Repository navigation
Conversation
Please consider the following formatting changes to AliceO2Group#18677
|
O2 linter results: ❌ 0 errors, |
|
Error while checking build/O2Physics/o2 for be49428 at 2026-11-13 07:50: Full log here. |
|
Error while checking build/O2Physics/code-check for be49428 at 2026-11-19 03:26: Full log here. |
ariedel-cern
left a comment
There was a problem hiding this comment.
Hi @yakparo ,
many thanks for preparing this PR. There are some issues with the data model of the sigma0 and the builder.
Here are the 2 main points:
- It does not provide useful information to store the index of the daughter lambda and its decay products for the sigma0. I would suggest doing it the way we do it for cascades, where we only store the indices of the daughter tracks. That is all the information necessary for pair cleaning/CPR/CTR.
- Please check how TwoTrackResonance/TwoPhotonResonance builder are implemented. Apply selections on the daughters before they even enter the builder. Applying filters and bitmask by hand is way slower than using the Filter and Partitioning features of the O2 framework
| DECLARE_SOA_INDEX_COLUMN_FULL(Photon, photon, int32_t, FPhotons, "_photon"); ///< row in FPhotons | ||
| // id columns for Lambda daughter tracks | ||
| DECLARE_SOA_INDEX_COLUMN_FULL(PosDau, posDau, int32_t, FTracks, "_PosDau"); //! index column for positive daughter track | ||
| DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! index column for negative daughter track |
There was a problem hiding this comment.
I am not sure all these indices are necessary. For example, for Cascade we only store the indices to the the daughter tracks (the secondary lambda we dont care about much and the when we we do pair cleaning or CPR, we always check on the track level). So I would remove here the index of the lambda
| PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore | ||
| COMPONENT_NAME Analysis) | ||
|
|
||
| o2physics_add_dpl_workflow(femto-sigma0-producer |
There was a problem hiding this comment.
Please rename the task to femto-producer-sigma0 to use the same convention as for the other producer tasks
| sigma0builder::ConfSigma0Tables tables; | ||
| sigma0builder::Sigma0Builder sigma0Builder; | ||
|
|
||
| HistogramRegistry registry{"Sigma0", {}, OutputObjHandlingPolicy::AnalysisObject}; |
There was a problem hiding this comment.
Use a more descriptive name like FemtoProducerSigma0
There was a problem hiding this comment.
The registry name is irrelevant. It does not appear anywhere.
There was a problem hiding this comment.
And the other arguments are equal to the default ones which makes it redundant to write them.
| // { | ||
| // sigma0Builder.fillSigma0s(products, lambdas, photons, tracks); | ||
| // } | ||
| void process(Lambdas const& lambdas, Photons const& photons, o2::aod::FTracks const& tracks, o2::aod::FCols const& /**/, o2::aod::FColMasks const& /**/, o2::aod::FTrackMasks const& /**/) |
There was a problem hiding this comment.
This does not seem correct. Like this you would pare every lambda with every photon in every collision.
There was a problem hiding this comment.
You have to subscribe to the collision iterate first to group the other tables by the collision index. then you can pare all particle in one collision to search for sigma0 candidates.
| #include "PWGCF/Femto/Core/pairCleaner.h" | ||
| #include "PWGCF/Femto/Core/particleCleaner.h" | ||
| #include "PWGCF/Femto/Core/partitions.h" | ||
| // #include "PWGCF/Femto/Core/photonHistManager.h" |
There was a problem hiding this comment.
Please done leave code commented
| using FSigma0s = FSigma0s_001; | ||
|
|
||
| DECLARE_SOA_TABLE_STAGED_VERSIONED(FSigma0Masks_001, "FSIGMA0MASK", 1, //! sigma0 masks | ||
| femtosigma0s::Mask); |
There was a problem hiding this comment.
Here you should store the bitmask of the daugher lambda and photon
| // Preselect photons once and group their row indices by collision. | ||
| std::unordered_map<int64_t, std::vector<int64_t>> photonRowsPerCollision; | ||
| for (const auto& photon : photons) { | ||
| if (selectPhoton(photon)) { |
There was a problem hiding this comment.
Don't do it like that. Specify a selection bit for the lambda and photon, and then partition them before feeding them to the builder. Please check how the twotrackresonancebuilder or the twophotonresonance builder implements the reconstruction of resonances.
| return; | ||
| } | ||
|
|
||
| mPhotonMask = filter.photonMask.value; |
There was a problem hiding this comment.
Filters for the daughters should be applied outside of the builder with a Filter
| } | ||
|
|
||
| template <typename T> | ||
| bool selectLambda(T const& lambda) |
There was a problem hiding this comment.
Remove, This should all happen, filtering and partioning should happen outside of the builder
| template <typename TProducts, typename TLambda, typename TPhoton, typename TPosDau, typename TNegDau> | ||
| bool buildSigma0(TProducts& products, TLambda const& lambda, TPhoton const& photon, TPosDau const& posDau, TNegDau const& negDau) | ||
| { | ||
| const float lambdaPt = std::abs(lambda.signedPt()); |
There was a problem hiding this comment.
Please use ROOT::Math::PtEtaPhiMVector and then cache pt/eta/phi as class variables. Please check how twotrackresonance producer is implemented
|
Does not compile on macOS. |
|
@yakparo Please add your name on your GitHub profile. |
|
Error while checking build/O2Physics/code-check for 0560b75 at 2026-11-25 02:03: Full log here. |
| // Sigma0PhotonSelection.mask) is always added as the loosest selection, without a bit. | ||
| struct ConfSigma0Bits : o2::framework::ConfigurableGroup { | ||
| std::string prefix = std::string("Sigma0Bits"); | ||
| o2::framework::Configurable<std::vector<int>> lambdaMask{"lambdaMask", {}, "Bitmasks (decimal) on the Lambda mask, one bit of FSigma0Masks.maskLambda per entry"}; |
There was a problem hiding this comment.
Why are you passing a vector of integers? One int should be enough to select daughters with widest systematic selection
| class FilterHistogram | ||
| { | ||
| public: | ||
| void init(o2::framework::HistogramRegistry* registry, std::string_view name, std::vector<std::pair<std::string, std::string>> const& filters) | ||
| { | ||
| mNFilters = static_cast<int>(filters.size()); | ||
| mHist = registry->add<TH1>(std::string(name), "; Filter; Entries", o2::framework::HistType::kTH1F, {{mNFilters + 2, -0.5, mNFilters + 1.5}}); | ||
| auto* axis = mHist->GetXaxis(); | ||
| for (int i = 0; i < mNFilters; ++i) { | ||
| std::ostringstream label; | ||
| label << "FilterName" << selectioncontainer::ValueDelimiter << filters.at(i).first << selectioncontainer::SectionDelimiter | ||
| << "FilterValue" << selectioncontainer::ValueDelimiter << filters.at(i).second; | ||
| axis->SetBinLabel(i + 1, label.str().c_str()); | ||
| } | ||
| axis->SetBinLabel(mNFilters + 1, "All analyzed"); | ||
| axis->SetBinLabel(mNFilters + 2, "All passed"); | ||
| } | ||
|
|
||
| /// fill the bin of one filter bound if it is passed, returns the decision | ||
| bool fill(int filterIndex, bool passed) | ||
| { | ||
| if (passed) { | ||
| mHist->Fill(filterIndex); | ||
| } | ||
| return passed; | ||
| } | ||
|
|
||
| /// fill the summary bins, called once per candidate | ||
| void fillSummary(bool passedAll) | ||
| { | ||
| mHist->Fill(mNFilters); | ||
| if (passedAll) { | ||
| mHist->Fill(mNFilters + 1); | ||
| } | ||
| } | ||
|
|
||
| template <typename T> | ||
| static std::string toString(T value) | ||
| { | ||
| std::ostringstream oss; | ||
| oss << value; | ||
| return oss.str(); | ||
| } | ||
|
|
||
| template <typename T> | ||
| static std::string maskToString(T mask) | ||
| { | ||
| return std::to_string(static_cast<uint64_t>(mask)); | ||
| } | ||
|
|
||
| private: | ||
| std::shared_ptr<TH1> mHist; | ||
| int mNFilters = 0; | ||
| }; | ||
|
|
||
| // filters applied to the input collisions (Filter), Lambdas and photons (Partitions) of the producer | ||
| enum CollisionFilters { | ||
| kColVtxZMin, | ||
| kColVtxZMax, | ||
| kColMultMin, | ||
| kColMultMax, | ||
| kColCentMin, | ||
| kColCentMax, | ||
| kColMagFieldMin, | ||
| kColMagFieldMax, | ||
| kColMask, | ||
| kCollisionFiltersMax | ||
| }; | ||
|
|
||
| enum LambdaFilters { | ||
| kLambdaSign, | ||
| kLambdaPtMin, | ||
| kLambdaPtMax, | ||
| kLambdaEtaMin, | ||
| kLambdaEtaMax, | ||
| kLambdaPhiMin, | ||
| kLambdaPhiMax, | ||
| kLambdaMassMin, | ||
| kLambdaMassMax, | ||
| kLambdaMask, | ||
| kLambdaFiltersMax | ||
| }; | ||
|
|
||
| enum PhotonFilters { | ||
| kPhotonPtMin, | ||
| kPhotonPtMax, | ||
| kPhotonEtaMin, | ||
| kPhotonEtaMax, | ||
| kPhotonPhiMin, | ||
| kPhotonPhiMax, | ||
| kPhotonMask, | ||
| kPhotonFiltersMax | ||
| }; | ||
|
|
||
| // filters on the reconstructed Lambda-photon pair | ||
| enum Sigma0Filters { | ||
| kSigma0PtMin, | ||
| kSigma0PtMax, | ||
| kSigma0EtaMin, | ||
| kSigma0EtaMax, | ||
| kSigma0PhiMin, | ||
| kSigma0PhiMax, | ||
| kSigma0MassMin, | ||
| kSigma0MassMax, | ||
| kSigma0FiltersMax | ||
| }; | ||
|
|
||
| constexpr std::string_view CollisionFilterHistName = "hCollisionFilters"; | ||
| constexpr std::string_view LambdaFilterHistName = "hLambdaFilters"; | ||
| constexpr std::string_view PhotonFilterHistName = "hPhotonFilters"; | ||
| constexpr std::string_view Sigma0FilterHistName = "hSigma0Filters"; | ||
|
|
||
| // minimal QA histograms of the producer | ||
| constexpr char QaSigma0Mass[] = "Sigma0Qa/hSigma0Mass"; | ||
| constexpr char QaLambdaMass[] = "Sigma0Qa/hLambdaMass"; | ||
| constexpr char QaSigma0Pt[] = "Sigma0Qa/hSigma0Pt"; | ||
| constexpr char QaLambdaPt[] = "Sigma0Qa/hLambdaPt"; | ||
| constexpr char QaPhotonPt[] = "Sigma0Qa/hPhotonPt"; | ||
|
|
||
| /// \brief Documents the filters applied to the input tables of the (derived-to-derived) Sigma0 producer. | ||
| /// The filters themselves are applied by the Filter/Partitions of the producer; here they are re-evaluated on the full input | ||
| /// to fill the filter histograms. Lambdas and photons are only counted in collisions passing the collision filter. | ||
| class Sigma0InputFilters | ||
| { | ||
| public: | ||
| template <typename T1, typename T2, typename T3> | ||
| void init(o2::framework::HistogramRegistry* registry, T1 const& confCollision, T2 const& confLambda, T3 const& confPhoton) | ||
| { | ||
| mVtxZMin = confCollision.vtxZMin.value; | ||
| mVtxZMax = confCollision.vtxZMax.value; | ||
| mMultMin = confCollision.multMin.value; | ||
| mMultMax = confCollision.multMax.value; | ||
| mCentMin = confCollision.centMin.value; | ||
| mCentMax = confCollision.centMax.value; | ||
| mMagFieldMin = static_cast<int8_t>(confCollision.magFieldMin.value); | ||
| mMagFieldMax = static_cast<int8_t>(confCollision.magFieldMax.value); | ||
| mCollisionMask = confCollision.collisionMask.value; | ||
|
|
||
| mLambdaSign = confLambda.sign.value; | ||
| mLambdaPtMin = confLambda.ptMin.value; | ||
| mLambdaPtMax = confLambda.ptMax.value; | ||
| mLambdaEtaMin = confLambda.etaMin.value; | ||
| mLambdaEtaMax = confLambda.etaMax.value; | ||
| mLambdaPhiMin = confLambda.phiMin.value; | ||
| mLambdaPhiMax = confLambda.phiMax.value; | ||
| mLambdaMassMin = confLambda.massMin.value; | ||
| mLambdaMassMax = confLambda.massMax.value; | ||
| mLambdaMask = confLambda.mask.value; | ||
|
|
||
| mPhotonPtMin = confPhoton.ptMin.value; | ||
| mPhotonPtMax = confPhoton.ptMax.value; | ||
| mPhotonEtaMin = confPhoton.etaMin.value; | ||
| mPhotonEtaMax = confPhoton.etaMax.value; | ||
| mPhotonPhiMin = confPhoton.phiMin.value; | ||
| mPhotonPhiMax = confPhoton.phiMax.value; | ||
| mPhotonMask = confPhoton.mask.value; | ||
|
|
||
| mCollisionHist.init(registry, CollisionFilterHistName, | ||
| { | ||
| {"vtxZMin", FilterHistogram::toString(mVtxZMin)}, | ||
| {"vtxZMax", FilterHistogram::toString(mVtxZMax)}, | ||
| {"multMin", FilterHistogram::toString(mMultMin)}, | ||
| {"multMax", FilterHistogram::toString(mMultMax)}, | ||
| {"centMin", FilterHistogram::toString(mCentMin)}, | ||
| {"centMax", FilterHistogram::toString(mCentMax)}, | ||
| {"magFieldMin", FilterHistogram::toString(static_cast<int>(mMagFieldMin))}, | ||
| {"magFieldMax", FilterHistogram::toString(static_cast<int>(mMagFieldMax))}, | ||
| {"collisionMask", FilterHistogram::maskToString(mCollisionMask)}, | ||
| }); | ||
| mLambdaHist.init(registry, LambdaFilterHistName, | ||
| { | ||
| {"sign", FilterHistogram::toString(mLambdaSign)}, | ||
| {"ptMin", FilterHistogram::toString(mLambdaPtMin)}, | ||
| {"ptMax", FilterHistogram::toString(mLambdaPtMax)}, | ||
| {"etaMin", FilterHistogram::toString(mLambdaEtaMin)}, | ||
| {"etaMax", FilterHistogram::toString(mLambdaEtaMax)}, | ||
| {"phiMin", FilterHistogram::toString(mLambdaPhiMin)}, | ||
| {"phiMax", FilterHistogram::toString(mLambdaPhiMax)}, | ||
| {"massMin", FilterHistogram::toString(mLambdaMassMin)}, | ||
| {"massMax", FilterHistogram::toString(mLambdaMassMax)}, | ||
| {"mask", FilterHistogram::maskToString(mLambdaMask)}, | ||
| }); | ||
| mPhotonHist.init(registry, PhotonFilterHistName, | ||
| { | ||
| {"ptMin", FilterHistogram::toString(mPhotonPtMin)}, | ||
| {"ptMax", FilterHistogram::toString(mPhotonPtMax)}, | ||
| {"etaMin", FilterHistogram::toString(mPhotonEtaMin)}, | ||
| {"etaMax", FilterHistogram::toString(mPhotonEtaMax)}, | ||
| {"phiMin", FilterHistogram::toString(mPhotonPhiMin)}, | ||
| {"phiMax", FilterHistogram::toString(mPhotonPhiMax)}, | ||
| {"mask", FilterHistogram::maskToString(mPhotonMask)}, | ||
| }); |
There was a problem hiding this comment.
I see why you’d like to have these filter histograms, but adding dedicated process functions for them makes the builder more complicated than it needs to be.
I’d move the histogramming to a dedicated Sigma0 QA task. The twotrackresonanceqa task is a good starting point. You could then run the builder with two configurations, one with loose cuts and one with tight cuts, and use the same QA task to compare the resulting distributions. Or you just have one very open configuration in the builder and then apply all selections downstream in the Qa task. This keeps the builder focused on candidate reconstruction and selection while still letting you study the effect of tightening the cuts. (This has the added benefit of reusing the track and photon qa histogramming and getting histograms on all detector variables. Also, running different configurations via hyperloop is way more flexible)
| photon.globalIndex()); | ||
| } | ||
| if (mProduceSigma0Masks) { | ||
| products.producedSigma0Masks(mLambdaSelection.applySelections(lambda.mask()), mPhotonSelection.applySelections(photon.mask())); |
There was a problem hiding this comment.
This seems very wrong to me. If the candidate reaches this code, it should already be accepted, so you would just copy the lambda and photon masks. Why would you call applySelections here?
| kMass, | ||
| kSign, | ||
| kPtVsMass, | ||
| // qa variables (from FSigma0Extras) |
There was a problem hiding this comment.
These Qa histograms should already be filled in the Qa histograms of the daughers, why would plot them here again?
| products.producedSigma0Masks(mLambdaSelection.applySelections(lambda.mask()), mPhotonSelection.applySelections(photon.mask())); | ||
| } | ||
| if (mProduceSigma0Extras) { | ||
| if constexpr (requires { lambda.cosPa(); lambda.dauDca(); lambda.transRadius(); photon.cosPa(); photon.v0Radius(); photon.chi2Ndf(); }) { |
There was a problem hiding this comment.
Copying these values is not useful. When you run the Qa task, you already do the Qa of the daughters in their respective histogram manager.
Even if you would plot correlations between different variables of the daughters, you could still handle all that inside the histogram manager
| template <auto& Prefix> | ||
| struct ConfSigma0QaBinning : o2::framework::ConfigurableGroup { | ||
| std::string prefix = Prefix; | ||
| o2::framework::Configurable<bool> plot2d{"plot2d", true, "Enable 2d QA histograms"}; | ||
| o2::framework::ConfigurableAxis lambdaMass{"lambdaMass", {{200, 1., 1.2}}, "Mass of daughter Lambda"}; | ||
| o2::framework::ConfigurableAxis lambdaPt{"lambdaPt", {{600, 0, 6}}, "Pt of daughter Lambda"}; | ||
| o2::framework::ConfigurableAxis lambdaCosPa{"lambdaCosPa", {{100, 0.9, 1}}, "Cosine of pointing angle of daughter Lambda"}; | ||
| o2::framework::ConfigurableAxis lambdaDauDca{"lambdaDauDca", {{150, 0, 1.5}}, "DCA of Lambda daughters at Lambda decay vertex"}; | ||
| o2::framework::ConfigurableAxis lambdaTransRadius{"lambdaTransRadius", {{100, 0, 100}}, "Transverse radius of daughter Lambda decay vertex"}; | ||
| o2::framework::ConfigurableAxis photonPt{"photonPt", {{600, 0, 6}}, "Pt of daughter photon"}; | ||
| o2::framework::ConfigurableAxis photonCosPa{"photonCosPa", {{100, 0.9, 1}}, "Cosine of pointing angle of daughter photon"}; | ||
| o2::framework::ConfigurableAxis photonTransRadius{"photonTransRadius", {{180, 0, 90}}, "Transverse radius of photon conversion point"}; | ||
| o2::framework::ConfigurableAxis photonChi2Ndf{"photonChi2Ndf", {{100, 0, 50}}, "Chi2/NDF of photon conversion vertex"}; | ||
| o2::framework::ConfigurableAxis openingAngle{"openingAngle", {{180, 0, 1.f * o2::constants::math::PI}}, "Opening angle between Lambda and photon"}; | ||
| }; |
There was a problem hiding this comment.
This should all be handled by the hisotgram manager of the daughters
| {kTrueEtaVsEta, o2::framework::HistType::kTH2F, "hTrueEtaVsEta", "True pseudorapdity vs pseudorapdity; #eta_{True}; #eta"}, | ||
| {kTruePhiVsPhi, o2::framework::HistType::kTH2F, "hTruePhiVsPhi", "True azimuthal angle vs azimuthal angle; #varphi_{True}; #varphi"}}, | ||
| }; | ||
|
|
There was a problem hiding this comment.
You can check out the Qa for TwoParticleResonances.
The important Qa information is in the daughters, were dedicated histogram managers are already implemented.
| DECLARE_SOA_COLUMN(MaskLambda, maskLambda, o2::analysis::femto::datatypes::V0MaskType); //! Bitmask of the Lambda daughter | ||
| DECLARE_SOA_COLUMN(MaskPhoton, maskPhoton, o2::analysis::femto::datatypes::PhotonMaskType); //! Bitmask of the photon daughter | ||
|
|
||
| // columns for QA on dau info |
There was a problem hiding this comment.
These are not necessary. The daughters already carry that information and they are available during Qa, so we can just query this information directly from them
There was a problem hiding this comment.
Sorry, just realized we only keep track of the indices of the daughter tracks, so copying over the values for the daughter lambda makes sense. The values for the photons however you can alwayas query from the daughter directly.
| } | ||
|
|
||
| // documents the filters applied to the input tables, independent of the process function used to build the Sigma0s | ||
| void processInputFilters(FemtoCollisions const& cols, FemtoLambdas const& lambdas, FemtoPhotons const& photons) |
There was a problem hiding this comment.
As discussed above, this process function should not be necessary. Please also implement a dedicated Sigma0 Qa task
No description provided.