2323
2424#include " Common/Core/TrackSelectorPID.h"
2525
26+ #include " CommonConstants/PhysicsConstants.h"
2627#include " Framework/AnalysisTask.h"
2728#include " Framework/runDataProcessing.h"
2829
@@ -38,13 +39,9 @@ struct HfCandidateSelectorXicToXiPiPi {
3839 Produces<aod::HfSelXicToXiPiPi> hfSelXicToXiPiPiCandidate;
3940 Produces<aod::HfMlXicToXiPiPi> hfMlXicToXiPiPiCandidate;
4041
41- Configurable<float > ptCandMin{" ptCandMin" , 0 ., " Lower bound of candidate pT" };
42- Configurable<float > ptCandMax{" ptCandMax" , 36 ., " Upper bound of candidate pT" };
43- // topological cuts
4442 Configurable<std::vector<double >> binsPt{" binsPt" , std::vector<double >{hf_cuts_xic_to_xi_pi_pi::vecBinsPt}, " pT bin limits" };
4543 Configurable<LabeledArray<double >> cuts{" cuts" , {hf_cuts_xic_to_xi_pi_pi::Cuts[0 ], hf_cuts_xic_to_xi_pi_pi::NBinsPt, hf_cuts_xic_to_xi_pi_pi::NCutVars, hf_cuts_xic_to_xi_pi_pi::labelsPt, hf_cuts_xic_to_xi_pi_pi::labelsCutVar}, " Xicplus candidate selection per pT bin" };
46- // QA switch
47- Configurable<bool > activateQA{" activateQA" , false , " Flag to enable QA histogram" };
44+ Configurable<bool > fillHistogram{" fillHistogram" , false , " Flag to filling of counter histogram" };
4845 // Enable PID
4946 Configurable<bool > usePid{" usePid" , true , " Switch for PID selection at track level" };
5047 Configurable<bool > useTpcPidOnly{" useTpcPidOnly" , false , " Switch to use TPC PID only instead of TPC OR TOF)" };
@@ -77,6 +74,18 @@ struct HfCandidateSelectorXicToXiPiPi {
7774 o2::ccdb::CcdbApi ccdbApi;
7875 TrackSelectorPi selectorPion;
7976 TrackSelectorPr selectorProton;
77+ enum XicSelCriteria { All = 0 ,
78+ Pt,
79+ Mass,
80+ Rapidity,
81+ Eta,
82+ EtaDaughters,
83+ PtPionFromXicPlus,
84+ Chi2SV,
85+ MinDecayLength,
86+ MaxInvMassXiPiPairs,
87+ PidSelected,
88+ BdtSelected };
8089
8190 using TracksPidWithSel = soa::Join<aod::TracksWExtra, aod::TracksPidPi, aod::TracksPidPr, aod::TrackSelection>;
8291
@@ -101,19 +110,20 @@ struct HfCandidateSelectorXicToXiPiPi {
101110 selectorProton.setRangeNSigmaTofCondTpc (-nSigmaTofCombinedMax, nSigmaTofCombinedMax);
102111 }
103112
104- if (activateQA) {
105- constexpr int kNBinsSelections = 1 + SelectionStep::NSelectionSteps;
106- std::string labels[kNBinsSelections ];
107- labels[0 ] = " No selection" ;
108- labels[1 + SelectionStep::RecoSkims] = " Skims selection" ;
109- labels[1 + SelectionStep::RecoTopol] = " Skims & Topological selections" ;
110- labels[1 + SelectionStep::RecoPID] = " Skims & Topological & PID selections" ;
111- labels[1 + SelectionStep::RecoMl] = " Skims & Topological & PID & ML selections" ;
112- static const AxisSpec axisSelections = {kNBinsSelections , 0.5 , kNBinsSelections + 0.5 , " " };
113- registry.add (" hSelections" , " Selections;;#it{p}_{T} (GeV/#it{c})" , {HistType::kTH2F , {axisSelections, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
114- for (int iBin = 0 ; iBin < kNBinsSelections ; ++iBin) {
115- registry.get <TH2>(HIST (" hSelections" ))->GetXaxis ()->SetBinLabel (iBin + 1 , labels[iBin].data ());
116- }
113+ if (fillHistogram) {
114+ registry.add (" hSelCandidates" , " ;;entries" , {HistType::kTH1F , {{11 , -0.5 , 10.5 }}});
115+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + All, " All" );
116+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + Pt, " #it{p}_{T}" );
117+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + Mass, " #Delta M" );
118+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + Rapidity, " y" );
119+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + Eta, " #eta" );
120+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + EtaDaughters, " #eta final state daughters" );
121+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + PtPionFromXicPlus, " #it{p}_{T} (#pi #leftarrow #Xi_{c}^{+})" );
122+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + Chi2SV, " #chi^{2}_{SV}" );
123+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + MinDecayLength, " Decay length" );
124+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + MaxInvMassXiPiPairs, " M_{#Xi #pi}" );
125+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + PidSelected, " PID selection" );
126+ registry.get <TH1>(HIST (" hSelCandidates" ))->GetXaxis ()->SetBinLabel (1 + BdtSelected, " BDT selection" );
117127 }
118128
119129 if (applyMl) {
@@ -133,62 +143,72 @@ struct HfCandidateSelectorXicToXiPiPi {
133143 // / \param candidate is candidate
134144 // / \return true if candidate passes all cuts
135145 template <typename T1>
136- bool selectionTopol (const T1& hfCandXic)
146+ bool isSelectedXic (const T1& hfCandXic)
137147 {
138148 auto candpT = hfCandXic.pt ();
139149 int pTBin = findBin (binsPt, candpT);
140150 if (pTBin == -1 ) {
141151 return false ;
142152 }
143-
144- // check that the candidate pT is within the analysis range
145- if (candpT < ptCandMin || candpT >= ptCandMax) {
146- return false ;
153+ if (fillHistogram) {
154+ registry.fill (HIST (" hSelCandidates" ), Pt);
147155 }
148156
149- // check candidate mass is within a defined mass window
157+ // check whether candidate mass is within a defined mass window
150158 if (std::abs (hfCandXic.invMassXicPlus () - o2::constants::physics::MassXiCPlus) > cuts->get (pTBin, " m" )) {
151159 return false ;
152160 }
153-
154- // cosine of pointing angle
155- if (hfCandXic.cpa () <= cuts->get (pTBin, " cos pointing angle" )) {
156- return false ;
161+ if (fillHistogram) {
162+ registry.fill (HIST (" hSelCandidates" ), Mass);
157163 }
158164
159- // cosine of pointing angle XY
160- if (hfCandXic.cpaXY () <= cuts->get (pTBin, " cos pointing angle XY " )) {
165+ // cut on candidate rapidity
166+ if (std::abs ( hfCandXic.y (o2::constants::physics::MassXiCPlus)) > cuts->get (pTBin, " y " )) {
161167 return false ;
162168 }
169+ if (fillHistogram) {
170+ registry.fill (HIST (" hSelCandidates" ), Rapidity);
171+ }
163172
164- // candidate maximum decay length
165- if (hfCandXic.decayLength () > cuts->get (pTBin, " max decay length " )) {
173+ // cut on candidate pseudorapidity
174+ if (std::abs ( hfCandXic.eta ()) > cuts->get (pTBin, " eta " )) {
166175 return false ;
167176 }
177+ if (fillHistogram) {
178+ registry.fill (HIST (" hSelCandidates" ), Eta);
179+ }
168180
169- // candidate maximum decay length XY
170- if (hfCandXic.decayLengthXY () > cuts->get (pTBin, " max decay length XY " )) {
181+ // cut on pion pT
182+ if (hfCandXic.ptProng1 () < cuts->get (pTBin, " pT Pi0 " ) || hfCandXic. ptProng2 () < cuts-> get (pTBin, " pT Pi1 " )) {
171183 return false ;
172184 }
185+ if (fillHistogram) {
186+ registry.fill (HIST (" hSelCandidates" ), PtPionFromXicPlus);
187+ }
173188
174- // candidate chi2PC
175- if (hfCandXic.chi2PCA () > cuts->get (pTBin, " chi2PCA " )) {
189+ // cut on chi2 of secondary vertex
190+ if (hfCandXic.chi2PCA () > cuts->get (pTBin, " chi2SV " )) {
176191 return false ;
177192 }
193+ if (fillHistogram) {
194+ registry.fill (HIST (" hSelCandidates" ), Chi2SV);
195+ }
178196
179- // maximum DCA of daughters
180- if ((std::abs (hfCandXic.impactParameter0 ()) > cuts->get (pTBin, " max impParXY Xi" )) ||
181- (std::abs (hfCandXic.impactParameter1 ()) > cuts->get (pTBin, " max impParXY Pi0" )) ||
182- (std::abs (hfCandXic.impactParameter2 ()) > cuts->get (pTBin, " max impParXY Pi1" ))) {
197+ // cut on candidate decay length
198+ if (hfCandXic.decayLength () < cuts->get (pTBin, " min decay length" ) || hfCandXic.decayLengthXY () < cuts->get (pTBin, " min decay length XY" )) {
183199 return false ;
184200 }
201+ if (fillHistogram) {
202+ registry.fill (HIST (" hSelCandidates" ), MinDecayLength);
203+ }
185204
186- // cut on daughter pT
187- if (hfCandXic.ptProng0 () < cuts->get (pTBin, " pT Xi" ) ||
188- hfCandXic.ptProng1 () < cuts->get (pTBin, " pT Pi0" ) ||
189- hfCandXic.ptProng2 () < cuts->get (pTBin, " pT Pi1" )) {
205+ // cut on invariant mass of Xi-pion pairs
206+ if (hfCandXic.invMassXiPi0 () > cuts->get (pTBin, " max inv mass Xi-Pi0" ) || hfCandXic.invMassXiPi1 () > cuts->get (pTBin, " max inv mass Xi-Pi1" )) {
190207 return false ;
191208 }
209+ if (fillHistogram) {
210+ registry.fill (HIST (" hSelCandidates" ), MaxInvMassXiPiPairs);
211+ }
192212
193213 return true ;
194214 }
@@ -225,33 +245,25 @@ struct HfCandidateSelectorXicToXiPiPi {
225245 {
226246 for (const auto & hfCandXic : hfCandsXic) {
227247 int statusXicToXiPiPi = 0 ;
228-
229- outputMlXicToXiPiPi.clear ();
230-
231- auto ptCandXic = hfCandXic.pt ();
232-
233- if (activateQA) {
234- registry.fill (HIST (" hSelections" ), 1 , ptCandXic);
248+ if (applyMl) {
249+ outputMlXicToXiPiPi.clear ();
235250 }
236251
252+ // get candidate pT
253+ float ptCandXic = hfCandXic.pt ();
254+
237255 // No hfflag -> by default skim selected
238256 SETBIT (statusXicToXiPiPi, SelectionStep::RecoSkims); // RecoSkims = 0 --> statusXicToXiPiPi = 1
239- if (activateQA) {
240- registry.fill (HIST (" hSelections" ), 2 + SelectionStep::RecoSkims, ptCandXic);
241- }
242257
243- // topological cuts
244- if (!selectionTopol (hfCandXic)) {
258+ // kinematic and topological selection
259+ if (!isSelectedXic (hfCandXic)) {
245260 hfSelXicToXiPiPiCandidate (statusXicToXiPiPi);
246261 if (applyMl) {
247262 hfMlXicToXiPiPiCandidate (outputMlXicToXiPiPi);
248263 }
249264 continue ;
250265 }
251266 SETBIT (statusXicToXiPiPi, SelectionStep::RecoTopol); // RecoTopol = 1 --> statusXicToXiPiPi = 3
252- if (activateQA) {
253- registry.fill (HIST (" hSelections" ), 2 + SelectionStep::RecoTopol, ptCandXic);
254- }
255267
256268 // track-level PID selection
257269 if (usePid) {
@@ -275,17 +287,17 @@ struct HfCandidateSelectorXicToXiPiPi {
275287 }
276288
277289 if (useTpcPidOnly) {
278- TrackSelectorPID::Status statusPidPi0 = selectorPion.statusTpc (trackPi0);
279- TrackSelectorPID::Status statusPidPi1 = selectorPion.statusTpc (trackPi1);
280- TrackSelectorPID::Status statusPidPiXi = selectorPion.statusTpc (trackPiFromXi);
281- TrackSelectorPID::Status statusPidPrLam = selectorProton.statusTpc (trackPr);
282- TrackSelectorPID::Status statusPidPiLam = selectorPion.statusTpc (trackPiFromLam);
290+ statusPidPi0 = selectorPion.statusTpc (trackPi0);
291+ statusPidPi1 = selectorPion.statusTpc (trackPi1);
292+ statusPidPiXi = selectorPion.statusTpc (trackPiFromXi);
293+ statusPidPrLam = selectorProton.statusTpc (trackPr);
294+ statusPidPiLam = selectorPion.statusTpc (trackPiFromLam);
283295 } else {
284- TrackSelectorPID::Status statusPidPi0 = selectorPion.statusTpcOrTof (trackPi0);
285- TrackSelectorPID::Status statusPidPi1 = selectorPion.statusTpcOrTof (trackPi1);
286- TrackSelectorPID::Status statusPidPiXi = selectorPion.statusTpcOrTof (trackPiFromXi);
287- TrackSelectorPID::Status statusPidPrLam = selectorProton.statusTpcOrTof (trackPr);
288- TrackSelectorPID::Status statusPidPiLam = selectorPion.statusTpcOrTof (trackPiFromLam);
296+ statusPidPi0 = selectorPion.statusTpcOrTof (trackPi0);
297+ statusPidPi1 = selectorPion.statusTpcOrTof (trackPi1);
298+ statusPidPiXi = selectorPion.statusTpcOrTof (trackPiFromXi);
299+ statusPidPrLam = selectorProton.statusTpcOrTof (trackPr);
300+ statusPidPiLam = selectorPion.statusTpcOrTof (trackPiFromLam);
289301 }
290302
291303 if (!selectionPid (statusPidPi0, statusPidPi1, statusPidPiXi, statusPidPrLam, statusPidPiLam, useTpcPidOnly.value )) {
@@ -296,10 +308,13 @@ struct HfCandidateSelectorXicToXiPiPi {
296308 continue ;
297309 }
298310 SETBIT (statusXicToXiPiPi, SelectionStep::RecoPID); // RecoPID = 2 --> statusXicToXiPiPi = 7
299- if (activateQA ) {
300- registry.fill (HIST (" hSelections " ), 2 + SelectionStep::RecoPID, ptCandXic );
311+ if (fillHistogram ) {
312+ registry.fill (HIST (" hSelCandidates " ), PidSelected );
301313 }
302314 }
315+ if (!usePid && fillHistogram) {
316+ registry.fill (HIST (" hSelCandidates" ), PidSelected);
317+ }
303318
304319 // ML selection
305320 if (applyMl) {
@@ -315,10 +330,13 @@ struct HfCandidateSelectorXicToXiPiPi {
315330 continue ;
316331 }
317332 SETBIT (statusXicToXiPiPi, aod::SelectionStep::RecoMl);
318- if (activateQA ) {
319- registry.fill (HIST (" hSelections " ), 2 + SelectionStep::RecoMl, ptCandXic );
333+ if (fillHistogram ) {
334+ registry.fill (HIST (" hSelCandidates " ), BdtSelected );
320335 }
321336 }
337+ if (!applyMl && fillHistogram) {
338+ registry.fill (HIST (" hSelCandidates" ), BdtSelected);
339+ }
322340
323341 hfSelXicToXiPiPiCandidate (statusXicToXiPiPi);
324342 }
0 commit comments