2727#include " Common/Core/RecoDecay.h"
2828
2929#include < CommonConstants/MathConstants.h>
30+ #include < CommonConstants/PhysicsConstants.h>
3031#include < Framework/AnalysisHelpers.h>
3132#include < Framework/Configurable.h>
3233#include < Framework/HistogramRegistry.h>
@@ -60,34 +61,39 @@ struct ConfKinkFilters : o2::framework::ConfigurableGroup {
6061
6162// selections bits for all kinks
6263// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
63- #define KINK_DEFAULT_BITS \
64- o2::framework::Configurable<bool > passThrough{" passThrough" , false , " If true, all Kinks are passed through. Bits for all selections are stored." }; \
65- o2::framework::Configurable<std::vector<float >> kinkTopoDcaMax{" kinkTopoDcaMax" , {2 .0f }, " Maximum kink topological DCA" }; \
66- o2::framework::Configurable<std::vector<float >> transRadMin{" transRadMin" , {20 . f }, " Minimum transverse radius (cm)" }; \
67- o2::framework::Configurable<std::vector<float >> transRadMax{" transRadMax" , {100 .f }, " Maximum transverse radius (cm)" }; \
68- o2::framework::Configurable<std::vector<float >> dauAbsEtaMax{" dauAbsEtaMax" , {1 .0f }, " Maximum absolute pseudorapidity for daughter track" }; \
69- o2::framework::Configurable<std::vector<float >> dauDcaPvMin{" dauDcaPvMin" , {0 .1f }, " Minimum DCA of daughter from primary vertex (cm)" }; \
70- o2::framework::Configurable<std::vector<float >> mothDcaPvMax{" mothDcaPvMax" , {1 .0f }, " Maximum DCA of mother from primary vertex (cm)" }; \
71- o2::framework::Configurable<std::vector<float >> alphaAPMin{ " alphaAPMin " , {- 1 . 0f }, " Minimum Alpha_AP for Sigma candidates" }; \
72- o2::framework::Configurable<std::vector<float >> alphaAPMax{ " alphaAPMax " , {0 .0f }, " Maximum Alpha_AP for Sigma candidates" }; \
73- o2::framework::Configurable<std::vector<float >> qtAPMin{ " qtAPMin " , {0 .15f }, " Minimum qT_AP for Sigma candidates " }; \
74- o2::framework::Configurable<std::vector<float >> qtAPMax{ " qtAPMax " , {0 .2f }, " Maximum qT_AP for Sigma candidates " }; \
75- o2::framework::Configurable<std::vector<float >> cosPointingAngleMin{ " cosPointingAngleMin " , {0 . 0f }, " Minimum cosine of pointing angle " };
64+ #define KINK_DEFAULT_BITS \
65+ o2::framework::Configurable<bool > passThrough{" passThrough" , false , " If true, all Kinks are passed through. Bits for all selections are stored." }; \
66+ o2::framework::Configurable<std::vector<float >> kinkTopoDcaMax{" kinkTopoDcaMax" , {2 .0f }, " Maximum kink topological DCA" }; \
67+ o2::framework::Configurable<std::vector<float >> transRadMin{" transRadMin" , {19 . 6f }, " Minimum transverse radius (cm)" }; \
68+ o2::framework::Configurable<std::vector<float >> transRadMax{" transRadMax" , {100 .f }, " Maximum transverse radius (cm)" }; \
69+ o2::framework::Configurable<std::vector<float >> dauAbsEtaMax{" dauAbsEtaMax" , {1 .0f }, " Maximum absolute pseudorapidity for daughter track" }; \
70+ o2::framework::Configurable<std::vector<float >> dauDcaPvMin{" dauDcaPvMin" , {0 .1f }, " Minimum DCA of daughter from primary vertex (cm)" }; \
71+ o2::framework::Configurable<std::vector<float >> mothDcaPvMax{" mothDcaPvMax" , {1 .0f }, " Maximum DCA of mother from primary vertex (cm)" }; \
72+ o2::framework::Configurable<std::vector<float >> qtAPMin{ " qtAPMin " , {0 . 15f }, " Minimum qT_AP for Sigma candidates" }; \
73+ o2::framework::Configurable<std::vector<float >> qtAPMax{ " qtAPMax " , {0 .2f }, " Maximum qT_AP for Sigma candidates" }; \
74+ o2::framework::Configurable<std::vector<float >> cosPointingAngleMin{ " cosPointingAngleMin " , {0 .0f }, " Minimum cosine of pointing angle " }; \
75+ o2::framework::Configurable<std::vector<float >> ptOriginalMin{ " ptOriginalMin " , {1 .2f }, " Minimum original (not recalculated) pT of the mother (GeV/c) " }; \
76+ o2::framework::Configurable<std::vector<float >> ptOriginalMax{ " ptOriginalMax " , {10 . f }, " Maximum original (not recalculated) pT of the mother (GeV/c) " };
7677
7778// derived selection bits for sigma
7879struct ConfSigmaBits : o2::framework::ConfigurableGroup {
7980 std::string prefix = std::string(" SigmaBits" );
8081 KINK_DEFAULT_BITS
82+ o2::framework::Configurable<std::vector<float >> alphaAPMin{" alphaAPMin" , {-1 .0f }, " Minimum Alpha_AP for Sigma candidates" };
83+ o2::framework::Configurable<std::vector<float >> alphaAPMax{" alphaAPMax" , {0 .0f }, " Maximum Alpha_AP for Sigma candidates" };
8184 o2::framework::Configurable<std::vector<float >> chaDauTpcPion{" chaDauTpcPion" , {5 .f }, " Maximum |nsigma_Pion| TPC for charged daughter tracks" };
8285};
8386
8487// derived selection bits for sigma plus
8588struct ConfSigmaPlusBits : o2::framework::ConfigurableGroup {
8689 std::string prefix = std::string(" SigmaPlusBits" );
8790 KINK_DEFAULT_BITS
91+ o2::framework::Configurable<std::vector<float >> alphaAPMin{" alphaAPMin" , {0 .0f }, " Minimum Alpha_AP for SigmaPlus candidates" };
92+ o2::framework::Configurable<std::vector<float >> alphaAPMax{" alphaAPMax" , {1 .0f }, " Maximum Alpha_AP for SigmaPlus candidates" };
8893 o2::framework::Configurable<std::vector<float >> chaDauTpcProton{" chaDauTpcProton" , {5 .f }, " Maximum |nsigma_Proton| TPC for charged daughter tracks" };
89- o2::framework::Configurable<std::vector<float >> chaDauTofProton{" chaDauTofProton" , {5 .f }, " Maximum combined |nsigma_Proton| (TPC+TOF) for charged daughter tracks" };
90- o2::framework::Configurable<float > pidThres{" pidThres" , 0 .75f , " Momentum threshold for using TOF/combined pid for daughter tracks (GeV/c)" };
94+ o2::framework::Configurable<std::vector<float >> chaDauTofProton{" chaDauTofProton" , {}, " Maximum |nsigma_Proton| TOF for charged daughter tracks" };
95+ o2::framework::Configurable<bool > requireTof{" requireTof" , false , " If true, TOF PID is a minimal selection. If false, TOF PID is optional" };
96+ o2::framework::Configurable<bool > keepTracksWithoutTof{" keepTracksWithoutTof" , true , " If true, the bit mask for the TOF selection will be true for all limits if the daughter track has no TOF" };
9197};
9298
9399#undef KINK_DEFAULT_BITS
@@ -153,6 +159,9 @@ enum KinkSeles {
153159 kQtAPMax ,
154160 kCosPointingAngleMin ,
155161
162+ kPtOriginalMin ,
163+ kPtOriginalMax ,
164+
156165 kKinkSelsMax
157166};
158167
@@ -173,7 +182,9 @@ const std::unordered_map<KinkSeles, std::string> kinkSelectionNames = {
173182 {kAlphaAPMax , " alphaAPMax" },
174183 {kQtAPMin , " qtAPMin" },
175184 {kQtAPMax , " qtAPMax" },
176- {kCosPointingAngleMin , " cosPointingAngleMin" }};
185+ {kCosPointingAngleMin , " cosPointingAngleMin" },
186+ {kPtOriginalMin , " ptOriginalMin" },
187+ {kPtOriginalMax , " ptOriginalMax" }};
177188
178189// / enum for all kink pre-filters (evaluated in checkFilters, before the selection bitmask)
179190enum KinkFilters {
@@ -231,9 +242,9 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
231242 if constexpr (modes::isEqual (kinkType, modes::Kink::kSigmaPlus )) {
232243 mMassSigmaPlusLowerLimit = filter.massMinSigmaPlus .value ;
233244 mMassSigmaPlusUpperLimit = filter.massMaxSigmaPlus .value ;
234- mPidThreshold = config.pidThres .value ;
235- this ->addSelection (kChaDaughTpcProton , kinkSelectionNames.at (kChaDaughTpcProton ), config.chaDauTpcProton .value , limits::kAbsUpperLimit , false , false , true );
236- this ->addSelection (kChaDaughTofProton , kinkSelectionNames.at (kChaDaughTofProton ), config.chaDauTofProton .value , limits::kUpperLimit , false , false , true );
245+ mKeepTracksWithoutTof = config.keepTracksWithoutTof .value ;
246+ this ->addSelection (kChaDaughTpcProton , kinkSelectionNames.at (kChaDaughTpcProton ), config.chaDauTpcProton .value , limits::kAbsUpperLimit , true , true , false );
247+ this ->addSelection (kChaDaughTofProton , kinkSelectionNames.at (kChaDaughTofProton ), config.chaDauTofProton .value , limits::kAbsUpperLimit , true , config. requireTof . value , false );
237248 }
238249
239250 this ->addSelection (kKinkTopoDcaMax , kinkSelectionNames.at (kKinkTopoDcaMax ), config.kinkTopoDcaMax .value , limits::kUpperLimit , true , true , false );
@@ -247,6 +258,8 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
247258 this ->addSelection (kQtAPMin , kinkSelectionNames.at (kQtAPMin ), config.qtAPMin .value , limits::kLowerLimit , true , true , false );
248259 this ->addSelection (kQtAPMax , kinkSelectionNames.at (kQtAPMax ), config.qtAPMax .value , limits::kUpperLimit , true , true , false );
249260 this ->addSelection (kCosPointingAngleMin , kinkSelectionNames.at (kCosPointingAngleMin ), config.cosPointingAngleMin .value , limits::kLowerLimit , true , true , false );
261+ this ->addSelection (kPtOriginalMin , kinkSelectionNames.at (kPtOriginalMin ), config.ptOriginalMin .value , limits::kLowerLimit , true , true , false );
262+ this ->addSelection (kPtOriginalMax , kinkSelectionNames.at (kPtOriginalMax ), config.ptOriginalMax .value , limits::kUpperLimit , true , true , false );
250263
251264 this ->setupSelectionHistogram <SelectionHistName>(registry);
252265
@@ -281,7 +294,7 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
281294 };
282295
283296 template <typename T1 , typename T2 , typename T3 >
284- void computeKinkKinematics (T1 const & kinkCand, T2 const & /* tracks*/ , T3 const & col)
297+ void computeKinkKinematics (T1 const & kinkCand, T2 const & /* tracks*/ , T3 const & /* col*/ )
285298 {
286299 std::array<float , 3 > momMother = {kinkCand.pxMoth (), kinkCand.pyMoth (), kinkCand.pzMoth ()};
287300 float kinkMomP = RecoDecay::p (momMother);
@@ -300,12 +313,11 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
300313 float p2A = kinkDauP * kinkDauP;
301314 mQtAp = (p2V0 > 0 .f ) ? std::sqrt (std::max (0 .f , p2A - dp * dp / p2V0)) : 0 .f ;
302315
303- std::array<float , 3 > vMother = {kinkCand.xDecVtx () - col. posX () , kinkCand.yDecVtx () - col. posY () , kinkCand.zDecVtx () - col. posZ ()};
316+ std::array<float , 3 > vMother = {kinkCand.xDecVtx (), kinkCand.yDecVtx (), kinkCand.zDecVtx ()};
304317 float vMotherNorm = std::sqrt (std::inner_product (vMother.begin (), vMother.end (), vMother.begin (), 0 .f ));
305318 mCosPointingAngle = (vMotherNorm > 0 .f && kinkMomP > 0 .f ) ? (std::inner_product (momMother.begin (), momMother.end (), vMother.begin (), 0 .f )) / (kinkMomP * vMotherNorm) : 0 .f ;
306319 mTransRadius = std::hypot (kinkCand.xDecVtx (), kinkCand.yDecVtx ());
307320
308- mKinkDauP = kinkDauP;
309321 mKinkDauEta = RecoDecay::eta (momDaughter);
310322
311323 mKinkAngle = 0 .f ;
@@ -327,6 +339,9 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
327339 this ->evaluateObservable (kQtAPMin , mQtAp );
328340 this ->evaluateObservable (kQtAPMax , mQtAp );
329341 this ->evaluateObservable (kCosPointingAngleMin , mCosPointingAngle );
342+ // the stored pT is the recalculated one, the original pT is only available as selection bits
343+ this ->evaluateObservable (kPtOriginalMin , mKinkMotherPtOriginal );
344+ this ->evaluateObservable (kPtOriginalMax , mKinkMotherPtOriginal );
330345 this ->evaluateObservable (kKinkTopoDcaMax , kinkCand.dcaKinkTopo ());
331346
332347 // Compute transRadius
@@ -345,14 +360,11 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
345360 this ->evaluateObservable (kChaDaughTpcPion , chaDaughter.tpcNSigmaPi ());
346361 }
347362 if constexpr (modes::isEqual (kinkType, modes::Kink::kSigmaPlus )) {
348- if (mKinkDauP < mPidThreshold ) {
349- this ->evaluateObservable (kChaDaughTpcProton , chaDaughter.tpcNSigmaPr ());
363+ this ->evaluateObservable (kChaDaughTpcProton , chaDaughter.tpcNSigmaPr ());
364+ if (chaDaughter.hasTOF ()) {
365+ this ->evaluateObservable (kChaDaughTofProton , chaDaughter.tofNSigmaPr ());
350366 } else {
351- if (chaDaughter.hasTOF ()) {
352- this ->evaluateObservable (kChaDaughTofProton , std::abs (chaDaughter.tofNSigmaPr ()));
353- } else {
354- this ->evaluateObservable (kChaDaughTofProton , 999 .f );
355- }
367+ this ->evaluateObservable (kChaDaughTofProton , mKeepTracksWithoutTof ? 0 .f : 999 .f );
356368 }
357369 }
358370
@@ -368,9 +380,20 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
368380 mKinkMotherEta = RecoDecay::eta (momMother);
369381 mKinkMotherPhi = RecoDecay::phi (momMother);
370382
371- // Recalculate pT using kinematic constraints
372- float ptRecalc = utils::calcPtnew (momMother[0 ], momMother[1 ], momMother[2 ], momDaughter[0 ], momDaughter[1 ], momDaughter[2 ]);
373- mKinkMotherPt = (ptRecalc > 0 .f ) ? ptRecalc : std::hypot (momMother[0 ], momMother[1 ]);
383+ // Recalculate pT using kinematic constraints of the decay channel
384+ float ptRecalc = -999 .f ;
385+ if constexpr (modes::isEqual (kinkType, modes::Kink::kSigma )) {
386+ // Sigma- -> pi- n
387+ ptRecalc = utils::calcPtnew (momMother[0 ], momMother[1 ], momMother[2 ], momDaughter[0 ], momDaughter[1 ], momDaughter[2 ],
388+ o2::constants::physics::MassSigmaMinus, o2::constants::physics::MassPionCharged, o2::constants::physics::MassNeutron);
389+ }
390+ if constexpr (modes::isEqual (kinkType, modes::Kink::kSigmaPlus )) {
391+ // Sigma+ -> p pi0
392+ ptRecalc = utils::calcPtnew (momMother[0 ], momMother[1 ], momMother[2 ], momDaughter[0 ], momDaughter[1 ], momDaughter[2 ],
393+ o2::constants::physics::MassSigmaPlus, o2::constants::physics::MassProton, o2::constants::physics::MassPionNeutral);
394+ }
395+ mKinkMotherPtOriginal = std::hypot (momMother[0 ], momMother[1 ]);
396+ mKinkMotherPt = (ptRecalc > 0 .f ) ? ptRecalc : mKinkMotherPtOriginal ;
374397 }
375398
376399 template <typename T>
@@ -443,7 +466,7 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
443466 float mMassSigmaUpperLimit = 1 .25f ;
444467 float mMassSigmaPlusLowerLimit = 1 .15f ;
445468 float mMassSigmaPlusUpperLimit = 1 .25f ;
446- float mPidThreshold = 0 . 75f ;
469+ bool mKeepTracksWithoutTof = true ;
447470
448471 // kinematic filters
449472 float mPtMin = 0 .f;
@@ -454,7 +477,8 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
454477 float mPhiMax = o2::constants::math::TwoPI;
455478
456479 // mother kinematic
457- float mKinkMotherPt = 0 .f;
480+ float mKinkMotherPt = 0 .f; // recalculated pT (falls back to the original pT if the recalculation fails)
481+ float mKinkMotherPtOriginal = 0 .f; // pT of the mother track as reconstructed
458482 float mKinkMotherEta = 0 .f;
459483 float mKinkMotherPhi = 0 .f;
460484
@@ -464,7 +488,6 @@ class KinkSelection : public baseselection::BaseSelection<float, o2::analysis::f
464488 float mCosPointingAngle = 0 .f;
465489 float mTransRadius = 0 .f;
466490 float mKinkDauEta = 0 .f;
467- float mKinkDauP = 0 .f;
468491 float mKinkAngle = 0 .f;
469492};
470493
@@ -549,7 +572,8 @@ class KinkBuilder
549572 }
550573 }
551574
552- if (mProduceSigmas || mProduceSigmaMasks || mProduceSigmaExtras || mProduceSigmaPlus || mProduceSigmaPlusMasks || mProduceSigmaPlusExtras ) {
575+ if (mProduceSigmas || mProduceLiteSigmas || mProduceSigmaMasks || mProduceSigmaExtras ||
576+ mProduceSigmaPlus || mProduceLiteSigmaPlus || mProduceSigmaPlusMasks || mProduceSigmaPlusExtras ) {
553577 mFillAnyTable = true ;
554578 } else {
555579 LOG (info) << " No tables configured, Selection object will not be configured..." ;
0 commit comments