2727
2828namespace o2 ::analysis::femto::pairprocesshelpers
2929{
30+ // NOTE: all processSameEvent helpers return true if at least one pair in the event passed
31+ // the pair cleaner, the close pair rejection and the pair cuts (e.g. kstarMax).
32+ // This allows to use them as a pair trigger.
33+
3034enum PairOrder : uint8_t {
3135 kOrder12 ,
3236 kOrder21
@@ -41,7 +45,7 @@ template <modes::Mode mode,
4145 typename T5 ,
4246 typename T6 ,
4347 typename T7 >
44- void processSameEvent (T1 const & SliceParticle,
48+ bool processSameEvent (T1 const & SliceParticle,
4549 T2 const & TrackTable,
4650 T3 const & Collision,
4751 T4 & ParticleHistManager,
@@ -51,6 +55,7 @@ void processSameEvent(T1 const& SliceParticle,
5155 PairOrder pairOrder)
5256{
5357 PairHistManager.resetTrackedParticlesPerEvent ();
58+ bool foundPair = false ;
5459 for (auto const & part : SliceParticle) {
5560 ParticleHistManager.template fill <mode>(part, TrackTable);
5661 }
@@ -78,9 +83,11 @@ void processSameEvent(T1 const& SliceParticle,
7883 if (PairHistManager.checkPairCuts ()) {
7984 PairHistManager.template fill <mode>();
8085 PairHistManager.trackParticlesPerEvent (p1, p2);
86+ foundPair = true ;
8187 }
8288 }
8389 PairHistManager.fillMixingQaSe ();
90+ return foundPair;
8491}
8592
8693// process same event for identical particles with mc information
@@ -97,7 +104,7 @@ template <modes::Mode mode,
97104 typename T10 ,
98105 typename T11 ,
99106 typename T12 >
100- void processSameEvent (T1 const & SliceParticle,
107+ bool processSameEvent (T1 const & SliceParticle,
101108 T2 const & TrackTable,
102109 T3 const & mcParticles,
103110 T4 const & mcMothers,
@@ -112,6 +119,7 @@ void processSameEvent(T1 const& SliceParticle,
112119 PairOrder pairOrder)
113120{
114121 PairHistManager.resetTrackedParticlesPerEvent ();
122+ bool foundPair = false ;
115123 for (auto const & part : SliceParticle) {
116124 if (!ParticleCleaner.isClean (part, mcParticles, mcMothers, mcPartonicMothers)) {
117125 continue ;
@@ -147,9 +155,11 @@ void processSameEvent(T1 const& SliceParticle,
147155 if (PairHistManager.checkPairCuts ()) {
148156 PairHistManager.template fill <mode>();
149157 PairHistManager.trackParticlesPerEvent (p1, p2);
158+ foundPair = true ;
150159 }
151160 }
152161 PairHistManager.fillMixingQaSe ();
162+ return foundPair;
153163}
154164
155165// process same event for non-identical particles
@@ -163,7 +173,7 @@ template <modes::Mode mode,
163173 typename T7 ,
164174 typename T8 ,
165175 typename T9 >
166- void processSameEvent (T1 const & SliceParticle1,
176+ bool processSameEvent (T1 const & SliceParticle1,
167177 T2 const & SliceParticle2,
168178 T3 const & TrackTable,
169179 T4 const & Collision,
@@ -174,6 +184,7 @@ void processSameEvent(T1 const& SliceParticle1,
174184 T9 & PcManager)
175185{
176186 PairHistManager.resetTrackedParticlesPerEvent ();
187+ bool foundPair = false ;
177188 // Fill single particle histograms
178189 for (auto const & part : SliceParticle1) {
179190 ParticleHistManager1.template fill <mode>(part, TrackTable);
@@ -195,9 +206,11 @@ void processSameEvent(T1 const& SliceParticle1,
195206 if (PairHistManager.checkPairCuts ()) {
196207 PairHistManager.template fill <mode>();
197208 PairHistManager.trackParticlesPerEvent (p1, p2);
209+ foundPair = true ;
198210 }
199211 }
200212 PairHistManager.fillMixingQaSe ();
213+ return foundPair;
201214}
202215
203216// process same event for non-identical particles with mc information
@@ -217,7 +230,7 @@ template <modes::Mode mode,
217230 typename T13 ,
218231 typename T14 ,
219232 typename T15 >
220- void processSameEvent (T1 const & SliceParticle1,
233+ bool processSameEvent (T1 const & SliceParticle1,
221234 T2 const & SliceParticle2,
222235 T3 const & TrackTable,
223236 T4 const & mcParticles,
@@ -234,6 +247,7 @@ void processSameEvent(T1 const& SliceParticle1,
234247 T15 & PcManager)
235248{
236249 PairHistManager.resetTrackedParticlesPerEvent ();
250+ bool foundPair = false ;
237251 // Fill single particle histograms
238252 for (auto const & part : SliceParticle1) {
239253 if (!ParticleCleaner1.isClean (part, mcParticles, mcMothers, mcPartonicMothers)) {
@@ -266,9 +280,11 @@ void processSameEvent(T1 const& SliceParticle1,
266280 if (PairHistManager.checkPairCuts ()) {
267281 PairHistManager.template fill <mode>();
268282 PairHistManager.trackParticlesPerEvent (p1, p2);
283+ foundPair = true ;
269284 }
270285 }
271286 PairHistManager.fillMixingQaSe ();
287+ return foundPair;
272288}
273289// process same event for identical particles, mc truth only (no track table, no reco collisions)
274290template <modes::Mode mode,
@@ -282,7 +298,7 @@ template <modes::Mode mode,
282298 typename T8 ,
283299 typename T9 ,
284300 typename T10 >
285- void processSameEvent (T1 const & SliceParticle,
301+ bool processSameEvent (T1 const & SliceParticle,
286302 T2 const & /* mcParticles*/ ,
287303 T3 const & mcMothers,
288304 T4 const & mcPartonicMothers,
@@ -295,6 +311,7 @@ void processSameEvent(T1 const& SliceParticle,
295311 PairOrder pairOrder)
296312{
297313 PairHistManager.resetTrackedParticlesPerEvent ();
314+ bool foundPair = false ;
298315 for (auto const & part : SliceParticle) {
299316 if (!ParticleCleaner.isClean (part, mcMothers, mcPartonicMothers)) {
300317 continue ;
@@ -327,9 +344,11 @@ void processSameEvent(T1 const& SliceParticle,
327344 if (PairHistManager.checkPairCuts ()) {
328345 PairHistManager.template fill <mode>();
329346 PairHistManager.trackParticlesPerEvent (p1, p2);
347+ foundPair = true ;
330348 }
331349 }
332350 PairHistManager.fillMixingQaSe ();
351+ return foundPair;
333352}
334353
335354// process same event for non-identical particles, mc truth only
@@ -347,7 +366,7 @@ template <modes::Mode mode,
347366 typename T11 ,
348367 typename T12 ,
349368 typename T13 >
350- void processSameEvent (T1 const & SliceParticle1,
369+ bool processSameEvent (T1 const & SliceParticle1,
351370 T2 const & SliceParticle2,
352371 T3 const & /* mcParticles*/ ,
353372 T4 const & mcMothers,
@@ -362,6 +381,7 @@ void processSameEvent(T1 const& SliceParticle1,
362381 T13 & PcManager)
363382{
364383 PairHistManager.resetTrackedParticlesPerEvent ();
384+ bool foundPair = false ;
365385 for (auto const & part : SliceParticle1) {
366386 if (!ParticleCleaner1.isClean (part, mcMothers, mcPartonicMothers)) {
367387 continue ;
@@ -391,9 +411,11 @@ void processSameEvent(T1 const& SliceParticle1,
391411 if (PairHistManager.checkPairCuts ()) {
392412 PairHistManager.template fill <mode>();
393413 PairHistManager.trackParticlesPerEvent (p1, p2);
414+ foundPair = true ;
394415 }
395416 }
396417 PairHistManager.fillMixingQaSe ();
418+ return foundPair;
397419}
398420
399421// mixed event in data
0 commit comments