@@ -63,6 +63,8 @@ struct ConfCpr : o2::framework::ConfigurableGroup {
6363 o2::framework::Configurable<bool > plotAverage{" plotAverage" , true , " Plot average deta dphi distribution" };
6464 o2::framework::Configurable<float > detaMax{" detaMax" , 0 .01f , " Maximium deta" };
6565 o2::framework::Configurable<float > dphistarMax{" dphistarMax" , 0 .01f , " Maximum dphistar" };
66+ o2::framework::Configurable<float > kstarMin{" kstarMin" , -1 .f , " Minimum kstar of pair for plotting (Set to negative value to turn off the cut)" };
67+ o2::framework::Configurable<float > kstarMax{" kstarMax" , -1 .f , " Maximum kstar of pair for plotting (Set to negative value to turn off the cut)" };
6668 o2::framework::ConfigurableAxis binningDeta{" binningDeta" , {{250 , -0.5 , 0.5 }}, " deta" };
6769 o2::framework::ConfigurableAxis binningDphistar{" binningDphistar" , {{250 , -0.5 , 0.5 }}, " dphi" };
6870};
@@ -140,19 +142,15 @@ class CloseTrackRejection
140142 CloseTrackRejection () = default ;
141143 ~CloseTrackRejection () = default ;
142144
145+ template <typename T>
143146 void init (o2::framework::HistogramRegistry* registry,
144147 std::map<CprHist, std::vector<o2::framework::AxisSpec>> const & specs,
145- bool plotAverage,
146- bool plotAllRadii,
147- bool cutOnAverage,
148- bool cutOnAnyRadius,
149- float detaMax,
150- float dphistarMax,
148+ T const & confCpr,
151149 int chargeAbsTrack1,
152150 int chargeAbsTrack2)
153151 {
154- mDetaMax = detaMax;
155- mDphistarMax = dphistarMax;
152+ mDetaMax = confCpr. detaMax . value ;
153+ mDphistarMax = confCpr. dphistarMax . value ;
156154
157155 // check the limits
158156 if (mDetaMax <= 0 || mDphistarMax <= 0 ) {
@@ -162,14 +160,17 @@ class CloseTrackRejection
162160 mChargeAbsTrack1 = std::abs (chargeAbsTrack1);
163161 mChargeAbsTrack2 = std::abs (chargeAbsTrack2);
164162
165- mCutOnAverage = cutOnAverage;
166- mCutOnAnyRadius = cutOnAnyRadius;
163+ mCutAverage = confCpr.cutAverage .value ;
164+ mCutAnyRadius = confCpr.cutAnyRadius .value ;
165+
166+ mKstarMin = confCpr.kstarMin .value ;
167+ mKstarMax = confCpr.kstarMax .value ;
167168
168- mPlotAverage = plotAverage;
169- mPlotAllRadii = plotAllRadii;
169+ mPlotAverage = confCpr. plotAverage . value ;
170+ mPlotAllRadii = confCpr. plotAllRadii . value ;
170171
171172 // check if we need to apply any cut a plot is requested
172- mIsActivated = mCutOnAverage || mCutOnAnyRadius || mPlotAverage || mPlotAllRadii ;
173+ mIsActivated = mCutAverage || mCutAnyRadius || mPlotAverage || mPlotAllRadii ;
173174
174175 mHistogramRegistry = registry;
175176
@@ -210,7 +211,7 @@ class CloseTrackRejection
210211 auto phistar1 = utils::dphistar (mMagField , TpcRadii[i], mChargeAbsTrack1 * track1.signedPt (), track1.phi ());
211212 auto phistar2 = utils::dphistar (mMagField , TpcRadii[i], mChargeAbsTrack2 * track2.signedPt (), track2.phi ());
212213 if (phistar1 && phistar2) {
213- mDphistar .at (i) = RecoDecay::constrainAngle (phistar1.value () - phistar2.value (), -o2::constants::math::PI); // const angle difference between -pi and pi
214+ mDphistar .at (i) = RecoDecay::constrainAngle (phistar1.value () - phistar2.value (), -o2::constants::math::PI); // constrain angular difference between -pi and pi
214215 mDphistarMask .at (i) = true ;
215216 count++;
216217 }
@@ -219,11 +220,20 @@ class CloseTrackRejection
219220 mAverageDphistar = std::accumulate (mDphistar .begin (), mDphistar .end (), 0 .f ) / count; // only average values if phistar could be computed
220221 }
221222
222- void fill ()
223+ void fill (float kstar )
223224 {
224225 if (!mIsActivated ) {
225226 return ;
226227 }
228+
229+ if (mKstarMin > 0 .f && kstar < mKstarMin ) {
230+ return ;
231+ }
232+
233+ if (mKstarMax > 0 .f && kstar > mKstarMax ) {
234+ return ;
235+ }
236+
227237 // fill average hist
228238 if (mPlotAverage ) {
229239 mHistogramRegistry ->fill (HIST (prefix) + HIST (getHistName (kAverage , HistTable)), mDeta , mAverageDphistar );
@@ -269,11 +279,11 @@ class CloseTrackRejection
269279 bool isCloseAverage = false ;
270280 bool isCloseAnyRadius = false ;
271281
272- if (mCutOnAverage ) {
282+ if (mCutAverage ) {
273283 isCloseAverage = std::hypot (mAverageDphistar / mDphistarMax , mDeta / mDetaMax ) < 1 .f ;
274284 }
275285
276- if (mCutOnAnyRadius ) {
286+ if (mCutAnyRadius ) {
277287 for (size_t i = 0 ; i < TpcRadii.size (); i++) {
278288 if (isCloseAnyRadius) {
279289 break ;
@@ -293,8 +303,11 @@ class CloseTrackRejection
293303 bool mPlotAllRadii = false ;
294304 bool mPlotAverage = false ;
295305
296- bool mCutOnAverage = false ;
297- bool mCutOnAnyRadius = false ;
306+ float mKstarMin = -1 .f;
307+ float mKstarMax = -1 .f;
308+
309+ bool mCutAverage = false ;
310+ bool mCutAnyRadius = false ;
298311
299312 bool mIsActivated = false ;
300313
@@ -321,7 +334,7 @@ class ClosePairRejectionTrackTrack
321334 int absChargeTrack1,
322335 int absChargeTrack2)
323336 {
324- mCtr .init (registry, specs, confCpr. plotAverage . value , confCpr. plotAllRadii . value , confCpr. cutAverage . value , confCpr. cutAnyRadius . value , confCpr. detaMax . value , confCpr. dphistarMax . value , absChargeTrack1, absChargeTrack2);
337+ mCtr .init (registry, specs, confCpr, absChargeTrack1, absChargeTrack2);
325338 }
326339
327340 void setMagField (float magField) { mCtr .setMagField (magField); }
@@ -331,7 +344,7 @@ class ClosePairRejectionTrackTrack
331344 mCtr .compute (track1, track2);
332345 }
333346 bool isClosePair () const { return mCtr .isClosePair (); }
334- void fill () { mCtr .fill (); }
347+ void fill (float kstar ) { mCtr .fill (kstar ); }
335348
336349 private:
337350 CloseTrackRejection<prefix> mCtr ;
@@ -348,8 +361,8 @@ class ClosePairRejectionV0V0
348361 T1 const & confCprPos,
349362 T2 const & confCprNeg)
350363 {
351- mCtrPos .init (registry, specsPos, confCprPos. plotAverage . value , confCprPos. plotAllRadii . value , confCprPos. cutAverage . value , confCprPos. cutAnyRadius . value , confCprPos. detaMax . value , confCprPos. dphistarMax . value , 1 , 1 );
352- mCtrNeg .init (registry, specsNeg, confCprNeg. plotAverage . value , confCprNeg. plotAllRadii . value , confCprNeg. cutAverage . value , confCprNeg. cutAnyRadius . value , confCprNeg. detaMax . value , confCprNeg. dphistarMax . value , 1 , 1 );
364+ mCtrPos .init (registry, specsPos, confCprPos, 1 , 1 );
365+ mCtrNeg .init (registry, specsNeg, confCprNeg, 1 , 1 );
353366 }
354367
355368 void setMagField (float magField)
@@ -372,10 +385,10 @@ class ClosePairRejectionV0V0
372385
373386 bool isClosePair () const { return mCtrPos .isClosePair () || mCtrNeg .isClosePair (); }
374387
375- void fill ()
388+ void fill (float kstar )
376389 {
377- mCtrPos .fill ();
378- mCtrNeg .fill ();
390+ mCtrPos .fill (kstar );
391+ mCtrNeg .fill (kstar );
379392 }
380393
381394 private:
@@ -393,7 +406,7 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h
393406 T const & confCpr,
394407 int absChargeTrack)
395408 {
396- mCtr .init (registry, specs, confCpr. plotAverage . value , confCpr. plotAllRadii . value , confCpr. cutAverage . value , confCpr. cutAnyRadius . value , confCpr. detaMax . value , confCpr. dphistarMax . value , absChargeTrack, 1 );
409+ mCtr .init (registry, specs, confCpr, absChargeTrack, 1 );
397410 }
398411
399412 void setMagField (float magField) { mCtr .setMagField (magField); }
@@ -412,7 +425,7 @@ class ClosePairRejectionTrackV0 // can also be used for any particle type that h
412425
413426 bool isClosePair () const { return mCtr .isClosePair (); }
414427
415- void fill () { mCtr .fill (); }
428+ void fill (float kstar ) { mCtr .fill (kstar ); }
416429
417430 private:
418431 CloseTrackRejection<prefixTrackV0> mCtr ;
@@ -430,8 +443,8 @@ class ClosePairRejectionTrackCascade
430443 T2 const & confCprV0Daughter,
431444 int absChargeTrack)
432445 {
433- mCtrBachelor .init (registry, specsBachelor, confCprBachelor. plotAverage . value , confCprBachelor. plotAllRadii . value , confCprBachelor. cutAverage . value , confCprBachelor. cutAnyRadius . value , confCprBachelor. detaMax . value , confCprBachelor. dphistarMax . value , absChargeTrack, 1 );
434- mCtrV0Daughter .init (registry, specsV0Daughter, confCprV0Daughter. plotAverage . value , confCprV0Daughter. plotAllRadii . value , confCprV0Daughter. cutAverage . value , confCprV0Daughter. cutAnyRadius . value , confCprV0Daughter. detaMax . value , confCprV0Daughter. dphistarMax . value , absChargeTrack, 1 );
446+ mCtrBachelor .init (registry, specsBachelor, confCprBachelor, absChargeTrack, 1 );
447+ mCtrV0Daughter .init (registry, specsV0Daughter, confCprV0Daughter, absChargeTrack, 1 );
435448 }
436449
437450 void setMagField (float magField)
@@ -461,10 +474,10 @@ class ClosePairRejectionTrackCascade
461474 return mCtrBachelor .isClosePair () || mCtrBachelor .isClosePair ();
462475 }
463476
464- void fill ()
477+ void fill (float kstar )
465478 {
466- mCtrBachelor .fill ();
467- mCtrV0Daughter .fill ();
479+ mCtrBachelor .fill (kstar );
480+ mCtrV0Daughter .fill (kstar );
468481 }
469482
470483 private:
@@ -482,7 +495,7 @@ class ClosePairRejectionTrackKink
482495 T const & confCpr,
483496 int absChargeTrack)
484497 {
485- mCtr .init (registry, specs, confCpr. plotAverage . value , confCpr. plotAllRadii . value , confCpr. cutAverage . value , confCpr. cutAnyRadius . value , confCpr. detaMax . value , confCpr. dphistarMax . value , absChargeTrack, 1 );
498+ mCtr .init (registry, specs, confCpr, absChargeTrack, 1 );
486499 }
487500
488501 void setMagField (float magField)
@@ -498,7 +511,7 @@ class ClosePairRejectionTrackKink
498511 }
499512
500513 bool isClosePair () const { return mCtr .isClosePair (); }
501- void fill () { mCtr .fill (); }
514+ void fill (float kstar ) { mCtr .fill (kstar ); }
502515
503516 private:
504517 CloseTrackRejection<prefix> mCtr ;
0 commit comments