Project
Loading...
Searching...
No Matches
PIDResponse.h
Go to the documentation of this file.
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
16
17#ifndef AliceO2_TPC_PIDResponse_H
18#define AliceO2_TPC_PIDResponse_H
19
20// o2 includes
21#include "GPUCommonDef.h"
22#include "GPUCommonRtypes.h"
23#include "GPUCommonMath.h"
28
29namespace o2::tpc
30{
31class TrackTPC;
32
37
39{
40 public:
42 PIDResponse() = default;
43
45 ~PIDResponse() = default;
46
48 GPUd() void setBetheBlochParams(const float betheBlochParams[5]);
49 GPUd() void setMIP(float mip) { mMIP = mip; }
50 GPUd() void setChargeFactor(float chargeFactor) { mChargeFactor = chargeFactor; }
51
53 GPUd() const float* getBetheBlochParams() const { return mBetheBlochParams; }
54 GPUd() float getMIP() const { return mMIP; }
55 GPUd() float getChargeFactor() const { return mChargeFactor; }
56
58 GPUd() float getExpectedSignal(const TrackTPC& track, const o2::track::PID::ID id) const;
59
61 GPUd() o2::track::PID::ID getMostProbablePID(const TrackTPC& track, float PID_EKrangeMin, float PID_EKrangeMax, float PID_EPrangeMin, float PID_EPrangeMax, float PID_EDrangeMin, float PID_EDrangeMax, float PID_ETrangeMin, float PID_ETrangeMax, char PID_useNsigma, float PID_sigma) const;
62
63 private:
64 float mBetheBlochParams[5] = {0.19310481, 4.26696118, 0.00522579, 2.38124907, 0.98055396}; // BBAleph average fit parameters
65 float mMIP = 50.f;
66 float mChargeFactor = 2.299999952316284f;
67
68 ClassDefNV(PIDResponse, 1);
69};
70
71GPUd() void PIDResponse::setBetheBlochParams(const float betheBlochParams[5])
72{
73 for (int i = 0; i < 5; i++) {
74 mBetheBlochParams[i] = betheBlochParams[i];
75 }
76}
77
78GPUd() float PIDResponse::getExpectedSignal(const TrackTPC& track, const o2::track::PID::ID id) const
79{
80 const float bg = static_cast<float>(track.getP() / o2::track::pid_constants::sMasses[id]);
81 if (bg < 0.05) {
82 return -999.;
83 }
84 const float bethe = mMIP * o2::tpc::BetheBlochAleph(bg, mBetheBlochParams[0], mBetheBlochParams[1], mBetheBlochParams[2], mBetheBlochParams[3], mBetheBlochParams[4]) * o2::gpu::GPUCommonMath::Pow(static_cast<float>(o2::track::pid_constants::sCharges[id]), mChargeFactor);
85 return bethe >= 0. ? bethe : -999.;
86}
87
88// get most probable PID
89GPUd() o2::track::PID::ID PIDResponse::getMostProbablePID(const TrackTPC& track, float PID_EKrangeMin, float PID_EKrangeMax, float PID_EPrangeMin, float PID_EPrangeMax, float PID_EDrangeMin, float PID_EDrangeMax, float PID_ETrangeMin, float PID_ETrangeMax, char PID_useNsigma, float PID_sigma) const
90{
91 const float dEdx = track.getdEdx().dEdxTotTPC;
92
93 if (dEdx < 10.) {
95 }
96
98 float distanceMin = 0.;
99 float dEdxExpected = getExpectedSignal(track, id);
100 if (PID_useNsigma) {
101 // using nSigma
102 distanceMin = o2::gpu::GPUCommonMath::Abs((dEdx - dEdxExpected) / (PID_sigma * dEdxExpected));
103 } else {
104 // using absolute distance
105 distanceMin = o2::gpu::GPUCommonMath::Abs(dEdx - dEdxExpected);
106 }
107
108 // calculate the distance to the expected dEdx signals
109 // start from Pion to exlude Muons
111 float distance = 0.;
112 dEdxExpected = getExpectedSignal(track, i);
113 if (PID_useNsigma) {
114 // using nSigma
115 distance = o2::gpu::GPUCommonMath::Abs((dEdx - dEdxExpected) / (PID_sigma * dEdxExpected));
116 } else {
117 // using absolute distance
118 distance = o2::gpu::GPUCommonMath::Abs(dEdx - dEdxExpected);
119 }
120 if (distance < distanceMin) {
121 id = i;
122 distanceMin = distance;
123 }
124 }
125
126 // override the electrons to the closest alternative PID in the bands crossing regions
127 if (id == o2::track::PID::Electron) {
128 const float p = track.getP();
129 if ((p > PID_EKrangeMin) && (p < PID_EKrangeMax)) {
131 } else if ((p > PID_EPrangeMin) && (p < PID_EPrangeMax)) {
133 } else if ((p > PID_EDrangeMin) && (p < PID_EDrangeMax)) {
135 } else if ((p > PID_ETrangeMin) && (p < PID_ETrangeMax)) {
137 }
138 }
139
140 return id;
141}
142
143} // namespace o2::tpc
144
145#endif
particle ids, masses, names class definition
int32_t i
PID response class.
Definition PIDResponse.h:39
GPUd() float getMIP() const
Definition PIDResponse.h:54
GPUd() void setChargeFactor(float chargeFactor)
Definition PIDResponse.h:50
GPUd() void setBetheBlochParams(const float betheBlochParams[5])
setters
const o2::track::PID::ID id const
Definition PIDResponse.h:58
PIDResponse()=default
default constructor
~PIDResponse()=default
default destructor
GPUd() const float *getBetheBlochParams() const
getters
Definition PIDResponse.h:53
GPUd() float getChargeFactor() const
Definition PIDResponse.h:55
static constexpr ID Electron
Definition PID.h:94
static constexpr ID NIDs
number of defined IDs
Definition PID.h:106
static constexpr ID Kaon
Definition PID.h:97
pid_constants::ID ID
Definition PID.h:92
static constexpr ID Pion
Definition PID.h:96
static constexpr ID Deuteron
Definition PID.h:99
static constexpr ID Proton
Definition PID.h:98
static constexpr ID Triton
Definition PID.h:100
GLsizei GLsizei GLfloat distance
Definition glcorearb.h:5506
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLuint id
Definition glcorearb.h:650
Global TPC definitions and constants.
Definition SimTraits.h:167
GPUd() void PIDResponse
Definition PIDResponse.h:71
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...