@@ -222,6 +222,31 @@ enum centDetectors {
222222};
223223
224224static const std::vector<std::string> centDetectorNames{" FV0A" , " FT0M" , " FT0A" , " FT0C" };
225+
226+ enum evSel {
227+ kTVX = 0 ,
228+ kZvtx ,
229+ kTFborder ,
230+ kITSROFborder ,
231+ kNoSameBunchPileup ,
232+ kIsGoodZvtxFT0vsPV ,
233+ kIsGoodITSLayersAll ,
234+ kIsEPtriggered ,
235+ kNevSels
236+ };
237+
238+ static const std::vector<std::string> eventSelectionTitle{" Event selections" };
239+ static const std::vector<std::string> eventSelectionLabels{" TVX" , " Z vtx" , " TF border" , " ITS ROF border" , " No same-bunch pile-up" , " kIsGoodZvtxFT0vsPV" , " isGoodITSLayersAll" , " isEPtriggered" };
240+
241+ constexpr int EvSelDefault[8 ][1 ]{
242+ {1 },
243+ {1 },
244+ {0 },
245+ {0 },
246+ {0 },
247+ {0 },
248+ {0 },
249+ {0 }};
225250} // namespace nuclei
226251
227252struct nucleiSpectra {
@@ -263,6 +288,8 @@ struct nucleiSpectra {
263288 Configurable<float > cfgCutPtMinTree{" cfgCutPtMinTree" , 0 .2f , " Minimum track transverse momentum for tree saving" };
264289 Configurable<float > cfgCutPtMaxTree{" cfgCutPtMaxTree" , 15 .0f , " Maximum track transverse momentum for tree saving" };
265290
291+ Configurable<LabeledArray<int >> cfgEventSelections{" cfgEventSelections" , {nuclei::EvSelDefault[0 ], 8 , 1 , nuclei::eventSelectionLabels, nuclei::eventSelectionTitle}, " Event selections" };
292+
266293 Configurable<LabeledArray<double >> cfgMomentumScalingBetheBloch{" cfgMomentumScalingBetheBloch" , {nuclei::bbMomScalingDefault[0 ], 5 , 2 , nuclei::names, nuclei::chargeLabelNames}, " TPC Bethe-Bloch momentum scaling for light nuclei" };
267294 Configurable<LabeledArray<double >> cfgBetheBlochParams{" cfgBetheBlochParams" , {nuclei::betheBlochDefault[0 ], 5 , 6 , nuclei::names, nuclei::betheBlochParNames}, " TPC Bethe-Bloch parameterisation for light nuclei" };
268295 Configurable<LabeledArray<double >> cfgNsigmaTPC{" cfgNsigmaTPC" , {nuclei::nSigmaTPCdefault[0 ], 5 , 2 , nuclei::names, nuclei::nSigmaConfigName}, " TPC nsigma selection for light nuclei" };
@@ -354,6 +381,59 @@ struct nucleiSpectra {
354381 return collision.selection_bit (aod::evsel::kIsTriggerTVX ) && collision.posZ () > -cfgCutVertex && collision.posZ () < cfgCutVertex && collision.selection_bit (aod::evsel::kNoTimeFrameBorder );
355382 }
356383
384+ template <class Tcoll >
385+ bool eventSelectionWithHisto (Tcoll& collision)
386+ {
387+ spectra.fill (HIST (" hEventSelections" ), 0 );
388+
389+ if (cfgEventSelections->get (nuclei::evSel::kTVX ) && !collision.selection_bit (aod::evsel::kIsTriggerTVX )) {
390+ return false ;
391+ }
392+ spectra.fill (HIST (" hEventSelections" ), nuclei::evSel::kTVX + 1 );
393+
394+ if (cfgEventSelections->get (nuclei::evSel::kZvtx ) && std::abs (collision.posZ ()) > cfgCutVertex) {
395+ return false ;
396+ }
397+ spectra.fill (HIST (" hEventSelections" ), nuclei::evSel::kZvtx + 1 );
398+
399+ if (cfgEventSelections->get (nuclei::evSel::kTFborder ) && !collision.selection_bit (aod::evsel::kNoTimeFrameBorder )) {
400+ return false ;
401+ }
402+ spectra.fill (HIST (" hEventSelections" ), nuclei::evSel::kTFborder + 1 );
403+
404+ if (cfgEventSelections->get (nuclei::evSel::kITSROFborder ) && !collision.selection_bit (aod::evsel::kNoITSROFrameBorder )) {
405+ return false ;
406+ }
407+ spectra.fill (HIST (" hEventSelections" ), nuclei::evSel::kITSROFborder + 1 );
408+
409+ if (cfgEventSelections->get (nuclei::evSel::kNoSameBunchPileup ) && !collision.selection_bit (aod::evsel::kNoSameBunchPileup )) {
410+ return false ;
411+ }
412+ spectra.fill (HIST (" hEventSelections" ), nuclei::evSel::kNoSameBunchPileup + 1 );
413+
414+ if (cfgEventSelections->get (nuclei::evSel::kIsGoodZvtxFT0vsPV ) && !collision.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV )) {
415+ return false ;
416+ }
417+ spectra.fill (HIST (" hEventSelections" ), nuclei::evSel::kIsGoodZvtxFT0vsPV + 1 );
418+
419+ if (cfgEventSelections->get (nuclei::evSel::kIsGoodITSLayersAll ) && !collision.selection_bit (aod::evsel::kIsGoodITSLayersAll )) {
420+ return false ;
421+ }
422+ spectra.fill (HIST (" hEventSelections" ), nuclei::evSel::kIsGoodITSLayersAll + 1 );
423+
424+ if constexpr (
425+ requires {
426+ collision.triggereventep ();
427+ }) {
428+ if (cfgEventSelections->get (nuclei::evSel::kIsEPtriggered ) && !collision.triggereventep ()) {
429+ return false ;
430+ }
431+ spectra.fill (HIST (" hEventSelections" ), nuclei::evSel::kIsEPtriggered + 1 );
432+ }
433+
434+ return true ;
435+ }
436+
357437 void initCCDB (aod::BCsWithTimestamps::iterator const & bc)
358438 {
359439 if (mRunNumber == bc.runNumber ()) {
@@ -414,6 +494,17 @@ struct nucleiSpectra {
414494 {cfgDCAxyBinsAlpha, " DCA_{z} (cm)" }};
415495 const AxisSpec etaAxis{40 , -1 ., 1 ., " #eta" };
416496
497+ spectra.add (" hEventSelections" , " hEventSelections" , {HistType::kTH1I , {{nuclei::evSel::kNevSels + 1 , -0 .5f , float (nuclei::evSel::kNevSels ) + 0 .5f }}});
498+ spectra.get <TH1>(HIST (" hEventSelections" ))->GetXaxis ()->SetBinLabel (1 , " all" );
499+ spectra.get <TH1>(HIST (" hEventSelections" ))->GetXaxis ()->SetBinLabel (nuclei::evSel::kTVX + 2 , " TVX" );
500+ spectra.get <TH1>(HIST (" hEventSelections" ))->GetXaxis ()->SetBinLabel (nuclei::evSel::kZvtx + 2 , " Zvtx" );
501+ spectra.get <TH1>(HIST (" hEventSelections" ))->GetXaxis ()->SetBinLabel (nuclei::evSel::kTFborder + 2 , " TFborder" );
502+ spectra.get <TH1>(HIST (" hEventSelections" ))->GetXaxis ()->SetBinLabel (nuclei::evSel::kITSROFborder + 2 , " ITSROFborder" );
503+ spectra.get <TH1>(HIST (" hEventSelections" ))->GetXaxis ()->SetBinLabel (nuclei::evSel::kNoSameBunchPileup + 2 , " kNoSameBunchPileup" );
504+ spectra.get <TH1>(HIST (" hEventSelections" ))->GetXaxis ()->SetBinLabel (nuclei::evSel::kIsGoodZvtxFT0vsPV + 2 , " isGoodZvtxFT0vsPV" );
505+ spectra.get <TH1>(HIST (" hEventSelections" ))->GetXaxis ()->SetBinLabel (nuclei::evSel::kIsGoodITSLayersAll + 2 , " IsGoodITSLayersAll" );
506+ spectra.get <TH1>(HIST (" hEventSelections" ))->GetXaxis ()->SetBinLabel (nuclei::evSel::kIsEPtriggered + 2 , " IsEPtriggered" );
507+
417508 spectra.add (" hRecVtxZData" , " collision z position" , HistType::kTH1F , {{200 , -20 ., +20 ., " z position (cm)" }});
418509 if (doprocessMC) {
419510 spectra.add (" hGenVtxZ" , " generated collision z position" , HistType::kTH1F , {{200 , -20 ., +20 ., " z position (cm)" }});
@@ -760,7 +851,7 @@ struct nucleiSpectra {
760851 {
761852 nuclei::candidates.clear ();
762853 nuclei::candidates_flow.clear ();
763- if (!eventSelection (collision)) {
854+ if (!eventSelectionWithHisto (collision)) {
764855 return ;
765856 }
766857 if (!collision.triggereventep () || !collision.selection_bit (aod::evsel::kNoSameBunchPileup )) {
@@ -789,7 +880,7 @@ struct nucleiSpectra {
789880 {
790881 nuclei::candidates.clear ();
791882 nuclei::candidates_flow.clear ();
792- if (!eventSelection (collision)) {
883+ if (!eventSelectionWithHisto (collision)) {
793884 return ;
794885 }
795886 if (!collision.selection_bit (aod::evsel::kNoSameBunchPileup )) {
0 commit comments