diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index dd022f91501..f787543f945 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -398,20 +398,66 @@ class CascadeBuilder continue; } + collisionBuilder.template fillCollision(collisionProducts, col); + // cleaner, but without ITS pid: auto bachelor = cascade.template bachelor_as(); auto bachelor = tracksWithItsPid.iteratorAt(cascade.bachelorId() - tracksWithItsPid.offset()); + bachelorIndex = trackBuilder.template getDaughterIndex(bachelor, trackProducts, collisionProducts); + // cleaner, but without ITS pid: auto posDaughter = cascade.template posTrack_as(); auto posDaughter = tracksWithItsPid.iteratorAt(cascade.posTrackId() - tracksWithItsPid.offset()); + posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts); + // cleaner, but without ITS pid: auto negDaughter = cascade.template negTrack_as(); auto negDaughter = tracksWithItsPid.iteratorAt(cascade.negTrackId() - tracksWithItsPid.offset()); + negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts); - collisionBuilder.template fillCollision(collisionProducts, col); + fillCascade(collisionProducts, cascadeProducts, cascade, col, bachelorIndex, posDaughterIndex, negDaughterIndex); + } + } - bachelorIndex = trackBuilder.template getDaughterIndex(bachelor, trackProducts, collisionProducts); - posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts); - negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts); + template + void fillMcCascades(T1 const& col, T2& collisionBuilder, T3& collisionProducts, T4 const& mcCols, T5& trackProducts, T6& cascadeProducts, T7 const& cascades, T8 const& tracks, T9 const& tracksWithItsPid, T10& trackBuilder, T11 const& mcParticles, T12& mcBuilder, T13& mcProducts) + { + if (!mFillAnyTable) { + return; + } + + int64_t bachelorIndex = 0; + int64_t posDaughterIndex = 0; + int64_t negDaughterIndex = 0; + for (const auto& cascade : cascades) { + if (!mCascadeSelection.checkFilters(cascade)) { + continue; + } + mCascadeSelection.applySelections(cascade, tracks, col); + if (!mCascadeSelection.passesAllRequiredSelections()) { + continue; + } + + collisionBuilder.template fillMcCollision(collisionProducts, col, mcCols, mcProducts, mcBuilder); + + auto bachelor = tracks.iteratorAt(cascade.bachelorId() - tracks.offset()); + auto bachelorWithItsPid = tracksWithItsPid.iteratorAt(cascade.bachelorId() - tracksWithItsPid.offset()); + bachelorIndex = trackBuilder.template getDaughterIndex(col, collisionProducts, mcCols, bachelor, bachelorWithItsPid, trackProducts, mcParticles, mcBuilder, mcProducts); + + auto posDaughter = tracks.iteratorAt(cascade.posTrackId() - tracks.offset()); + auto posDaughterWithItsPid = tracksWithItsPid.iteratorAt(cascade.posTrackId() - tracksWithItsPid.offset()); + posDaughterIndex = trackBuilder.template getDaughterIndex(col, collisionProducts, mcCols, posDaughter, posDaughterWithItsPid, trackProducts, mcParticles, mcBuilder, mcProducts); + + auto negDaughter = tracks.iteratorAt(cascade.negTrackId() - tracks.offset()); + auto negDaughterWithItsPid = tracksWithItsPid.iteratorAt(cascade.negTrackId() - tracksWithItsPid.offset()); + negDaughterIndex = trackBuilder.template getDaughterIndex(col, collisionProducts, mcCols, negDaughter, negDaughterWithItsPid, trackProducts, mcParticles, mcBuilder, mcProducts); fillCascade(collisionProducts, cascadeProducts, cascade, col, bachelorIndex, posDaughterIndex, negDaughterIndex); + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kXi)) { + mcBuilder.template fillMcXiWithLabel(col, mcCols, cascade, mcParticles, mcProducts); + ; + } + if constexpr (modes::isEqual(cascadeType, modes::Cascade::kOmega)) { + mcBuilder.template fillMcOmegaWithLabel(col, mcCols, cascade, mcParticles, mcProducts); + ; + } } } diff --git a/PWGCF/Femto/Core/cascadeHistManager.h b/PWGCF/Femto/Core/cascadeHistManager.h index e4bd045f7d5..e5c4e7c610e 100644 --- a/PWGCF/Femto/Core/cascadeHistManager.h +++ b/PWGCF/Femto/Core/cascadeHistManager.h @@ -49,6 +49,10 @@ enum CascadeHist { kCosPa, kDecayDauDca, kTransRadius, + kLambdaCosPa, + kLambdaDauDca, + kLambdaTransRadius, + kLambdaDcaToPv, // 2d qa kPtVsEta, kPtVsPhi, @@ -57,9 +61,29 @@ enum CascadeHist { kPtVsMassXi, kPtVsMassOmega, kMassXiVsMassOmega, + // mc + kOrigin, + kPdg, + kPdgMother, + kPdgPartonicMother, + kTruePtVsPt, + kTrueEtaVsEta, + kTruePhiVsPhi, + // histograms for fraction estimation of v0s + kNoMcParticle, + kPrimary, + kFromWrongCollision, + kFromMaterial, + kMissidentified, + kSecondary1, + kSecondary2, + kSecondary3, + kSecondaryOther, kCascadeHistLast }; +constexpr std::size_t MaxSecondary = 3; + template struct ConfCascadeBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; @@ -68,6 +92,7 @@ struct ConfCascadeBinning : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis phi{"phi", {{720, 0, 1.f * o2::constants::math::TwoPI}}, "Phi"}; o2::framework::ConfigurableAxis mass{"mass", {{1000, 1.f, 2.f}}, "Mass"}; o2::framework::ConfigurableAxis sign{"sign", {{3, -1.5, 1.5}}, "Sign"}; + o2::framework::ConfigurableAxis pdgCodes{"pdgCodes", {{8001, -4000.5, 4000.5}}, "MC ONLY: PDG codes of reconstructed cascades"}; }; constexpr const char PrefixXiBinning[] = "XiBinning"; @@ -84,6 +109,10 @@ struct ConfCascadeQaBinning : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis transRadius{"transRadius", {{100, 0, 100}}, "Transverse radius"}; o2::framework::ConfigurableAxis massXi{"massXi", {{400, 1.2f, 1.6f}}, "mass for antiparticle hypothesis"}; o2::framework::ConfigurableAxis massOmega{"massOmega", {{400, 1.4f, 1.8f}}, "mass for antiparticle hypothesis"}; + o2::framework::ConfigurableAxis lambdaCosPa{"lambdaCosPa", {{100, 0.9, 1}}, "Cosine of poiting angle of daughter lambda"}; + o2::framework::ConfigurableAxis lambdaDauDca{"lambdaDauDca", {{150, 0, 1.0}}, "DCA of lambda daughters at lambda decay vertex"}; + o2::framework::ConfigurableAxis lambdaTransRadius{"lambdaTransRadius", {{100, 0, 100}}, "DCA of lambda daughters at lambda decay vertex"}; + o2::framework::ConfigurableAxis lambdaDcaToPv{"lambdaDcaToPv", {{100, 0, 200}}, "DCA of lambda daughter from primary vertex"}; }; constexpr const char PrefixXiQaBinning[] = "XiQaBinning"; @@ -102,50 +131,124 @@ constexpr std::array, kCascadeHistLast> HistT {kSign, o2::framework::kTH1F, "hSign", "Sign (-1 -> antiparticle, 0 -> self conjugate, +1 -> particle); sign; Entries"}, {kMassXi, o2::framework::kTH1F, "hMassXi", "Mass #Xi; m_{#Lambda#pi} (GeV/#it{c}^{2}); Entries"}, {kMassOmega, o2::framework::kTH1F, "hMassOmega", "mass #Omega; m_{#LambdaK} (GeV/#it{c}^{2}); Entries"}, - {kCosPa, o2::framework::kTH1F, "hCosPa", "Cosine of pointing angle; coa(#alpha); Entries"}, + {kCosPa, o2::framework::kTH1F, "hCosPa", "Cosine of pointing angle; cos(#alpha); Entries"}, {kDecayDauDca, o2::framework::kTH1F, "hDauDca", "Daughter DCA at decay vertex ; DCA_{Decay vertex} (cm); Entries"}, {kTransRadius, o2::framework::kTH1F, "hTransRadius", "Transverse radius ; r_{xy} (cm); Entries"}, + {kLambdaCosPa, o2::framework::kTH1F, "hLambdaCosPa", "Cosine of poiting angle of daughter lambda ; cos_{#Lambda}(#alpha); Entries"}, + {kLambdaDauDca, o2::framework::kTH1F, "hLambdaDauDca", "Daughter DCA at #Lambda decay vertex ; DCA_{#Lambda decay vertex} (cm); Entries"}, + {kLambdaTransRadius, o2::framework::kTH1F, "hLambdaTransRadius", "Transverse radius of daughter #Lambda ; r_{xy} (cm); Entries"}, + {kLambdaDcaToPv, o2::framework::kTH1F, "hLambdaDcaToPv", "DCA to primary vertex of daughter #Lambda ; DCA (cm); Entries"}, {kPtVsEta, o2::framework::kTH2F, "hPtVsEta", "p_{T} vs #eta; p_{T} (GeV/#it{c}) ; #eta"}, {kPtVsPhi, o2::framework::kTH2F, "hPtVsPhi", "p_{T} vs #varphi; p_{T} (GeV/#it{c}) ; #varphi"}, {kPhiVsEta, o2::framework::kTH2F, "hPhiVsEta", "#varphi vs #eta; #varphi ; #eta"}, {kPtVsCosPa, o2::framework::kTH2F, "hPtVsCosPa", "Cosine of poiting angle vs p_{T}; cos(#alpha); p_{T} (GeV/#it{c})"}, {kPtVsMassXi, o2::framework::kTH2F, "hPtVsMassXi", "p_{T} vs mass #Xi; p_{T} (GeV/#it{c}); m_{#Lambda#pi} (GeV/#it{c}^{2})"}, {kPtVsMassOmega, o2::framework::kTH2F, "hPtVsMassOmega", "p_{T} vs mass #Omega; p_{T} (GeV/#it{c}); m_{#LambdaK} (GeV/#it{c}^{2})"}, - {kMassXiVsMassOmega, o2::framework::kTH2F, "hMassXiVsMassOmega", "mass #Xi vs mass #Omega; m_{#Lambda#pi} (GeV/#it{c}^{2}); m_{#LambdaK} (GeV/#it{c}^{2})"}}}; + {kMassXiVsMassOmega, o2::framework::kTH2F, "hMassXiVsMassOmega", "mass #Xi vs mass #Omega; m_{#Lambda#pi} (GeV/#it{c}^{2}); m_{#LambdaK} (GeV/#it{c}^{2})"}, + {kOrigin, o2::framework::kTH1F, "hOrigin", "Status Codes (=Origin); Status Code; Entries"}, + {kPdg, o2::framework::kTH1F, "hPdg", "PDG Codes of reconstructed v0; PDG Code; Entries"}, + {kPdgMother, o2::framework::kTH1F, "hPdgMother", "PDG Codes of mother of reconstructed v0; PDG Code; Entries"}, + {kPdgPartonicMother, o2::framework::kTH1F, "hPdgPartonicMother", "PDG Codes of partonic mother of reconstructed v0; PDG Code; Entries"}, + {kTruePtVsPt, o2::framework::kTH2F, "hTruePtVsPt", "True transverse momentum vs transverse momentum; p_{T,True} (GeV/#it{c}); p_{T,True} (GeV/#it{c})"}, + {kTrueEtaVsEta, o2::framework::kTH2F, "hTrueEtaVsEta", "True pseudorapdity vs pseudorapdity; #eta_{True}; #eta"}, + {kTruePhiVsPhi, o2::framework::kTH2F, "hTruePhiVsPhi", "True azimuthal angle vs azimuthal angle; #varphi_{True}; #varphi"}, + {kNoMcParticle, o2::framework::kTH2F, "hNoMcParticle", "Wrongly reconstructed particles; p_{T} (GeV/#it{c}); cos(#alpha)"}, + {kPrimary, o2::framework::kTH2F, "hPrimary", "Primary particles; p_{T} (GeV/#it{c}); cos(#alpha)"}, + {kFromWrongCollision, o2::framework::kTH2F, "hFromWrongCollision", "Particles associated to wrong collision; p_{T} (GeV/#it{c}); cos(#alpha)"}, + {kFromMaterial, o2::framework::kTH2F, "hFromMaterial", "Particles from material; p_{T} (GeV/#it{c}); cos(#alpha)"}, + {kMissidentified, o2::framework::kTH2F, "hMissidentified", "Missidentified particles (fake/wrong PDG code); p_{T} (GeV/#it{c}); cos(#alpha)"}, + {kSecondary1, o2::framework::kTH2F, "hFromSecondary1", "Particles from secondary decay; p_{T} (GeV/#it{c}); cos(#alpha)"}, + {kSecondary2, o2::framework::kTH2F, "hFromSecondary2", "Particles from seconary decay; p_{T} (GeV/#it{c}); cos(#alpha)"}, + {kSecondary3, o2::framework::kTH2F, "hFromSecondary3", "Particles from seconary decay; p_{T} (GeV/#it{c}); cos(#alpha)"}, + {kSecondaryOther, o2::framework::kTH2F, "hFromSecondaryOther", "Particles from every other seconary decay; p_{T} (GeV/#it{c}); cos(#alpha)"}}, +}; + +#define CASCADE_HIST_ANALYSIS_MAP(conf) \ + {kPt, {conf.pt}}, \ + {kEta, {conf.eta}}, \ + {kPhi, {conf.phi}}, \ + {kMass, {conf.mass}}, \ + {kSign, {conf.sign}}, + +#define CASCADE_HIST_MC_MAP(conf) \ + {kTruePtVsPt, {conf.pt, conf.pt}}, \ + {kTrueEtaVsEta, {conf.eta, conf.eta}}, \ + {kTruePhiVsPhi, {conf.phi, conf.phi}}, \ + {kPdg, {conf.pdgCodes}}, \ + {kPdgMother, {conf.pdgCodes}}, \ + {kPdgPartonicMother, {conf.pdgCodes}}, + +#define CASCADE_HIST_QA_MAP(confAnalysis, confQa) \ + {kPt, {confAnalysis.pt}}, \ + {kEta, {confAnalysis.eta}}, \ + {kPhi, {confAnalysis.phi}}, \ + {kMass, {confAnalysis.mass}}, \ + {kSign, {confAnalysis.sign}}, \ + {kCosPa, {confQa.cosPa}}, \ + {kDecayDauDca, {confQa.dauDcaAtDecay}}, \ + {kTransRadius, {confQa.transRadius}}, \ + {kLambdaCosPa, {confQa.lambdaCosPa}}, \ + {kLambdaDauDca, {confQa.lambdaDauDca}}, \ + {kLambdaTransRadius, {confQa.lambdaTransRadius}}, \ + {kLambdaDcaToPv, {confQa.lambdaDcaToPv}}, \ + {kPtVsEta, {confAnalysis.pt, confAnalysis.eta}}, \ + {kPtVsPhi, {confAnalysis.pt, confAnalysis.phi}}, \ + {kPhiVsEta, {confAnalysis.phi, confAnalysis.eta}}, \ + {kPtVsCosPa, {confAnalysis.pt, confQa.cosPa}}, \ + {kMassXi, {confQa.massXi}}, \ + {kMassOmega, {confQa.massOmega}}, \ + {kPtVsMassXi, {confAnalysis.pt, confQa.massXi}}, \ + {kPtVsMassOmega, {confAnalysis.pt, confQa.massOmega}}, \ + {kMassXiVsMassOmega, {confQa.massXi, confQa.massOmega}}, + +#define CASCADE_HIST_MC_QA_MAP(confAnalysis, confQa) \ + {kNoMcParticle, {confAnalysis.pt, confQa.cosPa}}, \ + {kPrimary, {confAnalysis.pt, confQa.cosPa}}, \ + {kFromWrongCollision, {confAnalysis.pt, confQa.cosPa}}, \ + {kFromMaterial, {confAnalysis.pt, confQa.cosPa}}, \ + {kMissidentified, {confAnalysis.pt, confQa.cosPa}}, \ + {kSecondary1, {confAnalysis.pt, confQa.cosPa}}, \ + {kSecondary2, {confAnalysis.pt, confQa.cosPa}}, \ + {kSecondary3, {confAnalysis.pt, confQa.cosPa}}, \ + {kSecondaryOther, {confAnalysis.pt, confQa.cosPa}}, template auto makeCascadeHistSpecMap(const T& confBinningAnalysis) { return std::map>{ - {kPt, {confBinningAnalysis.pt}}, - {kEta, {confBinningAnalysis.eta}}, - {kPhi, {confBinningAnalysis.phi}}, - {kMass, {confBinningAnalysis.mass}}, - {kSign, {confBinningAnalysis.sign}}}; + CASCADE_HIST_ANALYSIS_MAP(confBinningAnalysis)}; +} + +template +auto makeCascadeMcHistSpecMap(const T& confBinningAnalysis) +{ + return std::map>{ + CASCADE_HIST_ANALYSIS_MAP(confBinningAnalysis) + CASCADE_HIST_MC_MAP(confBinningAnalysis)}; } template std::map> makeCascadeQaHistSpecMap(T1 const& confBinningAnalysis, T2 const& confBinningQa) { return std::map>{ - {kPt, {confBinningAnalysis.pt}}, - {kEta, {confBinningAnalysis.eta}}, - {kPhi, {confBinningAnalysis.phi}}, - {kMass, {confBinningAnalysis.mass}}, - {kSign, {confBinningAnalysis.sign}}, - {kCosPa, {confBinningQa.cosPa}}, - {kDecayDauDca, {confBinningQa.dauDcaAtDecay}}, - {kTransRadius, {confBinningQa.transRadius}}, - {kPtVsEta, {confBinningAnalysis.pt, confBinningAnalysis.eta}}, - {kPtVsPhi, {confBinningAnalysis.pt, confBinningAnalysis.phi}}, - {kPhiVsEta, {confBinningAnalysis.phi, confBinningAnalysis.eta}}, - {kPtVsCosPa, {confBinningAnalysis.pt, confBinningQa.cosPa}}, - {kMassXi, {confBinningQa.massXi}}, - {kMassOmega, {confBinningQa.massOmega}}, - {kPtVsMassXi, {confBinningAnalysis.pt, confBinningQa.massXi}}, - {kPtVsMassOmega, {confBinningAnalysis.pt, confBinningQa.massOmega}}, - {kMassXiVsMassOmega, {confBinningQa.massXi, confBinningQa.massOmega}}}; -}; + CASCADE_HIST_ANALYSIS_MAP(confBinningAnalysis) + CASCADE_HIST_QA_MAP(confBinningAnalysis, confBinningQa)}; +} + +template +std::map> makeCascadeMcQaHistSpecMap(T1 const& confBinningAnalysis, T2 const& confBinningQa) +{ + return std::map>{ + CASCADE_HIST_ANALYSIS_MAP(confBinningAnalysis) + CASCADE_HIST_QA_MAP(confBinningAnalysis, confBinningQa) + CASCADE_HIST_MC_MAP(confBinningAnalysis) + CASCADE_HIST_MC_QA_MAP(confBinningAnalysis, confBinningQa)}; +} + +#undef CASCADE_HIST_ANALYSIS_MAP +#undef CASCADE_HIST_MC_MAP +#undef CASCADE_HIST_QA_MAP +#undef CASCADE_HIST_MC_QA_MAP constexpr char PrefixXiQa[] = "XiQA/"; constexpr char PrefixXi[] = "Xi/"; @@ -156,8 +259,7 @@ constexpr char PrefixLambdaCascade[] = "LambdaCascadeQa/"; constexpr std::string_view AnalysisDir = "Kinematics/"; constexpr std::string_view QaDir = "QA/"; - -constexpr int AbsChargeDaughters = 1; +constexpr std::string_view McDir = "MC/"; /// \class FemtoDreamEventHisto /// \brief Class for histogramming event properties @@ -199,7 +301,7 @@ class CascadeHistManager posDauPdgCodeAbs = std::abs(PDG_t::kProton); negDauPdgCodeAbs = std::abs(PDG_t::kPiMinus); } else { - mPdgCode = -1 * mPdgCode; // Xi+ has negative pdg code + mPdgCode = -1 * mPdgCode; // Xi+ has negative pdg code because it is the anti particle bachelorPdgCodeAbs = std::abs(PDG_t::kPiPlus); signBachelor = 1; posDauPdgCodeAbs = std::abs(PDG_t::kPiPlus); @@ -212,7 +314,7 @@ class CascadeHistManager posDauPdgCodeAbs = std::abs(PDG_t::kProton); negDauPdgCodeAbs = std::abs(PDG_t::kPiMinus); } else { - mPdgCode = -1 * mPdgCode; // Omega+ has negative pdg code + mPdgCode = -1 * mPdgCode; // Omega+ has negative pdg code because it is the anti particle bachelorPdgCodeAbs = std::abs(PDG_t::kKPlus); signBachelor = 1; posDauPdgCodeAbs = std::abs(PDG_t::kPiPlus); @@ -229,6 +331,9 @@ class CascadeHistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { initAnalysis(cascadeSpecs); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { + this->initMc(cascadeSpecs); + } } template @@ -295,15 +400,14 @@ class CascadeHistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { initQa(cascadeSpecs); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { + this->initMc(cascadeSpecs); + } } template void fill(T1 const& cascadeCandidate, T2 const& tracks) { - // this used to work, still under investigation - // auto bachelor = cascadeCandidate.template bachelor_as(); - // auto posDaughter = cascadeCandidate.template posDau_as(); - // auto negDaughter = cascadeCandidate.template negDau_as(); auto posDaughter = tracks.rawIteratorAt(cascadeCandidate.posDauId() - tracks.offset()); mPosDauManager.template fill(posDaughter, tracks); auto negDaughter = tracks.rawIteratorAt(cascadeCandidate.negDauId() - tracks.offset()); @@ -319,6 +423,27 @@ class CascadeHistManager } } + template + void fill(T1 const& cascadeCandidate, T2 const& tracks, T3 const& mcParticles, T4 const& mcMothers, T5 const& mcPartonicMothers) + { + auto posDaughter = tracks.rawIteratorAt(cascadeCandidate.posDauId() - tracks.offset()); + mPosDauManager.template fill(posDaughter, tracks, mcParticles, mcMothers, mcPartonicMothers); + auto negDaughter = tracks.rawIteratorAt(cascadeCandidate.negDauId() - tracks.offset()); + mNegDauManager.template fill(negDaughter, tracks, mcParticles, mcMothers, mcPartonicMothers); + auto bachelor = tracks.rawIteratorAt(cascadeCandidate.bachelorId() - tracks.offset()); + mBachelorManager.template fill(bachelor, tracks, mcParticles, mcMothers, mcPartonicMothers); + + if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { + this->fillAnalysis(cascadeCandidate); + } + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + this->fillQa(cascadeCandidate); + } + if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { + this->template fillMc(cascadeCandidate, mcParticles, mcMothers, mcPartonicMothers); + } + } + private: template void enableOptionalHistograms(T const& CascadeConfBinningQa) @@ -342,6 +467,10 @@ class CascadeHistManager mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {cascadeSpecs.at(kCosPa)}); mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {cascadeSpecs.at(kDecayDauDca)}); mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {cascadeSpecs.at(kTransRadius)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kLambdaCosPa, HistTable), getHistDesc(kLambdaCosPa, HistTable), getHistType(kLambdaCosPa, HistTable), {cascadeSpecs.at(kLambdaCosPa)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kLambdaDauDca, HistTable), getHistDesc(kLambdaDauDca, HistTable), getHistType(kLambdaDauDca, HistTable), {cascadeSpecs.at(kLambdaDauDca)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kLambdaTransRadius, HistTable), getHistDesc(kLambdaTransRadius, HistTable), getHistType(kLambdaTransRadius, HistTable), {cascadeSpecs.at(kLambdaTransRadius)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kLambdaDcaToPv, HistTable), getHistDesc(kLambdaDcaToPv, HistTable), getHistType(kLambdaDcaToPv, HistTable), {cascadeSpecs.at(kLambdaDcaToPv)}); mHistogramRegistry->add(qaDir + getHistNameV2(kMassXi, HistTable), getHistDesc(kMassXi, HistTable), getHistType(kMassXi, HistTable), {cascadeSpecs.at(kMassXi)}); mHistogramRegistry->add(qaDir + getHistNameV2(kMassOmega, HistTable), getHistDesc(kMassOmega, HistTable), getHistType(kMassOmega, HistTable), {cascadeSpecs.at(kMassOmega)}); @@ -357,6 +486,47 @@ class CascadeHistManager } } + void initMc(std::map> const& V0Specs) + { + std::string mcDir = std::string(cascadePrefix) + std::string(McDir); + mHistogramRegistry->add(mcDir + getHistNameV2(kTruePtVsPt, HistTable), getHistDesc(kTruePtVsPt, HistTable), getHistType(kTruePtVsPt, HistTable), {V0Specs.at(kTruePtVsPt)}); + mHistogramRegistry->add(mcDir + getHistNameV2(kTrueEtaVsEta, HistTable), getHistDesc(kTrueEtaVsEta, HistTable), getHistType(kTrueEtaVsEta, HistTable), {V0Specs.at(kTrueEtaVsEta)}); + mHistogramRegistry->add(mcDir + getHistNameV2(kTruePhiVsPhi, HistTable), getHistDesc(kTruePhiVsPhi, HistTable), getHistType(kTruePhiVsPhi, HistTable), {V0Specs.at(kTruePhiVsPhi)}); + + // mc origin can be configured here + const framework::AxisSpec axisOrigin = {static_cast(modes::McOrigin::kMcOriginLast), -0.5, static_cast(modes::McOrigin::kMcOriginLast) - 0.5}; + mHistogramRegistry->add(mcDir + getHistNameV2(kOrigin, HistTable), getHistDesc(kOrigin, HistTable), getHistType(kOrigin, HistTable), {axisOrigin}); + mHistogramRegistry->get(HIST(cascadePrefix) + HIST(McDir) + HIST(histmanager::getHistName(kOrigin, HistTable)))->GetXaxis()->SetBinLabel(1 + static_cast(modes::McOrigin::kNoMcParticle), modes::mcOriginToString(modes::McOrigin::kNoMcParticle)); + mHistogramRegistry->get(HIST(cascadePrefix) + HIST(McDir) + HIST(histmanager::getHistName(kOrigin, HistTable)))->GetXaxis()->SetBinLabel(1 + static_cast(modes::McOrigin::kFromWrongCollision), modes::mcOriginToString(modes::McOrigin::kFromWrongCollision)); + mHistogramRegistry->get(HIST(cascadePrefix) + HIST(McDir) + HIST(histmanager::getHistName(kOrigin, HistTable)))->GetXaxis()->SetBinLabel(1 + static_cast(modes::McOrigin::kPhysicalPrimary), modes::mcOriginToString(modes::McOrigin::kPhysicalPrimary)); + mHistogramRegistry->get(HIST(cascadePrefix) + HIST(McDir) + HIST(histmanager::getHistName(kOrigin, HistTable)))->GetXaxis()->SetBinLabel(1 + static_cast(modes::McOrigin::kFromSecondaryDecay), modes::mcOriginToString(modes::McOrigin::kFromSecondaryDecay)); + mHistogramRegistry->get(HIST(cascadePrefix) + HIST(McDir) + HIST(histmanager::getHistName(kOrigin, HistTable)))->GetXaxis()->SetBinLabel(1 + static_cast(modes::McOrigin::kFromMaterial), modes::mcOriginToString(modes::McOrigin::kFromMaterial)); + mHistogramRegistry->get(HIST(cascadePrefix) + HIST(McDir) + HIST(histmanager::getHistName(kOrigin, HistTable)))->GetXaxis()->SetBinLabel(1 + static_cast(modes::McOrigin::kMissidentified), modes::mcOriginToString(modes::McOrigin::kMissidentified)); + + mHistogramRegistry->add(mcDir + getHistNameV2(kPdg, HistTable), getHistDesc(kPdg, HistTable), getHistType(kPdg, HistTable), {V0Specs.at(kPdg)}); + mHistogramRegistry->add(mcDir + getHistNameV2(kPdgMother, HistTable), getHistDesc(kPdgMother, HistTable), getHistType(kPdgMother, HistTable), {V0Specs.at(kPdgMother)}); + mHistogramRegistry->add(mcDir + getHistNameV2(kPdgPartonicMother, HistTable), getHistDesc(kPdgPartonicMother, HistTable), getHistType(kPdgPartonicMother, HistTable), {V0Specs.at(kPdgPartonicMother)}); + + if (mPlotOrigins) { + mHistogramRegistry->add(mcDir + getHistNameV2(kNoMcParticle, HistTable), getHistDesc(kNoMcParticle, HistTable), getHistType(kNoMcParticle, HistTable), {V0Specs.at(kNoMcParticle)}); + mHistogramRegistry->add(mcDir + getHistNameV2(kPrimary, HistTable), getHistDesc(kPrimary, HistTable), getHistType(kPrimary, HistTable), {V0Specs.at(kPrimary)}); + mHistogramRegistry->add(mcDir + getHistNameV2(kFromWrongCollision, HistTable), getHistDesc(kFromWrongCollision, HistTable), getHistType(kFromWrongCollision, HistTable), {V0Specs.at(kFromWrongCollision)}); + mHistogramRegistry->add(mcDir + getHistNameV2(kFromMaterial, HistTable), getHistDesc(kFromMaterial, HistTable), getHistType(kFromMaterial, HistTable), {V0Specs.at(kFromMaterial)}); + mHistogramRegistry->add(mcDir + getHistNameV2(kMissidentified, HistTable), getHistDesc(kMissidentified, HistTable), getHistType(kMissidentified, HistTable), {V0Specs.at(kMissidentified)}); + + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel1) { + mHistogramRegistry->add(mcDir + getHistNameV2(kSecondary1, HistTable), getHistDesc(kSecondary1, HistTable), getHistType(kSecondary1, HistTable), {V0Specs.at(kSecondary1)}); + } + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel2) { + mHistogramRegistry->add(mcDir + getHistNameV2(kSecondary2, HistTable), getHistDesc(kSecondary2, HistTable), getHistType(kSecondary2, HistTable), {V0Specs.at(kSecondary2)}); + } + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel3) { + mHistogramRegistry->add(mcDir + getHistNameV2(kSecondary3, HistTable), getHistDesc(kSecondary3, HistTable), getHistType(kSecondary3, HistTable), {V0Specs.at(kSecondary3)}); + } + mHistogramRegistry->add(mcDir + getHistNameV2(kSecondaryOther, HistTable), getHistDesc(kSecondaryOther, HistTable), getHistType(kSecondaryOther, HistTable), {V0Specs.at(kSecondaryOther)}); + } + } + template void fillAnalysis(T const& cascadeCandidate) { @@ -383,6 +553,10 @@ class CascadeHistManager mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), cascadeCandidate.cascadeCosPa()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), cascadeCandidate.cascadeDauDca()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), cascadeCandidate.cascadeTransRadius()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kLambdaCosPa, HistTable)), cascadeCandidate.lambdaCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kLambdaDauDca, HistTable)), cascadeCandidate.lambdaDauDca()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kLambdaTransRadius, HistTable)), cascadeCandidate.lambdaTransRadius()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kLambdaDcaToPv, HistTable)), cascadeCandidate.lambdaDcaToPv()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassXi, HistTable)), massXi); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassOmega, HistTable)), massOmega); @@ -397,12 +571,107 @@ class CascadeHistManager } } + template + void fillMc(T1 const& cascadeCandidate, T2 const& /*mcParticles*/, T3 const& /*mcMothers*/, T4 const& /*mcPartonicMothers*/) + { + // No MC Particle + if (!cascadeCandidate.has_fMcParticle()) { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kPdg, HistTable)), 0); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kOrigin, HistTable)), static_cast(modes::McOrigin::kNoMcParticle)); + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + if (mPlotOrigins) { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kNoMcParticle, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + } + } + return; + } + + // Retrieve MC particle + auto mcParticle = cascadeCandidate.template fMcParticle_as(); + + // missidentifed particles are special case + // whether a particle is missidentfied or not cannot be known by the producer so we check it here + bool isMissidentified = mcParticle.pdgCode() != mPdgCode; + + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kTruePtVsPt, HistTable)), mcParticle.pt(), cascadeCandidate.pt()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kTrueEtaVsEta, HistTable)), mcParticle.eta(), cascadeCandidate.eta()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kTruePhiVsPhi, HistTable)), mcParticle.phi(), cascadeCandidate.phi()); + if (isMissidentified) { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kOrigin, HistTable)), static_cast(modes::McOrigin::kMissidentified)); + } else { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kOrigin, HistTable)), mcParticle.origin()); + } + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kPdg, HistTable)), mcParticle.pdgCode()); + + // get mother + if (cascadeCandidate.has_fMcMother()) { + auto mother = cascadeCandidate.template fMcMother_as(); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kPdgMother, HistTable)), mother.pdgCode()); + } else { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kPdgMother, HistTable)), 0); + } + + // get partonic mother + if (cascadeCandidate.has_fMcPartMoth()) { + auto partonicMother = cascadeCandidate.template fMcPartMoth_as(); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kPdgPartonicMother, HistTable)), partonicMother.pdgCode()); + } else { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kPdgPartonicMother, HistTable)), 0); + } + + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + if (mPlotOrigins) { + // check first if particle is missidentified + if (isMissidentified) { + // if it is, we fill it as such + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kMissidentified, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + } else { + // if not, we fill it acccoridng to its origin + switch (static_cast(mcParticle.origin())) { + case modes::McOrigin::kPhysicalPrimary: + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kPrimary, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + break; + case modes::McOrigin::kFromWrongCollision: + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kFromWrongCollision, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + break; + case modes::McOrigin::kFromMaterial: + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kFromMaterial, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + break; + case modes::McOrigin::kFromSecondaryDecay: + if (cascadeCandidate.has_fMcMother()) { + auto mother = cascadeCandidate.template fMcMother_as(); + int motherPdgCode = std::abs(mother.pdgCode()); + // Switch on PDG of the mother + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel1 && motherPdgCode == mPdgCodesSecondaryMother[0]) { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kSecondary1, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + } else if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel2 && motherPdgCode == mPdgCodesSecondaryMother[1]) { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kSecondary2, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + } else if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel3 && motherPdgCode == mPdgCodesSecondaryMother[2]) { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kSecondary3, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + } else { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kSecondaryOther, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + } + } + break; + default: + LOG(warn) << "Encounted partilce with unknown origin!"; + break; + } + } + } + } + } + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; - bool mPlot2d = true; + int mPdgCode = 0; + bool mPlotOrigins = false; + int mPlotNSecondaries = 0; + std::array mPdgCodesSecondaryMother = {0}; + bool mPlot2d = false; + trackhistmanager::TrackHistManager mBachelorManager; trackhistmanager::TrackHistManager mPosDauManager; trackhistmanager::TrackHistManager mNegDauManager; - int mPdgCode = 0; }; }; // namespace cascadehistmanager }; // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 1739fdefa5e..90bbf9b7f46 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -214,15 +214,15 @@ class CloseTrackRejection mDeta = track1.eta() - track2.eta(); for (size_t i = 0; i < TpcRadii.size(); i++) { - auto phistar1 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack1 * track1.signedPt(), track1.phi()); - auto phistar2 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack2 * track2.signedPt(), track2.phi()); + auto phistar1 = phistar(mMagField, TpcRadii[i], mChargeAbsTrack1 * track1.signedPt(), track1.phi()); + auto phistar2 = phistar(mMagField, TpcRadii[i], mChargeAbsTrack2 * track2.signedPt(), track2.phi()); if (phistar1 && phistar2) { mDphistar.at(i) = RecoDecay::constrainAngle(phistar1.value() - phistar2.value(), -o2::constants::math::PI); // constrain angular difference between -pi and pi mDphistarMask.at(i) = true; count++; } } - // for small momemeta the calculation of phistar might fail, if the particle did not reach a certain radius + // for small momemeta the calculation of phistar might fail, if the particle did not reach one or more of the outer radii if (count > 0) { mAverageDphistar = std::accumulate(mDphistar.begin(), mDphistar.end(), 0.f) / count; // only average values if phistar could be computed } else { @@ -309,6 +309,16 @@ class CloseTrackRejection bool isActivated() const { return mIsActivated; } private: + std::optional phistar(float magfield, float radius, float signedPt, float phi) + { + double arg = 0.3 * (0.1 * magfield) * (0.01 * radius) / (2. * signedPt); + if (std::fabs(arg) <= 1.) { + double phistar = phi - std::asin(arg); + return static_cast(RecoDecay::constrainAngle(phistar)); + } + return std::nullopt; + } + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; bool mPlotAllRadii = false; bool mPlotAverage = false; diff --git a/PWGCF/Femto/Core/closeTripletRejection.h b/PWGCF/Femto/Core/closeTripletRejection.h index e929f0c4078..9a678032a97 100644 --- a/PWGCF/Femto/Core/closeTripletRejection.h +++ b/PWGCF/Femto/Core/closeTripletRejection.h @@ -47,6 +47,9 @@ template void init(o2::framework::HistogramRegistry* registry, std::map> const& specs, diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index 0d094bc5abf..bdd471d16c6 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -225,7 +225,7 @@ class CollisionSelection : public BaseSelection void setSphericity(T tracks) { - mSphericity = utils::sphericity(tracks); + mSphericity = computeSphericity(tracks); } float getSphericity() const { return mSphericity; } @@ -312,6 +312,39 @@ class CollisionSelection : public BaseSelection + float computeSphericity(T const& tracks) + { + int minNumberTracks = 2; + double maxSphericity = 2.f; + if (tracks.size() <= minNumberTracks) { + return maxSphericity; + } + // Initialize the transverse momentum tensor components + double sxx = 0.; + double syy = 0.; + double sxy = 0.; + double sumPt = 0.; + // Loop over the tracks to compute the tensor components + for (const auto& track : tracks) { + sxx += (track.px() * track.px()) / track.pt(); + syy += (track.py() * track.py()) / track.pt(); + sxy += (track.px() * track.py()) / track.pt(); + sumPt += track.pt(); + } + sxx /= sumPt; + syy /= sumPt; + sxy /= sumPt; + // Compute the eigenvalues (real values) + double lambda1 = ((sxx + syy) + std::sqrt((sxx + syy) * (sxx + syy) - 4. * (sxx * syy - sxy * sxy))) / 2.; + double lambda2 = ((sxx + syy) - std::sqrt((sxx + syy) * (sxx + syy) - 4. * (sxx * syy - sxy * sxy))) / 2.; + if (lambda1 <= 0. || lambda2 <= 0.) { + return maxSphericity; + } + // Compute sphericity + return static_cast(2. * lambda2 / (lambda1 + lambda2)); + } + // filter cuts float mVtxZMin = -12.f; float mVtxZMax = -12.f; diff --git a/PWGCF/Femto/Core/femtoUtils.h b/PWGCF/Femto/Core/femtoUtils.h index abd53f2bc75..5f9da9ab910 100644 --- a/PWGCF/Femto/Core/femtoUtils.h +++ b/PWGCF/Femto/Core/femtoUtils.h @@ -16,11 +16,8 @@ #ifndef PWGCF_FEMTO_CORE_FEMTOUTILS_H_ #define PWGCF_FEMTO_CORE_FEMTOUTILS_H_ -#include "RecoDecay.h" - #include "Common/Core/TableHelper.h" -#include "CommonConstants/MathConstants.h" #include "CommonConstants/PhysicsConstants.h" #include "Framework/InitContext.h" @@ -63,55 +60,16 @@ float itsSignal(T const& track) auto clSizeLayer6 = (clsizeflag >> (6 * 4)) & 0xf; int numLayers = 7; int sumClusterSizes = clSizeLayer0 + clSizeLayer1 + clSizeLayer2 + clSizeLayer3 + clSizeLayer4 + clSizeLayer5 + clSizeLayer6; - float cosLamnda = 1. / std::cosh(track.eta()); - return (static_cast(sumClusterSizes) / numLayers) * cosLamnda; + double cosLamnda = 1. / std::cosh(track.eta()); + double signal = (static_cast(sumClusterSizes) / numLayers) * cosLamnda; + return static_cast(signal); }; -template -float sphericity(T const& tracks) -{ - - int minNumberTracks = 2; - float maxSphericity = 2.f; - - if (tracks.size() <= minNumberTracks) { - return maxSphericity; - } - - // Initialize the transverse momentum tensor components - float sxx = 0.f; - float syy = 0.f; - float sxy = 0.f; - float sumPt = 0.f; - - // Loop over the tracks to compute the tensor components - for (const auto& track : tracks) { - sxx += (track.px() * track.px()) / track.pt(); - syy += (track.py() * track.py()) / track.pt(); - sxy += (track.px() * track.py()) / track.pt(); - sumPt += track.pt(); - } - sxx /= sumPt; - syy /= sumPt; - sxy /= sumPt; - - // Compute the eigenvalues (real values) - float lambda1 = ((sxx + syy) + std::sqrt((sxx + syy) * (sxx + syy) - 4 * (sxx * syy - sxy * sxy))) / 2; - float lambda2 = ((sxx + syy) - std::sqrt((sxx + syy) * (sxx + syy) - 4 * (sxx * syy - sxy * sxy))) / 2; - - if (lambda1 <= 0.f || lambda2 <= 0.f) { - return maxSphericity; - } - - // Compute sphericity - return 2.f * lambda2 / (lambda1 + lambda2); -} - -inline float getMass(int pdgCode) +inline double getMass(int pdgCode) { // use this function instead of TDatabasePDG to return masses defined in the PhysicsConstants.h header // this approach saves a lot of memory and important partilces like deuteron are missing in TDatabasePDG anyway - float mass = 0.f; + double mass = 0.f; // add new particles if necessary here switch (std::abs(pdgCode)) { case kPiPlus: @@ -175,15 +133,6 @@ float qn(T const& col) return qn; } -inline std::optional dphistar(float magfield, float radius, float signedPt, float phi) -{ - float arg = 0.3f * (0.1f * magfield) * (0.01 * radius) / (2.f * signedPt); - if (std::fabs(arg) <= 1.f) { - return RecoDecay::constrainAngle(phi - std::asin(arg)); - } - return std::nullopt; -} - inline bool enableTable(const char* tableName, int userSetting, o2::framework::InitContext& initContext) { if (userSetting == 1) { diff --git a/PWGCF/Femto/Core/mcBuilder.h b/PWGCF/Femto/Core/mcBuilder.h index 67385354077..b7c063941cb 100644 --- a/PWGCF/Femto/Core/mcBuilder.h +++ b/PWGCF/Femto/Core/mcBuilder.h @@ -54,6 +54,8 @@ struct McBuilderProducts : o2::framework::ProducesGroup { o2::framework::Produces producedK0shortLabels; o2::framework::Produces producedSigmaLabels; o2::framework::Produces producedSigmaPlusLabels; + o2::framework::Produces producedXiLabels; + o2::framework::Produces producedOmegaLabels; }; struct ConfMcTables : o2::framework::ConfigurableGroup { @@ -69,6 +71,8 @@ struct ConfMcTables : o2::framework::ConfigurableGroup { o2::framework::Configurable producedK0shortLabels{"producedK0shortLabels", -1, "Produce k0short labels (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable producedSigmaLabels{"producedSigmaLabels", -1, "Produce k0short labels (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable producedSigmaPlusLabels{"producedSigmaPlusLabels", -1, "Produce k0short labels (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable producedXiLabels{"producedXiLabels", -1, "Produce xi labels (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable producedOmegaLabels{"producedOmegaLabels", -1, "Produce omega labels (-1: auto; 0 off; 1 on)"}; }; class McBuilder @@ -93,8 +97,15 @@ class McBuilder mProduceK0shortLabels = utils::enableTable("FK0shortLabels", table.producedK0shortLabels.value, initContext); mProduceSigmaLabels = utils::enableTable("FSigmaLabels", table.producedSigmaLabels.value, initContext); mProduceSigmaPlusLabels = utils::enableTable("FSigmaPlusLabels", table.producedSigmaPlusLabels.value, initContext); - - if (mProduceMcCollisions || mProduceMcParticles || mProduceMcMothers || mProduceMcPartonicMothers || mProduceCollisionLabels || mProduceTrackLabels || mProduceLambdaLabels || mProduceK0shortLabels) { + mProduceXiLabels = utils::enableTable("FXiLabels", table.producedXiLabels.value, initContext); + mProduceOmegaLabels = utils::enableTable("FOmegaLabels", table.producedOmegaLabels.value, initContext); + + if (mProduceMcCollisions || mProduceCollisionLabels || + mProduceMcParticles || mProduceMcMothers || mProduceMcPartonicMothers || + mProduceTrackLabels || + mProduceLambdaLabels || mProduceK0shortLabels || + mProduceSigmaLabels || mProduceSigmaPlusLabels || + mProduceXiLabels || mProduceOmegaLabels) { mFillAnyTable = true; } else { LOG(info) << "No tables configured..."; @@ -125,7 +136,7 @@ class McBuilder // Add label mcProducts.producedCollisionLabels(it->second); } else { - // Case: No MC collision associated + // If no MC collision associated, fill empty label mcProducts.producedCollisionLabels(-1); } } @@ -178,6 +189,26 @@ class McBuilder fillMcLabelGeneric(col, mcCols, sigmaPlusDaughter, mcParticles, mcProducts, [](auto& prod, int64_t p, int64_t m, int64_t pm) { prod.producedSigmaPlusLabels(p, m, pm); }, true); } + template + void fillMcXiWithLabel(T1 const& col, T2 const& mcCols, T3 const& xi, T4 const& mcParticles, T5& mcProducts) + { + if (!mProduceXiLabels) { + mcProducts.producedXiLabels(-1, -1, -1); + return; + } + fillMcLabelGeneric(col, mcCols, xi, mcParticles, mcProducts, [](auto& prod, int64_t p, int64_t m, int64_t pm) { prod.producedXiLabels(p, m, pm); }); + } + + template + void fillMcOmegaWithLabel(T1 const& col, T2 const& mcCols, T3 const& omega, T4 const& mcParticles, T5& mcProducts) + { + if (!mProduceOmegaLabels) { + mcProducts.producedOmegaLabels(-1, -1, -1); + return; + } + fillMcLabelGeneric(col, mcCols, omega, mcParticles, mcProducts, [](auto& prod, int64_t p, int64_t m, int64_t pm) { prod.producedOmegaLabels(p, m, pm); }); + } + bool fillAnyTable() const { return mFillAnyTable; } template @@ -386,6 +417,8 @@ class McBuilder bool mProduceK0shortLabels = false; bool mProduceSigmaLabels = false; bool mProduceSigmaPlusLabels = false; + bool mProduceXiLabels = false; + bool mProduceOmegaLabels = false; std::unordered_map mCollisionMap; diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index b9ac36cf4ff..06145605685 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -24,6 +24,7 @@ #include "PWGCF/Femto/Core/pairCleaner.h" #include "PWGCF/Femto/Core/pairHistManager.h" #include "PWGCF/Femto/Core/pairProcessHelpers.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/trackHistManager.h" #include "PWGCF/Femto/Core/twoTrackResonanceHistManager.h" #include "PWGCF/Femto/Core/v0HistManager.h" @@ -63,19 +64,23 @@ class PairTrackTrackBuilder typename T8, typename T9, typename T10, - typename T11> + typename T11, + typename T12, + typename T13> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection1, T2 const& confTrackSelection2, - T3 const& confCpr, - T4 const& confMixing, - T5 const& confPairBinning, - T6 const& confPairCuts, - std::map> const& colHistSpec, - std::map> const& trackHistSpec1, - std::map> const& trackHistSpec2, - std::map> const& pairHistSpec, - std::map> const& cprHistSpec) + T3 const& confTrackCleaner1, + T4 const& confTrackCleaner2, + T5 const& confCpr, + T6 const& confMixing, + T7 const& confPairBinning, + T8 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& trackHistSpec1, + std::map> const& trackHistSpec2, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { // check if correlate the same tracks or not @@ -87,6 +92,8 @@ class PairTrackTrackBuilder mPc.template init(confPairCuts); if (mSameSpecies) { + mTrackCleaner1.init(confTrackCleaner1); + mTrackHistManager1.template init(registry, trackHistSpec1, confTrackSelection1); mPairHistManagerSe.setMass(confTrackSelection1.pdgCodeAbs.value, confTrackSelection1.pdgCodeAbs.value); @@ -97,6 +104,8 @@ class PairTrackTrackBuilder mPairHistManagerMe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); } else { + mTrackCleaner1.init(confTrackCleaner1); + mTrackCleaner2.init(confTrackCleaner2); mTrackHistManager1.template init(registry, trackHistSpec1, confTrackSelection1); mTrackHistManager2.template init(registry, trackHistSpec2, confTrackSelection2); @@ -170,7 +179,7 @@ class PairTrackTrackBuilder if (mMixIdenticalParticles) { pairOrder = static_cast(mDist(mRng)); } - pairprocesshelpers::processSameEvent(trackSlice1, trackTable, mcParticles, mcMothers, mcPartonicMothers, col, mcCols, mTrackHistManager1, mPairHistManagerSe, mCprSe, mPc, pairOrder); + pairprocesshelpers::processSameEvent(trackSlice1, trackTable, mcParticles, mcMothers, mcPartonicMothers, col, mcCols, mTrackHistManager1, mPairHistManagerSe, mTrackCleaner1, mCprSe, mPc, pairOrder); } else { auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); @@ -179,7 +188,7 @@ class PairTrackTrackBuilder } mColHistManager.template fill(col, mcCols); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice1, trackSlice2, trackTable, mcParticles, mcMothers, mcPartonicMothers, col, mcCols, mTrackHistManager1, mTrackHistManager2, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice1, trackSlice2, trackTable, mcParticles, mcMothers, mcPartonicMothers, col, mcCols, mTrackHistManager1, mTrackHistManager2, mPairHistManagerSe, mTrackCleaner1, mTrackCleaner2, mCprSe, mPc); } } @@ -218,19 +227,19 @@ class PairTrackTrackBuilder } } - template - void processMixedEvent(T1 const& cols, T2 const& mcCols, T3& trackTable, T4& partition1, T5& partition2, T6 const& mcParticles, T7& cache, T8& binsVtxMult, T9& binsVtxCent, T10& binsVtxMultCent) + template + void processMixedEvent(T1 const& cols, T2 const& mcCols, T3& trackTable, T4& partition1, T5& partition2, T6 const& mcParticles, T7 const& mcMothers, T8 const& mcPartonicMothers, T9& cache, T10& binsVtxMult, T11& binsVtxCent, T12& binsVtxMultCent) { if (mSameSpecies) { switch (mMixingPolicy) { case static_cast(pairhistmanager::kVtxMult): - pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition1, trackTable, mcParticles, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition1, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mTrackCleaner1, mTrackCleaner1, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxCent): - pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition1, trackTable, mcParticles, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition1, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mTrackCleaner1, mTrackCleaner1, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxMultCent): - pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition1, trackTable, mcParticles, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition1, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mTrackCleaner1, mTrackCleaner1, mCprMe, mPc); break; default: LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; @@ -238,13 +247,13 @@ class PairTrackTrackBuilder } else { switch (mMixingPolicy) { case static_cast(pairhistmanager::kVtxMult): - pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition2, trackTable, mcParticles, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition2, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mTrackCleaner1, mTrackCleaner2, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxCent): - pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition2, trackTable, mcParticles, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition2, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mTrackCleaner1, mTrackCleaner2, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxMultCent): - pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition2, trackTable, mcParticles, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, partition1, partition2, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mTrackCleaner1, mTrackCleaner2, mCprMe, mPc); break; default: LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; @@ -261,6 +270,8 @@ class PairTrackTrackBuilder closepairrejection::ClosePairRejectionTrackTrack mCprSe; closepairrejection::ClosePairRejectionTrackTrack mCprMe; paircleaner::TrackTrackPairCleaner mPc; + particlecleaner::ParticleCleaner mTrackCleaner1; + particlecleaner::ParticleCleaner mTrackCleaner2; pairhistmanager::MixingPolicy mMixingPolicy = pairhistmanager::MixingPolicy::kVtxMult; int mMixingDepth = 5; bool mSameSpecies = false; @@ -304,23 +315,27 @@ class PairV0V0Builder typename T12, typename T13, typename T14, - typename T15> + typename T15, + typename T16, + typename T17> void init(o2::framework::HistogramRegistry* registry, T1 const& confV0Selection1, T2 const& confV0Selection2, - T3 const& confCprPos, - T4 const& confCprNeg, - T5 const& confMixing, - T6 const& confPairBinning, - T7 const& confPairCuts, - std::map> const& colHistSpec, - std::map> const& V0HistSpec1, - std::map> const& V0HistSpec2, - std::map> const& PosDauHistSpec, - std::map> const& NegDauHistSpec, - std::map> const& pairHistSpec, - std::map> const& cprHistSpecPos, - std::map> const& cprHistSpecNeg) + T3 const& confV0Cleaner1, + T4 const& confV0Cleaner2, + T5 const& confCprPos, + T6 const& confCprNeg, + T7 const& confMixing, + T8 const& confPairBinning, + T9 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& V0HistSpec1, + std::map> const& V0HistSpec2, + std::map> const& PosDauHistSpec, + std::map> const& NegDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpecPos, + std::map> const& cprHistSpecNeg) { // check if correlate the same tracks or not @@ -331,6 +346,7 @@ class PairV0V0Builder mPairHistManagerMe.template init(registry, pairHistSpec, confPairBinning, confPairCuts); if (mSameSpecies) { + mV0Cleaner1.init(confV0Cleaner1); mV0HistManager1.template init(registry, V0HistSpec1, confV0Selection1, PosDauHistSpec, NegDauHistSpec); mPairHistManagerSe.setMass(confV0Selection1.pdgCodeAbs.value, confV0Selection1.pdgCodeAbs.value); @@ -341,6 +357,8 @@ class PairV0V0Builder mPairHistManagerMe.setCharge(1, 1); mCprMe.init(registry, cprHistSpecPos, cprHistSpecNeg, confCprPos, confCprNeg); } else { + mV0Cleaner1.init(confV0Cleaner1); + mV0Cleaner2.init(confV0Cleaner2); mV0HistManager1.template init(registry, V0HistSpec1, confV0Selection1, PosDauHistSpec, NegDauHistSpec); mV0HistManager2.template init(registry, V0HistSpec2, confV0Selection2, PosDauHistSpec, NegDauHistSpec); @@ -436,6 +454,8 @@ class PairV0V0Builder colhistmanager::CollisionHistManager mColHistManager; v0histmanager::V0HistManager mV0HistManager1; v0histmanager::V0HistManager mV0HistManager2; + particlecleaner::ParticleCleaner mV0Cleaner1; + particlecleaner::ParticleCleaner mV0Cleaner2; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionV0V0 mCprSe; @@ -477,27 +497,34 @@ class PairTrackV0Builder typename T10, typename T11, typename T12, - typename T13> + typename T13, + typename T14, + typename T15> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection, - T2 const& confV0Selection, - T3 const& confCpr, - T4 const& confMixing, - T5 const& confPairBinning, - T6 const& confPairCuts, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& v0HistSpec, - std::map>& posDauHistSpec, - std::map>& negDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T2 const& confTrackCleaner, + T3 const& confV0Selection, + T4 const& confV0Cleaner, + T5 const& confCpr, + T6 const& confMixing, + T7 const& confPairBinning, + T8 const& confPairCuts, + std::map>& colHistSpec, + std::map>& trackHistSpec, + std::map>& v0HistSpec, + std::map>& posDauHistSpec, + std::map>& negDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) { mColHistManager.template init(registry, colHistSpec); mTrackHistManager.template init(registry, trackHistSpec, confTrackSelection); mV0HistManager.template init(registry, v0HistSpec, confV0Selection, posDauHistSpec, negDauHistSpec); + mTrackCleaner.init(confTrackCleaner); + mV0Cleaner.init(confV0Cleaner); + mPairHistManagerSe.template init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerSe.setMass(confTrackSelection.pdgCodeAbs.value, confV0Selection.pdgCodeAbs.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); @@ -537,7 +564,7 @@ class PairTrackV0Builder } mColHistManager.template fill(col, mcCols); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mcParticles, mcMothers, mcPartonicMothers, col, mcCols, mTrackHistManager, mV0HistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mcParticles, mcMothers, mcPartonicMothers, col, mcCols, mTrackHistManager, mV0HistManager, mPairHistManagerSe, mTrackCleaner, mV0Cleaner, mCprSe, mPc); } template @@ -558,18 +585,18 @@ class PairTrackV0Builder } } - template - void processMixedEvent(T1 const& cols, T2 const& mcCols, T3& trackTable, T4& trackPartition, T5& v0Partition, T6 const& mcParticles, T7& cache, T8& binsVtxMult, T9& binsVtxCent, T10& binsVtxMultCent) + template + void processMixedEvent(T1 const& cols, T2 const& mcCols, T3& trackTable, T4& trackPartition, T5& v0Partition, T6 const& mcParticles, T7 const& mcMothers, T8 const& mcPartonicMothers, T9& cache, T10& binsVtxMult, T11& binsVtxCent, T12& binsVtxMultCent) { switch (mMixingPolicy) { case static_cast(pairhistmanager::kVtxMult): - pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, v0Partition, trackTable, mcParticles, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, v0Partition, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mTrackCleaner, mV0Cleaner, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxCent): - pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, v0Partition, trackTable, mcParticles, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, v0Partition, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mTrackCleaner, mV0Cleaner, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxMultCent): - pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, v0Partition, trackTable, mcParticles, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, v0Partition, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mTrackCleaner, mV0Cleaner, mCprMe, mPc); break; default: LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; @@ -580,6 +607,8 @@ class PairTrackV0Builder colhistmanager::CollisionHistManager mColHistManager; trackhistmanager::TrackHistManager mTrackHistManager; v0histmanager::V0HistManager mV0HistManager; + particlecleaner::ParticleCleaner mTrackCleaner; + particlecleaner::ParticleCleaner mV0Cleaner; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionTrackV0 mCprSe; @@ -723,26 +752,33 @@ class PairTrackKinkBuilder typename T9, typename T10, typename T11, - typename T12> + typename T12, + typename T13, + typename T14> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection, - T2 const& confKinkSelection, - T3 const& confCpr, - T4 const& confMixing, - T5 const& confPairBinning, - T6 const& confPairCuts, - std::map> const& colHistSpec, - std::map> const& trackHistSpec, - std::map> const& kinkHistSpec, - std::map> const& chaDauHistSpec, - std::map> const& pairHistSpec, - std::map> const& cprHistSpec) + T2 const& confTrackCleaner, + T3 const& confKinkSelection, + T4 const& confKinkCleaner, + T5 const& confCpr, + T6 const& confMixing, + T7 const& confPairBinning, + T8 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& kinkHistSpec, + std::map> const& chaDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.template init(registry, colHistSpec); mTrackHistManager.template init(registry, trackHistSpec, confTrackSelection); mKinkHistManager.template init(registry, kinkHistSpec, confKinkSelection, chaDauHistSpec); + mTrackCleaner.init(confTrackCleaner); + mKinkCleaner.init(confKinkCleaner); + mPairHistManagerSe.template init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerSe.setMass(confTrackSelection.pdgCodeAbs.value, confKinkSelection.pdgCodeAbs.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); // abs charge of kink daughter is always 1 @@ -782,7 +818,7 @@ class PairTrackKinkBuilder } mColHistManager.fill(col, mcCols); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, kinkSlice, trackTable, mcParticles, mcMothers, mcPartonicMothers, col, mcCols, mTrackHistManager, mKinkHistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, kinkSlice, trackTable, mcParticles, mcMothers, mcPartonicMothers, col, mcCols, mTrackHistManager, mKinkHistManager, mPairHistManagerSe, mTrackCleaner, mKinkCleaner, mCprSe, mPc); } template @@ -803,18 +839,18 @@ class PairTrackKinkBuilder } } - template - void processMixedEvent(T1 const& cols, T2 const& mcCols, T3& trackTable, T4& trackPartition, T5& kinkPartition, T6 const& mcParticles, T7& cache, T8& binsVtxMult, T9& binsVtxCent, T10& binsVtxMultCent) + template + void processMixedEvent(T1 const& cols, T2 const& mcCols, T3& trackTable, T4& trackPartition, T5& kinkPartition, T6 const& mcParticles, T7 const& mcMothers, T8 const& mcPartonicMothers, T9& cache, T10& binsVtxMult, T11& binsVtxCent, T12& binsVtxMultCent) { switch (mMixingPolicy) { case static_cast(pairhistmanager::kVtxMult): - pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, kinkPartition, trackTable, mcParticles, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, kinkPartition, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxMult, mMixingDepth, mPairHistManagerMe, mTrackCleaner, mKinkCleaner, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxCent): - pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, kinkPartition, trackTable, mcParticles, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, kinkPartition, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxCent, mMixingDepth, mPairHistManagerMe, mTrackCleaner, mKinkCleaner, mCprMe, mPc); break; case static_cast(pairhistmanager::kVtxMultCent): - pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, kinkPartition, trackTable, mcParticles, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mCprMe, mPc); + pairprocesshelpers::processMixedEvent(cols, mcCols, trackPartition, kinkPartition, trackTable, mcParticles, mcMothers, mcPartonicMothers, cache, binsVtxMultCent, mMixingDepth, mPairHistManagerMe, mTrackCleaner, mKinkCleaner, mCprMe, mPc); break; default: LOG(fatal) << "Invalid binning policiy specifed. Breaking..."; @@ -825,6 +861,8 @@ class PairTrackKinkBuilder colhistmanager::CollisionHistManager mColHistManager; trackhistmanager::TrackHistManager mTrackHistManager; kinkhistmanager::KinkHistManager mKinkHistManager; + particlecleaner::ParticleCleaner mTrackCleaner; + particlecleaner::ParticleCleaner mKinkCleaner; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionTrackKink mCprSe; @@ -868,30 +906,37 @@ class PairTrackCascadeBuilder typename T13, typename T14, typename T15, - typename T16> + typename T16, + typename T17, + typename T18> void init(o2::framework::HistogramRegistry* registry, T1 const& confTrackSelection, - T2 const& confCascadeSelection, - T3 const& confCprBachelor, - T4 const& confCprV0Daughter, - T5 const& confMixing, - T6 const& confPairBinning, - T7 const& confPairCuts, - std::map> const& colHistSpec, - std::map> const& trackHistSpec, - std::map> const& cascadeHistSpec, - std::map> const& bachelorHistSpec, - std::map> const& posDauHistSpec, - std::map> const& negDauHistSpec, - std::map> const& pairHistSpec, - std::map> const& cprHistSpecBachelor, - std::map> const& cprHistSpecV0Daughter) + T2 const& confTrackCleaner, + T3 const& confCascadeSelection, + T4 const& confCascadeCleaner, + T5 const& confCprBachelor, + T6 const& confCprV0Daughter, + T7 const& confMixing, + T8 const& confPairBinning, + T9 const& confPairCuts, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& cascadeHistSpec, + std::map> const& bachelorHistSpec, + std::map> const& posDauHistSpec, + std::map> const& negDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpecBachelor, + std::map> const& cprHistSpecV0Daughter) { mColHistManager.template init(registry, colHistSpec); mTrackHistManager.template init(registry, trackHistSpec, confTrackSelection); mCascadeHistManager.template init(registry, cascadeHistSpec, confCascadeSelection, bachelorHistSpec, posDauHistSpec, negDauHistSpec); + mTrackCleaner.init(confTrackCleaner); + mCascadeCleaner.init(confCascadeCleaner); + mPairHistManagerSe.template init(registry, pairHistSpec, confPairBinning, confPairCuts); mPairHistManagerSe.setMass(confTrackSelection.pdgCodeAbs.value, confCascadeSelection.pdgCodeAbs.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); @@ -942,6 +987,8 @@ class PairTrackCascadeBuilder colhistmanager::CollisionHistManager mColHistManager; trackhistmanager::TrackHistManager mTrackHistManager; cascadehistmanager::CascadeHistManager mCascadeHistManager; + particlecleaner::ParticleCleaner mTrackCleaner; + particlecleaner::ParticleCleaner mCascadeCleaner; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; closepairrejection::ClosePairRejectionTrackCascade mCprSe; diff --git a/PWGCF/Femto/Core/pairCleaner.h b/PWGCF/Femto/Core/pairCleaner.h index b1076efa0b0..ee1c1af92d1 100644 --- a/PWGCF/Femto/Core/pairCleaner.h +++ b/PWGCF/Femto/Core/pairCleaner.h @@ -53,7 +53,7 @@ class BasePairCleaner template bool pairHasCommonAncestor(T1 const& particle1, T2 const& particle2, T3 const& /*partonicMothers*/) const { - // if one of the two particles has no associated partonic mother, we cannot now if they have a common anchestor, so we break out with false + // if one of the two particles has no associated partonic mother, we cannot know if they have a common anchestor, so we break out with false if (!particle1.has_fMcPartMoth() || !particle2.has_fMcPartMoth()) { return false; } diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index 54eb28d8ae0..f27785cac62 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -596,14 +596,14 @@ class PairHistManager float getKt(ROOT::Math::PtEtaPhiMVector const& part1, ROOT::Math::PtEtaPhiMVector const& part2) { - auto sum = part1 + part2; - return 0.5 * sum.Pt(); + double kt = 0.5 * (part1 + part2).Pt(); + return static_cast(kt); } float getMt(ROOT::Math::PtEtaPhiMVector const& part1, ROOT::Math::PtEtaPhiMVector const& part2) { auto sum = part1 + part2; - float mt = 0; + double mt = 0; switch (mMtType) { case modes::TransverseMassType::kAveragePdgMass: mt = std::hypot(0.5 * sum.Pt(), mAverageMass); @@ -617,7 +617,7 @@ class PairHistManager default: LOG(fatal) << "Invalid transverse mass type, breaking..."; } - return mt; + return static_cast(mt); } float getKstar(ROOT::Math::PtEtaPhiMVector const& part1, ROOT::Math::PtEtaPhiMVector const& part2) @@ -630,7 +630,7 @@ class PairHistManager // get lorentz boost into pair rest frame ROOT::Math::Boost boostPrf(sum.BoostToCM()); // boost particle 1 into pair rest frame and calculate its momentum, which has the same value as k* - return boostPrf(particle1Prf).P(); + return static_cast(boostPrf(particle1Prf).P()); } o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; @@ -638,8 +638,8 @@ class PairHistManager float mPdgMass2 = 0.f; modes::TransverseMassType mMtType = modes::TransverseMassType::kAveragePdgMass; - float mAverageMass = 0.f; - float mReducedMass = 0.f; + double mAverageMass = 0.f; + double mReducedMass = 0.f; int mAbsCharge1 = 1; int mAbsCharge2 = 1; diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index 6190c29d10a..8a70283e9c6 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -94,7 +94,8 @@ template + typename T11, + typename T12> void processSameEvent(T1 const& SliceParticle, T2 const& TrackTable, T3 const& mcParticles, @@ -104,14 +105,23 @@ void processSameEvent(T1 const& SliceParticle, T7 const& mcCollisions, T8& ParticleHistManager, T9& PairHistManager, - T10& CprManager, - T11& PcManager, + T10& ParticleCleaner, + T11& CprManager, + T12& PcManager, PairOrder pairOrder) { for (auto const& part : SliceParticle) { + if (!ParticleCleaner.isClean(part, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } ParticleHistManager.template fill(part, TrackTable, mcParticles, mcMothers, mcPartonicMothers); } for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsStrictlyUpperIndexPolicy(SliceParticle, SliceParticle))) { + // check if particles are clean + if (!ParticleCleaner.isClean(p1, mcParticles, mcMothers, mcPartonicMothers) || + !ParticleCleaner.isClean(p2, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } // check if pair is clean if (!PcManager.isCleanPair(p1, p2, TrackTable, mcPartonicMothers)) { continue; @@ -201,7 +211,9 @@ template + typename T13, + typename T14, + typename T15> void processSameEvent(T1 const& SliceParticle1, T2 const& SliceParticle2, T3 const& TrackTable, @@ -213,17 +225,30 @@ void processSameEvent(T1 const& SliceParticle1, T9& ParticleHistManager1, T10& ParticleHistManager2, T11& PairHistManager, - T12& CprManager, - T13& PcManager) + T12& ParticleCleaner1, + T13& ParticleCleaner2, + T14& CprManager, + T15& PcManager) { // Fill single particle histograms for (auto const& part : SliceParticle1) { + if (!ParticleCleaner1.isClean(part, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } ParticleHistManager1.template fill(part, TrackTable, mcParticles, mcMothers, mcPartonicMothers); } for (auto const& part : SliceParticle2) { + if (!ParticleCleaner2.isClean(part, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } ParticleHistManager2.template fill(part, TrackTable, mcParticles, mcMothers, mcPartonicMothers); } for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(SliceParticle1, SliceParticle2))) { + // check if particles are clean + if (!ParticleCleaner1.isClean(p1, mcParticles, mcMothers, mcPartonicMothers) || + !ParticleCleaner2.isClean(p2, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } // pair cleaning if (!PcManager.isCleanPair(p1, p2, TrackTable, mcPartonicMothers)) { continue; @@ -305,20 +330,28 @@ template + typename T13, + typename T14, + typename T15, + typename T16> void processMixedEvent(T1 const& Collisions, T2 const& mcCollisions, T3& Partition1, T4& Partition2, T5 const& TrackTable, T6 const& mcParticles, - T7& cache, - T8 const& policy, - T9 const& depth, - T10& PairHistManager, - T11& CprManager, - T12& PcManager) + T7 const& mcMothers, + T8 const& mcPartonicMothers, + T9& cache, + T10 const& policy, + T11 const& depth, + T12& PairHistManager, + T13& ParticleCleaner1, + T14& ParticleCleaner2, + T15& CprManager, + T16& PcManager) { for (auto const& [collision1, collision2] : o2::soa::selfCombinations(policy, depth, -1, Collisions, Collisions)) { if (collision1.magField() != collision2.magField()) { @@ -331,6 +364,11 @@ void processMixedEvent(T1 const& Collisions, continue; } for (auto const& [p1, p2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(sliceParticle1, sliceParticle2))) { + // particle cleaning + if (!ParticleCleaner1.isClean(p1, mcParticles, mcMothers, mcPartonicMothers) || + !ParticleCleaner2.isClean(p2, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } // pair cleaning if (!PcManager.isCleanPair(p1, p2, TrackTable)) { continue; diff --git a/PWGCF/Femto/Core/particleCleaner.h b/PWGCF/Femto/Core/particleCleaner.h new file mode 100644 index 00000000000..92110b91a1c --- /dev/null +++ b/PWGCF/Femto/Core/particleCleaner.h @@ -0,0 +1,186 @@ +// Copyright 2019-2022 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file particleCleaner.h +/// \brief particle cleaner class +/// \author anton.riedel@tum.de, TU München, anton.riedel@tum.de + +#ifndef PWGCF_FEMTO_CORE_PARTICLECLEANER_H_ +#define PWGCF_FEMTO_CORE_PARTICLECLEANER_H_ + +#include "Framework/Configurable.h" + +#include +#include + +namespace o2::analysis::femto +{ +namespace particlecleaner +{ + +template +struct ConfParticleCleaner : o2::framework::ConfigurableGroup { + std::string prefix = std::string(Prefix); + o2::framework::Configurable activate{"activate", false, "Activate particle cleaner"}; + o2::framework::Configurable pdgCode{"pdgCode", 0, "Only consider particles with this exact pdg code (including the sign!). If set to 0, this is cut is ignored"}; + o2::framework::Configurable rejectedParticleWithoutMcInformation{"rejectedParticleWithoutMcInformation", true, "If true, all particles which have no associated MC information, are rejected by default"}; + o2::framework::Configurable> requiredMotherPdgCodes{"requiredMotherPdgCodes", {}, "Only consider particles whose mothers have one of the supplied pdg codes (inclduing the sign!)"}; + o2::framework::Configurable> rejectMotherPdgCodes{"rejectMotherPdgCodes", {}, "Only consider particles whose mothers do not have one of the supplied pdg codes (inclduing the sign!)"}; + o2::framework::Configurable> requiredPartonicMotherPdgCodes{"requiredPartonicMotherPdgCodes", {}, "Only consider particles whose partonic mothers have one of the supplied pdg codes (inclduing the sign!)"}; + o2::framework::Configurable> rejectPartonicMotherPdgCodes{"rejectPartonicMotherPdgCodes", {}, "Only consider particles whose mothers do not have one of the supplied pdg codes (inclduing the sign!)"}; +}; + +constexpr const char PrefixTrackCleaner1[] = "TrackCleaner1"; +constexpr const char PrefixTrackCleaner2[] = "TrackCleaner2"; +constexpr const char PrefixTrackCleaner3[] = "TrackCleaner3"; +using ConfTrackCleaner1 = ConfParticleCleaner; +using ConfTrackCleaner2 = ConfParticleCleaner; +using ConfTrackCleaner3 = ConfParticleCleaner; + +constexpr const char PrefixLambdaCleaner1[] = "LambdaCleaner1"; +constexpr const char PrefixLambdaCleaner2[] = "LambdaCleaner2"; +using ConfLambdaCleaner1 = ConfParticleCleaner; +using ConfLambdaCleaner2 = ConfParticleCleaner; + +constexpr const char PrefixK0shortCleaner1[] = "K0shortCleaner1"; +constexpr const char PrefixK0shortCleaner2[] = "K0shortCleaner2"; +using ConfK0shortCleaner1 = ConfParticleCleaner; +using ConfK0shortCleaner2 = ConfParticleCleaner; + +constexpr const char PrefixSigmaCleaner1[] = "SigmaCleaner1"; +constexpr const char PrefixSigmaCleaner2[] = "SigmaCleaner2"; +using ConfSigmaCleaner1 = ConfParticleCleaner; +using ConfSigmaCleaner2 = ConfParticleCleaner; + +constexpr const char PrefixSigmaPlusCleaner1[] = "SigmaPlusCleaner1"; +constexpr const char PrefixSigmaPlusCleaner2[] = "SigmaPlusCleaner2"; +using ConfSigmaPlusCleaner1 = ConfParticleCleaner; +using ConfSigmaPlusCleaner2 = ConfParticleCleaner; + +constexpr const char PrefixXiCleaner1[] = "XiCleaner1"; +constexpr const char PrefixXiCleaner2[] = "XiCleaner2"; +using ConfXiCleaner1 = ConfParticleCleaner; +using ConfXiCleaner2 = ConfParticleCleaner; + +constexpr const char PrefixOmegaCleaner1[] = "OmegaCleaner1"; +constexpr const char PrefixOmegaCleaner2[] = "OmegaCleaner2"; +using ConfOmegaCleaner1 = ConfParticleCleaner; +using ConfOmegaCleaner2 = ConfParticleCleaner; + +class ParticleCleaner +{ + public: + ParticleCleaner() = default; + ~ParticleCleaner() = default; + + template + void init(T const& confMpc) + { + mActivate = confMpc.activate.value; + mRejectParticleWithoutMcInformation = confMpc.rejectedParticleWithoutMcInformation.value; + mPdgCode = confMpc.pdgCode.value; + mRequiredMotherPdgCodes = confMpc.requiredMotherPdgCodes.value; + mRejectMotherPdgCodes = confMpc.rejectMotherPdgCodes.value; + mRequiredPartonicMotherPdgCodes = confMpc.requiredPartonicMotherPdgCodes.value; + mRejectPartonicMotherPdgCodes = confMpc.rejectPartonicMotherPdgCodes.value; + } + + template + bool isClean(T1 const& particle, T2 const& /*mcParticles*/, T3 const& /*mcMothers*/, T4 const& /*mcPartonicMothers*/) + { + // check whether we apply cuts at all + if (!mActivate) { + return true; + } + // check if we even have an associated mc particle + if (!particle.has_fMcParticle()) { + if (mRejectParticleWithoutMcInformation) { + return false; + } else { + return true; + } + } + // perfrom cuts based on mc information of the particle itself + auto mcParticle = particle.template fMcParticle_as(); + if (mPdgCode != 0) { + if (mPdgCode != mcParticle.pdgCode()) { + return false; + } + } + + // perfrom cuts based on mc information of the mothers + auto mother = particle.template fMcMother_as(); + + // if list is empty, set it to true and skip the looop + bool hasMotherWithRequiredPdgCode = true; + if (!mRequiredMotherPdgCodes.empty()) { + hasMotherWithRequiredPdgCode = false; + for (int const& pdgCode : mRequiredMotherPdgCodes) { + if (pdgCode == mother.pdgCode()) { + hasMotherWithRequiredPdgCode = true; + break; + } + } + } + + bool hasMotherWithRejectedPdgCode = false; + if (!mRejectMotherPdgCodes.empty()) { + for (int const& pdgCode : mRejectMotherPdgCodes) { + if (pdgCode == mother.pdgCode()) { + hasMotherWithRejectedPdgCode = true; + break; + } + } + } + + // perfrom cuts based on mc information of the partonic mothers + auto partonicMother = particle.template fMcPartMoth_as(); + + // if list is empty, set it to true and skip the looop + bool hasPartonicMotherWithRequiredPdgCode = true; + if (!mRequiredPartonicMotherPdgCodes.empty()) { + hasPartonicMotherWithRequiredPdgCode = false; + for (int const& pdgCode : mRequiredPartonicMotherPdgCodes) { + if (pdgCode == partonicMother.pdgCode()) { + hasPartonicMotherWithRequiredPdgCode = true; + break; + } + } + } + + bool hasPartonicMotherWithRejectedPdgCode = false; + if (!mRejectPartonicMotherPdgCodes.empty()) { + for (int const& pdgCode : mRejectPartonicMotherPdgCodes) { + if (pdgCode == partonicMother.pdgCode()) { + hasPartonicMotherWithRejectedPdgCode = true; + break; + } + } + } + + return hasMotherWithRequiredPdgCode && !hasMotherWithRejectedPdgCode && + hasPartonicMotherWithRequiredPdgCode && !hasPartonicMotherWithRejectedPdgCode; + } + + private: + bool mActivate = false; + bool mRejectParticleWithoutMcInformation = true; + int mPdgCode = 0; + std::vector mRequiredMotherPdgCodes{}; + std::vector mRejectMotherPdgCodes{}; + std::vector mRequiredPartonicMotherPdgCodes{}; + std::vector mRejectPartonicMotherPdgCodes{}; +}; + +} // namespace particlecleaner +} // namespace o2::analysis::femto + +#endif // PWGCF_FEMTO_CORE_PARTICLECLEANER_H_ diff --git a/PWGCF/Femto/Core/tripletCleaner.h b/PWGCF/Femto/Core/tripletCleaner.h index fd8ebc71aad..cf7345547a6 100644 --- a/PWGCF/Femto/Core/tripletCleaner.h +++ b/PWGCF/Femto/Core/tripletCleaner.h @@ -27,6 +27,7 @@ class TrackTrackTrackTripletCleaner : public paircleaner::BasePairCleaner { public: TrackTrackTrackTripletCleaner() = default; + ~TrackTrackTrackTripletCleaner() = default; template bool isCleanTriplet(T1 const& track1, T2 const& track2, T3 const& track3, T4 const& /*trackTable*/) const diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index e7907f56f41..868e17e4629 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -388,13 +388,14 @@ class V0Builder if (!mV0Selection.passesAllRequiredSelections()) { continue; } + + collisionBuilder.template fillCollision(collisionProducts, col); + // cleaner, but without ITS pid: auto posDaughter = v0.template posTrack_as(); auto posDaughter = tracksWithItsPid.iteratorAt(v0.posTrackId() - tracksWithItsPid.offset()); // cleaner, but without ITS pid: auto negDaughter = v0.template negTrack_as(); auto negDaughter = tracksWithItsPid.iteratorAt(v0.negTrackId() - tracksWithItsPid.offset()); - collisionBuilder.template fillCollision(collisionProducts, col); - posDaughterIndex = trackBuilder.template getDaughterIndex(posDaughter, trackProducts, collisionProducts); negDaughterIndex = trackBuilder.template getDaughterIndex(negDaughter, trackProducts, collisionProducts); diff --git a/PWGCF/Femto/Core/v0HistManager.h b/PWGCF/Femto/Core/v0HistManager.h index b79972437ef..bdfa0cc9aaa 100644 --- a/PWGCF/Femto/Core/v0HistManager.h +++ b/PWGCF/Femto/Core/v0HistManager.h @@ -679,10 +679,11 @@ class V0HistManager o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; int mPdgCode = 0; - bool mPlot2d = false; bool mPlotOrigins = false; int mPlotNSecondaries = 0; std::array mPdgCodesSecondaryMother = {0}; + bool mPlot2d = false; + trackhistmanager::TrackHistManager mPosDauManager; trackhistmanager::TrackHistManager mNegDauManager; }; diff --git a/PWGCF/Femto/DataModel/FemtoTables.h b/PWGCF/Femto/DataModel/FemtoTables.h index 9f742edf96c..66707be9e8b 100644 --- a/PWGCF/Femto/DataModel/FemtoTables.h +++ b/PWGCF/Femto/DataModel/FemtoTables.h @@ -760,5 +760,15 @@ DECLARE_SOA_TABLE(FSigmaPlusLabels, "AOD", "FSIGMAPLUSLABEL", femtolabels::FMcMotherId, femtolabels::FMcPartMothId); +DECLARE_SOA_TABLE(FXiLabels, "AOD", "FXILABEL", + femtolabels::FMcParticleId, + femtolabels::FMcMotherId, + femtolabels::FMcPartMothId); + +DECLARE_SOA_TABLE(FOmegaLabels, "AOD", "FOMEGALABEL", + femtolabels::FMcParticleId, + femtolabels::FMcMotherId, + femtolabels::FMcPartMothId); + } // namespace o2::aod #endif // PWGCF_FEMTO_DATAMODEL_FEMTOTABLES_H_ diff --git a/PWGCF/Femto/TableProducer/femtoProducer.cxx b/PWGCF/Femto/TableProducer/femtoProducer.cxx index a86ce731cb9..4aa617a692a 100644 --- a/PWGCF/Femto/TableProducer/femtoProducer.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducer.cxx @@ -190,7 +190,7 @@ struct FemtoProducer { hRegistry.print(); } - // Core implementations + // processing collisions template bool processCollisions(T1 const& col, T2 const& /* bcs*/, T3 const& tracks) { @@ -204,7 +204,6 @@ struct FemtoProducer { // collisions are filled if at least one partilce is found in the collisions return true; } - template bool processMcCollisions(T1 const& col, T2 const& mcCols, T3 const& /* bcs*/, T4 const& tracks, T5 const& mcParticles) { @@ -220,13 +219,13 @@ struct FemtoProducer { return true; } + // processing tracks template void processTracks(T1 const& col, T2 const& tracksWithItsPid) { trackBuilder.reset(tracksWithItsPid); trackBuilder.fillTracks(col, collisionBuilder, collisionBuilderProducts, tracksWithItsPid, trackBuilderProducts); } - template void processMcTracks(T1 const& col, T2 const& mcCols, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& mcParticles) { @@ -234,7 +233,7 @@ struct FemtoProducer { trackBuilder.fillMcTracks(col, collisionBuilder, collisionBuilderProducts, mcCols, tracks, tracksWithItsPid, trackBuilderProducts, mcParticles, mcBuilder, mcProducts); } - // add v0s + // processing v0s template void processV0s(T1 const& col, T2 const& tracks, T3 const& tracksWithItsPid, T4 const& v0s) { @@ -242,7 +241,6 @@ struct FemtoProducer { antilambdaBuilder.fillV0s(col, collisionBuilder, collisionBuilderProducts, trackBuilderProducts, v0builderProducts, v0s, tracks, tracksWithItsPid, trackBuilder); k0shortBuilder.fillV0s(col, collisionBuilder, collisionBuilderProducts, trackBuilderProducts, v0builderProducts, v0s, tracks, tracksWithItsPid, trackBuilder); } - template void processMcV0s(T1 const& col, T2 const& mcCols, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& v0s, T6 const& mcParticles) { @@ -251,14 +249,13 @@ struct FemtoProducer { k0shortBuilder.fillMcV0s(col, collisionBuilder, collisionBuilderProducts, mcCols, trackBuilderProducts, v0builderProducts, v0s, tracks, tracksWithItsPid, trackBuilder, mcParticles, mcBuilder, mcProducts); } - // add kinks + // processing kinks template void processKinks(T1 const& col, T2 const& tracks, T3 const& tracksWithItsPid, T4 const& kinks) { sigmaBuilder.fillKinks(col, collisionBuilder, collisionBuilderProducts, trackBuilderProducts, kinkBuilderProducts, kinks, tracks, tracksWithItsPid, trackBuilder); sigmaPlusBuilder.fillKinks(col, collisionBuilder, collisionBuilderProducts, trackBuilderProducts, kinkBuilderProducts, kinks, tracks, tracksWithItsPid, trackBuilder); } - template void processMcKinks(T1 const& col, T2 const& mcCols, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& kinks, T6 const& mcParticles) { @@ -266,7 +263,7 @@ struct FemtoProducer { sigmaPlusBuilder.fillMcKinks(col, collisionBuilder, collisionBuilderProducts, mcCols, trackBuilderProducts, kinkBuilderProducts, kinks, tracks, tracksWithItsPid, trackBuilder, mcParticles, mcBuilder, mcProducts); } - // add cascades + // processing cascades template void processCascades(T1 const& col, T2 const& tracks, T3 const& tracksWithItsPid, T4 const& cascades) { @@ -275,6 +272,12 @@ struct FemtoProducer { omegaBuilder.fillCascades(col, collisionBuilder, collisionBuilderProducts, trackBuilderProducts, cascadeBuilderProducts, cascades, tracks, tracksWithItsPid, trackBuilder); } + template + void processMcCascades(T1 const& col, T2 const& mcCols, T3 const& tracks, T4 const& tracksWithItsPid, T5 const& cascades, T6 const& mcParticles) + { + xiBuilder.fillMcCascades(col, collisionBuilder, collisionBuilderProducts, mcCols, trackBuilderProducts, cascadeBuilderProducts, cascades, tracks, tracksWithItsPid, trackBuilder, mcParticles, mcBuilder, mcProducts); + omegaBuilder.fillMcCascades(col, collisionBuilder, collisionBuilderProducts, mcCols, trackBuilderProducts, cascadeBuilderProducts, cascades, tracks, tracksWithItsPid, trackBuilder, mcParticles, mcBuilder, mcProducts); + } // proccess functions void processTracksRun3pp(consumeddata::Run3PpCollisions::iterator const& col, @@ -431,6 +434,26 @@ struct FemtoProducer { processMcKinks(col, mcCols, tracks, tracksWithItsPid, kinks, mcParticles); } PROCESS_SWITCH(FemtoProducer, processTracksV0sKinksRun3ppMc, "Provide reconstructed and generated tracks and v0s and kinks", false); + + // process monte carlo tracks and v0s + void processTracksV0sCascadesRun3ppMc(consumeddata::Run3PpMcRecoCollisions::iterator const& col, + consumeddata::Run3PpMcGenCollisions const& mcCols, + BCsWithTimestamps const& bcs, + consumeddata::Run3McRecoTracks const& tracks, + consumeddata::Run3RecoVzeros const& v0s, + consumeddata::Run3RecoCascades const& cascades, + consumeddata::Run3McGenParticles const& mcParticles) + { + if (!processMcCollisions(col, mcCols, bcs, tracks, mcParticles)) { + return; + } + auto tracksWithItsPid = o2::soa::Attach(tracks); + processMcTracks(col, mcCols, tracks, tracksWithItsPid, mcParticles); + processMcV0s(col, mcCols, tracks, tracksWithItsPid, v0s, mcParticles); + processMcCascades(col, mcCols, tracks, tracksWithItsPid, cascades, mcParticles); + } + PROCESS_SWITCH(FemtoProducer, processTracksV0sCascadesRun3ppMc, "Provide reconstructed and generated tracks and v0s", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx index 2e9fd0c1b8c..74c2617b87b 100644 --- a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -18,6 +18,7 @@ #include "PWGCF/Femto/Core/collisionBuilder.h" #include "PWGCF/Femto/Core/collisionHistManager.h" #include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackHistManager.h" #include "PWGCF/Femto/DataModel/FemtoTables.h" @@ -43,17 +44,22 @@ using namespace o2::analysis::femto; struct FemtoCascadeQa { - // setup tables using FemtoCollisions = o2::soa::Join; - using FemtoCollision = FemtoCollisions::iterator; - using FilteredFemtoCollisions = o2::soa::Filtered; using FilteredFemtoCollision = FilteredFemtoCollisions::iterator; + using FemtoCollisionsWithLabel = o2::soa::Join; + using FilteredFemtoCollisionsWithLabel = o2::soa::Filtered; + using FilteredFemtoCollisionWithLabel = FilteredFemtoCollisionsWithLabel::iterator; + using FemtoXis = o2::soa::Join; using FemtoOmegas = o2::soa::Join; using FemtoTracks = o2::soa::Join; + using FemtoXisWithLabel = o2::soa::Join; + using FemtoOmegasWithLabel = o2::soa::Join; + using FemtoTracksWithLabel = o2::soa::Join; + SliceCache cache; // setup collisions @@ -65,9 +71,16 @@ struct FemtoCascadeQa { // setup for xis cascadebuilder::ConfXiSelection confXiSelection; + + particlecleaner::ConfXiCleaner1 confXiCleaner; + particlecleaner::ParticleCleaner xiCleaner; + Partition xiPartition = MAKE_CASCADE_PARTITION(confXiSelection); Preslice preColXis = femtobase::stored::fColId; + Partition xiWithLabelPartition = MAKE_CASCADE_PARTITION(confXiSelection); + Preslice perColXisWithLabel = femtobase::stored::fColId; + cascadehistmanager::ConfXiBinning confXiBinning; cascadehistmanager::ConfXiQaBinning confXiQaBinning; cascadehistmanager::CascadeHistManager< @@ -80,9 +93,16 @@ struct FemtoCascadeQa { // setup for omegas cascadebuilder::ConfOmegaSelection confOmegaSelection; + + particlecleaner::ConfOmegaCleaner1 confOmegaCleaner; + particlecleaner::ParticleCleaner omegaCleaner; + Partition omegaPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); Preslice preColOmegas = femtobase::stored::fColId; + Partition omegaWithLabelPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); + Preslice perColOmegasWithLabel = femtobase::stored::fColId; + cascadehistmanager::ConfOmegaBinning confOmegaBinning; cascadehistmanager::ConfOmegaQaBinning confOmegaQaBinning; cascadehistmanager::CascadeHistManager< @@ -105,29 +125,45 @@ struct FemtoCascadeQa { void init(InitContext&) { - if ((doprocessXis + doprocessOmegas) > 1) { + if ((doprocessXi + doprocessXiMc + doprocessOmega + doprocessOmegaMc) > 1) { LOG(fatal) << "Only one process can be activated"; } - - auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); - auto bachelorHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confBachelorBinning, confBachelorQaBinning); - auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); - auto negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confNegDaughterBinning, confNegDaughterQaBinning); - - if (doprocessXis) { - auto xiHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confXiBinning, confXiQaBinning); - xiHistManager.init(&hRegistry, xiHistSpec, confXiSelection, confXiQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); - } - - if (doprocessOmegas) { - auto omegaHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confOmegaBinning, confOmegaQaBinning); - omegaHistManager.init(&hRegistry, omegaHistSpec, confOmegaSelection, confOmegaQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); + bool processData = doprocessXi || doprocessOmega; + xiCleaner.init(confXiCleaner); + omegaCleaner.init(confOmegaCleaner); + if (processData) { + auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); + auto bachelorHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confBachelorBinning, confBachelorQaBinning); + auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); + auto negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confNegDaughterBinning, confNegDaughterQaBinning); + if (doprocessXi) { + auto xiHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confXiBinning, confXiQaBinning); + xiHistManager.init(&hRegistry, xiHistSpec, confXiSelection, confXiQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); + } + if (doprocessOmega) { + auto omegaHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confOmegaBinning, confOmegaQaBinning); + omegaHistManager.init(&hRegistry, omegaHistSpec, confOmegaSelection, confOmegaQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); + } + } else { + auto colHistSpec = colhistmanager::makeColMcQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); + auto bachelorHistSpec = trackhistmanager::makeTrackMcQaHistSpecMap(confBachelorBinning, confBachelorQaBinning); + auto posDaughterHistSpec = trackhistmanager::makeTrackMcQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); + auto negDaughterHistSpec = trackhistmanager::makeTrackMcQaHistSpecMap(confNegDaughterBinning, confNegDaughterQaBinning); + if (doprocessXiMc) { + auto xiHistSpec = cascadehistmanager::makeCascadeMcQaHistSpecMap(confXiBinning, confXiQaBinning); + xiHistManager.init(&hRegistry, xiHistSpec, confXiSelection, confXiQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); + } + if (doprocessOmegaMc) { + auto omegaHistSpec = cascadehistmanager::makeCascadeMcQaHistSpecMap(confOmegaBinning, confOmegaQaBinning); + omegaHistManager.init(&hRegistry, omegaHistSpec, confOmegaSelection, confOmegaQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); + } } hRegistry.print(); }; - void processXis(FilteredFemtoCollision const& col, FemtoXis const& /*xis*/, FemtoTracks const& tracks) + void processXi(FilteredFemtoCollision const& col, FemtoXis const& /*xis*/, FemtoTracks const& tracks) { colHistManager.fill(col); auto xiSlice = xiPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); @@ -135,9 +171,22 @@ struct FemtoCascadeQa { xiHistManager.fill(xi, tracks); } } - PROCESS_SWITCH(FemtoCascadeQa, processXis, "Process Xis", true); + PROCESS_SWITCH(FemtoCascadeQa, processXi, "Process Xis", true); + + void processXiMc(FilteredFemtoCollisionWithLabel const& col, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoXisWithLabel const& /*xis*/, FMcParticles const& mcParticles, FMcMothers const& mcMothers, FMcPartMoths const& mcPartonicMothers) + { + colHistManager.fill(col, mcCols); + auto xiSlice = xiWithLabelPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + for (auto const& xi : xiSlice) { + if (!xiCleaner.isClean(xi, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } + xiHistManager.fill(xi, tracks, mcParticles, mcMothers, mcPartonicMothers); + } + } + PROCESS_SWITCH(FemtoCascadeQa, processXiMc, "Process Xis with MC information", false); - void processOmegas(FilteredFemtoCollision const& col, FemtoOmegas const& /*omegas*/, FemtoTracks const& tracks) + void processOmega(FilteredFemtoCollision const& col, FemtoOmegas const& /*omegas*/, FemtoTracks const& tracks) { colHistManager.fill(col); auto omegaSlice = omegaPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); @@ -145,7 +194,20 @@ struct FemtoCascadeQa { omegaHistManager.fill(omega, tracks); } } - PROCESS_SWITCH(FemtoCascadeQa, processOmegas, "Process Omegas", false); + PROCESS_SWITCH(FemtoCascadeQa, processOmega, "Process Omegas", false); + + void processOmegaMc(FilteredFemtoCollisionWithLabel const& col, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoOmegasWithLabel const& /*omegas*/, FMcParticles const& mcParticles, FMcMothers const& mcMothers, FMcPartMoths const& mcPartonicMothers) + { + colHistManager.fill(col, mcCols); + auto omegaSlice = omegaWithLabelPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); + for (auto const& omega : omegaSlice) { + if (!omegaCleaner.isClean(omega, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } + omegaHistManager.fill(omega, tracks, mcParticles, mcMothers, mcPartonicMothers); + } + } + PROCESS_SWITCH(FemtoCascadeQa, processOmegaMc, "Process Omegas with MC information", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGCF/Femto/Tasks/femtoKinkQa.cxx b/PWGCF/Femto/Tasks/femtoKinkQa.cxx index 7887b563463..e64c99b193a 100644 --- a/PWGCF/Femto/Tasks/femtoKinkQa.cxx +++ b/PWGCF/Femto/Tasks/femtoKinkQa.cxx @@ -19,6 +19,7 @@ #include "PWGCF/Femto/Core/kinkBuilder.h" #include "PWGCF/Femto/Core/kinkHistManager.h" #include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackHistManager.h" #include "PWGCF/Femto/DataModel/FemtoTables.h" @@ -75,6 +76,9 @@ struct FemtoKinkQa { // setup for sigmas kinkbuilder::ConfSigmaSelection1 confSigmaSelection; + particlecleaner::ConfSigmaCleaner1 confSigmaCleaner; + particlecleaner::ParticleCleaner sigmaCleaner; + Partition sigmaPartition = MAKE_SIGMA_PARTITION(confSigmaSelection); Preslice perColSigmas = femtobase::stored::fColId; @@ -92,6 +96,9 @@ struct FemtoKinkQa { // setup for sigma plus kinkbuilder::ConfSigmaPlusSelection1 confSigmaPlusSelection; + particlecleaner::ConfSigmaPlusCleaner1 confSigmaPlusCleaner; + particlecleaner::ParticleCleaner sigmaPlusCleaner; + Partition sigmaPlusPartition = MAKE_SIGMAPLUS_PARTITION(confSigmaPlusSelection); Preslice perColSigmaPlus = femtobase::stored::fColId; @@ -119,7 +126,8 @@ struct FemtoKinkQa { } bool processData = doprocessSigma || doprocessSigmaPlus; - + sigmaCleaner.init(confSigmaCleaner); + sigmaPlusCleaner.init(confSigmaPlusCleaner); if (processData) { auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); @@ -163,6 +171,9 @@ struct FemtoKinkQa { colHistManager.fill(col, mcCols); auto sigmaSlice = sigmaWithLabelPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& sigma : sigmaSlice) { + if (!sigmaCleaner.isClean(sigma, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } sigmaHistManager.fill(sigma, tracks, mcParticles, mcMothers, mcPartonicMothers); } } @@ -185,6 +196,9 @@ struct FemtoKinkQa { colHistManager.fill(col, mcCols); auto sigmaPlusSlice = sigmaPlusWithLabelPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& sigmaPlus : sigmaPlusSlice) { + if (!sigmaPlusCleaner.isClean(sigmaPlus, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } sigmaPlusHistManager.fill(sigmaPlus, tracks, mcParticles, mcMothers, mcPartonicMothers); } } diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index 905817348fd..cb3b929537c 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -21,6 +21,7 @@ #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/pairBuilder.h" #include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackBuilder.h" #include "PWGCF/Femto/Core/trackHistManager.h" @@ -68,9 +69,10 @@ struct FemtoPairTrackCascade { colhistmanager::ConfCollisionBinning confCollisionBinning; // setup tracks - trackbuilder::ConfTrackSelection1 trackSelection; + trackbuilder::ConfTrackSelection1 confTrackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; - Partition trackPartition = MAKE_TRACK_PARTITION(trackSelection); + particlecleaner::ConfTrackCleaner1 confTrackCleaner; + Partition trackPartition = MAKE_TRACK_PARTITION(confTrackSelection); Preslice perColTracks = aod::femtobase::stored::fColId; // setup for daughters/bachelor @@ -79,15 +81,17 @@ struct FemtoPairTrackCascade { trackhistmanager::ConfCascadeBachelorBinning confBachelorBinning; // setup xis - cascadebuilder::ConfXiSelection xiSelection; + cascadebuilder::ConfXiSelection confXiSelection; cascadehistmanager::ConfXiBinning confXiBinning; - Partition xiPartition = MAKE_CASCADE_PARTITION(xiSelection); + particlecleaner::ConfXiCleaner1 confXiCleaner; + Partition xiPartition = MAKE_CASCADE_PARTITION(confXiSelection); Preslice perColXis = aod::femtobase::stored::fColId; // setup omegas - cascadebuilder::ConfOmegaSelection omegaSelection; + cascadebuilder::ConfOmegaSelection confOmegaSelection; cascadehistmanager::ConfOmegaBinning confOmegaBinning; - Partition omegaPartition = MAKE_CASCADE_PARTITION(omegaSelection); + particlecleaner::ConfOmegaCleaner1 confOmegaCleaner; + Partition omegaPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); Preslice perColOmegas = aod::femtobase::stored::fColId; // setup pairs @@ -162,14 +166,14 @@ struct FemtoPairTrackCascade { if (doprocessXiSameEvent || doprocessXiMixedEvent) { auto xiHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confXiBinning); auto pairTrackXiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter); + pairTrackXiBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, confXiSelection, confXiCleaner, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter); } // setup for omegas if (doprocessOmegaSameEvent || doprocessOmegaMixedEvent) { auto omegaHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confOmegaBinning); auto pairTrackOmegaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - pairTrackOmegaBuilder.init(&hRegistry, trackSelection, xiSelection, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter); + pairTrackOmegaBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, confOmegaSelection, confOmegaCleaner, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter); } if (((doprocessXiSameEvent || doprocessXiMixedEvent) + (doprocessOmegaSameEvent || doprocessOmegaMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx index 438c91b474c..55b1717b0c8 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx @@ -22,6 +22,7 @@ #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/pairBuilder.h" #include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackBuilder.h" #include "PWGCF/Femto/Core/trackHistManager.h" @@ -77,6 +78,7 @@ struct FemtoPairTrackKink { // setup tracks trackbuilder::ConfTrackSelection1 confTrackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; + particlecleaner::ConfTrackCleaner1 confTrackCleaner; Partition trackPartition = MAKE_TRACK_PARTITION(confTrackSelection); Preslice perColTracks = aod::femtobase::stored::fColId; @@ -90,6 +92,7 @@ struct FemtoPairTrackKink { // setup sigmas kinkbuilder::ConfSigmaSelection1 confSigmaSelection; kinkhistmanager::ConfSigmaBinning1 confSigmaBinning; + particlecleaner::ConfSigmaCleaner1 confSigmaCleaner; Partition sigmaPartition = MAKE_SIGMA_PARTITION(confSigmaSelection); Preslice perColSigmas = aod::femtobase::stored::fColId; @@ -100,6 +103,7 @@ struct FemtoPairTrackKink { // setup for sigma plus kinkbuilder::ConfSigmaPlusSelection1 confSigmaPlusSelection; kinkhistmanager::ConfSigmaPlusBinning1 confSigmaPlusBinning; + particlecleaner::ConfSigmaPlusCleaner1 confSigmaPlusCleaner; Partition sigmaPlusPartition = MAKE_SIGMAPLUS_PARTITION(confSigmaPlusSelection); Preslice perColSigmaPlus = aod::femtobase::stored::fColId; @@ -178,10 +182,10 @@ struct FemtoPairTrackKink { auto pairTrackKinkHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); if (processSigma) { auto sigmaHistSpec = kinkhistmanager::makeKinkHistSpecMap(confSigmaBinning); - pairTrackSigmaBuilder.init(&hRegistry, confTrackSelection, confSigmaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairTrackKinkHistSpec, cprHistSpec); + pairTrackSigmaBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, confSigmaSelection, confSigmaCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairTrackKinkHistSpec, cprHistSpec); } else { auto sigmaplusHistSpec = kinkhistmanager::makeKinkHistSpecMap(confSigmaPlusBinning); - pairTrackSigmaPlusBuilder.init(&hRegistry, confTrackSelection, confSigmaPlusSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, sigmaplusHistSpec, chaDauSpec, pairTrackKinkHistSpec, cprHistSpec); + pairTrackSigmaPlusBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, confSigmaPlusSelection, confSigmaPlusCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, sigmaplusHistSpec, chaDauSpec, pairTrackKinkHistSpec, cprHistSpec); } } else { auto colHistSpec = colhistmanager::makeColMcHistSpecMap(confCollisionBinning); @@ -190,10 +194,10 @@ struct FemtoPairTrackKink { auto pairTrackKinkHistSpec = pairhistmanager::makePairMcHistSpecMap(confPairBinning); if (processSigma) { auto sigmaHistSpec = kinkhistmanager::makeKinkMcHistSpecMap(confSigmaBinning); - pairTrackSigmaBuilder.init(&hRegistry, confTrackSelection, confSigmaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairTrackKinkHistSpec, cprHistSpec); + pairTrackSigmaBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, confSigmaSelection, confSigmaCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairTrackKinkHistSpec, cprHistSpec); } else { auto sigmaplusHistSpec = kinkhistmanager::makeKinkMcHistSpecMap(confSigmaPlusBinning); - pairTrackSigmaPlusBuilder.init(&hRegistry, confTrackSelection, confSigmaPlusSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, sigmaplusHistSpec, chaDauSpec, pairTrackKinkHistSpec, cprHistSpec); + pairTrackSigmaPlusBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, confSigmaPlusSelection, confSigmaPlusCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, sigmaplusHistSpec, chaDauSpec, pairTrackKinkHistSpec, cprHistSpec); } } hRegistry.print(); @@ -217,9 +221,9 @@ struct FemtoPairTrackKink { } PROCESS_SWITCH(FemtoPairTrackKink, processSigmaMixedEvent, "Enable processing mixed event processing for tracks and sigmas", true); - void processSigmaMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoSigmasWithLabel const& /*sigmas*/, FMcParticles const& mcParticles) + void processSigmaMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoSigmasWithLabel const& /*sigmas*/, FMcParticles const& mcParticles, FMcMothers const& mcMothers, FMcPartMoths const& mcPartonicMothers) { - pairTrackSigmaBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, sigmaWithLabelPartition, mcParticles, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairTrackSigmaBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, sigmaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairTrackKink, processSigmaMixedEventMc, "Enable processing mixed event processing for tracks and sigmas with MC information", false); @@ -241,9 +245,9 @@ struct FemtoPairTrackKink { } PROCESS_SWITCH(FemtoPairTrackKink, processSigmaPlusMixedEvent, "Enable processing mixed event processing for tracks and sigma plus", false); - void processSigmaPlusMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoSigmaPlusWithLabel const& /*sigmaplus*/, FMcParticles const& mcParticles) + void processSigmaPlusMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoSigmaPlusWithLabel const& /*sigmaplus*/, FMcParticles const& mcParticles, FMcMothers const& mcMothers, FMcPartMoths const& mcPartonicMothers) { - pairTrackSigmaPlusBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, sigmaPlusWithLabelPartition, mcParticles, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairTrackSigmaPlusBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, sigmaPlusWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairTrackKink, processSigmaPlusMixedEventMc, "Enable processing mixed event processing for tracks and sigma plus with MC information", false); }; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index f8a647dfcfe..6a13f9b5745 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -19,6 +19,7 @@ #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/pairBuilder.h" #include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackBuilder.h" #include "PWGCF/Femto/Core/trackHistManager.h" @@ -35,7 +36,6 @@ #include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" -#include #include using namespace o2; @@ -69,8 +69,11 @@ struct FemtoPairTrackTrack { // setup tracks trackbuilder::ConfTrackSelection1 confTrackSelections1; + particlecleaner::ConfTrackCleaner1 confTrackCleaner1; trackhistmanager::ConfTrackBinning1 confTrackBinning1; + trackbuilder::ConfTrackSelection2 confTrackSelections2; + particlecleaner::ConfTrackCleaner2 confTrackCleaner2; trackhistmanager::ConfTrackBinning2 confTrackBinning2; Partition trackPartition1 = MAKE_TRACK_PARTITION(confTrackSelections1); @@ -132,13 +135,13 @@ struct FemtoPairTrackTrack { auto trackHistSpec1 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning1); auto trackHistSpec2 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning2); auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - pairTrackTrackBuilder.init(&hRegistry, confTrackSelections1, confTrackSelections2, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); + pairTrackTrackBuilder.init(&hRegistry, confTrackSelections1, confTrackSelections2, confTrackCleaner1, confTrackCleaner2, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); } else { auto colHistSpec = colhistmanager::makeColMcHistSpecMap(confCollisionBinning); auto trackHistSpec1 = trackhistmanager::makeTrackMcHistSpecMap(confTrackBinning1); auto trackHistSpec2 = trackhistmanager::makeTrackMcHistSpecMap(confTrackBinning2); auto pairHistSpec = pairhistmanager::makePairMcHistSpecMap(confPairBinning); - pairTrackTrackBuilder.init(&hRegistry, confTrackSelections1, confTrackSelections2, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); + pairTrackTrackBuilder.init(&hRegistry, confTrackSelections1, confTrackSelections2, confTrackCleaner1, confTrackCleaner2, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); } hRegistry.print(); }; @@ -161,9 +164,9 @@ struct FemtoPairTrackTrack { } PROCESS_SWITCH(FemtoPairTrackTrack, processMixedEvent, "Enable processing mixed event processing", true); - void processMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FMcParticles const& mcParticles) + void processMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FMcParticles const& mcParticles, FMcMothers const& mcMothers, FMcPartMoths const& mcPartonicMothers) { - pairTrackTrackBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition1, trackWithLabelPartition2, mcParticles, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairTrackTrackBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition1, trackWithLabelPartition2, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairTrackTrack, processMixedEventMc, "Enable processing mixed event processing", false); }; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index 550d9778c6b..934e8406684 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -19,6 +19,7 @@ #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/pairBuilder.h" #include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackBuilder.h" #include "PWGCF/Femto/Core/trackHistManager.h" @@ -76,6 +77,7 @@ struct FemtoPairTrackV0 { // setup tracks trackbuilder::ConfTrackSelection1 confTrackSelection; trackhistmanager::ConfTrackBinning1 confTrackBinning; + particlecleaner::ConfTrackCleaner1 confTrackCleaner; Partition trackPartition = MAKE_TRACK_PARTITION(confTrackSelection); Preslice perColTracks = aod::femtobase::stored::fColId; @@ -90,6 +92,7 @@ struct FemtoPairTrackV0 { // setup lambdas v0builder::ConfLambdaSelection1 lambdaSelection; v0histmanager::ConfLambdaBinning1 confLambdaBinning; + particlecleaner::ConfLambdaCleaner1 confLambdaCleaner; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); Preslice perColLambdas = aod::femtobase::stored::fColId; @@ -100,6 +103,7 @@ struct FemtoPairTrackV0 { // setup k0shorts v0builder::ConfK0shortSelection1 k0shortSelection; v0histmanager::ConfK0shortBinning1 confK0shortBinning; + particlecleaner::ConfK0shortCleaner1 confK0shortCleaner; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); Preslice perColk0shorts = aod::femtobase::stored::fColId; @@ -181,10 +185,10 @@ struct FemtoPairTrackV0 { auto pairTrackV0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); if (processLambda) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); - pairTrackLambdaBuilder.init(&hRegistry, confTrackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec); + pairTrackLambdaBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, lambdaSelection, confLambdaCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec); } else { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); - pairTrackK0shortBuilder.init(&hRegistry, confTrackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec); + pairTrackK0shortBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, lambdaSelection, confTrackCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec); } } else { auto colHistSpec = colhistmanager::makeColMcHistSpecMap(confCollisionBinning); @@ -194,10 +198,10 @@ struct FemtoPairTrackV0 { auto pairTrackV0HistSpec = pairhistmanager::makePairMcHistSpecMap(confPairBinning); if (processLambda) { auto lambdaHistSpec = v0histmanager::makeV0McHistSpecMap(confLambdaBinning); - pairTrackLambdaBuilder.init(&hRegistry, confTrackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec); + pairTrackLambdaBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, lambdaSelection, confLambdaCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec); } else { auto k0shortHistSpec = v0histmanager::makeV0McHistSpecMap(confK0shortBinning); - pairTrackK0shortBuilder.init(&hRegistry, confTrackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec); + pairTrackK0shortBuilder.init(&hRegistry, confTrackSelection, confTrackCleaner, lambdaSelection, confLambdaCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec); } } hRegistry.print(); @@ -221,9 +225,9 @@ struct FemtoPairTrackV0 { } PROCESS_SWITCH(FemtoPairTrackV0, processLambdaMixedEvent, "Enable processing mixed event processing for tracks and lambdas", true); - void processLambdaMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& /*lambas*/, FMcParticles const& mcParticles) + void processLambdaMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& /*lambas*/, FMcParticles const& mcParticles, FMcMothers const& mcMothers, FMcPartMoths const& mcPartonicMothers) { - pairTrackLambdaBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, lambdaWithLabelPartition, mcParticles, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairTrackLambdaBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, lambdaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairTrackV0, processLambdaMixedEventMc, "Enable processing mixed event processing for tracks and lambdas with MC information", false); @@ -245,9 +249,9 @@ struct FemtoPairTrackV0 { } PROCESS_SWITCH(FemtoPairTrackV0, processK0shortMixedEvent, "Enable processing mixed event processing for tracks and k0shorts", false); - void processK0shortMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoK0shortsWithLabel const& /*k0shorts*/, FMcParticles const& mcParticles) + void processK0shortMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoK0shortsWithLabel const& /*k0shorts*/, FMcParticles const& mcParticles, FMcMothers const& mcMothers, FMcPartMoths const& mcPartonicMothers) { - pairTrackK0shortBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, k0shortWithLabelPartition, mcParticles, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairTrackK0shortBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, k0shortWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairTrackV0, processK0shortMixedEventMc, "Enable processing mixed event processing for tracks and k0shorts with mc information", false); }; diff --git a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx index b3cf25d3967..d1d8c045724 100644 --- a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx @@ -19,8 +19,8 @@ #include "PWGCF/Femto/Core/modes.h" #include "PWGCF/Femto/Core/pairBuilder.h" #include "PWGCF/Femto/Core/pairHistManager.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/partitions.h" -#include "PWGCF/Femto/Core/trackBuilder.h" #include "PWGCF/Femto/Core/trackHistManager.h" #include "PWGCF/Femto/Core/v0Builder.h" #include "PWGCF/Femto/Core/v0HistManager.h" @@ -72,15 +72,17 @@ struct FemtoPairV0V0 { trackhistmanager::ConfV0NegDauBinning confNegDauBinning; // setup lambdas - v0builder::ConfLambdaSelection1 lambdaSelection; + v0builder::ConfLambdaSelection1 confLambdaSelection; + particlecleaner::ConfLambdaCleaner1 confLambdaCleaner; v0histmanager::ConfLambdaBinning1 confLambdaBinning; - Partition lambdaPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); + Partition lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); Preslice perColLambdas = aod::femtobase::stored::fColId; // setup k0shorts - v0builder::ConfK0shortSelection1 k0shortSelection; + v0builder::ConfK0shortSelection1 confK0shortSelection; + particlecleaner::ConfK0shortCleaner1 confK0shortCleaner; v0histmanager::ConfK0shortBinning1 confK0shortBinning; - Partition k0shortPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); + Partition k0shortPartition = MAKE_K0SHORT_PARTITION(confK0shortSelection); Preslice perColk0shorts = aod::femtobase::stored::fColId; // setup pairs @@ -160,14 +162,14 @@ struct FemtoPairV0V0 { if (doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpecPos, cprHistSpecNeg); + pairLambdaLambdaBuilder.init(&hRegistry, confLambdaSelection, confLambdaSelection, confLambdaCleaner, confLambdaCleaner, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpecPos, cprHistSpecNeg); } // setup for k0short if (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent) { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); auto pairK0shortK0shortHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning); - pairK0shortK0shortBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairK0shortK0shortHistSpec, cprHistSpecPos, cprHistSpecNeg); + pairK0shortK0shortBuilder.init(&hRegistry, confK0shortSelection, confK0shortSelection, confK0shortCleaner, confK0shortCleaner, confCprPos, confCprNeg, confMixing, confPairBinning, confPairCuts, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairK0shortK0shortHistSpec, cprHistSpecPos, cprHistSpecNeg); } }; diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index 52d082ff7fa..aa85a2c4d17 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -16,6 +16,7 @@ #include "PWGCF/Femto/Core/collisionBuilder.h" #include "PWGCF/Femto/Core/collisionHistManager.h" #include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackBuilder.h" #include "PWGCF/Femto/Core/trackHistManager.h" @@ -30,8 +31,6 @@ #include "Framework/OutputObjHeader.h" #include "Framework/runDataProcessing.h" -#include - using namespace o2::aod; using namespace o2::framework; using namespace o2::framework::expressions; @@ -70,6 +69,9 @@ struct FemtoTrackQa { Partition trackPartition = MAKE_TRACK_PARTITION(confTrackSelection); Preslice perColReco = femtobase::stored::fColId; + particlecleaner::ConfTrackCleaner1 confTrackCleaner; + particlecleaner::ParticleCleaner trackCleaner; + Partition trackWithLabelPartition = MAKE_TRACK_PARTITION(confTrackSelection); Preslice perColRecoWithLabel = femtobase::stored::fColId; @@ -100,6 +102,7 @@ struct FemtoTrackQa { LOG(fatal) << "More than 1 process function is activated. Breaking..."; } bool processData = doprocessData; + trackCleaner.init(confTrackCleaner); if (processData) { auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); @@ -130,6 +133,9 @@ struct FemtoTrackQa { auto trackSlice = trackWithLabelPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& track : trackSlice) { + if (!trackCleaner.isClean(track, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } trackHistManager.fill(track, tracks, mcParticles, mcMothers, mcPartonicMothers); } } diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx index 1d1e0ec45f9..bfe3c56d588 100644 --- a/PWGCF/Femto/Tasks/femtoV0Qa.cxx +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -16,6 +16,7 @@ #include "PWGCF/Femto/Core/collisionBuilder.h" #include "PWGCF/Femto/Core/collisionHistManager.h" #include "PWGCF/Femto/Core/modes.h" +#include "PWGCF/Femto/Core/particleCleaner.h" #include "PWGCF/Femto/Core/partitions.h" #include "PWGCF/Femto/Core/trackHistManager.h" #include "PWGCF/Femto/Core/v0Builder.h" @@ -69,6 +70,7 @@ struct FemtoV0Qa { colhistmanager::ConfCollisionQaBinning confCollisionQaBinning; // setup for lambdas + particlecleaner::ConfLambdaCleaner1 confLambdaCleaner; v0builder::ConfLambdaSelection1 confLambdaSelection; Partition lambdaPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); @@ -77,6 +79,8 @@ struct FemtoV0Qa { Partition lambdaWithLabelPartition = MAKE_LAMBDA_PARTITION(confLambdaSelection); Preslice perColLambdasWithLabel = femtobase::stored::fColId; + particlecleaner::ParticleCleaner lambdaCleaner; + v0histmanager::ConfLambdaBinning1 confLambdaBinning; v0histmanager::ConfLambdaQaBinning1 confLambdaQaBinning; v0histmanager::V0HistManager< @@ -87,6 +91,7 @@ struct FemtoV0Qa { lambdaHistManager; // setup for k0shorts + particlecleaner::ConfK0shortCleaner1 confK0shortCleaner; v0builder::ConfK0shortSelection1 confK0shortSelection; Partition k0shortPartition = MAKE_K0SHORT_PARTITION(confK0shortSelection); @@ -95,6 +100,8 @@ struct FemtoV0Qa { Partition k0shortWithLabelPartition = MAKE_K0SHORT_PARTITION(confK0shortSelection); Preslice perColK0shortsWithLabel = femtobase::stored::fColId; + particlecleaner::ParticleCleaner k0shortCleaner; + v0histmanager::ConfK0shortBinning1 confK0shortBinning; v0histmanager::ConfK0shortQaBinning1 confK0shortQaBinning; v0histmanager::V0HistManager< @@ -118,9 +125,10 @@ struct FemtoV0Qa { if ((doprocessLambda + doprocessLambdaMc + doprocessK0short + doprocessK0shortMc) > 1) { LOG(fatal) << "Only one process can be activated"; } - bool processData = doprocessLambda || doprocessK0short; + lambdaCleaner.init(confLambdaCleaner); + k0shortCleaner.init(confK0shortCleaner); if (processData) { auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); @@ -166,10 +174,13 @@ struct FemtoV0Qa { colHistManager.fill(col, mcCols); auto k0shortSlice = k0shortWithLabelPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& k0short : k0shortSlice) { + if (!k0shortCleaner.isClean(k0short, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } k0shortHistManager.fill(k0short, tracks, mcParticles, mcMothers, mcPartonicMothers); } } - PROCESS_SWITCH(FemtoV0Qa, processK0shortMc, "Process k0shorts", false); + PROCESS_SWITCH(FemtoV0Qa, processK0shortMc, "Process k0shorts with MC information", false); void processLambda(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoLambdas const& /*lambdas*/) { @@ -186,6 +197,9 @@ struct FemtoV0Qa { colHistManager.fill(col, mcCols); auto lambdaSlice = lambdaWithLabelPartition->sliceByCached(femtobase::stored::fColId, col.globalIndex(), cache); for (auto const& lambda : lambdaSlice) { + if (!lambdaCleaner.isClean(lambda, mcParticles, mcMothers, mcPartonicMothers)) { + continue; + } lambdaHistManager.fill(lambda, tracks, mcParticles, mcMothers, mcPartonicMothers); } }