2020#ifndef PWGLF_UTILS_COLLISIONCUTS_H_
2121#define PWGLF_UTILS_COLLISIONCUTS_H_
2222
23+ #include < vector>
24+
2325#include " Framework/HistogramRegistry.h"
2426#include " Framework/Logger.h"
2527#include " Common/DataModel/EventSelection.h"
@@ -43,6 +45,8 @@ class CollisonCuts
4345 kFlagBunchPileup ,
4446 kFlagZvtxFT0vsPV ,
4547 kFlagOccupancy ,
48+ kNoCollInTimeRangeStandard ,
49+ kNoCollInTimeRangeNarrow ,
4650 kAllpassed
4751 };
4852
@@ -54,14 +58,12 @@ class CollisonCuts
5458 // / \brief Pass the selection criteria to the class
5559 // / \param zvtxMax Maximal value of the z-vertex
5660 // / \param checkTrigger whether or not to check for the trigger alias
57- // / \param trig Requested trigger alias
5861 // / \param checkOffline whether or not to check for offline selection criteria
59- void setCuts (float zvtxMax, bool checkTrigger, int trig, bool checkOffline, bool checkRun3, bool triggerTVXsel = false , int trackOccupancyInTimeRangeMax = -1 , int trackOccupancyInTimeRangeMin = -1 )
62+ void setCuts (float zvtxMax, bool checkTrigger, bool checkOffline, bool checkRun3, bool triggerTVXsel = false , int trackOccupancyInTimeRangeMax = -1 , int trackOccupancyInTimeRangeMin = -1 )
6063 {
6164 mCutsSet = true ;
6265 mZvtxMax = zvtxMax;
6366 mCheckTrigger = checkTrigger;
64- mTrigger = trig;
6567 mCheckOffline = checkOffline;
6668 mTriggerTVXselection = triggerTVXsel;
6769 mCheckIsRun3 = checkRun3;
@@ -85,6 +87,9 @@ class CollisonCuts
8587 if (!mCutsSet ) {
8688 LOGF (error, " Event selection not set - quitting!" );
8789 }
90+ for (int i = 0 ; i < kNaliases ; i++) {
91+ bit_list.push_back (1 << i); // BIT(i)
92+ }
8893 mHistogramRegistry = registry;
8994 mHistogramRegistry ->add (" Event/posZ" , " ; vtx_{z} (cm); Entries" , o2::framework::kTH1F , {{250 , -12.5 , 12.5 }}); // z-vertex histogram after event selections
9095 mHistogramRegistry ->add (" Event/posZ_noCut" , " ; vtx_{z} (cm); Entries" , o2::framework::kTH1F , {{250 , -12.5 , 12.5 }}); // z-vertex histogram before all selections
@@ -99,7 +104,7 @@ class CollisonCuts
99104 } else {
100105 mHistogramRegistry ->add (" Event/CentRun2V0M" , " ; vCentV0M; Entries" , o2::framework::kTH1F , {{110 , 0 , 110 }});
101106 }
102- mHistogramRegistry ->add (" CollCutCounts" , " ; ; Entries" , o2::framework::kTH1F , {{11 , 0 ., 11 . }});
107+ mHistogramRegistry ->add (" CollCutCounts" , " ; ; Entries" , o2::framework::kTH1F , {{kAllpassed + 1 , 0 , kAllpassed + 1 }});
103108 mHistogramRegistry ->get <TH1>(HIST (" CollCutCounts" ))->GetXaxis ()->SetBinLabel (binLabel (EvtSel::kAllEvent ), " all" );
104109 mHistogramRegistry ->get <TH1>(HIST (" CollCutCounts" ))->GetXaxis ()->SetBinLabel (binLabel (EvtSel::kFlagZvertex ), " Zvtx" );
105110 mHistogramRegistry ->get <TH1>(HIST (" CollCutCounts" ))->GetXaxis ()->SetBinLabel (binLabel (EvtSel::kFlagTrigerTVX ), " IsTriggerTVX" );
@@ -110,6 +115,8 @@ class CollisonCuts
110115 mHistogramRegistry ->get <TH1>(HIST (" CollCutCounts" ))->GetXaxis ()->SetBinLabel (binLabel (EvtSel::kFlagBunchPileup ), " NoSameBunchPileup" );
111116 mHistogramRegistry ->get <TH1>(HIST (" CollCutCounts" ))->GetXaxis ()->SetBinLabel (binLabel (EvtSel::kFlagZvtxFT0vsPV ), " IsGoodZvtxFT0vsPV" );
112117 mHistogramRegistry ->get <TH1>(HIST (" CollCutCounts" ))->GetXaxis ()->SetBinLabel (binLabel (EvtSel::kFlagOccupancy ), " LowOccupancy" );
118+ mHistogramRegistry ->get <TH1>(HIST (" CollCutCounts" ))->GetXaxis ()->SetBinLabel (binLabel (EvtSel::kNoCollInTimeRangeStandard ), " NoCollInTimeRangeStandard" );
119+ mHistogramRegistry ->get <TH1>(HIST (" CollCutCounts" ))->GetXaxis ()->SetBinLabel (binLabel (EvtSel::kNoCollInTimeRangeNarrow ), " NoCollInTimeRangeNarrow" );
113120 mHistogramRegistry ->get <TH1>(HIST (" CollCutCounts" ))->GetXaxis ()->SetBinLabel (binLabel (EvtSel::kAllpassed ), " Allpassed" );
114121 }
115122
@@ -119,7 +126,6 @@ class CollisonCuts
119126 LOGF (info, " Debug information for Collison Cuts" );
120127 LOGF (info, " Max. z-vertex: %f" , mZvtxMax );
121128 LOGF (info, " Check trigger: %d" , mCheckTrigger );
122- LOGF (info, " Trigger: %d" , mTrigger );
123129 LOGF (info, " Check offline: %d" , mCheckOffline );
124130 LOGF (info, " Check Run3: %d" , mCheckIsRun3 );
125131 if (mCheckIsRun3 ) {
@@ -142,9 +148,6 @@ class CollisonCuts
142148 // / Set MB selection
143149 void setTriggerTVX (bool triggerTVXsel) { mTriggerTVXselection = triggerTVXsel; }
144150
145- // / Scan the trigger alias of the event
146- void setInitialTriggerScan (bool checkTrigger) { mInitialTriggerScan = checkTrigger; }
147-
148151 // / Set the time frame border cut
149152 void setApplyTFBorderCut (bool applyTFBorderCut) { mApplyTFBorderCut = applyTFBorderCut; }
150153
@@ -194,6 +197,14 @@ class CollisonCuts
194197 LOGF (debug, " Vertex out of range" );
195198 return false ;
196199 }
200+ if (mInitialColBitScan ) {
201+ for (int bit : bit_list) {
202+ if (col.selection_bit (bit)) {
203+ LOGF (info, " Trigger %d fired" , bit);
204+ }
205+ }
206+ mInitialColBitScan = false ;
207+ }
197208 mHistogramRegistry ->fill (HIST (" CollCutCounts" ), EvtSel::kFlagZvertex );
198209 if (mCheckIsRun3 ) { // Run3 case
199210 if (!col.selection_bit (aod::evsel::kIsTriggerTVX ) && mTriggerTVXselection ) {
@@ -225,11 +236,12 @@ class CollisonCuts
225236 LOGF (debug, " Pileup rejection failed" );
226237 return false ;
227238 }
239+ mHistogramRegistry ->fill (HIST (" CollCutCounts" ), EvtSel::kFlagBunchPileup );
228240 if (!col.selection_bit (o2::aod::evsel::kNoCollInTimeRangeNarrow ) && mApplyCollInTimeRangeNarrow ) {
229241 LOGF (debug, " NoCollInTimeRangeNarrow selection failed" );
230242 return false ;
231243 }
232- mHistogramRegistry ->fill (HIST (" CollCutCounts" ), EvtSel::kFlagBunchPileup );
244+ mHistogramRegistry ->fill (HIST (" CollCutCounts" ), EvtSel::kNoCollInTimeRangeNarrow );
233245 if (!col.selection_bit (o2::aod::evsel::kIsGoodZvtxFT0vsPV ) && mApplyZvertexTimedifference ) {
234246 LOGF (debug, " Z-vertex time difference cut failed" );
235247 return false ;
@@ -243,11 +255,12 @@ class CollisonCuts
243255 LOGF (debug, " trackOccupancyInTimeRange selection failed" );
244256 return false ;
245257 }
258+ mHistogramRegistry ->fill (HIST (" CollCutCounts" ), EvtSel::kFlagOccupancy );
246259 if ((!col.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) && mApplyCollInTimeRangeStandard ) {
247260 LOGF (debug, " NoCollInTimeRangeStandard selection failed" );
248261 return false ;
249262 }
250- mHistogramRegistry ->fill (HIST (" CollCutCounts" ), EvtSel::kFlagOccupancy );
263+ mHistogramRegistry ->fill (HIST (" CollCutCounts" ), EvtSel::kNoCollInTimeRangeStandard );
251264 } else { // Run2 case
252265 if (mCheckOffline && !col.sel7 ()) {
253266 LOGF (debug, " Offline selection failed (sel7)" );
@@ -265,19 +278,6 @@ class CollisonCuts
265278 }
266279 mHistogramRegistry ->fill (HIST (" CollCutCounts" ), EvtSel::kAllpassed );
267280 }
268- if (mCheckTrigger && !col.alias_bit (mTrigger )) {
269- LOGF (debug, " Trigger selection failed" );
270- if (mInitialTriggerScan ) { // Print out the trigger bits
271- LOGF (debug, " Trigger scan initialized" );
272- for (int i = 0 ; i < kNaliases ; i++) {
273- if (col.alias_bit (i)) {
274- LOGF (debug, " Trigger %d fired" , i);
275- }
276- }
277- mInitialTriggerScan = false ;
278- }
279- return false ;
280- }
281281 mHistogramRegistry ->fill (HIST (" CollCutCounts" ), EvtSel::kAllpassed );
282282 return true ;
283283 }
@@ -317,25 +317,25 @@ class CollisonCuts
317317 private:
318318 using BCsWithRun2Info = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps>;
319319 o2::framework::HistogramRegistry* mHistogramRegistry = nullptr ; // /< For QA output
320- bool mCutsSet = false ; // /< Protection against running without cuts
321- bool mCheckTrigger = false ; // /< Check for trigger
322- bool mTriggerTVXselection = false ; // /< Check for trigger TVX selection
323- bool mCheckOffline = false ; // /< Check for offline criteria (might change)
324- bool mCheckIsRun3 = false ; // /< Check if running on Pilot Beam
325- bool mInitialTriggerScan = false ; // /< Check trigger when the event is first selected
326- bool mApplyTFBorderCut = false ; // /< Apply time frame border cut
327- bool mApplyITSTPCvertex = false ; // /< Apply at least one ITS-TPC track for vertexing
328- bool mApplyCollInTimeRangeNarrow = false ; // /< Apply NoCollInTimeRangeNarrow selection
329- bool mApplyZvertexTimedifference = false ; // /< removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference.
330- bool mApplyPileupRejection = false ; // /< Pileup rejection
331- bool mApplyNoITSROBorderCut = false ; // /< Apply NoITSRO frame border cut
332- bool mApplyCollInTimeRangeStandard = false ; // /< Apply NoCollInTimeRangeStandard selection
333- bool mApplyRun2AliEventCuts = true ; // /< Apply Run2 AliEventCuts
334- bool mApplyRun2INELgtZERO = false ; // /< Apply Run2 INELgtZERO selection
335- int mTrigger = kINT7 ; // /< Trigger to check for
336- float mZvtxMax = 999 .f; // /< Maximal deviation from nominal z-vertex (cm)
337- int mtrackOccupancyInTimeRangeMax = -1 ; // /< Maximum trackOccupancyInTimeRange cut (-1 no cut)
338- int mtrackOccupancyInTimeRangeMin = -1 ; // /< Minimum trackOccupancyInTimeRange cut (-1 no cut)
320+ std::vector< int > bit_list;
321+ bool mCutsSet = false ; // /< Protection against running without cuts
322+ bool mInitialColBitScan = true ; // /< Scan for collision bit
323+ bool mCheckTrigger = false ; // /< Check for trigger
324+ bool mTriggerTVXselection = false ; // /< Check for trigger TVX selection
325+ bool mCheckOffline = false ; // /< Check for offline criteria (might change)
326+ bool mCheckIsRun3 = false ; // /< Check if running on Pilot Beam
327+ bool mApplyTFBorderCut = false ; // /< Apply time frame border cut
328+ bool mApplyITSTPCvertex = false ; // /< Apply at least one ITS-TPC track for vertexing
329+ bool mApplyCollInTimeRangeNarrow = false ; // /< Apply NoCollInTimeRangeNarrow selection
330+ bool mApplyZvertexTimedifference = false ; // /< removes collisions with large differences between z of PV by tracks and z of PV from FT0 A-C time difference.
331+ bool mApplyPileupRejection = false ; // /< Pileup rejection
332+ bool mApplyNoITSROBorderCut = false ; // /< Apply NoITSRO frame border cut
333+ bool mApplyCollInTimeRangeStandard = false ; // /< Apply NoCollInTimeRangeStandard selection
334+ bool mApplyRun2AliEventCuts = true ; // /< Apply Run2 AliEventCuts
335+ bool mApplyRun2INELgtZERO = false ; // /< Apply Run2 INELgtZERO selection
336+ float mZvtxMax = 999 .f; // /< Maximal deviation from nominal z-vertex (cm)
337+ int mtrackOccupancyInTimeRangeMax = -1 ; // /< Maximum trackOccupancyInTimeRange cut (-1 no cut)
338+ int mtrackOccupancyInTimeRangeMin = -1 ; // /< Minimum trackOccupancyInTimeRange cut (-1 no cut)
339339};
340340} // namespace o2::analysis
341341
0 commit comments