forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPIDTOF.h
More file actions
141 lines (114 loc) · 5.78 KB
/
PIDTOF.h
File metadata and controls
141 lines (114 loc) · 5.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
///
/// \file PIDTOF.h
/// \author Nicolo' Jacazio
/// \since 02/07/2020
/// \brief Implementation of the TOF detector response for PID
///
#ifndef O2_FRAMEWORK_PIDTOF_H_
#define O2_FRAMEWORK_PIDTOF_H_
// ROOT includes
#include "Rtypes.h"
#include "TMath.h"
// O2 includes
#include "Framework/Logger.h"
#include "ReconstructionDataFormats/PID.h"
#include "PIDBase/DetectorResponse.h"
namespace o2::pid::tof
{
// Utility values
static constexpr float kCSPEED = TMath::C() * 1.0e2f * 1.0e-12f; /// Speed of light in TOF units (cm/ps)
/// \brief Class to handle the the TOF detector response for the TOF beta measurement
template <typename Coll, typename Trck, o2::track::PID::ID id>
class Beta
{
public:
Beta() = default;
~Beta() = default;
/// Computes the beta of a track given a length, a time measurement and an event time
static float GetBeta(const float length, const float tofSignal, const float collisionTime);
/// Gets the beta for the track of interest
float GetBeta(const Coll& col, const Trck& trk) const { return GetBeta(trk.length(), trk.tofSignal(), col.collisionTime()); }
/// Computes the expected uncertainty on the beta measurement
static float GetExpectedSigma(const float& length, const float& tofSignal, const float& collisionTime, const float& time_reso);
/// Gets the expected uncertainty on the beta measurement of the track of interest
float GetExpectedSigma(const Coll& col, const Trck& trk) const { return GetExpectedSigma(trk.length(), trk.tofSignal(), col.collisionTime(), mExpectedResolution); }
/// Gets the expected beta for a given mass hypothesis (no energy loss taken into account)
static float GetExpectedSignal(const float& mom, const float& mass);
/// Gets the expected beta given the particle index (no energy loss taken into account)
float GetExpectedSignal(const Coll& col, const Trck& trk) const { return GetExpectedSignal(trk.p(), o2::track::PID::getMass2Z(id)); }
/// Gets the number of sigmas with respect the approximate beta (no energy loss taken into account)
float GetSeparation(const Coll& col, const Trck& trk) const { return (GetBeta(col, trk) - GetExpectedSignal(col, trk)) / GetExpectedSigma(col, trk); }
float mExpectedResolution = 80; /// Expected time resolution
};
//_________________________________________________________________________
template <typename Coll, typename Trck, o2::track::PID::ID id>
float Beta<Coll, Trck, id>::GetBeta(const float length, const float tofSignal, const float collisionTime)
{
if (tofSignal <= 0) {
return -999.f;
}
return length / (tofSignal - collisionTime) / kCSPEED;
}
//_________________________________________________________________________
template <typename Coll, typename Trck, o2::track::PID::ID id>
float Beta<Coll, Trck, id>::GetExpectedSigma(const float& length, const float& tofSignal, const float& collisionTime, const float& time_reso)
{
if (tofSignal <= 0) {
return -999.f;
}
return GetBeta(length, tofSignal, collisionTime) / (tofSignal - collisionTime) * time_reso;
}
//_________________________________________________________________________
template <typename Coll, typename Trck, o2::track::PID::ID id>
float Beta<Coll, Trck, id>::GetExpectedSignal(const float& mom, const float& mass)
{
if (mom > 0) {
return mom / TMath::Sqrt(mom * mom + mass * mass);
}
return 0;
}
/// \brief Class to handle the the TOF detector response for the expected time
template <typename Coll, typename Trck, o2::track::PID::ID id>
class ExpTimes
{
public:
ExpTimes() = default;
~ExpTimes() = default;
/// Computes the expected time of a track, given it TOF expected momentum
static float ComputeExpectedTime(const float& tofExpMom, const float& length, const float& massZ);
/// Gets the expected signal of the track of interest under the PID assumption
float GetExpectedSignal(const Coll& col, const Trck& trk) const { return ComputeExpectedTime(trk.tofExpMom() / kCSPEED, trk.length(), o2::track::PID::getMass2Z(id)); }
/// Gets the expected resolution of the measurement
float GetExpectedSigma(const DetectorResponse& response, const Coll& col, const Trck& trk) const;
/// Gets the number of sigmas with respect the expected time
float GetSeparation(const DetectorResponse& response, const Coll& col, const Trck& trk) const { return (trk.tofSignal() - col.collisionTime() - GetExpectedSignal(col, trk)) / GetExpectedSigma(response, col, trk); }
};
//_________________________________________________________________________
template <typename Coll, typename Trck, o2::track::PID::ID id>
float ExpTimes<Coll, Trck, id>::ComputeExpectedTime(const float& tofExpMom, const float& length, const float& massZ)
{
const float energy = sqrt((massZ * massZ) + (tofExpMom * tofExpMom));
return length * energy / (kCSPEED * tofExpMom);
}
//_________________________________________________________________________
template <typename Coll, typename Trck, o2::track::PID::ID id>
float ExpTimes<Coll, Trck, id>::GetExpectedSigma(const DetectorResponse& response, const Coll& col, const Trck& trk) const
{
if (trk.tofSignal() <= 0) {
return -999.f;
}
const float x[4] = {trk.p(), trk.tofSignal(), col.collisionTimeRes(), o2::track::PID::getMass2Z(id)};
return response(response.kSigma, x);
// return response(response.kSigma, const Coll& col, const Trck& trk, id);
}
} // namespace o2::pid::tof
#endif // O2_FRAMEWORK_PIDTOF_H_