2626
2727using namespace o2 ;
2828using namespace o2 ::analysis;
29+ using namespace o2 ::constants::math;
2930using namespace o2 ::framework;
3031using namespace o2 ::framework::expressions;
3132
@@ -35,10 +36,40 @@ enum Channel : uint8_t {
3536 NChannels
3637};
3738
39+ namespace o2 ::aod
40+ {
41+ namespace hf_charm_cand_lite
42+ {
43+ DECLARE_SOA_COLUMN (M, m, float ); // ! Invariant mass of candidate (GeV/c2)
44+ DECLARE_SOA_COLUMN (Pt, pt, float ); // ! Transverse momentum of candidate (GeV/c)
45+ DECLARE_SOA_COLUMN (Y, y, float ); // ! Rapidity of candidate
46+ DECLARE_SOA_COLUMN (Phi, phi, float ); // ! Azimuth angle of candidate
47+ DECLARE_SOA_COLUMN (ImpactParameterXY, impactParameterXY, float ); // ! Dca XY of candidate
48+ DECLARE_SOA_COLUMN (MlScoreBkg, mlScoreBkg, float ); // ! ML score for background class
49+ DECLARE_SOA_COLUMN (MlScorePrompt, mlScorePrompt, float ); // ! ML Prompt score for prompt class
50+ DECLARE_SOA_COLUMN (MlScoreNonPrompt, mlScoreNonPrompt, float ); // ! ML Non Prompt score for non prompt class
51+ } // namespace hf_charm_cand_lite
52+
53+ DECLARE_SOA_TABLE (HfCharmCandLites, " AOD" , " HFCHARMCANDLITE" , // ! Table with some B+ properties
54+ hf_charm_cand_lite::M,
55+ hf_charm_cand_lite::Pt,
56+ hf_charm_cand_lite::Y,
57+ hf_charm_cand_lite::Phi,
58+ hf_charm_cand_lite::ImpactParameterXY,
59+ hf_charm_cand_lite::MlScoreBkg,
60+ hf_charm_cand_lite::MlScorePrompt,
61+ hf_charm_cand_lite::MlScoreNonPrompt);
62+ } // namespace o2::aod
63+
3864struct HfTaskCharmHadImpactPar {
65+ Produces<aod::HfCharmCandLites> hfCharmCandLite;
66+
3967 Configurable<int > selectionFlag{" selectionFlag" , 15 , " Selection Flag for the considered charm hadron" };
68+ Configurable<int > fillLightTreeCandidate{" fillLightTreeCandidate" , 0 , " Flag to store charm hadron features" };
4069 ConfigurableAxis axisPt{" axisPt" , {0 .f , 1 .f , 2 .f , 3 .f , 4 .f , 5 .f , 6 .f , 8 .f , 10 .f , 12 .f , 16 .f , 24 .f , 36 .f , 50 .f }, " axis for pT of charm hadron" };
4170 ConfigurableAxis axisMass{" axisMass" , {250 , 1 .65f , 2 .15f }, " axis for mass of charm hadron" };
71+ ConfigurableAxis axisPhi{" axisPhi" , {180 , 0 .f , 2 * PI}, " axis for azimuthal angle of charm hadron" };
72+ ConfigurableAxis axisY{" axisY" , {20 , -1 .f , 1 .f }, " axis for rapidity of charm hadron" };
4273 ConfigurableAxis axisImpPar{" axisImpPar" , {2000 , -500 .f , 500 .f }, " axis for impact-parameter of charm hadron" };
4374 ConfigurableAxis axisMlScore0{" axisMlScore0" , {100 , 0 .f , 1 .f }, " axis for ML output score 0" };
4475 ConfigurableAxis axisMlScore1{" axisMlScore1" , {100 , 0 .f , 1 .f }, " axis for ML output score 1" };
@@ -63,9 +94,9 @@ struct HfTaskCharmHadImpactPar {
6394 LOGP (fatal, " Only one process function should be enabled! Please check your configuration!" );
6495 }
6596 if (doprocessDplus || doprocessDzero) {
66- registry.add (" hMassPtImpPar " , " ;#it{M} (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c});dca XY (#mum);" , HistType::kTHnSparseF , {axisMass, axisPt, axisImpPar});
97+ registry.add (" hMassPtImpParPhiY " , " ;#it{M} (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c});dca XY (#mum); phi; y; " , HistType::kTHnSparseF , {axisMass, axisPt, axisImpPar, axisPhi, axisY });
6798 } else if (doprocessDplusWithMl || doprocessDzeroWithMl) {
68- registry.add (" hMassPtImpPar " , " ;#it{M} (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c});dca XY (#mum);ML score 0;ML score 1; ML score 2;" , HistType::kTHnSparseF , {axisMass, axisPt, axisImpPar, axisMlScore0, axisMlScore1, axisMlScore2});
99+ registry.add (" hMassPtImpParPhiY " , " ;#it{M} (GeV/#it{c}^{2});#it{p}_{T} (GeV/#it{c});dca XY (#mum); phi; y; ML score 0;ML score 1; ML score 2;" , HistType::kTHnSparseF , {axisMass, axisPt, axisImpPar, axisPhi, axisY , axisMlScore0, axisMlScore1, axisMlScore2});
69100 }
70101 }
71102
@@ -76,40 +107,92 @@ struct HfTaskCharmHadImpactPar {
76107 {
77108 std::vector<float > outputMl = {-999 ., -999 ., -999 .};
78109 float invMass{-1 .f };
110+ float yCand{-999 .f };
79111 if constexpr (channel == Channel::DplusToKPiPi) { // D+ -> Kpipi
80112 invMass = hfHelper.invMassDplusToPiKPi (candidate);
113+ yCand = hfHelper.yDplus (candidate);
81114 if constexpr (withMl) {
82115 for (auto iScore{0u }; iScore < candidate.mlProbDplusToPiKPi ().size (); ++iScore) {
83116 outputMl[iScore] = candidate.mlProbDplusToPiKPi ()[iScore];
84117 }
85- registry.fill (HIST (" hMassPtImpPar " ), invMass, candidate.pt (), candidate.impactParameterXY (), outputMl[0 ], outputMl[1 ], outputMl[2 ]);
118+ registry.fill (HIST (" hMassPtImpParPhiY " ), invMass, candidate.pt (), candidate.impactParameterXY (), candidate. phi (), yCand , outputMl[0 ], outputMl[1 ], outputMl[2 ]);
86119 } else {
87- registry.fill (HIST (" hMassPtImpPar " ), invMass, candidate.pt (), candidate.impactParameterXY ());
120+ registry.fill (HIST (" hMassPtImpParPhiY " ), invMass, candidate.pt (), candidate.impactParameterXY (), candidate. phi (), yCand );
88121 }
89122 } else if constexpr (channel == Channel::DzeroToKPi) {
90123 if (candidate.isSelD0 ()) { // D0 -> Kpi
91124 invMass = hfHelper.invMassD0ToPiK (candidate);
125+ yCand = hfHelper.yD0 (candidate);
92126 if constexpr (withMl) {
93127 for (auto iScore{0u }; iScore < candidate.mlProbD0 ().size (); ++iScore) {
94128 outputMl[iScore] = candidate.mlProbD0 ()[iScore];
95129 }
96- registry.fill (HIST (" hMassPtImpPar " ), invMass, candidate.pt (), candidate.impactParameterXY (), outputMl[0 ], outputMl[1 ], outputMl[2 ]);
130+ registry.fill (HIST (" hMassPtImpParPhiY " ), invMass, candidate.pt (), candidate.impactParameterXY (), candidate. phi (), yCand , outputMl[0 ], outputMl[1 ], outputMl[2 ]);
97131 } else {
98- registry.fill (HIST (" hMassPtImpPar " ), invMass, candidate.pt (), candidate.impactParameterXY ());
132+ registry.fill (HIST (" hMassPtImpParPhiY " ), invMass, candidate.pt (), candidate.impactParameterXY (), candidate. phi (), yCand );
99133 }
100134 }
101135 if (candidate.isSelD0bar ()) {
102136 invMass = hfHelper.invMassD0barToKPi (candidate);
137+ yCand = hfHelper.yD0 (candidate);
103138 if constexpr (withMl) {
104139 for (auto iScore{0u }; iScore < candidate.mlProbD0bar ().size (); ++iScore) {
105140 outputMl[iScore] = candidate.mlProbD0bar ()[iScore];
106141 }
107- registry.fill (HIST (" hMassPtImpPar " ), invMass, candidate.pt (), candidate.impactParameterXY (), outputMl[0 ], outputMl[1 ], outputMl[2 ]);
142+ registry.fill (HIST (" hMassPtImpParPhiY " ), invMass, candidate.pt (), candidate.impactParameterXY (), candidate. phi (), yCand , outputMl[0 ], outputMl[1 ], outputMl[2 ]);
108143 } else {
109- registry.fill (HIST (" hMassPtImpPar" ), invMass, candidate.pt (), candidate.impactParameterXY ());
144+ registry.fill (HIST (" hMassPtImpParPhiY" ), invMass, candidate.pt (), candidate.impactParameterXY (), candidate.phi (), yCand);
145+ }
146+ }
147+ }
148+ }
149+
150+ // Fill THnSparses for the ML analysis
151+ // / \param candidate is a particle candidate
152+ template <Channel channel, bool withMl, typename CCands>
153+ void fillTree (const CCands& candidate)
154+ {
155+ std::vector<float > outputMl = {-999 ., -999 ., -999 .};
156+ float invMass{-1 .f };
157+ float yCand{-999 .f };
158+ if constexpr (channel == Channel::DplusToKPiPi) { // D+ -> Kpipi
159+ invMass = hfHelper.invMassDplusToPiKPi (candidate);
160+ yCand = hfHelper.yDplus (candidate);
161+ if constexpr (withMl) {
162+ for (auto iScore{0u }; iScore < candidate.mlProbDplusToPiKPi ().size (); ++iScore) {
163+ outputMl[iScore] = candidate.mlProbDplusToPiKPi ()[iScore];
164+ }
165+ }
166+ } else if constexpr (channel == Channel::DzeroToKPi) {
167+ if (candidate.isSelD0 ()) { // D0 -> Kpi
168+ invMass = hfHelper.invMassD0ToPiK (candidate);
169+ yCand = hfHelper.yD0 (candidate);
170+ if constexpr (withMl) {
171+ for (auto iScore{0u }; iScore < candidate.mlProbD0 ().size (); ++iScore) {
172+ outputMl[iScore] = candidate.mlProbD0 ()[iScore];
173+ }
174+ }
175+ }
176+ if (candidate.isSelD0bar ()) {
177+ invMass = hfHelper.invMassD0barToKPi (candidate);
178+ yCand = hfHelper.yD0 (candidate);
179+ if constexpr (withMl) {
180+ for (auto iScore{0u }; iScore < candidate.mlProbD0bar ().size (); ++iScore) {
181+ outputMl[iScore] = candidate.mlProbD0bar ()[iScore];
182+ }
110183 }
111184 }
112185 }
186+ hfCharmCandLite (
187+ // Charm candidate meson features
188+ invMass,
189+ candidate.pt (),
190+ yCand,
191+ candidate.phi (),
192+ candidate.impactParameterXY (),
193+ outputMl[0 ],
194+ outputMl[1 ],
195+ outputMl[2 ]);
113196 }
114197
115198 // / \param candidates are reconstructed candidates
@@ -118,6 +201,9 @@ struct HfTaskCharmHadImpactPar {
118201 {
119202 for (auto const & candidate : candidates) {
120203 fillSparse<channel, withMl>(candidate);
204+ if (fillLightTreeCandidate) {
205+ fillTree<channel, withMl>(candidate);
206+ }
121207 }
122208 }
123209
0 commit comments