From 7d9da08046fa454b11d430e441bf930ef8f9b4eb Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Mon, 27 Oct 2025 22:59:13 +0100 Subject: [PATCH 1/3] feat: update histogram managers --- PWGCF/Femto/Core/baseSelection.h | 2 +- PWGCF/Femto/Core/cascadeBuilder.h | 8 +- PWGCF/Femto/Core/cascadeHistManager.h | 153 ++++--- PWGCF/Femto/Core/closePairRejection.h | 353 ++++++++++++---- PWGCF/Femto/Core/collisionBuilder.h | 8 +- PWGCF/Femto/Core/collisionHistManager.h | 102 +++-- PWGCF/Femto/Core/dataTypes.h | 2 +- PWGCF/Femto/Core/kinkBuilder.h | 8 +- PWGCF/Femto/Core/kinkHistManager.h | 178 ++++---- PWGCF/Femto/Core/modes.h | 3 +- PWGCF/Femto/Core/pairBuilder.h | 270 ++++++------ PWGCF/Femto/Core/pairHistManager.h | 196 +++++++-- PWGCF/Femto/Core/pairProcessHelpers.h | 36 +- PWGCF/Femto/Core/trackBuilder.h | 6 +- PWGCF/Femto/Core/trackHistManager.h | 387 +++++++++++------- PWGCF/Femto/Core/twoTrackResonanceBuilder.h | 4 +- .../Femto/Core/twoTrackResonanceHistManager.h | 115 ++++-- PWGCF/Femto/Core/v0Builder.h | 4 +- PWGCF/Femto/Core/v0HistManager.h | 164 +++++--- PWGCF/Femto/Tasks/femtoCascadeQa.cxx | 6 +- PWGCF/Femto/Tasks/femtoKinkQa.cxx | 4 +- PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx | 22 +- PWGCF/Femto/Tasks/femtoPairTrackKink.cxx | 2 +- PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx | 4 +- .../Tasks/femtoPairTrackTwoTrackResonance.cxx | 26 +- PWGCF/Femto/Tasks/femtoPairTrackV0.cxx | 18 +- PWGCF/Femto/Tasks/femtoPairV0V0.cxx | 6 +- PWGCF/Femto/Tasks/femtoTrackQa.cxx | 4 +- .../Femto/Tasks/femtoTwotrackresonanceQa.cxx | 8 +- PWGCF/Femto/Tasks/femtoV0Qa.cxx | 6 +- 30 files changed, 1359 insertions(+), 746 deletions(-) diff --git a/PWGCF/Femto/Core/baseSelection.h b/PWGCF/Femto/Core/baseSelection.h index f5487262912..8ada2f09ed1 100644 --- a/PWGCF/Femto/Core/baseSelection.h +++ b/PWGCF/Femto/Core/baseSelection.h @@ -47,7 +47,7 @@ class BaseSelection { public: /// \brief Default constructor. - BaseSelection() {} + BaseSelection() = default; /// \brief Destructor virtual ~BaseSelection() = default; diff --git a/PWGCF/Femto/Core/cascadeBuilder.h b/PWGCF/Femto/Core/cascadeBuilder.h index c65611da008..5c73652b055 100644 --- a/PWGCF/Femto/Core/cascadeBuilder.h +++ b/PWGCF/Femto/Core/cascadeBuilder.h @@ -171,8 +171,8 @@ template class CascadeSelection : public BaseSelection { public: - CascadeSelection() {} - virtual ~CascadeSelection() = default; + CascadeSelection() = default; + ~CascadeSelection() = default; template void configure(T1 const& config, T2 const& filter) @@ -331,8 +331,8 @@ template class CascadeBuilder { public: - CascadeBuilder() {} - virtual ~CascadeBuilder() = default; + CascadeBuilder() = default; + ~CascadeBuilder() = default; template void init(T1& config, T2& filter, T3& table, T4& initContext) diff --git a/PWGCF/Femto/Core/cascadeHistManager.h b/PWGCF/Femto/Core/cascadeHistManager.h index 4619b30ae26..358c72292ff 100644 --- a/PWGCF/Femto/Core/cascadeHistManager.h +++ b/PWGCF/Femto/Core/cascadeHistManager.h @@ -78,6 +78,7 @@ using ConfOmegaBinning = ConfCascadeBinning; template struct ConfCascadeQaBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; + o2::framework::Configurable plot2d{"plot2d", true, "Enable 2d Qa histograms"}; o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.9, 1}}, "Cosine of poiting 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"}; @@ -169,48 +170,48 @@ class CascadeHistManager { public: CascadeHistManager() = default; - virtual ~CascadeHistManager() = default; - /// Initializes histograms for the task - /// \param registry Histogram registry to be passed - /// + ~CascadeHistManager() = default; + void init(o2::framework::HistogramRegistry* registry, - std::map> cascadeSpecs, - std::map> BachelorSpecs, - std::map> PosDauSpecs, - std::map> NegDauSpecs) + std::map> const& cascadeSpecs, + std::map> const& BachelorSpecs, + std::map> const& PosDauSpecs, + std::map> const& NegDauSpecs) { mHistogramRegistry = registry; mBachelorManager.init(registry, BachelorSpecs); mPosDauManager.init(registry, PosDauSpecs); mNegDauManager.init(registry, NegDauSpecs); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(cascadePrefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {cascadeSpecs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {cascadeSpecs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {cascadeSpecs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {cascadeSpecs[kMass]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {cascadeSpecs[kSign]}); + initAnalysis(cascadeSpecs); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(cascadePrefix) + std::string(QaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {cascadeSpecs[kCosPa]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {cascadeSpecs[kDecayDauDca]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {cascadeSpecs[kTransRadius]}); + initQa(cascadeSpecs); + } + } - // qa 2d - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {cascadeSpecs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {cascadeSpecs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {cascadeSpecs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {cascadeSpecs[kPtVsCosPa]}); + template + void enableOptionalHistograms(T1 const& CascadeConfBinningQa, T2 const& BachelorConfBinningQa, T3 const& PosDauConfBinningQa, T4 const& NegDauConfBinningQa) + { + mBachelorManager.enableOptionalHistograms(BachelorConfBinningQa); + mPosDauManager.enableOptionalHistograms(PosDauConfBinningQa); + mNegDauManager.enableOptionalHistograms(NegDauConfBinningQa); + mPlot2d = CascadeConfBinningQa.plot2d.value; + } - mHistogramRegistry->add(qaDir + getHistNameV2(kMassXi, HistTable), getHistDesc(kMassXi, HistTable), getHistType(kMassXi, HistTable), {cascadeSpecs[kMassXi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMassOmega, HistTable), getHistDesc(kMassOmega, HistTable), getHistType(kMassOmega, HistTable), {cascadeSpecs[kMassOmega]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassXi, HistTable), getHistDesc(kPtVsMassXi, HistTable), getHistType(kPtVsMassXi, HistTable), {cascadeSpecs[kPtVsMassXi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassOmega, HistTable), getHistDesc(kPtVsMassOmega, HistTable), getHistType(kPtVsMassOmega, HistTable), {cascadeSpecs[kPtVsMassOmega]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMassXiVsMassOmega, HistTable), getHistDesc(kMassXiVsMassOmega, HistTable), getHistType(kMassXiVsMassOmega, HistTable), {cascadeSpecs[kMassXiVsMassOmega]}); - } + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& cascadeSpecs, + T1 const& CascadeConfBinningQa, + std::map> const& BachelorSpecs, + T2 const& BachelorConfBinningQa, + std::map> const& PosDauSpecs, + T3 const& PosDauConfBinningQa, + std::map> const& NegDauSpecs, + T4 const& NegDauConfBinningQa) + { + enableOptionalHistograms(CascadeConfBinningQa, BachelorConfBinningQa, PosDauConfBinningQa, NegDauConfBinningQa); + init(registry, cascadeSpecs, BachelorSpecs, PosDauSpecs, NegDauSpecs); } template @@ -220,7 +221,6 @@ class CascadeHistManager // auto bachelor = cascadeCandidate.template bachelor_as(); // auto posDaughter = cascadeCandidate.template posDau_as(); // auto negDaughter = cascadeCandidate.template negDau_as(); - auto posDaughter = tracks.rawIteratorAt(cascadeCandidate.posDauId() - tracks.offset()); mPosDauManager.fill(posDaughter, tracks); auto negDaughter = tracks.rawIteratorAt(cascadeCandidate.negDauId() - tracks.offset()); @@ -229,40 +229,87 @@ class CascadeHistManager mBachelorManager.fill(bachelor, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), cascadeCandidate.pt()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), cascadeCandidate.eta()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), cascadeCandidate.phi()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), cascadeCandidate.mass()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), cascadeCandidate.sign()); + fillAnalysis(cascadeCandidate); } if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - float massXi, massOmega; - if constexpr (modes::isEqual(cascade, modes::Cascade::kXi)) { - massXi = cascadeCandidate.mass(); - massOmega = cascadeCandidate.massOmega(); - } - if constexpr (modes::isEqual(cascade, modes::Cascade::kOmega)) { - massXi = cascadeCandidate.massXi(); - massOmega = cascadeCandidate.mass(); - } - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), cascadeCandidate.cascadeCosPa()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), cascadeCandidate.cascadeDauDca()); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), cascadeCandidate.cascadeTransRadius()); + fillQa(cascadeCandidate); + } + } + + private: + void initAnalysis(std::map> const& cascadeSpecs) + { + std::string analysisDir = std::string(cascadePrefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {cascadeSpecs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {cascadeSpecs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {cascadeSpecs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {cascadeSpecs.at(kMass)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {cascadeSpecs.at(kSign)}); + } + + void initQa(std::map> const& cascadeSpecs) + { + std::string qaDir = std::string(cascadePrefix) + std::string(QaDir); + mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {cascadeSpecs.at(kCosPa)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {cascadeSpecs.at(kDecayDauDca)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {cascadeSpecs.at(kTransRadius)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassXi, HistTable), getHistDesc(kMassXi, HistTable), getHistType(kMassXi, HistTable), {cascadeSpecs.at(kMassXi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassOmega, HistTable), getHistDesc(kMassOmega, HistTable), getHistType(kMassOmega, HistTable), {cascadeSpecs.at(kMassOmega)}); + + if (mPlot2d) { + 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(kPtVsMassXi, HistTable), getHistDesc(kPtVsMassXi, HistTable), getHistType(kPtVsMassXi, HistTable), {cascadeSpecs.at(kPtVsMassXi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMassOmega, HistTable), getHistDesc(kPtVsMassOmega, HistTable), getHistType(kPtVsMassOmega, HistTable), {cascadeSpecs.at(kPtVsMassOmega)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassXiVsMassOmega, HistTable), getHistDesc(kMassXiVsMassOmega, HistTable), getHistType(kMassXiVsMassOmega, HistTable), {cascadeSpecs.at(kMassXiVsMassOmega)}); + } + } + + template + void fillAnalysis(T const& cascadeCandidate) + { + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), cascadeCandidate.pt()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), cascadeCandidate.eta()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), cascadeCandidate.phi()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), cascadeCandidate.mass()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), cascadeCandidate.sign()); + } + + template + void fillQa(T const& cascadeCandidate) + { + float massXi = 0.f; + float massOmega = 0.f; + if constexpr (modes::isEqual(cascade, modes::Cascade::kXi)) { + massXi = cascadeCandidate.mass(); + massOmega = cascadeCandidate.massOmega(); + } + if constexpr (modes::isEqual(cascade, modes::Cascade::kOmega)) { + massXi = cascadeCandidate.massXi(); + massOmega = cascadeCandidate.mass(); + } + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), cascadeCandidate.cascadeCosPa()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), cascadeCandidate.cascadeDauDca()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), cascadeCandidate.cascadeTransRadius()); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassXi, HistTable)), massXi); + mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassOmega, HistTable)), massOmega); + + if (mPlot2d) { 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(kMassXi, HistTable)), massXi); - mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassOmega, HistTable)), massOmega); 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); mHistogramRegistry->fill(HIST(cascadePrefix) + HIST(QaDir) + HIST(getHistName(kMassXiVsMassOmega, HistTable)), massXi, massOmega); } } - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; - + bool mPlot2d = true; trackhistmanager::TrackHistManager mBachelorManager; trackhistmanager::TrackHistManager mPosDauManager; trackhistmanager::TrackHistManager mNegDauManager; diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 0ea82363337..7395e35b691 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -51,15 +51,63 @@ enum CprHist { kCprHistogramLast }; +// default config, cpr between two charged tracks (or track vs particle which decays into one charged track, like sigma) struct ConfCpr : o2::framework::ConfigurableGroup { std::string prefix = std::string("ClosePairRejection"); o2::framework::Configurable on{"on", true, "Turn on CPR"}; + o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; + o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; o2::framework::Configurable detaMax{"detaMax", 0.01f, "Maximium deta"}; o2::framework::Configurable dphistarMax{"dphistarMax", 0.01f, "Maximum dphistar"}; o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; }; +struct ConfCprTrackV0 : o2::framework::ConfigurableGroup { + std::string prefix = std::string("ClosePairRejectionTrackV0"); + o2::framework::Configurable onSameCharge{"onSameCharge", true, "Turn on CPR for track and same charge daughter"}; + o2::framework::Configurable onOppositeCharge{"onOppositeCharge", false, "Turn on CPR for track and opposite charge daughter"}; + o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; + o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; + o2::framework::Configurable detaMaxSameCharge{"detaMaxSameCharge", 0.01f, "Maximium deta between track and same charge daughter"}; + o2::framework::Configurable dphistarMaxSameCharge{"dphistarMaxSameCharge", 0.01f, "Maximium dphistar between track and same charge daughter"}; + o2::framework::Configurable detaMaxOppositeCharge{"detaMaxOppositeCharge", 0.01f, "Maximum deta between track and opposite charge daughter"}; + o2::framework::Configurable dphistarMaxOppositeCharge{"dphistarMaxOppositeCharge", 0.01f, "Maximum dphistar between track and opposite charge daughter"}; + o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; + o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; +}; + +struct ConfCprV0V0 : o2::framework::ConfigurableGroup { + std::string prefix = std::string("ClosePairRejectionV0V0"); + o2::framework::Configurable on{"on", true, "Turn on CPR"}; + o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; + o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; + o2::framework::Configurable detaMaxPosDau{"detaMaxPosDau", 0.01f, "Maximium deta between positive daughters"}; + o2::framework::Configurable dphistarMaxPosDau{"dphistarMaxPosDau", 0.01f, "Maximium dphistar between positive daughters"}; + o2::framework::Configurable detaMaxNegDau{"detaMaxNegDau", 0.01f, "Maximum deta between negative daughters"}; + o2::framework::Configurable dphistarMaxNegDau{"dphistarMaxNegDau", 0.01f, "Maximum dphistar between negative daughters"}; + o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; + o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; +}; + +struct ConfCprTrrackCascade : o2::framework::ConfigurableGroup { + std::string prefix = std::string("ClosePairRejectionTrackCascade"); + o2::framework::Configurable onBachelor{"onBachelor", true, "Turn on CPR for track and bachelor"}; + o2::framework::Configurable onSameCharge{"onSameCharge", false, "Turn on CPR for track and same charge V0 daughter"}; + o2::framework::Configurable onOppositeCharge{"onOppositeCharge", false, "Turn on CPR for track and opposite charge V0 daughter"}; + o2::framework::Configurable plotAllRadii{"plotAllRadii", false, "Plot deta-dphi distribution at all radii"}; + o2::framework::Configurable plotAverage{"plotAverage", true, "Plot average deta dphi distribution"}; + o2::framework::Configurable detaMaxBachelor{"detaMaxBachelor", 0.01f, "Maximium deta between track and bachelor"}; + o2::framework::Configurable dphistarMaxBachelor{"dphistarMaxBachelor", 0.01f, "Maximium dphistar between track and bachelor"}; + o2::framework::Configurable detaMaxSameCharge{"detaMaxSameCharge", 0.01f, "Maximium deta between track and same charge daughter"}; + o2::framework::Configurable dphistarMaxSameCharge{"dphistarMaxSameCharge", 0.01f, "Maximium dphistar between track and same charge daughter"}; + o2::framework::Configurable detaMaxOppositeCharge{"detaMaxOppositeCharge", 0.01f, "Maximum deta between track and opposite charge daughter"}; + o2::framework::Configurable dphistarMaxOppositeCharge{"dphistarMaxOppositeCharge", 0.01f, "Maximum dphistar between track and opposite charge daughter"}; + o2::framework::ConfigurableAxis binningDeta{"binningDeta", {{500, -0.5, 0.5}}, "deta"}; + o2::framework::ConfigurableAxis binningDphistar{"binningDphistar", {{500, -0.5, 0.5}}, "dphi"}; + o2::framework::Configurable on{"on", true, "Turn on CPR"}; +}; + // tpc radii for computing phistar constexpr int kNradii = 9; constexpr std::array kTpcRadius = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; // in cm @@ -67,16 +115,18 @@ constexpr std::array kTpcRadius = {85., 105., 125., 145., 165., // directory names constexpr char PrefixTrackTrackSe[] = "CPR_TrackTrack/SE/"; constexpr char PrefixTrackTrackMe[] = "CPR_TrackTrack/ME/"; -constexpr char PrefixTrackV0Se[] = "CPR_TrackV0Daughter/SE/"; -constexpr char PrefixTrackV0Me[] = "CPR_TrackV0Daughter/ME/"; +constexpr char PrefixTrackV0SameChargeSe[] = "CPR_TrackV0DauSameCharge/SE/"; +constexpr char PrefixTrackV0SameChargeMe[] = "CPR_TrackV0DauSameCharge/ME/"; +constexpr char PrefixTrackV0OppositeChargeSe[] = "CPR_TrackV0DauOppositeCharge/SE/"; +constexpr char PrefixTrackV0OppositeChargeMe[] = "CPR_TrackV0DauOppositeCharge/ME/"; constexpr char PrefixV0V0PosSe[] = "CPR_V0V0_PosDau/SE/"; constexpr char PrefixV0V0NegSe[] = "CPR_V0V0_NegDau/SE/"; constexpr char PrefixV0V0PosMe[] = "CPR_V0V0_PosDau/ME/"; constexpr char PrefixV0V0NegMe[] = "CPR_V0V0_NegDau/ME/"; constexpr char PrefixTrackTwoTrackResonanceSe[] = "CPR_TrackResonanceDaughter/SE/"; constexpr char PrefixTrackTwoTrackResonnaceMe[] = "CPR_TrackResonanceDaughter/ME/"; -constexpr char PrefixTrackCascadeSe[] = "CPR_TrackCascadeBachelor/SE/"; -constexpr char PrefixTrackCascadeMe[] = "CPR_TrackCascadeBachelor/ME/"; +constexpr char PrefixTrackCascadeBachelorSe[] = "CPR_TrackCascadeBachelor/SE/"; +constexpr char PrefixTrackCascadeBachelorMe[] = "CPR_TrackCascadeBachelor/ME/"; constexpr char PrefixTrackKinkSe[] = "CPR_TrackKink/SE/"; constexpr char PrefixTrackKinkMe[] = "CPR_TrackKink/ME/"; @@ -115,34 +165,56 @@ class CloseTrackRejection { public: CloseTrackRejection() = default; - virtual ~CloseTrackRejection() = default; - - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int chargeAbsTrack1, int chargeAbsTrack2) + ~CloseTrackRejection() = default; + + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + bool plotAverage, + bool plotAllRadii, + float detaMax, + float dphistarMax, + int chargeAbsTrack1, + int chargeAbsTrack2) { mDetaMax = detaMax; mDphistarMax = dphistarMax; + // check the limits + if (mDetaMax <= 0 || mDphistarMax <= 0) { + LOG(warn) << "Close Pair Rejection configured with 0 or negative limits. Histograms will be filled, but no CPR cut will be applied!"; + mPlotOnly = true; + } else { + mPlotOnly = false; + } + mChargeAbsTrack1 = chargeAbsTrack1; mChargeAbsTrack2 = chargeAbsTrack2; mHistogramRegistry = registry; - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kAverage, HistTable), getHistDesc(kAverage, HistTable), getHistType(kAverage, HistTable), {specs.at(kAverage)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius0, HistTable), getHistDesc(kRadius0, HistTable), getHistType(kRadius0, HistTable), {specs.at(kRadius0)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius1, HistTable), getHistDesc(kRadius1, HistTable), getHistType(kRadius1, HistTable), {specs.at(kRadius1)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius2, HistTable), getHistDesc(kRadius2, HistTable), getHistType(kRadius2, HistTable), {specs.at(kRadius2)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius3, HistTable), getHistDesc(kRadius3, HistTable), getHistType(kRadius3, HistTable), {specs.at(kRadius3)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius4, HistTable), getHistDesc(kRadius4, HistTable), getHistType(kRadius4, HistTable), {specs.at(kRadius4)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius5, HistTable), getHistDesc(kRadius5, HistTable), getHistType(kRadius5, HistTable), {specs.at(kRadius5)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius6, HistTable), getHistDesc(kRadius6, HistTable), getHistType(kRadius6, HistTable), {specs.at(kRadius6)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius7, HistTable), getHistDesc(kRadius7, HistTable), getHistType(kRadius7, HistTable), {specs.at(kRadius7)}); - mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius8, HistTable), getHistDesc(kRadius8, HistTable), getHistType(kRadius8, HistTable), {specs.at(kRadius8)}); + mPlotAverage = plotAverage; + mPlotAllRadii = plotAllRadii; + + if (mPlotAverage) { + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kAverage, HistTable), getHistDesc(kAverage, HistTable), getHistType(kAverage, HistTable), {specs.at(kAverage)}); + } + if (mPlotAllRadii) { + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius0, HistTable), getHistDesc(kRadius0, HistTable), getHistType(kRadius0, HistTable), {specs.at(kRadius0)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius1, HistTable), getHistDesc(kRadius1, HistTable), getHistType(kRadius1, HistTable), {specs.at(kRadius1)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius2, HistTable), getHistDesc(kRadius2, HistTable), getHistType(kRadius2, HistTable), {specs.at(kRadius2)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius3, HistTable), getHistDesc(kRadius3, HistTable), getHistType(kRadius3, HistTable), {specs.at(kRadius3)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius4, HistTable), getHistDesc(kRadius4, HistTable), getHistType(kRadius4, HistTable), {specs.at(kRadius4)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius5, HistTable), getHistDesc(kRadius5, HistTable), getHistType(kRadius5, HistTable), {specs.at(kRadius5)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius6, HistTable), getHistDesc(kRadius6, HistTable), getHistType(kRadius6, HistTable), {specs.at(kRadius6)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius7, HistTable), getHistDesc(kRadius7, HistTable), getHistType(kRadius7, HistTable), {specs.at(kRadius7)}); + mHistogramRegistry->add(std::string(prefix) + getHistNameV2(kRadius8, HistTable), getHistDesc(kRadius8, HistTable), getHistType(kRadius8, HistTable), {specs.at(kRadius8)}); + } } void setMagField(float magField) { mMagField = magField; } template - void compute(const T1& track1, const T2& track2) + void compute(T1 const& track1, T2 const& track2) { // reset values mAverageDphistar = 0.f; @@ -165,47 +237,61 @@ class CloseTrackRejection void fill() { // fill average hist - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kAverage, HistTable)), mDeta, mAverageDphistar); + if (mPlotAverage) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kAverage, HistTable)), mDeta, mAverageDphistar); + } // fill radii hists - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius0, HistTable)), mDeta, mDphistar.at(0)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius1, HistTable)), mDeta, mDphistar.at(1)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius2, HistTable)), mDeta, mDphistar.at(2)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius3, HistTable)), mDeta, mDphistar.at(3)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius4, HistTable)), mDeta, mDphistar.at(4)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius5, HistTable)), mDeta, mDphistar.at(5)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius6, HistTable)), mDeta, mDphistar.at(6)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius7, HistTable)), mDeta, mDphistar.at(7)); - mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius8, HistTable)), mDeta, mDphistar.at(8)); + if (mPlotAllRadii) { + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius0, HistTable)), mDeta, mDphistar.at(0)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius1, HistTable)), mDeta, mDphistar.at(1)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius2, HistTable)), mDeta, mDphistar.at(2)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius3, HistTable)), mDeta, mDphistar.at(3)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius4, HistTable)), mDeta, mDphistar.at(4)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius5, HistTable)), mDeta, mDphistar.at(5)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius6, HistTable)), mDeta, mDphistar.at(6)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius7, HistTable)), mDeta, mDphistar.at(7)); + mHistogramRegistry->fill(HIST(prefix) + HIST(getHistName(kRadius8, HistTable)), mDeta, mDphistar.at(8)); + } } bool isClosePair() const { - return std::hypot(mAverageDphistar / mDphistarMax, mDeta / mDetaMax) < 1.f; + return !mPlotOnly && std::hypot(mAverageDphistar / mDphistarMax, mDeta / mDetaMax) < 1.f; } private: + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + bool mPlotAllRadii = false; + bool mPlotAverage = true; + int mChargeAbsTrack1 = 0; int mChargeAbsTrack2 = 0; float mMagField = 0.f; - float mAverageDphistar = 0.f; - float mDeta = 0.f; float mDetaMax = 0.f; float mDphistarMax = 0.f; + + float mAverageDphistar = 0.f; + float mDeta = 0.f; std::array mDphistar = {0.f}; - o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + bool mPlotOnly = true; }; template class ClosePairRejectionTrackTrack { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack1, int absChargeTrack2, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr, + int absChargeTrack1, + int absChargeTrack2) { - mIsActivated = isActivated; + mIsActivated = confCpr.on.value; if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack1, absChargeTrack2); + mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack1, absChargeTrack2); } } @@ -228,12 +314,15 @@ template class ClosePairRejectionV0V0 { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr) { - mIsActivated = isActivated; + mIsActivated = confCpr.on.value; if (mIsActivated) { - mCtrPos.init(registry, specs, detaMax, dphistarMax, 1, 1); - mCtrNeg.init(registry, specs, detaMax, dphistarMax, 1, 1); + mCtrPos.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxPosDau.value, confCpr.dphistarMaxPosDau.value, 1, 1); + mCtrNeg.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxNegDau.value, confCpr.dphistarMaxNegDau.value, 1, 1); } } @@ -245,25 +334,24 @@ class ClosePairRejectionV0V0 template void setPair(T1 const& v01, T2 const& v02, T3 const& tracks) { - // auto posDau1 = v01.template posDau_as(); - // auto negDau1 = v01.template posDau_as(); auto posDau1 = tracks.rawIteratorAt(v01.posDauId() - tracks.offset()); auto negDau1 = tracks.rawIteratorAt(v01.negDauId() - tracks.offset()); - // auto posDau2 = v02.template posDau_as(); - // auto negDau2 = v02.template posDau_as(); auto posDau2 = tracks.rawIteratorAt(v02.posDauId() - tracks.offset()); auto negDau2 = tracks.rawIteratorAt(v02.negDauId() - tracks.offset()); mCtrPos.compute(posDau1, posDau2); mCtrNeg.compute(negDau1, negDau2); } + bool isClosePair() const { return mCtrPos.isClosePair() && mCtrNeg.isClosePair(); } + void fill() { mCtrPos.fill(); mCtrNeg.fill(); } + bool isActivated() const { return mIsActivated; } private: @@ -272,97 +360,201 @@ class ClosePairRejectionV0V0 bool mIsActivated = true; }; -template +template class ClosePairRejectionTrackV0 // can also be used for any particle type that has pos/neg daughters, like resonances { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr, + int absChargeTrack) { - mIsActivated = isActivated; - // initialize CPR with charge of the track and the same charge for the daughter particle - // absolute charge of the daughter track will be 1, so we just pass 1 - if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack, 1); + mIsActivatedSameCharge = confCpr.onSameCharge.value; + if (mIsActivatedSameCharge) { + mCtrSameCharge.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxSameCharge.value, confCpr.dphistarMaxSameCharge.value, absChargeTrack, 1); } + + mIsActivatedOppositeCharge = confCpr.onOppositeCharge.value; + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxOppositeCharge.value, confCpr.dphistarMaxOppositeCharge.value, absChargeTrack, 1); + } + + mIsActivated = mIsActivatedSameCharge || mIsActivatedOppositeCharge; } void setMagField(float magField) { - mCtr.setMagField(magField); + if (mIsActivatedSameCharge) { + mCtrSameCharge.setMagField(magField); + } + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.setMagField(magField); + } } + template - void setPair(const T1& track, const T2& v0, const T3 trackTable) + void setPair(T1 const& track, T2 const& v0, T3 const& trackTable) { - if (track.signedPt() > 0) { - // auto daughter = v0.template posDau_as(); - auto daughter = trackTable.rawIteratorAt(v0.posDauId() - trackTable.offset()); - mCtr.compute(track, daughter); + auto posDau = trackTable.rawIteratorAt(v0.posDauId() - trackTable.offset()); + auto negDau = trackTable.rawIteratorAt(v0.negDauId() - trackTable.offset()); + if (track.sign() > 0) { + if (mIsActivatedSameCharge) { + mCtrSameCharge.compute(track, posDau); + } + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.compute(track, negDau); + } } else { - // auto daughter = v0.template negDau_as(); - auto daughter = trackTable.rawIteratorAt(v0.negDauId() - trackTable.offset()); - mCtr.compute(track, daughter); + if (mIsActivatedSameCharge) { + mCtrSameCharge.compute(track, negDau); + } + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.compute(track, posDau); + } } } - bool isClosePair() const { return mCtr.isClosePair(); } + bool isClosePair() const + { + bool cprSameCharge = mIsActivatedSameCharge && mCtrSameCharge.isClosePair(); + bool cprOppositeCharrge = mIsActivatedOppositeCharge && mCtrOppositeCharge.isClosePair(); + return cprSameCharge || cprOppositeCharrge; + } + void fill() { - mCtr.fill(); + if (mIsActivatedSameCharge) { + mCtrSameCharge.fill(); + } + if (mIsActivatedOppositeCharge) { + mCtrOppositeCharge.fill(); + } } bool isActivated() const { return mIsActivated; } private: - CloseTrackRejection mCtr; + CloseTrackRejection mCtrSameCharge; + CloseTrackRejection mCtrOppositeCharge; bool mIsActivated = true; + bool mIsActivatedSameCharge = true; + bool mIsActivatedOppositeCharge = false; }; -template +template class ClosePairRejectionTrackCascade { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr, + int absChargeTrack) { - mIsActivated = isActivated; - if (mIsActivated) { - // charge of cascade is always 1 - mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack, 1); + mIsActivatedBachelor = confCpr.onBachelor.value; + if (mIsActivatedBachelor) { + mCtrBachelor.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxBachelor.value, confCpr.dphistarMaxBachelor.value, absChargeTrack, 1); } + + mIsActivatedSameChargeV0Daughter = confCpr.onSameCharge.value; + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxSameCharge.value, confCpr.dphistarMaxSameCharge.value, absChargeTrack, 1); + } + + mIsActivatedOppositeChargeV0Daughter = confCpr.onOppositeCharge.value; + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMaxOppositeCharge.value, confCpr.dphistarMaxOppositeCharge.value, absChargeTrack, 1); + } + + mIsActivated = mIsActivatedBachelor || mIsActivatedSameChargeV0Daughter || mIsActivatedOppositeChargeV0Daughter; } void setMagField(float magField) { - mCtr.setMagField(magField); + if (mIsActivatedBachelor) { + mCtrBachelor.setMagField(magField); + } + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.setMagField(magField); + } + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.setMagField(magField); + } } template - void setPair(const T1& track, const T2& cascade, const T3 trackTable) + void setPair(T1 const& track, T2 const& cascade, T3 const& trackTable) { - // auto bachelor = cascade.template posDau_as(); auto bachelor = trackTable.rawIteratorAt(cascade.bachelorId() - trackTable.offset()); - mCtr.compute(track, bachelor); + auto posDau = trackTable.rawIteratorAt(cascade.posDauId() - trackTable.offset()); + auto negDau = trackTable.rawIteratorAt(cascade.negDauId() - trackTable.offset()); + + if (mIsActivatedBachelor) { + mCtrBachelor.compute(track, bachelor); + } + + if (track.sign() > 0) { + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.compute(track, posDau); + } + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.compute(track, negDau); + } + } else { + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.compute(track, negDau); + } + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.compute(track, posDau); + } + } + } + + bool isClosePair() const + { + bool cprBachelor = mIsActivatedBachelor && mCtrBachelor.isClosePair(); + bool cprSameCharge = mIsActivatedSameChargeV0Daughter && mCtrSameChargeV0Daughter.isClosePair(); + bool cprOppositeCharrge = mIsActivatedOppositeChargeV0Daughter && mCtrOppositeChargeV0Daughter.isClosePair(); + return cprBachelor || cprSameCharge || cprOppositeCharrge; } - bool isClosePair() const { return mCtr.isClosePair(); } void fill() { - mCtr.fill(); + if (mIsActivatedBachelor) { + mCtrBachelor.fill(); + } + if (mIsActivatedSameChargeV0Daughter) { + mCtrSameChargeV0Daughter.fill(); + } + if (mIsActivatedOppositeChargeV0Daughter) { + mCtrOppositeChargeV0Daughter.fill(); + } } + bool isActivated() const { return mIsActivated; } private: - CloseTrackRejection mCtr; + CloseTrackRejection mCtrBachelor; + CloseTrackRejection mCtrSameChargeV0Daughter; + CloseTrackRejection mCtrOppositeChargeV0Daughter; bool mIsActivated = true; + bool mIsActivatedBachelor = false; + bool mIsActivatedSameChargeV0Daughter = false; + bool mIsActivatedOppositeChargeV0Daughter = false; }; template class ClosePairRejectionTrackKink { public: - void init(o2::framework::HistogramRegistry* registry, std::map>& specs, float detaMax, float dphistarMax, int absChargeTrack, bool isActivated) + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& specs, + T const& confCpr, + int absChargeTrack) { - mIsActivated = isActivated; - // The charged daughter has absolute charge of 1, so we can pass 1 directly + mIsActivated = confCpr.on.value; if (mIsActivated) { - mCtr.init(registry, specs, detaMax, dphistarMax, absChargeTrack, 1); + mCtr.init(registry, specs, confCpr.plotAverage.value, confCpr.plotAllRadii.value, confCpr.detaMax.value, confCpr.dphistarMax.value, absChargeTrack, 1); } } @@ -372,9 +564,8 @@ class ClosePairRejectionTrackKink } template - void setPair(const T1& track, const T2& kink, const T3 trackTable) + void setPair(T1 const& track, T2 const& kink, T3 const& trackTable) { - // auto daughter = kink.template chaDau_as(); auto daughter = trackTable.rawIteratorAt(kink.chaDauId() - trackTable.offset()); mCtr.compute(track, daughter); } diff --git a/PWGCF/Femto/Core/collisionBuilder.h b/PWGCF/Femto/Core/collisionBuilder.h index 80791b52ebc..31bbcd10f68 100644 --- a/PWGCF/Femto/Core/collisionBuilder.h +++ b/PWGCF/Femto/Core/collisionBuilder.h @@ -166,7 +166,7 @@ class CollisionSelection : public BaseSelection void configure(T1 const& filter, T2 const& config) @@ -348,8 +348,8 @@ struct ConfCollisionTables : o2::framework::ConfigurableGroup { class CollisionBuilder { public: - CollisionBuilder() {} - virtual ~CollisionBuilder() = default; + CollisionBuilder() = default; + ~CollisionBuilder() = default; template void init(T1& confFilter, T2& confBits, T3& confRct, T4& confCcdb, T5& confTable, T6& initContext) @@ -505,7 +505,7 @@ class CollisionBuilderDerivedToDerived { public: CollisionBuilderDerivedToDerived() = default; - virtual ~CollisionBuilderDerivedToDerived() = default; + ~CollisionBuilderDerivedToDerived() = default; template void processCollision(T1& col, T2& newCollisionTable) diff --git a/PWGCF/Femto/Core/collisionHistManager.h b/PWGCF/Femto/Core/collisionHistManager.h index 38e261069fd..0cadaa6e380 100644 --- a/PWGCF/Femto/Core/collisionHistManager.h +++ b/PWGCF/Femto/Core/collisionHistManager.h @@ -115,6 +115,7 @@ struct ConfCollisionBinning : o2::framework::ConfigurableGroup { struct ConfCollisionQaBinning : o2::framework::ConfigurableGroup { std::string prefix = std::string("CollisionQaBinning"); + o2::framework::Configurable plot2d{"plot2d", true, "Enable 2d QA histograms"}; o2::framework::ConfigurableAxis vtx{"vtx", {120, 0.f, 12.f}, "Vertex position binning"}; o2::framework::ConfigurableAxis vtxXY{"vtxXY", {100, -1.f, 1.f}, "Vertex X/Y binning"}; o2::framework::ConfigurableAxis sphericity{"sphericity", {100, 0.f, 1.f}, "Spericity Binning"}; @@ -126,52 +127,89 @@ class CollisionHistManager { public: CollisionHistManager() = default; - virtual ~CollisionHistManager() = default; + ~CollisionHistManager() = default; /// Initializes histograms for the task /// \param registry Histogram registry to be passed - void init(o2::framework::HistogramRegistry* registry, std::map> Specs) + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs) { mHistogramRegistry = registry; if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(ColAnalysisDir); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPosZ, HistTable), getHistDesc(kPosZ, HistTable), getHistType(kPosZ, HistTable), {Specs[kPosZ]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMult, HistTable), getHistDesc(kMult, HistTable), getHistType(kMult, HistTable), {Specs[kMult]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kCent, HistTable), getHistDesc(kCent, HistTable), getHistType(kCent, HistTable), {Specs[kCent]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMagField, HistTable), getHistDesc(kMagField, HistTable), getHistType(kMagField, HistTable), {Specs[kMagField]}); + initAnalysis(Specs); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(ColQaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kPosX, HistTable), getHistDesc(kPosX, HistTable), getHistType(kPosX, HistTable), {Specs[kPosX]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPosY, HistTable), getHistDesc(kPosY, HistTable), getHistType(kPosY, HistTable), {Specs[kPosY]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPos, HistTable), getHistDesc(kPos, HistTable), getHistType(kPos, HistTable), {Specs[kPos]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kSphericity, HistTable), getHistDesc(kSphericity, HistTable), getHistType(kSphericity, HistTable), {Specs[kSphericity]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kOccupancy, HistTable), getHistDesc(kOccupancy, HistTable), getHistType(kOccupancy, HistTable), {Specs[kOccupancy]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsMult, HistTable), getHistDesc(kPoszVsMult, HistTable), getHistType(kPoszVsMult, HistTable), {Specs[kPoszVsMult]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsCent, HistTable), getHistDesc(kPoszVsCent, HistTable), getHistType(kPoszVsCent, HistTable), {Specs[kPoszVsCent]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsMult, HistTable), getHistDesc(kCentVsMult, HistTable), getHistType(kCentVsMult, HistTable), {Specs[kCentVsMult]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMultVsSphericity, HistTable), getHistDesc(kMultVsSphericity, HistTable), getHistType(kMultVsSphericity, HistTable), {Specs[kMultVsSphericity]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsSphericity, HistTable), getHistDesc(kCentVsSphericity, HistTable), getHistType(kCentVsSphericity, HistTable), {Specs[kCentVsSphericity]}); + initQa(Specs); } - } // namespace o2::analysis::femtounited + } + + template + void enableOptionalHistograms(T const& ConfBinningQa) + { + mPlot2d = ConfBinningQa.plot2d.value; + } + + template + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs, T const& ConfBinningQa) + { + enableOptionalHistograms(ConfBinningQa); + init(registry, Specs); + } template void fill(T const& col) { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kPosZ, HistTable)), col.posZ()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMult, HistTable)), col.mult()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kCent, HistTable)), col.cent()); - mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMagField, HistTable)), col.magField()); + fillAnalysis(col); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosX, HistTable)), col.posX()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosY, HistTable)), col.posY()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPos, HistTable)), std::hypot(col.posX(), col.posY(), col.posZ())); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kSphericity, HistTable)), col.sphericity()); - mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kOccupancy, HistTable)), col.trackOccupancyInTimeRange()); + fillQa(col); + } + } + + private: + void initAnalysis(std::map> const& Specs) + { + std::string analysisDir = std::string(ColAnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPosZ, HistTable), getHistDesc(kPosZ, HistTable), getHistType(kPosZ, HistTable), {Specs.at(kPosZ)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMult, HistTable), getHistDesc(kMult, HistTable), getHistType(kMult, HistTable), {Specs.at(kMult)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kCent, HistTable), getHistDesc(kCent, HistTable), getHistType(kCent, HistTable), {Specs.at(kCent)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMagField, HistTable), getHistDesc(kMagField, HistTable), getHistType(kMagField, HistTable), {Specs.at(kMagField)}); + } + + void initQa(std::map> const& Specs) + { + std::string qaDir = std::string(ColQaDir); + mHistogramRegistry->add(qaDir + getHistNameV2(kPosX, HistTable), getHistDesc(kPosX, HistTable), getHistType(kPosX, HistTable), {Specs.at(kPosX)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPosY, HistTable), getHistDesc(kPosY, HistTable), getHistType(kPosY, HistTable), {Specs.at(kPosY)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPos, HistTable), getHistDesc(kPos, HistTable), getHistType(kPos, HistTable), {Specs.at(kPos)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kSphericity, HistTable), getHistDesc(kSphericity, HistTable), getHistType(kSphericity, HistTable), {Specs.at(kSphericity)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kOccupancy, HistTable), getHistDesc(kOccupancy, HistTable), getHistType(kOccupancy, HistTable), {Specs.at(kOccupancy)}); + if (mPlot2d) { + mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsMult, HistTable), getHistDesc(kPoszVsMult, HistTable), getHistType(kPoszVsMult, HistTable), {Specs.at(kPoszVsMult)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPoszVsCent, HistTable), getHistDesc(kPoszVsCent, HistTable), getHistType(kPoszVsCent, HistTable), {Specs.at(kPoszVsCent)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsMult, HistTable), getHistDesc(kCentVsMult, HistTable), getHistType(kCentVsMult, HistTable), {Specs.at(kCentVsMult)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMultVsSphericity, HistTable), getHistDesc(kMultVsSphericity, HistTable), getHistType(kMultVsSphericity, HistTable), {Specs.at(kMultVsSphericity)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kCentVsSphericity, HistTable), getHistDesc(kCentVsSphericity, HistTable), getHistType(kCentVsSphericity, HistTable), {Specs.at(kCentVsSphericity)}); + } + } + + template + void fillAnalysis(T const& col) + { + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kPosZ, HistTable)), col.posZ()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMult, HistTable)), col.mult()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kCent, HistTable)), col.cent()); + mHistogramRegistry->fill(HIST(ColAnalysisDir) + HIST(getHistName(kMagField, HistTable)), col.magField()); + } + + template + void fillQa(T const& col) + { + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosX, HistTable)), col.posX()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPosY, HistTable)), col.posY()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPos, HistTable)), std::hypot(col.posX(), col.posY(), col.posZ())); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kSphericity, HistTable)), col.sphericity()); + mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kOccupancy, HistTable)), col.trackOccupancyInTimeRange()); + if (mPlot2d) { mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPoszVsMult, HistTable)), col.posZ(), col.mult()); mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kPoszVsCent, HistTable)), col.posZ(), col.cent()); mHistogramRegistry->fill(HIST(ColQaDir) + HIST(getHistName(kCentVsMult, HistTable)), col.cent(), col.mult()); @@ -180,8 +218,8 @@ class CollisionHistManager } } - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + bool mPlot2d = true; }; // namespace femtounitedcolhistmanager }; // namespace colhistmanager }; // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/dataTypes.h b/PWGCF/Femto/Core/dataTypes.h index 39ae9fc9ae8..0cb8c8758a5 100644 --- a/PWGCF/Femto/Core/dataTypes.h +++ b/PWGCF/Femto/Core/dataTypes.h @@ -29,7 +29,7 @@ using CollisionTagType = uint64_t; using CollisionMaskType = uint16_t; // datatypes for tracks -using MomentumType = uint16_t; +using MomentumType = uint8_t; using TrackMaskType = uint64_t; using TrackType = uint16_t; diff --git a/PWGCF/Femto/Core/kinkBuilder.h b/PWGCF/Femto/Core/kinkBuilder.h index 22514f77f20..c17d94ec89e 100644 --- a/PWGCF/Femto/Core/kinkBuilder.h +++ b/PWGCF/Femto/Core/kinkBuilder.h @@ -148,8 +148,8 @@ template class KinkSelection : public BaseSelection { public: - KinkSelection() {} - virtual ~KinkSelection() = default; + KinkSelection() = default; + ~KinkSelection() = default; template void configure(T1& config, T2& filter) @@ -304,8 +304,8 @@ template class KinkBuilder { public: - KinkBuilder() {} - virtual ~KinkBuilder() = default; + KinkBuilder() = default; + ~KinkBuilder() = default; template void init(T1& config, T2& filter, T3& table, T4& initContext) diff --git a/PWGCF/Femto/Core/kinkHistManager.h b/PWGCF/Femto/Core/kinkHistManager.h index bd82a5027d8..78b92b3b0d9 100644 --- a/PWGCF/Femto/Core/kinkHistManager.h +++ b/PWGCF/Femto/Core/kinkHistManager.h @@ -82,6 +82,7 @@ using ConfSigmaBinning1 = ConfSigmaBinning; template struct ConfKinkQaBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; + o2::framework::Configurable plot2d{"plot2d", true, "Enable 2d QA h histograms"}; o2::framework::ConfigurableAxis kinkAngle{"kinkAngle", {{100, 0, 3.15}}, "Kink Angle (rad)"}; o2::framework::ConfigurableAxis dcaMothToPV{"dcaMothToPV", {{150, 0, 1.5}}, "Mother DCA to PV (cm)"}; o2::framework::ConfigurableAxis dcaDaugToPV{"dcaDaugToPV", {{1000, 0, 100}}, "Daughter DCA to PV (cm)"}; @@ -167,99 +168,117 @@ class KinkHistManager { public: KinkHistManager() = default; - virtual ~KinkHistManager() = default; + ~KinkHistManager() = default; - /// Initializes histograms for the task - /// \param registry Histogram registry to be passed - /// void init(o2::framework::HistogramRegistry* registry, - std::map> KinkSpecs, - std::map> ChaDauSpecs) + std::map> const& KinkSpecs, + std::map> const& ChaDauSpecs) { mHistogramRegistry = registry; mChaDauManager.init(registry, ChaDauSpecs); - if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(kinkPrefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {KinkSpecs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {KinkSpecs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {KinkSpecs[kMass]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {KinkSpecs[kSign]}); + initAnalysis(KinkSpecs); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(kinkPrefix) + std::string(QaDir); + initQa(KinkSpecs); + } + } - // Basic kinematic histograms - mHistogramRegistry->add(qaDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {KinkSpecs[kPt]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {KinkSpecs[kEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {KinkSpecs[kPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {KinkSpecs[kMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {KinkSpecs[kSign]}); + template + void enableOptionalHistograms(T1 const& KinkConfBinningQa, T2 const& ChaDauConfBinningQa) + { + mChaDauManager.enableOptionalHistograms(ChaDauConfBinningQa); + mPlot2d = KinkConfBinningQa.plot2d.value; + } - // Kink-specific QA histograms - mHistogramRegistry->add(qaDir + getHistNameV2(kKinkAngle, HistTable), getHistDesc(kKinkAngle, HistTable), getHistType(kKinkAngle, HistTable), {KinkSpecs[kKinkAngle]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDcaMothToPV, HistTable), getHistDesc(kDcaMothToPV, HistTable), getHistType(kDcaMothToPV, HistTable), {KinkSpecs[kDcaMothToPV]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDcaDaugToPV, HistTable), getHistDesc(kDcaDaugToPV, HistTable), getHistType(kDcaDaugToPV, HistTable), {KinkSpecs[kDcaDaugToPV]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {KinkSpecs[kDecayVtxX]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {KinkSpecs[kDecayVtxY]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {KinkSpecs[kDecayVtxZ]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {KinkSpecs[kDecayVtx]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {KinkSpecs[kTransRadius]}); + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& KinkSpecs, + T1 const& KinkConfBinningQa, + std::map> const& ChaDauSpecs, + T2 const& ChaDauConfBinningQa) + { + enableOptionalHistograms(KinkConfBinningQa, ChaDauConfBinningQa); + init(registry, KinkSpecs, ChaDauSpecs); + } - // 2D QA histograms - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {KinkSpecs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {KinkSpecs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {KinkSpecs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsKinkAngle, HistTable), getHistDesc(kPtVsKinkAngle, HistTable), getHistType(kPtVsKinkAngle, HistTable), {KinkSpecs[kPtVsKinkAngle]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDecayRadius, HistTable), getHistDesc(kPtVsDecayRadius, HistTable), getHistType(kPtVsDecayRadius, HistTable), {KinkSpecs[kPtVsDecayRadius]}); + template + void fill(T1 const& kinkcandidate, T2 const& tracks) + { + // this used to work, still under investigation + // auto chaDaughter = kinkcandidate.template chaDau_as(); + auto chaDaughter = tracks.rawIteratorAt(kinkcandidate.chaDauId() - tracks.offset()); + mChaDauManager.fill(chaDaughter, tracks); + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { + fillAnalysis(kinkcandidate); + } + if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + fillQa(kinkcandidate); + } + } + + private: + void initAnalysis(std::map> const& KinkSpecs) + { + std::string analysisDir = std::string(kinkPrefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {KinkSpecs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {KinkSpecs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {KinkSpecs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {KinkSpecs.at(kMass)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {KinkSpecs.at(kSign)}); + } + + void initQa(std::map> const& KinkSpecs) + { + std::string qaDir = std::string(kinkPrefix) + std::string(QaDir); + // Kink-specific QA histograms + mHistogramRegistry->add(qaDir + getHistNameV2(kKinkAngle, HistTable), getHistDesc(kKinkAngle, HistTable), getHistType(kKinkAngle, HistTable), {KinkSpecs.at(kKinkAngle)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDcaMothToPV, HistTable), getHistDesc(kDcaMothToPV, HistTable), getHistType(kDcaMothToPV, HistTable), {KinkSpecs.at(kDcaMothToPV)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDcaDaugToPV, HistTable), getHistDesc(kDcaDaugToPV, HistTable), getHistType(kDcaDaugToPV, HistTable), {KinkSpecs.at(kDcaDaugToPV)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {KinkSpecs.at(kDecayVtxX)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {KinkSpecs.at(kDecayVtxY)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {KinkSpecs.at(kDecayVtxZ)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {KinkSpecs.at(kDecayVtx)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {KinkSpecs.at(kTransRadius)}); + if (mPlot2d) { + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {KinkSpecs.at(kPtVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {KinkSpecs.at(kPtVsPhi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {KinkSpecs.at(kPhiVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsKinkAngle, HistTable), getHistDesc(kPtVsKinkAngle, HistTable), getHistType(kPtVsKinkAngle, HistTable), {KinkSpecs.at(kPtVsKinkAngle)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDecayRadius, HistTable), getHistDesc(kPtVsDecayRadius, HistTable), getHistType(kPtVsDecayRadius, HistTable), {KinkSpecs.at(kPtVsDecayRadius)}); } } /// Fill histograms for kink candidates /// \param kinkcandidate Kink candidate to fill histograms for template - void fill(T const& kinkcandidate) + void fillAnalysis(T const& kinkcandidate) { - if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), kinkcandidate.pt()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), kinkcandidate.eta()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), kinkcandidate.phi()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), kinkcandidate.mass()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), kinkcandidate.pt()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), kinkcandidate.eta()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), kinkcandidate.phi()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), kinkcandidate.mass()); - if constexpr (isEqual(kink, modes::Kink::kSigma)) { - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), kinkcandidate.sign()); - } + if constexpr (isEqual(kink, modes::Kink::kSigma)) { + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), kinkcandidate.sign()); } + } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - // Basic kinematic histograms - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPt, HistTable)), kinkcandidate.pt()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kEta, HistTable)), kinkcandidate.eta()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPhi, HistTable)), kinkcandidate.phi()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kMass, HistTable)), kinkcandidate.mass()); - - if constexpr (isEqual(kink, modes::Kink::kSigma)) { - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kSign, HistTable)), kinkcandidate.sign()); - } - - // Kink-specific QA histograms - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kKinkAngle, HistTable)), kinkcandidate.kinkAngle()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaMothToPV, HistTable)), kinkcandidate.dcaMothToPV()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaDaugToPV, HistTable)), kinkcandidate.dcaDaugToPV()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), kinkcandidate.decayVtxX()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), kinkcandidate.decayVtxY()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), kinkcandidate.decayVtxZ()); - - // Calculate decay distance from PV - float decayDistance = std::sqrt(kinkcandidate.decayVtxX() * kinkcandidate.decayVtxX() + - kinkcandidate.decayVtxY() * kinkcandidate.decayVtxY() + - kinkcandidate.decayVtxZ() * kinkcandidate.decayVtxZ()); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), decayDistance); - mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), kinkcandidate.transRadius()); - - // 2D QA histograms + template + void fillQa(T const& kinkcandidate) + { + // Kink-specific QA histograms + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kKinkAngle, HistTable)), kinkcandidate.kinkAngle()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaMothToPV, HistTable)), kinkcandidate.dcaMothToPV()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDcaDaugToPV, HistTable)), kinkcandidate.dcaDaugToPV()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), kinkcandidate.decayVtxX()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), kinkcandidate.decayVtxY()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), kinkcandidate.decayVtxZ()); + // Calculate decay distance from PV + float decayDistance = std::hypot(kinkcandidate.decayVtxX(), kinkcandidate.decayVtxY(), kinkcandidate.decayVtxZ()); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), decayDistance); + mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), kinkcandidate.transRadius()); + if (mPlot2d) { mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), kinkcandidate.pt(), kinkcandidate.eta()); mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), kinkcandidate.pt(), kinkcandidate.phi()); mHistogramRegistry->fill(HIST(kinkPrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), kinkcandidate.phi(), kinkcandidate.eta()); @@ -268,22 +287,9 @@ class KinkHistManager } } - /// Fill histograms for kink candidates - overload with track table argument - /// \param kinkcandidate Kink candidate to fill histograms for - /// \param tracks Track table for daughter access - template - void fill(T1 const& kinkcandidate, T2 const& tracks) - { - // this used to work, still under investigation - // auto chaDaughter = kinkcandidate.template chaDau_as(); - auto chaDaughter = tracks.rawIteratorAt(kinkcandidate.chaDauId() - tracks.offset()); - mChaDauManager.fill(chaDaughter, tracks); - fill(kinkcandidate); - } - - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; trackhistmanager::TrackHistManager mChaDauManager; + bool mPlot2d = true; }; }; // namespace kinkhistmanager }; // namespace o2::analysis::femto diff --git a/PWGCF/Femto/Core/modes.h b/PWGCF/Femto/Core/modes.h index 752df384b7a..672ada08ba3 100644 --- a/PWGCF/Femto/Core/modes.h +++ b/PWGCF/Femto/Core/modes.h @@ -66,8 +66,9 @@ enum class System : uint32_t { }; enum class MomentumType : o2::aod::femtodatatypes::MomentumType { - kPAtPv, // momentum at primary vertex kPt, // transverse momentum + kPAtPv, // momentum at primary vertex + kPTpc, // momentum at inner wall of tpc }; enum class Track : o2::aod::femtodatatypes::TrackType { diff --git a/PWGCF/Femto/Core/pairBuilder.h b/PWGCF/Femto/Core/pairBuilder.h index 9ffd0f91465..1d788b5badd 100644 --- a/PWGCF/Femto/Core/pairBuilder.h +++ b/PWGCF/Femto/Core/pairBuilder.h @@ -67,47 +67,49 @@ class PairTrackTrackBuilder typename T6, typename T7, typename T8, - typename T9> + typename T9, + typename T10> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection1, - T2& confTrackSelection2, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec1, - std::map>& trackHistSpec2, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection1, + T2 const& confTrackSelection2, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map> const& colHistSpec, + std::map> const& trackHistSpec1, + std::map> const& trackHistSpec2, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { // check if correlate the same tracks or not mSameSpecies = confMixing.sameSpecies.value; mColHistManager.init(registry, colHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); if (mSameSpecies) { - mTrackHistManager1.init(registry, trackHistSpec1); + mTrackHistManager1.init(registry, trackHistSpec1, confTrackSelection1.chargeAbs.value); mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection1.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection1.chargeAbs.value, confTrackSelection1.chargeAbs.value); } else { - mTrackHistManager1.init(registry, trackHistSpec1); - mTrackHistManager2.init(registry, trackHistSpec2); + mTrackHistManager1.init(registry, trackHistSpec1, confTrackSelection1.chargeAbs.value); + mTrackHistManager2.init(registry, trackHistSpec2, confTrackSelection2.chargeAbs.value); mPairHistManagerSe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); mPairHistManagerMe.setMass(confTrackSelection1.pdgCode.value, confTrackSelection2.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection1.chargeAbs.value, confTrackSelection2.chargeAbs.value); } // setup mixing @@ -137,7 +139,7 @@ class PairTrackTrackBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice1, trackTable, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); + pairprocesshelpers::processSameEvent(trackSlice1, trackTable, col, mTrackHistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); } else { auto trackSlice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); auto trackSlice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); @@ -146,7 +148,7 @@ class PairTrackTrackBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice1, trackSlice2, trackTable, mTrackHistManager1, mTrackHistManager2, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice1, trackSlice2, trackTable, col, mTrackHistManager1, mTrackHistManager2, mPairHistManagerSe, mCprSe, mPc); } } @@ -233,49 +235,51 @@ class PairV0V0Builder typename T8, typename T9, typename T10, + typename T12, typename T11> void init(o2::framework::HistogramRegistry* registry, - T1& confV0Selection1, - T2& confV0Selection2, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& V0HistSpec1, - std::map>& V0HistSpec2, - std::map>& PosDauHistSpec, - std::map>& NegDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confV0Selection1, + T2 const& confV0Selection2, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map>& colHistSpec, + std::map>& V0HistSpec1, + std::map>& V0HistSpec2, + std::map>& PosDauHistSpec, + std::map>& NegDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) { // check if correlate the same tracks or not mSameSpecies = confMixing.sameSpecies.value; mColHistManager.init(registry, colHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); if (mSameSpecies) { mV0HistManager1.init(registry, V0HistSpec1, PosDauHistSpec, NegDauHistSpec); mPairHistManagerSe.setMass(confV0Selection1.pdgCode.value, confV0Selection1.pdgCode.value); mPairHistManagerSe.setCharge(1, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr); mPairHistManagerMe.setMass(confV0Selection1.pdgCode.value, confV0Selection1.pdgCode.value); mPairHistManagerMe.setCharge(1, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr); } else { mV0HistManager1.init(registry, V0HistSpec1, PosDauHistSpec, NegDauHistSpec); mV0HistManager2.init(registry, V0HistSpec2, PosDauHistSpec, NegDauHistSpec); mPairHistManagerSe.setMass(confV0Selection1.pdgCode.value, confV0Selection2.pdgCode.value); mPairHistManagerSe.setCharge(1, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr); mPairHistManagerMe.setMass(confV0Selection1.pdgCode.value, confV0Selection2.pdgCode.value); mPairHistManagerMe.setCharge(1, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr); } // setup mixing @@ -305,7 +309,7 @@ class PairV0V0Builder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(v0Slice1, trackTable, mV0HistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); + pairprocesshelpers::processSameEvent(v0Slice1, trackTable, col, mV0HistManager1, mPairHistManagerSe, mCprSe, mRng, mMixIdenticalParticles); } else { auto v0Slice1 = partition1->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); auto v0Slice2 = partition2->sliceByCached(o2::aod::femtobase::stored::fColId, col.globalIndex(), cache); @@ -314,7 +318,7 @@ class PairV0V0Builder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(v0Slice1, v0Slice2, trackTable, mV0HistManager1, mV0HistManager2, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(v0Slice1, v0Slice2, trackTable, col, mV0HistManager1, mV0HistManager2, mPairHistManagerSe, mCprSe, mPc); } } @@ -376,8 +380,10 @@ template < const char* prefixNegDau, const char* prefixSe, const char* prefixMe, - const char* prefixCprSe, - const char* prefixCprMe, + const char* prefixCprSameChargeSe, + const char* prefixCprSameChargeMe, + const char* prefixCprOppositeChargeSe, + const char* prefixCprOppositeChargeMe, modes::Mode mode, modes::V0 v0Type> class PairTrackV0Builder @@ -396,34 +402,36 @@ class PairTrackV0Builder typename T8, typename T9, typename T10, - typename T11> + typename T11, + typename T12> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection, - T2& confV0Selection, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& v0HistSpec, - std::map>& posDauHistSpec, - std::map>& negDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection, + T2 const& confV0Selection, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map>& colHistSpec, + std::map>& trackHistSpec, + std::map>& v0HistSpec, + std::map>& posDauHistSpec, + std::map>& negDauHistSpec, + std::map>& pairHistSpec, + std::map>& cprHistSpec) { mColHistManager.init(registry, colHistSpec); - mTrackHistManager.init(registry, trackHistSpec); + mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mV0HistManager.init(registry, v0HistSpec, posDauHistSpec, negDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confV0Selection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -440,7 +448,7 @@ class PairTrackV0Builder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mTrackHistManager, mV0HistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, col, mTrackHistManager, mV0HistManager, mPairHistManagerSe, mCprSe, mPc); } template @@ -467,8 +475,8 @@ class PairTrackV0Builder v0histmanager::V0HistManager mV0HistManager; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; - closepairrejection::ClosePairRejectionTrackV0 mCprSe; - closepairrejection::ClosePairRejectionTrackV0 mCprMe; + closepairrejection::ClosePairRejectionTrackV0 mCprSe; + closepairrejection::ClosePairRejectionTrackV0 mCprMe; paircleaner::TrackV0PairCleaner mPc; pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; int mMixingDepth = 5; @@ -481,8 +489,10 @@ template < const char* prefixNegDau, const char* prefixSe, const char* prefixMe, - const char* prefixCprSe, - const char* prefixCprMe, + const char* prefixCprSameChargeSe, + const char* prefixCprSameChargeMe, + const char* prefixCprOppositeChargeSe, + const char* prefixCprOppositeChargeMe, modes::Mode mode, modes::TwoTrackResonance resonanceType> class PairTrackTwoTrackResonanceBuilder @@ -501,34 +511,36 @@ class PairTrackTwoTrackResonanceBuilder typename T8, typename T9, typename T10, - typename T11> + typename T11, + typename T12> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection, - T2& confResonanceSelection, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& resonanceHistSpec, - std::map>& posDauHistSpec, - std::map>& negDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection, + T2 const& confResonanceSelection, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& resonanceHistSpec, + std::map> const& posDauHistSpec, + std::map> const& negDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.init(registry, colHistSpec); - mTrackHistManager.init(registry, trackHistSpec); + mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mResonanceHistManager.init(registry, resonanceHistSpec, posDauHistSpec, negDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confResonanceSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -545,7 +557,7 @@ class PairTrackTwoTrackResonanceBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mTrackHistManager, mResonanceHistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, col, mTrackHistManager, mResonanceHistManager, mPairHistManagerSe, mCprSe, mPc); } template @@ -572,9 +584,9 @@ class PairTrackTwoTrackResonanceBuilder twotrackresonancehistmanager::TwoTrackResonanceHistManager mResonanceHistManager; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; - closepairrejection::ClosePairRejectionTrackV0 mCprSe; // cpr for twotrackresonances and v0 work the same way - closepairrejection::ClosePairRejectionTrackV0 mCprMe; // cpr for twotrackresonances and v0 work the same way - paircleaner::TrackV0PairCleaner mPc; // pc for twotrackresonances and v0 work the same way + closepairrejection::ClosePairRejectionTrackV0 mCprSe; // cpr for twotrackresonances and v0 work the same way + closepairrejection::ClosePairRejectionTrackV0 mCprMe; // cpr for twotrackresonances and v0 work the same way + paircleaner::TrackV0PairCleaner mPc; // pc for twotrackresonances and v0 work the same way pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; int mMixingDepth = 5; }; @@ -604,33 +616,35 @@ class PairTrackKinkBuilder typename T7, typename T8, typename T9, - typename T10> + typename T10, + typename T11> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection, - T2& confKinkSelection, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& kinkHistSpec, - std::map>& chaDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection, + T2 const& confKinkSelection, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& kinkHistSpec, + std::map> const& chaDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.init(registry, colHistSpec); - mTrackHistManager.init(registry, trackHistSpec); + mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mKinkHistManager.init(registry, kinkHistSpec, chaDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); // abs charge of kink daughter is always 1 - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confKinkSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); // abs charge of kink daughter is always 1 - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -647,7 +661,7 @@ class PairTrackKinkBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, kinkSlice, trackTable, mTrackHistManager, mKinkHistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, kinkSlice, trackTable, col, mTrackHistManager, mKinkHistManager, mPairHistManagerSe, mCprSe, mPc); } template @@ -689,8 +703,12 @@ template < const char* prefixNegDau, const char* prefixSe, const char* prefixMe, - const char* prefixCprSe, - const char* prefixCprMe, + const char* prefixCprBachelorSe, + const char* prefixCprSameChargeSe, + const char* prefixCprOppositeChargeSe, + const char* prefixCprBachelorMe, + const char* prefixCprSameChargeMe, + const char* prefixCprOppositeChargeMe, modes::Mode mode, modes::Cascade cascadeType> class PairTrackCascadeBuilder @@ -710,35 +728,37 @@ class PairTrackCascadeBuilder typename T9, typename T10, typename T11, - typename T12> + typename T12, + typename T13> void init(o2::framework::HistogramRegistry* registry, - T1& confTrackSelection, - T2& confCascadeSelection, - T3& confCpr, - T4& confMixing, - std::map>& colHistSpec, - std::map>& trackHistSpec, - std::map>& cascadeHistSpec, - std::map>& bachelorHistSpec, - std::map>& posDauHistSpec, - std::map>& negDauHistSpec, - std::map>& pairHistSpec, - std::map>& cprHistSpec) + T1 const& confTrackSelection, + T2 const& confCascadeSelection, + T3 const& confCpr, + T4 const& confMixing, + T5 const& confPairBinning, + std::map> const& colHistSpec, + std::map> const& trackHistSpec, + std::map> const& cascadeHistSpec, + std::map> const& bachelorHistSpec, + std::map> const& posDauHistSpec, + std::map> const& negDauHistSpec, + std::map> const& pairHistSpec, + std::map> const& cprHistSpec) { mColHistManager.init(registry, colHistSpec); - mTrackHistManager.init(registry, trackHistSpec); + mTrackHistManager.init(registry, trackHistSpec, confTrackSelection.chargeAbs.value); mCascadeHistManager.init(registry, cascadeHistSpec, bachelorHistSpec, posDauHistSpec, negDauHistSpec); - mPairHistManagerSe.init(registry, pairHistSpec); + mPairHistManagerSe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerSe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); mPairHistManagerSe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprSe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprSe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); - mPairHistManagerMe.init(registry, pairHistSpec); + mPairHistManagerMe.init(registry, pairHistSpec, confPairBinning); mPairHistManagerMe.setMass(confTrackSelection.pdgCode.value, confCascadeSelection.pdgCode.value); mPairHistManagerMe.setCharge(confTrackSelection.chargeAbs.value, 1); - mCprMe.init(registry, cprHistSpec, confCpr.detaMax.value, confCpr.dphistarMax.value, confTrackSelection.chargeAbs.value, confCpr.on.value); + mCprMe.init(registry, cprHistSpec, confCpr, confTrackSelection.chargeAbs.value); // setup mixing mMixingPolicy = static_cast(confMixing.policy.value); @@ -755,7 +775,7 @@ class PairTrackCascadeBuilder } mColHistManager.fill(col); mCprSe.setMagField(col.magField()); - pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, mTrackHistManager, mCascadeHistManager, mPairHistManagerSe, mCprSe, mPc); + pairprocesshelpers::processSameEvent(trackSlice, v0Slice, trackTable, col, mTrackHistManager, mCascadeHistManager, mPairHistManagerSe, mCprSe, mPc); } template @@ -782,8 +802,8 @@ class PairTrackCascadeBuilder cascadehistmanager::CascadeHistManager mCascadeHistManager; pairhistmanager::PairHistManager mPairHistManagerSe; pairhistmanager::PairHistManager mPairHistManagerMe; - closepairrejection::ClosePairRejectionTrackCascade mCprSe; - closepairrejection::ClosePairRejectionTrackCascade mCprMe; + closepairrejection::ClosePairRejectionTrackCascade mCprSe; + closepairrejection::ClosePairRejectionTrackCascade mCprMe; paircleaner::TrackCascadePairCleaner mPc; pairhistmanager::MixingPoliciy mMixingPolicy = pairhistmanager::MixingPoliciy::kVtxMult; int mMixingDepth = 5; diff --git a/PWGCF/Femto/Core/pairHistManager.h b/PWGCF/Femto/Core/pairHistManager.h index 6b296d0af9e..16077c7a2ea 100644 --- a/PWGCF/Femto/Core/pairHistManager.h +++ b/PWGCF/Femto/Core/pairHistManager.h @@ -52,8 +52,18 @@ enum PairHist { kPt2VsKt, kPt1VsMt, kPt2VsMt, + kKstarVsKt, + kKstarVsMt, + kKstarVsMult, + kKstarVsCent, + + // higher dimensions + kKstarVsMtVsMult, + kKstarVsMtVsMultVsCent, + kKstarVsMtVsPt1VsP2VsMult, + kKstarVsMtVsPt1VsP2VsMultVsCent, + kPairHistogramLast - // more dimensions }; enum MixingPoliciy { @@ -77,23 +87,46 @@ struct ConfMixing : o2::framework::ConfigurableGroup { struct ConfPairBinning : o2::framework::ConfigurableGroup { std::string prefix = std::string("PairBinning"); + o2::framework::Configurable plot1D{"plot1D", true, "Enable 1D histograms"}; + o2::framework::Configurable plot2D{"plot2D", true, "Enable 2D histograms"}; + o2::framework::Configurable plotKstarVsMtVsMult{"plotKstarVsMtVsMult", false, "Enable 3D histogram (Kstar Vs Mt Vs Mult)"}; + o2::framework::Configurable plotKstarVsMtVsMultVsCent{"plotKstarVsMtVsMultVsCent", false, "Enable 4D histogram (Kstar Vs Mt Vs Mult Vs Cent)"}; + o2::framework::Configurable plotKstarVsMtVsPt1VsP2VsMult{"plotKstarVsMtVsPt1VsP2VsMult", false, "Enable 5D histogram (Kstar Vs Mt Vs Pt1 Vs Pt2 Vs Mult)"}; + o2::framework::Configurable plotKstarVsMtVsPt1VsP2VsMultVsCent{"plotKstarVsMtVsPt1VsP2VsMultVsCent", false, "Enable 6D histogram (Kstar Vs Mt Vs Pt1 Vs Pt2 Vs Mult Vs Cent)"}; o2::framework::ConfigurableAxis kstar{"kstar", {{600, 0, 6}}, "kstar"}; o2::framework::ConfigurableAxis kt{"kt", {{600, 0, 6}}, "kt"}; o2::framework::ConfigurableAxis mt{"mt", {{500, 0.8, 5.8}}, "mt"}; + o2::framework::ConfigurableAxis multiplicity{"multiplicity", {{50, 0, 200}}, "multiplicity"}; + o2::framework::ConfigurableAxis centrality{"centrality", {{10, 0, 100}}, "centrality (mult. percentile)"}; }; // the enum gives the correct index in the array constexpr std::array, kPairHistogramLast> HistTable = { - {{kKstar, o2::framework::kTH1F, "hKstar", "k*; k* (GeV/#it{c}); Entries"}, - {kKt, o2::framework::kTH1F, "hKt", "transverse momentum; k_{T} (GeV/#it{c}); Entries"}, - {kMt, o2::framework::kTH1F, "hMt", "transverse mass; m_{T} (GeV/#it{c}^{2}); Entries"}, - {kPt1VsPt2, o2::framework::kTH2F, "hPt1VsPt2", "track1 p_{T} vs track2 p_{T}; track1 p_T (GeV/#it{c}); track2 p_{T} (GeV/#it{c})"}, - {kPt1VsKstar, o2::framework::kTH2F, "hPt1VsKstar", "p_{T,1} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, - {kPt2VsKstar, o2::framework::kTH2F, "hPt2VsKstar", "p_{T,2} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, - {kPt1VsKt, o2::framework::kTH2F, "hPt1VsKt", "p_{T,1} vs k_{T}; p_{T,1} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, - {kPt2VsKt, o2::framework::kTH2F, "hPt2VsKt", "p_{T,2} vs k_{T}; p_{T,2} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, - {kPt1VsMt, o2::framework::kTH2F, "hPt1VsMt", "p_{T,1} vs m_{T}; p_{T,1} (GeV/#it{c}); m_{T} (GeV/#it{c})"}, - {kPt2VsMt, o2::framework::kTH2F, "hPt2VsMt", "p_{T,2} vs m_{T}; p_{T,2} (GeV/#it{c}); m_{T} (GeV/#it{c})"}}}; + { + // 1D + {kKstar, o2::framework::kTH1F, "hKstar", "k*; k* (GeV/#it{c}); Entries"}, + {kKt, o2::framework::kTH1F, "hKt", "transverse momentum; k_{T} (GeV/#it{c}); Entries"}, + {kMt, o2::framework::kTH1F, "hMt", "transverse mass; m_{T} (GeV/#it{c}^{2}); Entries"}, + // 2D + {kPt1VsPt2, o2::framework::kTH2F, "hPt1VsPt2", "track1 p_{T} vs track2 p_{T}; track1 p_T (GeV/#it{c}); track2 p_{T} (GeV/#it{c})"}, + {kPt1VsKstar, o2::framework::kTH2F, "hPt1VsKstar", "p_{T,1} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, + {kPt2VsKstar, o2::framework::kTH2F, "hPt2VsKstar", "p_{T,2} vs k*; p_{T,2} (GeV/#it{c}); k* (GeV/#it{c})"}, + {kPt1VsKt, o2::framework::kTH2F, "hPt1VsKt", "p_{T,1} vs k_{T}; p_{T,1} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kPt2VsKt, o2::framework::kTH2F, "hPt2VsKt", "p_{T,2} vs k_{T}; p_{T,2} (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kPt1VsMt, o2::framework::kTH2F, "hPt1VsMt", "p_{T,1} vs m_{T}; p_{T,1} (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, + {kPt2VsMt, o2::framework::kTH2F, "hPt2VsMt", "p_{T,2} vs m_{T}; p_{T,2} (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, + {kKstarVsKt, o2::framework::kTH2F, "hKstarVsKt", "k* vs k_{T}; k* (GeV/#it{c}); k_{T} (GeV/#it{c})"}, + {kKstarVsMt, o2::framework::kTH2F, "hKstarVsMt", "k* vs m_{T}; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2})"}, + {kKstarVsCent, o2::framework::kTH2F, "hKstarVsCent", "k* vs Centrality (Mult. Percentile); k* (GeV/#it{c}); Centrality (%)"}, + {kKstarVsMult, o2::framework::kTH2F, "hKstarVsMult", "k* vs Multiplicity; k* (GeV/#it{c}); Multiplicity"}, + + // n-D + {kKstarVsMtVsMult, o2::framework::kTHnSparseF, "hKstarVsMtVsMult", "k* vs m_{T} vs multiplicity; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); Multiplicity"}, + {kKstarVsMtVsMultVsCent, o2::framework::kTHnSparseF, "hKstarVsMtVsMultVsCent", "k* vs m_{T} vs multiplicity vs centrality; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); Multiplicity; Centrality (%)"}, + {kKstarVsMtVsPt1VsP2VsMult, o2::framework::kTHnSparseF, "hKstarVsMtVsPt1VsPt2VsMult", "k* vs m_{T} vs p_{T,1} vs p_{T,2} vs multiplicity; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); p_{T,1} (GeV/#it{c}); p_{T,2} (GeV/#it{c}); Multiplicity"}, + {kKstarVsMtVsPt1VsP2VsMultVsCent, o2::framework::kTHnSparseF, "hKstarVsMtVsPt1VsPt2VsMultVsCent", "k* vs m_{T} vs p_{T,1} vs p_{T,2} vs multiplicity vs centrality; k* (GeV/#it{c}); m_{T} (GeV/#it{c}^{2}); p_{T,1} (GeV/#it{c}); p_{T,2} (GeV/#it{c}); Multiplicity; Centrality"}, + + }}; template auto makePairHistSpecMap(const T1& confPairBinning, const T2& confObject1Binning, const T3& confObject2Binning) @@ -108,7 +141,17 @@ auto makePairHistSpecMap(const T1& confPairBinning, const T2& confObject1Binning {kPt1VsKt, {confObject1Binning.pt, confPairBinning.kt}}, {kPt2VsKt, {confObject2Binning.pt, confPairBinning.kt}}, {kPt1VsMt, {confObject1Binning.pt, confPairBinning.mt}}, - {kPt2VsMt, {confObject2Binning.pt, confPairBinning.mt}}}; + {kPt2VsMt, {confObject2Binning.pt, confPairBinning.mt}}, + {kKstarVsKt, {confPairBinning.kstar, confPairBinning.kt}}, + {kKstarVsMt, {confPairBinning.kstar, confPairBinning.mt}}, + {kKstarVsMult, {confPairBinning.kstar, confPairBinning.multiplicity}}, + {kKstarVsCent, {confPairBinning.kstar, confPairBinning.centrality}}, + + {kKstarVsMtVsMult, {confPairBinning.kstar, confPairBinning.mt, confPairBinning.multiplicity}}, + {kKstarVsMtVsMultVsCent, {confPairBinning.kstar, confPairBinning.mt, confPairBinning.multiplicity, confPairBinning.centrality}}, + {kKstarVsMtVsPt1VsP2VsMult, {confPairBinning.kstar, confPairBinning.mt, confObject1Binning.pt, confObject2Binning.pt, confPairBinning.multiplicity}}, + {kKstarVsMtVsPt1VsP2VsMultVsCent, {confPairBinning.kstar, confPairBinning.mt, confObject1Binning.pt, confObject2Binning.pt, confPairBinning.multiplicity, confPairBinning.centrality}}, + }; }; constexpr char PrefixTrackTrackSe[] = "TrackTrack/SE/"; @@ -139,24 +182,55 @@ template class PairHistManager { public: - /// Destructor - virtual ~PairHistManager() = default; - void init(o2::framework::HistogramRegistry* registry, std::map> Specs) + PairHistManager() = default; + ~PairHistManager() = default; + + template + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs, T const& ConfPairBinning) { mHistogramRegistry = registry; + mPlot1d = ConfPairBinning.plot1D.value; + mPlot2d = ConfPairBinning.plot2D.value; + mPlotKstarVsMtVsMult = ConfPairBinning.plotKstarVsMtVsMult.value; + mPlotKstarVsMtVsMultVsCent = ConfPairBinning.plotKstarVsMtVsMultVsCent.value; + mPlotKstarVsMtVsPt1VsP2VsMult = ConfPairBinning.plotKstarVsMtVsPt1VsP2VsMult.value; + mPlotKstarVsMtVsPt1VsP2VsMultVsCent = ConfPairBinning.plotKstarVsMtVsPt1VsP2VsMultVsCent.value; + if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); - - mHistogramRegistry->add(analysisDir + getHistNameV2(kKstar, HistTable), getHistDesc(kKstar, HistTable), getHistType(kKstar, HistTable), {Specs[kKstar]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMt, HistTable), getHistDesc(kMt, HistTable), getHistType(kMt, HistTable), {Specs[kMt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsPt2, HistTable), getHistDesc(kPt1VsPt2, HistTable), getHistType(kPt1VsPt2, HistTable), {Specs[kPt1VsPt2]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKstar, HistTable), getHistDesc(kPt1VsKstar, HistTable), getHistType(kPt1VsKstar, HistTable), {Specs[kPt1VsKstar]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKstar, HistTable), getHistDesc(kPt2VsKstar, HistTable), getHistType(kPt2VsKstar, HistTable), {Specs[kPt2VsKstar]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKt, HistTable), getHistDesc(kPt1VsKt, HistTable), getHistType(kPt1VsKt, HistTable), {Specs[kPt1VsKt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKt, HistTable), getHistDesc(kPt2VsKt, HistTable), getHistType(kPt2VsKt, HistTable), {Specs[kPt2VsKt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsMt, HistTable), getHistDesc(kPt1VsMt, HistTable), getHistType(kPt1VsMt, HistTable), {Specs[kPt1VsMt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsMt, HistTable), getHistDesc(kPt2VsMt, HistTable), getHistType(kPt2VsMt, HistTable), {Specs[kPt2VsMt]}); + if (mPlot1d) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstar, HistTable), getHistDesc(kKstar, HistTable), getHistType(kKstar, HistTable), {Specs.at(kKstar)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKt, HistTable), getHistDesc(kKt, HistTable), getHistType(kKt, HistTable), {Specs.at(kKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMt, HistTable), getHistDesc(kMt, HistTable), getHistType(kMt, HistTable), {Specs.at(kMt)}); + } + if (mPlot2d) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsPt2, HistTable), getHistDesc(kPt1VsPt2, HistTable), getHistType(kPt1VsPt2, HistTable), {Specs.at(kPt1VsPt2)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKstar, HistTable), getHistDesc(kPt1VsKstar, HistTable), getHistType(kPt1VsKstar, HistTable), {Specs.at(kPt1VsKstar)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKstar, HistTable), getHistDesc(kPt2VsKstar, HistTable), getHistType(kPt2VsKstar, HistTable), {Specs.at(kPt2VsKstar)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsKt, HistTable), getHistDesc(kPt1VsKt, HistTable), getHistType(kPt1VsKt, HistTable), {Specs.at(kPt1VsKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsKt, HistTable), getHistDesc(kPt2VsKt, HistTable), getHistType(kPt2VsKt, HistTable), {Specs.at(kPt2VsKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt1VsMt, HistTable), getHistDesc(kPt1VsMt, HistTable), getHistType(kPt1VsMt, HistTable), {Specs.at(kPt1VsMt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt2VsMt, HistTable), getHistDesc(kPt2VsMt, HistTable), getHistType(kPt2VsMt, HistTable), {Specs.at(kPt2VsMt)}); + + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsKt, HistTable), getHistDesc(kKstarVsKt, HistTable), getHistType(kKstarVsKt, HistTable), {Specs.at(kKstarVsKt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMt, HistTable), getHistDesc(kKstarVsMt, HistTable), getHistType(kKstarVsMt, HistTable), {Specs.at(kKstarVsMt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMult, HistTable), getHistDesc(kKstarVsMult, HistTable), getHistType(kKstarVsMult, HistTable), {Specs.at(kKstarVsMult)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsCent, HistTable), getHistDesc(kKstarVsCent, HistTable), getHistType(kKstarVsCent, HistTable), {Specs.at(kKstarVsCent)}); + } + + if (mPlotKstarVsMtVsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsMult, HistTable), getHistDesc(kKstarVsMtVsMult, HistTable), getHistType(kKstarVsMtVsMult, HistTable), {Specs.at(kKstarVsMtVsMult)}); + } + if (mPlotKstarVsMtVsMultVsCent) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsMultVsCent, HistTable), getHistType(kKstarVsMtVsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsMultVsCent)}); + } + if (mPlotKstarVsMtVsPt1VsP2VsMult) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsP2VsMult, HistTable), getHistDesc(kKstarVsMtVsPt1VsP2VsMult, HistTable), getHistType(kKstarVsMtVsPt1VsP2VsMult, HistTable), {Specs.at(kKstarVsMtVsPt1VsP2VsMult)}); + } + if (mPlotKstarVsMtVsPt1VsP2VsMultVsCent) { + mHistogramRegistry->add(analysisDir + getHistNameV2(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable), getHistDesc(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable), getHistType(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable), {Specs.at(kKstarVsMtVsPt1VsP2VsMultVsCent)}); + } } // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { @@ -177,10 +251,14 @@ class PairHistManager mAbsCharge2 = std::abs(chargeAbsParticle2); } - template - void setPair(const T1& particle1, const T2& particle2) + template + void setPair(const T1& particle1, const T2& particle2, const T3& col) { - // pt in track stable is stored from 1/signedPt from the original track table + // set collision properties + mMult = col.mult(); + mCent = col.cent(); + + // pt in track table is calculated from 1/signedPt from the original track table // in case of He with Z=2, we have to rescale the pt with the absolute charge mParticle1 = ROOT::Math::PtEtaPhiMVector{mAbsCharge1 * particle1.pt(), particle1.eta(), particle1.phi(), mMass1}; mParticle2 = ROOT::Math::PtEtaPhiMVector{mAbsCharge2 * particle2.pt(), particle2.eta(), particle2.phi(), mMass2}; @@ -193,24 +271,48 @@ class PairHistManager float averageMass = (mMass1 + mMass2) / 2.f; mMt = std::hypot(mKt, averageMass); - // Boost Track1 to the pair rest frame and calculate k* - auto track1 = ROOT::Math::PxPyPzEVector(mParticle1); + // Boost particle to the pair rest frame (Prf) and calculate k* (would be equivalent using particle 2) + // make a copy of particle 1 + auto particle1Prf = ROOT::Math::PtEtaPhiMVector(mParticle1); + // get lorentz boost into pair rest frame ROOT::Math::Boost boostPrf(partSum.BoostToCM()); - mKstar = boostPrf(track1).P(); + // boost particle 1 into pair rest frame and calculate its momentum, which has the same value as k* + mKstar = boostPrf(particle1Prf).P(); } void fill() { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstar, HistTable)), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMt, HistTable)), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsPt2, HistTable)), mParticle1.Pt(), mParticle2.Pt()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKstar, HistTable)), mParticle1.Pt(), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsMt, HistTable)), mParticle1.Pt(), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKt, HistTable)), mParticle1.Pt(), mKt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKstar, HistTable)), mParticle2.Pt(), mKstar); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsMt, HistTable)), mParticle2.Pt(), mMt); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKt, HistTable)), mParticle2.Pt(), mKt); + if (mPlot1d) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstar, HistTable)), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kMt, HistTable)), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKt, HistTable)), mKt); + } + if (mPlot2d) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsPt2, HistTable)), mParticle1.Pt(), mParticle2.Pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKstar, HistTable)), mParticle1.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsMt, HistTable)), mParticle1.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt1VsKt, HistTable)), mParticle1.Pt(), mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKstar, HistTable)), mParticle2.Pt(), mKstar); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsMt, HistTable)), mParticle2.Pt(), mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt2VsKt, HistTable)), mParticle2.Pt(), mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsKt, HistTable)), mKstar, mKt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMt, HistTable)), mKstar, mMt); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMult, HistTable)), mKstar, mMult); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsCent, HistTable)), mKstar, mCent); + } + if (mPlotKstarVsMtVsMult) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsMult, HistTable)), mKstar, mMt, mMult); + } + if (mPlotKstarVsMtVsMultVsCent) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsMultVsCent, HistTable)), mKstar, mMt, mMult, mCent); + } + if (mPlotKstarVsMtVsPt1VsP2VsMult) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsPt1VsP2VsMult, HistTable)), mKstar, mMt, mParticle1.Pt(), mParticle2.pt(), mMult); + } + if (mPlotKstarVsMtVsPt1VsP2VsMultVsCent) { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kKstarVsMtVsPt1VsP2VsMultVsCent, HistTable)), mKstar, mMt, mParticle1.Pt(), mParticle2.pt(), mMult, mCent); + } } // if constexpr (isFlagSet(mode, modes::Mode::kQA)) { @@ -222,13 +324,23 @@ class PairHistManager o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; float mMass1 = 0.f; float mMass2 = 0.f; - float mAbsCharge1 = 1.f; - float mAbsCharge2 = 1.f; + int mAbsCharge1 = 1; + int mAbsCharge2 = 1; ROOT::Math::PtEtaPhiMVector mParticle1{}; ROOT::Math::PtEtaPhiMVector mParticle2{}; float mKstar = 0.f; float mKt = 0.f; float mMt = 0.f; + float mMult = 0.f; + float mCent = 0.f; + + // flags + bool mPlot1d = true; + bool mPlot2d = true; + bool mPlotKstarVsMtVsMult = false; + bool mPlotKstarVsMtVsMultVsCent = false; + bool mPlotKstarVsMtVsPt1VsP2VsMult = false; + bool mPlotKstarVsMtVsPt1VsP2VsMultVsCent = false; }; }; // namespace pairhistmanager diff --git a/PWGCF/Femto/Core/pairProcessHelpers.h b/PWGCF/Femto/Core/pairProcessHelpers.h index ebcc6ec969d..dbede67648d 100644 --- a/PWGCF/Femto/Core/pairProcessHelpers.h +++ b/PWGCF/Femto/Core/pairProcessHelpers.h @@ -34,13 +34,15 @@ template + typename T6, + typename T7> void processSameEvent(T1 const& SliceParticle, T2 const& TrackTable, - T3& ParticleHistManager, - T4& PairHistManager, - T5& CprManager, - T6& rng, + T3 const& Collision, + T4& ParticleHistManager, + T5& PairHistManager, + T6& CprManager, + T7& rng, bool randomize) { // Fill single particle histograms @@ -61,9 +63,9 @@ void processSameEvent(T1 const& SliceParticle, float threshold = 0.5f; bool swapPair = randomize ? (dist(rng) > threshold) : false; if (swapPair) { - PairHistManager.setPair(p2, p1); + PairHistManager.setPair(p2, p1, Collision); } else { - PairHistManager.setPair(p1, p2); + PairHistManager.setPair(p1, p2, Collision); } PairHistManager.fill(); } @@ -77,15 +79,17 @@ template + typename T8, + typename T9> void processSameEvent(T1 const& SliceParticle1, T2 const& SliceParticle2, T3 const& TrackTable, - T4& ParticleHistManager1, - T5& ParticleHistManager2, - T6& PairHistManager, - T7& CprManager, - T8& PcManager) + T4 const& Collision, + T5& ParticleHistManager1, + T6& ParticleHistManager2, + T7& PairHistManager, + T8& CprManager, + T9& PcManager) { // Fill single particle histograms for (auto const& part : SliceParticle1) { @@ -107,7 +111,7 @@ void processSameEvent(T1 const& SliceParticle1, } } CprManager.fill(); - PairHistManager.setPair(p1, p2); + PairHistManager.setPair(p1, p2, Collision); PairHistManager.fill(); } } @@ -155,7 +159,7 @@ void processMixedEvent(T1& Collisions, } } CprManager.fill(); - PairHistManager.setPair(p1, p2); + PairHistManager.setPair(p1, p2, collision1); PairHistManager.fill(); } } @@ -206,7 +210,7 @@ void processMixedEvent(T1& Collisions, } } CprManager.fill(); - PairHistManager.setPair(p1, p2); + PairHistManager.setPair(p1, p2, collision1); PairHistManager.fill(); } } diff --git a/PWGCF/Femto/Core/trackBuilder.h b/PWGCF/Femto/Core/trackBuilder.h index 6a343d2ebbb..7bcb977473e 100644 --- a/PWGCF/Femto/Core/trackBuilder.h +++ b/PWGCF/Femto/Core/trackBuilder.h @@ -259,8 +259,8 @@ const std::unordered_map trackSelsToString = { class TrackSelection : public BaseSelection { public: - TrackSelection() {} - virtual ~TrackSelection() = default; + TrackSelection() = default; + ~TrackSelection() = default; template void configure(T1& config, T2& filter) @@ -451,7 +451,7 @@ class TrackBuilder { public: TrackBuilder() = default; - virtual ~TrackBuilder() = default; + ~TrackBuilder() = default; template void init(T1& config, T2& filter, T3& table, T4& initContext) diff --git a/PWGCF/Femto/Core/trackHistManager.h b/PWGCF/Femto/Core/trackHistManager.h index 751ee660e9c..b5cf3dae112 100644 --- a/PWGCF/Femto/Core/trackHistManager.h +++ b/PWGCF/Femto/Core/trackHistManager.h @@ -44,6 +44,8 @@ enum TrackHist { kPhi, kSign, // qa variables + kPAtPv, + kPTpc, kItsCluster, kItsClusterIb, kTpcCrossedRows, @@ -150,7 +152,15 @@ using ConfKinkChaDauBinning = ConfTrackBinning; template struct ConfTrackQaBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; - o2::framework::Configurable momentumType{"momentumType", 0, "Momentum on x-axis (0->Pt, 1->P at PV"}; + o2::framework::Configurable momentumType{"momentumType", static_cast(modes::MomentumType::kPAtPv), "Momentum on x-axis (0->Pt, 1->P at PV, 2->P at TPC inner wall)"}; + o2::framework::Configurable plot2d{"plot2d", true, "Generate various 2D QA plots"}; + o2::framework::Configurable plotElectronPid{"plotElectronPid", true, "Generate plots for Electron PID"}; + o2::framework::Configurable plotPionPid{"plotPionPid", true, "Generate plots for Pion PID"}; + o2::framework::Configurable plotKaonPid{"plotKaonPid", true, "Generate plots for Kaon PID"}; + o2::framework::Configurable plotProtonPid{"plotProtonPid", true, "Generate plots for Proton PID"}; + o2::framework::Configurable plotDeuteronPid{"plotDeuteronPid", true, "Generate plots for Deuteron PID"}; + o2::framework::Configurable plotTritonPid{"plotTritonPid", true, "Generate plots for Triton PID"}; + o2::framework::Configurable plotHeliumPid{"plotHeliumPid", true, "Generate plots for Helium PID"}; 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"}; @@ -232,6 +242,8 @@ constexpr std::array, kTrackHistLast> HistTable {kEta, o2::framework::kTH1F, "hEta", "Pseudorapdity; #eta; Entries"}, {kPhi, o2::framework::kTH1F, "hPhi", "Azimuthal angle; #varphi; Entries"}, {kSign, o2::framework::kTH1F, "hSign", "Sign of charge ; Sign; Entries"}, + {kPAtPv, o2::framework::kTH1F, "hPAtPv", "Momentum at Primary vertex; p_{vertex}; Entries"}, + {kPTpc, o2::framework::kTH1F, "hPTpc", "Momentum at inner wall of TPC; p_{TPC}; Entries"}, {kItsCluster, o2::framework::kTH1F, "hItsCluster", "ITS cluster; ITS cluster; Entries"}, {kItsClusterIb, o2::framework::kTH1F, "hItsClusterIb", "ITS cluster in inner barrel; ITS IB cluster; Entries"}, {kTpcCrossedRows, o2::framework::kTH1F, "hTpcCrossedRows", "TPC crossed rows; TPC crossed rows; Entries"}, @@ -311,6 +323,8 @@ auto makeTrackQaHistSpecMap(const T1& confBinningAnalysis, const T2 confiBinning {kEta, {confBinningAnalysis.eta}}, {kPhi, {confBinningAnalysis.phi}}, {kSign, {confBinningAnalysis.sign}}, + {kPAtPv, {confiBinningQa.p}}, + {kPTpc, {confiBinningQa.p}}, {kItsCluster, {confiBinningQa.itsCluster}}, {kItsClusterIb, {confiBinningQa.itsClusterIb}}, {kPtVsEta, {confBinningAnalysis.pt, confBinningAnalysis.eta}}, @@ -411,122 +425,185 @@ template class TrackHistManager { public: - /// Destructor - virtual ~TrackHistManager() = default; + TrackHistManager() = default; + ~TrackHistManager() = default; - void init(o2::framework::HistogramRegistry* registry, std::map> Specs, int absCharge = 1, int momentumTypeForPid = 0) + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs, int AbsCharge = 1) { mHistogramRegistry = registry; - mAbsCharge = absCharge; // stored absolute charge of the track to scale the momentum in case of Z!=1 (case only for He3) - + mAbsCharge = std::abs(AbsCharge); if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); - - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {Specs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {Specs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {Specs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {Specs[kSign]}); + initAnalysis(Specs); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { + initQa(Specs); + } + } - std::string qaDir = std::string(prefix) + std::string(QaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kItsCluster, HistTable), getHistDesc(kItsCluster, HistTable), getHistType(kItsCluster, HistTable), {Specs[kItsCluster]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kItsClusterIb, HistTable), getHistDesc(kItsClusterIb, HistTable), getHistType(kItsClusterIb, HistTable), {Specs[kItsClusterIb]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCrossedRows, HistTable), getHistDesc(kTpcCrossedRows, HistTable), getHistType(kTpcCrossedRows, HistTable), {Specs[kTpcCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCluster, HistTable), getHistDesc(kTpcCluster, HistTable), getHistType(kTpcCluster, HistTable), {Specs[kTpcCluster]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterOverCrossedRows, HistTable), getHistDesc(kTpcClusterOverCrossedRows, HistTable), getHistType(kTpcClusterOverCrossedRows, HistTable), {Specs[kTpcClusterOverCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterShared, HistTable), getHistDesc(kTpcClusterShared, HistTable), getHistType(kTpcClusterShared, HistTable), {Specs[kTpcClusterShared]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterFractionShared, HistTable), getHistDesc(kTpcClusterFractionShared, HistTable), getHistType(kTpcClusterFractionShared, HistTable), {Specs[kTpcClusterFractionShared]}); - - // qa 2d - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {Specs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {Specs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {Specs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsItsCluster, HistTable), getHistDesc(kPtVsItsCluster, HistTable), getHistType(kPtVsItsCluster, HistTable), {Specs[kPtVsItsCluster]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCluster, HistTable), getHistDesc(kPtVsTpcCluster, HistTable), getHistType(kPtVsTpcCluster, HistTable), {Specs[kPtVsTpcCluster]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCrossedRows, HistTable), getHistDesc(kPtVsTpcCrossedRows, HistTable), getHistType(kPtVsTpcCrossedRows, HistTable), {Specs[kPtVsTpcCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterOverCrossedRows, HistTable), getHistDesc(kPtVsTpcClusterOverCrossedRows, HistTable), getHistType(kPtVsTpcClusterOverCrossedRows, HistTable), {Specs[kPtVsTpcClusterOverCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterShared, HistTable), getHistDesc(kPtVsTpcClusterShared, HistTable), getHistType(kPtVsTpcClusterShared, HistTable), {Specs[kPtVsTpcClusterShared]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterFractionShared, HistTable), getHistDesc(kPtVsTpcClusterFractionShared, HistTable), getHistType(kPtVsTpcClusterFractionShared, HistTable), {Specs[kPtVsTpcClusterFractionShared]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcCrossedRows, HistTable), getHistDesc(kTpcClusterVsTpcCrossedRows, HistTable), getHistType(kTpcClusterVsTpcCrossedRows, HistTable), {Specs[kTpcClusterVsTpcCrossedRows]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcClusterShared, HistTable), getHistDesc(kTpcClusterVsTpcClusterShared, HistTable), getHistType(kTpcClusterVsTpcClusterShared, HistTable), {Specs[kTpcClusterVsTpcClusterShared]}); + template + void enableOptionalHistograms(T const& ConfBinningQa) + { + mPlot2d = ConfBinningQa.plot2d.value; + mPlotElectronPid = ConfBinningQa.plotElectronPid.value; + mPlotPionPid = ConfBinningQa.plotPionPid.value; + mPlotKaonPid = ConfBinningQa.plotKaonPid.value; + mPlotProtonPid = ConfBinningQa.plotProtonPid.value; + mPlotDeuteronPid = ConfBinningQa.plotDeuteronPid.value; + mPlotTritonPid = ConfBinningQa.plotTritonPid.value; + mPlotHeliumPid = ConfBinningQa.plotHeliumPid.value; + mMomentumType = static_cast(ConfBinningQa.momentumType.value); + } - // dca - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaxy, HistTable), getHistDesc(kPtVsDcaxy, HistTable), getHistType(kPtVsDcaxy, HistTable), {Specs[kPtVsDcaxy]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaz, HistTable), getHistDesc(kPtVsDcaz, HistTable), getHistType(kPtVsDcaz, HistTable), {Specs[kPtVsDcaz]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDca, HistTable), getHistDesc(kPtVsDca, HistTable), getHistType(kPtVsDca, HistTable), {Specs[kPtVsDca]}); - - std::string pidDir = std::string(prefix) + std::string(PidDir); - - mMomentumType = static_cast(momentumTypeForPid); - - mHistogramRegistry->add(pidDir + getHistNameV2(kItsSignal, HistTable), getHistDesc(kItsSignal, HistTable), getHistType(kItsSignal, HistTable), {Specs[kItsSignal]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsElectron, HistTable), getHistDesc(kItsElectron, HistTable), getHistType(kItsElectron, HistTable), {Specs[kItsElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsPion, HistTable), getHistDesc(kItsPion, HistTable), getHistType(kItsPion, HistTable), {Specs[kItsPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsKaon, HistTable), getHistDesc(kItsKaon, HistTable), getHistType(kItsKaon, HistTable), {Specs[kItsKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsProton, HistTable), getHistDesc(kItsProton, HistTable), getHistType(kItsProton, HistTable), {Specs[kItsProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsDeuteron, HistTable), getHistDesc(kItsDeuteron, HistTable), getHistType(kItsDeuteron, HistTable), {Specs[kItsDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsTriton, HistTable), getHistDesc(kItsTriton, HistTable), getHistType(kItsTriton, HistTable), {Specs[kItsTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kItsHelium, HistTable), getHistDesc(kItsHelium, HistTable), getHistType(kItsHelium, HistTable), {Specs[kItsHelium]}); - - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcSignal, HistTable), getHistDesc(kTpcSignal, HistTable), getHistType(kTpcSignal, HistTable), {Specs[kTpcSignal]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcElectron, HistTable), getHistDesc(kTpcElectron, HistTable), getHistType(kTpcElectron, HistTable), {Specs[kTpcElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcPion, HistTable), getHistDesc(kTpcPion, HistTable), getHistType(kTpcPion, HistTable), {Specs[kTpcPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcKaon, HistTable), getHistDesc(kTpcKaon, HistTable), getHistType(kTpcKaon, HistTable), {Specs[kTpcKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcProton, HistTable), getHistDesc(kTpcProton, HistTable), getHistType(kTpcProton, HistTable), {Specs[kTpcProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcDeuteron, HistTable), getHistDesc(kTpcDeuteron, HistTable), getHistType(kTpcDeuteron, HistTable), {Specs[kTpcDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcTriton, HistTable), getHistDesc(kTpcTriton, HistTable), getHistType(kTpcTriton, HistTable), {Specs[kTpcTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcHelium, HistTable), getHistDesc(kTpcHelium, HistTable), getHistType(kTpcHelium, HistTable), {Specs[kTpcHelium]}); - - mHistogramRegistry->add(pidDir + getHistNameV2(kTofBeta, HistTable), getHistDesc(kTofBeta, HistTable), getHistType(kTofBeta, HistTable), {Specs[kTofBeta]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofMass, HistTable), getHistDesc(kTofMass, HistTable), getHistType(kTofMass, HistTable), {Specs[kTofMass]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofElectron, HistTable), getHistDesc(kTofElectron, HistTable), getHistType(kTofElectron, HistTable), {Specs[kTofElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofPion, HistTable), getHistDesc(kTofPion, HistTable), getHistType(kTofPion, HistTable), {Specs[kTofPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofKaon, HistTable), getHistDesc(kTofKaon, HistTable), getHistType(kTofKaon, HistTable), {Specs[kTofKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofProton, HistTable), getHistDesc(kTofProton, HistTable), getHistType(kTofProton, HistTable), {Specs[kTofProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofDeuteron, HistTable), getHistDesc(kTofDeuteron, HistTable), getHistType(kTofDeuteron, HistTable), {Specs[kTofDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofTriton, HistTable), getHistDesc(kTofTriton, HistTable), getHistType(kTofTriton, HistTable), {Specs[kTofTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTofHelium, HistTable), getHistDesc(kTofHelium, HistTable), getHistType(kTofHelium, HistTable), {Specs[kTofHelium]}); - - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsElectron, HistTable), getHistDesc(kTpcitsElectron, HistTable), getHistType(kTpcitsElectron, HistTable), {Specs[kTpcitsElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsPion, HistTable), getHistDesc(kTpcitsPion, HistTable), getHistType(kTpcitsPion, HistTable), {Specs[kTpcitsPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsKaon, HistTable), getHistDesc(kTpcitsKaon, HistTable), getHistType(kTpcitsKaon, HistTable), {Specs[kTpcitsKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsProton, HistTable), getHistDesc(kTpcitsProton, HistTable), getHistType(kTpcitsProton, HistTable), {Specs[kTpcitsProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsDeuteron, HistTable), getHistDesc(kTpcitsDeuteron, HistTable), getHistType(kTpcitsDeuteron, HistTable), {Specs[kTpcitsDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsTriton, HistTable), getHistDesc(kTpcitsTriton, HistTable), getHistType(kTpcitsTriton, HistTable), {Specs[kTpcitsTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsHelium, HistTable), getHistDesc(kTpcitsHelium, HistTable), getHistType(kTpcitsHelium, HistTable), {Specs[kTpcitsHelium]}); - - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofElectron, HistTable), getHistDesc(kTpctofElectron, HistTable), getHistType(kTpctofElectron, HistTable), {Specs[kTpctofElectron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofPion, HistTable), getHistDesc(kTpctofPion, HistTable), getHistType(kTpctofPion, HistTable), {Specs[kTpctofPion]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofKaon, HistTable), getHistDesc(kTpctofKaon, HistTable), getHistType(kTpctofKaon, HistTable), {Specs[kTpctofKaon]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofProton, HistTable), getHistDesc(kTpctofProton, HistTable), getHistType(kTpctofProton, HistTable), {Specs[kTpctofProton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofDeuteron, HistTable), getHistDesc(kTpctofDeuteron, HistTable), getHistType(kTpctofDeuteron, HistTable), {Specs[kTpctofDeuteron]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofTriton, HistTable), getHistDesc(kTpctofTriton, HistTable), getHistType(kTpctofTriton, HistTable), {Specs[kTpctofTriton]}); - mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofHelium, HistTable), getHistDesc(kTpctofHelium, HistTable), getHistType(kTpctofHelium, HistTable), {Specs[kTpctofHelium]}); - } + // special init function for Qa + // passing config group for qa so we can optionally enable histograms via falgsc + template + void init(o2::framework::HistogramRegistry* registry, std::map> const& Specs, T const& ConfBinningQa, int AbsCharge) + { + enableOptionalHistograms(ConfBinningQa); + init(registry, Specs, AbsCharge); } template void fill(T1 const& track, T2 const& /*trackTable*/) { if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), mAbsCharge * track.pt()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), track.eta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), track.phi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), track.sign()); + fillAnalysis(track); } - if constexpr (isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsCluster, HistTable)), static_cast(track.itsNCls())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsClusterIb, HistTable)), static_cast(track.itsNClsInnerBarrel())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCrossedRows, HistTable)), static_cast(track.tpcNClsCrossedRows())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCluster, HistTable)), static_cast(track.tpcNClsFound())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterOverCrossedRows, HistTable)), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterShared, HistTable)), static_cast(track.tpcNClsShared())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterFractionShared, HistTable)), track.tpcSharedOverFound()); + fillQa(track); + } + } + + private: + void initAnalysis(std::map> const& Specs) + { + std::string analysisDir = std::string(prefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {Specs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {Specs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {Specs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {Specs.at(kSign)}); + } + + void initQa(std::map> const& Specs) + { + std::string qaDir = std::string(prefix) + std::string(QaDir); + + mHistogramRegistry->add(qaDir + getHistNameV2(kPAtPv, HistTable), getHistDesc(kPAtPv, HistTable), getHistType(kPAtPv, HistTable), {Specs.at(kPAtPv)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPTpc, HistTable), getHistDesc(kPTpc, HistTable), getHistType(kPTpc, HistTable), {Specs.at(kPTpc)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kItsCluster, HistTable), getHistDesc(kItsCluster, HistTable), getHistType(kItsCluster, HistTable), {Specs.at(kItsCluster)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kItsClusterIb, HistTable), getHistDesc(kItsClusterIb, HistTable), getHistType(kItsClusterIb, HistTable), {Specs.at(kItsClusterIb)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCrossedRows, HistTable), getHistDesc(kTpcCrossedRows, HistTable), getHistType(kTpcCrossedRows, HistTable), {Specs.at(kTpcCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcCluster, HistTable), getHistDesc(kTpcCluster, HistTable), getHistType(kTpcCluster, HistTable), {Specs.at(kTpcCluster)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterOverCrossedRows, HistTable), getHistDesc(kTpcClusterOverCrossedRows, HistTable), getHistType(kTpcClusterOverCrossedRows, HistTable), {Specs.at(kTpcClusterOverCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterShared, HistTable), getHistDesc(kTpcClusterShared, HistTable), getHistType(kTpcClusterShared, HistTable), {Specs.at(kTpcClusterShared)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterFractionShared, HistTable), getHistDesc(kTpcClusterFractionShared, HistTable), getHistType(kTpcClusterFractionShared, HistTable), {Specs.at(kTpcClusterFractionShared)}); + + // qa 2d + if (mPlot2d) { + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {Specs.at(kPtVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {Specs.at(kPtVsPhi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {Specs.at(kPhiVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsItsCluster, HistTable), getHistDesc(kPtVsItsCluster, HistTable), getHistType(kPtVsItsCluster, HistTable), {Specs.at(kPtVsItsCluster)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCluster, HistTable), getHistDesc(kPtVsTpcCluster, HistTable), getHistType(kPtVsTpcCluster, HistTable), {Specs.at(kPtVsTpcCluster)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcCrossedRows, HistTable), getHistDesc(kPtVsTpcCrossedRows, HistTable), getHistType(kPtVsTpcCrossedRows, HistTable), {Specs.at(kPtVsTpcCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterOverCrossedRows, HistTable), getHistDesc(kPtVsTpcClusterOverCrossedRows, HistTable), getHistType(kPtVsTpcClusterOverCrossedRows, HistTable), {Specs.at(kPtVsTpcClusterOverCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterShared, HistTable), getHistDesc(kPtVsTpcClusterShared, HistTable), getHistType(kPtVsTpcClusterShared, HistTable), {Specs.at(kPtVsTpcClusterShared)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsTpcClusterFractionShared, HistTable), getHistDesc(kPtVsTpcClusterFractionShared, HistTable), getHistType(kPtVsTpcClusterFractionShared, HistTable), {Specs.at(kPtVsTpcClusterFractionShared)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcCrossedRows, HistTable), getHistDesc(kTpcClusterVsTpcCrossedRows, HistTable), getHistType(kTpcClusterVsTpcCrossedRows, HistTable), {Specs.at(kTpcClusterVsTpcCrossedRows)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTpcClusterVsTpcClusterShared, HistTable), getHistDesc(kTpcClusterVsTpcClusterShared, HistTable), getHistType(kTpcClusterVsTpcClusterShared, HistTable), {Specs.at(kTpcClusterVsTpcClusterShared)}); + // dca + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaxy, HistTable), getHistDesc(kPtVsDcaxy, HistTable), getHistType(kPtVsDcaxy, HistTable), {Specs.at(kPtVsDcaxy)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDcaz, HistTable), getHistDesc(kPtVsDcaz, HistTable), getHistType(kPtVsDcaz, HistTable), {Specs.at(kPtVsDcaz)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsDca, HistTable), getHistDesc(kPtVsDca, HistTable), getHistType(kPtVsDca, HistTable), {Specs.at(kPtVsDca)}); + } + + std::string pidDir = std::string(prefix) + std::string(PidDir); + + mHistogramRegistry->add(pidDir + getHistNameV2(kItsSignal, HistTable), getHistDesc(kItsSignal, HistTable), getHistType(kItsSignal, HistTable), {Specs.at(kItsSignal)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcSignal, HistTable), getHistDesc(kTpcSignal, HistTable), getHistType(kTpcSignal, HistTable), {Specs.at(kTpcSignal)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofBeta, HistTable), getHistDesc(kTofBeta, HistTable), getHistType(kTofBeta, HistTable), {Specs.at(kTofBeta)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofMass, HistTable), getHistDesc(kTofMass, HistTable), getHistType(kTofMass, HistTable), {Specs.at(kTofMass)}); + + if (mPlotElectronPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsElectron, HistTable), getHistDesc(kItsElectron, HistTable), getHistType(kItsElectron, HistTable), {Specs.at(kItsElectron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcElectron, HistTable), getHistDesc(kTpcElectron, HistTable), getHistType(kTpcElectron, HistTable), {Specs.at(kTpcElectron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofElectron, HistTable), getHistDesc(kTofElectron, HistTable), getHistType(kTofElectron, HistTable), {Specs.at(kTofElectron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsElectron, HistTable), getHistDesc(kTpcitsElectron, HistTable), getHistType(kTpcitsElectron, HistTable), {Specs.at(kTpcitsElectron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofElectron, HistTable), getHistDesc(kTpctofElectron, HistTable), getHistType(kTpctofElectron, HistTable), {Specs.at(kTpctofElectron)}); + } + + if (mPlotPionPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsPion, HistTable), getHistDesc(kItsPion, HistTable), getHistType(kItsPion, HistTable), {Specs.at(kItsPion)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcPion, HistTable), getHistDesc(kTpcPion, HistTable), getHistType(kTpcPion, HistTable), {Specs.at(kTpcPion)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofPion, HistTable), getHistDesc(kTofPion, HistTable), getHistType(kTofPion, HistTable), {Specs.at(kTofPion)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsPion, HistTable), getHistDesc(kTpcitsPion, HistTable), getHistType(kTpcitsPion, HistTable), {Specs.at(kTpcitsPion)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofPion, HistTable), getHistDesc(kTpctofPion, HistTable), getHistType(kTpctofPion, HistTable), {Specs.at(kTpctofPion)}); + } + + if (mPlotKaonPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsKaon, HistTable), getHistDesc(kItsKaon, HistTable), getHistType(kItsKaon, HistTable), {Specs.at(kItsKaon)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcKaon, HistTable), getHistDesc(kTpcKaon, HistTable), getHistType(kTpcKaon, HistTable), {Specs.at(kTpcKaon)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofKaon, HistTable), getHistDesc(kTofKaon, HistTable), getHistType(kTofKaon, HistTable), {Specs.at(kTofKaon)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsKaon, HistTable), getHistDesc(kTpcitsKaon, HistTable), getHistType(kTpcitsKaon, HistTable), {Specs.at(kTpcitsKaon)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofKaon, HistTable), getHistDesc(kTpctofKaon, HistTable), getHistType(kTpctofKaon, HistTable), {Specs.at(kTpctofKaon)}); + } + + if (mPlotProtonPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsProton, HistTable), getHistDesc(kItsProton, HistTable), getHistType(kItsProton, HistTable), {Specs.at(kItsProton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcProton, HistTable), getHistDesc(kTpcProton, HistTable), getHistType(kTpcProton, HistTable), {Specs.at(kTpcProton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofProton, HistTable), getHistDesc(kTofProton, HistTable), getHistType(kTofProton, HistTable), {Specs.at(kTofProton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsProton, HistTable), getHistDesc(kTpcitsProton, HistTable), getHistType(kTpcitsProton, HistTable), {Specs.at(kTpcitsProton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofProton, HistTable), getHistDesc(kTpctofProton, HistTable), getHistType(kTpctofProton, HistTable), {Specs.at(kTpctofProton)}); + } + + if (mPlotDeuteronPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsDeuteron, HistTable), getHistDesc(kItsDeuteron, HistTable), getHistType(kItsDeuteron, HistTable), {Specs.at(kItsDeuteron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcDeuteron, HistTable), getHistDesc(kTpcDeuteron, HistTable), getHistType(kTpcDeuteron, HistTable), {Specs.at(kTpcDeuteron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofDeuteron, HistTable), getHistDesc(kTofDeuteron, HistTable), getHistType(kTofDeuteron, HistTable), {Specs.at(kTofDeuteron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsDeuteron, HistTable), getHistDesc(kTpcitsDeuteron, HistTable), getHistType(kTpcitsDeuteron, HistTable), {Specs.at(kTpcitsDeuteron)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofDeuteron, HistTable), getHistDesc(kTpctofDeuteron, HistTable), getHistType(kTpctofDeuteron, HistTable), {Specs.at(kTpctofDeuteron)}); + } + + if (mPlotTritonPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsTriton, HistTable), getHistDesc(kItsTriton, HistTable), getHistType(kItsTriton, HistTable), {Specs.at(kItsTriton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcTriton, HistTable), getHistDesc(kTpcTriton, HistTable), getHistType(kTpcTriton, HistTable), {Specs.at(kTpcTriton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofTriton, HistTable), getHistDesc(kTofTriton, HistTable), getHistType(kTofTriton, HistTable), {Specs.at(kTofTriton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsTriton, HistTable), getHistDesc(kTpcitsTriton, HistTable), getHistType(kTpcitsTriton, HistTable), {Specs.at(kTpcitsTriton)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofTriton, HistTable), getHistDesc(kTpctofTriton, HistTable), getHistType(kTpctofTriton, HistTable), {Specs.at(kTpctofTriton)}); + } + if (mPlotHeliumPid) { + mHistogramRegistry->add(pidDir + getHistNameV2(kItsHelium, HistTable), getHistDesc(kItsHelium, HistTable), getHistType(kItsHelium, HistTable), {Specs.at(kItsHelium)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcHelium, HistTable), getHistDesc(kTpcHelium, HistTable), getHistType(kTpcHelium, HistTable), {Specs.at(kTpcHelium)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTofHelium, HistTable), getHistDesc(kTofHelium, HistTable), getHistType(kTofHelium, HistTable), {Specs.at(kTofHelium)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpcitsHelium, HistTable), getHistDesc(kTpcitsHelium, HistTable), getHistType(kTpcitsHelium, HistTable), {Specs.at(kTpcitsHelium)}); + mHistogramRegistry->add(pidDir + getHistNameV2(kTpctofHelium, HistTable), getHistDesc(kTpctofHelium, HistTable), getHistType(kTpctofHelium, HistTable), {Specs.at(kTpctofHelium)}); + } + } + + template + void fillAnalysis(T const& track) + { + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), mAbsCharge * track.pt()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), track.eta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), track.phi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), track.sign()); + } + + template + void fillQa(T const& track) + { + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPAtPv, HistTable)), track.p()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPTpc, HistTable)), track.tpcInnerParam()); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsCluster, HistTable)), static_cast(track.itsNCls())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kItsClusterIb, HistTable)), static_cast(track.itsNClsInnerBarrel())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCrossedRows, HistTable)), static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcCluster, HistTable)), static_cast(track.tpcNClsFound())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterOverCrossedRows, HistTable)), static_cast(track.tpcNClsFound()) / static_cast(track.tpcNClsCrossedRows())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterShared, HistTable)), static_cast(track.tpcNClsShared())); + mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterFractionShared, HistTable)), track.tpcSharedOverFound()); + + if (mPlot2d) { mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), mAbsCharge * track.pt(), track.eta()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), mAbsCharge * track.pt(), track.phi()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), track.phi(), track.eta()); @@ -538,67 +615,95 @@ class TrackHistManager mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsTpcClusterFractionShared, HistTable)), mAbsCharge * track.pt(), static_cast(track.tpcNClsShared()) / static_cast(track.tpcNClsFound())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterVsTpcCrossedRows, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsCrossedRows())); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kTpcClusterVsTpcClusterShared, HistTable)), static_cast(track.tpcNClsFound()), static_cast(track.tpcNClsShared())); - mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaxy, HistTable)), mAbsCharge * track.pt(), track.dcaXY()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDcaz, HistTable)), mAbsCharge * track.pt(), track.dcaZ()); mHistogramRegistry->fill(HIST(prefix) + HIST(QaDir) + HIST(getHistName(kPtVsDca, HistTable)), mAbsCharge * track.pt(), track.dca()); + } - float momentum = 0.f; - if (mMomentumType == modes::MomentumType::kPAtPv) { - momentum = mAbsCharge * track.p(); - } else if (mMomentumType == modes::MomentumType::kPt) { - momentum = mAbsCharge * track.pt(); - } + float momentum = 0.f; + if (mMomentumType == modes::MomentumType::kPt) { + momentum = mAbsCharge * track.p(); + } else if (mMomentumType == modes::MomentumType::kPAtPv) { + momentum = mAbsCharge * track.pt(); + } else if (mMomentumType == modes::MomentumType::kPTpc) { + momentum = track.tpcInnerParam(); + } else { + LOG(warn) << "Invalid momentum type for PID plots"; + momentum = 0; + } - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsSignal, HistTable)), momentum, o2::analysis::femto::utils::itsSignal(track)); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsElectron, HistTable)), momentum, track.itsNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsPion, HistTable)), momentum, track.itsNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsKaon, HistTable)), momentum, track.itsNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsProton, HistTable)), momentum, track.itsNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsDeuteron, HistTable)), momentum, track.itsNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsTriton, HistTable)), momentum, track.itsNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsHelium, HistTable)), momentum, track.itsNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsSignal, HistTable)), momentum, o2::analysis::femto::utils::itsSignal(track)); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcSignal, HistTable)), momentum, track.tpcSignal()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofBeta, HistTable)), momentum, track.tofBeta()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofMass, HistTable)), momentum, track.tofMass()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcSignal, HistTable)), momentum, track.tpcSignal()); + if (mPlotElectronPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsElectron, HistTable)), momentum, track.itsNSigmaEl()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcElectron, HistTable)), momentum, track.tpcNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcPion, HistTable)), momentum, track.tpcNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcKaon, HistTable)), momentum, track.tpcNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcProton, HistTable)), momentum, track.tpcNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcDeuteron, HistTable)), momentum, track.tpcNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcTriton, HistTable)), momentum, track.tpcNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcHelium, HistTable)), momentum, track.tpcNSigmaHe()); - - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofBeta, HistTable)), momentum, track.tofBeta()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofMass, HistTable)), momentum, track.tofMass()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofElectron, HistTable)), momentum, track.tofNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofPion, HistTable)), momentum, track.tofNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofKaon, HistTable)), momentum, track.tofNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofProton, HistTable)), momentum, track.tofNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofDeuteron, HistTable)), momentum, track.tofNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofTriton, HistTable)), momentum, track.tofNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofHelium, HistTable)), momentum, track.tofNSigmaHe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsElectron, HistTable)), momentum, track.tpcitsNSigmaEl()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsPion, HistTable)), momentum, track.tpcitsNSigmaPi()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsKaon, HistTable)), momentum, track.tpcitsNSigmaKa()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsProton, HistTable)), momentum, track.tpcitsNSigmaPr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsDeuteron, HistTable)), momentum, track.tpcitsNSigmaDe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsTriton, HistTable)), momentum, track.tpcitsNSigmaTr()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsHelium, HistTable)), momentum, track.tpcitsNSigmaHe()); - mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofElectron, HistTable)), momentum, track.tpctofNSigmaEl()); + } + + if (mPlotPionPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsPion, HistTable)), momentum, track.itsNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcPion, HistTable)), momentum, track.tpcNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofPion, HistTable)), momentum, track.tofNSigmaPi()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsPion, HistTable)), momentum, track.tpcitsNSigmaPi()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofPion, HistTable)), momentum, track.tpctofNSigmaPi()); + } + + if (mPlotKaonPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsKaon, HistTable)), momentum, track.itsNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcKaon, HistTable)), momentum, track.tpcNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofKaon, HistTable)), momentum, track.tofNSigmaKa()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsKaon, HistTable)), momentum, track.tpcitsNSigmaKa()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofKaon, HistTable)), momentum, track.tpctofNSigmaKa()); + } + + if (mPlotProtonPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsProton, HistTable)), momentum, track.itsNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcProton, HistTable)), momentum, track.tpcNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofProton, HistTable)), momentum, track.tofNSigmaPr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsProton, HistTable)), momentum, track.tpcitsNSigmaPr()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofProton, HistTable)), momentum, track.tpctofNSigmaPr()); + } + + if (mPlotDeuteronPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsDeuteron, HistTable)), momentum, track.itsNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcDeuteron, HistTable)), momentum, track.tpcNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofDeuteron, HistTable)), momentum, track.tofNSigmaDe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsDeuteron, HistTable)), momentum, track.tpcitsNSigmaDe()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofDeuteron, HistTable)), momentum, track.tpctofNSigmaDe()); + } + + if (mPlotTritonPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsTriton, HistTable)), momentum, track.itsNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcTriton, HistTable)), momentum, track.tpcNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofTriton, HistTable)), momentum, track.tofNSigmaTr()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsTriton, HistTable)), momentum, track.tpcitsNSigmaTr()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofTriton, HistTable)), momentum, track.tpctofNSigmaTr()); + } + + if (mPlotHeliumPid) { + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kItsHelium, HistTable)), momentum, track.itsNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcHelium, HistTable)), momentum, track.tpcNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTofHelium, HistTable)), momentum, track.tofNSigmaHe()); + mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpcitsHelium, HistTable)), momentum, track.tpcitsNSigmaHe()); mHistogramRegistry->fill(HIST(prefix) + HIST(PidDir) + HIST(getHistName(kTpctofHelium, HistTable)), momentum, track.tpctofNSigmaHe()); } } - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; - float mAbsCharge = 1; + int mAbsCharge = 1; + bool mPlot2d = false; + bool mPlotElectronPid = false; + bool mPlotPionPid = false; + bool mPlotKaonPid = false; + bool mPlotProtonPid = false; + bool mPlotDeuteronPid = false; + bool mPlotTritonPid = false; + bool mPlotHeliumPid = false; modes::MomentumType mMomentumType = modes::MomentumType::kPAtPv; }; }; // namespace trackhistmanager diff --git a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h index 28d62a7c932..8086df4516e 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceBuilder.h +++ b/PWGCF/Femto/Core/twoTrackResonanceBuilder.h @@ -229,8 +229,8 @@ template class TwoTrackResonanceSelection : public BaseSelection { public: - TwoTrackResonanceSelection() {} - virtual ~TwoTrackResonanceSelection() = default; + TwoTrackResonanceSelection() = default; + ~TwoTrackResonanceSelection() = default; template void configure(T1& config, T2& filter, T3& daughterFilter) diff --git a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h index 895a3ba83c4..4852a0357a5 100644 --- a/PWGCF/Femto/Core/twoTrackResonanceHistManager.h +++ b/PWGCF/Femto/Core/twoTrackResonanceHistManager.h @@ -118,47 +118,48 @@ constexpr char PrefixKstar[] = "Kstar0/"; constexpr std::string_view AnalysisDir = "Kinematics/"; constexpr std::string_view QaDir = "QA/"; -/// \class FemtoDreamEventHisto -/// \brief Class for histogramming event properties -// template template class TwoTrackResonanceHistManager { public: - /// Destructor - virtual ~TwoTrackResonanceHistManager() = default; - /// Initializes histograms for the task - /// \param registry Histogram registry to be passed - /// + TwoTrackResonanceHistManager() = default; + ~TwoTrackResonanceHistManager() = default; + void init(o2::framework::HistogramRegistry* registry, - std::map> ResoSpecs, - std::map> PosDauSpecs, - std::map> NegDauSpecs) + std::map> const& ResoSpecs, + std::map> const& PosDauSpecs, + std::map> const& NegDauSpecs) { mHistogramRegistry = registry; mPosDauManager.init(registry, PosDauSpecs); mNegDauManager.init(registry, NegDauSpecs); - if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(resoPrefix) + std::string(AnalysisDir); - - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {ResoSpecs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {ResoSpecs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {ResoSpecs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {ResoSpecs[kMass]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {ResoSpecs[kSign]}); + initAnalysis(ResoSpecs); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(resoPrefix) + std::string(QaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {ResoSpecs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {ResoSpecs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {ResoSpecs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMass, HistTable), getHistDesc(kPtVsMass, HistTable), getHistType(kPtVsMass, HistTable), {ResoSpecs[kPtVsMass]}); + initQa(ResoSpecs); } } + template + void enableOptionalHistograms(T1 const& PosDauConfBinningQa, T2 const& NegDauConfBinningQa) + { + mPosDauManager.enableOptionalHistograms(PosDauConfBinningQa); + mNegDauManager.enableOptionalHistograms(NegDauConfBinningQa); + } + + template + void init(o2::framework::HistogramRegistry* registry, + std::map> ResoSpecs, + std::map> PosDauSpecs, + T1 const& PosDauConfBinningQa, + std::map> NegDauSpecs, + T2 const& NegDauConfBinningQa) + { + enableOptionalHistograms(PosDauConfBinningQa, NegDauConfBinningQa); + init(registry, ResoSpecs, PosDauSpecs, NegDauSpecs); + } + template void fill(T1 const& resonance, T2 const& tracks) { @@ -169,32 +170,58 @@ class TwoTrackResonanceHistManager mPosDauManager.fill(posDaughter, tracks); auto negDaughter = tracks.rawIteratorAt(resonance.negDauId() - tracks.offset()); mNegDauManager.fill(negDaughter, tracks); - if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), resonance.pt()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), resonance.eta()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), resonance.phi()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), resonance.mass()); - - if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kPhi) || modes::isEqual(reso, modes::TwoTrackResonance::kRho0)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); - } - if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kKstar0) || modes::isEqual(reso, modes::TwoTrackResonance::kKstar0Bar)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), resonance.sign()); - } + fillAnalysis(resonance); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), resonance.pt(), resonance.eta()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), resonance.pt(), resonance.phi()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), resonance.phi(), resonance.eta()); - mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMass, HistTable)), resonance.pt(), resonance.mass()); + fillQa(resonance); } } private: - o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; + void initAnalysis(std::map> const& ResoSpecs) + { + std::string analysisDir = std::string(resoPrefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {ResoSpecs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {ResoSpecs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {ResoSpecs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {ResoSpecs.at(kMass)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {ResoSpecs.at(kSign)}); + } + void initQa(std::map> const& ResoSpecs) + { + std::string qaDir = std::string(resoPrefix) + std::string(QaDir); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {ResoSpecs.at(kPtVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {ResoSpecs.at(kPtVsPhi)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {ResoSpecs.at(kPhiVsEta)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsMass, HistTable), getHistDesc(kPtVsMass, HistTable), getHistType(kPtVsMass, HistTable), {ResoSpecs.at(kPtVsMass)}); + } + template + void fillAnalysis(T const& resonance) + { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), resonance.pt()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), resonance.phi()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), resonance.mass()); + if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kPhi) || modes::isEqual(reso, modes::TwoTrackResonance::kRho0)) { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); + } + if constexpr (modes::isEqual(reso, modes::TwoTrackResonance::kKstar0) || modes::isEqual(reso, modes::TwoTrackResonance::kKstar0Bar)) { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), resonance.sign()); + } + } + + template + void fillQa(T const& resonance) + { + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsEta, HistTable)), resonance.pt(), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsPhi, HistTable)), resonance.pt(), resonance.phi()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPhiVsEta, HistTable)), resonance.phi(), resonance.eta()); + mHistogramRegistry->fill(HIST(resoPrefix) + HIST(QaDir) + HIST(getHistName(kPtVsMass, HistTable)), resonance.pt(), resonance.mass()); + } + + o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; trackhistmanager::TrackHistManager mPosDauManager; trackhistmanager::TrackHistManager mNegDauManager; }; diff --git a/PWGCF/Femto/Core/v0Builder.h b/PWGCF/Femto/Core/v0Builder.h index 7013e2c5722..b0a567643b9 100644 --- a/PWGCF/Femto/Core/v0Builder.h +++ b/PWGCF/Femto/Core/v0Builder.h @@ -177,8 +177,8 @@ template class V0Selection : public BaseSelection { public: - V0Selection() {} - virtual ~V0Selection() = default; + V0Selection() = default; + ~V0Selection() = default; template void configure(T1& config, T2& filter) diff --git a/PWGCF/Femto/Core/v0HistManager.h b/PWGCF/Femto/Core/v0HistManager.h index fe0cb31b04e..769210aa9b2 100644 --- a/PWGCF/Femto/Core/v0HistManager.h +++ b/PWGCF/Femto/Core/v0HistManager.h @@ -95,6 +95,7 @@ using ConfK0shortBinning1 = ConfK0shortBinning; template struct ConfV0QaBinning : o2::framework::ConfigurableGroup { std::string prefix = Prefix; + o2::framework::Configurable plot2d{"plot2d", true, "Generate various 2D QA plots"}; o2::framework::ConfigurableAxis cosPa{"cosPa", {{100, 0.9, 1}}, "Cosine of poiting 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"}; @@ -204,58 +205,47 @@ template > V0Specs, - std::map> PosDauSpecs, - std::map> NegDauSpecs) + std::map> const& V0Specs, + std::map> const& PosDauSpecs, + std::map> const& NegDauSpecs) { mHistogramRegistry = registry; mPosDauManager.init(registry, PosDauSpecs); mNegDauManager.init(registry, NegDauSpecs); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - std::string analysisDir = std::string(v0Prefix) + std::string(AnalysisDir); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {V0Specs[kPt]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {V0Specs[kEta]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {V0Specs[kPhi]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {V0Specs[kMass]}); - mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {V0Specs[kSign]}); + initAnalysis(V0Specs); } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - std::string qaDir = std::string(v0Prefix) + std::string(QaDir); - - mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {V0Specs[kCosPa]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {V0Specs[kDecayDauDca]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {V0Specs[kDecayVtxX]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {V0Specs[kDecayVtxY]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {V0Specs[kDecayVtxZ]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {V0Specs[kDecayVtx]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {V0Specs[kTransRadius]}); - - // qa 2d - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsEta, HistTable), getHistDesc(kPtVsEta, HistTable), getHistType(kPtVsEta, HistTable), {V0Specs[kPtVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsPhi, HistTable), getHistDesc(kPtVsPhi, HistTable), getHistType(kPtVsPhi, HistTable), {V0Specs[kPtVsPhi]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPhiVsEta, HistTable), getHistDesc(kPhiVsEta, HistTable), getHistType(kPhiVsEta, HistTable), {V0Specs[kPhiVsEta]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsCosPa, HistTable), getHistDesc(kPtVsCosPa, HistTable), getHistType(kPtVsCosPa, HistTable), {V0Specs[kPtVsCosPa]}); - - mHistogramRegistry->add(qaDir + getHistNameV2(kMassLambda, HistTable), getHistDesc(kMassLambda, HistTable), getHistType(kMassLambda, HistTable), {V0Specs[kMassLambda]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMassAntiLambda, HistTable), getHistDesc(kMassAntiLambda, HistTable), getHistType(kMassAntiLambda, HistTable), {V0Specs[kMassAntiLambda]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kMassK0short, HistTable), getHistDesc(kMassK0short, HistTable), getHistType(kMassK0short, HistTable), {V0Specs[kMassK0short]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsLambdaMass, HistTable), getHistDesc(kPtVsLambdaMass, HistTable), getHistType(kPtVsLambdaMass, HistTable), {V0Specs[kPtVsLambdaMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsAntiLambdaMass, HistTable), getHistDesc(kPtVsAntiLambdaMass, HistTable), getHistType(kPtVsAntiLambdaMass, HistTable), {V0Specs[kPtVsAntiLambdaMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsK0shortMass, HistTable), getHistDesc(kPtVsK0shortMass, HistTable), getHistType(kPtVsK0shortMass, HistTable), {V0Specs[kPtVsK0shortMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kLambdaMassVsAntiLambdaMass, HistTable), getHistDesc(kLambdaMassVsAntiLambdaMass, HistTable), getHistType(kLambdaMassVsAntiLambdaMass, HistTable), {V0Specs[kLambdaMassVsAntiLambdaMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsLambdaMass, HistTable), getHistDesc(kK0shortMassVsLambdaMass, HistTable), getHistType(kK0shortMassVsLambdaMass, HistTable), {V0Specs[kK0shortMassVsLambdaMass]}); - mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsAntiLambdaMass, HistTable), getHistDesc(kK0shortMassVsAntiLambdaMass, HistTable), getHistType(kK0shortMassVsAntiLambdaMass, HistTable), {V0Specs[kK0shortMassVsAntiLambdaMass]}); + initQa(V0Specs); } } + template + void enableOptionalHistograms(T1 const& V0ConfBinningQa, T2 const& PosDauConfBinningQa, T3 const& NegDauConfBinningQa) + { + mPosDauManager.enableOptionalHistograms(PosDauConfBinningQa); + mNegDauManager.enableOptionalHistograms(NegDauConfBinningQa); + mPlot2d = V0ConfBinningQa.plot2d.value; + } + + template + void init(o2::framework::HistogramRegistry* registry, + std::map> const& V0Specs, + T1 const& V0ConfBinningQa, + std::map> const& PosDauSpecs, + T2 const& PosDauConfBinningQa, + std::map> const& NegDauSpecs, + T3 const& NegDauConfBinningQa) + { + enableOptionalHistograms(V0ConfBinningQa, PosDauConfBinningQa, NegDauConfBinningQa); + init(registry, V0Specs, PosDauSpecs, NegDauSpecs); + } + template void fill(T1 const& v0candidate, T2 const& tracks) { @@ -268,27 +258,82 @@ class V0HistManager mNegDauManager.fill(negDaughter, tracks); if constexpr (modes::isFlagSet(mode, modes::Mode::kAnalysis)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), v0candidate.pt()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), v0candidate.eta()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), v0candidate.phi()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), v0candidate.mass()); + fillAnalysis(v0candidate); + } + if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { + fillQa(v0candidate); + } + } - if constexpr (modes::isEqual(v0, modes::V0::kLambda) || modes::isEqual(v0, modes::V0::kAntiLambda)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), v0candidate.sign()); - } - if constexpr (modes::isEqual(v0, modes::V0::kK0short)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); - } + private: + void initAnalysis(std::map> const& V0Specs) + { + std::string analysisDir = std::string(v0Prefix) + std::string(AnalysisDir); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPt, HistTable), getHistDesc(kPt, HistTable), getHistType(kPt, HistTable), {V0Specs.at(kPt)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kEta, HistTable), getHistDesc(kEta, HistTable), getHistType(kEta, HistTable), {V0Specs.at(kEta)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kPhi, HistTable), getHistDesc(kPhi, HistTable), getHistType(kPhi, HistTable), {V0Specs.at(kPhi)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kMass, HistTable), getHistDesc(kMass, HistTable), getHistType(kMass, HistTable), {V0Specs.at(kMass)}); + mHistogramRegistry->add(analysisDir + getHistNameV2(kSign, HistTable), getHistDesc(kSign, HistTable), getHistType(kSign, HistTable), {V0Specs.at(kSign)}); + } + + void initQa(std::map> const& V0Specs) + { + std::string qaDir = std::string(v0Prefix) + std::string(QaDir); + + mHistogramRegistry->add(qaDir + getHistNameV2(kCosPa, HistTable), getHistDesc(kCosPa, HistTable), getHistType(kCosPa, HistTable), {V0Specs.at(kCosPa)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayDauDca, HistTable), getHistDesc(kDecayDauDca, HistTable), getHistType(kDecayDauDca, HistTable), {V0Specs.at(kDecayDauDca)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxX, HistTable), getHistDesc(kDecayVtxX, HistTable), getHistType(kDecayVtxX, HistTable), {V0Specs.at(kDecayVtxX)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxY, HistTable), getHistDesc(kDecayVtxY, HistTable), getHistType(kDecayVtxY, HistTable), {V0Specs.at(kDecayVtxY)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtxZ, HistTable), getHistDesc(kDecayVtxZ, HistTable), getHistType(kDecayVtxZ, HistTable), {V0Specs.at(kDecayVtxZ)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kDecayVtx, HistTable), getHistDesc(kDecayVtx, HistTable), getHistType(kDecayVtx, HistTable), {V0Specs.at(kDecayVtx)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kTransRadius, HistTable), getHistDesc(kTransRadius, HistTable), getHistType(kTransRadius, HistTable), {V0Specs.at(kTransRadius)}); + + if (mPlot2d) { + 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(kMassLambda, HistTable), getHistDesc(kMassLambda, HistTable), getHistType(kMassLambda, HistTable), {V0Specs.at(kMassLambda)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassAntiLambda, HistTable), getHistDesc(kMassAntiLambda, HistTable), getHistType(kMassAntiLambda, HistTable), {V0Specs.at(kMassAntiLambda)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kMassK0short, HistTable), getHistDesc(kMassK0short, HistTable), getHistType(kMassK0short, HistTable), {V0Specs.at(kMassK0short)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsLambdaMass, HistTable), getHistDesc(kPtVsLambdaMass, HistTable), getHistType(kPtVsLambdaMass, HistTable), {V0Specs.at(kPtVsLambdaMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsAntiLambdaMass, HistTable), getHistDesc(kPtVsAntiLambdaMass, HistTable), getHistType(kPtVsAntiLambdaMass, HistTable), {V0Specs.at(kPtVsAntiLambdaMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kPtVsK0shortMass, HistTable), getHistDesc(kPtVsK0shortMass, HistTable), getHistType(kPtVsK0shortMass, HistTable), {V0Specs.at(kPtVsK0shortMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kLambdaMassVsAntiLambdaMass, HistTable), getHistDesc(kLambdaMassVsAntiLambdaMass, HistTable), getHistType(kLambdaMassVsAntiLambdaMass, HistTable), {V0Specs.at(kLambdaMassVsAntiLambdaMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsLambdaMass, HistTable), getHistDesc(kK0shortMassVsLambdaMass, HistTable), getHistType(kK0shortMassVsLambdaMass, HistTable), {V0Specs.at(kK0shortMassVsLambdaMass)}); + mHistogramRegistry->add(qaDir + getHistNameV2(kK0shortMassVsAntiLambdaMass, HistTable), getHistDesc(kK0shortMassVsAntiLambdaMass, HistTable), getHistType(kK0shortMassVsAntiLambdaMass, HistTable), {V0Specs.at(kK0shortMassVsAntiLambdaMass)}); } + } - if constexpr (modes::isFlagSet(mode, modes::Mode::kQa)) { - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), v0candidate.cosPa()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), v0candidate.dauDca()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), v0candidate.decayVtxX()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), v0candidate.decayVtxY()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), v0candidate.decayVtxZ()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), v0candidate.decayVtx()); - mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), v0candidate.transRadius()); + template + void fillAnalysis(T const& v0candidate) + { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPt, HistTable)), v0candidate.pt()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kEta, HistTable)), v0candidate.eta()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kPhi, HistTable)), v0candidate.phi()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kMass, HistTable)), v0candidate.mass()); + + if constexpr (modes::isEqual(v0, modes::V0::kLambda) || modes::isEqual(v0, modes::V0::kAntiLambda)) { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), v0candidate.sign()); + } + if constexpr (modes::isEqual(v0, modes::V0::kK0short)) { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(AnalysisDir) + HIST(getHistName(kSign, HistTable)), 0); + } + } + + template + void fillQa(T const& v0candidate) + { + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kCosPa, HistTable)), v0candidate.cosPa()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayDauDca, HistTable)), v0candidate.dauDca()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxX, HistTable)), v0candidate.decayVtxX()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxY, HistTable)), v0candidate.decayVtxY()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtxZ, HistTable)), v0candidate.decayVtxZ()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kDecayVtx, HistTable)), v0candidate.decayVtx()); + mHistogramRegistry->fill(HIST(v0Prefix) + HIST(QaDir) + HIST(getHistName(kTransRadius, HistTable)), v0candidate.transRadius()); + + if (mPlot2d) { 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()); @@ -328,9 +373,8 @@ class V0HistManager } } - private: o2::framework::HistogramRegistry* mHistogramRegistry = nullptr; - + bool mPlot2d = true; trackhistmanager::TrackHistManager mPosDauManager; trackhistmanager::TrackHistManager mNegDauManager; }; diff --git a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx index 4b953363dae..274e572c5bc 100644 --- a/PWGCF/Femto/Tasks/femtoCascadeQa.cxx +++ b/PWGCF/Femto/Tasks/femtoCascadeQa.cxx @@ -109,7 +109,7 @@ struct FemtoCascadeQa { { // create a map for histogram specs auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, colHistSpec); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); auto bachelorHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confBachelorBinning, confBachelorQaBinning); auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); @@ -121,12 +121,12 @@ struct FemtoCascadeQa { if (doprocessXis) { auto xiHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confXiBinning, confXiQaBinning); - xiHistManager.init(&hRegistry, xiHistSpec, bachelorHistSpec, posDaughterHistSpec, negDaughterHistSpec); + xiHistManager.init(&hRegistry, xiHistSpec, confXiQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } if (doprocessOmegas) { auto omegaHistSpec = cascadehistmanager::makeCascadeQaHistSpecMap(confOmegaBinning, confOmegaQaBinning); - omegaHistManager.init(&hRegistry, omegaHistSpec, bachelorHistSpec, posDaughterHistSpec, negDaughterHistSpec); + omegaHistManager.init(&hRegistry, omegaHistSpec, confOmegaQaBinning, bachelorHistSpec, confBachelorQaBinning, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } }; diff --git a/PWGCF/Femto/Tasks/femtoKinkQa.cxx b/PWGCF/Femto/Tasks/femtoKinkQa.cxx index 2b900fa417d..6f19b159984 100644 --- a/PWGCF/Femto/Tasks/femtoKinkQa.cxx +++ b/PWGCF/Femto/Tasks/femtoKinkQa.cxx @@ -91,10 +91,10 @@ struct FemtoKinkQa { auto sigmaHistSpec = kinkhistmanager::makeKinkQaHistSpecMap(confSigmaBinning, confSigmaQaBinning); auto chaDauHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confKinkChaDaughterBinning, confKinkChaDaughterQaBinning); - sigmaHistManager.init(&hRegistry, sigmaHistSpec, chaDauHistSpec); + sigmaHistManager.init(&hRegistry, sigmaHistSpec, confSigmaQaBinning, chaDauHistSpec, confKinkChaDaughterQaBinning); auto collisionHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, collisionHistSpec); + colHistManager.init(&hRegistry, collisionHistSpec, confCollisionQaBinning); }; // Process function for sigma particles from femto tables diff --git a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx index ee7d9d5e409..a6b976bcb75 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackCascade.cxx @@ -101,8 +101,12 @@ struct FemtoPairTrackCascade { trackhistmanager::PrefixCascadeNegDaughter, pairhistmanager::PrefixTrackCascadeSe, pairhistmanager::PrefixTrackCascadeMe, - closepairrejection::PrefixTrackCascadeSe, - closepairrejection::PrefixTrackCascadeMe, + closepairrejection::PrefixTrackCascadeBachelorSe, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackCascadeBachelorMe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::Cascade::kXi> pairTrackXiBuilder; @@ -115,8 +119,12 @@ struct FemtoPairTrackCascade { trackhistmanager::PrefixCascadeNegDaughter, pairhistmanager::PrefixTrackCascadeSe, pairhistmanager::PrefixTrackCascadeMe, - closepairrejection::PrefixTrackCascadeSe, - closepairrejection::PrefixTrackCascadeMe, + closepairrejection::PrefixTrackCascadeBachelorSe, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackCascadeBachelorMe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::Cascade::kOmega> pairTrackOmegaBuilder; @@ -133,7 +141,7 @@ struct FemtoPairTrackCascade { HistogramRegistry hRegistry{"FemtoTrackCascade", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprTrrackCascade confCpr; void init(InitContext&) { @@ -157,14 +165,14 @@ struct FemtoPairTrackCascade { if (doprocessXiSameEvent || doprocessXiMixedEvent) { auto xiHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confXiBinning); auto pairTrackXiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confXiBinning); - pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCpr, confMixing, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpec); + pairTrackXiBuilder.init(&hRegistry, trackSelection, xiSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, xiHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackXiHistSpec, cprHistSpec); } // setup for omegas if (doprocessOmegaSameEvent || doprocessOmegaMixedEvent) { auto omegaHistSpec = cascadehistmanager::makeCascadeHistSpecMap(confOmegaBinning); auto pairTrackOmegaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confOmegaBinning); - pairTrackOmegaBuilder.init(&hRegistry, trackSelection, omegaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpec); + pairTrackOmegaBuilder.init(&hRegistry, trackSelection, omegaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, omegaHistSpec, bachelorHistSpec, posDauSpec, negDauSpec, pairTrackOmegaHistSpec, cprHistSpec); } if (((doprocessXiSameEvent || doprocessXiMixedEvent) + (doprocessOmegaSameEvent || doprocessOmegaMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx index d0fd689fe21..6c8af2f5bff 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackKink.cxx @@ -131,7 +131,7 @@ struct FemtoPairTrackKink { // if (doprocessSigmaSameEvent || doprocessSigmaMixedEvent) { if (doprocessSigmaSameEvent) { auto sigmaHistSpec = kinkhistmanager::makeKinkHistSpecMap(confSigmaBinning); - pairTrackSigmaBuilder.init(&hRegistry, trackSelection, sigmaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairHistSpec, cprHistSpec); + pairTrackSigmaBuilder.init(&hRegistry, trackSelection, sigmaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, sigmaHistSpec, chaDauSpec, pairHistSpec, cprHistSpec); } }; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index 517478ed117..f58fbe2a075 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -1,4 +1,4 @@ -// Copyright 2019-2025 CERN and copyright holders of ALICE O2. +// Copyright 2019-2025 CERN and copyright holders of ALICE O2.tracktrack // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. // All rights not expressly granted are reserved. // @@ -114,7 +114,7 @@ struct FemtoPairTrackTrack { auto pairHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning1, confTrackBinning2); auto cprHistSpec = closepairrejection::makeCprHistSpecMap(confCpr); - pairTrackTrackBuilder.init(&hRegistry, trackSelections1, trackSelections2, confCpr, confMixing, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); + pairTrackTrackBuilder.init(&hRegistry, trackSelections1, trackSelections2, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec1, trackHistSpec2, pairHistSpec, cprHistSpec); }; void processSameEvent(FilteredCollision const& col, Tracks const& tracks) diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx index 73a340cde8a..16e773da509 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTwoTrackResonance.cxx @@ -107,8 +107,10 @@ struct FemtoPairTrackTwoTrackResonance { trackhistmanager::PrefixResonanceNegDaughter, pairhistmanager::PrefixTrackResonanceSe, pairhistmanager::PrefixTrackResonanceMe, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::TwoTrackResonance::kPhi> pairTrackPhiBuilder; @@ -121,8 +123,10 @@ struct FemtoPairTrackTwoTrackResonance { trackhistmanager::PrefixResonanceNegDaughter, pairhistmanager::PrefixTrackResonanceSe, pairhistmanager::PrefixTrackResonanceMe, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::TwoTrackResonance::kKstar0> pairTrackKstar0Builder; @@ -135,8 +139,10 @@ struct FemtoPairTrackTwoTrackResonance { trackhistmanager::PrefixResonanceNegDaughter, pairhistmanager::PrefixTrackResonanceSe, pairhistmanager::PrefixTrackResonanceMe, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::TwoTrackResonance::kRho0> pairTrackRho0Builder; @@ -153,7 +159,7 @@ struct FemtoPairTrackTwoTrackResonance { HistogramRegistry hRegistry{"FemtoTrackTwoTrackResonance", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprTrackV0 confCpr; void init(InitContext&) { @@ -179,21 +185,21 @@ struct FemtoPairTrackTwoTrackResonance { if (doprocessPhiSameEvent || doprocessPhiMixedEvent) { auto phiHistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confPhiBinning); auto pairTrackPhiHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confPhiBinning); - pairTrackPhiBuilder.init(&hRegistry, trackSelection, phiSelection, confCpr, confMixing, colHistSpec, trackHistSpec, phiHistSpec, posDauSpec, negDauSpec, pairTrackPhiHistSpec, cprHistSpec); + pairTrackPhiBuilder.init(&hRegistry, trackSelection, phiSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, phiHistSpec, posDauSpec, negDauSpec, pairTrackPhiHistSpec, cprHistSpec); } // setup for kstar0 if (doprocessKstar0SameEvent || doprocessKstar0MixedEvent) { auto kstar0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confKstar0Binning); auto pairTrackKstar0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confKstar0Binning); - pairTrackKstar0Builder.init(&hRegistry, trackSelection, kstar0Selection, confCpr, confMixing, colHistSpec, trackHistSpec, kstar0HistSpec, posDauSpec, negDauSpec, pairTrackKstar0HistSpec, cprHistSpec); + pairTrackKstar0Builder.init(&hRegistry, trackSelection, kstar0Selection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, kstar0HistSpec, posDauSpec, negDauSpec, pairTrackKstar0HistSpec, cprHistSpec); } // setup for kstar0 if (doprocessRho0SameEvent || doprocessRho0MixedEvent) { auto rho0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceHistSpecMap(confRho0Binning); auto pairTrackRho0HistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confRho0Binning); - pairTrackRho0Builder.init(&hRegistry, trackSelection, rho0Selection, confCpr, confMixing, colHistSpec, trackHistSpec, rho0HistSpec, posDauSpec, negDauSpec, pairTrackRho0HistSpec, cprHistSpec); + pairTrackRho0Builder.init(&hRegistry, trackSelection, rho0Selection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, rho0HistSpec, posDauSpec, negDauSpec, pairTrackRho0HistSpec, cprHistSpec); } }; diff --git a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx index 64fcb671314..9b92a7959e4 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackV0.cxx @@ -99,8 +99,10 @@ struct FemtoPairTrackV0 { trackhistmanager::PrefixV0NegDaughter1, pairhistmanager::PrefixTrackV0Se, pairhistmanager::PrefixTrackV0Me, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::V0::kLambda> pairTrackLambdaBuilder; @@ -112,8 +114,10 @@ struct FemtoPairTrackV0 { trackhistmanager::PrefixV0NegDaughter1, pairhistmanager::PrefixTrackV0Se, pairhistmanager::PrefixTrackV0Me, - closepairrejection::PrefixTrackV0Se, - closepairrejection::PrefixTrackV0Me, + closepairrejection::PrefixTrackV0SameChargeSe, + closepairrejection::PrefixTrackV0SameChargeMe, + closepairrejection::PrefixTrackV0OppositeChargeSe, + closepairrejection::PrefixTrackV0OppositeChargeMe, modes::Mode::kAnalysis, modes::V0::kK0short> pairTrackK0shortBuilder; @@ -130,7 +134,7 @@ struct FemtoPairTrackV0 { HistogramRegistry hRegistry{"FemtoTrackV0", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprTrackV0 confCpr; void init(InitContext&) { @@ -152,14 +156,14 @@ struct FemtoPairTrackV0 { if (doprocessLambdaSameEvent || doprocessLambdaMixedEvent) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); auto pairTrackLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); - pairTrackLambdaBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackLambdaHistSpec, cprHistSpec); + pairTrackLambdaBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairTrackLambdaHistSpec, cprHistSpec); } // setup for k0short if (doprocessK0shortSameEvent || doprocessK0shortMixedEvent) { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); auto pairTrackK0shortHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confTrackBinning, confLambdaBinning); - pairTrackK0shortBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackK0shortHistSpec, cprHistSpec); + pairTrackK0shortBuilder.init(&hRegistry, trackSelection, lambdaSelection, confCpr, confMixing, confPairBinning, colHistSpec, trackHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairTrackK0shortHistSpec, cprHistSpec); } if (((doprocessLambdaSameEvent || doprocessLambdaMixedEvent) + (doprocessK0shortSameEvent || doprocessK0shortMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx index bda347ad110..61356c41aa7 100644 --- a/PWGCF/Femto/Tasks/femtoPairV0V0.cxx +++ b/PWGCF/Femto/Tasks/femtoPairV0V0.cxx @@ -134,7 +134,7 @@ struct FemtoPairV0V0 { HistogramRegistry hRegistry{"FemtoTrackV0", {}, OutputObjHandlingPolicy::AnalysisObject}; // setup cpr - closepairrejection::ConfCpr confCpr; + closepairrejection::ConfCprV0V0 confCpr; void init(InitContext&) { @@ -155,14 +155,14 @@ struct FemtoPairV0V0 { if (doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) { auto lambdaHistSpec = v0histmanager::makeV0HistSpecMap(confLambdaBinning); auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confLambdaBinning, confLambdaBinning); - pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCpr, confMixing, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + pairLambdaLambdaBuilder.init(&hRegistry, lambdaSelection, lambdaSelection, confCpr, confMixing, confPairBinning, colHistSpec, lambdaHistSpec, lambdaHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); } // setup for k0short if (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent) { auto k0shortHistSpec = v0histmanager::makeV0HistSpecMap(confK0shortBinning); auto pairLambdaLambdaHistSpec = pairhistmanager::makePairHistSpecMap(confPairBinning, confLambdaBinning, confLambdaBinning); - pairLambdaLambdaBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCpr, confMixing, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); + pairLambdaLambdaBuilder.init(&hRegistry, k0shortSelection, k0shortSelection, confCpr, confMixing, confPairBinning, colHistSpec, k0shortHistSpec, k0shortHistSpec, posDauSpec, negDauSpec, pairLambdaLambdaHistSpec, cprHistSpec); } if (((doprocessLambdaLambdaSameEvent || doprocessLambdaLambdaMixedEvent) + (doprocessK0shortK0shortSameEvent || doprocessK0shortK0shortMixedEvent)) > 1) { diff --git a/PWGCF/Femto/Tasks/femtoTrackQa.cxx b/PWGCF/Femto/Tasks/femtoTrackQa.cxx index d78679ccf1b..ddc9aeb4806 100644 --- a/PWGCF/Femto/Tasks/femtoTrackQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTrackQa.cxx @@ -73,9 +73,9 @@ struct FemtoTrackQa { { // create a map for histogram specs auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, colHistSpec); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); auto trackHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confTrackBinning, confTrackQaBinning); - trackHistManager.init(&hRegistry, trackHistSpec, trackSelections.chargeAbs.value, confTrackQaBinning.momentumType.value); + trackHistManager.init(&hRegistry, trackHistSpec, confTrackQaBinning, trackSelections.chargeAbs.value); }; void process(FilteredFemtoCollision const& col, FemtoTracks const& tracks) diff --git a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx index c92d6537170..501312fb3f0 100644 --- a/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx +++ b/PWGCF/Femto/Tasks/femtoTwotrackresonanceQa.cxx @@ -118,7 +118,7 @@ struct FemtoTwotrackresonanceQa { { // create a map for histogram specs auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, colHistSpec); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confPosDaughterBinning, confPosDaughterQaBinning); auto negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confNegDaughterBinning, confNegDaughterQaBinning); @@ -129,16 +129,16 @@ struct FemtoTwotrackresonanceQa { if (doprocessPhis) { auto phiHistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceQaHistSpecMap(confPhiBinning); - phiHistManager.init(&hRegistry, phiHistSpec, posDaughterHistSpec, negDaughterHistSpec); + phiHistManager.init(&hRegistry, phiHistSpec, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } if (doprocessRho0s) { auto rho0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceQaHistSpecMap(confRho0Binning); - rho0HistManager.init(&hRegistry, rho0HistSpec, posDaughterHistSpec, negDaughterHistSpec); + rho0HistManager.init(&hRegistry, rho0HistSpec, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } if (doprocessKstar0s) { auto kstar0HistSpec = twotrackresonancehistmanager::makeTwoTrackResonanceQaHistSpecMap(confKstar0Binning); - kstar0HistManager.init(&hRegistry, kstar0HistSpec, posDaughterHistSpec, negDaughterHistSpec); + kstar0HistManager.init(&hRegistry, kstar0HistSpec, posDaughterHistSpec, confPosDaughterQaBinning, negDaughterHistSpec, confNegDaughterQaBinning); } }; diff --git a/PWGCF/Femto/Tasks/femtoV0Qa.cxx b/PWGCF/Femto/Tasks/femtoV0Qa.cxx index 1249664fa4c..20f6f1d0d0e 100644 --- a/PWGCF/Femto/Tasks/femtoV0Qa.cxx +++ b/PWGCF/Femto/Tasks/femtoV0Qa.cxx @@ -106,7 +106,7 @@ struct FemtoV0Qa { { // create a map for histogram specs auto colHistSpec = colhistmanager::makeColQaHistSpecMap(confCollisionBinning, confCollisionQaBinning); - colHistManager.init(&hRegistry, colHistSpec); + colHistManager.init(&hRegistry, colHistSpec, confCollisionQaBinning); auto posDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confV0PosDaughterBinning, confV0PosDaughterQaBinning); auto negDaughterHistSpec = trackhistmanager::makeTrackQaHistSpecMap(confV0NegDaughterBinning, confV0NegDaughterQaBinning); @@ -117,12 +117,12 @@ struct FemtoV0Qa { if (doprocessLambda) { auto lambdaHistSpec = v0histmanager::makeV0QaHistSpecMap(confLambdaBinning, confLambdaQaBinning); - lambdaHistManager.init(&hRegistry, lambdaHistSpec, posDaughterHistSpec, negDaughterHistSpec); + lambdaHistManager.init(&hRegistry, lambdaHistSpec, confLambdaQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); } if (doprocessK0short) { auto k0shortHistSpec = v0histmanager::makeV0QaHistSpecMap(confK0shortBinning, confK0shortQaBinning); - k0shortHistManager.init(&hRegistry, k0shortHistSpec, posDaughterHistSpec, negDaughterHistSpec); + k0shortHistManager.init(&hRegistry, k0shortHistSpec, confK0shortQaBinning, posDaughterHistSpec, confV0PosDaughterQaBinning, negDaughterHistSpec, confV0NegDaughterQaBinning); } }; From a556d6b718687261a90977f1686f69052cf9b476 Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Mon, 27 Oct 2025 23:04:52 +0100 Subject: [PATCH 2/3] Fix: fix file header --- PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx index f58fbe2a075..e905757ef85 100644 --- a/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx +++ b/PWGCF/Femto/Tasks/femtoPairTrackTrack.cxx @@ -1,4 +1,4 @@ -// Copyright 2019-2025 CERN and copyright holders of ALICE O2.tracktrack +// Copyright 2019-2025 CERN and copyright holders of ALICE O2. // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. // All rights not expressly granted are reserved. // From 0b9a2bcfe680410ed49e5a4fa84790e90e70d3e3 Mon Sep 17 00:00:00 2001 From: Anton Riedel Date: Mon, 27 Oct 2025 23:12:53 +0100 Subject: [PATCH 3/3] Feat: fix linter warnings --- PWGCF/Femto/Core/closePairRejection.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PWGCF/Femto/Core/closePairRejection.h b/PWGCF/Femto/Core/closePairRejection.h index 7395e35b691..c574398c432 100644 --- a/PWGCF/Femto/Core/closePairRejection.h +++ b/PWGCF/Femto/Core/closePairRejection.h @@ -109,8 +109,8 @@ struct ConfCprTrrackCascade : o2::framework::ConfigurableGroup { }; // tpc radii for computing phistar -constexpr int kNradii = 9; -constexpr std::array kTpcRadius = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; // in cm +constexpr int Nradii = 9; +constexpr std::array TpcRadii = {85., 105., 125., 145., 165., 185., 205., 225., 245.}; // in cm // directory names constexpr char PrefixTrackTrackSe[] = "CPR_TrackTrack/SE/"; @@ -222,9 +222,9 @@ class CloseTrackRejection mDphistar.fill(0.f); mDeta = track1.eta() - track2.eta(); - for (size_t i = 0; i < kTpcRadius.size(); i++) { - auto phistar1 = utils::dphistar(mMagField, kTpcRadius[i], mChargeAbsTrack1 * track1.signedPt(), track1.phi()); - auto phistar2 = utils::dphistar(mMagField, kTpcRadius[i], mChargeAbsTrack2 * track2.signedPt(), track2.phi()); + for (size_t i = 0; i < TpcRadii.size(); i++) { + auto phistar1 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack1 * track1.signedPt(), track1.phi()); + auto phistar2 = utils::dphistar(mMagField, TpcRadii[i], mChargeAbsTrack2 * track2.signedPt(), track2.phi()); if (phistar1 && phistar2) { // if the calculation for one phistar fails, keep the default value, which is 0 // this makes it more likelier for the pair to be rejected sind the averave will be biased towards lower values @@ -273,7 +273,7 @@ class CloseTrackRejection float mAverageDphistar = 0.f; float mDeta = 0.f; - std::array mDphistar = {0.f}; + std::array mDphistar = {0.f}; bool mPlotOnly = true; };