]>
Commit | Line | Data |
---|---|---|
7ce8802c | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | * *************************************************************************/ | |
16 | ||
27de2dfb | 17 | /* $Id$ */ |
18 | ||
7ce8802c | 19 | //*********************************************************** |
20 | // Class AliAODPidHF | |
21 | // class for PID with AliAODRecoDecayHF | |
b257e565 | 22 | // Authors: D. Caffarri caffarri@pd.infn.it, A.Dainese andrea.dainese@pd.infn.it, S. Dash dash@to.infn.it, F. Prino prino@to.infn.it, R. Romita r.romita@gsi.de, Y. Wang yifei@pi0.physi.uni-heidelberg.de P. Antonioli pietro.antonioli@bo.infn.it |
7ce8802c | 23 | //*********************************************************** |
24 | #include "AliAODPidHF.h" | |
25 | #include "AliAODPid.h" | |
7ce8802c | 26 | #include "AliPID.h" |
b79bfc3e | 27 | #include "AliPIDResponse.h" |
7ce8802c | 28 | #include "AliAODpidUtil.h" |
f9e3cf8e | 29 | #include "AliESDtrack.h" |
7ce8802c | 30 | |
31 | ||
32 | ClassImp(AliAODPidHF) | |
33 | ||
34 | //------------------------------ | |
35 | AliAODPidHF::AliAODPidHF(): | |
228f3aba | 36 | AliAODPid(), |
37 | fnNSigma(5), | |
38 | fnSigma(), | |
39 | fTOFSigma(160.), | |
40 | fnPriors(5), | |
41 | fPriors(), | |
42 | fnPLimit(2), | |
43 | fPLimit(), | |
cdac45d3 | 44 | fAsym(kFALSE), |
45 | fTPC(kFALSE), | |
46 | fTOF(kFALSE), | |
47 | fITS(kFALSE), | |
48 | fTRD(kFALSE), | |
79f3c225 | 49 | fMatch(0), |
913d1957 | 50 | fCompat(kFALSE), |
ad42e35b | 51 | fPCompatTOF(1.5), |
02baac36 | 52 | fnNSigmaCompat(2), |
ad42e35b | 53 | fnSigmaCompat(), |
12141139 | 54 | fMC(kFALSE), |
17c4a8d5 | 55 | fOnePad(kFALSE), |
5821ea5b | 56 | fMCLowEn2011(kFALSE), |
439d61b7 | 57 | fPbPb(kFALSE), |
b79bfc3e | 58 | fTOFdecide(kFALSE), |
59 | fOldPid(kFALSE), | |
60 | fPidResponse(0) | |
7ce8802c | 61 | { |
62 | // | |
63 | // Default constructor | |
64 | // | |
228f3aba | 65 | fPLimit=new Double_t[fnPLimit]; |
66 | fnSigma=new Double_t[fnNSigma]; | |
67 | fPriors=new Double_t[fnPriors]; | |
02baac36 | 68 | fnSigmaCompat=new Double_t[fnNSigmaCompat]; |
228f3aba | 69 | |
70 | for(Int_t i=0;i<fnNSigma;i++){ | |
71 | fnSigma[i]=0.; | |
72 | } | |
73 | for(Int_t i=0;i<fnPriors;i++){ | |
74 | fPriors[i]=0.; | |
75 | } | |
76 | for(Int_t i=0;i<fnPLimit;i++){ | |
77 | fPLimit[i]=0.; | |
78 | } | |
02baac36 | 79 | for(Int_t i=0;i<fnNSigmaCompat;i++){ |
ad42e35b | 80 | fnSigmaCompat[i]=3.; |
81 | } | |
7ce8802c | 82 | |
83 | } | |
84 | //---------------------- | |
85 | AliAODPidHF::~AliAODPidHF() | |
86 | { | |
87 | // destructor | |
228f3aba | 88 | // if(fPLimit) delete fPLimit; |
89 | // if(fnSigma) delete fnSigma; | |
90 | // if(fPriors) delete fPriors; | |
7ce8802c | 91 | } |
92 | //------------------------ | |
93 | AliAODPidHF::AliAODPidHF(const AliAODPidHF& pid) : | |
94 | AliAODPid(pid), | |
228f3aba | 95 | fnNSigma(pid.fnNSigma), |
96 | fnSigma(pid.fnSigma), | |
97 | fTOFSigma(pid.fTOFSigma), | |
98 | fnPriors(pid.fnPriors), | |
99 | fPriors(pid.fPriors), | |
100 | fnPLimit(pid.fnPLimit), | |
101 | fPLimit(pid.fPLimit), | |
cdac45d3 | 102 | fAsym(pid.fAsym), |
103 | fTPC(pid.fTPC), | |
104 | fTOF(pid.fTOF), | |
105 | fITS(pid.fITS), | |
106 | fTRD(pid.fTRD), | |
107 | fMatch(pid.fMatch), | |
913d1957 | 108 | fCompat(pid.fCompat), |
ad42e35b | 109 | fPCompatTOF(pid.fPCompatTOF), |
02baac36 | 110 | fnNSigmaCompat(pid.fnNSigmaCompat), |
ad42e35b | 111 | fnSigmaCompat(pid.fnSigmaCompat), |
12141139 | 112 | fMC(pid.fMC), |
17c4a8d5 | 113 | fOnePad(pid.fOnePad), |
5821ea5b | 114 | fMCLowEn2011(pid.fMCLowEn2011), |
439d61b7 | 115 | fPbPb(pid.fPbPb), |
b79bfc3e | 116 | fTOFdecide(pid.fTOFdecide), |
117 | fOldPid(pid.fOldPid), | |
118 | fPidResponse(pid.fPidResponse) | |
7ce8802c | 119 | { |
120 | ||
121 | for(Int_t i=0;i<5;i++){ | |
122 | fPriors[i]=pid.fPriors[i]; | |
123 | } | |
124 | ||
125 | } | |
126 | ||
127 | //---------------------- | |
228f3aba | 128 | Int_t AliAODPidHF::RawSignalPID(AliAODTrack *track, TString detector) const{ |
129 | // raw PID for single detectors, returns the particle type with smaller sigma | |
f9e3cf8e | 130 | Int_t specie=-1; |
131 | if(detector.Contains("ITS")) return ApplyPidITSRaw(track,specie); | |
132 | if(detector.Contains("TPC")) return ApplyPidTPCRaw(track,specie); | |
133 | if(detector.Contains("TOF")) return ApplyPidTOFRaw(track,specie); | |
7ce8802c | 134 | |
f9e3cf8e | 135 | return specie; |
7ce8802c | 136 | |
137 | } | |
138 | //--------------------------- | |
228f3aba | 139 | Bool_t AliAODPidHF::IsKaonRaw(AliAODTrack *track, TString detector) const{ |
140 | // checks if the track can be a kaon, raw PID applied for single detectors | |
7ce8802c | 141 | Int_t specie=0; |
142 | ||
143 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,3); | |
144 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,3); | |
145 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,3); | |
146 | ||
147 | if(specie==3) return kTRUE; | |
148 | return kFALSE; | |
149 | } | |
150 | //--------------------------- | |
228f3aba | 151 | Bool_t AliAODPidHF::IsPionRaw (AliAODTrack *track, TString detector) const{ |
152 | // checks if the track can be a pion, raw PID applied for single detectors | |
7ce8802c | 153 | |
154 | Int_t specie=0; | |
155 | ||
156 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,2); | |
157 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,2); | |
158 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,2); | |
159 | ||
160 | if(specie==2) return kTRUE; | |
161 | return kFALSE; | |
162 | } | |
163 | //--------------------------- | |
228f3aba | 164 | Bool_t AliAODPidHF::IsProtonRaw (AliAODTrack *track, TString detector) const{ |
165 | // checks if the track can be a proton raw PID applied for single detectors | |
7ce8802c | 166 | |
167 | Int_t specie=0; | |
168 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,4); | |
169 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,4); | |
170 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,4); | |
171 | ||
172 | if(specie==4) return kTRUE; | |
173 | ||
174 | return kFALSE; | |
175 | } | |
f9e3cf8e | 176 | //-------------------------- |
228f3aba | 177 | Bool_t AliAODPidHF::IsElectronRaw(AliAODTrack *track, TString detector) const{ |
178 | // checks if the track can be an electron raw PID applied for single detectors | |
f9e3cf8e | 179 | |
180 | Int_t specie=-1; | |
181 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,0); | |
182 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,0); | |
183 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,0); | |
184 | ||
185 | if(specie==0) return kTRUE; | |
186 | ||
187 | return kFALSE; | |
188 | } | |
189 | //-------------------------- | |
228f3aba | 190 | Int_t AliAODPidHF::ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const{ |
191 | // n-sigma cut, TPC PID | |
7ce8802c | 192 | |
cdac45d3 | 193 | if(!CheckStatus(track,"TPC")) return 0; |
b79bfc3e | 194 | Int_t pid=-1; |
195 | if(fOldPid){ | |
7ce8802c | 196 | AliAODPid *pidObj = track->GetDetPid(); |
197 | ||
198 | Double_t dedx=pidObj->GetTPCsignal(); | |
199 | Double_t mom = pidObj->GetTPCmomentum(); | |
200 | AliTPCPIDResponse tpcResponse; | |
12141139 | 201 | SetBetheBloch(tpcResponse); |
0aba57ed | 202 | UShort_t nTPCClus=pidObj->GetTPCsignalN(); |
203 | if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();} | |
12141139 | 204 | |
f9e3cf8e | 205 | if(specie<0){ // from RawSignalPID : should return the particle specie to wich the de/dx is closer to the bethe-block curve -> performance to be checked |
228f3aba | 206 | Double_t nsigmaMax=fnSigma[0]; |
f9e3cf8e | 207 | for(Int_t ipart=0;ipart<5;ipart++){ |
7ce8802c | 208 | AliPID::EParticleType type=AliPID::EParticleType(ipart); |
0aba57ed | 209 | Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,nTPCClus,type)); |
228f3aba | 210 | if((nsigma<nsigmaMax) && (nsigma<fnSigma[0])) { |
7ce8802c | 211 | pid=ipart; |
212 | nsigmaMax=nsigma; | |
213 | } | |
214 | } | |
215 | }else{ // asks only for one particle specie | |
216 | AliPID::EParticleType type=AliPID::EParticleType(specie); | |
0aba57ed | 217 | Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,nTPCClus,type)); |
228f3aba | 218 | if (nsigma>fnSigma[0]) { |
f9e3cf8e | 219 | pid=-1; |
7ce8802c | 220 | }else{ |
79f3c225 | 221 | pid=specie; |
7ce8802c | 222 | } |
223 | } | |
b79bfc3e | 224 | }else{ //old pid |
225 | if(specie<0){ // from RawSignalPID : should return the particle specie to wich the de/dx is closer to the bethe-block curve -> performance to be checked | |
226 | Double_t nsigmaMax=fnSigma[0]; | |
227 | for(Int_t ipart=0;ipart<5;ipart++){ | |
228 | AliPID::EParticleType type=AliPID::EParticleType(ipart); | |
229 | Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type)); | |
230 | if((nsigma<nsigmaMax) && (nsigma<fnSigma[0])) { | |
231 | pid=ipart; | |
232 | nsigmaMax=nsigma; | |
233 | } | |
234 | } | |
235 | }else{ // asks only for one particle specie | |
236 | AliPID::EParticleType type=AliPID::EParticleType(specie); | |
237 | Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type)); | |
238 | if (nsigma>fnSigma[0]) { | |
239 | pid=-1; | |
240 | }else{ | |
241 | pid=specie; | |
242 | } | |
243 | } | |
244 | ||
245 | } //new pid | |
7ce8802c | 246 | |
247 | return pid; | |
248 | ||
249 | } | |
250 | //---------------------------- | |
228f3aba | 251 | Int_t AliAODPidHF::ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const{ |
252 | // truncated mean, ITS PID | |
f9e3cf8e | 253 | |
cdac45d3 | 254 | if(!CheckStatus(track,"ITS")) return 0; |
b79bfc3e | 255 | Int_t pid=-1; |
f9e3cf8e | 256 | |
b79bfc3e | 257 | if(fOldPid){ |
7ce8802c | 258 | Double_t mom=track->P(); |
259 | AliAODPid *pidObj = track->GetDetPid(); | |
260 | ||
261 | Double_t dedx=pidObj->GetITSsignal(); | |
913d1957 | 262 | UChar_t clumap=track->GetITSClusterMap(); |
263 | Int_t nPointsForPid=0; | |
264 | for(Int_t i=2; i<6; i++){ | |
265 | if(clumap&(1<<i)) ++nPointsForPid; | |
266 | } | |
267 | ||
268 | Bool_t isSA=kTRUE; | |
269 | if(track->GetStatus() & AliESDtrack::kTPCin) isSA = kFALSE; | |
270 | ||
7ce8802c | 271 | AliITSPIDResponse itsResponse; |
f9e3cf8e | 272 | if(specie<0){ // from RawSignalPID : should return the particle specie to wich the de/dx is closer to the bethe-block curve -> performance to be checked |
228f3aba | 273 | Double_t nsigmaMax=fnSigma[4]; |
f9e3cf8e | 274 | for(Int_t ipart=0;ipart<5;ipart++){ |
7ce8802c | 275 | AliPID::EParticleType type=AliPID::EParticleType(ipart); |
913d1957 | 276 | Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type,nPointsForPid,isSA)); |
228f3aba | 277 | if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) { |
7ce8802c | 278 | pid=ipart; |
279 | nsigmaMax=nsigma; | |
280 | } | |
281 | } | |
282 | }else{ // asks only for one particle specie | |
283 | AliPID::EParticleType type=AliPID::EParticleType(specie); | |
284 | Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type)); | |
228f3aba | 285 | if (nsigma>fnSigma[4]) { |
f9e3cf8e | 286 | pid=-1; |
7ce8802c | 287 | }else{ |
79f3c225 | 288 | pid=specie; |
7ce8802c | 289 | } |
290 | } | |
b79bfc3e | 291 | }else{ // old pid |
292 | ||
293 | if(specie<0){ // from RawSignalPID : should return the particle specie to wich the de/dx is closer to the bethe-block curve -> performance to be checked | |
294 | Double_t nsigmaMax=fnSigma[4]; | |
295 | for(Int_t ipart=0;ipart<5;ipart++){ | |
296 | AliPID::EParticleType type=AliPID::EParticleType(ipart); | |
297 | Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type)); | |
298 | if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) { | |
299 | pid=ipart; | |
300 | nsigmaMax=nsigma; | |
301 | } | |
302 | } | |
303 | }else{ // asks only for one particle specie | |
304 | AliPID::EParticleType type=AliPID::EParticleType(specie); | |
305 | Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type)); | |
306 | if (nsigma>fnSigma[4]) { | |
307 | pid=-1; | |
308 | }else{ | |
309 | pid=specie; | |
310 | } | |
311 | } | |
312 | } //new pid | |
313 | ||
7ce8802c | 314 | return pid; |
315 | } | |
316 | //---------------------------- | |
228f3aba | 317 | Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{ |
318 | // n-sigma cut, TOF PID | |
f9e3cf8e | 319 | |
cdac45d3 | 320 | if(!CheckStatus(track,"TOF")) return 0; |
f9e3cf8e | 321 | |
7ce8802c | 322 | Double_t time[AliPID::kSPECIESN]; |
b257e565 | 323 | Double_t sigmaTOFPid[AliPID::kSPECIES]; |
7ce8802c | 324 | AliAODPid *pidObj = track->GetDetPid(); |
325 | pidObj->GetIntegratedTimes(time); | |
228f3aba | 326 | Double_t sigTOF=pidObj->GetTOFsignal(); |
b257e565 | 327 | pidObj->GetTOFpidResolution(sigmaTOFPid); |
328 | ||
f9e3cf8e | 329 | Int_t pid=-1; |
7ce8802c | 330 | |
b257e565 | 331 | if(specie<0){ |
332 | Double_t sigmaTOFtrack; | |
333 | if (sigmaTOFPid[4]>0) sigmaTOFtrack=sigmaTOFPid[4]; | |
334 | else sigmaTOFtrack=fTOFSigma; | |
335 | Double_t nsigmaMax=sigmaTOFtrack*fnSigma[3]; | |
f9e3cf8e | 336 | for(Int_t ipart=0;ipart<5;ipart++){ |
228f3aba | 337 | Double_t nsigma=TMath::Abs(sigTOF-time[ipart]); |
b257e565 | 338 | if (sigmaTOFPid[ipart]>0) sigmaTOFtrack=sigmaTOFPid[ipart]; |
339 | else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs | |
340 | if((nsigma<nsigmaMax) && (nsigma<fnSigma[3]*sigmaTOFtrack)) { | |
7ce8802c | 341 | pid=ipart; |
342 | nsigmaMax=nsigma; | |
343 | } | |
344 | } | |
345 | }else{ // asks only for one particle specie | |
228f3aba | 346 | Double_t nsigma=TMath::Abs(sigTOF-time[specie]); |
b257e565 | 347 | Double_t sigmaTOFtrack; |
348 | if (sigmaTOFPid[specie]>0) sigmaTOFtrack=sigmaTOFPid[specie]; | |
349 | else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs | |
350 | if (nsigma>fnSigma[3]*sigmaTOFtrack) { | |
351 | pid=-1; | |
352 | }else{ | |
353 | pid=specie; | |
354 | } | |
7ce8802c | 355 | } |
356 | return pid; | |
357 | ||
358 | } | |
359 | //------------------------------ | |
228f3aba | 360 | void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{ |
361 | // combined PID stored inside the AOD track | |
7ce8802c | 362 | |
363 | const Double_t *pid=track->PID(); | |
364 | Float_t max=0.; | |
365 | Int_t k=-1; | |
366 | for (Int_t i=0; i<10; i++) { | |
367 | if (pid[i]>max) {k=i; max=pid[i];} | |
368 | } | |
369 | ||
370 | if(k==2) type[0]=kTRUE; | |
371 | if(k==3) type[1]=kTRUE; | |
372 | if(k==4) type[2]=kTRUE; | |
373 | ||
374 | return; | |
375 | } | |
376 | //-------------------- | |
cdac45d3 | 377 | void AliAODPidHF::BayesianProbability(AliAODTrack *track,Double_t *pid) const{ |
228f3aba | 378 | // bayesian PID for single detectors or combined |
7ce8802c | 379 | |
cdac45d3 | 380 | if(fITS && !fTPC && !fTOF) {BayesianProbabilityITS(track,pid);return;} |
381 | if(fTPC && !fITS && !fTOF) {BayesianProbabilityTPC(track,pid);return;} | |
382 | if(fTOF && !fITS && !fTPC) {BayesianProbabilityTOF(track,pid);return;} | |
383 | ||
384 | Double_t probITS[5]={1.,1.,1.,1.,1.}; | |
385 | Double_t probTPC[5]={1.,1.,1.,1.,1.}; | |
386 | Double_t probTOF[5]={1.,1.,1.,1.,1.}; | |
387 | if(fITS) BayesianProbabilityITS(track,probITS); | |
388 | if(fTPC) BayesianProbabilityTPC(track,probTPC); | |
389 | if(fTOF) BayesianProbabilityTOF(track,probTOF); | |
7ce8802c | 390 | Double_t probTot[5]={0.,0.,0.,0.,0.}; |
391 | for(Int_t i=0;i<5;i++){ | |
392 | probTot[i]=probITS[i]*probTPC[i]*probTOF[i]; | |
393 | } | |
394 | for(Int_t i2=0;i2<5;i2++){ | |
395 | pid[i2]=probTot[i2]*fPriors[i2]/(probTot[0]*fPriors[0]+probTot[1]*fPriors[1]+probTot[2]*fPriors[2]+probTot[3]*fPriors[3]+probTot[4]*fPriors[4]); | |
396 | } | |
7ce8802c | 397 | |
398 | return; | |
399 | ||
400 | } | |
401 | //------------------------------------ | |
228f3aba | 402 | void AliAODPidHF::BayesianProbabilityITS(AliAODTrack *track,Double_t *prob) const{ |
7ce8802c | 403 | |
228f3aba | 404 | // bayesian PID for ITS |
7ce8802c | 405 | AliAODpidUtil pid; |
406 | Double_t itspid[AliPID::kSPECIES]; | |
407 | pid.MakeITSPID(track,itspid); | |
408 | for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){ | |
369ad90e | 409 | if(fTOF || fTPC || fTRD){ |
410 | prob[ind]=itspid[ind]; | |
411 | }else{ | |
412 | prob[ind]=itspid[ind]*fPriors[ind]/(itspid[0]*fPriors[0]+itspid[1]*fPriors[1]+itspid[2]*fPriors[2]+itspid[3]*fPriors[3]+itspid[4]*fPriors[4]); | |
413 | } | |
7ce8802c | 414 | } |
415 | return; | |
416 | ||
417 | } | |
418 | //------------------------------------ | |
228f3aba | 419 | void AliAODPidHF::BayesianProbabilityTPC(AliAODTrack *track,Double_t *prob) const{ |
420 | // bayesian PID for TPC | |
7ce8802c | 421 | |
422 | AliAODpidUtil pid; | |
423 | Double_t tpcpid[AliPID::kSPECIES]; | |
424 | pid.MakeTPCPID(track,tpcpid); | |
425 | for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){ | |
369ad90e | 426 | if(fTOF || fITS || fTRD){ |
427 | prob[ind]=tpcpid[ind]; | |
7ce8802c | 428 | }else{ |
369ad90e | 429 | prob[ind]=tpcpid[ind]*fPriors[ind]/(tpcpid[0]*fPriors[0]+tpcpid[1]*fPriors[1]+tpcpid[2]*fPriors[2]+tpcpid[3]*fPriors[3]+tpcpid[4]*fPriors[4]); |
7ce8802c | 430 | } |
369ad90e | 431 | } |
7ce8802c | 432 | return; |
433 | ||
434 | } | |
435 | //------------------------------------ | |
228f3aba | 436 | void AliAODPidHF::BayesianProbabilityTOF(AliAODTrack *track,Double_t *prob) const{ |
437 | // bayesian PID for TOF | |
7ce8802c | 438 | |
439 | AliAODpidUtil pid; | |
440 | Double_t tofpid[AliPID::kSPECIES]; | |
228f3aba | 441 | pid.MakeTOFPID(track,tofpid); |
7ce8802c | 442 | for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){ |
369ad90e | 443 | if(fTPC || fITS || fTRD){ |
444 | prob[ind]=tofpid[ind]; | |
445 | }else{ | |
7ce8802c | 446 | prob[ind]=tofpid[ind]*fPriors[ind]/(tofpid[0]*fPriors[0]+tofpid[1]*fPriors[1]+tofpid[2]*fPriors[2]+tofpid[3]*fPriors[3]+tofpid[4]*fPriors[4]); |
447 | } | |
369ad90e | 448 | } |
7ce8802c | 449 | return; |
450 | ||
451 | } | |
f9e3cf8e | 452 | //--------------------------------- |
228f3aba | 453 | void AliAODPidHF::BayesianProbabilityTRD(AliAODTrack *track,Double_t *prob) const{ |
454 | // bayesian PID for TRD | |
f9e3cf8e | 455 | |
456 | AliAODpidUtil pid; | |
457 | Double_t trdpid[AliPID::kSPECIES]; | |
458 | pid.MakeTRDPID(track,trdpid); | |
459 | for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){ | |
369ad90e | 460 | if(fTPC || fITS || fTOF){ |
461 | prob[ind]=trdpid[ind]; | |
f9e3cf8e | 462 | }else{ |
369ad90e | 463 | prob[ind]=trdpid[ind]*fPriors[ind]/(trdpid[0]*fPriors[0]+trdpid[1]*fPriors[1]+trdpid[2]*fPriors[2]+trdpid[3]*fPriors[3]+trdpid[4]*fPriors[4]); |
f9e3cf8e | 464 | } |
369ad90e | 465 | } |
f9e3cf8e | 466 | return; |
467 | ||
468 | } | |
469 | //-------------------------------- | |
228f3aba | 470 | Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{ |
f9e3cf8e | 471 | |
228f3aba | 472 | // Quality cuts on the tracks, detector by detector |
f9e3cf8e | 473 | |
474 | if(detectors.Contains("ITS")){ | |
475 | if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE; | |
476 | UChar_t clumap=track->GetITSClusterMap(); | |
477 | Int_t nPointsForPid=0; | |
478 | for(Int_t i=2; i<6; i++){ | |
479 | if(clumap&(1<<i)) ++nPointsForPid; | |
480 | } | |
913d1957 | 481 | if(nPointsForPid<3) return kFALSE; |
f9e3cf8e | 482 | } |
483 | ||
484 | if(detectors.Contains("TPC")){ | |
485 | if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE; | |
486 | UShort_t nTPCClus=track->GetTPCClusterMap().CountBits(); | |
487 | if (nTPCClus<70) return kFALSE; | |
488 | } | |
489 | ||
490 | if(detectors.Contains("TOF")){ | |
491 | if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE; | |
492 | if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE; | |
493 | if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE; | |
b257e565 | 494 | if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE; |
f9e3cf8e | 495 | } |
496 | ||
497 | ||
498 | if(detectors.Contains("TRD")){ | |
499 | if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE; | |
500 | AliAODPid *pidObj = track->GetDetPid(); | |
501 | Float_t *mom=pidObj->GetTRDmomentum(); | |
502 | Int_t ntracklets=0; | |
503 | for(Int_t iPl=0;iPl<6;iPl++){ | |
504 | if(mom[iPl]>0.) ntracklets++; | |
505 | } | |
506 | if(ntracklets<4) return kFALSE; | |
507 | } | |
508 | ||
509 | return kTRUE; | |
510 | } | |
228f3aba | 511 | //-------------------------------------------- |
512 | Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{ | |
513 | // TPC nsigma cut PID, different sigmas in different p bins | |
514 | ||
515 | if(!CheckStatus(track,"TPC")) return kFALSE; | |
516 | AliAODPid *pidObj = track->GetDetPid(); | |
517 | Double_t mom = pidObj->GetTPCmomentum(); | |
b79bfc3e | 518 | Double_t nsigma=999.; |
519 | if(fOldPid){ | |
228f3aba | 520 | Double_t dedx=pidObj->GetTPCsignal(); |
0aba57ed | 521 | UShort_t nTPCClus=pidObj->GetTPCsignalN(); |
522 | if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();} | |
228f3aba | 523 | |
524 | AliTPCPIDResponse tpcResponse; | |
12141139 | 525 | SetBetheBloch(tpcResponse); |
228f3aba | 526 | AliPID::EParticleType type=AliPID::EParticleType(specie); |
b79bfc3e | 527 | nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,nTPCClus,type)); |
528 | ||
529 | }else{ //old pid | |
530 | AliPID::EParticleType type=AliPID::EParticleType(specie); | |
531 | nsigma = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type)); | |
532 | } //new pid | |
228f3aba | 533 | |
534 | if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE; | |
535 | if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE; | |
536 | if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE; | |
537 | ||
538 | return kFALSE; | |
539 | } | |
540 | //------------------ | |
541 | Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track,Int_t mode,Int_t specie,Bool_t compat){ | |
542 | // combination of the PID info coming from TPC and TOF | |
543 | if(mode==1){ | |
544 | //TOF || TPC (a la' Andrea R.) | |
cdac45d3 | 545 | // convention: |
228f3aba | 546 | // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible |
547 | // the method returns the sum of the response of the 2 detectors | |
79f3c225 | 548 | if(fTPC && fTOF) {if(!CheckStatus(track,"TPC") && !CheckStatus(track,"TOF")) return 0;} |
228f3aba | 549 | |
cdac45d3 | 550 | |
1cb0f658 | 551 | Int_t tTPCinfo=0; |
cdac45d3 | 552 | if(fTPC){ |
228f3aba | 553 | if(CheckStatus(track,"TPC")) { |
554 | if(fAsym) { | |
3779f50a | 555 | if(TPCRawAsym(track,specie)) { |
1cb0f658 | 556 | tTPCinfo=1; |
3779f50a | 557 | }else{ |
1cb0f658 | 558 | tTPCinfo=-1; |
3779f50a | 559 | } |
228f3aba | 560 | }else{ |
3779f50a | 561 | if(specie==2 && IsPionRaw(track,"TPC")) { |
1cb0f658 | 562 | tTPCinfo=1; |
3779f50a | 563 | }else{ |
1cb0f658 | 564 | tTPCinfo=-1; |
3779f50a | 565 | } |
566 | if(specie==3 && IsKaonRaw(track,"TPC")) { | |
1cb0f658 | 567 | tTPCinfo=1; |
3779f50a | 568 | }else{ |
1cb0f658 | 569 | tTPCinfo=-1; |
3779f50a | 570 | } |
571 | if(specie==4 && IsProtonRaw(track,"TPC")) { | |
1cb0f658 | 572 | tTPCinfo=1; |
3779f50a | 573 | }else{ |
1cb0f658 | 574 | tTPCinfo=-1; |
3779f50a | 575 | } |
576 | ||
228f3aba | 577 | } |
578 | ||
579 | ||
1cb0f658 | 580 | if(compat && tTPCinfo<0){ |
cdac45d3 | 581 | Double_t sig0tmp=fnSigma[0]; |
ad42e35b | 582 | SetSigma(0,fnSigmaCompat[0]); |
1cb0f658 | 583 | if(specie==2 && IsPionRaw(track,"TPC")) tTPCinfo=0; |
584 | if(specie==3 && IsKaonRaw(track,"TPC")) tTPCinfo=0; | |
585 | if(specie==4 && IsProtonRaw(track,"TPC")) tTPCinfo=0; | |
cdac45d3 | 586 | SetSigma(0,sig0tmp); |
587 | } | |
228f3aba | 588 | |
cdac45d3 | 589 | } |
228f3aba | 590 | } |
591 | ||
1cb0f658 | 592 | Int_t tTOFinfo=0; |
cdac45d3 | 593 | if(fTOF){ |
1cb0f658 | 594 | if(!CheckStatus(track,"TOF") && fTPC) return tTPCinfo; |
228f3aba | 595 | |
1cb0f658 | 596 | tTOFinfo=-1; |
228f3aba | 597 | |
1cb0f658 | 598 | if(specie==2 && IsPionRaw(track,"TOF")) tTOFinfo=1; |
599 | if(specie==3 && IsKaonRaw(track,"TOF")) tTOFinfo=1; | |
600 | if(specie==4 && IsProtonRaw(track,"TOF")) tTOFinfo=1; | |
228f3aba | 601 | |
1cb0f658 | 602 | if(compat && tTOFinfo>0){ |
cdac45d3 | 603 | Double_t ptrack=track->P(); |
ad42e35b | 604 | if(ptrack>fPCompatTOF) { |
605 | Double_t sig0tmp=fnSigma[3]; | |
606 | SetSigma(3,fnSigmaCompat[1]); | |
607 | if(specie==2 && IsPionRaw(track,"TOF")) tTOFinfo=0; | |
608 | if(specie==3 && IsKaonRaw(track,"TOF")) tTOFinfo=0; | |
609 | if(specie==4 && IsProtonRaw(track,"TOF")) tTOFinfo=0; | |
610 | SetSigma(3,sig0tmp); | |
611 | } | |
cdac45d3 | 612 | } |
79f3c225 | 613 | } |
913d1957 | 614 | |
439d61b7 | 615 | |
616 | if(tTPCinfo+tTOFinfo==0 && fTOFdecide){ | |
617 | if(!CheckStatus(track,"TOF")) return tTPCinfo; | |
618 | return tTOFinfo; | |
619 | } | |
620 | ||
913d1957 | 621 | if(tTPCinfo+tTOFinfo==0 && fITS){ |
622 | if(!CheckStatus(track,"ITS")) return tTPCinfo+tTOFinfo; | |
623 | Int_t tITSinfo = -1; | |
2a5813a1 | 624 | if(specie==2 && IsPionRaw(track,"ITS")) tITSinfo=1; |
625 | if(specie==3 && IsKaonRaw(track,"ITS")) tITSinfo=1; | |
626 | if(specie==4 && IsProtonRaw(track,"ITS")) tITSinfo=1; | |
913d1957 | 627 | return tITSinfo; |
628 | } | |
629 | ||
1cb0f658 | 630 | return tTPCinfo+tTOFinfo; |
cdac45d3 | 631 | } |
228f3aba | 632 | if(mode==2){ |
633 | //TPC & TOF (a la' Yifei) | |
cdac45d3 | 634 | // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified |
1cb0f658 | 635 | Int_t tTPCinfo=0; |
cdac45d3 | 636 | |
637 | if(fTPC && CheckStatus(track,"TPC")) { | |
1cb0f658 | 638 | tTPCinfo=1; |
228f3aba | 639 | if(fAsym){ |
1cb0f658 | 640 | if(!TPCRawAsym(track,specie)) tTPCinfo=-1; |
228f3aba | 641 | }else{ |
1cb0f658 | 642 | if(specie==2 && !IsPionRaw(track,"TPC")) tTPCinfo=-1; |
643 | if(specie==3 && !IsKaonRaw(track,"TPC")) tTPCinfo=-1; | |
644 | if(specie==4 && !IsProtonRaw(track,"TPC")) tTPCinfo=-1; | |
228f3aba | 645 | } |
646 | } | |
647 | ||
1cb0f658 | 648 | Int_t tTOFinfo=1; |
cdac45d3 | 649 | if(fTOF){ |
1cb0f658 | 650 | if(fTPC && !CheckStatus(track,"TOF")) return tTPCinfo; |
228f3aba | 651 | |
1cb0f658 | 652 | if(specie==2 && !IsPionRaw(track,"TOF")) tTOFinfo=-1; |
653 | if(specie==3 && !IsKaonRaw(track,"TOF")) tTOFinfo=-1; | |
654 | if(specie==4 && !IsProtonRaw(track,"TOF")) tTOFinfo=-1; | |
cdac45d3 | 655 | } |
913d1957 | 656 | |
657 | if(tTOFinfo==1 && tTPCinfo==1) return 1; | |
658 | ||
659 | if(tTPCinfo+tTOFinfo==0 && fITS){ | |
660 | if(!CheckStatus(track,"ITS")) return tTPCinfo+tTOFinfo; | |
661 | Int_t tITSinfo = -1; | |
2a5813a1 | 662 | if(specie==2 && IsPionRaw(track,"ITS")) tITSinfo=1; |
663 | if(specie==3 && IsKaonRaw(track,"ITS")) tITSinfo=1; | |
664 | if(specie==4 && IsProtonRaw(track,"ITS")) tITSinfo=1; | |
913d1957 | 665 | return tITSinfo; |
666 | } | |
228f3aba | 667 | |
228f3aba | 668 | return -1; |
669 | ||
cdac45d3 | 670 | } |
228f3aba | 671 | |
672 | if(mode==3){ | |
673 | //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.) | |
674 | // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified | |
675 | ||
cdac45d3 | 676 | if(fTPC && fTOF) if(!CheckStatus(track,"TPC") && !CheckStatus(track,"TOF")) return 0; |
228f3aba | 677 | |
678 | Double_t ptrack=track->P(); | |
679 | ||
680 | ||
1cb0f658 | 681 | Int_t tTPCinfo=-1; |
228f3aba | 682 | |
913d1957 | 683 | if(ptrack>=fPLimit[0] && ptrack<fPLimit[1] && fTPC) { |
228f3aba | 684 | if(!CheckStatus(track,"TPC")) return 0; |
685 | if(fAsym) { | |
1cb0f658 | 686 | if(TPCRawAsym(track,specie)) tTPCinfo=1; |
228f3aba | 687 | }else{ |
1cb0f658 | 688 | if(specie==2 && IsPionRaw(track,"TPC")) tTPCinfo=1; |
689 | if(specie==3 && IsKaonRaw(track,"TPC")) tTPCinfo=1; | |
690 | if(specie==4 && IsProtonRaw(track,"TPC")) tTPCinfo=1; | |
228f3aba | 691 | } |
1cb0f658 | 692 | return tTPCinfo; |
228f3aba | 693 | } |
694 | ||
1cb0f658 | 695 | Int_t tTOFinfo=-1; |
913d1957 | 696 | if(ptrack>=fPLimit[1] && fTOF){ |
228f3aba | 697 | if(!CheckStatus(track,"TOF")) return 0; |
1cb0f658 | 698 | if(specie==2 && IsPionRaw(track,"TOF")) tTOFinfo=1; |
699 | if(specie==3 && IsKaonRaw(track,"TOF")) tTOFinfo=1; | |
700 | if(specie==4 && IsProtonRaw(track,"TOF")) tTOFinfo=1; | |
701 | return tTOFinfo; | |
228f3aba | 702 | } |
703 | ||
913d1957 | 704 | Int_t tITSinfo=-1; |
705 | if(ptrack<fPLimit[0] && fITS){ | |
706 | if(!CheckStatus(track,"ITS")) return 0; | |
707 | if(specie==2 && IsPionRaw(track,"ITS")) tITSinfo=1; | |
708 | if(specie==3 && IsKaonRaw(track,"ITS")) tITSinfo=1; | |
709 | if(specie==4 && IsProtonRaw(track,"ITS")) tITSinfo=1; | |
710 | return tITSinfo; | |
711 | } | |
712 | ||
228f3aba | 713 | } |
714 | ||
715 | return -1; | |
cdac45d3 | 716 | |
717 | } | |
718 | //---------------------------------- | |
719 | Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){ | |
1cb0f658 | 720 | // general method to compute PID |
cdac45d3 | 721 | if(fMatch>0){ |
1cb0f658 | 722 | return MatchTPCTOF(track,fMatch,specie,fCompat); |
cdac45d3 | 723 | }else{ |
724 | if(fTPC && !fTOF && !fITS) { | |
ad42e35b | 725 | Int_t tTPCres=0; |
726 | if(!fAsym){ | |
727 | tTPCres=ApplyPidTPCRaw(track,specie); | |
728 | }else{ | |
729 | if(TPCRawAsym(track,specie)) { | |
730 | tTPCres=1; | |
731 | }else{ | |
732 | tTPCres=-1; | |
733 | } | |
734 | } | |
1cb0f658 | 735 | if(tTPCres==specie){return 1;}else{return tTPCres;}; |
cdac45d3 | 736 | }else{ |
737 | AliError("You should enable just one detector if you don't want to match"); | |
738 | return 0; | |
739 | } | |
740 | if(fTOF && !fTPC && !fITS) { | |
1cb0f658 | 741 | Int_t tTOFres=ApplyPidTOFRaw(track,specie); |
742 | if(tTOFres==specie){return 1;}else{return tTOFres;}; | |
cdac45d3 | 743 | }else{ |
744 | AliError("You should enable just one detector if you don't want to match"); | |
745 | return 0; | |
746 | } | |
747 | ||
748 | if(fITS && !fTPC && !fTOF) { | |
1cb0f658 | 749 | Int_t tITSres=ApplyPidITSRaw(track,specie); |
750 | if(tITSres==specie){return 1;}else{return tITSres;}; | |
cdac45d3 | 751 | }else{ |
752 | AliError("You should enable just one detector if you don't want to match"); | |
753 | return 0; | |
754 | } | |
755 | } | |
756 | ||
228f3aba | 757 | } |
12141139 | 758 | //-------------------------------------------- |
bad87dce | 759 | void AliAODPidHF::SetBetheBloch(AliTPCPIDResponse &tpcResp) const{ |
12141139 | 760 | |
761 | Double_t alephParameters[5]; | |
98db0ef2 | 762 | |
32a978c2 | 763 | if(fMC) { // MC |
12141139 | 764 | |
32a978c2 | 765 | if(fPbPb) { // PbPb MC |
766 | ||
9ea811e0 | 767 | alephParameters[0] = 1.44405/50.; |
32a978c2 | 768 | alephParameters[1] = 2.35409e+01; |
769 | alephParameters[2] = TMath::Exp(-2.90330e+01); | |
770 | alephParameters[3] = 2.10681e+00; | |
771 | alephParameters[4] = 4.62254e+00; | |
12141139 | 772 | |
32a978c2 | 773 | } else { // pp MC |
5821ea5b | 774 | if(fMCLowEn2011){ |
775 | alephParameters[0]=0.0207667; | |
776 | alephParameters[1]=29.9936; | |
777 | alephParameters[2]=3.87866e-11; | |
778 | alephParameters[3]=2.17291; | |
779 | alephParameters[4]=7.1623; | |
780 | }else{ | |
781 | alephParameters[0] = 2.15898/50.; | |
782 | alephParameters[1] = 1.75295e+01; | |
783 | alephParameters[2] = 3.40030e-09; | |
784 | alephParameters[3] = 1.96178e+00; | |
785 | alephParameters[4] = 3.91720e+00; | |
786 | } | |
32a978c2 | 787 | } |
12141139 | 788 | |
32a978c2 | 789 | } else { // Real Data |
790 | ||
791 | if(fOnePad) { // pp 1-pad (since LHC10d) | |
792 | ||
793 | alephParameters[0] =1.34490e+00/50.; | |
98db0ef2 | 794 | alephParameters[1] = 2.69455e+01; |
8a292370 | 795 | alephParameters[2] = TMath::Exp(-2.97552e+01); |
98db0ef2 | 796 | alephParameters[3] = 2.35339e+00; |
797 | alephParameters[4] = 5.98079e+00; | |
798 | ||
32a978c2 | 799 | } else if(fPbPb) { // PbPb |
98db0ef2 | 800 | |
801 | // alephParameters[0] = 1.25202/50.; | |
802 | // alephParameters[1] = 2.74992e+01; | |
803 | // alephParameters[2] = TMath::Exp(-3.31517e+01); | |
804 | // alephParameters[3] = 2.46246; | |
805 | // alephParameters[4] = 6.78938; | |
806 | ||
807 | alephParameters[0] = 5.10207e+00/50.; | |
808 | alephParameters[1] = 7.94982e+00; | |
809 | alephParameters[2] = TMath::Exp(-9.07942e+00); | |
810 | alephParameters[3] = 2.38808e+00; | |
811 | alephParameters[4] = 1.68165e+00; | |
812 | ||
32a978c2 | 813 | } else { // pp no 1-pad (LHC10bc) |
814 | ||
12141139 | 815 | alephParameters[0] = 0.0283086/0.97; |
816 | alephParameters[1] = 2.63394e+01; | |
817 | alephParameters[2] = 5.04114e-11; | |
818 | alephParameters[3] = 2.12543e+00; | |
819 | alephParameters[4] = 4.88663e+00; | |
98db0ef2 | 820 | |
12141139 | 821 | } |
98db0ef2 | 822 | |
12141139 | 823 | } |
824 | ||
825 | tpcResp.SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]); | |
826 | ||
827 | ||
828 | return; | |
829 | ||
830 | } | |
d50b25df | 831 | //----------------------- |
832 | Bool_t AliAODPidHF::IsTOFPiKexcluded(AliAODTrack *track,Double_t nsigmaK){ | |
833 | ||
834 | ||
835 | if(!CheckStatus(track,"TOF")) return 0; | |
836 | ||
837 | Double_t time[AliPID::kSPECIESN]; | |
838 | Double_t sigmaTOFPid[AliPID::kSPECIES]; | |
839 | AliAODPid *pidObj = track->GetDetPid(); | |
840 | pidObj->GetIntegratedTimes(time); | |
841 | Double_t sigTOF=pidObj->GetTOFsignal(); | |
842 | pidObj->GetTOFpidResolution(sigmaTOFPid); | |
843 | Double_t sigmaTOFtrack; | |
844 | if (sigmaTOFPid[3]>0) sigmaTOFtrack=sigmaTOFPid[3]; | |
845 | else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs | |
846 | ||
847 | if((sigTOF-time[3])>nsigmaK*sigmaTOFtrack)return kTRUE;// K, Pi excluded (->LIKELY A PROTON) | |
848 | ||
849 | return kFALSE; | |
850 | ||
851 | } | |
852 |