]>
Commit | Line | Data |
---|---|---|
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" | |
a2c30af1 | 25 | #include "TF1.h" |
10d100d4 | 26 | |
27 | #include "AliTOFPIDResponse.h" | |
28 | ||
29 | ClassImp(AliTOFPIDResponse) | |
30 | ||
a2c30af1 | 31 | TF1 *AliTOFPIDResponse::fTOFtailResponse = NULL; // function to generate a TOF tail |
32 | ||
10d100d4 | 33 | //_________________________________________________________________________ |
34 | AliTOFPIDResponse::AliTOFPIDResponse(): | |
35 | fSigma(0), | |
36 | fPmax(0), // zero at 0.5 GeV/c for pp | |
37 | fTime0(0) | |
38 | { | |
679de35e | 39 | fPar[0] = 0.008; |
40 | fPar[1] = 0.008; | |
41 | fPar[2] = 0.002; | |
42 | fPar[3] = 40.0; | |
95ad1018 | 43 | |
a2c30af1 | 44 | if(!fTOFtailResponse){ |
45 | fTOFtailResponse = new TF1("fTOFtail","[0]*TMath::Exp(-(x-[1])*(x-[1])/2/[2]/[2])* (x < [1]+[3]*[2]) + (x > [1]+[3]*[2])*[0]*TMath::Exp(-(x-[1]-[3]*[2]*0.5)*[3]/[2] * 0.0111)*0.01818",-1000,1000); | |
46 | fTOFtailResponse->SetParameter(0,1); | |
47 | fTOFtailResponse->SetParameter(1,-25); | |
48 | fTOFtailResponse->SetParameter(2,1); | |
49 | fTOFtailResponse->SetParameter(3,1.1); | |
50 | fTOFtailResponse->SetNpx(10000); | |
51 | } | |
52 | ||
53 | ||
6c68754e | 54 | // Reset T0 info |
55 | ResetT0info(); | |
56 | SetMomBoundary(); | |
10d100d4 | 57 | } |
58 | //_________________________________________________________________________ | |
59 | AliTOFPIDResponse::AliTOFPIDResponse(Double_t *param): | |
60 | fSigma(param[0]), | |
61 | fPmax(0), // zero at 0.5 GeV/c for pp | |
62 | fTime0(0) | |
63 | { | |
64 | // | |
65 | // The main constructor | |
66 | // | |
67 | // | |
68 | ||
69 | //fPmax=TMath::Exp(-0.5*3*3)/fSigma; // ~3 sigma at 0.5 GeV/c for PbPb | |
6c68754e | 70 | |
679de35e | 71 | fPar[0] = 0.008; |
72 | fPar[1] = 0.008; | |
73 | fPar[2] = 0.002; | |
74 | fPar[3] = 40.0; | |
95ad1018 | 75 | |
6c68754e | 76 | // Reset T0 info |
77 | ResetT0info(); | |
78 | SetMomBoundary(); | |
10d100d4 | 79 | } |
80 | //_________________________________________________________________________ | |
81 | Double_t | |
82 | AliTOFPIDResponse::GetMismatchProbability(Double_t p, Double_t mass) const { | |
83 | // | |
84 | // Returns the probability of mismatching | |
85 | // assuming 1/(p*beta)^2 scaling | |
86 | // | |
87 | const Double_t km=0.5; // "reference" momentum (GeV/c) | |
88 | ||
89 | Double_t ref2=km*km*km*km/(km*km + mass*mass);// "reference" (p*beta)^2 | |
90 | Double_t p2beta2=p*p*p*p/(p*p + mass*mass); | |
91 | ||
92 | return fPmax*ref2/p2beta2; | |
93 | } | |
94 | //_________________________________________________________________________ | |
95 | Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, Float_t mass) const { | |
96 | // | |
97 | // Return the expected sigma of the PID signal for the specified | |
67376d1d | 98 | // particle mass/Z. |
10d100d4 | 99 | // If the operation is not possible, return a negative value. |
100 | // | |
101 | ||
95ad1018 | 102 | Double_t dpp=fPar[0] + fPar[1]*mom + fPar[2]*mass/mom; //mean relative pt resolution; |
10d100d4 | 103 | |
104 | ||
105 | Double_t sigma = dpp*time/(1.+ mom*mom/(mass*mass)); | |
6c68754e | 106 | |
107 | Int_t index = GetMomBin(mom); | |
108 | ||
109 | Double_t t0res = fT0resolution[index]; | |
110 | ||
95ad1018 | 111 | return TMath::Sqrt(sigma*sigma + fPar[3]*fPar[3]/mom/mom + fSigma*fSigma + t0res*t0res); |
10d100d4 | 112 | |
10d100d4 | 113 | } |
6c68754e | 114 | //_________________________________________________________________________ |
67376d1d | 115 | Double_t AliTOFPIDResponse::GetExpectedSigma(Float_t mom, Float_t time, AliPID::EParticleType type) const { |
116 | // | |
117 | // Return the expected sigma of the PID signal for the specified | |
118 | // particle type. | |
119 | // If the operation is not possible, return a negative value. | |
120 | // | |
121 | ||
122 | Double_t mass = AliPID::ParticleMassZ(type); | |
123 | Double_t dpp=fPar[0] + fPar[1]*mom + fPar[2]*mass/mom; //mean relative pt resolution; | |
124 | ||
125 | ||
126 | Double_t sigma = dpp*time/(1.+ mom*mom/(mass*mass)); | |
127 | ||
128 | Int_t index = GetMomBin(mom); | |
129 | ||
130 | Double_t t0res = fT0resolution[index]; | |
131 | ||
132 | return TMath::Sqrt(sigma*sigma + fPar[3]*fPar[3]/mom/mom + fSigma*fSigma + t0res*t0res); | |
133 | ||
134 | } | |
135 | //_________________________________________________________________________ | |
136 | Double_t AliTOFPIDResponse::GetExpectedSignal(const AliVTrack* track,AliPID::EParticleType type) const { | |
137 | // | |
138 | // Return the expected signal of the PID signal for the particle type | |
139 | // If the operation is not possible, return a negative value. | |
140 | // | |
141 | Double_t expt[5]; | |
142 | track->GetIntegratedTimes(expt); | |
143 | if (type<=AliPID::kProton) return expt[type]; | |
144 | else { | |
145 | Double_t p = track->P(); | |
146 | Double_t massZ = AliPID::ParticleMassZ(type); | |
147 | return expt[0]/p*massZ*TMath::Sqrt(1.+p*p/massZ/massZ); | |
148 | } | |
149 | } | |
150 | //_________________________________________________________________________ | |
6c68754e | 151 | Int_t AliTOFPIDResponse::GetMomBin(Float_t p) const{ |
f858b00e | 152 | // |
153 | // Returns the momentum bin index | |
154 | // | |
155 | ||
6c68754e | 156 | Int_t i=0; |
157 | while(p > fPCutMin[i] && i < fNmomBins) i++; | |
158 | if(i > 0) i--; | |
10d100d4 | 159 | |
6c68754e | 160 | return i; |
161 | } | |
162 | //_________________________________________________________________________ | |
163 | void AliTOFPIDResponse::SetMomBoundary(){ | |
f858b00e | 164 | // |
165 | // Set boundaries for momentum bins | |
166 | // | |
167 | ||
6c68754e | 168 | fPCutMin[0] = 0.3; |
169 | fPCutMin[1] = 0.5; | |
170 | fPCutMin[2] = 0.6; | |
171 | fPCutMin[3] = 0.7; | |
172 | fPCutMin[4] = 0.8; | |
173 | fPCutMin[5] = 0.9; | |
174 | fPCutMin[6] = 1; | |
175 | fPCutMin[7] = 1.2; | |
176 | fPCutMin[8] = 1.5; | |
177 | fPCutMin[9] = 2; | |
178 | fPCutMin[10] = 3; | |
179 | } | |
f858b00e | 180 | //_________________________________________________________________________ |
7170298c | 181 | Float_t AliTOFPIDResponse::GetStartTime(Float_t mom) const { |
f858b00e | 182 | // |
183 | // Returns event_time value as estimated by TOF combinatorial algorithm | |
184 | // | |
185 | ||
186 | Int_t ibin = GetMomBin(mom); | |
187 | return GetT0bin(ibin); | |
188 | ||
189 | } | |
190 | //_________________________________________________________________________ | |
7170298c | 191 | Float_t AliTOFPIDResponse::GetStartTimeRes(Float_t mom) const { |
f858b00e | 192 | // |
193 | // Returns event_time resolution as estimated by TOF combinatorial algorithm | |
194 | // | |
195 | ||
196 | Int_t ibin = GetMomBin(mom); | |
197 | return GetT0binRes(ibin); | |
198 | ||
199 | } | |
d4d15b21 | 200 | //_________________________________________________________________________ |
201 | Int_t AliTOFPIDResponse::GetStartTimeMask(Float_t mom) const { | |
202 | // | |
203 | // Returns event_time mask | |
204 | // | |
205 | ||
206 | Int_t ibin = GetMomBin(mom); | |
207 | return GetT0binMask(ibin); | |
208 | ||
209 | } | |
a2c30af1 | 210 | //_________________________________________________________________________ |
211 | Double_t AliTOFPIDResponse::GetTailRandomValue() const // generate a random value to add a tail to TOF time (for MC analyses) | |
212 | { | |
213 | if(fTOFtailResponse) | |
214 | return fTOFtailResponse->GetRandom(); | |
215 | else | |
216 | return 0.0; | |
217 | } |