]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEERBase/AliTOFPIDResponse.cxx
Changes for #95543: request to commit to trunk: TOF code supporting PID for light...
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliTOFPIDResponse.cxx
CommitLineData
10d100d4 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16//-----------------------------------------------------------------//
17// //
18// Implementation of the TOF PID class //
19// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //
20// //
21//-----------------------------------------------------------------//
22
23#include "TMath.h"
24#include "AliLog.h"
25
26#include "AliTOFPIDResponse.h"
27
28ClassImp(AliTOFPIDResponse)
29
30//_________________________________________________________________________
31AliTOFPIDResponse::AliTOFPIDResponse():
32 fSigma(0),
33 fPmax(0), // zero at 0.5 GeV/c for pp
34 fTime0(0)
35{
679de35e 36 fPar[0] = 0.008;
37 fPar[1] = 0.008;
38 fPar[2] = 0.002;
39 fPar[3] = 40.0;
95ad1018 40
6c68754e 41 // Reset T0 info
42 ResetT0info();
43 SetMomBoundary();
10d100d4 44}
45//_________________________________________________________________________
46AliTOFPIDResponse::AliTOFPIDResponse(Double_t *param):
47 fSigma(param[0]),
48 fPmax(0), // zero at 0.5 GeV/c for pp
49 fTime0(0)
50{
51 //
52 // The main constructor
53 //
54 //
55
56 //fPmax=TMath::Exp(-0.5*3*3)/fSigma; // ~3 sigma at 0.5 GeV/c for PbPb
6c68754e 57
679de35e 58 fPar[0] = 0.008;
59 fPar[1] = 0.008;
60 fPar[2] = 0.002;
61 fPar[3] = 40.0;
95ad1018 62
6c68754e 63 // Reset T0 info
64 ResetT0info();
65 SetMomBoundary();
10d100d4 66}
67//_________________________________________________________________________
68Double_t
69AliTOFPIDResponse::GetMismatchProbability(Double_t p, Double_t mass) const {
70 //
71 // Returns the probability of mismatching
72 // assuming 1/(p*beta)^2 scaling
73 //
74 const Double_t km=0.5; // "reference" momentum (GeV/c)
75
76 Double_t ref2=km*km*km*km/(km*km + mass*mass);// "reference" (p*beta)^2
77 Double_t p2beta2=p*p*p*p/(p*p + mass*mass);
78
79 return fPmax*ref2/p2beta2;
80}
81//_________________________________________________________________________
82Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, Float_t mass) const {
83 //
84 // Return the expected sigma of the PID signal for the specified
67376d1d 85 // particle mass/Z.
10d100d4 86 // If the operation is not possible, return a negative value.
87 //
88
95ad1018 89 Double_t dpp=fPar[0] + fPar[1]*mom + fPar[2]*mass/mom; //mean relative pt resolution;
10d100d4 90
91
92 Double_t sigma = dpp*time/(1.+ mom*mom/(mass*mass));
6c68754e 93
94 Int_t index = GetMomBin(mom);
95
96 Double_t t0res = fT0resolution[index];
97
95ad1018 98 return TMath::Sqrt(sigma*sigma + fPar[3]*fPar[3]/mom/mom + fSigma*fSigma + t0res*t0res);
10d100d4 99
10d100d4 100}
6c68754e 101//_________________________________________________________________________
67376d1d 102Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, AliPID::EParticleType type) const {
103 //
104 // Return the expected sigma of the PID signal for the specified
105 // particle type.
106 // If the operation is not possible, return a negative value.
107 //
108
109 Double_t mass = AliPID::ParticleMassZ(type);
110 Double_t dpp=fPar[0] + fPar[1]*mom + fPar[2]*mass/mom; //mean relative pt resolution;
111
112
113 Double_t sigma = dpp*time/(1.+ mom*mom/(mass*mass));
114
115 Int_t index = GetMomBin(mom);
116
117 Double_t t0res = fT0resolution[index];
118
119 return TMath::Sqrt(sigma*sigma + fPar[3]*fPar[3]/mom/mom + fSigma*fSigma + t0res*t0res);
120
121}
122//_________________________________________________________________________
123Double_t AliTOFPIDResponse::GetExpectedSignal(const AliVTrack* track,AliPID::EParticleType type) const {
124 //
125 // Return the expected signal of the PID signal for the particle type
126 // If the operation is not possible, return a negative value.
127 //
128 Double_t expt[5];
129 track->GetIntegratedTimes(expt);
130 if (type<=AliPID::kProton) return expt[type];
131 else {
132 Double_t p = track->P();
133 Double_t massZ = AliPID::ParticleMassZ(type);
134 return expt[0]/p*massZ*TMath::Sqrt(1.+p*p/massZ/massZ);
135 }
136}
137//_________________________________________________________________________
6c68754e 138Int_t AliTOFPIDResponse::GetMomBin(Float_t p) const{
f858b00e 139 //
140 // Returns the momentum bin index
141 //
142
6c68754e 143 Int_t i=0;
144 while(p > fPCutMin[i] && i < fNmomBins) i++;
145 if(i > 0) i--;
10d100d4 146
6c68754e 147 return i;
148}
149//_________________________________________________________________________
150void AliTOFPIDResponse::SetMomBoundary(){
f858b00e 151 //
152 // Set boundaries for momentum bins
153 //
154
6c68754e 155 fPCutMin[0] = 0.3;
156 fPCutMin[1] = 0.5;
157 fPCutMin[2] = 0.6;
158 fPCutMin[3] = 0.7;
159 fPCutMin[4] = 0.8;
160 fPCutMin[5] = 0.9;
161 fPCutMin[6] = 1;
162 fPCutMin[7] = 1.2;
163 fPCutMin[8] = 1.5;
164 fPCutMin[9] = 2;
165 fPCutMin[10] = 3;
166}
f858b00e 167//_________________________________________________________________________
7170298c 168Float_t AliTOFPIDResponse::GetStartTime(Float_t mom) const {
f858b00e 169 //
170 // Returns event_time value as estimated by TOF combinatorial algorithm
171 //
172
173 Int_t ibin = GetMomBin(mom);
174 return GetT0bin(ibin);
175
176}
177//_________________________________________________________________________
7170298c 178Float_t AliTOFPIDResponse::GetStartTimeRes(Float_t mom) const {
f858b00e 179 //
180 // Returns event_time resolution as estimated by TOF combinatorial algorithm
181 //
182
183 Int_t ibin = GetMomBin(mom);
184 return GetT0binRes(ibin);
185
186}
d4d15b21 187//_________________________________________________________________________
188Int_t AliTOFPIDResponse::GetStartTimeMask(Float_t mom) const {
189 //
190 // Returns event_time mask
191 //
192
193 Int_t ibin = GetMomBin(mom);
194 return GetT0binMask(ibin);
195
196}