@@ -82,7 +82,6 @@ struct Alice3HfSelector3Prong {
8282 Configurable<std::vector<double >> binsPt{" binsPt" , std::vector<double >{hf_cuts_3prongs_alice3::vecBinsPt}, " pT bin limits" };
8383 Configurable<LabeledArray<double >> cuts{" cuts" , {hf_cuts_3prongs_alice3::Cuts[0 ], hf_cuts_3prongs_alice3::NBinsPt, hf_cuts_3prongs_alice3::NCutVars, hf_cuts_3prongs_alice3::labelsPt, hf_cuts_3prongs_alice3::labelsCutVar}, " Lc cand selection per pT bin" };
8484 // QA switch
85- Configurable<bool > activateQA{" activateQA" , false , " Flag to enable QA histogram" };
8685 // ML inference
8786 Configurable<bool > applyMl{" applyMl" , false , " Flag to apply ML selections" };
8887 Configurable<std::vector<double >> binsPtMl{" binsPtMl" , std::vector<double >{hf_cuts_ml::vecBinsPt}, " pT bin limits for ML application" };
@@ -110,21 +109,34 @@ struct Alice3HfSelector3Prong {
110109
111110 void init (InitContext const &)
112111 {
113- if (activateQA) {
114- constexpr int kNBinsSelections = 1 + aod::SelectionStep::NSelectionSteps;
115- std::string labels[kNBinsSelections ];
116- labels[0 ] = " No selection" ;
117- labels[1 + aod::SelectionStep::RecoSkims] = " Skims selection" ;
118- labels[1 + aod::SelectionStep::RecoTopol] = " Skims & Topological selections" ;
119- labels[1 + aod::SelectionStep::RecoPID] = " Skims & Topological & PID selections" ;
120- labels[1 + aod::SelectionStep::RecoMl] = " ML selection" ;
121- static const AxisSpec axisSelections = {kNBinsSelections , 0.5 , kNBinsSelections + 0.5 , " " };
122- registry.add (" hSelections" , " Selections;;#it{p}_{T} (GeV/#it{c})" , {HistType::kTH2F , {axisSelections, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
123- registry.add (" hSelectionsTopology" , " hSelectionsTopology" , {HistType::kTH1D , {{10 , -0.5 , 9.5 , " Selection step" }}});
124- for (int iBin = 0 ; iBin < kNBinsSelections ; ++iBin) {
125- registry.get <TH2>(HIST (" hSelections" ))->GetXaxis ()->SetBinLabel (iBin + 1 , labels[iBin].data ());
126- }
112+ constexpr int kNBinsSelections = 1 + aod::SelectionStep::NSelectionSteps;
113+ std::string labels[kNBinsSelections ];
114+ labels[0 ] = " No selection" ;
115+ labels[1 + aod::SelectionStep::RecoSkims] = " Skims selection" ;
116+ labels[1 + aod::SelectionStep::RecoTopol] = " Skims & Topological selections" ;
117+ labels[1 + aod::SelectionStep::RecoPID] = " Skims & Topological & PID selections" ;
118+ labels[1 + aod::SelectionStep::RecoMl] = " ML selection" ;
119+ static const AxisSpec axisSelections = {kNBinsSelections , 0.5 , kNBinsSelections + 0.5 , " " };
120+ registry.add (" hSelections" , " Selections;;#it{p}_{T} (GeV/#it{c})" , {HistType::kTH2F , {axisSelections, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
121+ for (int iBin = 0 ; iBin < kNBinsSelections ; ++iBin) {
122+ registry.get <TH2>(HIST (" hSelections" ))->GetXaxis ()->SetBinLabel (iBin + 1 , labels[iBin].data ());
127123 }
124+ auto h = registry.add <TH1>(" hSelectionsTopology" , " hSelectionsTopology" , {HistType::kTH1D , {{11 , -0.5 , 10.5 , " Selection step" }}});
125+ h->GetXaxis ()->SetBinLabel (1 , " All candidates" );
126+ h->GetXaxis ()->SetBinLabel (2 , " pT cand" );
127+ h->GetXaxis ()->SetBinLabel (3 , " pT prong cuts" );
128+ h->GetXaxis ()->SetBinLabel (4 , " cos pointing angle" );
129+ h->GetXaxis ()->SetBinLabel (5 , " chi2PCA" );
130+ h->GetXaxis ()->SetBinLabel (6 , " decay length" );
131+ h->GetXaxis ()->SetBinLabel (7 , " decay length XY" );
132+ h->GetXaxis ()->SetBinLabel (8 , " norm decay length XY" );
133+ h->GetXaxis ()->SetBinLabel (9 , " impPar XY" );
134+ h->GetXaxis ()->SetBinLabel (10 , " prong DCA" );
135+ h->GetXaxis ()->SetBinLabel (11 , " finally accepted" );
136+
137+ registry.add (" Tried/hChi2PCA" , " Chi2PCA;Chi2PCA;entries" , {HistType::kTH1F , {{100 , 0 ., 100 .}}});
138+ registry.add (" Tried/hDecayLength" , " Decay Length;Decay Length;entries" , {HistType::kTH1F , {{100 , 0 ., 200 .}}});
139+ registry.addClone (" Tried/" , " Accepted/" );
128140
129141 if (applyMl) {
130142 mlResponse.configure (binsPtMl, cutsMl, cutDirMl, nClassesMl);
@@ -152,67 +164,68 @@ struct Alice3HfSelector3Prong {
152164 bool selectionTopol (const T& cand, float candPt)
153165 {
154166 int const ptBin = findBin (binsPt, candPt);
155- auto fillQAHistogram = [&](float bin) {
156- if (activateQA) {
157- registry.fill (HIST (" hSelectionsTopology" ), bin);
158- }
159- };
160- fillQAHistogram (0 .f );
167+ registry.fill (HIST (" hSelectionsTopology" ), 0 .f );
161168 // check that the cand pT is within the analysis range
162169 if (candPt < ptCandMin || candPt >= ptCandMax) {
163170 return false ;
164171 }
165- fillQAHistogram ( 1 .f );
172+ registry. fill ( HIST ( " hSelectionsTopology " ), 1 .f );
166173
167174 // cut on daughter pT
168175 if (cand.ptProng0 () < cuts->get (ptBin, " pT prong 0" ) ||
169176 cand.ptProng1 () < cuts->get (ptBin, " pT prong 1" ) ||
170177 cand.ptProng2 () < cuts->get (ptBin, " pT prong 2" )) {
171178 return false ;
172179 }
173- fillQAHistogram ( 2 .f );
180+ registry. fill ( HIST ( " hSelectionsTopology " ), 2 .f );
174181
175182 // cosine of pointing angle
176183 if (cand.cpa () <= cuts->get (ptBin, " cos pointing angle" )) {
177184 return false ;
178185 }
179- fillQAHistogram ( 3 .f );
186+ registry. fill ( HIST ( " hSelectionsTopology " ), 3 .f );
180187
181188 // cand chi2PCA
189+ registry.fill (HIST (" Tried/hChi2PCA" ), cand.chi2PCA ());
182190 if (cand.chi2PCA () > cuts->get (ptBin, " Chi2PCA" )) {
183191 return false ;
184192 }
185- fillQAHistogram (4 .f );
193+ registry.fill (HIST (" Accepted/hChi2PCA" ), cand.chi2PCA ());
194+ registry.fill (HIST (" hSelectionsTopology" ), 4 .f );
186195
196+ // cand decay length
197+ registry.fill (HIST (" Tried/hDecayLength" ), cand.decayLength ());
187198 if (cand.decayLength () <= cuts->get (ptBin, " decay length" )) {
188199 return false ;
189200 }
190- fillQAHistogram (5 .f );
201+ registry.fill (HIST (" Accepted/hDecayLength" ), cand.decayLength ());
202+ registry.fill (HIST (" hSelectionsTopology" ), 5 .f );
191203
192204 // cand decay length XY
193205 if (cand.decayLengthXY () <= cuts->get (ptBin, " decLengthXY" )) {
194206 return false ;
195207 }
196- fillQAHistogram ( 6 .f );
208+ registry. fill ( HIST ( " hSelectionsTopology " ), 6 .f );
197209
198210 // cand normalized decay length XY
199211 if (cand.decayLengthXYNormalised () < cuts->get (ptBin, " normDecLXY" )) {
200212 return false ;
201213 }
202- fillQAHistogram ( 7 .f );
214+ registry. fill ( HIST ( " hSelectionsTopology " ), 7 .f );
203215
204216 // cand impact parameter XY
205217 if (std::abs (cand.impactParameterXY ()) > cuts->get (ptBin, " impParXY" )) {
206218 return false ;
207219 }
208- fillQAHistogram ( 8 .f );
220+ registry. fill ( HIST ( " hSelectionsTopology " ), 8 .f );
209221
210222 // cand daughter prong DCA
211223 if (!isSelectedCandidateProngDca (cand)) {
212224 return false ;
213225 }
214- fillQAHistogram ( 9 .f );
226+ registry. fill ( HIST ( " hSelectionsTopology " ), 9 .f );
215227
228+ registry.fill (HIST (" hSelectionsTopology" ), 10 .f );
216229 return true ;
217230 }
218231
@@ -226,7 +239,7 @@ struct Alice3HfSelector3Prong {
226239 template <CharmHadAlice3 CharmHad, bool SwapHypo, typename TCandidate>
227240 bool selectionCandidateMass (int const ptBin, const TCandidate& cand)
228241 {
229- float massCand = hfHelper.getCandMass <CharmHad, SwapHypo>(cand);
242+ const float massCand = hfHelper.getCandMass <CharmHad, SwapHypo>(cand);
230243 // cut on mass window
231244 if (std::abs (massCand - MassReference) > cuts->get (ptBin, " m" )) {
232245 return false ;
@@ -307,9 +320,7 @@ struct Alice3HfSelector3Prong {
307320
308321 // looping over 3-prong cands
309322 for (const auto & cand : cands) {
310- if (activateQA) {
311- registry.fill (HIST (" hSelections" ), 1 , cand.pt ());
312- }
323+ registry.fill (HIST (" hSelections" ), 1 , cand.pt ());
313324 outputMl = {-1 .f , -1 .f , -1 .f };
314325 pidMask = 0 ;
315326
@@ -333,9 +344,7 @@ struct Alice3HfSelector3Prong {
333344 }
334345 continue ;
335346 }
336- if (activateQA) {
337- registry.fill (HIST (" hSelections" ), 2 + aod::SelectionStep::RecoSkims, ptCand);
338- }
347+ registry.fill (HIST (" hSelections" ), 2 + aod::SelectionStep::RecoSkims, ptCand);
339348
340349 // Topological selection (TODO: track quality selection)
341350 if (!selectionTopol (cand, ptCand)) {
@@ -345,9 +354,7 @@ struct Alice3HfSelector3Prong {
345354 }
346355 continue ;
347356 }
348- if (activateQA) {
349- registry.fill (HIST (" hSelections" ), 2 + aod::SelectionStep::RecoTopol, ptCand);
350- }
357+ registry.fill (HIST (" hSelections" ), 2 + aod::SelectionStep::RecoTopol, ptCand);
351358
352359 // PID selection
353360 configurePidMask<CharmHad>(cand, pidMask);
@@ -358,9 +365,7 @@ struct Alice3HfSelector3Prong {
358365 }
359366 continue ;
360367 }
361- if (activateQA) {
362- registry.fill (HIST (" hSelections" ), 2 + aod::SelectionStep::RecoPID, ptCand);
363- }
368+ registry.fill (HIST (" hSelections" ), 2 + aod::SelectionStep::RecoPID, ptCand);
364369
365370 bool isSelectedMl = true ;
366371 // ML selections
@@ -374,9 +379,7 @@ struct Alice3HfSelector3Prong {
374379 continue ;
375380 }
376381
377- if (activateQA) {
378- registry.fill (HIST (" hSelections" ), 2 + aod::SelectionStep::RecoMl, ptCand);
379- }
382+ registry.fill (HIST (" hSelections" ), 2 + aod::SelectionStep::RecoMl, ptCand);
380383 }
381384
382385 candSelFlags (selMassHypo0, selMassHypo1, pidMask);
0 commit comments