@@ -51,7 +51,7 @@ namespace pidtofgeneric
5151
5252static constexpr float kCSPEED = TMath::C() * 1 .0e2f * 1 .0e-12f ; // c in cm/ps
5353
54- template <typename TCollision, typename TTrack>
54+ template <typename TTrack>
5555class TofPidNewCollision
5656{
5757 public:
@@ -83,85 +83,95 @@ class TofPidNewCollision
8383 pidType = pidId;
8484 }
8585
86- float GetTOFNSigma (o2::track::PID::ID pidId, TTrack const & track, TCollision const & originalcol, TCollision const & correctedcol, bool EnableBCAO2D = true )
87- {
88- float mMassHyp = o2::track::pid_constants::sMasses2Z [track.pidForTracking ()];
89- float expTime = track.length () * sqrt ((mMassHyp * mMassHyp ) + (track.tofExpMom () * track.tofExpMom ())) / (kCSPEED * track.tofExpMom ()); // L*E/(p*c) = L/v
86+ template <typename TCollision>
87+ float GetTOFNSigma (o2::track::PID::ID pidId, TTrack const & track, TCollision const & originalcol, TCollision const & correctedcol, bool EnableBCAO2D = true );
9088
91- float evTime = correctedcol.evTime ();
92- float evTimeErr = correctedcol.evTimeErr ();
93- float tofsignal = track.trackTime () * 1000 + expTime; // in ps
94- float expSigma, tofNsigma;
89+ template <typename TCollision>
90+ float GetTOFNSigma (TTrack const & track, TCollision const & originalcol, TCollision const & correctedcol, bool EnableBCAO2D = true );
91+ };
9592
96- if (originalcol.globalIndex () == correctedcol.globalIndex ()) {
97- evTime = track.evTimeForTrack ();
98- evTimeErr = track.evTimeErrForTrack ();
93+ template <typename TTrack>
94+ template <typename TCollision>
95+ float TofPidNewCollision<TTrack>::GetTOFNSigma(o2::track::PID::ID pidId, TTrack const & track, TCollision const & originalcol, TCollision const & correctedcol, bool EnableBCAO2D)
96+ {
97+ float mMassHyp = o2::track::pid_constants::sMasses2Z [track.pidForTracking ()];
98+ float expTime = track.length () * sqrt ((mMassHyp * mMassHyp ) + (track.tofExpMom () * track.tofExpMom ())) / (kCSPEED * track.tofExpMom ()); // L*E/(p*c) = L/v
99+
100+ float evTime = correctedcol.evTime ();
101+ float evTimeErr = correctedcol.evTimeErr ();
102+ float tofsignal = track.trackTime () * 1000 + expTime; // in ps
103+ float expSigma, tofNsigma;
104+
105+ if (originalcol.globalIndex () == correctedcol.globalIndex ()) {
106+ evTime = track.evTimeForTrack ();
107+ evTimeErr = track.evTimeErrForTrack ();
108+ } else {
109+ if (EnableBCAO2D) {
110+ auto originalbc = originalcol.template bc_as <o2::aod::BCsWithTimestamps>();
111+ auto correctedbc = correctedcol.template bc_as <o2::aod::BCsWithTimestamps>();
112+ o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR (originalbc.globalBC ());
113+ o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR (correctedbc.globalBC ());
114+ tofsignal += originalIR.differenceInBCNS (correctedIR) * 1000 ;
99115 } else {
100- if (EnableBCAO2D) {
101- auto originalbc = originalcol.template bc_as <o2::aod::BCsWithTimestamps>();
102- auto correctedbc = correctedcol.template bc_as <o2::aod::BCsWithTimestamps>();
103- o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR (originalbc.globalBC ());
104- o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR (correctedbc.globalBC ());
105- tofsignal += originalIR.differenceInBCNS (correctedIR) * 1000 ;
106- } else {
107- auto originalbc = originalcol.template foundBC_as <o2::aod::BCsWithTimestamps>();
108- auto correctedbc = correctedcol.template foundBC_as <o2::aod::BCsWithTimestamps>();
109- o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR (originalbc.globalBC ());
110- o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR (correctedbc.globalBC ());
111- tofsignal += originalIR.differenceInBCNS (correctedIR) * 1000 ;
112- }
116+ auto originalbc = originalcol.template foundBC_as <o2::aod::BCsWithTimestamps>();
117+ auto correctedbc = correctedcol.template foundBC_as <o2::aod::BCsWithTimestamps>();
118+ o2::InteractionRecord originalIR = o2::InteractionRecord::long2IR (originalbc.globalBC ());
119+ o2::InteractionRecord correctedIR = o2::InteractionRecord::long2IR (correctedbc.globalBC ());
120+ tofsignal += originalIR.differenceInBCNS (correctedIR) * 1000 ;
113121 }
114-
115- switch (pidId) {
116- case 0 :
117- expSigma = responseEl.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
118- tofNsigma = (tofsignal - evTime - responseEl.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
119- break ;
120- case 1 :
121- expSigma = responseMu.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
122- tofNsigma = (tofsignal - evTime - responseMu.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
123- break ;
124- case 2 :
125- expSigma = responsePi.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
126- tofNsigma = (tofsignal - evTime - responsePi.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
127- break ;
128- case 3 :
129- expSigma = responseKa.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
130- tofNsigma = (tofsignal - evTime - responseKa.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
131- break ;
132- case 4 :
133- expSigma = responsePr.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
134- tofNsigma = (tofsignal - evTime - responsePr.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
135- break ;
136- case 5 :
137- expSigma = responseDe.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
138- tofNsigma = (tofsignal - evTime - responseDe.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
139- break ;
140- case 6 :
141- expSigma = responseTr.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
142- tofNsigma = (tofsignal - evTime - responseTr.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
143- break ;
144- case 7 :
145- expSigma = responseHe.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
146- tofNsigma = (tofsignal - evTime - responseHe.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
147- break ;
148- case 8 :
149- expSigma = responseAl.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
150- tofNsigma = (tofsignal - evTime - responseAl.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
151- break ;
152- default :
153- LOG (fatal) << " Wrong particle ID in TofPidSecondary class" ;
154- return -999 ;
155- }
156-
157- return tofNsigma;
158122 }
159123
160- float GetTOFNSigma (TTrack const & track, TCollision const & originalcol, TCollision const & correctedcol, bool EnableBCAO2D = true )
161- {
162- return GetTOFNSigma (pidType, track, originalcol, correctedcol, EnableBCAO2D);
124+ switch (pidId) {
125+ case 0 :
126+ expSigma = responseEl.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
127+ tofNsigma = (tofsignal - evTime - responseEl.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
128+ break ;
129+ case 1 :
130+ expSigma = responseMu.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
131+ tofNsigma = (tofsignal - evTime - responseMu.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
132+ break ;
133+ case 2 :
134+ expSigma = responsePi.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
135+ tofNsigma = (tofsignal - evTime - responsePi.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
136+ break ;
137+ case 3 :
138+ expSigma = responseKa.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
139+ tofNsigma = (tofsignal - evTime - responseKa.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
140+ break ;
141+ case 4 :
142+ expSigma = responsePr.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
143+ tofNsigma = (tofsignal - evTime - responsePr.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
144+ break ;
145+ case 5 :
146+ expSigma = responseDe.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
147+ tofNsigma = (tofsignal - evTime - responseDe.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
148+ break ;
149+ case 6 :
150+ expSigma = responseTr.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
151+ tofNsigma = (tofsignal - evTime - responseTr.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
152+ break ;
153+ case 7 :
154+ expSigma = responseHe.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
155+ tofNsigma = (tofsignal - evTime - responseHe.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
156+ break ;
157+ case 8 :
158+ expSigma = responseAl.GetExpectedSigma (mRespParamsV2 , track, tofsignal, evTimeErr);
159+ tofNsigma = (tofsignal - evTime - responseAl.GetCorrectedExpectedSignal (mRespParamsV2 , track)) / expSigma;
160+ break ;
161+ default :
162+ LOG (fatal) << " Wrong particle ID in TofPidSecondary class" ;
163+ return -999 ;
163164 }
164- };
165+
166+ return tofNsigma;
167+ }
168+
169+ template <typename TTrack>
170+ template <typename TCollision>
171+ float TofPidNewCollision<TTrack>::GetTOFNSigma(TTrack const & track, TCollision const & originalcol, TCollision const & correctedcol, bool EnableBCAO2D)
172+ {
173+ return GetTOFNSigma (pidType, track, originalcol, correctedcol, EnableBCAO2D);
174+ }
165175
166176} // namespace pidtofgeneric
167177} // namespace o2::aod
0 commit comments