@@ -109,20 +109,13 @@ class CloseTrackRejection
109109 CloseTrackRejection () = default ;
110110 virtual ~CloseTrackRejection () = default ;
111111
112- void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int chargeTrack1 , int chargeTrack2 )
112+ void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int chargeAbsTrack1 , int chargeAbsTrack2 )
113113 {
114114 mDetaMax = detaMax;
115115 mDphistarMax = dphistarMax;
116116
117- if (mDetaMax < o2::constants::math::Epsilon || mDphistarMax < o2::constants::math::Epsilon) {
118- LOG (fatal) << " Either DetaMax or DphistarMax are 0 or negative. Either turn off CPR or specify reasonable values. Breaking ..." ;
119- }
120- mChargeTrack1 = chargeTrack1;
121- mChargeTrack2 = chargeTrack2;
122-
123- if (utils::sign (mChargeTrack1 ) != utils::sign (mChargeTrack2 )) {
124- LOG (warn) << " CPR is turned on for tracks with opposite charge. Is this intended?" ;
125- }
117+ mChargeAbsTrack1 = chargeAbsTrack1;
118+ mChargeAbsTrack2 = chargeAbsTrack2;
126119
127120 mHistogramRegistry = registry;
128121
@@ -150,8 +143,8 @@ class CloseTrackRejection
150143
151144 mDeta = track1.eta () - track2.eta ();
152145 for (size_t i = 0 ; i < kTpcRadius .size (); i++) {
153- auto phistar1 = utils::dphistar (mMagField , kTpcRadius [i], mChargeTrack1 , track1.pt (), track1.phi ());
154- auto phistar2 = utils::dphistar (mMagField , kTpcRadius [i], mChargeTrack2 , track2.pt (), track2.phi ());
146+ auto phistar1 = utils::dphistar (mMagField , kTpcRadius [i], mChargeAbsTrack1 * track1.signedPt (), track1.phi ());
147+ auto phistar2 = utils::dphistar (mMagField , kTpcRadius [i], mChargeAbsTrack2 * track2.signedPt (), track2.phi ());
155148 if (phistar1 && phistar2) {
156149 // if the calculation for one phistar fails, keep the default value, which is 0
157150 // this makes it more likelier for the pair to be rejected sind the averave will be biased towards lower values
@@ -184,8 +177,8 @@ class CloseTrackRejection
184177 }
185178
186179 private:
187- int mChargeTrack1 = 0 ;
188- int mChargeTrack2 = 0 ;
180+ int mChargeAbsTrack1 = 0 ;
181+ int mChargeAbsTrack2 = 0 ;
189182 float mMagField = 0 .f;
190183 float mAverageDphistar = 0 .f;
191184 float mDeta = 0 .f;
@@ -200,11 +193,11 @@ template <const char* prefix>
200193class ClosePairRejectionTrackTrack
201194{
202195 public:
203- void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int chargeTrack1 , int chargeTrack2 , bool isActivated)
196+ void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int absChargeTrack1 , int absChargeTrack2 , bool isActivated)
204197 {
205198 mIsActivated = isActivated;
206199 if (mIsActivated ) {
207- mCtr .init (registry, specs, detaMax, dphistarMax, chargeTrack1, chargeTrack2 );
200+ mCtr .init (registry, specs, detaMax, dphistarMax, absChargeTrack1, absChargeTrack2 );
208201 }
209202 }
210203
@@ -227,15 +220,13 @@ template <const char* prefix>
227220class ClosePairRejectionTrackV0 // can also be used for any particle type that has pos/neg daughters, like resonances
228221{
229222 public:
230- void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int chargeTrack , bool isActivated)
223+ void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int absChargeTrack , bool isActivated)
231224 {
232225 mIsActivated = isActivated;
233- mChargeTrack = chargeTrack;
234-
235226 // initialize CPR with charge of the track and the same charge for the daughter particle
236- // absolute charge of the daughter track will be 1, so we just pass the sign
227+ // absolute charge of the daughter track will be 1, so we just pass 1
237228 if (mIsActivated ) {
238- mCtr .init (registry, specs, detaMax, dphistarMax, mChargeTrack , utils::sign ( mChargeTrack ) );
229+ mCtr .init (registry, specs, detaMax, dphistarMax, absChargeTrack, 1 );
239230 }
240231 }
241232
@@ -246,14 +237,12 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h
246237 template <typename T1, typename T2, typename T3>
247238 void setPair (const T1& track, const T2& v0, const T3 /* trackTable*/ )
248239 {
249- if (mChargeTrack > 0 ) {
240+ if (track. signedPt () > 0 ) {
250241 auto daughter = v0.template posDau_as <T3>();
251242 mCtr .compute (track, daughter);
252- } else if ( mChargeTrack < 0 ) {
243+ } else {
253244 auto daughter = v0.template negDau_as <T3>();
254245 mCtr .compute (track, daughter);
255- } else {
256- LOG (fatal) << " CPR Track-V0: Sign of the track is 0!" ;
257246 }
258247 }
259248
@@ -266,19 +255,19 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h
266255
267256 private:
268257 CloseTrackRejection<prefix> mCtr ;
269- int mChargeTrack = 0 ;
270258 bool mIsActivated = true ;
271259};
272260
273261template <const char * prefix>
274- class ClosePairRejectionTrackCascade // can also be used for any particle type that has pos/neg daughters, like resonances
262+ class ClosePairRejectionTrackCascade
275263{
276264 public:
277- void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int chargeTrack, int chargeCascade , bool isActivated)
265+ void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int absChargeTrack , bool isActivated)
278266 {
279267 mIsActivated = isActivated;
280268 if (mIsActivated ) {
281- mCtr .init (registry, specs, detaMax, dphistarMax, chargeTrack, chargeCascade);
269+ // charge of cascade is always 1
270+ mCtr .init (registry, specs, detaMax, dphistarMax, absChargeTrack, 1 );
282271 }
283272 }
284273
@@ -309,14 +298,12 @@ template <const char* prefix>
309298class ClosePairRejectionTrackKink
310299{
311300 public:
312- void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int chargeTrack, int signKinkCandidate , bool isActivated)
301+ void init (o2::framework::HistogramRegistry* registry, std::map<CprHist, std::vector<o2::framework::AxisSpec>>& specs, float detaMax, float dphistarMax, int absChargeTrack , bool isActivated)
313302 {
314303 mIsActivated = isActivated;
315- // initialize CPR with charge of the track and the charged daughter particle
316- // For kinks, we compare the primary track with the charged daughter
317- // The charged daughter has absolute charge of 1, so we can pass the sign directly
304+ // The charged daughter has absolute charge of 1, so we can pass 1 directly
318305 if (mIsActivated ) {
319- mCtr .init (registry, specs, detaMax, dphistarMax, chargeTrack, signKinkCandidate );
306+ mCtr .init (registry, specs, detaMax, dphistarMax, absChargeTrack, 1 );
320307 }
321308 }
322309
0 commit comments