]>
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 | //*********************************************************** |
64e39959 | 24 | #include <TCanvas.h> |
4c177f98 | 25 | #include <TString.h> |
26 | #include <TH1F.h> | |
27 | #include <TF1.h> | |
28 | #include <TFile.h> | |
64e39959 | 29 | |
7ce8802c | 30 | #include "AliAODPidHF.h" |
31 | #include "AliAODPid.h" | |
7ce8802c | 32 | #include "AliPID.h" |
b79bfc3e | 33 | #include "AliPIDResponse.h" |
7ce8802c | 34 | #include "AliAODpidUtil.h" |
f9e3cf8e | 35 | #include "AliESDtrack.h" |
7ce8802c | 36 | |
37 | ||
38 | ClassImp(AliAODPidHF) | |
39 | ||
40 | //------------------------------ | |
41 | AliAODPidHF::AliAODPidHF(): | |
0908b647 | 42 | TObject(), |
43 | fnNSigma(5), | |
44 | fnSigma(0), | |
45 | fTOFSigma(160.), | |
46 | fCutTOFmismatch(0.01), | |
47 | fMinNClustersTPCPID(0), | |
48 | fnPriors(5), | |
49 | fPriors(0), | |
50 | fnPLimit(2), | |
51 | fPLimit(0), | |
52 | fAsym(kFALSE), | |
53 | fTPC(kFALSE), | |
54 | fTOF(kFALSE), | |
55 | fITS(kFALSE), | |
56 | fTRD(kFALSE), | |
57 | fMatch(0), | |
58 | fForceTOFforKaons(kFALSE), | |
59 | fCompat(kFALSE), | |
60 | fPCompatTOF(1.5), | |
61 | fUseAsymTOF(kFALSE), | |
62 | fLownSigmaTOF(-3.), | |
63 | fUpnSigmaTOF(3.), | |
64 | fLownSigmaCompatTOF(-3.), | |
65 | fUpnSigmaCompatTOF(3.), | |
66 | fnNSigmaCompat(2), | |
67 | fnSigmaCompat(0), | |
68 | fMC(kFALSE), | |
69 | fOnePad(kFALSE), | |
70 | fMCLowEn2011(kFALSE), | |
71 | fppLowEn2011(kFALSE), | |
72 | fPbPb(kFALSE), | |
73 | fTOFdecide(kFALSE), | |
74 | fOldPid(kFALSE), | |
75 | fPtThresholdTPC(999999.), | |
76 | fMaxTrackMomForCombinedPID(999999.), | |
77 | fPidResponse(0), | |
78 | fPidCombined(new AliPIDCombined()), | |
79 | fTPCResponse(new AliTPCPIDResponse()), | |
80 | fPriorsH(), | |
81 | fCombDetectors(kTPCTOF), | |
82 | fUseCombined(kFALSE), | |
83 | fDefaultPriors(kTRUE) | |
7ce8802c | 84 | { |
fcff8ce7 | 85 | // |
86 | // Default constructor | |
87 | // | |
88 | fPLimit=new Double_t[fnPLimit]; | |
89 | fnSigma=new Double_t[fnNSigma]; | |
90 | fPriors=new Double_t[fnPriors]; | |
91 | fnSigmaCompat=new Double_t[fnNSigmaCompat]; | |
92 | ||
93 | for(Int_t i=0;i<fnNSigma;i++){ | |
94 | fnSigma[i]=0.; | |
95 | } | |
96 | for(Int_t i=0;i<fnPriors;i++){ | |
97 | fPriors[i]=0.; | |
98 | } | |
99 | for(Int_t i=0;i<fnPLimit;i++){ | |
100 | fPLimit[i]=0.; | |
101 | } | |
102 | for(Int_t i=0;i<fnNSigmaCompat;i++){ | |
103 | fnSigmaCompat[i]=3.; | |
104 | } | |
105 | for(Int_t i=0; i<3; i++){ // pi, K, proton | |
106 | fMaxnSigmaCombined[i]=3.; | |
107 | fMinnSigmaTPC[i]=-3; | |
108 | fMaxnSigmaTPC[i]=3; | |
109 | fMinnSigmaTOF[i]=-3; | |
110 | fMaxnSigmaTOF[i]=3; | |
111 | } | |
0908b647 | 112 | |
7ce8802c | 113 | } |
114 | //---------------------- | |
115 | AliAODPidHF::~AliAODPidHF() | |
116 | { | |
fa52905d | 117 | // destructor |
a7d74abb | 118 | if(fPLimit) delete [] fPLimit; |
119 | if(fnSigma) delete [] fnSigma; | |
120 | if(fPriors) delete [] fPriors; | |
121 | if(fnSigmaCompat) delete [] fnSigmaCompat; | |
fa52905d | 122 | delete fPidCombined; |
0908b647 | 123 | |
70e398d3 | 124 | delete fTPCResponse; |
4c177f98 | 125 | for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) { |
126 | delete fPriorsH[ispecies]; | |
127 | } | |
7ce8802c | 128 | } |
129 | //------------------------ | |
130 | AliAODPidHF::AliAODPidHF(const AliAODPidHF& pid) : | |
0908b647 | 131 | TObject(), |
132 | fnNSigma(pid.fnNSigma), | |
133 | fnSigma(0), | |
134 | fTOFSigma(pid.fTOFSigma), | |
135 | fCutTOFmismatch(pid.fCutTOFmismatch), | |
136 | fMinNClustersTPCPID(pid.fMinNClustersTPCPID), | |
137 | fnPriors(pid.fnPriors), | |
138 | fPriors(0), | |
139 | fnPLimit(pid.fnPLimit), | |
140 | fPLimit(0), | |
141 | fAsym(pid.fAsym), | |
142 | fTPC(pid.fTPC), | |
143 | fTOF(pid.fTOF), | |
144 | fITS(pid.fITS), | |
145 | fTRD(pid.fTRD), | |
146 | fMatch(pid.fMatch), | |
147 | fForceTOFforKaons(pid.fForceTOFforKaons), | |
148 | fCompat(pid.fCompat), | |
149 | fPCompatTOF(pid.fPCompatTOF), | |
150 | fUseAsymTOF(pid.fUseAsymTOF), | |
151 | fLownSigmaTOF(pid.fLownSigmaTOF), | |
152 | fUpnSigmaTOF(pid.fUpnSigmaTOF), | |
153 | fLownSigmaCompatTOF(pid.fLownSigmaCompatTOF), | |
154 | fUpnSigmaCompatTOF(pid.fUpnSigmaCompatTOF), | |
155 | fnNSigmaCompat(pid.fnNSigmaCompat), | |
156 | fnSigmaCompat(0x0), | |
157 | fMC(pid.fMC), | |
158 | fOnePad(pid.fOnePad), | |
159 | fMCLowEn2011(pid.fMCLowEn2011), | |
160 | fppLowEn2011(pid.fppLowEn2011), | |
161 | fPbPb(pid.fPbPb), | |
162 | fTOFdecide(pid.fTOFdecide), | |
163 | fOldPid(pid.fOldPid), | |
164 | fPtThresholdTPC(pid.fPtThresholdTPC), | |
165 | fMaxTrackMomForCombinedPID(pid.fMaxTrackMomForCombinedPID), | |
166 | fPidResponse(0x0), | |
167 | fPidCombined(0x0), | |
168 | fTPCResponse(0x0), | |
169 | fCombDetectors(pid.fCombDetectors), | |
170 | fUseCombined(pid.fUseCombined), | |
171 | fDefaultPriors(pid.fDefaultPriors) | |
375df9ce | 172 | { |
7ce8802c | 173 | |
2d070486 | 174 | fnSigmaCompat=new Double_t[fnNSigmaCompat]; |
175 | for(Int_t i=0;i<fnNSigmaCompat;i++){ | |
176 | fnSigmaCompat[i]=pid.fnSigmaCompat[i]; | |
177 | } | |
375df9ce | 178 | fnSigma = new Double_t[fnNSigma]; |
179 | for(Int_t i=0;i<fnNSigma;i++){ | |
180 | fnSigma[i]=pid.fnSigma[i]; | |
181 | } | |
182 | fPriors = new Double_t[fnPriors]; | |
183 | for(Int_t i=0;i<fnPriors;i++){ | |
7ce8802c | 184 | fPriors[i]=pid.fPriors[i]; |
185 | } | |
375df9ce | 186 | fPLimit = new Double_t[fnPLimit]; |
187 | for(Int_t i=0;i<fnPLimit;i++){ | |
188 | fPLimit[i]=pid.fPLimit[i]; | |
7ce8802c | 189 | } |
4c177f98 | 190 | fPriors = new Double_t[fnPriors]; |
191 | for(Int_t i=0;i<fnPriors;i++){ | |
192 | fPriors[i]=pid.fPriors[i]; | |
193 | } | |
194 | for(Int_t i=0;i<AliPID::kSPECIES;i++){ | |
195 | fPriorsH[i]=pid.fPriorsH[i]; | |
196 | } | |
fcff8ce7 | 197 | for(Int_t i=0; i<3; i++){ // pi, K, proton |
198 | fMaxnSigmaCombined[i]=pid.fMaxnSigmaCombined[i]; | |
199 | fMinnSigmaTPC[i]=pid.fMinnSigmaTPC[i]; | |
200 | fMaxnSigmaTPC[i]=pid.fMaxnSigmaTPC[i]; | |
201 | fMinnSigmaTOF[i]=pid.fMinnSigmaTOF[i]; | |
202 | fMaxnSigmaTOF[i]=pid.fMaxnSigmaTOF[i]; | |
203 | } | |
0908b647 | 204 | |
2d070486 | 205 | // if(pid.fTPCResponse) fTPCResponse = new AliTPCPIDResponse(*(pid.fTPCResponse)); |
206 | fTPCResponse = new AliTPCPIDResponse(); | |
207 | SetBetheBloch(); | |
208 | fPidCombined = new AliPIDCombined(); | |
375df9ce | 209 | //fPidResponse = new AliPIDResponse(*(pid.fPidResponse)); |
0908b647 | 210 | //fPidCombined = new AliPIDCombined(*(pid.fPidCombined)); |
211 | ||
375df9ce | 212 | } |
7ce8802c | 213 | //---------------------- |
228f3aba | 214 | Int_t AliAODPidHF::RawSignalPID(AliAODTrack *track, TString detector) const{ |
fcff8ce7 | 215 | // raw PID for single detectors, returns the particle type with smaller sigma |
216 | Int_t specie=-1; | |
217 | if(detector.Contains("ITS")) return ApplyPidITSRaw(track,specie); | |
218 | if(detector.Contains("TPC")) return ApplyPidTPCRaw(track,specie); | |
219 | if(detector.Contains("TOF")) return ApplyPidTOFRaw(track,specie); | |
220 | ||
f9e3cf8e | 221 | return specie; |
0908b647 | 222 | |
7ce8802c | 223 | } |
224 | //--------------------------- | |
228f3aba | 225 | Bool_t AliAODPidHF::IsKaonRaw(AliAODTrack *track, TString detector) const{ |
fcff8ce7 | 226 | // checks if the track can be a kaon, raw PID applied for single detectors |
227 | Int_t specie=0; | |
0908b647 | 228 | |
fcff8ce7 | 229 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,3); |
230 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,3); | |
231 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,3); | |
232 | ||
233 | if(specie==3) return kTRUE; | |
234 | return kFALSE; | |
7ce8802c | 235 | } |
236 | //--------------------------- | |
228f3aba | 237 | Bool_t AliAODPidHF::IsPionRaw (AliAODTrack *track, TString detector) const{ |
fcff8ce7 | 238 | // checks if the track can be a pion, raw PID applied for single detectors |
0908b647 | 239 | |
fcff8ce7 | 240 | Int_t specie=0; |
241 | ||
242 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,2); | |
243 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,2); | |
244 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,2); | |
245 | ||
246 | if(specie==2) return kTRUE; | |
247 | return kFALSE; | |
7ce8802c | 248 | } |
249 | //--------------------------- | |
228f3aba | 250 | Bool_t AliAODPidHF::IsProtonRaw (AliAODTrack *track, TString detector) const{ |
fcff8ce7 | 251 | // checks if the track can be a proton raw PID applied for single detectors |
252 | ||
253 | Int_t specie=0; | |
254 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,4); | |
0908b647 | 255 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,4); |
fcff8ce7 | 256 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,4); |
257 | ||
258 | if(specie==4) return kTRUE; | |
259 | ||
260 | return kFALSE; | |
7ce8802c | 261 | } |
f9e3cf8e | 262 | //-------------------------- |
228f3aba | 263 | Bool_t AliAODPidHF::IsElectronRaw(AliAODTrack *track, TString detector) const{ |
fcff8ce7 | 264 | // checks if the track can be an electron raw PID applied for single detectors |
0908b647 | 265 | |
fcff8ce7 | 266 | Int_t specie=-1; |
267 | if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,0); | |
268 | if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,0); | |
269 | if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,0); | |
270 | ||
271 | if(specie==0) return kTRUE; | |
272 | ||
273 | return kFALSE; | |
f9e3cf8e | 274 | } |
275 | //-------------------------- | |
228f3aba | 276 | Int_t AliAODPidHF::ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const{ |
0908b647 | 277 | // n-sigma cut, TPC PID |
278 | ||
fcff8ce7 | 279 | Double_t nsigma=-999.; |
b79bfc3e | 280 | Int_t pid=-1; |
0908b647 | 281 | |
f9e3cf8e | 282 | 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 |
4940d5bf | 283 | Double_t nsigmaMin=999.; |
284 | for(Int_t ipart=0;ipart<5;ipart++){ | |
285 | if(GetnSigmaTPC(track,ipart,nsigma)==1){ | |
0908b647 | 286 | nsigma=TMath::Abs(nsigma); |
287 | if((nsigma<nsigmaMin) && (nsigma<fnSigma[0])) { | |
288 | pid=ipart; | |
289 | nsigmaMin=nsigma; | |
290 | } | |
4940d5bf | 291 | } |
7ce8802c | 292 | } |
7ce8802c | 293 | }else{ // asks only for one particle specie |
4940d5bf | 294 | if(GetnSigmaTPC(track,specie,nsigma)==1){ |
295 | nsigma=TMath::Abs(nsigma); | |
0908b647 | 296 | if (nsigma>fnSigma[0]) pid=-1; |
4940d5bf | 297 | else pid=specie; |
b79bfc3e | 298 | } |
b79bfc3e | 299 | } |
0908b647 | 300 | |
4940d5bf | 301 | return pid; |
7ce8802c | 302 | } |
303 | //---------------------------- | |
228f3aba | 304 | Int_t AliAODPidHF::ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const{ |
0908b647 | 305 | // truncated mean, ITS PID |
fcff8ce7 | 306 | |
307 | Double_t nsigma=-999.; | |
b79bfc3e | 308 | Int_t pid=-1; |
fcff8ce7 | 309 | |
f9e3cf8e | 310 | 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 |
fcff8ce7 | 311 | Double_t nsigmaMin=999.; |
312 | for(Int_t ipart=0;ipart<5;ipart++){ | |
313 | if(GetnSigmaITS(track,ipart,nsigma)==1){ | |
0908b647 | 314 | nsigma=TMath::Abs(nsigma); |
315 | if((nsigma<nsigmaMin) && (nsigma<fnSigma[4])) { | |
316 | pid=ipart; | |
317 | nsigmaMin=nsigma; | |
318 | } | |
fcff8ce7 | 319 | } |
7ce8802c | 320 | } |
7ce8802c | 321 | }else{ // asks only for one particle specie |
fcff8ce7 | 322 | if(GetnSigmaITS(track,specie,nsigma)==1){ |
323 | nsigma=TMath::Abs(nsigma); | |
0908b647 | 324 | if (nsigma>fnSigma[4]) pid=-1; |
fcff8ce7 | 325 | else pid=specie; |
b79bfc3e | 326 | } |
b79bfc3e | 327 | } |
fcff8ce7 | 328 | |
329 | return pid; | |
7ce8802c | 330 | } |
331 | //---------------------------- | |
228f3aba | 332 | Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{ |
0908b647 | 333 | // n-sigma cut, TOF PID |
334 | ||
fcff8ce7 | 335 | Double_t nsigma=-999.; |
4940d5bf | 336 | Int_t pid=-1; |
0908b647 | 337 | |
338 | if(specie<0){ | |
339 | Double_t nsigmaMin=999.; | |
4940d5bf | 340 | for(Int_t ipart=0;ipart<5;ipart++){ |
341 | if(GetnSigmaTOF(track,ipart,nsigma)==1){ | |
0908b647 | 342 | nsigma=TMath::Abs(nsigma); |
343 | if((nsigma<nsigmaMin)&& (nsigma<fnSigma[3])){ | |
344 | pid=ipart; | |
345 | nsigmaMin=nsigma; | |
346 | } | |
4940d5bf | 347 | } |
348 | } | |
349 | }else{ // asks only for one particle specie | |
23e088a9 | 350 | Double_t nSigmaMin,nSigmaMax; |
351 | if(fUseAsymTOF){ | |
352 | nSigmaMin=fLownSigmaTOF; | |
353 | nSigmaMax=fUpnSigmaTOF; | |
354 | }else{ | |
355 | nSigmaMin=-fnSigma[3]; | |
356 | nSigmaMax=fnSigma[3]; | |
357 | } | |
4940d5bf | 358 | if(GetnSigmaTOF(track,specie,nsigma)==1){ |
23e088a9 | 359 | if(nsigma<nSigmaMin || nsigma>nSigmaMax) pid=-1; |
4940d5bf | 360 | else pid=specie; |
361 | } | |
362 | } | |
0908b647 | 363 | return pid; |
23e088a9 | 364 | } |
365 | //---------------------------- | |
366 | Int_t AliAODPidHF::ApplyTOFCompatibilityBand(AliAODTrack *track,Int_t specie) const{ | |
0908b647 | 367 | // n-sigma cut, TOF PID |
368 | ||
23e088a9 | 369 | if(specie<0) return -1; |
370 | Double_t nsigma=-999.; | |
371 | Int_t pid=-1; | |
0908b647 | 372 | |
23e088a9 | 373 | Double_t nSigmaMin,nSigmaMax; |
374 | if(fUseAsymTOF){ | |
375 | nSigmaMin=fLownSigmaCompatTOF; | |
0908b647 | 376 | nSigmaMax=fUpnSigmaCompatTOF; |
23e088a9 | 377 | }else{ |
378 | nSigmaMin=-fnSigmaCompat[1]; | |
379 | nSigmaMax=fnSigmaCompat[1]; | |
7ce8802c | 380 | } |
23e088a9 | 381 | if(GetnSigmaTOF(track,specie,nsigma)==1){ |
382 | if(nsigma<nSigmaMin || nsigma>nSigmaMax) pid=-1; | |
383 | else pid=specie; | |
384 | } | |
0908b647 | 385 | return pid; |
7ce8802c | 386 | } |
387 | //------------------------------ | |
228f3aba | 388 | void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{ |
0908b647 | 389 | // combined PID stored inside the AOD track |
390 | ||
391 | const Double_t *pid=track->PID(); | |
392 | Float_t max=0.; | |
393 | Int_t k=-1; | |
394 | for (Int_t i=0; i<10; i++) { | |
395 | if (pid[i]>max) {k=i; max=pid[i];} | |
396 | } | |
397 | ||
398 | if(k==2) type[0]=kTRUE; | |
399 | if(k==3) type[1]=kTRUE; | |
400 | if(k==4) type[2]=kTRUE; | |
401 | ||
402 | return; | |
7ce8802c | 403 | } |
f9e3cf8e | 404 | //-------------------------------- |
70e398d3 | 405 | Bool_t AliAODPidHF::CheckITSPIDStatus(AliAODTrack *track) const{ |
fcff8ce7 | 406 | // Check if the track is good for ITS PID |
407 | AliPIDResponse::EDetPidStatus status = fPidResponse->CheckPIDStatus(AliPIDResponse::kITS,track); | |
408 | if (status != AliPIDResponse::kDetPidOk) return kFALSE; | |
70e398d3 | 409 | return kTRUE; |
410 | } | |
411 | //-------------------------------- | |
412 | Bool_t AliAODPidHF::CheckTPCPIDStatus(AliAODTrack *track) const{ | |
fcff8ce7 | 413 | // Check if the track is good for TPC PID |
414 | AliPIDResponse::EDetPidStatus status = fPidResponse->CheckPIDStatus(AliPIDResponse::kTPC,track); | |
415 | if (status != AliPIDResponse::kDetPidOk) return kFALSE; | |
416 | UInt_t nclsTPCPID = track->GetTPCsignalN(); | |
417 | if(nclsTPCPID<fMinNClustersTPCPID) return kFALSE; | |
70e398d3 | 418 | return kTRUE; |
419 | } | |
420 | //-------------------------------- | |
421 | Bool_t AliAODPidHF::CheckTOFPIDStatus(AliAODTrack *track) const{ | |
fcff8ce7 | 422 | // Check if the track is good for TOF PID |
423 | AliPIDResponse::EDetPidStatus status = fPidResponse->CheckPIDStatus(AliPIDResponse::kTOF,track); | |
0908b647 | 424 | if (status != AliPIDResponse::kDetPidOk) return kFALSE; |
fcff8ce7 | 425 | Float_t probMis = fPidResponse->GetTOFMismatchProbability(track); |
426 | if (probMis > fCutTOFmismatch) return kFALSE; | |
427 | if ((track->GetStatus()&AliESDtrack::kTOFpid )==0 && | |
428 | track->GetStatus()&AliESDtrack::kITSrefit ) return kFALSE; | |
70e398d3 | 429 | return kTRUE; |
430 | } | |
431 | //-------------------------------- | |
432 | Bool_t AliAODPidHF::CheckTRDPIDStatus(AliAODTrack *track) const{ | |
fcff8ce7 | 433 | // Check if the track is good for TRD PID |
434 | AliPIDResponse::EDetPidStatus status = fPidResponse->CheckPIDStatus(AliPIDResponse::kTRD,track); | |
435 | if (status != AliPIDResponse::kDetPidOk) return kFALSE; | |
70e398d3 | 436 | return kTRUE; |
437 | } | |
438 | //-------------------------------- | |
228f3aba | 439 | Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{ |
fcff8ce7 | 440 | // Quality cuts on the tracks, detector by detector |
441 | if(detectors.Contains("ITS")) return CheckITSPIDStatus(track); | |
442 | else if(detectors.Contains("TPC")) return CheckTPCPIDStatus(track); | |
443 | else if(detectors.Contains("TOF")) return CheckTOFPIDStatus(track); | |
444 | else if(detectors.Contains("TRD")) return CheckTRDPIDStatus(track); | |
445 | else{ | |
446 | AliError("Wrong detector name"); | |
447 | return kFALSE; | |
f9e3cf8e | 448 | } |
f9e3cf8e | 449 | } |
228f3aba | 450 | //-------------------------------------------- |
451 | Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{ | |
fcff8ce7 | 452 | // TPC nsigma cut PID, different sigmas in different p bins |
0908b647 | 453 | |
c5541cc2 | 454 | AliAODPid *pidObj = track->GetDetPid(); |
455 | Double_t mom = pidObj->GetTPCmomentum(); | |
456 | if(mom>fPtThresholdTPC) return kTRUE; | |
0908b647 | 457 | |
4940d5bf | 458 | Double_t nsigma; |
459 | if(GetnSigmaTPC(track,specie,nsigma)!=1) return kFALSE; | |
460 | nsigma=TMath::Abs(nsigma); | |
0908b647 | 461 | |
462 | ||
228f3aba | 463 | if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE; |
464 | if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE; | |
465 | if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE; | |
0908b647 | 466 | |
70e398d3 | 467 | return kFALSE; |
228f3aba | 468 | } |
469 | //------------------ | |
70e398d3 | 470 | Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track, Int_t specie){ |
471 | // combination of the PID info coming from TPC and TOF | |
0908b647 | 472 | |
c5541cc2 | 473 | Double_t ptrack=track->P(); |
474 | if(ptrack>fMaxTrackMomForCombinedPID) return 1; | |
0908b647 | 475 | |
70e398d3 | 476 | Bool_t okTPC=CheckTPCPIDStatus(track); |
c5541cc2 | 477 | if(ptrack>fPtThresholdTPC) okTPC=kFALSE; |
fcff8ce7 | 478 | Bool_t okTOF=CheckTOFPIDStatus(track); |
0908b647 | 479 | |
70e398d3 | 480 | if(fMatch==1){ |
481 | //TOF || TPC (a la' Andrea R.) | |
0908b647 | 482 | // convention: |
70e398d3 | 483 | // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible |
484 | // the method returns the sum of the response of the 2 detectors | |
0908b647 | 485 | |
70e398d3 | 486 | if(fTPC && fTOF) { |
487 | if(!okTPC && !okTOF) return 0; | |
488 | } | |
489 | ||
490 | Int_t tTPCinfo=0; | |
491 | if(fTPC && okTPC){ | |
492 | tTPCinfo=-1; | |
493 | if(fAsym) { | |
0908b647 | 494 | if(TPCRawAsym(track,specie)) tTPCinfo=1; |
70e398d3 | 495 | }else{ |
0908b647 | 496 | if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1; |
70e398d3 | 497 | } |
498 | if(fCompat && tTPCinfo<0){ | |
0908b647 | 499 | Double_t sig0tmp=fnSigma[0]; |
500 | SetSigma(0,fnSigmaCompat[0]); | |
501 | if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=0; | |
502 | SetSigma(0,sig0tmp); | |
503 | } | |
70e398d3 | 504 | } |
0908b647 | 505 | |
70e398d3 | 506 | Int_t tTOFinfo=0; |
507 | if(fTOF){ | |
508 | if(!okTOF && fTPC) return tTPCinfo; | |
509 | tTOFinfo=-1; | |
510 | if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1; | |
511 | if(fCompat && tTOFinfo>0){ | |
0908b647 | 512 | if(ptrack>fPCompatTOF) { |
513 | if(ApplyTOFCompatibilityBand(track,specie)==specie) tTOFinfo=0; | |
514 | } | |
70e398d3 | 515 | } |
516 | } | |
0908b647 | 517 | |
518 | ||
70e398d3 | 519 | if(tTPCinfo+tTOFinfo==0 && fTOFdecide){ |
520 | if(!okTOF) return tTPCinfo; | |
521 | return tTOFinfo; | |
522 | } | |
523 | ||
524 | if(tTPCinfo+tTOFinfo==0 && fITS){ | |
525 | if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo; | |
526 | Int_t tITSinfo = -1; | |
527 | if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1; | |
528 | return tITSinfo; | |
529 | } | |
530 | return tTPCinfo+tTOFinfo; | |
cdac45d3 | 531 | } |
0908b647 | 532 | |
70e398d3 | 533 | if(fMatch==2){ |
534 | //TPC & TOF (a la' Yifei) | |
535 | // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified | |
0908b647 | 536 | Int_t tTPCinfo=0; |
537 | ||
70e398d3 | 538 | if(fTPC && okTPC) { |
539 | tTPCinfo=1; | |
540 | if(fAsym){ | |
0908b647 | 541 | if(!TPCRawAsym(track,specie)) tTPCinfo=-1; |
70e398d3 | 542 | }else{ |
0908b647 | 543 | if(ApplyPidTPCRaw(track,specie)!=specie) tTPCinfo=-1; |
70e398d3 | 544 | } |
545 | } | |
0908b647 | 546 | |
70e398d3 | 547 | Int_t tTOFinfo=1; |
548 | if(fTOF){ | |
549 | if(fTPC && !okTOF) return tTPCinfo; | |
550 | if(ApplyPidTPCRaw(track,specie)!=specie) tTOFinfo=-1; | |
551 | } | |
0908b647 | 552 | |
70e398d3 | 553 | if(tTOFinfo==1 && tTPCinfo==1) return 1; |
0908b647 | 554 | |
70e398d3 | 555 | if(tTPCinfo+tTOFinfo==0 && fITS){ |
556 | if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo; | |
557 | Int_t tITSinfo = -1; | |
558 | if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1; | |
559 | return tITSinfo; | |
560 | } | |
561 | return -1; | |
562 | } | |
0908b647 | 563 | |
70e398d3 | 564 | if(fMatch==3){ |
565 | //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.) | |
566 | // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified | |
567 | if(fTPC && fTOF) if(!okTPC && !okTOF) return 0; | |
0908b647 | 568 | |
569 | ||
70e398d3 | 570 | Int_t tTPCinfo=-1; |
0908b647 | 571 | if(ptrack>=fPLimit[0] && ptrack<fPLimit[1] && fTPC) { |
70e398d3 | 572 | if(!okTPC) return 0; |
573 | if(fAsym) { | |
0908b647 | 574 | if(TPCRawAsym(track,specie)) tTPCinfo=1; |
70e398d3 | 575 | }else{ |
0908b647 | 576 | if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1; |
577 | } | |
70e398d3 | 578 | return tTPCinfo; |
579 | } | |
580 | ||
581 | Int_t tTOFinfo=-1; | |
582 | if(ptrack>=fPLimit[1] && fTOF){ | |
583 | if(!okTOF) return 0; | |
584 | if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1; | |
585 | return tTOFinfo; | |
586 | } | |
587 | ||
588 | Int_t tITSinfo=-1; | |
589 | if(ptrack<fPLimit[0] && fITS){ | |
590 | if(!CheckITSPIDStatus(track)) return 0; | |
591 | if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1; | |
592 | return tITSinfo; | |
593 | } | |
594 | } | |
0908b647 | 595 | |
fcff8ce7 | 596 | if(fMatch==4 || fMatch==5){ |
0908b647 | 597 | |
fcff8ce7 | 598 | // fMatch == 4 ---> "circular cut" in nSigmaTPC, nSimgaTOF plane |
599 | // ---> nsigmaTPC^2+nsigmaTOF^2 < cut^2 | |
0908b647 | 600 | // fMatch == 5 ---> "rectangular cut" in nSigmaTPC, nsigmaTOF plane |
fcff8ce7 | 601 | // ---> ns1<nSigmaTPC<NS1 && ns2<nSigmaTOF<NS2 |
0908b647 | 602 | |
fcff8ce7 | 603 | Double_t nSigmaTPC=0.; |
604 | if(okTPC) { | |
605 | nSigmaTPC=fPidResponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)specie); | |
606 | if(nSigmaTPC<-990.) nSigmaTPC=0.; | |
607 | } | |
608 | Double_t nSigmaTOF=0.; | |
609 | if(okTOF) { | |
610 | nSigmaTOF=fPidResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)specie); | |
611 | } | |
612 | Int_t iPart=specie-2; //species is 2 for pions,3 for kaons and 4 for protons | |
613 | if(iPart<0 || iPart>2) return -1; | |
614 | if(fMatch==4){ | |
615 | Double_t nSigma2=nSigmaTPC*nSigmaTPC+nSigmaTOF*nSigmaTOF; | |
616 | if(nSigma2<fMaxnSigmaCombined[iPart]*fMaxnSigmaCombined[iPart]) return 1; | |
617 | else return -1; | |
618 | } | |
619 | else if(fMatch==5){ | |
0908b647 | 620 | if(fForceTOFforKaons && iPart==1 && !okTOF) return -1; |
fcff8ce7 | 621 | if((nSigmaTPC>fMinnSigmaTPC[iPart] && nSigmaTPC<fMaxnSigmaTPC[iPart]) && |
0908b647 | 622 | (nSigmaTOF>fMinnSigmaTOF[iPart] && nSigmaTOF<fMaxnSigmaTOF[iPart])) return 1; |
fcff8ce7 | 623 | else return -1; |
624 | } | |
625 | } | |
0908b647 | 626 | |
627 | ||
70e398d3 | 628 | return -1; |
0908b647 | 629 | |
cdac45d3 | 630 | } |
0908b647 | 631 | //---------------------------------- |
cdac45d3 | 632 | Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){ |
fcff8ce7 | 633 | // general method to compute PID |
70e398d3 | 634 | if(fMatch>0){ |
0908b647 | 635 | return MatchTPCTOF(track,specie); |
70e398d3 | 636 | }else{ |
637 | if(fTPC && !fTOF && !fITS) { | |
638 | Int_t tTPCres=0; | |
639 | if(!fAsym){ | |
0908b647 | 640 | tTPCres=ApplyPidTPCRaw(track,specie); |
641 | if(tTPCres==specie) return 1; | |
642 | else return tTPCres; | |
70e398d3 | 643 | }else{ |
0908b647 | 644 | if(TPCRawAsym(track,specie)) tTPCres=1; |
645 | else tTPCres=-1; | |
70e398d3 | 646 | } |
647 | return tTPCres; | |
648 | }else if(fTOF && !fTPC && !fITS) { | |
0908b647 | 649 | Int_t tTOFres=ApplyPidTOFRaw(track,specie); |
650 | if(tTOFres==specie) return 1; | |
70e398d3 | 651 | else return tTOFres; |
652 | }else if(fITS && !fTPC && !fTOF) { | |
653 | Int_t tITSres=ApplyPidITSRaw(track,specie); | |
654 | if(tITSres==specie) return 1; | |
655 | else return tITSres; | |
ad42e35b | 656 | }else{ |
70e398d3 | 657 | AliError("You should enable just one detector if you don't want to match"); |
658 | return 0; | |
ad42e35b | 659 | } |
0908b647 | 660 | } |
228f3aba | 661 | } |
12141139 | 662 | //-------------------------------------------- |
70e398d3 | 663 | void AliAODPidHF::GetTPCBetheBlochParams(Double_t alephParameters[5]) const { |
664 | // TPC bethe bloch parameters | |
fcff8ce7 | 665 | if(fMC) { // MC |
0908b647 | 666 | |
fcff8ce7 | 667 | if(fPbPb) { // PbPb MC |
668 | ||
669 | alephParameters[0] = 1.44405/50.; | |
670 | alephParameters[1] = 2.35409e+01; | |
671 | alephParameters[2] = TMath::Exp(-2.90330e+01); | |
672 | alephParameters[3] = 2.10681e+00; | |
673 | alephParameters[4] = 4.62254e+00; | |
674 | ||
675 | } else { // pp MC | |
676 | if(fMCLowEn2011){ | |
0908b647 | 677 | alephParameters[0]=0.0207667; |
678 | alephParameters[1]=29.9936; | |
679 | alephParameters[2]=3.87866e-11; | |
680 | alephParameters[3]=2.17291; | |
681 | alephParameters[4]=7.1623; | |
fcff8ce7 | 682 | }else if(fOnePad){ |
0908b647 | 683 | alephParameters[0]=0.029021; |
684 | alephParameters[1]=25.4181; | |
685 | alephParameters[2]=4.66596e-08; | |
686 | alephParameters[3]=1.90008; | |
687 | alephParameters[4]=4.63783; | |
fcff8ce7 | 688 | }else{ |
0908b647 | 689 | alephParameters[0] = 2.15898/50.; |
690 | alephParameters[1] = 1.75295e+01; | |
691 | alephParameters[2] = 3.40030e-09; | |
692 | alephParameters[3] = 1.96178e+00; | |
693 | alephParameters[4] = 3.91720e+00; | |
fcff8ce7 | 694 | } |
695 | } | |
696 | ||
697 | } else { // Real Data | |
698 | ||
699 | if(fOnePad) { // pp 1-pad (since LHC10d) | |
700 | ||
0908b647 | 701 | alephParameters[0] =1.34490e+00/50.; |
702 | alephParameters[1] = 2.69455e+01; | |
703 | alephParameters[2] = TMath::Exp(-2.97552e+01); | |
704 | alephParameters[3] = 2.35339e+00; | |
fcff8ce7 | 705 | alephParameters[4] = 5.98079e+00; |
706 | ||
0908b647 | 707 | } else if(fPbPb) { // PbPb |
fcff8ce7 | 708 | |
0908b647 | 709 | // alephParameters[0] = 1.25202/50.; |
710 | // alephParameters[1] = 2.74992e+01; | |
711 | // alephParameters[2] = TMath::Exp(-3.31517e+01); | |
712 | // alephParameters[3] = 2.46246; | |
fcff8ce7 | 713 | // alephParameters[4] = 6.78938; |
714 | ||
0908b647 | 715 | alephParameters[0] = 5.10207e+00/50.; |
716 | alephParameters[1] = 7.94982e+00; | |
717 | alephParameters[2] = TMath::Exp(-9.07942e+00); | |
718 | alephParameters[3] = 2.38808e+00; | |
fcff8ce7 | 719 | alephParameters[4] = 1.68165e+00; |
720 | ||
721 | } else if(fppLowEn2011){ // pp low energy | |
722 | ||
723 | alephParameters[0]=0.031642; | |
724 | alephParameters[1]=22.353; | |
725 | alephParameters[2]=4.16239e-12; | |
726 | alephParameters[3]=2.61952; | |
0908b647 | 727 | alephParameters[4]=5.76086; |
fcff8ce7 | 728 | |
729 | } else { // pp no 1-pad (LHC10bc) | |
730 | ||
731 | alephParameters[0] = 0.0283086/0.97; | |
732 | alephParameters[1] = 2.63394e+01; | |
733 | alephParameters[2] = 5.04114e-11; | |
734 | alephParameters[3] = 2.12543e+00; | |
735 | alephParameters[4] = 4.88663e+00; | |
736 | ||
737 | } | |
738 | ||
739 | } | |
0908b647 | 740 | |
70e398d3 | 741 | } |
742 | ||
743 | //----------------------- | |
744 | void AliAODPidHF::SetBetheBloch() { | |
745 | // Set Bethe Bloch Parameters | |
0908b647 | 746 | |
747 | Double_t alephParameters[5]; | |
748 | GetTPCBetheBlochParams(alephParameters); | |
749 | fTPCResponse->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]); | |
750 | ||
751 | return; | |
12141139 | 752 | } |
d50b25df | 753 | |
4940d5bf | 754 | |
64e39959 | 755 | //-------------------------------------------------------------------------- |
fcff8ce7 | 756 | Int_t AliAODPidHF::GetnSigmaITS(AliAODTrack *track,Int_t species, Double_t &nsigma) const{ |
757 | // get n sigma for ITS | |
0908b647 | 758 | |
759 | ||
fcff8ce7 | 760 | if (!CheckITSPIDStatus(track)) return -1; |
0908b647 | 761 | |
fcff8ce7 | 762 | Double_t nsigmaITS=-999; |
0908b647 | 763 | |
fcff8ce7 | 764 | if (fOldPid) { |
765 | Double_t mom=track->P(); | |
766 | AliAODPid *pidObj = track->GetDetPid(); | |
767 | Double_t dedx=pidObj->GetITSsignal(); | |
0908b647 | 768 | |
fcff8ce7 | 769 | AliITSPIDResponse itsResponse; |
770 | AliPID::EParticleType type=AliPID::EParticleType(species); | |
771 | nsigmaITS = itsResponse.GetNumberOfSigmas(mom,dedx,type); | |
0908b647 | 772 | |
fcff8ce7 | 773 | } // old pid |
774 | else { // new pid | |
0908b647 | 775 | |
fcff8ce7 | 776 | AliPID::EParticleType type=AliPID::EParticleType(species); |
777 | nsigmaITS = fPidResponse->NumberOfSigmasITS(track,type); | |
0908b647 | 778 | |
fcff8ce7 | 779 | } //new pid |
0908b647 | 780 | |
fcff8ce7 | 781 | nsigma = nsigmaITS; |
0908b647 | 782 | |
fcff8ce7 | 783 | return 1; |
0908b647 | 784 | |
fcff8ce7 | 785 | } |
451c9a4e | 786 | //-------------------------------------------------------------------------- |
4940d5bf | 787 | Int_t AliAODPidHF::GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &nsigma) const{ |
0908b647 | 788 | // get n sigma for TPC |
789 | ||
70e398d3 | 790 | if(!CheckTPCPIDStatus(track)) return -1; |
451c9a4e | 791 | |
792 | Double_t nsigmaTPC=-999; | |
793 | ||
794 | if(fOldPid){ | |
795 | AliAODPid *pidObj = track->GetDetPid(); | |
796 | Double_t dedx=pidObj->GetTPCsignal(); | |
797 | Double_t mom = pidObj->GetTPCmomentum(); | |
798 | if(mom>fPtThresholdTPC) return -2; | |
451c9a4e | 799 | UShort_t nTPCClus=pidObj->GetTPCsignalN(); |
800 | if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();} | |
801 | AliPID::EParticleType type=AliPID::EParticleType(species); | |
4940d5bf | 802 | nsigmaTPC = fTPCResponse->GetNumberOfSigmas(mom,dedx,nTPCClus,type); |
803 | nsigma=nsigmaTPC; | |
451c9a4e | 804 | } else{ |
4940d5bf | 805 | if(!fPidResponse) return -1; |
451c9a4e | 806 | AliPID::EParticleType type=AliPID::EParticleType(species); |
4940d5bf | 807 | nsigmaTPC = fPidResponse->NumberOfSigmasTPC(track,type); |
808 | nsigma=nsigmaTPC; | |
451c9a4e | 809 | } |
810 | return 1; | |
0908b647 | 811 | } |
451c9a4e | 812 | |
813 | //----------------------------- | |
814 | ||
4940d5bf | 815 | Int_t AliAODPidHF::GetnSigmaTOF(AliAODTrack *track,Int_t species, Double_t &nsigma) const{ |
4c177f98 | 816 | // get n sigma for TOF |
0908b647 | 817 | |
70e398d3 | 818 | if(!CheckTOFPIDStatus(track)) return -1; |
0908b647 | 819 | |
4940d5bf | 820 | if(fPidResponse){ |
821 | nsigma = fPidResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)species); | |
a585a726 | 822 | return 1; |
4940d5bf | 823 | }else{ |
a585a726 | 824 | AliFatal("To use TOF PID you need to attach AliPIDResponseTask"); |
825 | nsigma=-999.; | |
826 | return -1; | |
4940d5bf | 827 | } |
451c9a4e | 828 | } |
829 | ||
e7af8919 | 830 | //----------------------- |
4c177f98 | 831 | Bool_t AliAODPidHF::IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detectors) { |
832 | // Exclude a given hypothesis (labelTracks) in detector | |
0908b647 | 833 | |
e7af8919 | 834 | if (detectors.Contains("ITS")) { |
0908b647 | 835 | |
e7af8919 | 836 | AliInfo("Nothing to be done"); |
837 | /* | |
0908b647 | 838 | Double_t nsigma=0.; |
839 | if (GetnSigmaITS(track,labelTrack,nsigma)==1){ | |
840 | if(nsigma>nsigmaCut) return kTRUE; | |
841 | } | |
842 | */ | |
e7af8919 | 843 | return kFALSE; |
0908b647 | 844 | |
e7af8919 | 845 | } else if (detectors.Contains("TPC")) { |
0908b647 | 846 | |
e7af8919 | 847 | Double_t nsigma=0.; |
848 | if (GetnSigmaTPC(track,labelTrack,nsigma)==1){ | |
849 | if(nsigma>nsigmaCut) return kTRUE; | |
850 | } | |
851 | return kFALSE; | |
0908b647 | 852 | |
e7af8919 | 853 | } else if (detectors.Contains("TOF")) { |
0908b647 | 854 | |
e7af8919 | 855 | Double_t nsigma=0.; |
856 | if (GetnSigmaTOF(track,labelTrack,nsigma)==1){ | |
857 | if(nsigma>nsigmaCut) return kTRUE; | |
858 | } | |
859 | return kFALSE; | |
0908b647 | 860 | |
e7af8919 | 861 | } |
862 | return kFALSE; | |
0908b647 | 863 | |
e7af8919 | 864 | } |
fcff8ce7 | 865 | //----------------------- |
866 | Bool_t AliAODPidHF::IsTOFPiKexcluded(AliAODTrack *track,Double_t nsigmaK){ | |
867 | // TOF proton compatibility | |
0908b647 | 868 | |
fcff8ce7 | 869 | if(!CheckTOFPIDStatus(track)) return 0; |
0908b647 | 870 | |
fcff8ce7 | 871 | Double_t nsigma; |
872 | if(GetnSigmaTOF(track,3,nsigma)==1){ | |
873 | if(nsigma>nsigmaK) return kTRUE; | |
0908b647 | 874 | } |
fcff8ce7 | 875 | return kFALSE; |
876 | /* Double_t time[AliPID::kSPECIESN]; | |
0908b647 | 877 | Double_t sigmaTOFPid[AliPID::kSPECIES]; |
878 | AliAODPid *pidObj = track->GetDetPid(); | |
879 | pidObj->GetIntegratedTimes(time); | |
880 | Double_t sigTOF=pidObj->GetTOFsignal(); | |
881 | ||
882 | AliAODEvent *event=(AliAODEvent*)track->GetAODEvent(); | |
883 | if (event) { | |
fcff8ce7 | 884 | AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader(); |
0908b647 | 885 | if (tofH && fPidResponse) { |
886 | AliTOFPIDResponse TOFres = (AliTOFPIDResponse)fPidResponse->GetTOFResponse(); | |
887 | sigTOF -= TOFres.GetStartTime(track->P()); | |
888 | sigmaTOFPid[3]=TOFres.GetExpectedSigma(track->P(),time[3],AliPID::ParticleMass(3)); | |
fcff8ce7 | 889 | } |
890 | else pidObj->GetTOFpidResolution(sigmaTOFPid); | |
0908b647 | 891 | } else pidObj->GetTOFpidResolution(sigmaTOFPid); |
892 | Double_t sigmaTOFtrack; | |
893 | if (sigmaTOFPid[3]>0) sigmaTOFtrack=sigmaTOFPid[3]; | |
894 | else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs | |
895 | ||
896 | if((sigTOF-time[3])>nsigmaK*sigmaTOFtrack)return kTRUE;// K, Pi excluded (->LIKELY A PROTON) | |
897 | ||
898 | return kFALSE; | |
899 | */ | |
fcff8ce7 | 900 | } |
901 | ||
902 | //-------------------------------------------------------------------------- | |
903 | void AliAODPidHF::SetPriorDistribution(AliPID::EParticleType type,TH1F *prior){ | |
0908b647 | 904 | |
fcff8ce7 | 905 | // |
906 | // method setting the prior distributions to the AliPIDCombined object of the AliAODPidHF data member | |
907 | // all the checks are done directly in the AliPIDCombined object | |
908 | // | |
0908b647 | 909 | |
fcff8ce7 | 910 | GetPidCombined()->SetPriorDistribution(type,prior); |
911 | } | |
912 | //-------------------------------------------------------------------------- | |
913 | void AliAODPidHF::DrawPrior(AliPID::EParticleType type){ | |
0908b647 | 914 | |
fcff8ce7 | 915 | // |
916 | // Drawing prior distribution for type "type" | |
0908b647 | 917 | |
fcff8ce7 | 918 | new TCanvas(); |
919 | GetPidCombined()->GetPriorDistribution(type)->Draw(); | |
920 | } | |
921 | ||
451c9a4e | 922 | //----------------------------- |
4c177f98 | 923 | void AliAODPidHF::SetPriorsHistos(TString priorFileName){ |
924 | // Set histograms with priors | |
0908b647 | 925 | |
4c177f98 | 926 | for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) { |
927 | if(fPriorsH[ispecies]) delete fPriorsH[ispecies]; | |
928 | TString nt ="name"; | |
929 | nt+="_prior_"; | |
930 | nt+=AliPID::ParticleName(ispecies); | |
4c177f98 | 931 | } |
03a82f54 | 932 | TDirectory *current = gDirectory; |
4c177f98 | 933 | TFile *priorFile=TFile::Open(priorFileName); |
934 | if (priorFile) { | |
03a82f54 | 935 | TH1F* h3=static_cast<TH1F*>(priorFile->Get("priors3step9")); |
936 | TH1F* h2=static_cast<TH1F*>(priorFile->Get("priors2step9")); | |
937 | TH1F* h1=static_cast<TH1F*>(priorFile->Get("priors1step9")); | |
938 | current->cd(); | |
939 | fPriorsH[AliPID::kProton] = new TH1F(*h3); | |
940 | fPriorsH[AliPID::kKaon ] = new TH1F(*h2); | |
941 | fPriorsH[AliPID::kPion ] = new TH1F(*h1); | |
942 | priorFile->Close(); | |
4c177f98 | 943 | delete priorFile; |
944 | TF1 *salt=new TF1("salt","1.e-10",0,10); | |
945 | fPriorsH[AliPID::kProton]->Add(salt); | |
946 | fPriorsH[AliPID::kKaon ]->Add(salt); | |
947 | fPriorsH[AliPID::kPion ]->Add(salt); | |
948 | delete salt; | |
949 | } | |
950 | } | |
951 | //---------------------------------- | |
952 | void AliAODPidHF::SetUpCombinedPID(){ | |
953 | // Configuration of combined Bayesian PID | |
0908b647 | 954 | |
fcff8ce7 | 955 | fPidCombined->SetSelectedSpecies(AliPID::kSPECIES); |
e51f1625 | 956 | if(!fDefaultPriors){ |
957 | for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) { | |
958 | fPidCombined->SetPriorDistribution(static_cast<AliPID::EParticleType>(ispecies),fPriorsH[ispecies]); | |
959 | } | |
960 | }else{ | |
0908b647 | 961 | fPidCombined->SetDefaultTPCPriors(); |
4c177f98 | 962 | } |
fcff8ce7 | 963 | switch (fCombDetectors){ |
0908b647 | 964 | case kTPCTOF: |
965 | fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF); | |
966 | break; | |
0908b647 | 967 | case kTPCITS: |
968 | fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetITS); | |
969 | break; | |
970 | case kTPC: | |
971 | fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC); | |
972 | break; | |
973 | case kTOF: | |
974 | fPidCombined->SetDetectorMask(AliPIDResponse::kDetTOF); | |
975 | break; | |
fcff8ce7 | 976 | } |
4c177f98 | 977 | } |
f35c481f | 978 | |
f35c481f | 979 | |
f35149be | 980 | //----------------------------- |
981 | void AliAODPidHF::PrintAll() const { | |
982 | // print the configuration | |
983 | printf("Detectors used for PID: "); | |
984 | if(fITS) printf("ITS "); | |
985 | if(fTPC) printf("TPC "); | |
986 | if(fTRD) printf("TRD "); | |
987 | if(fTOF) printf("TOF "); | |
988 | printf("\n"); | |
989 | printf("Minimum TPC PID clusters = %d\n",fMinNClustersTPCPID); | |
990 | printf("Maximum momentum for using TPC PID = %f\n",fPtThresholdTPC); | |
991 | printf("TOF Mismatch probablility cut = %f\n",fCutTOFmismatch); | |
992 | printf("Maximum momentum for combined PID TPC PID = %f\n",fMaxTrackMomForCombinedPID); | |
993 | if(fOldPid){ | |
994 | printf("Use OLD PID"); | |
995 | printf(" fMC = %d\n",fMC); | |
996 | printf(" fPbPb = %d\n",fPbPb); | |
997 | printf(" fOnePad = %d\n",fOnePad); | |
998 | printf(" fMCLowEn2011 = %d\n",fMCLowEn2011); | |
999 | printf(" fppLowEn2011 = %d\n",fppLowEn2011); | |
1000 | } | |
1001 | printf("--- Matching algorithm = %d ---\n",fMatch); | |
1002 | if(fMatch==1){ | |
1003 | if(fITS) printf("nSigmaITS = %.2f\n",fnSigma[4]); | |
1004 | if(fTOF){ | |
1005 | printf("nSigmaTOF = %.2f\n",fnSigma[3]); | |
1006 | if(fCompat) printf("Compatibility band at nSigmaTOF=%.2f for p>%.2f\n",fnSigmaCompat[1],fPCompatTOF); | |
1007 | } | |
1008 | if(fTPC){ | |
1009 | if(fAsym){ | |
0908b647 | 1010 | printf("nSigmaTPC:\n"); |
1011 | printf(" pt<%.2f \t nsigmaTPC= %.2f\n",fPLimit[0],fnSigma[0]); | |
1012 | printf(" %.2f<pt<%.2f \t nsigmaTPC= %.2f\n",fPLimit[0],fPLimit[1],fnSigma[1]); | |
1013 | printf(" pt>%.2f \t nsigmaTPC= %.2f\n",fPLimit[1],fnSigma[2]); | |
f35149be | 1014 | }else{ |
0908b647 | 1015 | printf("nSigmaTPC = %.2f\n",fnSigma[0]); |
f35149be | 1016 | } |
1017 | if(fCompat) printf("Compatibility band at nSigmaTPC=%.2f\n",fnSigmaCompat[0]); | |
0908b647 | 1018 | } |
f35149be | 1019 | }else if(fMatch==4){ |
1020 | printf("Cuts on sqrt(nSigmaTPC^2+nSigmaTOF^2):\n"); | |
1021 | printf(" Pions: nSigma = %.2f\n",fMaxnSigmaCombined[0]); | |
1022 | printf(" Kaons: nSigma = %.2f\n",fMaxnSigmaCombined[1]); | |
1023 | printf(" Protons: nSigma = %.2f\n",fMaxnSigmaCombined[2]); | |
1024 | }else if(fMatch==5){ | |
1025 | printf("nSigma ranges:\n"); | |
1026 | printf(" Pions: %.2f<nSigmaTPC<%.2f %.2f<nSigmaTOF<%.2f\n", | |
0908b647 | 1027 | fMinnSigmaTPC[0],fMaxnSigmaTPC[0],fMinnSigmaTOF[0],fMaxnSigmaTOF[0]); |
f35149be | 1028 | printf(" Kaons: %.2f<nSigmaTPC<%.2f %.2f<nSigmaTOF<%.2f\n", |
0908b647 | 1029 | fMinnSigmaTPC[1],fMaxnSigmaTPC[1],fMinnSigmaTOF[1],fMaxnSigmaTOF[1]); |
f35149be | 1030 | printf(" Protons: %.2f<nSigmaTPC<%.2f %.2f<nSigmaTOF<%.2f\n", |
0908b647 | 1031 | fMinnSigmaTPC[2],fMaxnSigmaTPC[2],fMinnSigmaTOF[2],fMaxnSigmaTOF[2]); |
f35149be | 1032 | } |
1033 | } |