4040namespace o2 ::pid::tof
4141{
4242
43- // Utility values (to remove!)
44- static constexpr float defaultReturnValue = -999 .f; // / Default return value in case TOF measurement is not available
45-
46- // / \brief Class to handle the the TOF detector response for the TOF beta measurement
47- class Beta
48- {
49- public:
50- Beta () = default ;
51- ~Beta () = default ;
52-
53- // / Computes the beta of a track given a length, a time measurement and an event time (in ps)
54- // / \param length Length in cm of the track
55- // / \param tofSignal TOF signal in ps for the track
56- // / \param collisionTime collision time in ps for the event of the track
57- static float GetBeta (const float length, const float tofSignal, const float collisionTime) { return length / (tofSignal - collisionTime) * o2::constants::physics::invLightSpeedCm2PS; }
58-
59- // / Gets the beta for the track of interest
60- // / \param track Track of interest
61- // / \param collisionTime Collision time
62- template <typename TrackType>
63- static float GetBeta (const TrackType& track, const float collisionTime)
64- {
65- return track.hasTOF () ? GetBeta (track.length (), track.tofSignal (), collisionTime) : defaultReturnValue;
66- }
67-
68- // / Gets the beta for the track of interest
69- // / \param track Track of interest
70- template <typename TrackType>
71- static float GetBeta (const TrackType& track)
72- {
73- return GetBeta (track, track.tofEvTime ());
74- }
75-
76- // / Computes the expected uncertainty on the beta measurement
77- // / \param length Length in cm of the track
78- // / \param tofSignal TOF signal in ps for the track
79- // / \param collisionTime collision time in ps for the event of the track
80- // / \param time_reso expected time resolution
81- static float GetExpectedSigma (const float length, const float tofSignal, const float collisionTime, const float expectedResolution) { return GetBeta (length, tofSignal, collisionTime) / (tofSignal - collisionTime) * expectedResolution; }
82-
83- // / Gets the expected uncertainty on the beta measurement of the track of interest
84- // / \param track Track of interest
85- template <typename TrackType>
86- float GetExpectedSigma (const TrackType& track) const
87- {
88- return GetExpectedSigma (track.length (), track.tofSignal (), track.tofEvTime (), mExpectedResolution );
89- }
90-
91- // / Gets the expected beta for a given mass hypothesis (no energy loss taken into account)
92- // / \param momentum momentum in GeV/c of the track
93- // / \param mass mass in GeV/c2 of the particle of interest
94- static float GetExpectedBeta (const float momentum, const float mass) { return momentum > 0 ? momentum / std::sqrt (momentum * momentum + mass * mass) : 0 .f ; }
95-
96- // / Gets the expected beta given the particle index (no energy loss taken into account) of the track of interest
97- // / \param track Track of interest
98- template <o2::track::PID::ID id, typename TrackType>
99- float GetExpectedBeta (const TrackType& track) const
100- {
101- return GetExpectedBeta (track.p (), o2::track::PID::getMass2Z (id));
102- }
103-
104- // / Gets the number of sigmas with respect the approximate beta (no energy loss taken into account) of the track of interest
105- // / \param track Track of interest
106- template <o2::track::PID::ID id, typename TrackType>
107- float GetSeparation (const TrackType& track) const
108- {
109- return (GetBeta (track) - GetExpectedBeta<id>(track)) / GetExpectedSigma (track);
110- }
111-
112- float mExpectedResolution = 80 ; // / Expected time resolution
113- };
114-
115- // / \brief Class to handle the the TOF detector response for the TOF mass measurement
116- class TOFMass
117- {
118- public:
119- TOFMass () = default ;
120- ~TOFMass () = default ;
121-
122- // / Computes the TOF mass of a track given a momentum, a beta measurement
123- // / \param momentum momentum of the track
124- // / \param beta TOF beta measurement
125- static float GetTOFMass (const float momentum, const float beta) { return (momentum / beta) * std::sqrt (std::abs (1 .f - beta * beta)); }
126-
127- // / Gets the TOF mass for the track of interest
128- // / \param track Track of interest
129- template <typename TrackType>
130- static float GetTOFMass (const TrackType& track, const float beta)
131- {
132- return track.hasTOF () ? GetTOFMass (track.p (), beta) : defaultReturnValue;
133- }
134-
135- // / Gets the TOF mass for the track of interest
136- // / \param track Track of interest
137- template <typename TrackType>
138- static float GetTOFMass (const TrackType& track)
139- {
140- return track.hasTOF () ? GetTOFMass (track.p (), Beta::GetBeta<TrackType>(track)) : defaultReturnValue;
141- }
142- };
43+ // Utility values
44+ static constexpr float defaultReturnValue = -999 .f; // / Default return value in case TOF measurement is not available
14345
14446// / \brief Next implementation class to store TOF response parameters for exp. times
14547class TOFResoParamsV2 : public o2 ::tof::Parameters<13 >
@@ -404,8 +306,7 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13>
404306
405307 void setResolutionParametrization (std::unordered_map<std::string, float > const & pars)
406308 {
407- static constexpr std::array<const char *, 9 > particleNames = {" El" , " Mu" , " Pi" , " Ka" , " Pr" , " De" , " Tr" , " He" , " Al" };
408- for (int i = 0 ; i < 9 ; ++i) {
309+ for (int i = 0 ; i < 9 ; i++) {
409310 const std::string baseOpt = Form (" tofResTrack.%s_" , particleNames[i]);
410311 // Check if a key begins with a string
411312 for (const auto & [key, value] : pars) {
@@ -422,7 +323,7 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13>
422323 }
423324 }
424325 // Print a summary
425- for (int i = 0 ; i < 9 ; ++i ) {
326+ for (int i = 0 ; i < 9 ; i++ ) {
426327 if (!mResolution [i]) {
427328 LOG (info) << " Resolution function for " << particleNames[i] << " not provided, using default " << mDefaultResoParams [i];
428329 mResolution [i] = new TF2 (Form (" tofResTrack.%s_Default" , particleNames[i]), mDefaultResoParams [i], 0 ., 20 , -1 , 1 .);
@@ -431,6 +332,8 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13>
431332 }
432333 }
433334
335+ void setResolutionParametrizationRun2 (std::unordered_map<std::string, float > const & pars);
336+
434337 template <o2::track::PID::ID pid>
435338 float getResolution (const float p, const float eta) const
436339 {
@@ -439,9 +342,8 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13>
439342
440343 void printResolution () const
441344 {
442- static constexpr std::array<const char *, 9 > particleNames = {" El" , " Mu" , " Pi" , " Ka" , " Pr" , " De" , " Tr" , " He" , " Al" };
443345 // Print a summary
444- for (int i = 0 ; i < 9 ; ++i ) {
346+ for (int i = 0 ; i < 9 ; i++ ) {
445347 if (!mResolution [i]) {
446348 LOG (info) << " Resolution function for " << particleNames[i] << " is not defined yet" ;
447349 continue ;
@@ -474,12 +376,111 @@ class TOFResoParamsV3 : public o2::tof::Parameters<13>
474376 " 315*TMath::Power((TMath::Max(x-0.811,0.1))*(1-0.4235*y*y),-0.783)" ,
475377 " 157*TMath::Power((TMath::Max(x-0.556,0.1))*(1-0.4235*y*y),-0.783)" ,
476378 " 216*TMath::Power((TMath::Max(x-0.647,0.1))*(1-0.4235*y*y),-0.76)" };
379+ static constexpr std::array<const char *, 9 > particleNames = {" El" , " Mu" , " Pi" , " Ka" , " Pr" , " De" , " Tr" , " He" , " Al" };
477380
478381 // Time shift for post calibration
479382 TGraph* gPosEtaTimeCorr = nullptr ; // / Time shift correction for positive tracks
480383 TGraph* gNegEtaTimeCorr = nullptr ; // / Time shift correction for negative tracks
481384};
482385
386+ // / \brief Class to handle the the TOF detector response for the TOF beta measurement
387+ class Beta
388+ {
389+ public:
390+ Beta () = default ;
391+ ~Beta () = default ;
392+
393+ // / Computes the beta of a track given a length, a time measurement and an event time (in ps)
394+ // / \param length Length in cm of the track
395+ // / \param tofSignal TOF signal in ps for the track
396+ // / \param collisionTime collision time in ps for the event of the track
397+ static float GetBeta (const float length, const float tofSignal, const float collisionTime) { return length / (tofSignal - collisionTime) * o2::constants::physics::invLightSpeedCm2PS; }
398+
399+ // / Gets the beta for the track of interest
400+ // / \param track Track of interest
401+ // / \param collisionTime Collision time
402+ template <typename TrackType>
403+ static float GetBeta (const TrackType& track, const float collisionTime)
404+ {
405+ return track.hasTOF () ? GetBeta (track.length (), track.tofSignal (), collisionTime) : defaultReturnValue;
406+ }
407+
408+ // / Gets the beta for the track of interest
409+ // / \param track Track of interest
410+ template <typename TrackType>
411+ static float GetBeta (const TrackType& track)
412+ {
413+ return GetBeta (track, track.tofEvTime ());
414+ }
415+
416+ // / Computes the expected uncertainty on the beta measurement
417+ // / \param length Length in cm of the track
418+ // / \param tofSignal TOF signal in ps for the track
419+ // / \param collisionTime collision time in ps for the event of the track
420+ // / \param time_reso expected time resolution
421+ static float GetExpectedSigma (const float length, const float tofSignal, const float collisionTime, const float expectedResolution) { return GetBeta (length, tofSignal, collisionTime) / (tofSignal - collisionTime) * expectedResolution; }
422+
423+ // / Gets the expected uncertainty on the beta measurement of the track of interest
424+ // / \param track Track of interest
425+ template <typename TrackType>
426+ float GetExpectedSigma (const TrackType& track) const
427+ {
428+ return GetExpectedSigma (track.length (), track.tofSignal (), track.tofEvTime (), mExpectedResolution );
429+ }
430+
431+ // / Gets the expected beta for a given mass hypothesis (no energy loss taken into account)
432+ // / \param momentum momentum in GeV/c of the track
433+ // / \param mass mass in GeV/c2 of the particle of interest
434+ static float GetExpectedBeta (const float momentum, const float mass) { return momentum > 0 ? momentum / std::sqrt (momentum * momentum + mass * mass) : 0 .f ; }
435+
436+ // / Gets the expected beta given the particle index (no energy loss taken into account) of the track of interest
437+ // / \param track Track of interest
438+ template <o2::track::PID::ID id, typename TrackType>
439+ float GetExpectedBeta (const TrackType& track) const
440+ {
441+ return GetExpectedBeta (track.p (), o2::track::PID::getMass2Z (id));
442+ }
443+
444+ // / Gets the number of sigmas with respect the approximate beta (no energy loss taken into account) of the track of interest
445+ // / \param track Track of interest
446+ template <o2::track::PID::ID id, typename TrackType>
447+ float GetSeparation (const TrackType& track) const
448+ {
449+ return (GetBeta (track) - GetExpectedBeta<id>(track)) / GetExpectedSigma (track);
450+ }
451+
452+ float mExpectedResolution = 80 ; // / Expected time resolution
453+ };
454+
455+ // / \brief Class to handle the the TOF detector response for the TOF mass measurement
456+ class TOFMass
457+ {
458+ public:
459+ TOFMass () = default ;
460+ ~TOFMass () = default ;
461+
462+ // / Computes the TOF mass of a track given a momentum, a beta measurement
463+ // / \param momentum momentum of the track
464+ // / \param beta TOF beta measurement
465+ static float GetTOFMass (const float momentum, const float beta) { return (momentum / beta) * std::sqrt (std::abs (1 .f - beta * beta)); }
466+
467+ // / Gets the TOF mass for the track of interest
468+ // / \param track Track of interest
469+ template <typename TrackType>
470+ static float GetTOFMass (const TrackType& track, const float beta)
471+ {
472+ return track.hasTOF () ? GetTOFMass (track.p (), beta) : defaultReturnValue;
473+ }
474+
475+ // / Gets the TOF mass for the track of interest
476+ // / \param track Track of interest
477+ template <typename TrackType>
478+ static float GetTOFMass (const TrackType& track)
479+ {
480+ return track.hasTOF () ? GetTOFMass (track.p (), Beta::GetBeta<TrackType>(track)) : defaultReturnValue;
481+ }
482+ };
483+
483484// / \brief Class to handle the the TOF detector response for the expected time
484485template <typename TrackType, o2::track::PID::ID id>
485486class ExpTimes
0 commit comments