Skip to content

Commit d64d703

Browse files
authored
New TPC PID Response after BugFix (#610)
* New TPC PID Response after BugFix * remove SetParameters from makeTable and use functions handleParamBase
1 parent 0d9f3fe commit d64d703

16 files changed

Lines changed: 633 additions & 556 deletions

Common/Core/AnalysisCoreLinkDef.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@
1919
#pragma link C++ class o2::pid::Parametrization + ;
2020

2121
#pragma link C++ class o2::pid::tof::TOFReso + ;
22-
#pragma link C++ class o2::pid::tpc::BetheBloch + ;
23-
#pragma link C++ class o2::pid::tpc::TPCReso + ;
2422
#pragma link C++ class OrbitRange + ;
23+
#pragma link C++ class o2::pid::tpc::Response + ;

Common/Core/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ o2physics_target_root_dictionary(AnalysisCore
2323
PID/DetectorResponse.h
2424
PID/PIDTOF.h
2525
PID/TOFReso.h
26-
PID/PIDTPC.h
27-
PID/BetheBloch.h
28-
PID/TPCReso.h
26+
PID/TPCPIDResponse.h
2927
LINKDEF AnalysisCoreLinkDef.h)
3028

3129
o2physics_add_executable(merger
3230
COMPONENT_NAME aod
3331
SOURCES aodMerger.cxx
34-
PUBLIC_LINK_LIBRARIES ROOT::Hist ROOT::Core ROOT::Net)
32+
PUBLIC_LINK_LIBRARIES ROOT::Hist ROOT::Core ROOT::Net)

Common/Core/PID/BetheBloch.h

Lines changed: 0 additions & 55 deletions
This file was deleted.

Common/Core/PID/PIDTPC.h

Lines changed: 0 additions & 70 deletions
This file was deleted.

