Skip to content

Commit dc40dc1

Browse files
authored
Update PIDTOF.h
1 parent 83938db commit dc40dc1

1 file changed

Lines changed: 29 additions & 22 deletions

File tree

Common/Core/PID/PIDTOF.h

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ class ExpTimes
409409
/// Gets the expected signal of the track of interest under the PID assumption corrected for shifts in expected momentum
410410
/// \param parameters Parameters to correct for the momentum shift
411411
/// \param track Track of interest
412-
static float GetCorrectedExpectedSignal(const TOFResoParamsV2& parameters, const TrackType& track)
412+
template <typename ParamType>
413+
static float GetCorrectedExpectedSignal(const ParamType& parameters, const TrackType& track)
413414
{
414415
if (!track.hasTOF()) {
415416
return defaultReturnValue;
@@ -421,28 +422,14 @@ class ExpTimes
421422
return ComputeExpectedTime(track.tofExpMom() / (1.f + track.sign() * parameters.getShift(track.eta())), track.length()) + parameters.getTimeShift(track.eta(), track.sign());
422423
}
423424

424-
/// Gets the expected signal of the track of interest under the PID assumption corrected for shifts in expected momentum
425-
/// \param parameters Parameters to correct for the momentum shift
426-
/// \param track Track of interest
427-
static float GetCorrectedExpectedSignal(const TOFResoParamsV3& parameters, const TrackType& track)
428-
{
429-
if (!track.hasTOF()) {
430-
return defaultReturnValue;
431-
}
432-
if (track.trackType() == o2::aod::track::Run2Track) {
433-
return ComputeExpectedTime(track.tofExpMom() * kCSPEDDInv / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta())), track.length());
434-
}
435-
LOG(debug) << "TOF exp. mom. " << track.tofExpMom() << " shifted = " << track.tofExpMom() / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta()));
436-
return ComputeExpectedTime(track.tofExpMom() / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta())), track.length()) + parameters.getTimeShift(track.eta(), track.sign());
437-
}
438-
439425
/// Gets the expected resolution of the t-texp-t0
440426
/// Given a TOF signal and collision time resolutions
441427
/// \param parameters Detector response parameters
442428
/// \param track Track of interest
443429
/// \param tofSignal TOF signal of the track of interest
444430
/// \param collisionTimeRes Collision time resolution of the track of interest
445-
static float GetExpectedSigma(const TOFResoParamsV2& parameters, const TrackType& track, const float tofSignal, const float collisionTimeRes)
431+
template <typename ParamType>
432+
static float GetExpectedSigma(const ParamType& parameters, const TrackType& track, const float tofSignal, const float collisionTimeRes)
446433
{
447434
const float& mom = track.p();
448435
if (mom <= 0) {
@@ -468,29 +455,49 @@ class ExpTimes
468455
/// Gets the expected resolution of the t-texp-t0
469456
/// \param parameters Detector response parameters
470457
/// \param track Track of interest
471-
static float GetExpectedSigma(const TOFResoParamsV2& parameters, const TrackType& track) { return GetExpectedSigma(parameters, track, track.tofSignal(), track.tofEvTimeErr()); }
458+
template <typename ParamType>
459+
static float GetExpectedSigma(const ParamType& parameters, const TrackType& track)
460+
{
461+
return GetExpectedSigma(parameters, track, track.tofSignal(), track.tofEvTimeErr());
462+
}
472463

473464
/// Gets the expected resolution of the time measurement, uses the expected time and no event time resolution
474465
/// \param parameters Parameters to use to compute the expected resolution
475466
/// \param track Track of interest
476-
static float GetExpectedSigmaTracking(const TOFResoParamsV2& parameters, const TrackType& track) { return GetExpectedSigma(parameters, track, GetCorrectedExpectedSignal(parameters, track), 0.f); }
467+
template <typename ParamType>
468+
static float GetExpectedSigmaTracking(const ParamType& parameters, const TrackType& track)
469+
{
470+
return GetExpectedSigma(parameters, track, GetCorrectedExpectedSignal(parameters, track), 0.f);
471+
}
477472

478473
/// Gets the number of sigmas with respect the expected time
479474
/// \param parameters Detector response parameters
480475
/// \param track Track of interest
481476
/// \param collisionTime Collision time
482477
/// \param collisionTimeRes Collision time resolution of the track of interest
483-
static float GetSeparation(const TOFResoParamsV2& parameters, const TrackType& track, const float collisionTime, const float resolution) { return track.hasTOF() ? (track.tofSignal() - collisionTime - GetCorrectedExpectedSignal(parameters, track)) / resolution : defaultReturnValue; }
478+
template <typename ParamType>
479+
static float GetSeparation(const ParamType& parameters, const TrackType& track, const float collisionTime, const float resolution)
480+
{
481+
return track.hasTOF() ? (track.tofSignal() - collisionTime - GetCorrectedExpectedSignal(parameters, track)) / resolution : defaultReturnValue;
482+
}
484483

485484
/// Gets the number of sigmas with respect the expected time
486485
/// \param parameters Detector response parameters
487486
/// \param track Track of interest
488-
static float GetSeparation(const TOFResoParamsV2& parameters, const TrackType& track, const float resolution) { return GetSeparation(parameters, track, track.tofEvTime(), resolution); }
487+
template <typename ParamType>
488+
static float GetSeparation(const ParamType& parameters, const TrackType& track, const float resolution)
489+
{
490+
return GetSeparation(parameters, track, track.tofEvTime(), resolution);
491+
}
489492

490493
/// Gets the number of sigmas with respect the expected time
491494
/// \param parameters Detector response parameters
492495
/// \param track Track of interest
493-
static float GetSeparation(const TOFResoParamsV2& parameters, const TrackType& track) { return GetSeparation(parameters, track, track.tofEvTime(), GetExpectedSigma(parameters, track)); }
496+
template <typename ParamType>
497+
static float GetSeparation(const ParamType& parameters, const TrackType& track)
498+
{
499+
return GetSeparation(parameters, track, track.tofEvTime(), GetExpectedSigma(parameters, track));
500+
}
494501
};
495502

496503
/// \brief Class to convert the trackTime to the tofSignal used for PID

0 commit comments

Comments
 (0)