@@ -157,16 +157,16 @@ struct ZdcQVectors {
157157
158158 enum SelectionCriteria {
159159 evSel_FilteredEvent,
160- evSel_RCTFlagsZDC,
161160 evSel_Zvtx,
162161 evSel_sel8,
163162 evSel_occupancy,
164163 evSel_kNoSameBunchPileup,
165164 evSel_kIsGoodZvtxFT0vsPV,
166165 evSel_kNoCollInTimeRangeStandard,
167166 evSel_kIsVertexITSTPC,
168- evSel_CentCuts,
169167 evSel_kIsGoodITSLayersAll,
168+ evSel_RCTFlagsZDC,
169+ evSel_CentCuts,
170170 evSel_isSelectedZDC,
171171 nEventSelections
172172 };
@@ -337,71 +337,72 @@ struct ZdcQVectors {
337337 }
338338
339339 template <typename TCollision>
340- bool eventSelected (TCollision collision, const float & centrality )
340+ uint16_t eventSelected (TCollision collision)
341341 {
342- if (std::fabs (collision.posZ ()) > cfgVtxZ)
343- return 0 ;
344- registry.fill (HIST (" hEventCount" ), evSel_Zvtx);
345-
346- if (!collision.sel8 ())
347- return 0 ;
348- registry.fill (HIST (" hEventCount" ), evSel_sel8);
349-
350- // Occupancy
351- if (cfgEvSelsDoOccupancySel) {
352- auto occupancy = collision.trackOccupancyInTimeRange ();
353- if (occupancy > cfgEvSelsMaxOccupancy) {
354- return 0 ;
355- }
342+ uint16_t selectionBits = 0 ;
343+ bool selected;
344+
345+ // Define selection criteria
346+ // If event is selected (passed the cut), set the corresponding bit in the selectionBits variable
347+ // bit 0 is for filterd events, so it will stay 0
348+ // uint16_t is 16 bits, so we have room for 15 selection criteria here
349+
350+ selected = std::fabs (collision.posZ ()) < cfgVtxZ;
351+ if (selected) {
352+ selectionBits |= (uint16_t )(0x1u << evSel_Zvtx);
353+ registry.fill (HIST (" hEventCount" ), evSel_Zvtx);
354+ }
355+
356+ selected = collision.sel8 ();
357+ if (selected) {
358+ selectionBits |= (uint16_t )(0x1u << evSel_sel8);
359+ registry.fill (HIST (" hEventCount" ), evSel_sel8);
360+ }
361+
362+ auto occupancy = collision.trackOccupancyInTimeRange ();
363+ selected = occupancy <= cfgEvSelsMaxOccupancy;
364+ if (selected) {
365+ selectionBits |= (uint16_t )(0x1u << evSel_occupancy);
356366 registry.fill (HIST (" hEventCount" ), evSel_occupancy);
357367 }
358368
359- if (cfgEvSelsNoSameBunchPileupCut) {
360- if (!collision.selection_bit (o2::aod::evsel::kNoSameBunchPileup )) {
361- // rejects collisions which are associated with the same "found-by-T0" bunch crossing
362- // https://indico.cern.ch/event/1396220/#1-event-selection-with-its-rof
363- return 0 ;
364- }
369+ selected = collision.selection_bit (o2::aod::evsel::kNoSameBunchPileup );
370+ if (selected) {
371+ selectionBits |= (uint16_t )(0x1u << evSel_kNoSameBunchPileup);
365372 registry.fill (HIST (" hEventCount" ), evSel_kNoSameBunchPileup);
366373 }
367- if (cfgEvSelsIsGoodZvtxFT0vsPV) {
368- if (!collision.selection_bit (o2::aod::evsel::kIsGoodZvtxFT0vsPV )) {
369- // removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference
370- // use this cut at low multiplicities with caution
371- return 0 ;
372- }
374+
375+ selected = collision.selection_bit (o2::aod::evsel::kIsGoodZvtxFT0vsPV );
376+ if (selected) {
377+ selectionBits |= (uint16_t )(0x1u << evSel_kIsGoodZvtxFT0vsPV);
373378 registry.fill (HIST (" hEventCount" ), evSel_kIsGoodZvtxFT0vsPV);
374379 }
375- if (cfgEvSelsNoCollInTimeRangeStandard) {
376- if (!collision.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) {
377- // Rejection of the collisions which have other events nearby
378- return 0 ;
379- }
380+
381+ selected = collision.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard );
382+ if (selected) {
383+ selectionBits |= (uint16_t )(0x1u << evSel_kNoCollInTimeRangeStandard);
380384 registry.fill (HIST (" hEventCount" ), evSel_kNoCollInTimeRangeStandard);
381385 }
382386
383- if (cfgEvSelsIsVertexITSTPC) {
384- if (!collision.selection_bit (o2::aod::evsel::kIsVertexITSTPC )) {
385- // selects collisions with at least one ITS-TPC track, and thus rejects vertices built from ITS-only tracks
386- return 0 ;
387- }
387+ selected = collision.selection_bit (o2::aod::evsel::kIsVertexITSTPC );
388+ if (selected) {
389+ selectionBits |= (uint16_t )(0x1u << evSel_kIsVertexITSTPC);
388390 registry.fill (HIST (" hEventCount" ), evSel_kIsVertexITSTPC);
389391 }
390392
391- if (centrality > cfgEvSelsCentMax || centrality < cfgEvSelsCentMin)
392- return 0 ;
393- registry.fill (HIST (" hEventCount" ), evSel_CentCuts);
394-
395- if (cfgEvSelsIsGoodITSLayersAll) {
396- if (!collision.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
397- // New event selection bits to cut time intervals with dead ITS staves
398- // https://indico.cern.ch/event/1493023/ (09-01-2025)
399- return 0 ;
400- }
393+ selected = collision.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll );
394+ if (selected) {
395+ selectionBits |= (uint16_t )(0x1u << evSel_kIsGoodITSLayersAll);
401396 registry.fill (HIST (" hEventCount" ), evSel_kIsGoodITSLayersAll);
402397 }
403398
404- return 1 ;
399+ selected = rctChecker (collision);
400+ if (selected){
401+ selectionBits |= (uint16_t )(0x1u << evSel_RCTFlagsZDC);
402+ registry.fill (HIST (" hEventCount" ), evSel_RCTFlagsZDC);
403+ }
404+
405+ return selectionBits;
405406 }
406407
407408 template <FillType ft>
@@ -602,28 +603,22 @@ struct ZdcQVectors {
602603
603604 registry.fill (HIST (" hEventCount" ), evSel_FilteredEvent);
604605
605- if (rctFlags.cfgEvtUseRCTFlagChecker && !rctChecker (collision)) {
606- // event not selected
607- isSelected = false ;
608- spTableZDC (runnumber, cent, v[0 ], v[1 ], v[2 ], 0 , 0 , 0 , 0 , isSelected, 0 , 0 );
609- counter++;
610- lastRunNumber = runnumber;
611- return ;
612- }
613- registry.fill (HIST (" hEventCount" ), evSel_RCTFlagsZDC);
614606
615- if (!eventSelected (collision, cent)) {
607+ uint16_t eventSelectionFlags = eventSelected (collision);
608+
609+ if (centrality < cfgEvSelsCentMin || centrality > cfgEvSelsCentMax) {
616610 // event not selected
617611 isSelected = false ;
618- spTableZDC (runnumber, cent, v[0 ], v[1 ], v[2 ], 0 , 0 , 0 , 0 , isSelected, 0 , 0 );
612+ spTableZDC (runnumber, cent, v[0 ], v[1 ], v[2 ], 0 , 0 , 0 , 0 , isSelected, eventSelectionFlags );
619613 counter++;
620614 lastRunNumber = runnumber;
621615 return ;
622616 }
617+ registry.fill (HIST (" hEventCount" ), evSel_CentCuts);
623618
624619 if (!foundBC.has_zdc ()) {
625620 isSelected = false ;
626- spTableZDC (runnumber, cent, v[0 ], v[1 ], v[2 ], 0 , 0 , 0 , 0 , isSelected, 0 , 0 );
621+ spTableZDC (runnumber, cent, v[0 ], v[1 ], v[2 ], 0 , 0 , 0 , 0 , isSelected, eventSelectionFlags );
627622 counter++;
628623 lastRunNumber = runnumber;
629624 return ;
@@ -705,7 +700,7 @@ struct ZdcQVectors {
705700 if (!isZNAhit || !isZNChit) {
706701 counter++;
707702 isSelected = false ;
708- spTableZDC (runnumber, centrality, v[0 ], v[1 ], v[2 ], 0 , 0 , 0 , 0 , isSelected, 0 , 0 );
703+ spTableZDC (runnumber, centrality, v[0 ], v[1 ], v[2 ], 0 , 0 , 0 , 0 , isSelected, eventSelectionFlags );
709704 lastRunNumber = runnumber;
710705 return ;
711706 }
@@ -716,7 +711,7 @@ struct ZdcQVectors {
716711 if (!cal.calibfilesLoaded [0 ]) {
717712 counter++;
718713 isSelected = false ;
719- spTableZDC (runnumber, centrality, v[0 ], v[1 ], v[2 ], 0 , 0 , 0 , 0 , isSelected, 0 , 0 );
714+ spTableZDC (runnumber, centrality, v[0 ], v[1 ], v[2 ], 0 , 0 , 0 , 0 , isSelected, eventSelectionFlags );
720715 lastRunNumber = runnumber;
721716 return ;
722717 }
@@ -857,7 +852,7 @@ struct ZdcQVectors {
857852 if (isSelected && cfgFillCommonRegistry)
858853 fillCommonRegistry<kBefore >(q[0 ], q[1 ], q[2 ], q[3 ], v, centrality);
859854
860- spTableZDC (runnumber, centrality, v[0 ], v[1 ], v[2 ], q[0 ], q[1 ], q[2 ], q[3 ], isSelected, 0 , 0 );
855+ spTableZDC (runnumber, centrality, v[0 ], v[1 ], v[2 ], q[0 ], q[1 ], q[2 ], q[3 ], isSelected, eventSelectionFlags );
861856 counter++;
862857 lastRunNumber = runnumber;
863858 return ;
@@ -991,7 +986,7 @@ struct ZdcQVectors {
991986 double qXcShift = std::hypot (qRec[2 ], qRec[3 ]) * std::cos (psiZDCCshift);
992987 double qYcShift = std::hypot (qRec[2 ], qRec[3 ]) * std::sin (psiZDCCshift);
993988
994- spTableZDC (runnumber, centrality, v[0 ], v[1 ], v[2 ], qXaShift, qYaShift, qXcShift, qYcShift, isSelected, cal. atIteration , cal. atStep );
989+ spTableZDC (runnumber, centrality, v[0 ], v[1 ], v[2 ], qXaShift, qYaShift, qXcShift, qYcShift, isSelected, eventSelectionFlags );
995990 qRec.clear ();
996991
997992 counter++;
0 commit comments