Skip to content

Commit b148970

Browse files
ddobrigkalibuild
andauthored
[Common] single-device TPC PID service for testing (#12277)
Co-authored-by: ALICE Builder <alibuild@users.noreply.github.com>
1 parent ef11c50 commit b148970

File tree

5 files changed

+944
-4
lines changed

5 files changed

+944
-4
lines changed

Common/Core/PID/TPCPIDResponse.h

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,18 @@ class Response
7474
/// Gets the expected resolution of the track
7575
template <typename CollisionType, typename TrackType>
7676
float GetExpectedSigma(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id) const;
77+
/// Gets the expected resolution of the track with multTPC explicitly provided
78+
template <typename TrackType>
79+
float GetExpectedSigmaAtMultiplicity(const long multTPC, const TrackType& trk, const o2::track::PID::ID id) const;
7780
/// Gets the number of sigmas with respect the expected value
7881
template <typename CollisionType, typename TrackType>
7982
float GetNumberOfSigma(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id) const;
8083
// Number of sigmas with respect to expected for MC, defining a tune-on-data signal value
8184
template <typename CollisionType, typename TrackType>
8285
float GetNumberOfSigmaMCTuned(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const;
86+
// Number of sigmas with respect to expected for MC, defining a tune-on-data signal value, explicit multTPC
87+
template <typename TrackType>
88+
float GetNumberOfSigmaMCTunedAtMultiplicity(const long multTPC, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const;
8389
/// Gets the deviation to the expected signal
8490
template <typename TrackType>
8591
float GetSignalDelta(const TrackType& trk, const o2::track::PID::ID id) const;
@@ -116,6 +122,14 @@ inline float Response::GetExpectedSignal(const TrackType& track, const o2::track
116122
/// Gets the expected resolution of the measurement
117123
template <typename CollisionType, typename TrackType>
118124
inline float Response::GetExpectedSigma(const CollisionType& collision, const TrackType& track, const o2::track::PID::ID id) const
125+
{
126+
// use multTPC (legacy behaviour) if multTPC not provided
127+
return Response::GetExpectedSigmaAtMultiplicity(collision.multTPC(), track, id);
128+
}
129+
130+
/// Gets the expected resolution of the measurement
131+
template <typename TrackType>
132+
inline float Response::GetExpectedSigmaAtMultiplicity(const long multTPC, const TrackType& track, const o2::track::PID::ID id) const
119133
{
120134
if (!track.hasTPC()) {
121135
return -999.f;
@@ -133,7 +147,7 @@ inline float Response::GetExpectedSigma(const CollisionType& collision, const Tr
133147
const double dEdx = o2::tpc::BetheBlochAleph(static_cast<float>(bg), mBetheBlochParams[0], mBetheBlochParams[1], mBetheBlochParams[2], mBetheBlochParams[3], mBetheBlochParams[4]) * std::pow(static_cast<float>(o2::track::pid_constants::sCharges[id]), mChargeFactor);
134148
const double relReso = GetRelativeResolutiondEdx(p, mass, o2::track::pid_constants::sCharges[id], mResolutionParams[3]);
135149

136-
const std::vector<double> values{1.f / dEdx, track.tgl(), std::sqrt(ncl), relReso, track.signed1Pt(), collision.multTPC() / mMultNormalization};
150+
const std::vector<double> values{1.f / dEdx, track.tgl(), std::sqrt(ncl), relReso, track.signed1Pt(), multTPC / mMultNormalization};
137151

138152
const float reso = sqrt(pow(mResolutionParams[0], 2) * values[0] + pow(mResolutionParams[1], 2) * (values[2] * mResolutionParams[5]) * pow(values[0] / sqrt(1 + pow(values[1], 2)), mResolutionParams[2]) + values[2] * pow(values[3], 2) + pow(mResolutionParams[4] * values[4], 2) + pow(values[5] * mResolutionParams[6], 2) + pow(values[5] * (values[0] / sqrt(1 + pow(values[1], 2))) * mResolutionParams[7], 2)) * dEdx * mMIP;
139153
reso >= 0.f ? resolution = reso : resolution = -999.f;
@@ -160,7 +174,13 @@ inline float Response::GetNumberOfSigma(const CollisionType& collision, const Tr
160174
template <typename CollisionType, typename TrackType>
161175
inline float Response::GetNumberOfSigmaMCTuned(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const
162176
{
163-
if (GetExpectedSigma(collision, trk, id) < 0.) {
177+
return Response::GetNumberOfSigmaMCTunedAtMultiplicity(collision.multTPC(), trk, id, mcTunedTPCSignal);
178+
}
179+
180+
template <typename TrackType>
181+
inline float Response::GetNumberOfSigmaMCTunedAtMultiplicity(const long multTPC, const TrackType& trk, const o2::track::PID::ID id, float mcTunedTPCSignal) const
182+
{
183+
if (GetExpectedSigmaAtMultiplicity(multTPC, trk, id) < 0.) {
164184
return -999.f;
165185
}
166186
if (GetExpectedSignal(trk, id) < 0.) {
@@ -169,7 +189,7 @@ inline float Response::GetNumberOfSigmaMCTuned(const CollisionType& collision, c
169189
if (!trk.hasTPC()) {
170190
return -999.f;
171191
}
172-
return ((mcTunedTPCSignal - GetExpectedSignal(trk, id)) / GetExpectedSigma(collision, trk, id));
192+
return ((mcTunedTPCSignal - GetExpectedSignal(trk, id)) / GetExpectedSigmaAtMultiplicity(multTPC, trk, id));
173193
}
174194

175195
/// Gets the deviation between the actual signal and the expected signal

Common/TableProducer/PID/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ o2physics_add_dpl_workflow(pid-tof-full
4343

4444
# TPC
4545

46+
o2physics_add_dpl_workflow(pid-tpc-service
47+
SOURCES pidTPCService.cxx
48+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB
49+
COMPONENT_NAME Analysis)
50+
4651
o2physics_add_dpl_workflow(pid-tpc-base
4752
SOURCES pidTPCBase.cxx
4853
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB

Common/TableProducer/PID/pidTPC.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ struct tpcPid {
447447
}
448448

449449
float nSigma = -999.f;
450+
int multTPC = 0;
451+
if (trk.has_collision()) {
452+
auto collision = collisions.rawIteratorAt(trk.collisionId());
453+
multTPC = collision.multTPC();
454+
}
450455
float bg = trk.tpcInnerParam() / o2::track::pid_constants::sMasses[pid]; // estimated beta-gamma for network cutoff
451456
if (useNetworkCorrection && speciesNetworkFlags[pid] && trk.has_collision() && bg > networkBetaGammaCutoff) {
452457

@@ -469,7 +474,7 @@ struct tpcPid {
469474
LOGF(fatal, "Network output-dimensions incompatible!");
470475
}
471476
} else {
472-
nSigma = response->GetNumberOfSigmaMCTuned(collisions.iteratorAt(trk.collisionId()), trk, pid, tpcSignal);
477+
nSigma = response->GetNumberOfSigmaMCTunedAtMultiplicity(multTPC, trk, pid, tpcSignal);
473478
}
474479
if (flagFull)
475480
tableFull(expSigma, nSigma);

0 commit comments

Comments
 (0)