2424#include " PWGCF/FemtoUniverse/DataModel/FemtoDerived.h"
2525
2626#include < CommonConstants/PhysicsConstants.h>
27+ #include < Framework/Array2D.h>
2728#include < Framework/HistogramRegistry.h>
2829#include < Framework/HistogramSpec.h>
2930#include < Framework/Logger.h>
@@ -50,6 +51,98 @@ namespace o2::analysis
5051namespace femto_universe
5152{
5253
54+ // / \namespace cpr_track_cascade_cuts
55+ // / \brief Default per-daughter CPR cut table for the track-cascade combination.
56+ // / Rows correspond to the cascade daughters in the order used by FemtoUniverseDetaDphiStar
57+ // / (posChild, negChild, bachelor); columns to the DeltaPhi*/DeltaEta cut values.
58+ namespace cpr_track_cascade_cuts
59+ {
60+ static constexpr int NDaughters = 3 ;
61+ static constexpr int NCutVars = 4 ;
62+
63+ // default values for the cuts (all 0.0: rows fall back to the scalar CPR cuts)
64+ constexpr double Cuts[NDaughters][NCutVars] = {{0.0 , 0.0 , 0.0 , 0.0 }, /* posChild */
65+ {0.0 , 0.0 , 0.0 , 0.0 }, /* negChild */
66+ {0.0 , 0.0 , 0.0 , 0.0 }}; /* bachelor */
67+
68+ // row labels
69+ static const std::vector<std::string> labelsDaughter = {" posChild" , " negChild" , " bachelor" };
70+
71+ // column labels
72+ static const std::vector<std::string> labelsCutVar = {" dPhiStarMin" , " dPhiStarMax" , " dEtaMin" , " dEtaMax" };
73+ } // namespace cpr_track_cascade_cuts
74+
75+ // / \namespace cpr_cascade_cascade_cuts
76+ // / \brief Default per-pair CPR cut table for the cascade-cascade combination.
77+ // / Rows correspond to the daughter pairs in the order of CascChildTable
78+ // / (offsets relative to the cascade index: -3 posChild, -2 negChild, -1 bachelor);
79+ // / columns to the DeltaPhi*/DeltaEta cut values.
80+ namespace cpr_cascade_cascade_cuts
81+ {
82+ static constexpr int NPairs = 7 ;
83+ static constexpr int NCutVars = 4 ;
84+
85+ // daughter pair table: row i = {offset of daughter of cascade 1, offset of daughter of cascade 2}
86+ // ordered from pos to bach (both indices sorted pos < neg < bach)
87+ constexpr int CascChildTable[NPairs][2 ] = {{-3 , -3 }, {-3 , -1 }, {-2 , -2 }, {-2 , -1 }, {-1 , -1 }, {-1 , -2 }, {-1 , -3 }};
88+
89+ // default values for the cuts (all 0.0: rows fall back to the scalar CPR cuts)
90+ constexpr double Cuts[NPairs][NCutVars] = {{0.0 , 0.0 , 0.0 , 0.0 }, /* pos-pos */
91+ {0.0 , 0.0 , 0.0 , 0.0 }, /* pos-bach */
92+ {0.0 , 0.0 , 0.0 , 0.0 }, /* neg-neg */
93+ {0.0 , 0.0 , 0.0 , 0.0 }, /* neg-bach */
94+ {0.0 , 0.0 , 0.0 , 0.0 }, /* bach-bach */
95+ {0.0 , 0.0 , 0.0 , 0.0 }, /* bach-neg */
96+ {0.0 , 0.0 , 0.0 , 0.0 }}; /* bach-pos */
97+
98+ // row labels
99+ static const std::vector<std::string> labelsPair = {" pos-pos" , " pos-bach" , " neg-neg" , " neg-bach" , " bach-bach" , " bach-neg" , " bach-pos" };
100+
101+ // column labels
102+ static const std::vector<std::string> labelsCutVar = {" dPhiStarMin" , " dPhiStarMax" , " dEtaMin" , " dEtaMax" };
103+ } // namespace cpr_cascade_cascade_cuts
104+
105+ // / \namespace cpr_track_v0_cuts
106+ // / \brief Default per-daughter CPR cut table for the track-V0 combination.
107+ // / Rows correspond to the V0 daughters in the order used by FemtoUniverseDetaDphiStar
108+ // / (posChild, negChild); columns to the DeltaPhi*/DeltaEta cut values.
109+ // / Note: the track-V0 branch applies an elliptic cut, so only dPhiStarMax and dEtaMax are used.
110+ namespace cpr_track_v0_cuts
111+ {
112+ static constexpr int NDaughters = 2 ;
113+ static constexpr int NCutVars = 4 ;
114+
115+ // default values for the cuts (all 0.0: rows fall back to the scalar CPR cuts)
116+ constexpr double Cuts[NDaughters][NCutVars] = {{0.0 , 0.0 , 0.0 , 0.0 }, /* posChild */
117+ {0.0 , 0.0 , 0.0 , 0.0 }}; /* negChild */
118+
119+ // row labels
120+ static const std::vector<std::string> labelsDaughter = {" posChild" , " negChild" };
121+
122+ // column labels
123+ static const std::vector<std::string> labelsCutVar = {" dPhiStarMin" , " dPhiStarMax" , " dEtaMin" , " dEtaMax" };
124+ } // namespace cpr_track_v0_cuts
125+
126+ // / \namespace cpr_v0_v0_cuts
127+ // / \brief Default per-pair CPR cut table for the V0-V0 combination.
128+ // / Rows correspond to the daughter pairs checked by FemtoUniverseDetaDphiStar
129+ // / (pos-pos, neg-neg); columns to the DeltaPhi*/DeltaEta cut values.
130+ namespace cpr_v0_v0_cuts
131+ {
132+ static constexpr int NPairs = 2 ;
133+ static constexpr int NCutVars = 4 ;
134+
135+ // default values for the cuts (all 0.0: rows fall back to the scalar CPR cuts)
136+ constexpr double Cuts[NPairs][NCutVars] = {{0.0 , 0.0 , 0.0 , 0.0 }, /* pos-pos */
137+ {0.0 , 0.0 , 0.0 , 0.0 }}; /* neg-neg */
138+
139+ // row labels
140+ static const std::vector<std::string> labelsPair = {" pos-pos" , " neg-neg" };
141+
142+ // column labels
143+ static const std::vector<std::string> labelsCutVar = {" dPhiStarMin" , " dPhiStarMax" , " dEtaMin" , " dEtaMax" };
144+ } // namespace cpr_v0_v0_cuts
145+
53146// / \class FemtoUniverseDetaDphiStar
54147// / \brief Class to check particles for the close pair rejection.
55148// / \tparam partOne Type of particle 1 (Track/V0/Cascade/...)
@@ -200,6 +293,19 @@ class FemtoUniverseDetaDphiStar
200293 }
201294 }
202295
296+ // / Set the per-daughter/pair CPR cut table for this combination.
297+ // / For track-cascade: rows = posChild, negChild, bachelor.
298+ // / For cascade-cascade: rows = the daughter pairs of cpr_cascade_cascade_cuts::CascChildTable.
299+ // / For track-V0: rows = posChild, negChild (elliptic cut: only dPhiStarMax/dEtaMax are used).
300+ // / For V0-V0: rows = pos-pos, neg-neg (all columns used for the rectangular cut;
301+ // / only dPhiStarMax/dEtaMax for the elliptic cut).
302+ // / Columns: dPhiStarMin, dPhiStarMax, dEtaMin, dEtaMax.
303+ // / A row left at all zeros falls back to the scalar cuts set in init().
304+ void setCPRCuts (const o2::framework::LabeledArray<double >& lCPRCuts)
305+ {
306+ mCPRCuts = lCPRCuts;
307+ }
308+
203309 template <typename t1, typename t2, typename t3>
204310 void init_kT (o2::framework::HistogramRegistry* registry, t1& ktbins, t3& fDeltaEtaAxis , t3& fDeltaPhiStarAxis , t2& ldeltaphistarcutmin, t2& ldeltaphistarcutmax, t2& ldeltaetacutmin, t2& ldeltaetacutmax, t2& ldeltaphistarcutFractionmin, t2& ldeltaphistarcutFractionmax, t2& ldeltaetacutFractionmin, t2& ldeltaetacutFractionmax, bool filldEtadPhiTPCcls)
205311 {
@@ -294,7 +400,19 @@ class FemtoUniverseDetaDphiStar
294400 LOG (fatal) << " FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed." ;
295401 }
296402
297- if (std::pow (dphiAvg, 2 ) / std::pow (cutDeltaPhiStarMax, 2 ) + std::pow (deta, 2 ) / std::pow (cutDeltaEtaMax, 2 ) < 1 .) {
403+ // Per-daughter cuts from the LabeledArray; rows left at all zeros fall back to the scalar cuts
404+ // (the track-V0 branch applies an elliptic cut, so only the Max values are used)
405+ float dPhiStarMax = cutDeltaPhiStarMax;
406+ float dEtaMax = cutDeltaEtaMax;
407+ if (mCPRCuts .rows () > 0 && i < static_cast <int >(mCPRCuts .rows ())) {
408+ double * cutsDaughter = mCPRCuts .getRow (i);
409+ if (cutsDaughter[0 ] != 0 . || cutsDaughter[1 ] != 0 . || cutsDaughter[2 ] != 0 . || cutsDaughter[3 ] != 0 .) {
410+ dPhiStarMax = static_cast <float >(cutsDaughter[1 ]);
411+ dEtaMax = static_cast <float >(cutsDaughter[3 ]);
412+ }
413+ }
414+
415+ if (std::pow (dphiAvg, 2 ) / std::pow (dPhiStarMax, 2 ) + std::pow (deta, 2 ) / std::pow (dEtaMax, 2 ) < 1 .) {
298416 pass = true ;
299417 } else {
300418 if (ChosenEventType == femto_universe_container::EventType::same) {
@@ -331,9 +449,24 @@ class FemtoUniverseDetaDphiStar
331449 LOG (fatal) << " FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed." ;
332450 }
333451
334- if (V0V0rect && (dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) {
452+ // Per-pair cuts from the LabeledArray; rows left at all zeros fall back to the scalar cuts
453+ float dPhiStarMin = cutDeltaPhiStarMin;
454+ float dPhiStarMax = cutDeltaPhiStarMax;
455+ float dEtaMin = cutDeltaEtaMin;
456+ float dEtaMax = cutDeltaEtaMax;
457+ if (mCPRCuts .rows () > 0 && i < static_cast <int >(mCPRCuts .rows ())) {
458+ double * cutsPair = mCPRCuts .getRow (i);
459+ if (cutsPair[0 ] != 0 . || cutsPair[1 ] != 0 . || cutsPair[2 ] != 0 . || cutsPair[3 ] != 0 .) {
460+ dPhiStarMin = static_cast <float >(cutsPair[0 ]);
461+ dPhiStarMax = static_cast <float >(cutsPair[1 ]);
462+ dEtaMin = static_cast <float >(cutsPair[2 ]);
463+ dEtaMax = static_cast <float >(cutsPair[3 ]);
464+ }
465+ }
466+
467+ if (V0V0rect && (dphiAvg > dPhiStarMin) && (dphiAvg < dPhiStarMax) && (deta > dEtaMin) && (deta < dEtaMax)) {
335468 pass = true ;
336- } else if (!V0V0rect && std::pow (dphiAvg, 2 ) / std::pow (cutDeltaPhiStarMax , 2 ) + std::pow (deta, 2 ) / std::pow (cutDeltaEtaMax , 2 ) < 1 .) {
469+ } else if (!V0V0rect && std::pow (dphiAvg, 2 ) / std::pow (dPhiStarMax , 2 ) + std::pow (deta, 2 ) / std::pow (dEtaMax , 2 ) < 1 .) {
337470 pass = true ;
338471 } else {
339472 if (ChosenEventType == femto_universe_container::EventType::same) {
@@ -354,10 +487,9 @@ class FemtoUniverseDetaDphiStar
354487 }
355488
356489 bool pass = false ;
357- static constexpr int CascChildTable[][2 ] = {{-1 , -1 }, {-1 , -2 }, {-1 , -3 }, {-2 , -2 }, {-3 , -3 }, {-2 , -1 }, {-3 , -1 }};
358- for (int i = 0 ; i < 7 ; i++) {
359- auto indexOfDaughterpart1 = (ChosenEventType == femto_universe_container::EventType::mixed ? part1.globalIndex () : part1.index ()) + CascChildTable[i][0 ];
360- auto indexOfDaughterpart2 = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex () : part2.index ()) + CascChildTable[i][1 ];
490+ for (int i = 0 ; i < cpr_cascade_cascade_cuts::NPairs; i++) {
491+ auto indexOfDaughterpart1 = (ChosenEventType == femto_universe_container::EventType::mixed ? part1.globalIndex () : part1.index ()) + cpr_cascade_cascade_cuts::CascChildTable[i][0 ];
492+ auto indexOfDaughterpart2 = (ChosenEventType == femto_universe_container::EventType::mixed ? part2.globalIndex () : part2.index ()) + cpr_cascade_cascade_cuts::CascChildTable[i][1 ];
361493 auto daughterpart1 = particles.begin () + indexOfDaughterpart1;
362494 auto daughterpart2 = particles.begin () + indexOfDaughterpart2;
363495 if (isSameSignCPR && (daughterpart1.mAntiLambda () != daughterpart2.mAntiLambda ())) // mAntiLambda() is used here as sign getter
@@ -372,7 +504,22 @@ class FemtoUniverseDetaDphiStar
372504 LOG (fatal) << " FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed." ;
373505 }
374506
375- if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) {
507+ // Per-pair cuts from the LabeledArray; rows left at all zeros fall back to the scalar cuts
508+ float dPhiStarMin = cutDeltaPhiStarMin;
509+ float dPhiStarMax = cutDeltaPhiStarMax;
510+ float dEtaMin = cutDeltaEtaMin;
511+ float dEtaMax = cutDeltaEtaMax;
512+ if (mCPRCuts .rows () > 0 && i < static_cast <int >(mCPRCuts .rows ())) {
513+ double * cutsPair = mCPRCuts .getRow (i);
514+ if (cutsPair[0 ] != 0 . || cutsPair[1 ] != 0 . || cutsPair[2 ] != 0 . || cutsPair[3 ] != 0 .) {
515+ dPhiStarMin = static_cast <float >(cutsPair[0 ]);
516+ dPhiStarMax = static_cast <float >(cutsPair[1 ]);
517+ dEtaMin = static_cast <float >(cutsPair[2 ]);
518+ dEtaMax = static_cast <float >(cutsPair[3 ]);
519+ }
520+ }
521+
522+ if ((dphiAvg > dPhiStarMin) && (dphiAvg < dPhiStarMax) && (deta > dEtaMin) && (deta < dEtaMax)) {
376523 pass = true ;
377524 } else {
378525 if (ChosenEventType == femto_universe_container::EventType::same) {
@@ -408,7 +555,22 @@ class FemtoUniverseDetaDphiStar
408555 LOG (fatal) << " FemtoUniverseDetaDphiStar: passed arguments don't agree with FemtoUniverseDetaDphiStar's type of events! Please provide same or mixed." ;
409556 }
410557
411- if ((dphiAvg > cutDeltaPhiStarMin) && (dphiAvg < cutDeltaPhiStarMax) && (deta > cutDeltaEtaMin) && (deta < cutDeltaEtaMax)) {
558+ // Per-daughter cuts from the LabeledArray; rows left at all zeros fall back to the scalar cuts
559+ float dPhiStarMin = cutDeltaPhiStarMin;
560+ float dPhiStarMax = cutDeltaPhiStarMax;
561+ float dEtaMin = cutDeltaEtaMin;
562+ float dEtaMax = cutDeltaEtaMax;
563+ if (mCPRCuts .rows () > 0 && i < static_cast <int >(mCPRCuts .rows ())) {
564+ double * cutsDaughter = mCPRCuts .getRow (i);
565+ if (cutsDaughter[0 ] != 0 . || cutsDaughter[1 ] != 0 . || cutsDaughter[2 ] != 0 . || cutsDaughter[3 ] != 0 .) {
566+ dPhiStarMin = static_cast <float >(cutsDaughter[0 ]);
567+ dPhiStarMax = static_cast <float >(cutsDaughter[1 ]);
568+ dEtaMin = static_cast <float >(cutsDaughter[2 ]);
569+ dEtaMax = static_cast <float >(cutsDaughter[3 ]);
570+ }
571+ }
572+
573+ if ((dphiAvg > dPhiStarMin) && (dphiAvg < dPhiStarMax) && (deta > dEtaMin) && (deta < dEtaMax)) {
412574 pass = true ;
413575 } else {
414576 if (ChosenEventType == femto_universe_container::EventType::same) {
@@ -890,6 +1052,7 @@ class FemtoUniverseDetaDphiStar
8901052 float cutDeltaPhiStarMin;
8911053 float cutDeltaEtaMax;
8921054 float cutDeltaEtaMin;
1055+ o2::framework::LabeledArray<double > mCPRCuts {}; // /< Per-daughter/pair CPR cuts for this combination (rows: daughters or daughter pairs, cols: dPhiStarMin/dPhiStarMax/dEtaMin/dEtaMax)
8931056
8941057 std::vector<float > cutDeltaPhiStarMaxVector;
8951058 std::vector<float > cutDeltaPhiStarMinVector;
0 commit comments