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