Common/Core/PID/TPCPIDResponse.h

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
///
12+
/// \file TPCPIDResponse.h
13+
/// \author Annalena Kalteyer <annalena.sophie.kalteyer@cern.ch>
14+
/// \author Christian Sonnabend
15+
/// \brief
16+
17+
#ifndef O2_PID_TPC_RESPONSE_H_
18+
#define O2_PID_TPC_RESPONSE_H_
19+
20+
#include <array>
21+
#include <vector>
22+
#include <cmath>
23+
#include "Framework/Logger.h"
24+
// O2 includes
25+
#include "ReconstructionDataFormats/PID.h"
26+
#include "DataFormatsTPC/BetheBlochAleph.h"
27+
28+
namespace o2::pid::tpc
29+
{
30+
31+
/// \brief Class to handle the TPC PID response
32+
33+
class Response
34+
{
35+
36+
public:
37+
Response() = default;
38+
~Response() = default;
39+
40+
/// Setter and Getter for the private parameters
41+
void SetBetheBlochParams(const std::array<float, 5>& betheBlochParams) { mBetheBlochParams = betheBlochParams; }
42+
void SetResolutionParamsDefault(const std::array<float, 2>& resolutionParamsDefault) { mResolutionParamsDefault = resolutionParamsDefault; }
43+
void SetResolutionParams(const std::vector<double>& resolutionParams) { mResolutionParams = resolutionParams; }
44+
void SetMIP(const float mip) { mMIP = mip; }
45+
void SetChargeFactor(const float chargeFactor) { mChargeFactor = chargeFactor; }
46+
void SetMultiplicityNormalization(const float multNormalization) { mMultNormalization = multNormalization; }
47+
void SetUseDefaultResolutionParam(const bool useDefault) { mUseDefaultResolutionParam = useDefault; }
48+
void SetParameters(const Response* response)
49+
{
50+
mBetheBlochParams = response->GetBetheBlochParams();
51+
mResolutionParamsDefault = response->GetResolutionParamsDefault();
52+
mResolutionParams = response->GetResolutionParams();
53+
mMIP = response->GetMIP();
54+
mChargeFactor = response->GetChargeFactor();
55+
mMultNormalization = response->GetMultiplicityNormalization();
56+
mUseDefaultResolutionParam = response->GetUseDefaultResolutionParam();
57+
}
58+
59+
const std::array<float, 5> GetBetheBlochParams() const { return mBetheBlochParams; }
60+
const std::array<float, 2> GetResolutionParamsDefault() const { return mResolutionParamsDefault; }
61+
const std::vector<double> GetResolutionParams() const { return mResolutionParams; }
62+
const float GetMIP() const { return mMIP; }
63+
const float GetChargeFactor() const { return mChargeFactor; }
64+
const float GetMultiplicityNormalization() const { return mMultNormalization; }
65+
const bool GetUseDefaultResolutionParam() const { return mUseDefaultResolutionParam; }
66+
67+
/// Gets the expected signal of the track
68+
template <typename TrackType>
69+
float GetExpectedSignal(const TrackType& track, const o2::track::PID::ID id) const;
70+
/// Gets the expected resolution of the track
71+
template <typename CollisionType, typename TrackType>
72+
float GetExpectedSigma(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id) const;
73+
/// Gets the number of sigmas with respect the expected value
74+
template <typename CollisionType, typename TrackType>
75+
float GetNumberOfSigma(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id) const;
76+
/// Gets the deviation to the expected signal
77+
template <typename TrackType>
78+
float GetSignalDelta(const TrackType& trk, const o2::track::PID::ID id) const;
79+
/// Gets relative dEdx resolution contribution due to relative pt resolution
80+
float GetRelativeResolutiondEdx(const float p, const float mass, const float charge, const float resol) const;
81+
82+
void PrintAll() const;
83+
84+
private:
85+
std::array<float, 5> mBetheBlochParams = {0.03209809958934784, 19.9768009185791, 2.5266601063857674e-16, 2.7212300300598145, 6.080920219421387};
86+
std::array<float, 2> mResolutionParamsDefault = {0.07, 0.0};
87+
std::vector<double> mResolutionParams = {5.43799e-7, 0.053044, 0.667584, 0.0142667, 0.00235175, 1.22482, 2.3501e-7, 0.031585};
88+
float mMIP = 50.f;
89+
float mChargeFactor = 2.299999952316284f;
90+
float mMultNormalization = 11000.;
91+
bool mUseDefaultResolutionParam = true;
92+
93+
ClassDefNV(Response, 2);
94+
95+
}; // class Response
96+
97+
/// Get expected Signal of the measurement
98+
template <typename TrackType>
99+
inline float Response::GetExpectedSignal(const TrackType& track, const o2::track::PID::ID id) const
100+
{
101+
const float bethe = mMIP * o2::tpc::BetheBlochAleph(track.tpcInnerParam() / o2::track::pid_constants::sMasses[id], mBetheBlochParams[0], mBetheBlochParams[1], mBetheBlochParams[2], mBetheBlochParams[3], mBetheBlochParams[4]) * std::pow((float)o2::track::pid_constants::sCharges[id], mChargeFactor);
102+
return bethe >= 0.f ? bethe : 0.f;
103+
}
104+
105+
/// Gets the expected resolution of the measurement
106+
template <typename CollisionType, typename TrackType>
107+
inline float Response::GetExpectedSigma(const CollisionType& collision, const TrackType& track, const o2::track::PID::ID id) const
108+
{
109+
float resolution = 0.;
110+
if (mUseDefaultResolutionParam) {
111+
const float reso = track.tpcSignal() * mResolutionParamsDefault[0] * ((float)track.tpcNClsFound() > 0 ? std::sqrt(1. + mResolutionParamsDefault[1] / (float)track.tpcNClsFound()) : 1.f);
112+
reso >= 0.f ? resolution = reso : resolution = 0.f;
113+
} else {
114+
115+
const double ncl = 159. / track.tpcNClsFound(); //
116+
const double p = track.tpcInnerParam();
117+
const double mass = o2::track::pid_constants::sMasses[id];
118+
const double bg = p / mass;
119+
const double dEdx = o2::tpc::BetheBlochAleph((float)bg, mBetheBlochParams[0], mBetheBlochParams[1], mBetheBlochParams[2], mBetheBlochParams[3], mBetheBlochParams[4]) * std::pow((float)o2::track::pid_constants::sCharges[id], mChargeFactor);
120+
const double relReso = GetRelativeResolutiondEdx(p, mass, o2::track::pid_constants::sCharges[id], mResolutionParams[3]);
121+
122+
const std::vector<double> values{1.f / dEdx, track.tgl(), std::sqrt(ncl), relReso, track.signed1Pt(), collision.multTPC() / mMultNormalization};
123+
124+
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;
125+
reso >= 0.f ? resolution = reso : resolution = 0.f;
126+
}
127+
return resolution;
128+
}
129+
130+
/// Gets the number of sigma between the actual signal and the expected signal
131+
template <typename CollisionType, typename TrackType>
132+
inline float Response::GetNumberOfSigma(const CollisionType& collision, const TrackType& trk, const o2::track::PID::ID id) const
133+
{
134+
return ((trk.tpcSignal() - GetExpectedSignal(trk, id)) / GetExpectedSigma(collision, trk, id));
135+
}
136+
137+
/// Gets the deviation between the actual signal and the expected signal
138+
template <typename TrackType>
139+
inline float Response::GetSignalDelta(const TrackType& trk, const o2::track::PID::ID id) const
140+
{
141+
return (trk.tpcSignal() - GetExpectedSignal(trk, id));
142+
}
143+
144+
//// Gets relative dEdx resolution contribution due relative pt resolution
145+
inline float Response::GetRelativeResolutiondEdx(const float p, const float mass, const float charge, const float resol) const
146+
{
147+
const float bg = p / mass;
148+
const float dEdx = o2::tpc::BetheBlochAleph(bg, mBetheBlochParams[0], mBetheBlochParams[1], mBetheBlochParams[2], mBetheBlochParams[3], mBetheBlochParams[4]) * std::pow(charge, mChargeFactor);
149+
const float deltaP = resol * std::sqrt(dEdx);
150+
const float bgDelta = p * (1 + deltaP) / mass;
151+
const float dEdx2 = o2::tpc::BetheBlochAleph(bgDelta, mBetheBlochParams[0], mBetheBlochParams[1], mBetheBlochParams[2], mBetheBlochParams[3], mBetheBlochParams[4]) * std::pow(charge, mChargeFactor);
152+
const float deltaRel = std::abs(dEdx2 - dEdx) / dEdx;
153+
return deltaRel;
154+
}
155+
156+
inline void Response::PrintAll() const
157+
{
158+
LOGP(info, "==== TPC PID response parameters: ====");
159+
for (int i = 0; i < int(mBetheBlochParams.size()); i++) {
160+
LOGP(info, "BB param [{}] = {}", i, mBetheBlochParams[i]);
161+
}
162+
LOGP(info, "use default resolution parametrization = {}", mUseDefaultResolutionParam);
163+
if (mUseDefaultResolutionParam) {
164+
LOGP(info, "Default Resolution parametrization: ");
165+
for (int i = 0; i < int(mResolutionParamsDefault.size()); i++) {
166+
LOGP(info, "Resolution param [{}] = {}", i, mResolutionParamsDefault[i]);
167+
}
168+
} else {
169+
for (int i = 0; i < int(mResolutionParams.size()); i++) {
170+
LOGP(info, "Resolution param [{}] = {}", i, mResolutionParams[i]);
171+
}
172+
}
173+
LOGP(info, "mMIP = {}", mMIP);
174+
LOGP(info, "mChargeFactor = {}", mChargeFactor);
175+
LOGP(info, "mMultNormalization = {}", mMultNormalization);
176+
}
177+
178+
} // namespace o2::pid::tpc
179+
180+
#endif // O2_FRAMEWORK_PIDRESPONSE_H_

Common/Core/PID/TPCReso.h

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)