]>
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 | ||
17 | //*********************************************************** | |
18 | // Class AliAODPidHF | |
19 | // class for PID with AliAODRecoDecayHF | |
228f3aba | 20 | // 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 |
7ce8802c | 21 | //*********************************************************** |
22 | #include "AliAODPidHF.h" | |
23 | #include "AliAODPid.h" | |
7ce8802c | 24 | #include "AliPID.h" |
25 | #include "AliTPCPIDResponse.h" | |
26 | #include "AliITSPIDResponse.h" | |
27 | #include "AliTOFPIDResponse.h" | |
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), |
51 | fMC(kFALSE) | |
7ce8802c | 52 | { |
53 | // | |
54 | // Default constructor | |
55 | // | |
228f3aba | 56 | fPLimit=new Double_t[fnPLimit]; |
57 | fnSigma=new Double_t[fnNSigma]; | |
58 | fPriors=new Double_t[fnPriors]; | |
59 | ||
60 | for(Int_t i=0;i<fnNSigma;i++){ | |
61 | fnSigma[i]=0.; | |
62 | } | |
63 | for(Int_t i=0;i<fnPriors;i++){ | |
64 | fPriors[i]=0.; | |
65 | } | |
66 | for(Int_t i=0;i<fnPLimit;i++){ | |
67 | fPLimit[i]=0.; | |
68 | } | |
7ce8802c | 69 | |
70 | } | |
71 | //---------------------- | |
72 | AliAODPidHF::~AliAODPidHF() | |
73 | { | |
74 | // destructor | |
228f3aba | 75 | // if(fPLimit) delete fPLimit; |
76 | // if(fnSigma) delete fnSigma; | |
77 | // if(fPriors) delete fPriors; | |
7ce8802c | 78 | } |
79 | //------------------------ | |
80 | AliAODPidHF::AliAODPidHF(const AliAODPidHF& pid) : | |
81 | AliAODPid(pid), | |
228f3aba | 82 | fnNSigma(pid.fnNSigma), |
83 | fnSigma(pid.fnSigma), | |
84 | fTOFSigma(pid.fTOFSigma), | |
85 | fnPriors(pid.fnPriors), | |
86 | fPriors(pid.fPriors), | |
87 | fnPLimit(pid.fnPLimit), | |
88 | fPLimit(pid.fPLimit), | |
cdac45d3 | 89 | fAsym(pid.fAsym), |
90 | fTPC(pid.fTPC), | |
91 | fTOF(pid.fTOF), | |
92 | fITS(pid.fITS), | |
93 | fTRD(pid.fTRD), | |
94 | fMatch(pid.fMatch), | |
913d1957 | 95 | fCompat(pid.fCompat), |
96 | fMC(kFALSE) | |
7ce8802c | 97 | { |
98 | ||
99 | for(Int_t i=0;i<5;i++){ | |
100 | fPriors[i]=pid.fPriors[i]; | |
101 | } | |
102 | ||
103 | } | |
104 | ||
105 | //---------------------- | |
228f3aba | 106 | Int_t AliAODPidHF::RawSignalPID(AliAODTrack *track, TString detector) const{ |
107 | // raw PID for single detectors, returns the particle type with smaller sigma | |
f9e3cf8e | 108 | Int_t specie=-1; |
109 | if(detector.Contains("ITS")) return ApplyPidITSRaw(track,specie); | |
110 | if(detector.Contains("TPC")) return ApplyPidTPCRaw(track,specie); | |
111 | if(detector.Contains("TOF")) return ApplyPidTOFRaw(track,specie); | |
7ce8802c | 112 | |
f9e3cf8e | 113 | return specie; |
7ce8802c | 114 | |
115 | } | |
116 | //--------------------------- | |
228f3aba | 117 | Bool_t AliAODPidHF::IsKaonRaw(AliAODTrack *track, TString detector) const{ |
118 | // checks if the track can be a kaon, raw PID applied for single detectors | |
7ce8802c | 119 | Int_t specie=0; |
120 | ||
121 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,3); | |
122 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,3); | |
123 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,3); | |
124 | ||
125 | if(specie==3) return kTRUE; | |
126 | return kFALSE; | |
127 | } | |
128 | //--------------------------- | |
228f3aba | 129 | Bool_t AliAODPidHF::IsPionRaw (AliAODTrack *track, TString detector) const{ |
130 | // checks if the track can be a pion, raw PID applied for single detectors | |
7ce8802c | 131 | |
132 | Int_t specie=0; | |
133 | ||
134 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,2); | |
135 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,2); | |
136 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,2); | |
137 | ||
138 | if(specie==2) return kTRUE; | |
139 | return kFALSE; | |
140 | } | |
141 | //--------------------------- | |
228f3aba | 142 | Bool_t AliAODPidHF::IsProtonRaw (AliAODTrack *track, TString detector) const{ |
143 | // checks if the track can be a proton raw PID applied for single detectors | |
7ce8802c | 144 | |
145 | Int_t specie=0; | |
146 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,4); | |
147 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,4); | |
148 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,4); | |
149 | ||
150 | if(specie==4) return kTRUE; | |
151 | ||
152 | return kFALSE; | |
153 | } | |
f9e3cf8e | 154 | //-------------------------- |
228f3aba | 155 | Bool_t AliAODPidHF::IsElectronRaw(AliAODTrack *track, TString detector) const{ |
156 | // checks if the track can be an electron raw PID applied for single detectors | |
f9e3cf8e | 157 | |
158 | Int_t specie=-1; | |
159 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,0); | |
160 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,0); | |
161 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,0); | |
162 | ||
163 | if(specie==0) return kTRUE; | |
164 | ||
165 | return kFALSE; | |
166 | } | |
167 | //-------------------------- | |
228f3aba | 168 | Int_t AliAODPidHF::ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const{ |
169 | // n-sigma cut, TPC PID | |
7ce8802c | 170 | |
cdac45d3 | 171 | if(!CheckStatus(track,"TPC")) return 0; |
7ce8802c | 172 | AliAODPid *pidObj = track->GetDetPid(); |
173 | ||
174 | Double_t dedx=pidObj->GetTPCsignal(); | |
175 | Double_t mom = pidObj->GetTPCmomentum(); | |
176 | AliTPCPIDResponse tpcResponse; | |
f9e3cf8e | 177 | Int_t pid=-1; |
178 | 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 | 179 | Double_t nsigmaMax=fnSigma[0]; |
f9e3cf8e | 180 | for(Int_t ipart=0;ipart<5;ipart++){ |
7ce8802c | 181 | AliPID::EParticleType type=AliPID::EParticleType(ipart); |
f9e3cf8e | 182 | Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,track->GetTPCNcls(),type)); |
228f3aba | 183 | if((nsigma<nsigmaMax) && (nsigma<fnSigma[0])) { |
7ce8802c | 184 | pid=ipart; |
185 | nsigmaMax=nsigma; | |
186 | } | |
187 | } | |
188 | }else{ // asks only for one particle specie | |
189 | AliPID::EParticleType type=AliPID::EParticleType(specie); | |
f9e3cf8e | 190 | Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,track->GetTPCNcls(),type)); |
228f3aba | 191 | if (nsigma>fnSigma[0]) { |
f9e3cf8e | 192 | pid=-1; |
7ce8802c | 193 | }else{ |
79f3c225 | 194 | pid=specie; |
7ce8802c | 195 | } |
196 | } | |
197 | ||
198 | return pid; | |
199 | ||
200 | } | |
201 | //---------------------------- | |
228f3aba | 202 | Int_t AliAODPidHF::ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const{ |
203 | // truncated mean, ITS PID | |
f9e3cf8e | 204 | |
cdac45d3 | 205 | if(!CheckStatus(track,"ITS")) return 0; |
f9e3cf8e | 206 | |
7ce8802c | 207 | Double_t mom=track->P(); |
208 | AliAODPid *pidObj = track->GetDetPid(); | |
209 | ||
210 | Double_t dedx=pidObj->GetITSsignal(); | |
913d1957 | 211 | UChar_t clumap=track->GetITSClusterMap(); |
212 | Int_t nPointsForPid=0; | |
213 | for(Int_t i=2; i<6; i++){ | |
214 | if(clumap&(1<<i)) ++nPointsForPid; | |
215 | } | |
216 | ||
217 | Bool_t isSA=kTRUE; | |
218 | if(track->GetStatus() & AliESDtrack::kTPCin) isSA = kFALSE; | |
219 | ||
7ce8802c | 220 | AliITSPIDResponse itsResponse; |
f9e3cf8e | 221 | Int_t pid=-1; |
222 | 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 | 223 | Double_t nsigmaMax=fnSigma[4]; |
f9e3cf8e | 224 | for(Int_t ipart=0;ipart<5;ipart++){ |
7ce8802c | 225 | AliPID::EParticleType type=AliPID::EParticleType(ipart); |
913d1957 | 226 | Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type,nPointsForPid,isSA)); |
228f3aba | 227 | if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) { |
7ce8802c | 228 | pid=ipart; |
229 | nsigmaMax=nsigma; | |
230 | } | |
231 | } | |
232 | }else{ // asks only for one particle specie | |
233 | AliPID::EParticleType type=AliPID::EParticleType(specie); | |
234 | Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type)); | |
228f3aba | 235 | if (nsigma>fnSigma[4]) { |
f9e3cf8e | 236 | pid=-1; |
7ce8802c | 237 | }else{ |
79f3c225 | 238 | pid=specie; |
7ce8802c | 239 | } |
240 | } | |
241 | return pid; | |
242 | } | |
243 | //---------------------------- | |
228f3aba | 244 | Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{ |
245 | // n-sigma cut, TOF PID | |
f9e3cf8e | 246 | |
cdac45d3 | 247 | if(!CheckStatus(track,"TOF")) return 0; |
f9e3cf8e | 248 | |
7ce8802c | 249 | Double_t time[AliPID::kSPECIESN]; |
250 | AliAODPid *pidObj = track->GetDetPid(); | |
251 | pidObj->GetIntegratedTimes(time); | |
228f3aba | 252 | Double_t sigTOF=pidObj->GetTOFsignal(); |
253 | // AliTOFPIDResponse tofResponse; | |
f9e3cf8e | 254 | Int_t pid=-1; |
7ce8802c | 255 | |
f9e3cf8e | 256 | 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 | 257 | Double_t nsigmaMax=fTOFSigma*fnSigma[3]; |
f9e3cf8e | 258 | for(Int_t ipart=0;ipart<5;ipart++){ |
228f3aba | 259 | //AliPID::EParticleType type=AliPID::EParticleType(ipart); |
260 | //Double_t nsigma = tofResponse.GetExpectedSigma(track->P(),time[type],AliPID::ParticleMass(type)); | |
261 | Double_t nsigma=TMath::Abs(sigTOF-time[ipart]); | |
262 | if((nsigma<nsigmaMax) && (nsigma<fnSigma[3]*fTOFSigma)) { | |
7ce8802c | 263 | pid=ipart; |
264 | nsigmaMax=nsigma; | |
265 | } | |
266 | } | |
267 | }else{ // asks only for one particle specie | |
228f3aba | 268 | //AliPID::EParticleType type=AliPID::EParticleType(specie); |
269 | //Double_t nsigma = TMath::Abs(tofResponse.GetExpectedSigma(track->P(),time[type],AliPID::ParticleMass(type))); | |
270 | Double_t nsigma=TMath::Abs(sigTOF-time[specie]); | |
271 | if (nsigma>fnSigma[3]*fTOFSigma) { | |
f9e3cf8e | 272 | pid=-1; |
7ce8802c | 273 | }else{ |
79f3c225 | 274 | pid=specie; |
7ce8802c | 275 | } |
276 | } | |
277 | return pid; | |
278 | ||
279 | } | |
280 | //------------------------------ | |
228f3aba | 281 | void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{ |
282 | // combined PID stored inside the AOD track | |
7ce8802c | 283 | |
284 | const Double_t *pid=track->PID(); | |
285 | Float_t max=0.; | |
286 | Int_t k=-1; | |
287 | for (Int_t i=0; i<10; i++) { | |
288 | if (pid[i]>max) {k=i; max=pid[i];} | |
289 | } | |
290 | ||
291 | if(k==2) type[0]=kTRUE; | |
292 | if(k==3) type[1]=kTRUE; | |
293 | if(k==4) type[2]=kTRUE; | |
294 | ||
295 | return; | |
296 | } | |
297 | //-------------------- | |
cdac45d3 | 298 | void AliAODPidHF::BayesianProbability(AliAODTrack *track,Double_t *pid) const{ |
228f3aba | 299 | // bayesian PID for single detectors or combined |
7ce8802c | 300 | |
cdac45d3 | 301 | if(fITS && !fTPC && !fTOF) {BayesianProbabilityITS(track,pid);return;} |
302 | if(fTPC && !fITS && !fTOF) {BayesianProbabilityTPC(track,pid);return;} | |
303 | if(fTOF && !fITS && !fTPC) {BayesianProbabilityTOF(track,pid);return;} | |
304 | ||
305 | Double_t probITS[5]={1.,1.,1.,1.,1.}; | |
306 | Double_t probTPC[5]={1.,1.,1.,1.,1.}; | |
307 | Double_t probTOF[5]={1.,1.,1.,1.,1.}; | |
308 | if(fITS) BayesianProbabilityITS(track,probITS); | |
309 | if(fTPC) BayesianProbabilityTPC(track,probTPC); | |
310 | if(fTOF) BayesianProbabilityTOF(track,probTOF); | |
7ce8802c | 311 | Double_t probTot[5]={0.,0.,0.,0.,0.}; |
312 | for(Int_t i=0;i<5;i++){ | |
313 | probTot[i]=probITS[i]*probTPC[i]*probTOF[i]; | |
314 | } | |
315 | for(Int_t i2=0;i2<5;i2++){ | |
316 | 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]); | |
317 | } | |
7ce8802c | 318 | |
319 | return; | |
320 | ||
321 | } | |
322 | //------------------------------------ | |
228f3aba | 323 | void AliAODPidHF::BayesianProbabilityITS(AliAODTrack *track,Double_t *prob) const{ |
7ce8802c | 324 | |
228f3aba | 325 | // bayesian PID for ITS |
7ce8802c | 326 | AliAODpidUtil pid; |
327 | Double_t itspid[AliPID::kSPECIES]; | |
328 | pid.MakeITSPID(track,itspid); | |
329 | for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){ | |
369ad90e | 330 | if(fTOF || fTPC || fTRD){ |
331 | prob[ind]=itspid[ind]; | |
332 | }else{ | |
333 | 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]); | |
334 | } | |
7ce8802c | 335 | } |
336 | return; | |
337 | ||
338 | } | |
339 | //------------------------------------ | |
228f3aba | 340 | void AliAODPidHF::BayesianProbabilityTPC(AliAODTrack *track,Double_t *prob) const{ |
341 | // bayesian PID for TPC | |
7ce8802c | 342 | |
343 | AliAODpidUtil pid; | |
344 | Double_t tpcpid[AliPID::kSPECIES]; | |
345 | pid.MakeTPCPID(track,tpcpid); | |
346 | for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){ | |
369ad90e | 347 | if(fTOF || fITS || fTRD){ |
348 | prob[ind]=tpcpid[ind]; | |
7ce8802c | 349 | }else{ |
369ad90e | 350 | 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 | 351 | } |
369ad90e | 352 | } |
7ce8802c | 353 | return; |
354 | ||
355 | } | |
356 | //------------------------------------ | |
228f3aba | 357 | void AliAODPidHF::BayesianProbabilityTOF(AliAODTrack *track,Double_t *prob) const{ |
358 | // bayesian PID for TOF | |
7ce8802c | 359 | |
360 | AliAODpidUtil pid; | |
361 | Double_t tofpid[AliPID::kSPECIES]; | |
228f3aba | 362 | pid.MakeTOFPID(track,tofpid); |
7ce8802c | 363 | for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){ |
369ad90e | 364 | if(fTPC || fITS || fTRD){ |
365 | prob[ind]=tofpid[ind]; | |
366 | }else{ | |
7ce8802c | 367 | 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]); |
368 | } | |
369ad90e | 369 | } |
7ce8802c | 370 | return; |
371 | ||
372 | } | |
f9e3cf8e | 373 | //--------------------------------- |
228f3aba | 374 | void AliAODPidHF::BayesianProbabilityTRD(AliAODTrack *track,Double_t *prob) const{ |
375 | // bayesian PID for TRD | |
f9e3cf8e | 376 | |
377 | AliAODpidUtil pid; | |
378 | Double_t trdpid[AliPID::kSPECIES]; | |
379 | pid.MakeTRDPID(track,trdpid); | |
380 | for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){ | |
369ad90e | 381 | if(fTPC || fITS || fTOF){ |
382 | prob[ind]=trdpid[ind]; | |
f9e3cf8e | 383 | }else{ |
369ad90e | 384 | 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 | 385 | } |
369ad90e | 386 | } |
f9e3cf8e | 387 | return; |
388 | ||
389 | } | |
390 | //-------------------------------- | |
228f3aba | 391 | Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{ |
f9e3cf8e | 392 | |
228f3aba | 393 | // Quality cuts on the tracks, detector by detector |
f9e3cf8e | 394 | |
395 | if(detectors.Contains("ITS")){ | |
396 | if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE; | |
397 | UChar_t clumap=track->GetITSClusterMap(); | |
398 | Int_t nPointsForPid=0; | |
399 | for(Int_t i=2; i<6; i++){ | |
400 | if(clumap&(1<<i)) ++nPointsForPid; | |
401 | } | |
913d1957 | 402 | if(nPointsForPid<3) return kFALSE; |
f9e3cf8e | 403 | } |
404 | ||
405 | if(detectors.Contains("TPC")){ | |
406 | if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE; | |
407 | UShort_t nTPCClus=track->GetTPCClusterMap().CountBits(); | |
408 | if (nTPCClus<70) return kFALSE; | |
409 | } | |
410 | ||
411 | if(detectors.Contains("TOF")){ | |
412 | if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE; | |
413 | if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE; | |
414 | if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE; | |
415 | } | |
416 | ||
417 | ||
418 | if(detectors.Contains("TRD")){ | |
419 | if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE; | |
420 | AliAODPid *pidObj = track->GetDetPid(); | |
421 | Float_t *mom=pidObj->GetTRDmomentum(); | |
422 | Int_t ntracklets=0; | |
423 | for(Int_t iPl=0;iPl<6;iPl++){ | |
424 | if(mom[iPl]>0.) ntracklets++; | |
425 | } | |
426 | if(ntracklets<4) return kFALSE; | |
427 | } | |
428 | ||
429 | return kTRUE; | |
430 | } | |
228f3aba | 431 | //-------------------------------------------- |
432 | Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{ | |
433 | // TPC nsigma cut PID, different sigmas in different p bins | |
434 | ||
435 | if(!CheckStatus(track,"TPC")) return kFALSE; | |
436 | AliAODPid *pidObj = track->GetDetPid(); | |
437 | Double_t mom = pidObj->GetTPCmomentum(); | |
438 | Double_t dedx=pidObj->GetTPCsignal(); | |
439 | ||
440 | AliTPCPIDResponse tpcResponse; | |
441 | AliPID::EParticleType type=AliPID::EParticleType(specie); | |
442 | Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,track->GetTPCNcls(),type)); | |
443 | ||
444 | if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE; | |
445 | if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE; | |
446 | if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE; | |
447 | ||
448 | return kFALSE; | |
449 | } | |
450 | //------------------ | |
451 | Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track,Int_t mode,Int_t specie,Bool_t compat){ | |
452 | // combination of the PID info coming from TPC and TOF | |
453 | if(mode==1){ | |
454 | //TOF || TPC (a la' Andrea R.) | |
cdac45d3 | 455 | // convention: |
228f3aba | 456 | // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible |
457 | // the method returns the sum of the response of the 2 detectors | |
79f3c225 | 458 | if(fTPC && fTOF) {if(!CheckStatus(track,"TPC") && !CheckStatus(track,"TOF")) return 0;} |
228f3aba | 459 | |
cdac45d3 | 460 | |
1cb0f658 | 461 | Int_t tTPCinfo=0; |
cdac45d3 | 462 | if(fTPC){ |
228f3aba | 463 | if(CheckStatus(track,"TPC")) { |
464 | if(fAsym) { | |
3779f50a | 465 | if(TPCRawAsym(track,specie)) { |
1cb0f658 | 466 | tTPCinfo=1; |
3779f50a | 467 | }else{ |
1cb0f658 | 468 | tTPCinfo=-1; |
3779f50a | 469 | } |
228f3aba | 470 | }else{ |
3779f50a | 471 | if(specie==2 && IsPionRaw(track,"TPC")) { |
1cb0f658 | 472 | tTPCinfo=1; |
3779f50a | 473 | }else{ |
1cb0f658 | 474 | tTPCinfo=-1; |
3779f50a | 475 | } |
476 | if(specie==3 && IsKaonRaw(track,"TPC")) { | |
1cb0f658 | 477 | tTPCinfo=1; |
3779f50a | 478 | }else{ |
1cb0f658 | 479 | tTPCinfo=-1; |
3779f50a | 480 | } |
481 | if(specie==4 && IsProtonRaw(track,"TPC")) { | |
1cb0f658 | 482 | tTPCinfo=1; |
3779f50a | 483 | }else{ |
1cb0f658 | 484 | tTPCinfo=-1; |
3779f50a | 485 | } |
486 | ||
228f3aba | 487 | } |
488 | ||
489 | ||
1cb0f658 | 490 | if(compat && tTPCinfo<0){ |
cdac45d3 | 491 | Double_t sig0tmp=fnSigma[0]; |
492 | SetSigma(0,3.); | |
1cb0f658 | 493 | if(specie==2 && IsPionRaw(track,"TPC")) tTPCinfo=0; |
494 | if(specie==3 && IsKaonRaw(track,"TPC")) tTPCinfo=0; | |
495 | if(specie==4 && IsProtonRaw(track,"TPC")) tTPCinfo=0; | |
cdac45d3 | 496 | SetSigma(0,sig0tmp); |
497 | } | |
228f3aba | 498 | |
cdac45d3 | 499 | } |
228f3aba | 500 | } |
501 | ||
1cb0f658 | 502 | Int_t tTOFinfo=0; |
cdac45d3 | 503 | if(fTOF){ |
1cb0f658 | 504 | if(!CheckStatus(track,"TOF") && fTPC) return tTPCinfo; |
228f3aba | 505 | |
1cb0f658 | 506 | tTOFinfo=-1; |
228f3aba | 507 | |
1cb0f658 | 508 | if(specie==2 && IsPionRaw(track,"TOF")) tTOFinfo=1; |
509 | if(specie==3 && IsKaonRaw(track,"TOF")) tTOFinfo=1; | |
510 | if(specie==4 && IsProtonRaw(track,"TOF")) tTOFinfo=1; | |
228f3aba | 511 | |
1cb0f658 | 512 | if(compat && tTOFinfo>0){ |
cdac45d3 | 513 | Double_t ptrack=track->P(); |
1cb0f658 | 514 | if(ptrack>1.5) tTOFinfo=0; |
cdac45d3 | 515 | } |
79f3c225 | 516 | } |
913d1957 | 517 | |
518 | if(tTPCinfo+tTOFinfo==0 && fITS){ | |
519 | if(!CheckStatus(track,"ITS")) return tTPCinfo+tTOFinfo; | |
520 | Int_t tITSinfo = -1; | |
521 | if(specie==2 && IsPionRaw(track,"TOF")) tITSinfo=1; | |
522 | if(specie==3 && IsKaonRaw(track,"TOF")) tITSinfo=1; | |
523 | if(specie==4 && IsProtonRaw(track,"TOF")) tITSinfo=1; | |
524 | return tITSinfo; | |
525 | } | |
526 | ||
1cb0f658 | 527 | return tTPCinfo+tTOFinfo; |
cdac45d3 | 528 | } |
228f3aba | 529 | if(mode==2){ |
530 | //TPC & TOF (a la' Yifei) | |
cdac45d3 | 531 | // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified |
1cb0f658 | 532 | Int_t tTPCinfo=0; |
cdac45d3 | 533 | |
534 | if(fTPC && CheckStatus(track,"TPC")) { | |
1cb0f658 | 535 | tTPCinfo=1; |
228f3aba | 536 | if(fAsym){ |
1cb0f658 | 537 | if(!TPCRawAsym(track,specie)) tTPCinfo=-1; |
228f3aba | 538 | }else{ |
1cb0f658 | 539 | if(specie==2 && !IsPionRaw(track,"TPC")) tTPCinfo=-1; |
540 | if(specie==3 && !IsKaonRaw(track,"TPC")) tTPCinfo=-1; | |
541 | if(specie==4 && !IsProtonRaw(track,"TPC")) tTPCinfo=-1; | |
228f3aba | 542 | } |
543 | } | |
544 | ||
1cb0f658 | 545 | Int_t tTOFinfo=1; |
cdac45d3 | 546 | if(fTOF){ |
1cb0f658 | 547 | if(fTPC && !CheckStatus(track,"TOF")) return tTPCinfo; |
228f3aba | 548 | |
1cb0f658 | 549 | if(specie==2 && !IsPionRaw(track,"TOF")) tTOFinfo=-1; |
550 | if(specie==3 && !IsKaonRaw(track,"TOF")) tTOFinfo=-1; | |
551 | if(specie==4 && !IsProtonRaw(track,"TOF")) tTOFinfo=-1; | |
cdac45d3 | 552 | } |
913d1957 | 553 | |
554 | if(tTOFinfo==1 && tTPCinfo==1) return 1; | |
555 | ||
556 | if(tTPCinfo+tTOFinfo==0 && fITS){ | |
557 | if(!CheckStatus(track,"ITS")) return tTPCinfo+tTOFinfo; | |
558 | Int_t tITSinfo = -1; | |
559 | if(specie==2 && IsPionRaw(track,"TOF")) tITSinfo=1; | |
560 | if(specie==3 && IsKaonRaw(track,"TOF")) tITSinfo=1; | |
561 | if(specie==4 && IsProtonRaw(track,"TOF")) tITSinfo=1; | |
562 | return tITSinfo; | |
563 | } | |
228f3aba | 564 | |
228f3aba | 565 | return -1; |
566 | ||
cdac45d3 | 567 | } |
228f3aba | 568 | |
569 | if(mode==3){ | |
570 | //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.) | |
571 | // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified | |
572 | ||
cdac45d3 | 573 | if(fTPC && fTOF) if(!CheckStatus(track,"TPC") && !CheckStatus(track,"TOF")) return 0; |
228f3aba | 574 | |
575 | Double_t ptrack=track->P(); | |
576 | ||
577 | ||
1cb0f658 | 578 | Int_t tTPCinfo=-1; |
228f3aba | 579 | |
913d1957 | 580 | if(ptrack>=fPLimit[0] && ptrack<fPLimit[1] && fTPC) { |
228f3aba | 581 | if(!CheckStatus(track,"TPC")) return 0; |
582 | if(fAsym) { | |
1cb0f658 | 583 | if(TPCRawAsym(track,specie)) tTPCinfo=1; |
228f3aba | 584 | }else{ |
1cb0f658 | 585 | if(specie==2 && IsPionRaw(track,"TPC")) tTPCinfo=1; |
586 | if(specie==3 && IsKaonRaw(track,"TPC")) tTPCinfo=1; | |
587 | if(specie==4 && IsProtonRaw(track,"TPC")) tTPCinfo=1; | |
228f3aba | 588 | } |
1cb0f658 | 589 | return tTPCinfo; |
228f3aba | 590 | } |
591 | ||
1cb0f658 | 592 | Int_t tTOFinfo=-1; |
913d1957 | 593 | if(ptrack>=fPLimit[1] && fTOF){ |
228f3aba | 594 | if(!CheckStatus(track,"TOF")) return 0; |
1cb0f658 | 595 | if(specie==2 && IsPionRaw(track,"TOF")) tTOFinfo=1; |
596 | if(specie==3 && IsKaonRaw(track,"TOF")) tTOFinfo=1; | |
597 | if(specie==4 && IsProtonRaw(track,"TOF")) tTOFinfo=1; | |
598 | return tTOFinfo; | |
228f3aba | 599 | } |
600 | ||
913d1957 | 601 | Int_t tITSinfo=-1; |
602 | if(ptrack<fPLimit[0] && fITS){ | |
603 | if(!CheckStatus(track,"ITS")) return 0; | |
604 | if(specie==2 && IsPionRaw(track,"ITS")) tITSinfo=1; | |
605 | if(specie==3 && IsKaonRaw(track,"ITS")) tITSinfo=1; | |
606 | if(specie==4 && IsProtonRaw(track,"ITS")) tITSinfo=1; | |
607 | return tITSinfo; | |
608 | } | |
609 | ||
228f3aba | 610 | } |
611 | ||
612 | return -1; | |
cdac45d3 | 613 | |
614 | } | |
615 | //---------------------------------- | |
616 | Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){ | |
1cb0f658 | 617 | // general method to compute PID |
cdac45d3 | 618 | if(fMatch>0){ |
1cb0f658 | 619 | return MatchTPCTOF(track,fMatch,specie,fCompat); |
cdac45d3 | 620 | }else{ |
621 | if(fTPC && !fTOF && !fITS) { | |
1cb0f658 | 622 | Int_t tTPCres=ApplyPidTPCRaw(track,specie); |
623 | if(tTPCres==specie){return 1;}else{return tTPCres;}; | |
cdac45d3 | 624 | }else{ |
625 | AliError("You should enable just one detector if you don't want to match"); | |
626 | return 0; | |
627 | } | |
628 | if(fTOF && !fTPC && !fITS) { | |
1cb0f658 | 629 | Int_t tTOFres=ApplyPidTOFRaw(track,specie); |
630 | if(tTOFres==specie){return 1;}else{return tTOFres;}; | |
cdac45d3 | 631 | }else{ |
632 | AliError("You should enable just one detector if you don't want to match"); | |
633 | return 0; | |
634 | } | |
635 | ||
636 | if(fITS && !fTPC && !fTOF) { | |
1cb0f658 | 637 | Int_t tITSres=ApplyPidITSRaw(track,specie); |
638 | if(tITSres==specie){return 1;}else{return tITSres;}; | |
cdac45d3 | 639 | }else{ |
640 | AliError("You should enable just one detector if you don't want to match"); | |
641 | return 0; | |
642 | } | |
643 | } | |
644 | ||
228f3aba | 645 | } |