@@ -103,9 +103,10 @@ class TrackSelectorPidBase
103103 // / Checks if track is compatible with given particle species hypothesis within given TPC nσ range.
104104 // / \param track track
105105 // / \param conditionalTof variable to store the result of selection with looser cuts for conditional accepting of track if combined with TOF
106+ // / \param tpcNSigmaCustom custom TPC nσ value to be used for the selection, in case the desired value cannot be taken from the track table
106107 // / \return true if track satisfies TPC PID hypothesis for given TPC nσ range
107108 template <typename T>
108- bool isSelectedByTpc (const T& track, bool & conditionalTof)
109+ bool isSelectedByTpc (const T& track, bool & conditionalTof, float tpcNSigmaCustom = - 999 .f )
109110 {
110111 // Accept if selection is disabled via large values.
111112 if (mNSigmaTpcMin < -999 . && mNSigmaTpcMax > 999 .) {
@@ -128,6 +129,11 @@ class TrackSelectorPidBase
128129 errorPdg ();
129130 }
130131
132+ // / use custom TPC nσ, if a valid value is provided
133+ if (tpcNSigmaCustom > -999 .f ) {
134+ nSigma = tpcNSigmaCustom;
135+ }
136+
131137 if (mNSigmaTpcMinCondTof < -999 . && mNSigmaTpcMaxCondTof > 999 .) {
132138 conditionalTof = true ;
133139 } else {
@@ -140,13 +146,13 @@ class TrackSelectorPidBase
140146 // / \param track track
141147 // / \return TPC selection status (see TrackSelectorPID::Status)
142148 template <typename T>
143- TrackSelectorPID::Status statusTpc (const T& track)
149+ TrackSelectorPID::Status statusTpc (const T& track, float tpcNSigmaCustom = - 999 .f )
144150 {
145151 if (!isValidForTpc (track)) {
146152 return TrackSelectorPID::NotApplicable;
147153 }
148154 bool condTof = false ;
149- if (isSelectedByTpc (track, condTof)) {
155+ if (isSelectedByTpc (track, condTof, tpcNSigmaCustom )) {
150156 return TrackSelectorPID::Accepted;
151157 } else if (condTof) {
152158 return TrackSelectorPID::Conditional; // potential to be accepted if combined with TOF
@@ -191,9 +197,10 @@ class TrackSelectorPidBase
191197 // / Checks if track is compatible with given particle species hypothesis within given TOF nσ range.
192198 // / \param track track
193199 // / \param conditionalTpc variable to store the result of selection with looser cuts for conditional accepting of track if combined with TPC
200+ // / \param tofNSigmaCustom custom TOF nσ value to be used for the selection, in case the desired value cannot be taken from the track table
194201 // / \return true if track satisfies TOF PID hypothesis for given TOF nσ range
195202 template <typename T>
196- bool isSelectedByTof (const T& track, bool & conditionalTpc)
203+ bool isSelectedByTof (const T& track, bool & conditionalTpc, float tofNSigmaCustom = - 999 .f )
197204 {
198205 // Accept if selection is disabled via large values.
199206 if (mNSigmaTofMin < -999 . && mNSigmaTofMax > 999 .) {
@@ -216,6 +223,11 @@ class TrackSelectorPidBase
216223 errorPdg ();
217224 }
218225
226+ // / use custom TOF nσ, if a valid value is provided
227+ if (tofNSigmaCustom > -999 .f ) {
228+ nSigma = tofNSigmaCustom;
229+ }
230+
219231 if (mNSigmaTofMinCondTpc < -999 . && mNSigmaTofMaxCondTpc > 999 .) {
220232 conditionalTpc = true ;
221233 } else {
@@ -228,13 +240,13 @@ class TrackSelectorPidBase
228240 // / \param track track
229241 // / \return TOF selection status (see TrackSelectorPID::Status)
230242 template <typename T>
231- TrackSelectorPID::Status statusTof (const T& track)
243+ TrackSelectorPID::Status statusTof (const T& track, float tofNSigmaCustom = - 999 .f )
232244 {
233245 if (!isValidForTof (track)) {
234246 return TrackSelectorPID::NotApplicable;
235247 }
236248 bool condTpc = false ;
237- if (isSelectedByTof (track, condTpc)) {
249+ if (isSelectedByTof (track, condTpc, tofNSigmaCustom )) {
238250 return TrackSelectorPID::Accepted;
239251 } else if (condTpc) {
240252 return TrackSelectorPID::Conditional; // potential to be accepted if combined with TPC
@@ -391,10 +403,10 @@ class TrackSelectorPidBase
391403 // / \param track track
392404 // / \return status of combined PID (TPC or TOF) (see TrackSelectorPID::Status)
393405 template <typename T>
394- TrackSelectorPID::Status statusTpcOrTof (const T& track)
406+ TrackSelectorPID::Status statusTpcOrTof (const T& track, float tpcNSigmaCustom = - 999 .f, float tofNSigmaCustom = - 999 .f )
395407 {
396- int pidTpc = statusTpc (track);
397- int pidTof = statusTof (track);
408+ int pidTpc = statusTpc (track, tpcNSigmaCustom );
409+ int pidTof = statusTof (track, tofNSigmaCustom );
398410
399411 if (pidTpc == TrackSelectorPID::Accepted || pidTof == TrackSelectorPID::Accepted) {
400412 return TrackSelectorPID::Accepted;
@@ -412,15 +424,15 @@ class TrackSelectorPidBase
412424 // / \param track track
413425 // / \return status of combined PID (TPC and TOF) (see TrackSelectorPID::Status)
414426 template <typename T>
415- TrackSelectorPID::Status statusTpcAndTof (const T& track)
427+ TrackSelectorPID::Status statusTpcAndTof (const T& track, float tpcNSigmaCustom = - 999 .f, float tofNSigmaCustom = - 999 .f )
416428 {
417429 int pidTpc = TrackSelectorPID::NotApplicable;
418430 if (track.hasTPC ()) {
419- pidTpc = statusTpc (track);
431+ pidTpc = statusTpc (track, tpcNSigmaCustom );
420432 }
421433 int pidTof = TrackSelectorPID::NotApplicable;
422434 if (track.hasTOF ()) {
423- pidTof = statusTof (track);
435+ pidTof = statusTof (track, tofNSigmaCustom );
424436 }
425437
426438 if (pidTpc == TrackSelectorPID::Accepted && pidTof == TrackSelectorPID::Accepted) {
0 commit comments