diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index a8ab5f6620c..3dda17bf3a5 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -481,10 +481,12 @@ struct CascadeBuilderProducts : o2::framework::ProducesGroup { o2::framework::Produces producedLiteXis; o2::framework::Produces producedXiMasks; o2::framework::Produces producedXiExtras; + o2::framework::Produces producedXiFrac; o2::framework::Produces producedOmegas; o2::framework::Produces producedLiteOmegas; o2::framework::Produces producedOmegaMasks; o2::framework::Produces producedOmegaExtras; + o2::framework::Produces producedOmegaFrac; }; struct ConfCascadeTables : o2::framework::ConfigurableGroup { @@ -493,10 +495,12 @@ struct ConfCascadeTables : o2::framework::ConfigurableGroup { o2::framework::Configurable produceLiteXis{"produceLiteXis", -1, "Produce LiteXis (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceXiMasks{"produceXiMasks", -1, "Produce XiMasks (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceXiExtras{"produceXiExtras", -1, "Produce XiExtras (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceXiFrac{"produceXiFrac", -1, "Produce XiFrac (cpa for fraction extraction) (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceOmegas{"produceOmegas", -1, "Produce Omegas (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceLiteOmegas{"produceLiteOmegas", -1, "Produce LiteOmegas (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceOmegaMasks{"produceOmegaMasks", -1, "Produce OmegaMasks (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceOmegaExtras{"produceOmegaExtras", -1, "Produce OmegaExtras (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceOmegaFrac{"produceOmegaFrac", -1, "Produce OmegaFrac (cpa for fraction extraction) (-1: auto; 0 off; 1 on)"}; }; template @@ -515,6 +519,7 @@ class CascadeBuilder mProduceXis = utils::enableTable("FXis_001", table.produceXis.value, initContext); mProduceXiMasks = utils::enableTable("FXiMasks_002", table.produceXiMasks.value, initContext); mProduceXiExtras = utils::enableTable("FXiExtras_001", table.produceXiExtras.value, initContext); + mProduceXiFrac = utils::enableTable("FXiFrac_001", table.produceXiFrac.value, initContext); if (mProduceXis && mProduceLiteXis) { LOG(fatal) << "FXis and FLiteXis are mutually exclusive -- enable only one. " @@ -538,6 +543,7 @@ class CascadeBuilder mProduceLiteOmegas = utils::enableTable("FLiteOmegas_001", table.produceLiteOmegas.value, initContext); mProduceOmegaMasks = utils::enableTable("FOmegaMasks_002", table.produceOmegaMasks.value, initContext); mProduceOmegaExtras = utils::enableTable("FOmegaExtras_001", table.produceOmegaExtras.value, initContext); + mProduceOmegaFrac = utils::enableTable("FOmegaFrac_001", table.produceOmegaFrac.value, initContext); if (mProduceOmegas && mProduceLiteOmegas) { LOG(fatal) << "FOmegas and FLiteOmegas are mutually exclusive -- enable only one. " @@ -556,8 +562,8 @@ class CascadeBuilder } } - if (mProduceXis || mProduceLiteXis || mProduceXiExtras || mProduceXiMasks || - mProduceOmegas || mProduceLiteOmegas || mProduceOmegaMasks || mProduceOmegaExtras) { + if (mProduceXis || mProduceLiteXis || mProduceXiExtras || mProduceXiFrac || mProduceXiMasks || + mProduceOmegas || mProduceLiteOmegas || mProduceOmegaMasks || mProduceOmegaExtras || mProduceOmegaFrac) { mFillAnyTable = true; } else { LOG(info) << "No tables configured, Selection object will not be configured..."; @@ -701,6 +707,9 @@ class CascadeBuilder strangeTofPosDau, strangeTofNegDau); } + if (mProduceXiFrac) { + cascadeProducts.producedXiFrac(cascade.casccosPA(col.posX(), col.posY(), col.posZ())); + } } if constexpr (modes::isEqual(cascadeType, modes::Cascade::kOmega)) { if (mProduceOmegas) { @@ -741,6 +750,9 @@ class CascadeBuilder strangeTofPosDau, strangeTofNegDau); } + if (mProduceOmegaFrac) { + cascadeProducts.producedOmegaFrac(cascade.casccosPA(col.posX(), col.posY(), col.posZ())); + } } } @@ -754,10 +766,12 @@ class CascadeBuilder bool mProduceLiteXis = false; bool mProduceXiMasks = false; bool mProduceXiExtras = false; + bool mProduceXiFrac = false; bool mProduceOmegas = false; bool mProduceLiteOmegas = false; bool mProduceOmegaMasks = false; bool mProduceOmegaExtras = false; + bool mProduceOmegaFrac = false; }; struct ConfCascadeTablesDerivedToDerived : o2::framework::ConfigurableGroup { diff --git a/PWGCF/Femto/Core/cascadeHistManager.h b/PWGCF/Femto/Core/cascadeHistManager.h index 6d83ee144fe..73d13b7a6a8 100644 --- a/PWGCF/Femto/Core/cascadeHistManager.h +++ b/PWGCF/Femto/Core/cascadeHistManager.h @@ -46,7 +46,8 @@ enum CascadeHist { kPhi, kMass, kSign, - kPtVsMass, // nice to have during analysis + kPtVsMass, // nice to have during analysis + kFractionCpa, // fraction estimation: pt vs cosPa, binned independently of the QA cosPa axis // qa variables kMassXi, kMassOmega, @@ -66,7 +67,6 @@ enum CascadeHist { kPtVsEta, kPtVsPhi, kPhiVsEta, - kPtVsCosPa, kPtVsPa, kPtVsMassXi, kPtVsMassOmega, @@ -107,6 +107,7 @@ struct ConfCascadeBinning : o2::framework::ConfigurableGroup { 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"}; + o2::framework::ConfigurableAxis fractionCpa{"fractionCpa", {{100, 0.95, 1}}, "Cosine of pointing angle (fraction estimation)"}; }; constexpr const char PrefixXiBinning[] = "XiBinning"; @@ -120,7 +121,7 @@ struct ConfCascadeQaBinning : o2::framework::ConfigurableGroup { o2::framework::Configurable plot2d{"plot2d", true, "Enable 2d Qa histograms"}; o2::framework::Configurable plotOrigins{"plotOrigins", true, "MC ONLY: Plot pt vs cosPa for different particle origins"}; o2::framework::Configurable> pdgCodesForMothersOfSecondary{"pdgCodesForMothersOfSecondary", {3312, 3334}, "MC ONLY: PDG codes of mothers of secondaries (Max 3 will be considered)"}; - o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.9, 1}}, "Cosine of pointing angle"}; + o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.95, 1}}, "Cosine of pointing angle"}; o2::framework::ConfigurableAxis pa{"pa", {{180, 0, 1.f * o2::constants::math::PI}}, "Pointing angle"}; o2::framework::ConfigurableAxis dauDcaAtDecay{"dauDcaAtDecay", {{150, 0, 1.5}}, "Daughter DCA at decay vertex"}; o2::framework::ConfigurableAxis transRadius{"transRadius", {{100, 0, 100}}, "Transverse radius"}; @@ -149,6 +150,7 @@ constexpr std::array, kCascadeHistLast> HistT {kMass, o2::framework::HistType::kTH1F, "hMass", "Invariant Mass; m_{Inv} (GeV/#it{c}^{2}); Entries"}, {kSign, o2::framework::HistType::kTH1F, "hSign", "Sign (-1 -> particle, 0 -> self conjugate, +1 -> antiparticle); sign; Entries"}, {kPtVsMass, o2::framework::HistType::kTH2F, "hPtVsMass", "Transverse momentum vs invariant mass; p_{T} (GeV/#it{c}); m_{Inv} (GeV/#it{c}^{2})"}, + {kFractionCpa, o2::framework::HistType::kTH2F, "hFractionCpa", "p_{T} vs Cosine of pointing angle (fraction estimation); p_{T} (GeV/#it{c}); cos(#alpha)"}, {kMassXi, o2::framework::HistType::kTH1F, "hMassXi", "Mass #Xi; m_{#Lambda#pi} (GeV/#it{c}^{2}); Entries"}, {kMassOmega, o2::framework::HistType::kTH1F, "hMassOmega", "mass #Omega; m_{#LambdaK} (GeV/#it{c}^{2}); Entries"}, {kCosPa, o2::framework::HistType::kTH1F, "hCosPa", "Cosine of pointing angle; cos(#alpha); Entries"}, @@ -166,7 +168,6 @@ constexpr std::array, kCascadeHistLast> HistT {kPtVsEta, o2::framework::HistType::kTH2F, "hPtVsEta", "p_{T} vs #eta; p_{T} (GeV/#it{c}) ; #eta"}, {kPtVsPhi, o2::framework::HistType::kTH2F, "hPtVsPhi", "p_{T} vs #varphi; p_{T} (GeV/#it{c}) ; #varphi"}, {kPhiVsEta, o2::framework::HistType::kTH2F, "hPhiVsEta", "#varphi vs #eta; #varphi ; #eta"}, - {kPtVsCosPa, o2::framework::HistType::kTH2F, "hPtVsCosPa", "p_{T} vs Cosine of pointing angle; p_{T} (GeV/#it{c}); cos(#alpha)"}, {kPtVsPa, o2::framework::HistType::kTH2F, "hPtVsPa", "p_{T} vs Pointing angle; p_{T} (GeV/#it{c}); #alpha"}, {kPtVsMassXi, o2::framework::HistType::kTH2F, "hPtVsMassXi", "p_{T} vs mass #Xi; p_{T} (GeV/#it{c}); m_{#Lambda#pi} (GeV/#it{c}^{2})"}, {kPtVsMassOmega, o2::framework::HistType::kTH2F, "hPtVsMassOmega", "p_{T} vs mass #Omega; p_{T} (GeV/#it{c}); m_{#LambdaK} (GeV/#it{c}^{2})"}, @@ -194,13 +195,14 @@ constexpr std::array, kCascadeHistLast> HistT }; // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define CASCADE_HIST_ANALYSIS_MAP(conf) \ - {kPt, {(conf).pt}}, \ - {kEta, {(conf).eta}}, \ - {kPhi, {(conf).phi}}, \ - {kMass, {(conf).mass}}, \ - {kSign, {(conf).sign}}, \ - {kPtVsMass, {(conf).pt, (conf).mass}}, +#define CASCADE_HIST_ANALYSIS_MAP(conf) \ + {kPt, {(conf).pt}}, \ + {kEta, {(conf).eta}}, \ + {kPhi, {(conf).phi}}, \ + {kMass, {(conf).mass}}, \ + {kSign, {(conf).sign}}, \ + {kPtVsMass, {(conf).pt, (conf).mass}}, \ + {kFractionCpa, {(conf).pt, (conf).fractionCpa}}, // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define CASCADE_HIST_MC_MAP(conf) \ @@ -228,7 +230,6 @@ constexpr std::array, kCascadeHistLast> HistT {kPtVsEta, {(confAnalysis).pt, (confAnalysis).eta}}, \ {kPtVsPhi, {(confAnalysis).pt, (confAnalysis).phi}}, \ {kPhiVsEta, {(confAnalysis).phi, (confAnalysis).eta}}, \ - {kPtVsCosPa, {(confAnalysis).pt, (confQa).cosPa}}, \ {kPtVsPa, {(confAnalysis).pt, (confQa).pa}}, \ {kMassXi, {(confQa).massXi}}, \ {kMassOmega, {(confQa).massOmega}}, \ @@ -240,17 +241,20 @@ constexpr std::array, kCascadeHistLast> HistT {kStrangeTofVsTofPosDau, {(confQa).strangeTof, (confQa).strangeTof}}, \ {kStrangeTofVsTofNegDau, {(confQa).strangeTof, (confQa).strangeTof}}, +// per-origin truth-split variants of the FitVars fraction-estimation CPA histogram; binned on +// fractionCpa (not the QA-only cosPa) so they are available wherever FitVars is, including the +// pair task where no QA binning config exists // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#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}}, +#define CASCADE_HIST_FITVARS_MC_MAP(conf) \ + {kNoMcParticle, {(conf).pt, (conf).fractionCpa}}, \ + {kPrimary, {(conf).pt, (conf).fractionCpa}}, \ + {kFromWrongCollision, {(conf).pt, (conf).fractionCpa}}, \ + {kFromMaterial, {(conf).pt, (conf).fractionCpa}}, \ + {kMissidentified, {(conf).pt, (conf).fractionCpa}}, \ + {kSecondary1, {(conf).pt, (conf).fractionCpa}}, \ + {kSecondary2, {(conf).pt, (conf).fractionCpa}}, \ + {kSecondary3, {(conf).pt, (conf).fractionCpa}}, \ + {kSecondaryOther, {(conf).pt, (conf).fractionCpa}}, template auto makeCascadeHistSpecMap(const T& confBinningAnalysis) @@ -264,7 +268,8 @@ auto makeCascadeMcHistSpecMap(const T& confBinningAnalysis) { return std::map>{ CASCADE_HIST_ANALYSIS_MAP(confBinningAnalysis) - CASCADE_HIST_MC_MAP(confBinningAnalysis)}; + CASCADE_HIST_MC_MAP(confBinningAnalysis) + CASCADE_HIST_FITVARS_MC_MAP(confBinningAnalysis)}; } template @@ -282,13 +287,13 @@ std::map> makeCascadeMcQaHistS CASCADE_HIST_ANALYSIS_MAP(confBinningAnalysis) CASCADE_HIST_QA_MAP(confBinningAnalysis, confBinningQa) CASCADE_HIST_MC_MAP(confBinningAnalysis) - CASCADE_HIST_MC_QA_MAP(confBinningAnalysis, confBinningQa)}; + CASCADE_HIST_FITVARS_MC_MAP(confBinningAnalysis)}; } #undef CASCADE_HIST_ANALYSIS_MAP #undef CASCADE_HIST_MC_MAP #undef CASCADE_HIST_QA_MAP -#undef CASCADE_HIST_MC_QA_MAP +#undef CASCADE_HIST_FITVARS_MC_MAP constexpr char PrefixXiQa[] = "XiQA/"; constexpr char PrefixXiSe[] = "Xi/SE/"; @@ -302,6 +307,7 @@ constexpr char PrefixLambdaCascade[] = "LambdaCascadeQa/"; constexpr std::string_view AnalysisDir = "Analysis/"; constexpr std::string_view QaDir = "QA/"; constexpr std::string_view McDir = "MC/"; +constexpr std::string_view FitVarsDir = "FitVars/"; /// \class FemtoDreamEventHisto /// \brief Class for histogramming event properties @@ -374,6 +380,9 @@ class CascadeHistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { this->initMc(cascadeSpecs); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { + this->template initFitVars(cascadeSpecs); + } } template @@ -443,6 +452,9 @@ class CascadeHistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { this->initMc(cascadeSpecs); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { + this->template initFitVars(cascadeSpecs); + } } template @@ -461,6 +473,9 @@ class CascadeHistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { fillQa(cascadeCandidate, bachelor, posDaughter, negDaughter); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { + this->fillFitVars(cascadeCandidate); + } } template @@ -482,6 +497,9 @@ class CascadeHistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { this->template fillMc(cascadeCandidate, col, mcParticles, mcMothers, mcPartonicMothers); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { + this->fillFitVars(cascadeCandidate); + } } private: @@ -533,7 +551,6 @@ class CascadeHistManager mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {cascadeSpecs.at(kPtVsEta)}); mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {cascadeSpecs.at(kPtVsPhi)}); mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {cascadeSpecs.at(kPhiVsEta)}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {cascadeSpecs.at(kPtVsCosPa)}); mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPa, HistTable), getHistDesc(kPtVsPa, HistTable), getHistType(kPtVsPa, HistTable), {cascadeSpecs.at(kPtVsPa)}); mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassXi, HistTable), getHistDesc(kPtVsMassXi, HistTable), getHistType(kPtVsMassXi, HistTable), {cascadeSpecs.at(kPtVsMassXi)}); @@ -566,24 +583,36 @@ class CascadeHistManager 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)}); + // fraction estimation (CPA); only called when mode carries kFitVars + template + void initFitVars(std::map> const& cascadeSpecs) + { + std::string fitVarsDir = std::string(cascadePrefix) + std::string(FitVarsDir); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kFractionCpa, HistTable), getHistDesc(kFractionCpa, HistTable), getHistType(kFractionCpa, HistTable), {cascadeSpecs.at(kFractionCpa)}); - 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)}); + // per-origin truth-split fraction-CPA templates; need MC truth, so only booked when the mode + // also carries kMc + if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { + if (mPlotOrigins) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kNoMcParticle, HistTable), getHistDesc(kNoMcParticle, HistTable), getHistType(kNoMcParticle, HistTable), {cascadeSpecs.at(kNoMcParticle)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kPrimary, HistTable), getHistDesc(kPrimary, HistTable), getHistType(kPrimary, HistTable), {cascadeSpecs.at(kPrimary)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kFromWrongCollision, HistTable), getHistDesc(kFromWrongCollision, HistTable), getHistType(kFromWrongCollision, HistTable), {cascadeSpecs.at(kFromWrongCollision)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kFromMaterial, HistTable), getHistDesc(kFromMaterial, HistTable), getHistType(kFromMaterial, HistTable), {cascadeSpecs.at(kFromMaterial)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kMissidentified, HistTable), getHistDesc(kMissidentified, HistTable), getHistType(kMissidentified, HistTable), {cascadeSpecs.at(kMissidentified)}); + + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel1) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondary1, HistTable), getHistDesc(kSecondary1, HistTable), getHistType(kSecondary1, HistTable), {cascadeSpecs.at(kSecondary1)}); + } + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel2) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondary2, HistTable), getHistDesc(kSecondary2, HistTable), getHistType(kSecondary2, HistTable), {cascadeSpecs.at(kSecondary2)}); + } + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel3) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondary3, HistTable), getHistDesc(kSecondary3, HistTable), getHistType(kSecondary3, HistTable), {cascadeSpecs.at(kSecondary3)}); + } + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondaryOther, HistTable), getHistDesc(kSecondaryOther, HistTable), getHistType(kSecondaryOther, HistTable), {cascadeSpecs.at(kSecondaryOther)}); } - mHistogramRegistry->add(mcDir + getHistNameV2(kSecondaryOther, HistTable), getHistDesc(kSecondaryOther, HistTable), getHistType(kSecondaryOther, HistTable), {V0Specs.at(kSecondaryOther)}); } } @@ -598,6 +627,12 @@ class CascadeHistManager mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPtVsMass, HistTable)), cascadeCandidate.pt(), cascadeCandidate.mass()); } + template + void fillFitVars(T const& cascadeCandidate) + { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + HIST(getHistName(kFractionCpa, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + } + template void fillQa(T1 const& cascadeCandidate, T2 const& bachelor, T3 const& posDau, T4 const& negDau) { @@ -644,7 +679,6 @@ class CascadeHistManager mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), cascadeCandidate.pt(), cascadeCandidate.eta()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), cascadeCandidate.pt(), cascadeCandidate.phi()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), cascadeCandidate.phi(), cascadeCandidate.eta()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsCosPa, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPa, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadePa()); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMassXi, HistTable)), cascadeCandidate.pt(), massXi); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMassOmega, HistTable)), cascadeCandidate.pt(), massOmega); @@ -663,9 +697,9 @@ class CascadeHistManager 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 constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { if (mPlotOrigins) { - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kNoMcParticle, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + HIST(getHistName(kNoMcParticle, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); } } return; @@ -708,21 +742,21 @@ class CascadeHistManager mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kPdgPartonicMother, HistTable)), 0); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { if (mPlotOrigins) { if (fromWrongCollision) { - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kFromWrongCollision, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + HIST(getHistName(kFromWrongCollision, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); } else if (isMissidentified) { // if it is, we fill it as such - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kMissidentified, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + 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()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + HIST(getHistName(kPrimary, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); break; case modes::McOrigin::kFromMaterial: - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kFromMaterial, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + HIST(getHistName(kFromMaterial, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); break; case modes::McOrigin::kFromSecondaryDecay: if (mcParticle.has_fMcMother()) { @@ -730,13 +764,13 @@ class CascadeHistManager 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()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + 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()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + 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()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondary3, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); } else { - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(McDir) + HIST(getHistName(kSecondaryOther, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondaryOther, HistTable)), cascadeCandidate.pt(), cascadeCandidate.cascadeCosPa()); } } break; @@ -751,7 +785,10 @@ class CascadeHistManager o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; int mPdgCode = 0; - bool mPlotOrigins = false; + // true by default so the per-origin FitVars templates are booked/filled even where + // enableOptionalHistograms() is never called (e.g. the pair task, which has no QA-binning + // config); the QA task can still opt out via its plotOrigins Configurable + bool mPlotOrigins = true; int mPlotNSecondaries = 0; std::array mPdgCodesSecondaryMother = {0}; bool mPlot2d = false; diff --git a/PWGCF/Femto/Core/charmHadronHistManager.h b/PWGCF/Femto/Core/charmHadronHistManager.h index b405f028d6b..a7f78047ac2 100644 --- a/PWGCF/Femto/Core/charmHadronHistManager.h +++ b/PWGCF/Femto/Core/charmHadronHistManager.h @@ -128,7 +128,7 @@ struct ConfCharmHadronQaBinning : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis massD0{"massD0", {{200, 1.7, 2.0}}, "Mass of candidates selected as D0"}; o2::framework::ConfigurableAxis massD0bar{"massD0bar", {{200, 1.7, 2.0}}, "Mass of candidates selected as D0bar"}; o2::framework::ConfigurableAxis mlScore{"mlScore", {{100, 0.f, 1.f}}, "BDT ML score (bkg/prompt/non-prompt)"}; - o2::framework::ConfigurableAxis cpa{"cpa", {{100, 0.9f, 1.f}}, "Cosine of pointing angle"}; + o2::framework::ConfigurableAxis cpa{"cpa", {{100, 0.95f, 1.f}}, "Cosine of pointing angle"}; o2::framework::ConfigurableAxis decayLength{"decayLength", {{200, 0.f, 0.2f}}, "Decay length (cm)"}; o2::framework::ConfigurableAxis impactParameterProduct{"impactParameterProduct", {{200, -0.001f, 0.001f}}, "Product of daughter impact parameters (cm^2)"}; o2::framework::ConfigurableAxis cosThetaStar{"cosThetaStar", {{100, -1.f, 1.f}}, "Cosine of decay angle in D0 rest frame"}; @@ -144,7 +144,7 @@ struct ConfLcQaBinning : o2::framework::ConfigurableGroup { o2::framework::ConfigurableAxis massLcToPKPi{"massLcToPKPi", {{200, 2.15, 2.42}}, "Mass under the p K pi hypothesis"}; o2::framework::ConfigurableAxis massLcToPiKP{"massLcToPiKP", {{200, 2.15, 2.42}}, "Mass under the pi K p hypothesis"}; o2::framework::ConfigurableAxis mlScore{"mlScore", {{100, 0.f, 1.f}}, "BDT ML score (bkg/prompt/non-prompt)"}; - o2::framework::ConfigurableAxis cpa{"cpa", {{100, 0.9f, 1.f}}, "Cosine of pointing angle"}; + o2::framework::ConfigurableAxis cpa{"cpa", {{100, 0.95f, 1.f}}, "Cosine of pointing angle"}; o2::framework::ConfigurableAxis decayLength{"decayLength", {{200, 0.f, 0.2f}}, "Decay length (cm)"}; o2::framework::ConfigurableAxis chi2Pca{"chi2Pca", {{200, 0.f, 0.1f}}, "Sum of distances of the secondary vertex to its prongs (cm)"}; o2::framework::ConfigurableAxis impactParameterProngSqSum{"impactParameterProngSqSum", {{200, 0.f, 0.01f}}, "Sum of squared prong impact parameters (cm^2)"}; diff --git a/PWGCF/Femto/Core/mcBuilder.h b/PWGCF/Femto/Core/mcBuilder.h index 8062322c13b..c0f61d477f5 100644 --- a/PWGCF/Femto/Core/mcBuilder.h +++ b/PWGCF/Femto/Core/mcBuilder.h @@ -654,8 +654,22 @@ class McBuilder } template - int64_t findFirstPartonicMother(const T1& mcParticle, const T2& mcParticles) - { + int64_t findFirstPartonicMother(const T1& mcParticle, const T2& mcParticles, int depth = 0) + { + // guards against cyclic/malformed mother chains in some MC productions, which would + // otherwise recurse unboundedly and crash with a stack overflow; no physically sensible + // generator history is anywhere close to this deep + constexpr int MaxPartonicMotherDepth = 100; + if (depth >= MaxPartonicMotherDepth) { + // some productions hit this on a large fraction of particles (e.g. a mother-range + // heuristic below misfiring on this production's indexing convention), so warn once per + // device lifetime rather than once per particle + if (!mWarnedPartonicMotherDepth) { + LOG(warn) << "findFirstPartonicMother exceeded max recursion depth (" << MaxPartonicMotherDepth << ") at least once; mother chain may be cyclic or malformed for this MC production. Consider using findLastPartonicMother instead. Further occurrences will be suppressed."; + mWarnedPartonicMotherDepth = true; + } + return -1; + } if (!mcParticle.has_mothers()) { return -1; } @@ -689,7 +703,7 @@ class McBuilder return i; // Found a parton → return index } // Recurse upward - int64_t found = this->findFirstPartonicMother(mother, mcParticles); + int64_t found = this->findFirstPartonicMother(mother, mcParticles, depth + 1); if (found != -1) { return found; } @@ -745,6 +759,7 @@ class McBuilder bool mPassThrough = false; bool mFindLastPartonicMother = false; + bool mWarnedPartonicMotherDepth = false; bool mFillAnyTable = false; bool mProduceMcCollisions = false; bool mProduceMcParticles = false; diff --git a/PWGCF/Femto/Core/modes.h b/PWGCF/Femto/Core/modes.h index 8276bac97f2..1f4b9d16b3d 100644 --- a/PWGCF/Femto/Core/modes.h +++ b/PWGCF/Femto/Core/modes.h @@ -57,6 +57,8 @@ enum class Mode : uint32_t { kReco_Qa = kReco | kQa, kReco_Mc = kReco | kMc, kReco_Qa_Mc = kReco | kQa | kMc, + kReco_Qa_FitVars = kReco | kQa | kFitVars, + kReco_Qa_Mc_FitVars = kReco | kQa | kMc | kFitVars, kSe_Reco = kSe | kReco, kMe_Reco = kMe | kReco, kSe_Reco_Mc = kSe | kReco | kMc, diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index 8e885dd6d6b..6a41c2095c8 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -664,8 +664,8 @@ void processMixedEvent(T1 const& Collisions, PairHistManager.trackParticlesPerEvent(p1, p2); PairHistManager.template fill(); // single-particle histograms for particles that make it into an accepted mixed-event pair - ParticleHistManagerMe1.template fill(p1, TrackTable); - ParticleHistManagerMe2.template fill(p2, TrackTable); + ParticleHistManagerMe1.template fill(p1, TrackTable, collision1, mcParticles, mcMothers, mcPartonicMothers); + ParticleHistManagerMe2.template fill(p2, TrackTable, collision2, mcParticles, mcMothers, mcPartonicMothers); } } diff --git a/PWGCF/Femto/Core/photonHistManager.h b/PWGCF/Femto/Core/photonHistManager.h index 5ffe1e390fb..96ab98cc711 100644 --- a/PWGCF/Femto/Core/photonHistManager.h +++ b/PWGCF/Femto/Core/photonHistManager.h @@ -75,7 +75,7 @@ struct ConfPhotonBinning : o2::framework::ConfigurableGroup { struct ConfPhotonQaBinning : o2::framework::ConfigurableGroup { std::string prefix = std::string("PhotonQaBinning"); o2::framework::Configurable plot2d{"plot2d", true, "Generate various 2D QA plots"}; - o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.8, 1}}, "Cosine of pointing angle"}; + o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.95, 1}}, "Cosine of pointing angle"}; o2::framework::ConfigurableAxis pa{"pa", {{180, 0, 1.f * o2::constants::math::PI}}, "Pointing angle"}; o2::framework::ConfigurableAxis dcaToPv{"dcaToPv", {{200, -1, 1}}, "DCA of the photon to the PV (cm)"}; o2::framework::ConfigurableAxis chi2Ndf{"chi2Ndf", {{100, 0, 50}}, "Chi2/NDF of the KF conversion vertex"}; diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h index 296f11ab1aa..82fcbbd26de 100644 --- a/PWGCF/Femto/Core/trackHistManager.h +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -76,7 +76,6 @@ enum TrackHist { kPtVsDcaxy, kPtVsDcaz, kPtVsDca, - kPtVsDcaxyVsDcaz, // DCAxy vs DCAz vs pt for extraction of particle fraction kPVsPTpc, // its pid kItsSignal, @@ -239,7 +238,6 @@ struct ConfTrackQaBinning : o2::framework::ConfigurableGroup { o2::framework::Configurable plotHeliumPid{"plotHeliumPid", true, "Generate plots for Helium PID"}; o2::framework::Configurable plotOrigins{"plotOrigins", true, "MC ONLY: Plot pt vs DCAxy vs DCAz for different particle origins"}; o2::framework::Configurable> pdgCodesForMothersOfSecondary{"pdgCodesForMothersOfSecondary", {3122}, "MC ONLY: PDG codes of mothers of secondaries (Max 3 will be considered)"}; - o2::framework::Configurable plotDcaCorrelation{"plotDcaCorrelation", true, "Plot pt vs DCAxy vs DCAz"}; o2::framework::ConfigurableAxis itsCluster{"itsCluster", {{8, -0.5, 7.5}}, "ITS cluster"}; o2::framework::ConfigurableAxis itsClusterIb{"itsClusterIb", {{4, -0.5, 3.5}}, "ITS cluster in inner barrel"}; o2::framework::ConfigurableAxis tpcCrossedRows{"tpcCrossedRows", {{161, -0.5, 160.5}}, "TPC cluster"}; @@ -373,7 +371,6 @@ constexpr std::array, kTrackHistLast> {kPtVsDcaxy, o2::framework::HistType::kTH2F, "hPtVsDcaxy", "p_{T} vs DCA_{XY}; p_{T} (GeV/#it{c}); DCA_{XY} (cm)"}, {kPtVsDcaz, o2::framework::HistType::kTH2F, "hPtVsDcaz", "p_{T} vs DCA_{Z}; p_{T} (GeV/#it{c}); DCA_{Z} (cm)"}, {kPtVsDca, o2::framework::HistType::kTH2F, "hPtVsDca", "p_{T} vs DCA; p_{T} (GeV/#it{c}); DCA (cm)"}, - {kPtVsDcaxyVsDcaz, o2::framework::HistType::kTHnSparseF, "hPtVsDcaxyVsDcaz", "Transverse momentum vs DCA_{xy} vs DCA_{z}; p_{T} (GeV/#it{c}); DCA_{XY} (cm); DCA_{Z} (cm);"}, {kPVsPTpc, o2::framework::HistType::kTH2F, "hPVsPTpc", "Correlation p_{global} and p_{TPC}; p_{global} (GeV/#it{c}); p_{tpc} (GeV/#it{c})"}, {kItsSignal, o2::framework::HistType::kTH2F, "hItsSignal", "ITS Signal; p (GeV/#it{c}) ; x "}, {kItsElectron, o2::framework::HistType::kTH2F, "hItsPidElectron", "ITS PID Electron; p (GeV/#it{c}) ; n#sigma_{ITS,el}"}, @@ -481,7 +478,6 @@ constexpr std::array, kTrackHistLast> {kPtVsDcaxy, {(confAnalysis).pt, (confQa).dcaXy}}, \ {kPtVsDcaz, {(confAnalysis).pt, (confQa).dcaZ}}, \ {kPtVsDca, {(confAnalysis).pt, (confQa).dca}}, \ - {kPtVsDcaxyVsDcaz, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, \ {kPVsPTpc, {(confQa).p, (confQa).p}}, \ {kItsSignal, {(confQa).p, (confQa).itsSignal}}, \ {kItsElectron, {(confQa).p, (confQa).itsElectron}}, \ @@ -532,17 +528,20 @@ constexpr std::array, kTrackHistLast> {kPdgMother, {(conf).pdgCodes}}, \ {kPdgPartonicMother, {(conf).pdgCodes}}, +// per-origin truth-split variants of the FitVars fraction-estimation DCA histogram; binned on +// fractionDcaXy/fractionDcaZ (not the QA-only dcaXy/dcaZ) so they are available wherever FitVars +// is, including the pair task where no QA binning config exists // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define TRACK_HIST_MC_QA_MAP(confAnalysis, confQa) \ - {kNoMcParticle, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, \ - {kPrimary, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, \ - {kFromWrongCollision, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, \ - {kFromMaterial, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, \ - {kMissidentified, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, \ - {kSecondary1, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, \ - {kSecondary2, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, \ - {kSecondary3, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, \ - {kSecondaryOther, {(confAnalysis).pt, (confQa).dcaXy, (confQa).dcaZ}}, +#define TRACK_HIST_FITVARS_MC_MAP(conf) \ + {kNoMcParticle, {(conf).pt, (conf).fractionDcaXy, (conf).fractionDcaZ}}, \ + {kPrimary, {(conf).pt, (conf).fractionDcaXy, (conf).fractionDcaZ}}, \ + {kFromWrongCollision, {(conf).pt, (conf).fractionDcaXy, (conf).fractionDcaZ}}, \ + {kFromMaterial, {(conf).pt, (conf).fractionDcaXy, (conf).fractionDcaZ}}, \ + {kMissidentified, {(conf).pt, (conf).fractionDcaXy, (conf).fractionDcaZ}}, \ + {kSecondary1, {(conf).pt, (conf).fractionDcaXy, (conf).fractionDcaZ}}, \ + {kSecondary2, {(conf).pt, (conf).fractionDcaXy, (conf).fractionDcaZ}}, \ + {kSecondary3, {(conf).pt, (conf).fractionDcaXy, (conf).fractionDcaZ}}, \ + {kSecondaryOther, {(conf).pt, (conf).fractionDcaXy, (conf).fractionDcaZ}}, template auto makeTrackHistSpecMap(const T& confBinningAnalysis) @@ -556,7 +555,8 @@ auto makeTrackMcHistSpecMap(T const& confBinningAnalysis) { return std::map>{ TRACK_HIST_ANALYSIS_MAP(confBinningAnalysis) - TRACK_HIST_MC_MAP(confBinningAnalysis)}; + TRACK_HIST_MC_MAP(confBinningAnalysis) + TRACK_HIST_FITVARS_MC_MAP(confBinningAnalysis)}; }; template @@ -574,13 +574,13 @@ auto makeTrackMcQaHistSpecMap(T1 const& confBinningAnalysis, T2 const& confBinni TRACK_HIST_ANALYSIS_MAP(confBinningAnalysis) TRACK_HIST_QA_MAP(confBinningAnalysis, confBinningQa) TRACK_HIST_MC_MAP(confBinningAnalysis) - TRACK_HIST_MC_QA_MAP(confBinningAnalysis, confBinningQa)}; + TRACK_HIST_FITVARS_MC_MAP(confBinningAnalysis)}; }; #undef TRACK_HIST_ANALYSIS_MAP #undef TRACK_HIST_QA_MAP #undef TRACK_HIST_MC_MAP -#undef TRACK_HIST_MC_QA_MAP +#undef TRACK_HIST_FITVARS_MC_MAP constexpr char PrefixTrackQa[] = "TrackQA/"; // same-event / mixed-event siblings: single-particle histograms for a given track slot, split by @@ -685,7 +685,7 @@ class TrackHistManager this->initMc(Specs); } if constexpr (isFlagSet(mode, modes::Mode::kFitVars)) { - this->initFitVars(Specs); + this->template initFitVars(Specs); } } @@ -708,6 +708,9 @@ class TrackHistManager if constexpr (isFlagSet(mode, modes::Mode::kMc)) { this->initMc(Specs); } + if constexpr (isFlagSet(mode, modes::Mode::kFitVars)) { + this->template initFitVars(Specs); + } } // init for analysis and qa and mc @@ -778,8 +781,6 @@ class TrackHistManager mPlotHeliumPid = ConfBinningQa.plotHeliumPid.value; mMomentumType = static_cast(ConfBinningQa.momentumType.value); - mPlotDcaCorrelation = ConfBinningQa.plotDcaCorrelation.value; - mPlotOrigins = ConfBinningQa.plotOrigins.value; mPlotNSecondaries = ConfBinningQa.pdgCodesForMothersOfSecondary.value.size(); @@ -804,6 +805,7 @@ class TrackHistManager // purity (packed nSigma tables) and fraction (DCA) -- only called when mode carries kFitVars, // which also implies the track type actually has the relevant tables joined + template void initFitVars(std::map> const& Specs) { std::string fitVarsDir = std::string(prefix) + std::string(FitVarsDir); @@ -813,6 +815,30 @@ class TrackHistManager mHistogramRegistry->add(fitVarsDir + getHistNameV2(kTpcitsPurity, HistTable), getHistDesc(kTpcitsPurity, HistTable), getHistType(kTpcitsPurity, HistTable), {Specs.at(kTpcitsPurity)}); mHistogramRegistry->add(fitVarsDir + getHistNameV2(kTpctofPurity, HistTable), getHistDesc(kTpctofPurity, HistTable), getHistType(kTpctofPurity, HistTable), {Specs.at(kTpctofPurity)}); mHistogramRegistry->add(fitVarsDir + getHistNameV2(kFractionDca, HistTable), getHistDesc(kFractionDca, HistTable), getHistType(kFractionDca, HistTable), {Specs.at(kFractionDca)}); + + // per-origin truth-split fraction-DCA templates; need MC truth, so only booked when the mode + // also carries kMc (available in the QA task and in the pair task's SE/ME, consistently, since + // they use the same fractionDcaXy/fractionDcaZ binning as hFractionDca above) + if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { + if (mPlotOrigins) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kNoMcParticle, HistTable), getHistDesc(kNoMcParticle, HistTable), getHistType(kNoMcParticle, HistTable), {Specs.at(kNoMcParticle)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kPrimary, HistTable), getHistDesc(kPrimary, HistTable), getHistType(kPrimary, HistTable), {Specs.at(kPrimary)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kFromWrongCollision, HistTable), getHistDesc(kFromWrongCollision, HistTable), getHistType(kFromWrongCollision, HistTable), {Specs.at(kFromWrongCollision)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kFromMaterial, HistTable), getHistDesc(kFromMaterial, HistTable), getHistType(kFromMaterial, HistTable), {Specs.at(kFromMaterial)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kMissidentified, HistTable), getHistDesc(kMissidentified, HistTable), getHistType(kMissidentified, HistTable), {Specs.at(kMissidentified)}); + + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel1) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondary1, HistTable), getHistDesc(kSecondary1, HistTable), getHistType(kSecondary1, HistTable), {Specs.at(kSecondary1)}); + } + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel2) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondary2, HistTable), getHistDesc(kSecondary2, HistTable), getHistType(kSecondary2, HistTable), {Specs.at(kSecondary2)}); + } + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel3) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondary3, HistTable), getHistDesc(kSecondary3, HistTable), getHistType(kSecondary3, HistTable), {Specs.at(kSecondary3)}); + } + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondaryOther, HistTable), getHistDesc(kSecondaryOther, HistTable), getHistType(kSecondaryOther, HistTable), {Specs.at(kSecondaryOther)}); + } + } } void initQa(std::map> const& Specs) @@ -861,10 +887,6 @@ class TrackHistManager mHistogramRegistry->add(qaDir + getHistNameV2(kPVsPTpc, HistTable), getHistDesc(kPVsPTpc, HistTable), getHistType(kPVsPTpc, HistTable), {Specs.at(kPVsPTpc)}); } - if (mPlotDcaCorrelation) { - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaxyVsDcaz, HistTable), getHistDesc(kPtVsDcaxyVsDcaz, HistTable), getHistType(kPtVsDcaxyVsDcaz, HistTable), {Specs.at(kPtVsDcaxyVsDcaz)}); - } - std::string pidDir = std::string(prefix) + std::string(PidDir); this->addPidHistogram(pidDir, kItsSignal, Specs); @@ -963,25 +985,6 @@ class TrackHistManager mHistogramRegistry->add(mcDir + getHistNameV2(kPdg, HistTable), getHistDesc(kPdg, HistTable), getHistType(kPdg, HistTable), {Specs.at(kPdg)}); mHistogramRegistry->add(mcDir + getHistNameV2(kPdgMother, HistTable), getHistDesc(kPdgMother, HistTable), getHistType(kPdgMother, HistTable), {Specs.at(kPdgMother)}); mHistogramRegistry->add(mcDir + getHistNameV2(kPdgPartonicMother, HistTable), getHistDesc(kPdgPartonicMother, HistTable), getHistType(kPdgPartonicMother, HistTable), {Specs.at(kPdgPartonicMother)}); - - if (mPlotOrigins) { - mHistogramRegistry->add(mcDir + getHistNameV2(kNoMcParticle, HistTable), getHistDesc(kNoMcParticle, HistTable), getHistType(kNoMcParticle, HistTable), {Specs.at(kNoMcParticle)}); - mHistogramRegistry->add(mcDir + getHistNameV2(kPrimary, HistTable), getHistDesc(kPrimary, HistTable), getHistType(kPrimary, HistTable), {Specs.at(kPrimary)}); - mHistogramRegistry->add(mcDir + getHistNameV2(kFromWrongCollision, HistTable), getHistDesc(kFromWrongCollision, HistTable), getHistType(kFromWrongCollision, HistTable), {Specs.at(kFromWrongCollision)}); - mHistogramRegistry->add(mcDir + getHistNameV2(kFromMaterial, HistTable), getHistDesc(kFromMaterial, HistTable), getHistType(kFromMaterial, HistTable), {Specs.at(kFromMaterial)}); - mHistogramRegistry->add(mcDir + getHistNameV2(kMissidentified, HistTable), getHistDesc(kMissidentified, HistTable), getHistType(kMissidentified, HistTable), {Specs.at(kMissidentified)}); - - if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel1) { - mHistogramRegistry->add(mcDir + getHistNameV2(kSecondary1, HistTable), getHistDesc(kSecondary1, HistTable), getHistType(kSecondary1, HistTable), {Specs.at(kSecondary1)}); - } - if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel2) { - mHistogramRegistry->add(mcDir + getHistNameV2(kSecondary2, HistTable), getHistDesc(kSecondary2, HistTable), getHistType(kSecondary2, HistTable), {Specs.at(kSecondary2)}); - } - if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel3) { - mHistogramRegistry->add(mcDir + getHistNameV2(kSecondary3, HistTable), getHistDesc(kSecondary3, HistTable), getHistType(kSecondary3, HistTable), {Specs.at(kSecondary3)}); - } - mHistogramRegistry->add(mcDir + getHistNameV2(kSecondaryOther, HistTable), getHistDesc(kSecondaryOther, HistTable), getHistType(kSecondaryOther, HistTable), {Specs.at(kSecondaryOther)}); - } } template @@ -1083,10 +1086,6 @@ class TrackHistManager mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPVsPTpc, HistTable)), track.p(), track.tpcInnerParam()); } - if (mPlotDcaCorrelation) { - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaxyVsDcaz, HistTable)), mAbsCharge * track.pt(), track.dcaXY(), track.dcaZ()); - } - float momentum = 0.f; if (mMomentumType == modes::MomentumType::kPt) { momentum = mAbsCharge * track.pt(); @@ -1168,9 +1167,9 @@ class TrackHistManager if (!track.has_fMcParticle()) { mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kPdg, HistTable)), 0); mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kOrigin, HistTable)), static_cast(modes::McOrigin::kNoMcParticle)); - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { if (mPlotOrigins) { - mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kNoMcParticle, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(FitVarsDir) + HIST(getHistName(kNoMcParticle, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); } } return; @@ -1215,22 +1214,22 @@ class TrackHistManager mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kPdgPartonicMother, HistTable)), 0); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { if (mPlotOrigins) { // check first if particle is from a wrong collision if (fromWrongCollision) { - mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kFromWrongCollision, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(FitVarsDir) + HIST(getHistName(kFromWrongCollision, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); } else if (isMissidentified) { // if it is, we fill it as such - mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kMissidentified, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(FitVarsDir) + HIST(getHistName(kMissidentified, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); } else { // if not, we fill it acccoridng to its origin switch (static_cast(mcParticle.origin())) { case modes::McOrigin::kPhysicalPrimary: - mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kPrimary, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(FitVarsDir) + HIST(getHistName(kPrimary, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); break; case modes::McOrigin::kFromMaterial: - mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kFromMaterial, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(FitVarsDir) + HIST(getHistName(kFromMaterial, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); break; case modes::McOrigin::kFromSecondaryDecay: if (mcParticle.has_fMcMother()) { @@ -1238,13 +1237,13 @@ class TrackHistManager int motherPdgCode = std::abs(mother.pdgCode()); // Switch on PDG of the mother if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel1 && motherPdgCode == mPdgCodesSecondaryMother[0]) { - mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kSecondary1, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondary1, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); } else if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel2 && motherPdgCode == mPdgCodesSecondaryMother[1]) { - mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kSecondary2, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondary2, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); } else if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel3 && motherPdgCode == mPdgCodesSecondaryMother[2]) { - mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kSecondary3, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondary3, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); } else { - mHistogramRegistry->fill(HIST(prefix) + HIST(McDir) + HIST(getHistName(kSecondaryOther, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); + mHistogramRegistry->fill(HIST(prefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondaryOther, HistTable)), track.pt(), track.dcaXY(), track.dcaZ()); } } break; @@ -1269,8 +1268,10 @@ class TrackHistManager bool mPlotDeuteronPid = false; bool mPlotTritonPid = false; bool mPlotHeliumPid = false; - bool mPlotDcaCorrelation = false; - bool mPlotOrigins = false; + // true by default so the per-origin FitVars templates are booked/filled even where + // enableOptionalHistograms() is never called (e.g. the pair task, which has no QA-binning + // config); the QA task can still opt out via its plotOrigins Configurable + bool mPlotOrigins = true; int mPlotNSecondaries = 0; std::array mPdgCodesSecondaryMother = {0}; modes::MomentumType mMomentumType = modes::MomentumType::kPAtPv; diff --git a/PWGCF/Femto/Core/twoPhotonResonanceHistManager.h b/PWGCF/Femto/Core/twoPhotonResonanceHistManager.h index cfb71e8eb37..52e19c78bba 100644 --- a/PWGCF/Femto/Core/twoPhotonResonanceHistManager.h +++ b/PWGCF/Femto/Core/twoPhotonResonanceHistManager.h @@ -113,11 +113,11 @@ auto makeTwoPhotonResonanceQaHistSpecMap(const T& confBinningAnalysis) constexpr char PrefixPi0[] = "Pi0/"; constexpr char PrefixEta[] = "Eta/"; // same-event sibling, used only by a pair builder's same-event resonance manager -constexpr char PrefixPi0Se[] = "Pi0Se/"; -constexpr char PrefixEtaSe[] = "EtaSe/"; +constexpr char PrefixPi0Se[] = "Pi0/SE/"; +constexpr char PrefixEtaSe[] = "Eta/SE/"; // mixed-event sibling, used only by a pair builder's mixed-event resonance manager -constexpr char PrefixPi0Me[] = "Pi0Me/"; -constexpr char PrefixEtaMe[] = "EtaMe/"; +constexpr char PrefixPi0Me[] = "Pi0/ME/"; +constexpr char PrefixEtaMe[] = "Eta/ME/"; constexpr std::string_view AnalysisDir = "Analysis/"; constexpr std::string_view QaDir = "QA/"; diff --git a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h index 2cc046e92cc..95cdd37c01d 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h +++ b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h @@ -127,13 +127,13 @@ constexpr char PrefixRho[] = "Rho0/"; constexpr char PrefixPhi[] = "Phi/"; constexpr char PrefixKstar[] = "Kstar0/"; // same-event siblings, used only by a pair builder's same-event resonance manager -constexpr char PrefixRhoSe[] = "Rho0Se/"; -constexpr char PrefixPhiSe[] = "PhiSe/"; -constexpr char PrefixKstarSe[] = "Kstar0Se/"; +constexpr char PrefixRhoSe[] = "Rho0/SE/"; +constexpr char PrefixPhiSe[] = "Phi/SE/"; +constexpr char PrefixKstarSe[] = "Kstar0/SE/"; // mixed-event siblings, used only by a pair builder's mixed-event resonance manager -constexpr char PrefixRhoMe[] = "Rho0Me/"; -constexpr char PrefixPhiMe[] = "PhiMe/"; -constexpr char PrefixKstarMe[] = "Kstar0Me/"; +constexpr char PrefixRhoMe[] = "Rho0/ME/"; +constexpr char PrefixPhiMe[] = "Phi/ME/"; +constexpr char PrefixKstarMe[] = "Kstar0/ME/"; constexpr std::string_view AnalysisDir = "Analysis/"; constexpr std::string_view QaDir = "QA/"; diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index c753fd1edc6..154233ebfa4 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -489,10 +489,12 @@ struct V0BuilderProducts : o2::framework::ProducesGroup { o2::framework::Produces producedLiteLambdas; o2::framework::Produces producedLambdaMasks; o2::framework::Produces producedLambdaExtras; + o2::framework::Produces producedLambdaFrac; o2::framework::Produces producedK0shorts; o2::framework::Produces producedLiteK0shorts; o2::framework::Produces producedK0shortMasks; o2::framework::Produces producedK0shortExtras; + o2::framework::Produces producedK0shortFrac; }; struct ConfV0Tables : o2::framework::ConfigurableGroup { @@ -501,10 +503,12 @@ struct ConfV0Tables : o2::framework::ConfigurableGroup { o2::framework::Configurable produceLiteLambdas{"produceLiteLambdas", -1, "Produce LiteLambdas (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceLambdaMasks{"produceLambdaMasks", -1, "Produce LambdaMasks (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceLambdaExtras{"produceLambdaExtras", -1, "Produce LambdaExtras (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceLambdaFrac{"produceLambdaFrac", -1, "Produce LambdaFrac (cpa for fraction extraction) (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceK0shorts{"produceK0shorts", -1, "Produce K0shorts (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceLiteK0shorts{"produceLiteK0shorts", -1, "Produce LiteK0shorts (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceK0shortMasks{"produceK0shortMasks", -1, "Produce K0shortMasks (-1: auto; 0 off; 1 on)"}; o2::framework::Configurable produceK0shortExtras{"produceK0shortExtras", -1, "Produce K0shortExtras (-1: auto; 0 off; 1 on)"}; + o2::framework::Configurable produceK0shortFrac{"produceK0shortFrac", -1, "Produce K0shortFrac (cpa for fraction extraction) (-1: auto; 0 off; 1 on)"}; }; template @@ -528,6 +532,7 @@ class V0Builder mProduceLiteLambdas = utils::enableTable("FLiteLambdas_001", table.produceLiteLambdas.value, initContext); mProduceLambdaMasks = utils::enableTable("FLambdaMasks_002", table.produceLambdaMasks.value, initContext); mProduceLambdaExtras = utils::enableTable("FLambdaExtras_001", table.produceLambdaExtras.value, initContext); + mProduceLambdaFrac = utils::enableTable("FLambdaFrac_001", table.produceLambdaFrac.value, initContext); if (mProduceLambdas && mProduceLiteLambdas) { LOG(fatal) << "FLambdas and FLiteLambdas are mutually exclusive -- enable only one. " @@ -551,6 +556,7 @@ class V0Builder mProduceLiteK0shorts = utils::enableTable("FLiteK0shorts_001", table.produceLiteK0shorts.value, initContext); mProduceK0shortMasks = utils::enableTable("FK0shortMasks_002", table.produceK0shortMasks.value, initContext); mProduceK0shortExtras = utils::enableTable("FK0shortExtras_001", table.produceK0shortExtras.value, initContext); + mProduceK0shortFrac = utils::enableTable("FK0shortFrac_001", table.produceK0shortFrac.value, initContext); if (mProduceK0shorts && mProduceLiteK0shorts) { LOG(fatal) << "FK0shorts and FLiteK0shorts are mutually exclusive -- enable only one. " @@ -568,8 +574,8 @@ class V0Builder << "or switch to FK0shorts if TrackTables.produceTracks is enabled instead."; } } - if (mProduceLambdas || mProduceLiteLambdas || mProduceLambdaMasks || mProduceLambdaExtras || - mProduceK0shorts || mProduceLiteK0shorts || mProduceK0shortMasks || mProduceK0shortExtras) { + if (mProduceLambdas || mProduceLiteLambdas || mProduceLambdaMasks || mProduceLambdaExtras || mProduceLambdaFrac || + mProduceK0shorts || mProduceLiteK0shorts || mProduceK0shortMasks || mProduceK0shortExtras || mProduceK0shortFrac) { mFillAnyTable = true; } else { LOG(info) << "No tables configured, Selection object will not be configured..."; @@ -713,6 +719,9 @@ class V0Builder v0.alpha(), v0.qtarm()); } + if (mProduceLambdaFrac) { + v0Products.producedLambdaFrac(v0.v0cosPA()); + } } template @@ -754,6 +763,9 @@ class V0Builder v0.alpha(), v0.qtarm()); } + if (mProduceK0shortFrac) { + v0Products.producedK0shortFrac(v0.v0cosPA()); + } } [[nodiscard]] bool fillAnyTable() const { return mFillAnyTable; } @@ -766,10 +778,12 @@ class V0Builder bool mProduceLiteLambdas = false; bool mProduceLambdaMasks = false; bool mProduceLambdaExtras = false; + bool mProduceLambdaFrac = false; bool mProduceK0shorts = false; bool mProduceLiteK0shorts = false; bool mProduceK0shortMasks = false; bool mProduceK0shortExtras = false; + bool mProduceK0shortFrac = false; }; struct ConfV0TablesDerivedToDerived : o2::framework::ConfigurableGroup { diff --git a/PWGCF/Femto/Core/v0HistManager.h b/PWGCF/Femto/Core/v0HistManager.h index 6d85ccd6747..058edf2e6c8 100644 --- a/PWGCF/Femto/Core/v0HistManager.h +++ b/PWGCF/Femto/Core/v0HistManager.h @@ -46,7 +46,8 @@ enum V0Hist { kPhi, kMass, kSign, - kPtVsMass, // nice to have during analysis + kPtVsMass, // nice to have during analysis + kFractionCpa, // fraction estimation: pt vs cosPa, binned independently of the QA cosPa axis // qa variables kMassLambda, kMassAntiLambda, @@ -65,7 +66,6 @@ enum V0Hist { kPtVsEta, kPtVsPhi, kPhiVsEta, - kPtVsCosPa, kPtVsPa, kPtVsLambdaMass, kPtVsAntiLambdaMass, @@ -101,13 +101,14 @@ enum V0Hist { constexpr std::size_t MaxSecondary = 3; // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define V0_DEFAULT_BINNING(defaultMassMin, defaultMassMax) \ - o2::framework::ConfigurableAxis pt{"pt", {{600, 0, 6}}, "Pt"}; \ - o2::framework::ConfigurableAxis eta{"eta", {{300, -1.5, 1.5}}, "Eta"}; \ - o2::framework::ConfigurableAxis phi{"phi", {{720, 0, 1.f * o2::constants::math::TwoPI}}, "Phi"}; \ - o2::framework::ConfigurableAxis mass{"mass", {{200, (defaultMassMin), (defaultMassMax)}}, "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 V0s"}; +#define V0_DEFAULT_BINNING(defaultMassMin, defaultMassMax) \ + o2::framework::ConfigurableAxis pt{"pt", {{600, 0, 6}}, "Pt"}; \ + o2::framework::ConfigurableAxis eta{"eta", {{300, -1.5, 1.5}}, "Eta"}; \ + o2::framework::ConfigurableAxis phi{"phi", {{720, 0, 1.f * o2::constants::math::TwoPI}}, "Phi"}; \ + o2::framework::ConfigurableAxis mass{"mass", {{200, (defaultMassMin), (defaultMassMax)}}, "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 V0s"}; \ + o2::framework::ConfigurableAxis fractionCpa{"fractionCpa", {{100, 0.95, 1}}, "Cosine of pointing angle (fraction estimation)"}; template struct ConfLambdaBinning : o2::framework::ConfigurableGroup { @@ -137,7 +138,7 @@ struct ConfV0QaBinning : o2::framework::ConfigurableGroup { o2::framework::Configurable plot2d{"plot2d", true, "Generate various 2D QA plots"}; o2::framework::Configurable plotOrigins{"plotOrigins", true, "MC ONLY: Plot pt vs cosPa for different particle origins"}; o2::framework::Configurable> pdgCodesForMothersOfSecondary{"pdgCodesForMothersOfSecondary", {3312, 3334}, "MC ONLY: PDG codes of mothers of secondaries (Max 3 will be considered)"}; - o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.9, 1}}, "Cosine of pointing angle"}; + o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.95, 1}}, "Cosine of pointing angle"}; o2::framework::ConfigurableAxis pa{"pa", {{180, 0, 1.f * o2::constants::math::PI}}, "Pointing angle"}; o2::framework::ConfigurableAxis dauDcaAtDecay{"dauDcaAtDecay", {{150, 0, 1.5}}, "Daughter DCA at decay vertex"}; o2::framework::ConfigurableAxis decayVertex{"decayVertex", {{100, 0, 100}}, "Decay vertex"}; @@ -165,6 +166,7 @@ constexpr std::array, kV0HistLast> HistTable = { {kMass, o2::framework::HistType::kTH1F, "hMass", "Invariant Mass; m_{Inv} (GeV/#it{c}^{2}); Entries"}, {kSign, o2::framework::HistType::kTH1F, "hSign", "Sign (-1 -> antiparticle, 0 -> self conjugate, +1 -> particle); sign; Entries"}, {kPtVsMass, o2::framework::HistType::kTH2F, "hPtVsMass", "Transverse momentum vs invariant mass; p_{T} (GeV/#it{c}); m_{Inv} (GeV/#it{c}^{2})"}, + {kFractionCpa, o2::framework::HistType::kTH2F, "hFractionCpa", "p_{T} vs Cosine of pointing angle (fraction estimation); p_{T} (GeV/#it{c}); cos(#alpha)"}, {kMassLambda, o2::framework::HistType::kTH1F, "hMassLambda", "#Lambda mass; m_{p#pi^{-}} (GeV/#it{c}^{2}); Entries"}, {kMassAntiLambda, o2::framework::HistType::kTH1F, "hMassAntiLambda", "#bar{#Lambda} mass; m_{#bar{p}#pi^{+}} (GeV/#it{c}^{2}); Entries"}, {kMassK0short, o2::framework::HistType::kTH1F, "hMassK0short", "K^{0}_{s} mass; m_{#pi^{+}#pi^{-}} (GeV/#it{c}^{2}); Entries"}, @@ -181,7 +183,6 @@ constexpr std::array, kV0HistLast> HistTable = { {kPtVsEta, o2::framework::HistType::kTH2F, "hPtVsEta", "p_{T} vs #eta; p_{T} (GeV/#it{c}) ; #eta"}, {kPtVsPhi, o2::framework::HistType::kTH2F, "hPtVsPhi", "p_{T} vs #varphi; p_{T} (GeV/#it{c}) ; #varphi"}, {kPhiVsEta, o2::framework::HistType::kTH2F, "hPhiVsEta", "#varphi vs #eta; #varphi ; #eta"}, - {kPtVsCosPa, o2::framework::HistType::kTH2F, "hPtVsCosPa", "p_{T} vs Cosine of pointing angle;p_{T} (GeV/#it{c}); cos(#alpha);"}, {kPtVsPa, o2::framework::HistType::kTH2F, "hPtVsPa", "p_{T} vs Pointing angle;p_{T} (GeV/#it{c}); #alpha"}, {kPtVsLambdaMass, o2::framework::HistType::kTH2F, "hPtVsLambdaMass", "p_{T} vs #Lambda mass; p_{T} (GeV/#it{c}); m_{p#pi^{-}} (GeV/#it{c}^{2})"}, {kPtVsAntiLambdaMass, o2::framework::HistType::kTH2F, "hPtVsAntiLambdaMass", "p_{T} vs #bar{#Lambda} mass; p_{T} (GeV/#it{c}); m_{#bar{p}#pi^{+}} (GeV/#it{c}^{2})"}, @@ -211,13 +212,14 @@ constexpr std::array, kV0HistLast> HistTable = { }; // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define V0_HIST_ANALYSIS_MAP(conf) \ - {kPt, {(conf).pt}}, \ - {kEta, {(conf).eta}}, \ - {kPhi, {(conf).phi}}, \ - {kMass, {(conf).mass}}, \ - {kSign, {(conf).sign}}, \ - {kPtVsMass, {(conf).pt, (conf).mass}}, +#define V0_HIST_ANALYSIS_MAP(conf) \ + {kPt, {(conf).pt}}, \ + {kEta, {(conf).eta}}, \ + {kPhi, {(conf).phi}}, \ + {kMass, {(conf).mass}}, \ + {kSign, {(conf).sign}}, \ + {kPtVsMass, {(conf).pt, (conf).mass}}, \ + {kFractionCpa, {(conf).pt, (conf).fractionCpa}}, // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define V0_HIST_MC_MAP(conf) \ @@ -243,7 +245,6 @@ constexpr std::array, kV0HistLast> HistTable = { {kPtVsEta, {(confAnalysis).pt, (confAnalysis).eta}}, \ {kPtVsPhi, {(confAnalysis).pt, (confAnalysis).phi}}, \ {kPhiVsEta, {(confAnalysis).phi, (confAnalysis).eta}}, \ - {kPtVsCosPa, {(confAnalysis).pt, (confQa).cosPa}}, \ {kPtVsPa, {(confAnalysis).pt, (confQa).pa}}, \ {kMassLambda, {(confQa).massLambda}}, \ {kMassAntiLambda, {(confQa).massAntiLambda}}, \ @@ -258,17 +259,20 @@ constexpr std::array, kV0HistLast> HistTable = { {kStrangeTofVsTofNegDau, {(confQa).strangeTof, (confQa).strangeTof}}, \ {kArmenterosQtVsAlpha, {(confQa).armenterosAlpha, (confQa).armenterosQt}}, +// per-origin truth-split variants of the FitVars fraction-estimation CPA histogram; binned on +// fractionCpa (not the QA-only cosPa) so they are available wherever FitVars is, including the +// pair task where no QA binning config exists // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define V0_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}}, +#define V0_HIST_FITVARS_MC_MAP(conf) \ + {kNoMcParticle, {(conf).pt, (conf).fractionCpa}}, \ + {kPrimary, {(conf).pt, (conf).fractionCpa}}, \ + {kFromWrongCollision, {(conf).pt, (conf).fractionCpa}}, \ + {kFromMaterial, {(conf).pt, (conf).fractionCpa}}, \ + {kMissidentified, {(conf).pt, (conf).fractionCpa}}, \ + {kSecondary1, {(conf).pt, (conf).fractionCpa}}, \ + {kSecondary2, {(conf).pt, (conf).fractionCpa}}, \ + {kSecondary3, {(conf).pt, (conf).fractionCpa}}, \ + {kSecondaryOther, {(conf).pt, (conf).fractionCpa}}, template auto makeV0HistSpecMap(const T& confBinningAnalysis) @@ -282,7 +286,8 @@ auto makeV0McHistSpecMap(const T& confBinningAnalysis) { return std::map>{ V0_HIST_ANALYSIS_MAP(confBinningAnalysis) - V0_HIST_MC_MAP(confBinningAnalysis)}; + V0_HIST_MC_MAP(confBinningAnalysis) + V0_HIST_FITVARS_MC_MAP(confBinningAnalysis)}; } template @@ -300,13 +305,13 @@ std::map> makeV0McQaHistSpecMap(T1 V0_HIST_ANALYSIS_MAP(confBinningAnalysis) V0_HIST_QA_MAP(confBinningAnalysis, confBinningQa) V0_HIST_MC_MAP(confBinningAnalysis) - V0_HIST_MC_QA_MAP(confBinningAnalysis, confBinningQa)}; + V0_HIST_FITVARS_MC_MAP(confBinningAnalysis)}; } #undef V0_HIST_ANALYSIS_MAP #undef V0_HIST_QA_MAP #undef V0_HIST_MC_MAP -#undef V0_HIST_MC_QA_MAP +#undef V0_HIST_FITVARS_MC_MAP constexpr char PrefixLambdaQa[] = "LambdaQA/"; // same-event / mixed-event siblings: single-candidate histograms for a given slot, split by @@ -326,6 +331,7 @@ constexpr char PrefixLambdaCascade[] = "LambdaCascadeQa/"; constexpr std::string_view AnalysisDir = "Analysis/"; constexpr std::string_view QaDir = "QA/"; constexpr std::string_view McDir = "MC/"; +constexpr std::string_view FitVarsDir = "FitVars/"; /// \class FemtoDreamEventHisto /// \brief Class for histogramming event properties @@ -382,6 +388,9 @@ class V0HistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { this->initMc(V0Specs); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { + this->template initFitVars(V0Specs); + } } // init for analysis and qa and and mc @@ -433,6 +442,9 @@ class V0HistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { this->initMc(V0Specs); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { + this->template initFitVars(V0Specs); + } } template @@ -449,6 +461,9 @@ class V0HistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { this->fillQa(v0candidate, posDaughter, negDaughter); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { + this->fillFitVars(v0candidate); + } } template @@ -467,6 +482,9 @@ class V0HistManager if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { this->template fillMc(v0candidate, col, mcParticles, mcMothers, mcPartonicMothers); } + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { + this->fillFitVars(v0candidate); + } } private: @@ -515,7 +533,6 @@ class V0HistManager mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {V0Specs.at(kPtVsEta)}); mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {V0Specs.at(kPtVsPhi)}); mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {V0Specs.at(kPhiVsEta)}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {V0Specs.at(kPtVsCosPa)}); mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPa, HistTable), getHistDesc(kPtVsPa, HistTable), getHistType(kPtVsPa, HistTable), {V0Specs.at(kPtVsPa)}); mHistogramRegistry->add(qaDir + getHistNameV2(kMassLambda, HistTable), getHistDesc(kMassLambda, HistTable), getHistType(kMassLambda, HistTable), {V0Specs.at(kMassLambda)}); @@ -553,24 +570,36 @@ class V0HistManager 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)}); + // fraction estimation (CPA); only called when mode carries kFitVars + template + void initFitVars(std::map> const& V0Specs) + { + std::string fitVarsDir = std::string(v0Prefix) + std::string(FitVarsDir); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kFractionCpa, HistTable), getHistDesc(kFractionCpa, HistTable), getHistType(kFractionCpa, HistTable), {V0Specs.at(kFractionCpa)}); - 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)}); + // per-origin truth-split fraction-CPA templates; need MC truth, so only booked when the mode + // also carries kMc + if constexpr (modes::isFlagSet(mode, modes::Mode::kMc)) { + if (mPlotOrigins) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kNoMcParticle, HistTable), getHistDesc(kNoMcParticle, HistTable), getHistType(kNoMcParticle, HistTable), {V0Specs.at(kNoMcParticle)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kPrimary, HistTable), getHistDesc(kPrimary, HistTable), getHistType(kPrimary, HistTable), {V0Specs.at(kPrimary)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kFromWrongCollision, HistTable), getHistDesc(kFromWrongCollision, HistTable), getHistType(kFromWrongCollision, HistTable), {V0Specs.at(kFromWrongCollision)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kFromMaterial, HistTable), getHistDesc(kFromMaterial, HistTable), getHistType(kFromMaterial, HistTable), {V0Specs.at(kFromMaterial)}); + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kMissidentified, HistTable), getHistDesc(kMissidentified, HistTable), getHistType(kMissidentified, HistTable), {V0Specs.at(kMissidentified)}); + + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel1) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondary1, HistTable), getHistDesc(kSecondary1, HistTable), getHistType(kSecondary1, HistTable), {V0Specs.at(kSecondary1)}); + } + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel2) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondary2, HistTable), getHistDesc(kSecondary2, HistTable), getHistType(kSecondary2, HistTable), {V0Specs.at(kSecondary2)}); + } + if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel3) { + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondary3, HistTable), getHistDesc(kSecondary3, HistTable), getHistType(kSecondary3, HistTable), {V0Specs.at(kSecondary3)}); + } + mHistogramRegistry->add(fitVarsDir + getHistNameV2(kSecondaryOther, HistTable), getHistDesc(kSecondaryOther, HistTable), getHistType(kSecondaryOther, HistTable), {V0Specs.at(kSecondaryOther)}); } - mHistogramRegistry->add(mcDir + getHistNameV2(kSecondaryOther, HistTable), getHistDesc(kSecondaryOther, HistTable), getHistType(kSecondaryOther, HistTable), {V0Specs.at(kSecondaryOther)}); } } @@ -591,6 +620,12 @@ class V0HistManager } } + template + void fillFitVars(T const& v0candidate) + { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kFractionCpa, HistTable)), v0candidate.pt(), v0candidate.cosPa()); + } + template void fillQa(T1 const& v0candidate, T2 const& posDau, T3 const& negDau) { @@ -641,7 +676,6 @@ class V0HistManager mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), v0candidate.pt(), v0candidate.eta()); mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), v0candidate.pt(), v0candidate.phi()); mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), v0candidate.phi(), v0candidate.eta()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsCosPa, HistTable)), v0candidate.pt(), v0candidate.cosPa()); mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsPa, HistTable)), v0candidate.pt(), v0candidate.pa()); mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kPtVsLambdaMass, HistTable)), v0candidate.pt(), massLambda); @@ -663,9 +697,9 @@ class V0HistManager if (!v0Candidate.has_fMcParticle()) { mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kPdg, HistTable)), 0); mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kOrigin, HistTable)), static_cast(modes::McOrigin::kNoMcParticle)); - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { if (mPlotOrigins) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kNoMcParticle, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kNoMcParticle, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); } } return; @@ -708,22 +742,22 @@ class V0HistManager mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kPdgPartonicMother, HistTable)), 0); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + if constexpr (modes::isFlagSet(mode, modes::Mode::kFitVars)) { if (mPlotOrigins) { // check first if particle is missidentified if (fromWrongCollision) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kFromWrongCollision, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kFromWrongCollision, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); } else if (isMissidentified) { // if it is, we fill it as such - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kMissidentified, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kMissidentified, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); } else { // if not, we fill it acccoridng to its origin switch (static_cast(mcParticle.origin())) { case modes::McOrigin::kPhysicalPrimary: - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kPrimary, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kPrimary, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); break; case modes::McOrigin::kFromMaterial: - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kFromMaterial, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kFromMaterial, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); break; case modes::McOrigin::kFromSecondaryDecay: if (mcParticle.has_fMcMother()) { @@ -731,13 +765,13 @@ class V0HistManager int motherPdgCode = std::abs(mother.pdgCode()); // Switch on PDG of the mother if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel1 && motherPdgCode == mPdgCodesSecondaryMother[0]) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kSecondary1, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondary1, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); } else if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel2 && motherPdgCode == mPdgCodesSecondaryMother[1]) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kSecondary2, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondary2, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); } else if (mPlotNSecondaries >= histmanager::kSecondaryPlotLevel3 && motherPdgCode == mPdgCodesSecondaryMother[2]) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kSecondary3, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondary3, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); } else { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(McDir) + HIST(getHistName(kSecondaryOther, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(FitVarsDir) + HIST(getHistName(kSecondaryOther, HistTable)), v0Candidate.pt(), v0Candidate.cosPa()); } } break; @@ -752,7 +786,10 @@ class V0HistManager o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; int mPdgCode = 0; - bool mPlotOrigins = false; + // true by default so the per-origin FitVars templates are booked/filled even where + // enableOptionalHistograms() is never called (e.g. the pair task, which has no QA-binning + // config); the QA task can still opt out via its plotOrigins Configurable + bool mPlotOrigins = true; int mPlotNSecondaries = 0; std::array mPdgCodesSecondaryMother = {0}; bool mPlot2d = false; diff --git a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx index 2d6b5f1c580..64f6aa88985 100644 --- a/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx +++ b/PWGCF/Femto/TableProducer/femtoProducerDerivedToDerived.cxx @@ -51,7 +51,7 @@ using FemtoTracks = o2::soa::Join; using FemtoTracksWithMass = o2::soa::Join; // opt-in: carries the packed purity tables and FTrackDcas through to the re-written output -- // needs the upstream producer's TrackTables.produceItsPurity/produceTpcPurity/produceTofPurity/produceTrackDcas enabled -using FemtoTracksWithPurity = o2::soa::Join; +using FemtoTracksWithFitVars = o2::soa::Join; using FemtoLambdas = o2::soa::Join; using FemtoK0shorts = o2::soa::Join; using FemtoRho0s = o2::soa::Join; @@ -81,7 +81,7 @@ struct FemtoProducerDerivedToDerived { struct : public o2::framework::PresliceGroup { o2::framework::Preslice perColTracks = o2::aod::femtobase::stored::fColId; o2::framework::Preslice perColTracksWithMass = o2::aod::femtobase::stored::fColId; - o2::framework::Preslice perColTracksWithPurity = o2::aod::femtobase::stored::fColId; + o2::framework::Preslice perColTracksWithFitVars = o2::aod::femtobase::stored::fColId; o2::framework::Preslice perColLambdas = o2::aod::femtobase::stored::fColId; o2::framework::Preslice perColK0shorts = o2::aod::femtobase::stored::fColId; o2::framework::Preslice perColRho0s = o2::aod::femtobase::stored::fColId; @@ -130,8 +130,8 @@ struct FemtoProducerDerivedToDerived { o2::framework::Partition trackWithMassPartition1 = MAKE_TRACK_PARTITION_WITH_MASS(trackSelections1); o2::framework::Partition trackWithMassPartition2 = MAKE_TRACK_PARTITION_WITH_MASS(trackSelections2); - o2::framework::Partition trackWithPurityPartition1 = MAKE_TRACK_PARTITION(trackSelections1); - o2::framework::Partition trackWithPurityPartition2 = MAKE_TRACK_PARTITION(trackSelections2); + o2::framework::Partition trackWithFitVarsPartition1 = MAKE_TRACK_PARTITION(trackSelections1); + o2::framework::Partition trackWithFitVarsPartition2 = MAKE_TRACK_PARTITION(trackSelections2); // v0 builder v0builder::V0BuilderDerivedToDerivedProducts v0BuilderProducts; @@ -196,11 +196,12 @@ struct FemtoProducerDerivedToDerived { void init(o2::framework::InitContext& /*context*/) { const int activeProcesses = - static_cast(doprocessTracks) + static_cast(doprocessTracksWithMass) + static_cast(doprocessTracksWithPurity) + - static_cast(doprocessTracksLambdas) + static_cast(doprocessTracksWithMassLambdas) + + static_cast(doprocessTracks) + static_cast(doprocessTracksWithMass) + static_cast(doprocessTracksWithFitVars) + + static_cast(doprocessTracksLambdas) + static_cast(doprocessTracksWithMassLambdas) + static_cast(doprocessTracksWithFitVarsLambdas) + static_cast(doprocessLambdas) + - static_cast(doprocessTracksXis) + static_cast(doprocessTracksOmegas) + - static_cast(doprocessTracksK0shorts) + static_cast(doprocessTracksSigma) + + static_cast(doprocessTracksXis) + static_cast(doprocessTracksWithFitVarsXis) + + static_cast(doprocessTracksOmegas) + static_cast(doprocessTracksWithFitVarsOmegas) + + static_cast(doprocessTracksK0shorts) + static_cast(doprocessTracksWithFitVarsK0shorts) + static_cast(doprocessTracksSigma) + static_cast(doprocessTracksSigmaPlus) + static_cast(doprocessTracksSigmaPlusExtended) + static_cast(doprocessTracksSigmaPlusPcm) + static_cast(doprocessTracksSigmaPlusPcmExtended) + static_cast(doprocessTracksRho0) + static_cast(doprocessTracksPhi) + @@ -242,16 +243,16 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksWithMass, "Process tracks with mass", false); - void processTracksWithPurity(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracksWithPurity const& tracks) + void processTracksWithFitVars(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracksWithFitVars const& tracks) { - if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, trackWithPurityPartition1, trackWithPurityPartition2, cache)) { + if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache)) { return; } builders.trackBuilder.reset(tracks); builders.collisionBuilder.processCollision(col, collisionBuilderProducts); - builders.trackBuilder.processTracks(col, tracks, trackWithPurityPartition1, trackWithPurityPartition2, cache, trackBuilderProducts, collisionBuilderProducts); + builders.trackBuilder.processTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache, trackBuilderProducts, collisionBuilderProducts); } - PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksWithPurity, "Process tracks, carrying through purity/fraction tables", false); + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksWithFitVars, "Process tracks, carrying through FitVars tables", false); void processTracksLambdas(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracks const& tracks, femtotables::FemtoLambdas const& lambdas) { @@ -277,6 +278,18 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksWithMassLambdas, "Process lambdas and tracks with mass", false); + void processTracksWithFitVarsLambdas(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracksWithFitVars const& tracks, femtotables::FemtoLambdas const& lambdas) + { + if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache) || builders.v0Builder.collisionHasTooFewLambdas(col, lambdas, lambdaPartition, cache)) { + return; + } + builders.trackBuilder.reset(tracks); + builders.collisionBuilder.processCollision(col, collisionBuilderProducts); + builders.trackBuilder.processTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache, trackBuilderProducts, collisionBuilderProducts); + builders.v0Builder.processLambdas(col, lambdas, tracks, lambdaPartition, builders.trackBuilder, cache, v0BuilderProducts, trackBuilderProducts, collisionBuilderProducts); + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksWithFitVarsLambdas, "Process lambdas and tracks, carrying through FitVars tables", false); + void processLambdas(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracks const& tracks, femtotables::FemtoLambdas const& lambdas) { if (builders.v0Builder.collisionHasTooFewLambdas(col, lambdas, lambdaPartition, cache)) { @@ -300,6 +313,18 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksXis, "Process tracks and xis", false); + void processTracksWithFitVarsXis(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracksWithFitVars const& tracks, femtotables::FemtoXis const& xis) + { + if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache) || builders.cascadeBuilder.collisionHasTooFewXis(col, xis, xiPartition, cache)) { + return; + } + builders.trackBuilder.reset(tracks); + builders.collisionBuilder.processCollision(col, collisionBuilderProducts); + builders.trackBuilder.processTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache, trackBuilderProducts, collisionBuilderProducts); + builders.cascadeBuilder.processXis(col, xis, tracks, xiPartition, builders.trackBuilder, cache, cascadeBuilderProducts, trackBuilderProducts, collisionBuilderProducts); + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksWithFitVarsXis, "Process tracks and xis, carrying through FitVars tables", false); + void processTracksOmegas(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracks const& tracks, femtotables::FemtoOmegas const& omegas) { if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) || builders.cascadeBuilder.collisionHasTooFewOmegas(col, omegas, omegaPartition, cache)) { @@ -312,6 +337,18 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksOmegas, "Process tracks and omegas", false); + void processTracksWithFitVarsOmegas(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracksWithFitVars const& tracks, femtotables::FemtoOmegas const& omegas) + { + if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache) || builders.cascadeBuilder.collisionHasTooFewOmegas(col, omegas, omegaPartition, cache)) { + return; + } + builders.trackBuilder.reset(tracks); + builders.collisionBuilder.processCollision(col, collisionBuilderProducts); + builders.trackBuilder.processTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache, trackBuilderProducts, collisionBuilderProducts); + builders.cascadeBuilder.processOmegas(col, omegas, tracks, omegaPartition, builders.trackBuilder, cache, cascadeBuilderProducts, trackBuilderProducts, collisionBuilderProducts); + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksWithFitVarsOmegas, "Process tracks and omegas, carrying through FitVars tables", false); + void processTracksK0shorts(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracks const& tracks, femtotables::FemtoK0shorts const& k0shorts) { if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) || builders.v0Builder.collisionHasTooFewK0shorts(col, k0shorts, k0shortPartition, cache)) { @@ -324,6 +361,18 @@ struct FemtoProducerDerivedToDerived { } PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksK0shorts, "Process k0short and tracks", false); + void processTracksWithFitVarsK0shorts(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracksWithFitVars const& tracks, femtotables::FemtoK0shorts const& k0shorts) + { + if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache) || builders.v0Builder.collisionHasTooFewK0shorts(col, k0shorts, k0shortPartition, cache)) { + return; + } + builders.trackBuilder.reset(tracks); + builders.collisionBuilder.processCollision(col, collisionBuilderProducts); + builders.trackBuilder.processTracks(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache, trackBuilderProducts, collisionBuilderProducts); + builders.v0Builder.processK0shorts(col, k0shorts, tracks, k0shortPartition, builders.trackBuilder, cache, v0BuilderProducts, trackBuilderProducts, collisionBuilderProducts); + } + PROCESS_SWITCH(FemtoProducerDerivedToDerived, processTracksWithFitVarsK0shorts, "Process k0short and tracks, carrying through FitVars tables", false); + void processTracksSigma(femtotables::FilteredFemtoCollision const& col, femtotables::FemtoTracks const& tracks, femtotables::FemtoSigma const& sigma) { if (builders.trackBuilder.collisionHasTooFewTracks(col, tracks, trackPartition1, trackPartition2, cache) || builders.kinkBuilder.collisionHasTooFewSigma(col, sigma, sigmaPartition, cache)) { diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx index 63daed2c1a5..fee88a038c6 100644 --- a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -51,7 +51,7 @@ struct FemtoCascadeQa { using FemtoXis = o2::soa::Join; using FemtoOmegas = o2::soa::Join; - using FemtoTracks = o2::soa::Join; + using FemtoTracks = o2::soa::Join; using FemtoXisWithLabel = o2::soa::Join; using FemtoOmegasWithLabel = o2::soa::Join; @@ -147,11 +147,11 @@ struct FemtoCascadeQa { negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confNegDaughterBinning, confNegDaughterQaBinning); if (doprocessXi) { xiHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confXiBinning, confXiQaBinning); - xiHistManager.init(&hRegistry, xiHistSpec, confXiSelection, confXiQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); + xiHistManager.init(&hRegistry, xiHistSpec, confXiSelection, confXiQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } if (doprocessOmega) { omegaHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confOmegaBinning, confOmegaQaBinning); - omegaHistManager.init(&hRegistry, omegaHistSpec, confOmegaSelection, confOmegaQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); + omegaHistManager.init(&hRegistry, omegaHistSpec, confOmegaSelection, confOmegaQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } } else { colHistSpec = colhistmanager::makeColMcQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); @@ -161,11 +161,11 @@ struct FemtoCascadeQa { negDaughterHistSpec = trackhistmanager::makeTrackMcQaHistSpecMap(confNegDaughterBinning, confNegDaughterQaBinning); if (doprocessXiMc) { xiHistSpec = cascadehistmanager::makeCascadeMcQaHistSpecMap(confXiBinning, confXiQaBinning); - xiHistManager.init(&hRegistry, xiHistSpec, confXiSelection, confXiQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); + xiHistManager.init(&hRegistry, xiHistSpec, confXiSelection, confXiQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } if (doprocessOmegaMc) { omegaHistSpec = cascadehistmanager::makeCascadeMcQaHistSpecMap(confOmegaBinning, confOmegaQaBinning); - omegaHistManager.init(&hRegistry, omegaHistSpec, confOmegaSelection, confOmegaQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); + omegaHistManager.init(&hRegistry, omegaHistSpec, confOmegaSelection, confOmegaQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } } hRegistry.print(); @@ -179,7 +179,7 @@ struct FemtoCascadeQa { } colHistManager.fill(col); for (auto const& xi : xiSlice) { - xiHistManager.fill(xi, tracks); + xiHistManager.fill(xi, tracks); } } PROCESS_SWITCH(FemtoCascadeQa, processXi, "Process Xis", true); @@ -195,7 +195,7 @@ struct FemtoCascadeQa { if (!xiCleaner.isClean(xi, mcParticles, mcMothers, mcPartonicMothers)) { continue; } - xiHistManager.fill(xi, tracks, col, mcParticles, mcMothers, mcPartonicMothers); + xiHistManager.fill(xi, tracks, col, mcParticles, mcMothers, mcPartonicMothers); } } PROCESS_SWITCH(FemtoCascadeQa, processXiMc, "Process Xis with MC information", false); @@ -208,7 +208,7 @@ struct FemtoCascadeQa { } colHistManager.fill(col); for (auto const& omega : omegaSlice) { - omegaHistManager.fill(omega, tracks); + omegaHistManager.fill(omega, tracks); } } PROCESS_SWITCH(FemtoCascadeQa, processOmega, "Process Omegas", false); @@ -224,7 +224,7 @@ struct FemtoCascadeQa { if (!omegaCleaner.isClean(omega, mcParticles, mcMothers, mcPartonicMothers)) { continue; } - omegaHistManager.fill(omega, tracks, col, mcParticles, mcMothers, mcPartonicMothers); + omegaHistManager.fill(omega, tracks, col, mcParticles, mcMothers, mcPartonicMothers); } } PROCESS_SWITCH(FemtoCascadeQa, processOmegaMc, "Process Omegas with MC information", false); diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index 28185d90673..0f190a841cf 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -60,9 +60,14 @@ struct FemtoPairTrackCascade { using FemtoXis = o2::soa::Join; using FemtoOmegas = o2::soa::Join; - using FemtoTracksWithLabel = o2::soa::Join; - using FemtoXisWithLabel = o2::soa::Join; - using FemtoOmegasWithLabel = o2::soa::Join; + using FemtoTracksWithLabel = o2::soa::Join; + using FemtoXisWithLabel = o2::soa::Join; + using FemtoOmegasWithLabel = o2::soa::Join; + + // reco-only + FitVars (no MC labels, but carries the opt-in purity/fraction tables) + using FemtoTracksWithFitVars = o2::soa::Join; + using FemtoXisWithFitVars = o2::soa::Join; + using FemtoOmegasWithFitVars = o2::soa::Join; using FemtoMcParticlesWithLabel = o2::soa::Join; @@ -84,6 +89,9 @@ struct FemtoPairTrackCascade { o2::framework::Partition trackWithLabelPartition = MAKE_TRACK_PARTITION(confTrackSelection); o2::framework::Preslice perColtracksWithLabel = o2::aod::femtobase::stored::fColId; + o2::framework::Partition trackWithFitVarsPartition = MAKE_TRACK_PARTITION(confTrackSelection); + o2::framework::Preslice perColTracksWithFitVars = o2::aod::femtobase::stored::fColId; + // setup for daughters/bachelor trackhistmanager::ConfCascadePosDauBinning confPosDauBinning; trackhistmanager::ConfCascadeNegDauBinning confNegDauBinning; @@ -100,6 +108,9 @@ struct FemtoPairTrackCascade { o2::framework::Partition xiWithLabelPartition = MAKE_CASCADE_PARTITION(confXiSelection); o2::framework::Preslice perColXisWithLabel = o2::aod::femtobase::stored::fColId; + o2::framework::Partition xiWithFitVarsPartition = MAKE_CASCADE_PARTITION(confXiSelection); + o2::framework::Preslice perColXisWithFitVars = o2::aod::femtobase::stored::fColId; + // setup omegas cascadebuilder::ConfOmegaSelection confOmegaSelection; cascadehistmanager::ConfOmegaBinning confOmegaBinning; @@ -111,6 +122,9 @@ struct FemtoPairTrackCascade { o2::framework::Partition omegaWithLabelPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); o2::framework::Preslice perColOmegasWithLabel = o2::aod::femtobase::stored::fColId; + o2::framework::Partition omegaWithFitVarsPartition = MAKE_CASCADE_PARTITION(confOmegaSelection); + o2::framework::Preslice perColOmegasWithFitVars = o2::aod::femtobase::stored::fColId; + // setup pairs pairhistmanager::ConfPairBinning confPairBinning; pairhistmanager::ConfPairCuts confPairCuts; @@ -174,14 +188,15 @@ struct FemtoPairTrackCascade { void init(o2::framework::InitContext&) { bool processData = doprocessXiSameEvent || doprocessXiMixedEvent || doprocessOmegaSameEvent || doprocessOmegaMixedEvent; + bool processFitVars = doprocessXiSameEventWithFitVars || doprocessXiMixedEventWithFitVars || doprocessOmegaSameEventWithFitVars || doprocessOmegaMixedEventWithFitVars; bool processMc = doprocessXiSameEventMc || doprocessXiMixedEventMc || doprocessOmegaSameEventMc || doprocessOmegaMixedEventMc; - if (processData && processMc) { - LOG(fatal) << "Both data and mc processing is enabled. Breaking..."; + if (static_cast(processData) + static_cast(processFitVars) + static_cast(processMc) > 1) { + LOG(fatal) << "More than one of data, FitVars or mc processing is activated. Breaking..."; } - bool processXi = doprocessXiSameEvent || doprocessXiSameEventMc || doprocessXiMixedEvent || doprocessXiMixedEventMc; - bool processOmega = doprocessOmegaSameEvent || doprocessOmegaSameEventMc || doprocessOmegaMixedEvent || doprocessOmegaMixedEventMc; + bool processXi = doprocessXiSameEvent || doprocessXiSameEventWithFitVars || doprocessXiSameEventMc || doprocessXiMixedEvent || doprocessXiMixedEventWithFitVars || doprocessXiMixedEventMc; + bool processOmega = doprocessOmegaSameEvent || doprocessOmegaSameEventWithFitVars || doprocessOmegaSameEventMc || doprocessOmegaMixedEvent || doprocessOmegaMixedEventWithFitVars || doprocessOmegaMixedEventMc; if (processXi && processOmega) { LOG(fatal) << "Both xi-track and omega-track processing is enabled. Breaking..."; @@ -206,7 +221,21 @@ struct FemtoPairTrackCascade { std::map> cprHistSpecV0Daughter = closepairrejection::makeCprHistSpecMap(confCprV0Daughter); std::map> pairCleanerHistSpec = paircleaner::makePairCleanerHistSpecMap(confPairCleaner); - if (processData) { + if (processFitVars) { + colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); + bachelorHistSpec = trackhistmanager::makeTrackHistSpecMap(confBachelorBinning); + posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); + negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); + pairTrackCascadeHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confMixing); + if (processXi) { + xiHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confXiBinning); + pairTrackXiBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, confXiSelection, confXiCleaner, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackCascadeHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter, pairCleanerHistSpec); + } else { + omegaHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confOmegaBinning); + pairTrackOmegaBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, confOmegaSelection, confOmegaCleaner, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackCascadeHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter, pairCleanerHistSpec); + } + } else if (processData) { colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); bachelorHistSpec = trackhistmanager::makeTrackHistSpecMap(confBachelorBinning); @@ -230,10 +259,10 @@ struct FemtoPairTrackCascade { pairTrackCascadeHistSpec = pairhistmanager::makePairMcHistSpecMap(confPairBinning, confMixing); if (processXi) { xiHistSpec = cascadehistmanager::makeCascadeMcHistSpecMap(confXiBinning); - pairTrackXiBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, confXiSelection, confXiCleaner, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackCascadeHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter, pairCleanerHistSpec); + pairTrackXiBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, confXiSelection, confXiCleaner, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackCascadeHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter, pairCleanerHistSpec); } else { omegaHistSpec = cascadehistmanager::makeCascadeMcHistSpecMap(confOmegaBinning); - pairTrackOmegaBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, confOmegaSelection, confOmegaCleaner, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackCascadeHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter, pairCleanerHistSpec); + pairTrackOmegaBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, confOmegaSelection, confOmegaCleaner, confCprBachelor, confCprV0Daughter, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackCascadeHistSpec, cprHistSpecBachelor, cprHistSpecV0Daughter, pairCleanerHistSpec); } } hRegistry.print(); @@ -247,7 +276,7 @@ struct FemtoPairTrackCascade { void processXiSameEventMc(FilteredFemtoCollisionWithLabel const& col, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoXisWithLabel const& xis, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairTrackXiBuilder.processSameEvent(col, mcCols, tracks, trackWithLabelPartition, xis, xiWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache); + pairTrackXiBuilder.processSameEvent(col, mcCols, tracks, trackWithLabelPartition, xis, xiWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache); } PROCESS_SWITCH(FemtoPairTrackCascade, processXiSameEventMc, "Enable processing same event processing for tracks and xis with mc information", false); @@ -259,10 +288,22 @@ struct FemtoPairTrackCascade { void processXiMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoXisWithLabel const& /*xis*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairTrackXiBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, xiWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairTrackXiBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, xiWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairTrackCascade, processXiMixedEventMc, "Enable processing mixed event processing for tracks and xis with mc information", false); + void processXiSameEventWithFitVars(FilteredFemtoCollision const& col, FemtoTracksWithFitVars const& tracks, FemtoXisWithFitVars const& xis) + { + pairTrackXiBuilder.processSameEvent(col, tracks, trackWithFitVarsPartition, xis, xiWithFitVarsPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processXiSameEventWithFitVars, "Enable processing same event processing for tracks and xis, carrying through FitVars tables", false); + + void processXiMixedEventWithFitVars(FilteredFemtoCollisions const& cols, FemtoTracksWithFitVars const& tracks, FemtoXisWithFitVars const& /*xis*/) + { + pairTrackXiBuilder.processMixedEvent(cols, tracks, trackWithFitVarsPartition, xiWithFitVarsPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processXiMixedEventWithFitVars, "Enable processing mixed event processing for tracks and xis, carrying through FitVars tables", false); + void processOmegaSameEvent(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoOmegas const& omegas) { pairTrackOmegaBuilder.processSameEvent(col, tracks, trackPartition, omegas, omegaPartition, cache); @@ -271,7 +312,7 @@ struct FemtoPairTrackCascade { void processOmegaSameEventMc(FilteredFemtoCollisionWithLabel const& col, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoOmegasWithLabel const& omegas, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairTrackOmegaBuilder.processSameEvent(col, mcCols, tracks, trackWithLabelPartition, omegas, omegaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache); + pairTrackOmegaBuilder.processSameEvent(col, mcCols, tracks, trackWithLabelPartition, omegas, omegaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache); } PROCESS_SWITCH(FemtoPairTrackCascade, processOmegaSameEventMc, "Enable processing same event processing for tracks and omegas with mc information", false); @@ -283,9 +324,21 @@ struct FemtoPairTrackCascade { void processOmegaMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoOmegasWithLabel const& /*omegas*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairTrackOmegaBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, omegaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + pairTrackOmegaBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, omegaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); } PROCESS_SWITCH(FemtoPairTrackCascade, processOmegaMixedEventMc, "Enable processing mixed event processing for tracks and omegas with mc information", false); + + void processOmegaSameEventWithFitVars(FilteredFemtoCollision const& col, FemtoTracksWithFitVars const& tracks, FemtoOmegasWithFitVars const& omegas) + { + pairTrackOmegaBuilder.processSameEvent(col, tracks, trackWithFitVarsPartition, omegas, omegaWithFitVarsPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processOmegaSameEventWithFitVars, "Enable processing same event processing for tracks and omegas, carrying through FitVars tables", false); + + void processOmegaMixedEventWithFitVars(FilteredFemtoCollisions const& cols, FemtoTracksWithFitVars const& tracks, FemtoOmegasWithFitVars const& /*omegas*/) + { + pairTrackOmegaBuilder.processMixedEvent(cols, tracks, trackWithFitVarsPartition, omegaWithFitVarsPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackCascade, processOmegaMixedEventWithFitVars, "Enable processing mixed event processing for tracks and omegas, carrying through FitVars tables", false); }; o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context) diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index 28b9ce92d65..0b3299d8895 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -68,10 +68,10 @@ struct FemtoPairTrackTrack { // opt-in: adds the packed purity tables (nSigma, see TrackBinning1/2.puritySlotMask) and FTrackDcas // (fraction estimation) for the FitVars histograms. Needs the producer's // TrackTables.produceItsPurity/produceTpcPurity/produceTofPurity/produceTrackDcas enabled. - using FemtoTracksWithPurity = o2::soa::Join; + using FemtoTracksWithFitVars = o2::soa::Join; // the Mc process functions always carry the purity/fraction tables (not opt-in like the data - // path's WithPurity variant) -- requires the producer's TrackTables.produceItsPurity/ + // path's WithFitVars variant) -- requires the producer's TrackTables.produceItsPurity/ // produceTpcPurity/produceTofPurity/produceTrackDcas enabled whenever MC processing is used using FemtoTracksWithLabel = o2::soa::Join; @@ -101,9 +101,9 @@ struct FemtoPairTrackTrack { o2::framework::Partition trackWithMassPartition2 = MAKE_TRACK_PARTITION_WITH_MASS(confTrackSelections2); o2::framework::Preslice perColtracksWithMass = o2::aod::femtobase::stored::fColId; - o2::framework::Partition trackWithPurityPartition1 = MAKE_TRACK_PARTITION(confTrackSelections1); - o2::framework::Partition trackWithPurityPartition2 = MAKE_TRACK_PARTITION(confTrackSelections2); - o2::framework::Preslice perColtracksWithPurity = o2::aod::femtobase::stored::fColId; + o2::framework::Partition trackWithFitVarsPartition1 = MAKE_TRACK_PARTITION(confTrackSelections1); + o2::framework::Partition trackWithFitVarsPartition2 = MAKE_TRACK_PARTITION(confTrackSelections2); + o2::framework::Preslice perColtracksWithFitVars = o2::aod::femtobase::stored::fColId; o2::framework::Partition trackWithLabelPartition1 = MAKE_TRACK_PARTITION(confTrackSelections1); o2::framework::Partition trackWithLabelPartition2 = MAKE_TRACK_PARTITION(confTrackSelections2); @@ -142,14 +142,14 @@ struct FemtoPairTrackTrack { void init(o2::framework::InitContext&) { - if ((static_cast(doprocessSameEvent) + static_cast(doprocessSameEventWithMass) + static_cast(doprocessSameEventWithEventShape) + static_cast(doprocessSameEventWithPurity) + static_cast(doprocessSameEventMc)) > 1 || - (static_cast(doprocessMixedEvent) + static_cast(doprocessMixedEventWithMass) + static_cast(doprocessMixedEventWithEventShape) + static_cast(doprocessMixedEventWithPurity) + static_cast(doprocessMixedEventMc)) > 1) { + if ((static_cast(doprocessSameEvent) + static_cast(doprocessSameEventWithMass) + static_cast(doprocessSameEventWithEventShape) + static_cast(doprocessSameEventWithFitVars) + static_cast(doprocessSameEventMc)) > 1 || + (static_cast(doprocessMixedEvent) + static_cast(doprocessMixedEventWithMass) + static_cast(doprocessMixedEventWithEventShape) + static_cast(doprocessMixedEventWithFitVars) + static_cast(doprocessMixedEventMc)) > 1) { LOG(fatal) << "More than 1 same or mixed event process function is activated. Breaking..."; } bool processData = doprocessSameEvent || doprocessMixedEvent || doprocessSameEventWithMass || doprocessMixedEventWithMass || doprocessSameEventWithEventShape || doprocessMixedEventWithEventShape; - bool processPurity = doprocessSameEventWithPurity || doprocessMixedEventWithPurity; + bool processFitVars = doprocessSameEventWithFitVars || doprocessMixedEventWithFitVars; bool processMc = doprocessSameEventMc || doprocessMixedEventMc; - if (static_cast(processData) + static_cast(processPurity) + static_cast(processMc) > 1) { + if (static_cast(processData) + static_cast(processFitVars) + static_cast(processMc) > 1) { LOG(fatal) << "More than one of data, purity or mc processing is activated. Breaking..."; } @@ -168,7 +168,7 @@ struct FemtoPairTrackTrack { std::map> cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); std::map> pairCleanerHistSpec = paircleaner::makePairCleanerHistSpecMap(confPairCleaner); - if (processPurity) { + if (processFitVars) { colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); trackHistSpec1 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning1); trackHistSpec2 = trackhistmanager::makeTrackHistSpecMap(confTrackBinning2); @@ -202,11 +202,11 @@ struct FemtoPairTrackTrack { } PROCESS_SWITCH(FemtoPairTrackTrack, processSameEventWithMass, "Enable processing same event processing (with track masses)", false); - void processSameEventWithPurity(FilteredFemtoCollision const& col, FemtoTracksWithPurity const& tracks) + void processSameEventWithFitVars(FilteredFemtoCollision const& col, FemtoTracksWithFitVars const& tracks) { - pairTrackTrackBuilder.processSameEvent(col, tracks, trackWithPurityPartition1, trackWithPurityPartition2, cache); + pairTrackTrackBuilder.processSameEvent(col, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache); } - PROCESS_SWITCH(FemtoPairTrackTrack, processSameEventWithPurity, "Enable processing same event processing (with purity/fraction tables)", false); + PROCESS_SWITCH(FemtoPairTrackTrack, processSameEventWithFitVars, "Enable processing same event processing (with FitVars tables)", false); void processSameEventWithEventShape(FilteredFemtoCollisionWithEventShape const& col, FemtoTracks const& tracks) { @@ -232,11 +232,11 @@ struct FemtoPairTrackTrack { } PROCESS_SWITCH(FemtoPairTrackTrack, processMixedEventWithMass, "Enable processing mixed event processing (with track masses)", false); - void processMixedEventWithPurity(FilteredFemtoCollisions const& cols, FemtoTracksWithPurity const& tracks) + void processMixedEventWithFitVars(FilteredFemtoCollisions const& cols, FemtoTracksWithFitVars const& tracks) { - pairTrackTrackBuilder.processMixedEvent(cols, tracks, trackWithPurityPartition1, trackWithPurityPartition2, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent, mixBinsVtxCentEventPlaneAngle); + pairTrackTrackBuilder.processMixedEvent(cols, tracks, trackWithFitVarsPartition1, trackWithFitVarsPartition2, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent, mixBinsVtxCentEventPlaneAngle); } - PROCESS_SWITCH(FemtoPairTrackTrack, processMixedEventWithPurity, "Enable processing mixed event processing (with purity/fraction tables)", false); + PROCESS_SWITCH(FemtoPairTrackTrack, processMixedEventWithFitVars, "Enable processing mixed event processing (with FitVars tables)", false); void processMixedEventWithEventShape(FilteredFemtoCollisionsWithEventShape const& cols, FemtoTracks const& tracks) { diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index 88e844687e8..054e8bc40cf 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -60,9 +60,14 @@ struct FemtoPairTrackV0 { using FemtoLambdas = o2::soa::Join; using FemtoK0shorts = o2::soa::Join; - using FemtoTracksWithLabel = o2::soa::Join; - using FemtoLambdasWithLabel = o2::soa::Join; - using FemtoK0shortsWithLabel = o2::soa::Join; + using FemtoTracksWithLabel = o2::soa::Join; + using FemtoLambdasWithLabel = o2::soa::Join; + using FemtoK0shortsWithLabel = o2::soa::Join; + + // reco-only + FitVars (no MC labels, but carries the opt-in purity/fraction tables) + using FemtoTracksWithFitVars = o2::soa::Join; + using FemtoLambdasWithFitVars = o2::soa::Join; + using FemtoK0shortsWithFitVars = o2::soa::Join; using FemtoMcParticlesWithLabel = o2::soa::Join; @@ -84,6 +89,9 @@ struct FemtoPairTrackV0 { o2::framework::Partition trackWithLabelPartition = MAKE_TRACK_PARTITION(confTrackSelection); o2::framework::Preslice perColtracksWithLabel = o2::aod::femtobase::stored::fColId; + o2::framework::Partition trackWithFitVarsPartition = MAKE_TRACK_PARTITION(confTrackSelection); + o2::framework::Preslice perColTracksWithFitVars = o2::aod::femtobase::stored::fColId; + // setup for daughters trackhistmanager::ConfV01PosDauBinning confPosDauBinning; trackhistmanager::ConfV01NegDauBinning confNegDauBinning; @@ -99,6 +107,9 @@ struct FemtoPairTrackV0 { o2::framework::Partition lambdaWithLabelPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); o2::framework::Preslice perColLambdasWithLabel = o2::aod::femtobase::stored::fColId; + o2::framework::Partition lambdaWithFitVarsPartition = MAKE_LAMBDA_PARTITION(lambdaSelection); + o2::framework::Preslice perColLambdasWithFitVars = o2::aod::femtobase::stored::fColId; + // setup k0shorts v0builder::ConfK0shortSelection1 k0shortSelection; v0histmanager::ConfK0shortBinning1 confK0shortBinning; @@ -110,6 +121,9 @@ struct FemtoPairTrackV0 { o2::framework::Partition k0shortWithLabelPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); o2::framework::Preslice perColk0shortsWithLabel = o2::aod::femtobase::stored::fColId; + o2::framework::Partition k0shortWithFitVarsPartition = MAKE_K0SHORT_PARTITION(k0shortSelection); + o2::framework::Preslice perColk0shortsWithFitVars = o2::aod::femtobase::stored::fColId; + // setup pairs pairhistmanager::ConfPairBinning confPairBinning; pairhistmanager::ConfPairCuts confPairCuts; @@ -164,14 +178,15 @@ struct FemtoPairTrackV0 { void init(o2::framework::InitContext&) { bool processData = doprocessLambdaSameEvent || doprocessLambdaMixedEvent || doprocessK0shortSameEvent || doprocessK0shortMixedEvent; + bool processFitVars = doprocessLambdaSameEventWithFitVars || doprocessLambdaMixedEventWithFitVars || doprocessK0shortSameEventWithFitVars || doprocessK0shortMixedEventWithFitVars; bool processMc = doprocessLambdaSameEventMc || doprocessLambdaMixedEventMc || doprocessK0shortSameEventMc || doprocessK0shortMixedEventMc; - if (processData && processMc) { - LOG(fatal) << "Both data and mc processing is enabled. Breaking..."; + if (static_cast(processData) + static_cast(processFitVars) + static_cast(processMc) > 1) { + LOG(fatal) << "More than one of data, FitVars or mc processing is activated. Breaking..."; } - bool processLambda = doprocessLambdaSameEvent || doprocessLambdaSameEventMc || doprocessLambdaMixedEvent || doprocessLambdaMixedEventMc; - bool processK0short = doprocessK0shortSameEvent || doprocessK0shortSameEventMc || doprocessK0shortMixedEvent || doprocessK0shortMixedEventMc; + bool processLambda = doprocessLambdaSameEvent || doprocessLambdaSameEventWithFitVars || doprocessLambdaSameEventMc || doprocessLambdaMixedEvent || doprocessLambdaMixedEventWithFitVars || doprocessLambdaMixedEventMc; + bool processK0short = doprocessK0shortSameEvent || doprocessK0shortSameEventWithFitVars || doprocessK0shortSameEventMc || doprocessK0shortMixedEvent || doprocessK0shortMixedEventWithFitVars || doprocessK0shortMixedEventMc; if (processLambda && processK0short) { LOG(fatal) << "Both lambda-track and k0short-track processing is enabled. Breaking..."; @@ -193,7 +208,20 @@ struct FemtoPairTrackV0 { std::map> cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); std::map> pairCleanerHistSpec = paircleaner::makePairCleanerHistSpecMap(confPairCleaner); - if (processData) { + if (processFitVars) { + colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); + trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); + posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); + negDauSpec = trackhistmanager::makeTrackHistSpecMap(confNegDauBinning); + pairTrackV0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confMixing); + if (processLambda) { + lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); + pairTrackLambdaBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, lambdaSelection, confLambdaCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec, pairCleanerHistSpec); + } else { + k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); + pairTrackK0shortBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, k0shortSelection, confK0shortCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec, pairCleanerHistSpec); + } + } else if (processData) { colHistSpec = colhistmanager::makeColHistSpecMap(confCollisionBinning); trackHistSpec = trackhistmanager::makeTrackHistSpecMap(confTrackBinning); posDauSpec = trackhistmanager::makeTrackHistSpecMap(confPosDauBinning); @@ -214,10 +242,10 @@ struct FemtoPairTrackV0 { pairTrackV0HistSpec = pairhistmanager::makePairMcHistSpecMap(confPairBinning, confMixing); if (processLambda) { lambdaHistSpec = v0histmanager::makeV0McHistSpecMap(confLambdaBinning); - pairTrackLambdaBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, lambdaSelection, confLambdaCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec, pairCleanerHistSpec); + pairTrackLambdaBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, lambdaSelection, confLambdaCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec, pairCleanerHistSpec); } else { k0shortHistSpec = v0histmanager::makeV0McHistSpecMap(confK0shortBinning); - pairTrackK0shortBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, k0shortSelection, confK0shortCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec, pairCleanerHistSpec); + pairTrackK0shortBuilder.init(&hRegistry, confCollisionBinning, confTrackSelection, confTrackCleaner, k0shortSelection, confK0shortCleaner, confCpr, confMixing, confPairBinning, confPairCuts, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackV0HistSpec, cprHistSpec, pairCleanerHistSpec); } } hRegistry.print(); @@ -231,7 +259,7 @@ struct FemtoPairTrackV0 { void processLambdaSameEventMc(FilteredFemtoCollisionWithLabel const& col, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& lambdas, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairTrackLambdaBuilder.processSameEvent(col, mcCols, tracks, trackWithLabelPartition, lambdas, lambdaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache); + pairTrackLambdaBuilder.processSameEvent(col, mcCols, tracks, trackWithLabelPartition, lambdas, lambdaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache); } PROCESS_SWITCH(FemtoPairTrackV0, processLambdaSameEventMc, "Enable processing same event processing for tracks and lambdas with MC information", false); @@ -243,10 +271,22 @@ struct FemtoPairTrackV0 { void processLambdaMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoLambdasWithLabel const& /*lambas*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairTrackLambdaBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, lambdaWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, 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); + void processLambdaSameEventWithFitVars(FilteredFemtoCollision const& col, FemtoTracksWithFitVars const& tracks, FemtoLambdasWithFitVars const& lambdas) + { + pairTrackLambdaBuilder.processSameEvent(col, tracks, trackWithFitVarsPartition, lambdas, lambdaWithFitVarsPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackV0, processLambdaSameEventWithFitVars, "Enable processing same event processing for tracks and lambdas, carrying through FitVars tables", false); + + void processLambdaMixedEventWithFitVars(FilteredFemtoCollisions const& cols, FemtoTracksWithFitVars const& tracks, FemtoLambdasWithFitVars const& /*lambas*/) + { + pairTrackLambdaBuilder.processMixedEvent(cols, tracks, trackWithFitVarsPartition, lambdaWithFitVarsPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackV0, processLambdaMixedEventWithFitVars, "Enable processing mixed event processing for tracks and lambdas, carrying through FitVars tables", false); + void processK0shortSameEvent(FilteredFemtoCollision const& col, FemtoTracks const& tracks, FemtoK0shorts const& k0shorts) { pairTrackK0shortBuilder.processSameEvent(col, tracks, trackPartition, k0shorts, k0shortPartition, cache); @@ -255,7 +295,7 @@ struct FemtoPairTrackV0 { void processK0shortSameEventMc(FilteredFemtoCollisionWithLabel const& col, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoK0shortsWithLabel const& k0shorts, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairTrackK0shortBuilder.processSameEvent(col, mcCols, tracks, trackWithLabelPartition, k0shorts, k0shortWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache); + pairTrackK0shortBuilder.processSameEvent(col, mcCols, tracks, trackWithLabelPartition, k0shorts, k0shortWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache); } PROCESS_SWITCH(FemtoPairTrackV0, processK0shortSameEventMc, "Enable processing same event processing for tracks and k0shorts with MC information", false); @@ -267,9 +307,21 @@ struct FemtoPairTrackV0 { void processK0shortMixedEventMc(FilteredFemtoCollisionsWithLabel const& cols, o2::aod::FMcCols const& mcCols, FemtoTracksWithLabel const& tracks, FemtoK0shortsWithLabel const& /*k0shorts*/, FemtoMcParticlesWithLabel const& mcParticles, o2::aod::FMcMothers const& mcMothers, o2::aod::FMcPartMoths const& mcPartonicMothers) { - pairTrackK0shortBuilder.processMixedEvent(cols, mcCols, tracks, trackWithLabelPartition, k0shortWithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, 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); + + void processK0shortSameEventWithFitVars(FilteredFemtoCollision const& col, FemtoTracksWithFitVars const& tracks, FemtoK0shortsWithFitVars const& k0shorts) + { + pairTrackK0shortBuilder.processSameEvent(col, tracks, trackWithFitVarsPartition, k0shorts, k0shortWithFitVarsPartition, cache); + } + PROCESS_SWITCH(FemtoPairTrackV0, processK0shortSameEventWithFitVars, "Enable processing same event processing for tracks and k0shorts, carrying through FitVars tables", false); + + void processK0shortMixedEventWithFitVars(FilteredFemtoCollisions const& cols, FemtoTracksWithFitVars const& tracks, FemtoK0shortsWithFitVars const& /*k0shorts*/) + { + pairTrackK0shortBuilder.processMixedEvent(cols, tracks, trackWithFitVarsPartition, k0shortWithFitVarsPartition, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent); + } + PROCESS_SWITCH(FemtoPairTrackV0, processK0shortMixedEventWithFitVars, "Enable processing mixed event processing for tracks and k0shorts, carrying through FitVars tables", false); }; o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context) diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index 5a5f081e954..c247afdb75c 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -53,7 +53,7 @@ struct FemtoTrackQa { using FilteredFemtoCollisionsWithLabel = o2::soa::Filtered; using FilteredFemtoCollisionWithLabel = FilteredFemtoCollisionsWithLabel::iterator; - using FemtoTracks = o2::soa::Join; + using FemtoTracks = o2::soa::Join; using FemtoTracksWithLabel = o2::soa::Join; @@ -100,12 +100,12 @@ struct FemtoTrackQa { colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, colHistSpec, confCollisionBinning, confCollisionQaBinning); trackHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confTrackBinning, confTrackQaBinning); - trackHistManager.init(&hRegistry, trackHistSpec, confTrackSelection, confTrackQaBinning); + trackHistManager.init(&hRegistry, trackHistSpec, confTrackSelection, confTrackQaBinning); } else { colHistSpec = colhistmanager::makeColMcQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); colHistManager.init(&hRegistry, colHistSpec, confCollisionBinning, confCollisionQaBinning); trackHistSpec = trackhistmanager::makeTrackMcQaHistSpecMap(confTrackBinning, confTrackQaBinning); - trackHistManager.init(&hRegistry, trackHistSpec, confTrackSelection, confTrackQaBinning); + trackHistManager.init(&hRegistry, trackHistSpec, confTrackSelection, confTrackQaBinning); } hRegistry.print(); }; @@ -118,7 +118,7 @@ struct FemtoTrackQa { } colHistManager.fill(col); for (auto const& track : trackSlice) { - trackHistManager.fill(track, tracks); + trackHistManager.fill(track, tracks); } }; PROCESS_SWITCH(FemtoTrackQa, processData, "Track QA in Data", true); @@ -134,7 +134,7 @@ struct FemtoTrackQa { if (!trackCleaner.isClean(track, mcParticles, mcMothers, mcPartonicMothers)) { continue; } - trackHistManager.fill(track, tracks, col, mcParticles, mcMothers, mcPartonicMothers); + trackHistManager.fill(track, tracks, col, mcParticles, mcMothers, mcPartonicMothers); } } PROCESS_SWITCH(FemtoTrackQa, processMc, "Track QA in Monte Carlo", false); @@ -147,7 +147,7 @@ struct FemtoTrackQa { } colHistManager.fill(col); for (auto const& track : trackSlice) { - trackHistManager.fill(track, tracks); + trackHistManager.fill(track, tracks); } }; PROCESS_SWITCH(FemtoTrackQa, processDataWithEventShape, "Track QA in Data with event shape information", false); diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx index 18e6a485e99..083f5bcc849 100644 --- a/PWGCF/Femto/Tasks/femtoV0Qa.cxx +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -52,7 +52,7 @@ struct FemtoV0Qa { using FemtoLambdas = o2::soa::Join; using FemtoK0shorts = o2::soa::Join; - using FemtoTracks = o2::soa::Join; + using FemtoTracks = o2::soa::Join; using FemtoLambdasWithLabel = o2::soa::Join; using FemtoK0shortsWithLabel = o2::soa::Join; @@ -143,11 +143,11 @@ struct FemtoV0Qa { negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confV0NegDaughterBinning, confV0NegDaughterQaBinning); if (doprocessLambda) { lambdaHistSpec = v0histmanager::makeV0QaHistSpecMap(confLambdaBinning, confLambdaQaBinning); - lambdaHistManager.init(&hRegistry, lambdaHistSpec, confLambdaSelection, confLambdaQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); + lambdaHistManager.init(&hRegistry, lambdaHistSpec, confLambdaSelection, confLambdaQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); } if (doprocessK0short) { k0shortHistSpec = v0histmanager::makeV0QaHistSpecMap(confK0shortBinning, confK0shortQaBinning); - k0shortHistManager.init(&hRegistry, k0shortHistSpec, confK0shortSelection, confK0shortQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); + k0shortHistManager.init(&hRegistry, k0shortHistSpec, confK0shortSelection, confK0shortQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); } } else { colHistSpec = colhistmanager::makeColMcQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); @@ -156,11 +156,11 @@ struct FemtoV0Qa { negDaughterHistSpec = trackhistmanager::makeTrackMcQaHistSpecMap(confV0NegDaughterBinning, confV0NegDaughterQaBinning); if (doprocessLambdaMc) { lambdaHistSpec = v0histmanager::makeV0McQaHistSpecMap(confLambdaBinning, confLambdaQaBinning); - lambdaHistManager.init(&hRegistry, lambdaHistSpec, confLambdaSelection, confLambdaQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); + lambdaHistManager.init(&hRegistry, lambdaHistSpec, confLambdaSelection, confLambdaQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); } if (doprocessK0shortMc) { k0shortHistSpec = v0histmanager::makeV0McQaHistSpecMap(confK0shortBinning, confK0shortQaBinning); - k0shortHistManager.init(&hRegistry, k0shortHistSpec, confK0shortSelection, confK0shortQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); + k0shortHistManager.init(&hRegistry, k0shortHistSpec, confK0shortSelection, confK0shortQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); } } hRegistry.print(); @@ -174,7 +174,7 @@ struct FemtoV0Qa { } colHistManager.fill(col); for (auto const& k0short : k0shortSlice) { - k0shortHistManager.fill(k0short, tracks); + k0shortHistManager.fill(k0short, tracks); } } PROCESS_SWITCH(FemtoV0Qa, processK0short, "Process k0shorts", false); @@ -190,7 +190,7 @@ struct FemtoV0Qa { if (!k0shortCleaner.isClean(k0short, mcParticles, mcMothers, mcPartonicMothers)) { continue; } - k0shortHistManager.fill(k0short, tracks, col, mcParticles, mcMothers, mcPartonicMothers); + k0shortHistManager.fill(k0short, tracks, col, mcParticles, mcMothers, mcPartonicMothers); } } PROCESS_SWITCH(FemtoV0Qa, processK0shortMc, "Process k0shorts with MC information", false); @@ -203,7 +203,7 @@ struct FemtoV0Qa { } colHistManager.fill(col); for (auto const& lambda : lambdaSlice) { - lambdaHistManager.fill(lambda, tracks); + lambdaHistManager.fill(lambda, tracks); } } PROCESS_SWITCH(FemtoV0Qa, processLambda, "Process lambdas", true); @@ -219,7 +219,7 @@ struct FemtoV0Qa { if (!lambdaCleaner.isClean(lambda, mcParticles, mcMothers, mcPartonicMothers)) { continue; } - lambdaHistManager.fill(lambda, tracks, col, mcParticles, mcMothers, mcPartonicMothers); + lambdaHistManager.fill(lambda, tracks, col, mcParticles, mcMothers, mcPartonicMothers); } } PROCESS_SWITCH(FemtoV0Qa, processLambdaMc, "Process lambdas with MC informaton", false);