AliPhysics  vAN-20150827 (3e81cbb)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAODPidHF.cxx
Go to the documentation of this file.
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 /* $Id$ */
18 
24 #include <TCanvas.h>
25 #include <TString.h>
26 #include <TH1F.h>
27 #include <TF1.h>
28 #include <TFile.h>
29 
30 #include "AliAODPidHF.h"
31 #include "AliAODPid.h"
32 #include "AliPID.h"
33 #include "AliPIDResponse.h"
34 #include "AliAODpidUtil.h"
35 #include "AliESDtrack.h"
36 
40 
41 //------------------------------
43 TObject(),
44 fnNSigma(5),
45 fnSigma(0),
46 fTOFSigma(160.),
47 fCutTOFmismatch(0.01),
48 fMinNClustersTPCPID(0),
49 fnPriors(5),
50 fPriors(0),
51 fnPLimit(2),
52 fPLimit(0),
53 fAsym(kFALSE),
54 fTPC(kFALSE),
55 fTOF(kFALSE),
56 fITS(kFALSE),
57 fTRD(kFALSE),
58 fMatch(0),
59 fForceTOFforKaons(kFALSE),
60 fCompat(kFALSE),
61 fPCompatTOF(1.5),
62 fUseAsymTOF(kFALSE),
63 fLownSigmaTOF(-3.),
64 fUpnSigmaTOF(3.),
65 fLownSigmaCompatTOF(-3.),
66 fUpnSigmaCompatTOF(3.),
67 fnNSigmaCompat(2),
68 fnSigmaCompat(0),
69 fMC(kFALSE),
70 fOnePad(kFALSE),
71 fMCLowEn2011(kFALSE),
72 fppLowEn2011(kFALSE),
73 fPbPb(kFALSE),
74 fTOFdecide(kFALSE),
75 fOldPid(kFALSE),
76 fPtThresholdTPC(999999.),
77 fMaxTrackMomForCombinedPID(999999.),
78 fPidResponse(0),
79 fPidCombined(new AliPIDCombined()),
80 fTPCResponse(new AliTPCPIDResponse()),
81 fPriorsH(),
82 fCombDetectors(kTPCTOF),
83 fUseCombined(kFALSE),
84 fDefaultPriors(kTRUE)
85 {
89  fPLimit=new Double_t[fnPLimit];
90  fnSigma=new Double_t[fnNSigma];
91  fPriors=new Double_t[fnPriors];
92  fnSigmaCompat=new Double_t[fnNSigmaCompat];
93 
94  for(Int_t i=0;i<fnNSigma;i++){
95  fnSigma[i]=0.;
96  }
97  for(Int_t i=0;i<fnPriors;i++){
98  fPriors[i]=0.;
99  }
100  for(Int_t i=0;i<fnPLimit;i++){
101  fPLimit[i]=0.;
102  }
103  for(Int_t i=0;i<fnNSigmaCompat;i++){
104  fnSigmaCompat[i]=3.;
105  }
106  for(Int_t i=0; i<3; i++){ // pi, K, proton
107  fMaxnSigmaCombined[i]=3.;
108  fMinnSigmaTPC[i]=-3;
109  fMaxnSigmaTPC[i]=3;
110  fMinnSigmaTOF[i]=-3;
111  fMaxnSigmaTOF[i]=3;
112  }
113  for (Int_t s=0;s<AliPID::kSPECIES;s++) {
114  for (Int_t d=0;d<4;d++) {
115  fIdBandMin[s][d] = NULL;
116  fIdBandMax[s][d] = NULL;
117  fCompBandMin[s][d] = NULL;
118  fCompBandMax[s][d] = NULL;
119  }
120  }
121 
122 }
123 //----------------------
125 {
127  if(fPLimit) delete [] fPLimit;
128  if(fnSigma) delete [] fnSigma;
129  if(fPriors) delete [] fPriors;
130  if(fnSigmaCompat) delete [] fnSigmaCompat;
131  delete fPidCombined;
132 
133  delete fTPCResponse;
134  for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
135  delete fPriorsH[ispecies];
136  }
137 
138  for (Int_t s=0;s<AliPID::kSPECIES;s++) {
139  for (Int_t d=0;d<4;d++) {
140  delete fIdBandMin[s][d];
141  delete fIdBandMax[s][d];
142  delete fCompBandMin[s][d];
143  delete fCompBandMax[s][d];
144  }
145  }
146 }
147 //------------------------
149 TObject(),
150 fnNSigma(pid.fnNSigma),
151 fnSigma(0),
152 fTOFSigma(pid.fTOFSigma),
153 fCutTOFmismatch(pid.fCutTOFmismatch),
154 fMinNClustersTPCPID(pid.fMinNClustersTPCPID),
155 fnPriors(pid.fnPriors),
156 fPriors(0),
157 fnPLimit(pid.fnPLimit),
158 fPLimit(0),
159 fAsym(pid.fAsym),
160 fTPC(pid.fTPC),
161 fTOF(pid.fTOF),
162 fITS(pid.fITS),
163 fTRD(pid.fTRD),
164 fMatch(pid.fMatch),
165 fForceTOFforKaons(pid.fForceTOFforKaons),
166 fCompat(pid.fCompat),
167 fPCompatTOF(pid.fPCompatTOF),
168 fUseAsymTOF(pid.fUseAsymTOF),
169 fLownSigmaTOF(pid.fLownSigmaTOF),
170 fUpnSigmaTOF(pid.fUpnSigmaTOF),
171 fLownSigmaCompatTOF(pid.fLownSigmaCompatTOF),
172 fUpnSigmaCompatTOF(pid.fUpnSigmaCompatTOF),
173 fnNSigmaCompat(pid.fnNSigmaCompat),
174 fnSigmaCompat(0x0),
175 fMC(pid.fMC),
176 fOnePad(pid.fOnePad),
177 fMCLowEn2011(pid.fMCLowEn2011),
178 fppLowEn2011(pid.fppLowEn2011),
179 fPbPb(pid.fPbPb),
180 fTOFdecide(pid.fTOFdecide),
181 fOldPid(pid.fOldPid),
182 fPtThresholdTPC(pid.fPtThresholdTPC),
183 fMaxTrackMomForCombinedPID(pid.fMaxTrackMomForCombinedPID),
184 fPidResponse(0x0),
185 fPidCombined(0x0),
186 fTPCResponse(0x0),
187 fCombDetectors(pid.fCombDetectors),
188 fUseCombined(pid.fUseCombined),
189 fDefaultPriors(pid.fDefaultPriors)
190 {
191 
192  fnSigmaCompat=new Double_t[fnNSigmaCompat];
193  for(Int_t i=0;i<fnNSigmaCompat;i++){
194  fnSigmaCompat[i]=pid.fnSigmaCompat[i];
195  }
196  fnSigma = new Double_t[fnNSigma];
197  for(Int_t i=0;i<fnNSigma;i++){
198  fnSigma[i]=pid.fnSigma[i];
199  }
200  fPriors = new Double_t[fnPriors];
201  for(Int_t i=0;i<fnPriors;i++){
202  fPriors[i]=pid.fPriors[i];
203  }
204  fPLimit = new Double_t[fnPLimit];
205  for(Int_t i=0;i<fnPLimit;i++){
206  fPLimit[i]=pid.fPLimit[i];
207  }
208  for(Int_t i=0;i<AliPID::kSPECIES;i++){
209  fPriorsH[i] = pid.fPriorsH[i] ? new TH1F(*pid.fPriorsH[i]) : NULL;
210  }
211  for(Int_t i=0; i<3; i++){ // pi, K, proton
213  fMinnSigmaTPC[i]=pid.fMinnSigmaTPC[i];
214  fMaxnSigmaTPC[i]=pid.fMaxnSigmaTPC[i];
215  fMinnSigmaTOF[i]=pid.fMinnSigmaTOF[i];
216  fMaxnSigmaTOF[i]=pid.fMaxnSigmaTOF[i];
217  }
218 
219  // if(pid.fTPCResponse) fTPCResponse = new AliTPCPIDResponse(*(pid.fTPCResponse));
220  fTPCResponse = new AliTPCPIDResponse();
221  SetBetheBloch();
222  fPidCombined = new AliPIDCombined();
223  //fPidResponse = new AliPIDResponse(*(pid.fPidResponse));
224  //fPidCombined = new AliPIDCombined(*(pid.fPidCombined));
225 
226  //Copy bands
227  for (Int_t s=0;s<AliPID::kSPECIES;s++) {
228  for (Int_t d=0;d<4;d++) {
229  fIdBandMin[s][d] = pid.fIdBandMin[s][d] ? new TF1(*pid.fIdBandMin[s][d]) : NULL;
230  fIdBandMax[s][d] = pid.fIdBandMax[s][d] ? new TF1(*pid.fIdBandMax[s][d]) : NULL;
231  fCompBandMin[s][d] = pid.fCompBandMin[s][d] ? new TF1(*pid.fCompBandMin[s][d]) : NULL;
232  fCompBandMax[s][d] = pid.fCompBandMax[s][d] ? new TF1(*pid.fCompBandMax[s][d]) : NULL;
233  }
234  }
235 
236 }
237 //----------------------
238 Int_t AliAODPidHF::RawSignalPID(AliAODTrack *track, TString detector) const{
240  Int_t specie=-1;
241  if(detector.Contains("ITS")) return ApplyPidITSRaw(track,specie);
242  if(detector.Contains("TPC")) return ApplyPidTPCRaw(track,specie);
243  if(detector.Contains("TOF")) return ApplyPidTOFRaw(track,specie);
244 
245  return specie;
246 
247 }
248 //---------------------------
249 Bool_t AliAODPidHF::IsKaonRaw(AliAODTrack *track, TString detector) const{
251  Int_t specie=0;
252 
253  if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,3);
254  if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,3);
255  if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,3);
256 
257  if(specie==3) return kTRUE;
258  return kFALSE;
259 }
260 //---------------------------
261 Bool_t AliAODPidHF::IsPionRaw (AliAODTrack *track, TString detector) const{
263 
264  Int_t specie=0;
265 
266  if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,2);
267  if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,2);
268  if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,2);
269 
270  if(specie==2) return kTRUE;
271  return kFALSE;
272 }
273 //---------------------------
274 Bool_t AliAODPidHF::IsProtonRaw (AliAODTrack *track, TString detector) const{
276 
277  Int_t specie=0;
278  if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,4);
279  if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,4);
280  if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,4);
281 
282  if(specie==4) return kTRUE;
283 
284  return kFALSE;
285 }
286 //--------------------------
287 Bool_t AliAODPidHF::IsElectronRaw(AliAODTrack *track, TString detector) const{
289 
290  Int_t specie=-1;
291  if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,0);
292  if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,0);
293  if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,0);
294 
295  if(specie==0) return kTRUE;
296 
297  return kFALSE;
298 }
299 //--------------------------
300 Int_t AliAODPidHF::ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const{
302 
303  Double_t nsigma=-999.;
304  Int_t pid=-1;
305 
306  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
307  Double_t nsigmaMin=999.;
308  for(Int_t ipart=0;ipart<5;ipart++){
309  if(GetnSigmaTPC(track,ipart,nsigma)==1){
310  nsigma=TMath::Abs(nsigma);
311  if((nsigma<nsigmaMin) && (nsigma<fnSigma[0])) {
312  pid=ipart;
313  nsigmaMin=nsigma;
314  }
315  }
316  }
317  }else{ // asks only for one particle specie
318  if(GetnSigmaTPC(track,specie,nsigma)==1){
319  nsigma=TMath::Abs(nsigma);
320  if (nsigma>fnSigma[0]) pid=-1;
321  else pid=specie;
322  }
323  }
324 
325  return pid;
326 }
327 //----------------------------
328 Int_t AliAODPidHF::ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const{
330 
331  Double_t nsigma=-999.;
332  Int_t pid=-1;
333 
334  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
335  Double_t nsigmaMin=999.;
336  for(Int_t ipart=0;ipart<5;ipart++){
337  if(GetnSigmaITS(track,ipart,nsigma)==1){
338  nsigma=TMath::Abs(nsigma);
339  if((nsigma<nsigmaMin) && (nsigma<fnSigma[4])) {
340  pid=ipart;
341  nsigmaMin=nsigma;
342  }
343  }
344  }
345  }else{ // asks only for one particle specie
346  if(GetnSigmaITS(track,specie,nsigma)==1){
347  nsigma=TMath::Abs(nsigma);
348  if (nsigma>fnSigma[4]) pid=-1;
349  else pid=specie;
350  }
351  }
352 
353  return pid;
354 }
355 //----------------------------
356 Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{
358 
359  Double_t nsigma=-999.;
360  Int_t pid=-1;
361 
362  if(specie<0){
363  Double_t nsigmaMin=999.;
364  for(Int_t ipart=0;ipart<5;ipart++){
365  if(GetnSigmaTOF(track,ipart,nsigma)==1){
366  nsigma=TMath::Abs(nsigma);
367  if((nsigma<nsigmaMin)&& (nsigma<fnSigma[3])){
368  pid=ipart;
369  nsigmaMin=nsigma;
370  }
371  }
372  }
373  }else{ // asks only for one particle specie
374  Double_t nSigmaMin,nSigmaMax;
375  if(fUseAsymTOF){
376  nSigmaMin=fLownSigmaTOF;
377  nSigmaMax=fUpnSigmaTOF;
378  }else{
379  nSigmaMin=-fnSigma[3];
380  nSigmaMax=fnSigma[3];
381  }
382  if(GetnSigmaTOF(track,specie,nsigma)==1){
383  if(nsigma<nSigmaMin || nsigma>nSigmaMax) pid=-1;
384  else pid=specie;
385  }
386  }
387  return pid;
388 }
389 //----------------------------
390 Int_t AliAODPidHF::ApplyTOFCompatibilityBand(AliAODTrack *track,Int_t specie) const{
392 
393  if(specie<0) return -1;
394  Double_t nsigma=-999.;
395  Int_t pid=-1;
396 
397  Double_t nSigmaMin,nSigmaMax;
398  if(fUseAsymTOF){
399  nSigmaMin=fLownSigmaCompatTOF;
400  nSigmaMax=fUpnSigmaCompatTOF;
401  }else{
402  nSigmaMin=-fnSigmaCompat[1];
403  nSigmaMax=fnSigmaCompat[1];
404  }
405  if(GetnSigmaTOF(track,specie,nsigma)==1){
406  if(nsigma<nSigmaMin || nsigma>nSigmaMax) pid=-1;
407  else pid=specie;
408  }
409  return pid;
410 }
411 //------------------------------
412 void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{
414 
415  const Double_t *pid=track->PID();
416  Float_t max=0.;
417  Int_t k=-1;
418  for (Int_t i=0; i<10; i++) {
419  if (pid[i]>max) {k=i; max=pid[i];}
420  }
421 
422  if(k==2) type[0]=kTRUE;
423  if(k==3) type[1]=kTRUE;
424  if(k==4) type[2]=kTRUE;
425 
426  return;
427 }
428 //--------------------------------
429 Bool_t AliAODPidHF::CheckITSPIDStatus(AliAODTrack *track) const{
431  AliPIDResponse::EDetPidStatus status = fPidResponse->CheckPIDStatus(AliPIDResponse::kITS,track);
432  if (status != AliPIDResponse::kDetPidOk) return kFALSE;
433  return kTRUE;
434 }
435 //--------------------------------
436 Bool_t AliAODPidHF::CheckTPCPIDStatus(AliAODTrack *track) const{
438  AliPIDResponse::EDetPidStatus status = fPidResponse->CheckPIDStatus(AliPIDResponse::kTPC,track);
439  if (status != AliPIDResponse::kDetPidOk) return kFALSE;
440  UInt_t nclsTPCPID = track->GetTPCsignalN();
441  if(nclsTPCPID<fMinNClustersTPCPID) return kFALSE;
442  return kTRUE;
443 }
444 //--------------------------------
445 Bool_t AliAODPidHF::CheckTOFPIDStatus(AliAODTrack *track) const{
447  AliPIDResponse::EDetPidStatus status = fPidResponse->CheckPIDStatus(AliPIDResponse::kTOF,track);
448  if (status != AliPIDResponse::kDetPidOk) return kFALSE;
449  Float_t probMis = fPidResponse->GetTOFMismatchProbability(track);
450  if (probMis > fCutTOFmismatch) return kFALSE;
451  if ((track->GetStatus()&AliESDtrack::kTOFpid )==0 &&
452  track->GetStatus()&AliESDtrack::kITSrefit ) return kFALSE;
453  return kTRUE;
454 }
455 //--------------------------------
456 Bool_t AliAODPidHF::CheckTRDPIDStatus(AliAODTrack *track) const{
458  AliPIDResponse::EDetPidStatus status = fPidResponse->CheckPIDStatus(AliPIDResponse::kTRD,track);
459  if (status != AliPIDResponse::kDetPidOk) return kFALSE;
460  return kTRUE;
461 }
462 //--------------------------------
463 Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{
465  if(detectors.Contains("ITS")) return CheckITSPIDStatus(track);
466  else if(detectors.Contains("TPC")) return CheckTPCPIDStatus(track);
467  else if(detectors.Contains("TOF")) return CheckTOFPIDStatus(track);
468  else if(detectors.Contains("TRD")) return CheckTRDPIDStatus(track);
469  else{
470  AliError("Wrong detector name");
471  return kFALSE;
472  }
473 }
474 //--------------------------------------------
475 Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{
477 
478  AliAODPid *pidObj = track->GetDetPid();
479  Double_t mom = pidObj->GetTPCmomentum();
480  if(mom>fPtThresholdTPC) return kTRUE;
481 
482  Double_t nsigma;
483  if(GetnSigmaTPC(track,specie,nsigma)!=1) return kFALSE;
484  nsigma=TMath::Abs(nsigma);
485 
486 
487  if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE;
488  if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE;
489  if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE;
490 
491  return kFALSE;
492 }
493 //------------------
494 Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track, Int_t specie){
496 
497  Double_t ptrack=track->P();
498  if(ptrack>fMaxTrackMomForCombinedPID) return 1;
499 
500  Bool_t okTPC=CheckTPCPIDStatus(track);
501  if(ptrack>fPtThresholdTPC) okTPC=kFALSE;
502  Bool_t okTOF=CheckTOFPIDStatus(track);
503 
504  if(fMatch==1){
505  //TOF || TPC (a la' Andrea R.)
506  // convention:
507  // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible
508  // the method returns the sum of the response of the 2 detectors
509 
510  if(fTPC && fTOF) {
511  if(!okTPC && !okTOF) return 0;
512  }
513 
514  Int_t tTPCinfo=0;
515  if(fTPC && okTPC){
516  tTPCinfo=-1;
517  if(fAsym) {
518  if(TPCRawAsym(track,specie)) tTPCinfo=1;
519  }else{
520  if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
521  }
522  if(fCompat && tTPCinfo<0){
523  Double_t sig0tmp=fnSigma[0];
524  SetSigma(0,fnSigmaCompat[0]);
525  if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=0;
526  SetSigma(0,sig0tmp);
527  }
528  }
529 
530  Int_t tTOFinfo=0;
531  if(fTOF){
532  if(!okTOF && fTPC) return tTPCinfo;
533  tTOFinfo=-1;
534  if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
535  if(fCompat && tTOFinfo>0){
536  if(ptrack>fPCompatTOF) {
537  if(ApplyTOFCompatibilityBand(track,specie)==specie) tTOFinfo=0;
538  }
539  }
540  }
541 
542 
543  if(tTPCinfo+tTOFinfo==0 && fTOFdecide){
544  if(!okTOF) return tTPCinfo;
545  return tTOFinfo;
546  }
547 
548  if(tTPCinfo+tTOFinfo==0 && fITS){
549  if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
550  Int_t tITSinfo = -1;
551  if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
552  return tITSinfo;
553  }
554  return tTPCinfo+tTOFinfo;
555  }
556 
557  if(fMatch==2){
558  //TPC & TOF (a la' Yifei)
559  // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified
560  Int_t tTPCinfo=0;
561 
562  if(fTPC && okTPC) {
563  tTPCinfo=1;
564  if(fAsym){
565  if(!TPCRawAsym(track,specie)) tTPCinfo=-1;
566  }else{
567  if(ApplyPidTPCRaw(track,specie)!=specie) tTPCinfo=-1;
568  }
569  }
570 
571  Int_t tTOFinfo=1;
572  if(fTOF){
573  if(fTPC && !okTOF) return tTPCinfo;
574  if(ApplyPidTPCRaw(track,specie)!=specie) tTOFinfo=-1;
575  }
576 
577  if(tTOFinfo==1 && tTPCinfo==1) return 1;
578 
579  if(tTPCinfo+tTOFinfo==0 && fITS){
580  if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
581  Int_t tITSinfo = -1;
582  if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
583  return tITSinfo;
584  }
585  return -1;
586  }
587 
588  if(fMatch==3){
589  //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.)
590  // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified
591  if(fTPC && fTOF) if(!okTPC && !okTOF) return 0;
592 
593 
594  Int_t tTPCinfo=-1;
595  if(ptrack>=fPLimit[0] && ptrack<fPLimit[1] && fTPC) {
596  if(!okTPC) return 0;
597  if(fAsym) {
598  if(TPCRawAsym(track,specie)) tTPCinfo=1;
599  }else{
600  if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
601  }
602  return tTPCinfo;
603  }
604 
605  Int_t tTOFinfo=-1;
606  if(ptrack>=fPLimit[1] && fTOF){
607  if(!okTOF) return 0;
608  if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
609  return tTOFinfo;
610  }
611 
612  Int_t tITSinfo=-1;
613  if(ptrack<fPLimit[0] && fITS){
614  if(!CheckITSPIDStatus(track)) return 0;
615  if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
616  return tITSinfo;
617  }
618  }
619 
620  if(fMatch==4 || fMatch==5){
621 
622  // fMatch == 4 ---> "circular cut" in nSigmaTPC, nSimgaTOF plane
623  // ---> nsigmaTPC^2+nsigmaTOF^2 < cut^2
624  // fMatch == 5 ---> "rectangular cut" in nSigmaTPC, nsigmaTOF plane
625  // ---> ns1<nSigmaTPC<NS1 && ns2<nSigmaTOF<NS2
626 
627  Double_t nSigmaTPC=0.;
628  if(okTPC) {
629  nSigmaTPC=fPidResponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)specie);
630  if(nSigmaTPC<-990.) nSigmaTPC=0.;
631  }
632  Double_t nSigmaTOF=0.;
633  if(okTOF) {
634  nSigmaTOF=fPidResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)specie);
635  }
636  Int_t iPart=specie-2; //species is 2 for pions,3 for kaons and 4 for protons
637  if(iPart<0 || iPart>2) return -1;
638  if(fMatch==4){
639  Double_t nSigma2=nSigmaTPC*nSigmaTPC+nSigmaTOF*nSigmaTOF;
640  if(nSigma2<fMaxnSigmaCombined[iPart]*fMaxnSigmaCombined[iPart]) return 1;
641  else return -1;
642  }
643  else if(fMatch==5){
644  if(fForceTOFforKaons && iPart==1 && !okTOF) return -1;
645  if((nSigmaTPC>fMinnSigmaTPC[iPart] && nSigmaTPC<fMaxnSigmaTPC[iPart]) &&
646  (nSigmaTOF>fMinnSigmaTOF[iPart] && nSigmaTOF<fMaxnSigmaTOF[iPart])) return 1;
647  else return -1;
648  }
649  }
650 
651  //Asymmetric cuts using user defined bands
652  if (fMatch == 10) {
653  if (fTPC && fTOF && !okTPC && !okTOF) {
654  return 0;
655  }
656 
657  Int_t tTPCinfo = 0;
658  if (fTPC && okTPC) {
659  tTPCinfo = CheckBands((AliPID::EParticleType) specie, AliPIDResponse::kTPC, track);
660  }
661 
662  Int_t tTOFinfo = 0;
663  if (fTOF) {
664  if (!okTOF && fTPC) {
665  return tTPCinfo;
666  }
667  tTOFinfo = CheckBands((AliPID::EParticleType) specie, AliPIDResponse::kTOF, track);
668  }
669 
670 
671  if (tTPCinfo+tTOFinfo == 0 && fTOFdecide) {
672  if (!okTOF) {
673  return tTPCinfo;
674  }
675  return tTOFinfo;
676  }
677 
678  if (tTPCinfo+tTOFinfo == 0 && fITS) {
679  if (!CheckITSPIDStatus(track)) {
680  return tTPCinfo+tTOFinfo;
681  }
682  Int_t tITSinfo = CheckBands((AliPID::EParticleType) specie, AliPIDResponse::kITS, track);
683  return tITSinfo;
684  }
685  return tTPCinfo+tTOFinfo;
686  }
687 
688  return -1;
689 
690 }
691 
692 //--------------------------------------------------------------
693 Int_t AliAODPidHF::MatchTPCTOFMin(AliAODTrack *track, Int_t specie){
695 
696  Bool_t okTPC=CheckTPCPIDStatus(track);
697  Bool_t okTOF=CheckTOFPIDStatus(track);
698 
699  if(fTPC && fTOF){
700  if(!okTPC && !okTOF) return 0;
701  }
702 
703  Int_t pid=-1;
704  Double_t nsigmaTPC[5]={999.,999.,999.,999.,999.};
705  Double_t nsigmaTOF[5]={999.,999.,999.,999.,999.};
706  Double_t nsigmaMin=999.;
707  Double_t nsigma[5]={999.,999.,999.,999.,999.};
708 
709  if(okTPC) {
710  for(Int_t ipart=0;ipart<5;ipart++){
711  if(GetnSigmaTPC(track,ipart,nsigmaTPC[ipart])<1) nsigmaTPC[ipart]=0.;
712  }
713  }else{
714  for(Int_t ipart=0;ipart<5;ipart++){nsigmaTPC[ipart]=0.;}
715  }
716 
717  if(okTOF){
718  for(Int_t ipart=0;ipart<5;ipart++){
719  if(GetnSigmaTOF(track,ipart,nsigmaTOF[ipart])<1) nsigmaTOF[ipart]=0.;
720  }
721  }else{
722  for(Int_t ipart=0;ipart<5;ipart++){nsigmaTOF[ipart]=0.;}
723  }
724 
725  for(Int_t ipart=0;ipart<5;ipart++){
726  nsigma[ipart]=TMath::Sqrt(nsigmaTPC[ipart]*nsigmaTPC[ipart]+nsigmaTOF[ipart]*nsigmaTOF[ipart]);
727  if(nsigma[ipart]<nsigmaMin) {nsigmaMin=nsigma[ipart];pid=ipart;}
728  }
729 
730  if(pid==specie) return 1;
731 
732  return 0;
733 }
734 
735 
736 //----------------------------------
737 Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){
739  if(fMatch>0){
740  return MatchTPCTOF(track,specie);
741  }else{
742  if(fTPC && !fTOF && !fITS) {
743  Int_t tTPCres=0;
744  if(!fAsym){
745  tTPCres=ApplyPidTPCRaw(track,specie);
746  if(tTPCres==specie) return 1;
747  else return tTPCres;
748  }else{
749  if(TPCRawAsym(track,specie)) tTPCres=1;
750  else tTPCres=-1;
751  }
752  return tTPCres;
753  }else if(fTOF && !fTPC && !fITS) {
754  Int_t tTOFres=ApplyPidTOFRaw(track,specie);
755  if(tTOFres==specie) return 1;
756  else return tTOFres;
757  }else if(fITS && !fTPC && !fTOF) {
758  Int_t tITSres=ApplyPidITSRaw(track,specie);
759  if(tITSres==specie) return 1;
760  else return tITSres;
761  }else{
762  AliError("You should enable just one detector if you don't want to match");
763  return 0;
764  }
765  }
766 }
767 //--------------------------------------------
768 void AliAODPidHF::GetTPCBetheBlochParams(Double_t alephParameters[5]) const {
770  if(fMC) { // MC
771 
772  if(fPbPb) { // PbPb MC
773 
774  alephParameters[0] = 1.44405/50.;
775  alephParameters[1] = 2.35409e+01;
776  alephParameters[2] = TMath::Exp(-2.90330e+01);
777  alephParameters[3] = 2.10681e+00;
778  alephParameters[4] = 4.62254e+00;
779 
780  } else { // pp MC
781  if(fMCLowEn2011){
782  alephParameters[0]=0.0207667;
783  alephParameters[1]=29.9936;
784  alephParameters[2]=3.87866e-11;
785  alephParameters[3]=2.17291;
786  alephParameters[4]=7.1623;
787  }else if(fOnePad){
788  alephParameters[0]=0.029021;
789  alephParameters[1]=25.4181;
790  alephParameters[2]=4.66596e-08;
791  alephParameters[3]=1.90008;
792  alephParameters[4]=4.63783;
793  }else{
794  alephParameters[0] = 2.15898/50.;
795  alephParameters[1] = 1.75295e+01;
796  alephParameters[2] = 3.40030e-09;
797  alephParameters[3] = 1.96178e+00;
798  alephParameters[4] = 3.91720e+00;
799  }
800  }
801 
802  } else { // Real Data
803 
804  if(fOnePad) { // pp 1-pad (since LHC10d)
805 
806  alephParameters[0] =1.34490e+00/50.;
807  alephParameters[1] = 2.69455e+01;
808  alephParameters[2] = TMath::Exp(-2.97552e+01);
809  alephParameters[3] = 2.35339e+00;
810  alephParameters[4] = 5.98079e+00;
811 
812  } else if(fPbPb) { // PbPb
813 
814  // alephParameters[0] = 1.25202/50.;
815  // alephParameters[1] = 2.74992e+01;
816  // alephParameters[2] = TMath::Exp(-3.31517e+01);
817  // alephParameters[3] = 2.46246;
818  // alephParameters[4] = 6.78938;
819 
820  alephParameters[0] = 5.10207e+00/50.;
821  alephParameters[1] = 7.94982e+00;
822  alephParameters[2] = TMath::Exp(-9.07942e+00);
823  alephParameters[3] = 2.38808e+00;
824  alephParameters[4] = 1.68165e+00;
825 
826  } else if(fppLowEn2011){ // pp low energy
827 
828  alephParameters[0]=0.031642;
829  alephParameters[1]=22.353;
830  alephParameters[2]=4.16239e-12;
831  alephParameters[3]=2.61952;
832  alephParameters[4]=5.76086;
833 
834  } else { // pp no 1-pad (LHC10bc)
835 
836  alephParameters[0] = 0.0283086/0.97;
837  alephParameters[1] = 2.63394e+01;
838  alephParameters[2] = 5.04114e-11;
839  alephParameters[3] = 2.12543e+00;
840  alephParameters[4] = 4.88663e+00;
841 
842  }
843 
844  }
845 
846 }
847 
848 //-----------------------
851 
852  Double_t alephParameters[5];
853  GetTPCBetheBlochParams(alephParameters);
854  fTPCResponse->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
855 
856  return;
857 }
858 
859 
860 //--------------------------------------------------------------------------
861 Int_t AliAODPidHF::GetnSigmaITS(AliAODTrack *track,Int_t species, Double_t &nsigma) const{
863 
864 
865  if (!CheckITSPIDStatus(track)) return -1;
866 
867  Double_t nsigmaITS=-999;
868 
869  if (fOldPid) {
870  Double_t mom=track->P();
871  AliAODPid *pidObj = track->GetDetPid();
872  Double_t dedx=pidObj->GetITSsignal();
873 
874  AliITSPIDResponse itsResponse;
875  AliPID::EParticleType type=AliPID::EParticleType(species);
876  nsigmaITS = itsResponse.GetNumberOfSigmas(mom,dedx,type);
877 
878  } // old pid
879  else { // new pid
880 
881  AliPID::EParticleType type=AliPID::EParticleType(species);
882  nsigmaITS = fPidResponse->NumberOfSigmasITS(track,type);
883 
884  } //new pid
885 
886  nsigma = nsigmaITS;
887 
888  return 1;
889 
890 }
891 //--------------------------------------------------------------------------
892 Int_t AliAODPidHF::GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &nsigma) const{
894 
895  if(!CheckTPCPIDStatus(track)) return -1;
896 
897  Double_t nsigmaTPC=-999;
898 
899  if(fOldPid){
900  AliAODPid *pidObj = track->GetDetPid();
901  Double_t dedx=pidObj->GetTPCsignal();
902  Double_t mom = pidObj->GetTPCmomentum();
903  if(mom>fPtThresholdTPC) return -2;
904  UShort_t nTPCClus=pidObj->GetTPCsignalN();
905  if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
906  AliPID::EParticleType type=AliPID::EParticleType(species);
907  nsigmaTPC = fTPCResponse->GetNumberOfSigmas(mom,dedx,nTPCClus,type);
908  nsigma=nsigmaTPC;
909  } else{
910  if(!fPidResponse) return -1;
911  AliPID::EParticleType type=AliPID::EParticleType(species);
912  nsigmaTPC = fPidResponse->NumberOfSigmasTPC(track,type);
913  nsigma=nsigmaTPC;
914  }
915  return 1;
916 }
917 
918 //-----------------------------
919 
920 Int_t AliAODPidHF::GetnSigmaTOF(AliAODTrack *track,Int_t species, Double_t &nsigma) const{
922 
923  if(!CheckTOFPIDStatus(track)) return -1;
924 
925  if(fPidResponse){
926  nsigma = fPidResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)species);
927  return 1;
928  }else{
929  AliFatal("To use TOF PID you need to attach AliPIDResponseTask");
930  nsigma=-999.;
931  return -1;
932  }
933 }
934 
935 //-----------------------
936 Bool_t AliAODPidHF::IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detectors) {
938 
939  if (detectors.Contains("ITS")) {
940 
941  AliInfo("Nothing to be done");
942  /*
943  Double_t nsigma=0.;
944  if (GetnSigmaITS(track,labelTrack,nsigma)==1){
945  if(nsigma>nsigmaCut) return kTRUE;
946  }
947  */
948  return kFALSE;
949 
950  } else if (detectors.Contains("TPC")) {
951 
952  Double_t nsigma=0.;
953  if (GetnSigmaTPC(track,labelTrack,nsigma)==1){
954  if(nsigma>nsigmaCut) return kTRUE;
955  }
956  return kFALSE;
957 
958  } else if (detectors.Contains("TOF")) {
959 
960  Double_t nsigma=0.;
961  if (GetnSigmaTOF(track,labelTrack,nsigma)==1){
962  if(nsigma>nsigmaCut) return kTRUE;
963  }
964  return kFALSE;
965 
966  }
967  return kFALSE;
968 
969 }
970 //-----------------------
971 Bool_t AliAODPidHF::IsTOFPiKexcluded(AliAODTrack *track,Double_t nsigmaK){
973 
974  if(!CheckTOFPIDStatus(track)) return 0;
975 
976  Double_t nsigma;
977  if(GetnSigmaTOF(track,3,nsigma)==1){
978  if(nsigma>nsigmaK) return kTRUE;
979  }
980  return kFALSE;
981  /* Double_t time[AliPID::kSPECIESN];
982  Double_t sigmaTOFPid[AliPID::kSPECIES];
983  AliAODPid *pidObj = track->GetDetPid();
984  pidObj->GetIntegratedTimes(time);
985  Double_t sigTOF=pidObj->GetTOFsignal();
986 
987  AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
988  if (event) {
989  AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
990  if (tofH && fPidResponse) {
991  AliTOFPIDResponse TOFres = (AliTOFPIDResponse)fPidResponse->GetTOFResponse();
992  sigTOF -= TOFres.GetStartTime(track->P());
993  sigmaTOFPid[3]=TOFres.GetExpectedSigma(track->P(),time[3],AliPID::ParticleMass(3));
994  }
995  else pidObj->GetTOFpidResolution(sigmaTOFPid);
996  } else pidObj->GetTOFpidResolution(sigmaTOFPid);
997  Double_t sigmaTOFtrack;
998  if (sigmaTOFPid[3]>0) sigmaTOFtrack=sigmaTOFPid[3];
999  else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
1000 
1001  if((sigTOF-time[3])>nsigmaK*sigmaTOFtrack)return kTRUE;// K, Pi excluded (->LIKELY A PROTON)
1002 
1003  return kFALSE;
1004  */
1005 }
1006 
1007 //--------------------------------------------------------------------------
1008 void AliAODPidHF::SetPriorDistribution(AliPID::EParticleType type,TH1F *prior){
1009 
1014 
1015  GetPidCombined()->SetPriorDistribution(type,prior);
1016 }
1017 //--------------------------------------------------------------------------
1018 void AliAODPidHF::DrawPrior(AliPID::EParticleType type){
1019 
1022 
1023  new TCanvas();
1024  GetPidCombined()->GetPriorDistribution(type)->Draw();
1025 }
1026 
1027 //-----------------------------
1028 void AliAODPidHF::SetPriors(Double_t *priors, Int_t npriors){
1030  if (fnPriors != npriors) {
1031  if (fPriors) delete fPriors;
1032  fPriors = new Double_t[npriors];
1033  fnPriors = npriors;
1034  }
1035  for(Int_t i = 0; i < fnPriors; i++) fPriors[i] = priors[i];
1036 }
1037 
1038 //-----------------------------
1039 void AliAODPidHF::SetPLimit(Double_t *plim, Int_t npLim) {
1041  if (fnPLimit != npLim) {
1042  if (fPLimit) delete fPLimit;
1043  fPLimit = new Double_t[npLim];
1044  fnPLimit = npLim;
1045  }
1046  for(Int_t i = 0; i < fnPLimit; i++) fPLimit[i] = plim[i];
1047 }
1048 //-----------------------------
1049 void AliAODPidHF::SetPriorsHistos(TString priorFileName){
1051 
1052  for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
1053  if(fPriorsH[ispecies]) delete fPriorsH[ispecies];
1054  TString nt ="name";
1055  nt+="_prior_";
1056  nt+=AliPID::ParticleName(ispecies);
1057  }
1058  TDirectory *current = gDirectory;
1059  TFile *priorFile=TFile::Open(priorFileName);
1060  if (priorFile) {
1061  TH1F* h3=static_cast<TH1F*>(priorFile->Get("priors3step9"));
1062  TH1F* h2=static_cast<TH1F*>(priorFile->Get("priors2step9"));
1063  TH1F* h1=static_cast<TH1F*>(priorFile->Get("priors1step9"));
1064  current->cd();
1065  fPriorsH[AliPID::kProton] = new TH1F(*h3);
1066  fPriorsH[AliPID::kKaon ] = new TH1F(*h2);
1067  fPriorsH[AliPID::kPion ] = new TH1F(*h1);
1068  priorFile->Close();
1069  delete priorFile;
1070  TF1 *salt=new TF1("salt","1.e-10",0,10);
1071  fPriorsH[AliPID::kProton]->Add(salt);
1072  fPriorsH[AliPID::kKaon ]->Add(salt);
1073  fPriorsH[AliPID::kPion ]->Add(salt);
1074  delete salt;
1075  }
1076 }
1077 //----------------------------------
1080 
1081  fPidCombined->SetSelectedSpecies(AliPID::kSPECIES);
1082  if(!fDefaultPriors){
1083  for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
1084  fPidCombined->SetPriorDistribution(static_cast<AliPID::EParticleType>(ispecies),fPriorsH[ispecies]);
1085  }
1086  }else{
1087  fPidCombined->SetDefaultTPCPriors();
1088  }
1089  switch (fCombDetectors){
1090  case kTPCTOF:
1091  fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
1092  break;
1093  case kTPCITS:
1094  fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetITS);
1095  break;
1096  case kTPC:
1097  fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC);
1098  break;
1099  case kTOF:
1100  fPidCombined->SetDetectorMask(AliPIDResponse::kDetTOF);
1101  break;
1102  }
1103 }
1104 
1105 
1106 //-----------------------------
1109  printf("Detectors used for PID: ");
1110  if(fITS) printf("ITS ");
1111  if(fTPC) printf("TPC ");
1112  if(fTRD) printf("TRD ");
1113  if(fTOF) printf("TOF ");
1114  printf("\n");
1115  printf("Minimum TPC PID clusters = %d\n",fMinNClustersTPCPID);
1116  printf("Maximum momentum for using TPC PID = %f\n",fPtThresholdTPC);
1117  printf("TOF Mismatch probablility cut = %f\n",fCutTOFmismatch);
1118  printf("Maximum momentum for combined PID TPC PID = %f\n",fMaxTrackMomForCombinedPID);
1119  if(fOldPid){
1120  printf("Use OLD PID");
1121  printf(" fMC = %d\n",fMC);
1122  printf(" fPbPb = %d\n",fPbPb);
1123  printf(" fOnePad = %d\n",fOnePad);
1124  printf(" fMCLowEn2011 = %d\n",fMCLowEn2011);
1125  printf(" fppLowEn2011 = %d\n",fppLowEn2011);
1126  }
1127  printf("--- Matching algorithm = %d ---\n",fMatch);
1128  if(fMatch==1){
1129  if(fITS) printf("nSigmaITS = %.2f\n",fnSigma[4]);
1130  if(fTOF){
1131  printf("nSigmaTOF = %.2f\n",fnSigma[3]);
1132  if(fCompat) printf("Compatibility band at nSigmaTOF=%.2f for p>%.2f\n",fnSigmaCompat[1],fPCompatTOF);
1133  }
1134  if(fTPC){
1135  if(fAsym){
1136  printf("nSigmaTPC:\n");
1137  printf(" pt<%.2f \t nsigmaTPC= %.2f\n",fPLimit[0],fnSigma[0]);
1138  printf(" %.2f<pt<%.2f \t nsigmaTPC= %.2f\n",fPLimit[0],fPLimit[1],fnSigma[1]);
1139  printf(" pt>%.2f \t nsigmaTPC= %.2f\n",fPLimit[1],fnSigma[2]);
1140  }else{
1141  printf("nSigmaTPC = %.2f\n",fnSigma[0]);
1142  }
1143  if(fCompat) printf("Compatibility band at nSigmaTPC=%.2f\n",fnSigmaCompat[0]);
1144  }
1145  }else if(fMatch==4){
1146  printf("Cuts on sqrt(nSigmaTPC^2+nSigmaTOF^2):\n");
1147  printf(" Pions: nSigma = %.2f\n",fMaxnSigmaCombined[0]);
1148  printf(" Kaons: nSigma = %.2f\n",fMaxnSigmaCombined[1]);
1149  printf(" Protons: nSigma = %.2f\n",fMaxnSigmaCombined[2]);
1150  }else if(fMatch==5){
1151  printf("nSigma ranges:\n");
1152  printf(" Pions: %.2f<nSigmaTPC<%.2f %.2f<nSigmaTOF<%.2f\n",
1154  printf(" Kaons: %.2f<nSigmaTPC<%.2f %.2f<nSigmaTOF<%.2f\n",
1156  printf(" Protons: %.2f<nSigmaTPC<%.2f %.2f<nSigmaTOF<%.2f\n",
1158  } else if (fMatch == 10) {
1159  printf("Asymmetric PID using identification/compatibility bands as a function of track momentum p\n");
1160  printf("The following bands are set:\n");
1161  TString species[] = {"electron", "muon", "pion", "kaon", "proton"};
1162  TString detectors[] = {"ITS", "TPC", "TRD", "TOF"};
1163  for (Int_t s=0;s<AliPID::kSPECIES;s++) {
1164  for (Int_t d=0;d<4;d++) {
1165  if (fIdBandMin[s][d] && fIdBandMax[s][d]) {
1166  printf(" Identification band %s %s\n", species[s].Data(), detectors[d].Data());
1167  }
1168  if (fCompBandMin[s][d] && fCompBandMax[s][d]) {
1169  printf(" Compatibility band %s %s\n", species[s].Data(), detectors[d].Data());
1170  }
1171  }
1172  }
1173  }
1174 }
1175 
1176 //------------------
1177 void AliAODPidHF::SetIdBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TH1F *min, TH1F *max) {
1178  Int_t spe = (Int_t) specie;
1179  Int_t det = (Int_t) detector;
1180 
1181  if (spe >= AliPID::kSPECIES || det > 3 || !min || !max) {
1182  AliError("Identification band not set");
1183  return;
1184  }
1185 
1186  TAxis *axis;
1187  HistFunc *histFunc;
1188 
1189  axis = min->GetXaxis();
1190  histFunc = new HistFunc(min);
1191  TF1 *minFunc = new TF1(Form("IdMin_%d_%d", spe, det), histFunc, axis->GetBinLowEdge(axis->GetFirst()), axis->GetBinUpEdge(axis->GetLast()), 0, "HistFunc");
1192 
1193  axis = max->GetXaxis();
1194  histFunc = new HistFunc(max);
1195  TF1 *maxFunc = new TF1(Form("IdMax_%d_%d", spe, det), histFunc, axis->GetBinLowEdge(axis->GetFirst()), axis->GetBinUpEdge(axis->GetLast()), 0, "HistFunc");
1196 
1197  SetIdBand(specie, detector, minFunc, maxFunc);
1198 }
1199 
1200 //------------------
1201 void AliAODPidHF::SetIdBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TF1 *min, TF1 *max) {
1202  Int_t spe = (Int_t) specie;
1203  Int_t det = (Int_t) detector;
1204 
1205  if (spe >= AliPID::kSPECIES || det > 3 || !min || !max) {
1206  AliError("Identification band not set");
1207  return;
1208  }
1209 
1210  if (fIdBandMin[spe][det]) {
1211  delete fIdBandMin[spe][det];
1212  }
1213  fIdBandMin[spe][det] = new TF1(*min);
1214 
1215  if (fIdBandMax[spe][det]) {
1216  delete fIdBandMax[spe][det];
1217  }
1218  fIdBandMax[spe][det] = new TF1(*max);
1219 }
1220 
1221 //------------------
1222 void AliAODPidHF::SetCompBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TH1F *min, TH1F *max) {
1223  Int_t spe = (Int_t) specie;
1224  Int_t det = (Int_t) detector;
1225 
1226  if (spe >= AliPID::kSPECIES || det > 3 || !min || !max) {
1227  AliError("Compatibility band not set");
1228  return;
1229  }
1230 
1231  TAxis *axis;
1232  HistFunc *histFunc;
1233 
1234  axis = min->GetXaxis();
1235  histFunc = new HistFunc(min);
1236  TF1 *minFunc = new TF1(Form("CompMin_%d_%d", spe, det), histFunc, axis->GetBinLowEdge(axis->GetFirst()), axis->GetBinUpEdge(axis->GetLast()), 0, "HistFunc");
1237 
1238  axis = max->GetXaxis();
1239  histFunc = new HistFunc(max);
1240  TF1 *maxFunc = new TF1(Form("CompMax_%d_%d", spe, det), histFunc, axis->GetBinLowEdge(axis->GetFirst()), axis->GetBinUpEdge(axis->GetLast()), 0, "HistFunc");
1241 
1242  SetCompBand(specie, detector, minFunc, maxFunc);
1243 }
1244 
1245 //------------------
1246 void AliAODPidHF::SetCompBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TF1 *min, TF1 *max) {
1247  Int_t spe = (Int_t) specie;
1248  Int_t det = (Int_t) detector;
1249 
1250  if (spe >= AliPID::kSPECIES || det > 3 || !min || !max) {
1251  AliError("Compatibility band not set");
1252  return;
1253  }
1254 
1255  if (fCompBandMin[spe][det]) {
1256  delete fCompBandMin[spe][det];
1257  }
1258  fCompBandMin[spe][det] = new TF1(*min);
1259 
1260  if (fCompBandMax[spe][det]) {
1261  delete fCompBandMax[spe][det];
1262  }
1263  fCompBandMax[spe][det] = new TF1(*max);
1264 }
1265 
1266 //------------------
1267 Bool_t AliAODPidHF::CheckDetectorPIDStatus(AliPIDResponse::EDetector detector, AliAODTrack* track) {
1268  switch (detector) {
1269  case AliPIDResponse::kITS:
1270  return CheckITSPIDStatus(track);
1271  break;
1272  case AliPIDResponse::kTPC:
1273  return CheckTPCPIDStatus(track);
1274  break;
1275  case AliPIDResponse::kTRD:
1276  return CheckTRDPIDStatus(track);
1277  break;
1278  case AliPIDResponse::kTOF:
1279  return CheckTOFPIDStatus(track);
1280  break;
1281  default:
1282  return kFALSE;
1283  break;
1284  }
1285 }
1286 
1287 //------------------
1288 Float_t AliAODPidHF::NumberOfSigmas(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, AliAODTrack *track) {
1289  switch (detector) {
1290  case AliPIDResponse::kITS:
1291  return fPidResponse->NumberOfSigmasITS(track, specie);
1292  break;
1293  case AliPIDResponse::kTPC:
1294  return fPidResponse->NumberOfSigmasTPC(track, specie);
1295  break;
1296  case AliPIDResponse::kTOF:
1297  return fPidResponse->NumberOfSigmasTOF(track, specie);
1298  break;
1299  default:
1300  return -999.;
1301  break;
1302  }
1303 }
1304 
1305 //------------------
1306 Int_t AliAODPidHF::CheckBands(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, AliAODTrack *track) {
1308 
1309  Int_t spe = (Int_t) specie;
1310  Int_t det = (Int_t) detector;
1311 
1312  if (!fPidResponse || spe >= AliPID::kSPECIES) {
1313  return -1;
1314  }
1315 
1316  if (!CheckDetectorPIDStatus(detector, track)) {
1317  return 0;
1318  }
1319 
1320  Double_t P = track->P();
1321 
1322  Float_t nSigma = NumberOfSigmas(specie, detector, track);
1323  Float_t minContent, maxContent;
1324  Bool_t hasAnyBand = kFALSE;
1325 
1326  //Check if within identification band, return 1
1327  TF1 *IdBandMin = fIdBandMin[spe][det];
1328  TF1 *IdBandMax = fIdBandMax[spe][det];
1329 
1330  if (IdBandMin && IdBandMax) {
1331  minContent = IdBandMin->IsInside(&P) ? IdBandMin->Eval(P) : 0;
1332  maxContent = IdBandMax->IsInside(&P) ? IdBandMax->Eval(P) : 0;
1333  if (minContent != 0 || maxContent != 0) {
1334  //At least one identification band is set at this momentum
1335  hasAnyBand = kTRUE;
1336  if ((minContent == 0 || nSigma >= minContent) && (maxContent == 0 || nSigma <= maxContent)) {
1337  return 1;
1338  }
1339  }
1340  }
1341 
1342  //Check if within compatibility band, return 0
1343  TF1 *CompBandMin = fCompBandMin[spe][det];
1344  TF1 *CompBandMax = fCompBandMax[spe][det];
1345 
1346  if (CompBandMin && CompBandMax) {
1347  minContent = CompBandMin->IsInside(&P) ? CompBandMin->Eval(P) : 0;
1348  maxContent = CompBandMax->IsInside(&P) ? CompBandMax->Eval(P) : 0;
1349  if (minContent != 0 || maxContent != 0) {
1350  //At least one compatibility band is set at this momentum
1351  hasAnyBand = kTRUE;
1352  if ((minContent == 0 || nSigma >= minContent) && (maxContent == 0 || nSigma <= maxContent)) {
1353  return 0;
1354  }
1355  }
1356  }
1357 
1358  if (!hasAnyBand) {
1359  //No bands
1360  return 0;
1361  }
1362 
1363  //Bands were set and checked, but no match
1364  return -1;
1365 }
1366 
1367 //------------------
1369  SetMatch(10);
1370  SetTPC(kTRUE);
1371  SetTOF(kTRUE);
1372 
1373  //TPC K: shift by -0.2
1374  TF1 *TPCCompBandMinK = new TF1("TPCCompBandMinK", "[0]", 0, 24); TPCCompBandMinK->SetParameter(0, -3.2);
1375  TF1 *TPCCompBandMaxK = new TF1("TPCCompBandMaxK", "[0]", 0, 24); TPCCompBandMaxK->SetParameter(0, 2.8);
1376  SetCompBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCCompBandMinK, TPCCompBandMaxK);
1377 
1378  TF1 *TPCIdBandMinK = new TF1("TPCIdBandMinK", "[0]", 0, 24); TPCIdBandMinK->SetParameter(0, -2.2);
1379  TF1 *TPCIdBandMaxK = new TF1("TPCIdBandMaxK", "[0]", 0, 24); TPCIdBandMaxK->SetParameter(0, 1.8);
1380  SetIdBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCIdBandMinK, TPCIdBandMaxK);
1381 
1382  //TPC pi: shift by -0.14
1383  TF1 *TPCCompBandMinPi = new TF1("TPCCompBandMinPi", "[0]", 0, 24); TPCCompBandMinPi->SetParameter(0, -3.14);
1384  TF1 *TPCCompBandMaxPi = new TF1("TPCCompBandMaxPi", "[0]", 0, 24); TPCCompBandMaxPi->SetParameter(0, 2.86);
1385  SetCompBand(AliPID::kPion, AliPIDResponse::kTPC, TPCCompBandMinPi, TPCCompBandMaxPi);
1386 
1387  TF1 *TPCIdBandMinPi = new TF1("TPCIdBandMinPi", "[0]", 0, 24); TPCIdBandMinPi->SetParameter(0, -2.14);
1388  TF1 *TPCIdBandMaxPi = new TF1("TPCIdBandMaxPi", "[0]", 0, 24); TPCIdBandMaxPi->SetParameter(0, 1.86);
1389  SetIdBand(AliPID::kPion, AliPIDResponse::kTPC, TPCIdBandMinPi, TPCIdBandMaxPi);
1390 
1391  //TOF K: shift by -0.1
1392  TF1 *TOFCompBandMinK = new TF1("TOFCompBandMinK", "[0]", 2, 24); TOFCompBandMinK->SetParameter(0, -3.1);
1393  TF1 *TOFCompBandMaxK = new TF1("TOFCompBandMaxK", "[0]", 2, 24); TOFCompBandMaxK->SetParameter(0, 2.9);
1394  SetCompBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFCompBandMinK, TOFCompBandMaxK);
1395 
1396  TF1 *TOFIdBandMinK = new TF1("TOFIdBandMinK", "[0]", 0, 2); TOFIdBandMinK->SetParameter(0, -3.1);
1397  TF1 *TOFIdBandMaxK = new TF1("TOFIdBandMaxK", "[0]", 0, 2); TOFIdBandMaxK->SetParameter(0, 2.9);
1398  SetIdBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFIdBandMinK, TOFIdBandMaxK);
1399 
1400  //TOF pi: shift by -0.15
1401  TF1 *TOFCompBandMinPi = new TF1("TOFCompBandMinPi", "[0]", 2, 24); TOFCompBandMinPi->SetParameter(0, -3.15);
1402  TF1 *TOFCompBandMaxPi = new TF1("TOFCompBandMaxPi", "[0]", 2, 24); TOFCompBandMaxPi->SetParameter(0, 2.85);
1403  SetCompBand(AliPID::kPion, AliPIDResponse::kTOF, TOFCompBandMinPi, TOFCompBandMaxPi);
1404 
1405  TF1 *TOFIdBandMinPi = new TF1("TOFIdBandMinPi", "[0]", 0, 2); TOFIdBandMinPi->SetParameter(0, -3.15);
1406  TF1 *TOFIdBandMaxPi = new TF1("TOFIdBandMaxPi", "[0]", 0, 2); TOFIdBandMaxPi->SetParameter(0, 2.85);
1407  SetIdBand(AliPID::kPion, AliPIDResponse::kTOF, TOFIdBandMinPi, TOFIdBandMaxPi);
1408 }
1409 
1410 //------------------
1413 
1414  SetMatch(10);
1415  SetTPC(kTRUE);
1416  SetTOF(kTRUE);
1417 
1418  //TPC K
1419  Double_t TPCIdBandMinKBins[] = {0, 0.4, 0.5, 0.6, 0.9, 24};
1420  TH1F *TPCIdBandMinK = new TH1F("TPCIdBandMinK", "TPC Id Band Min K", 5, TPCIdBandMinKBins);
1421  TPCIdBandMinK->SetBinContent(1, -3); //0 - 0.4
1422  TPCIdBandMinK->SetBinContent(2, -2); //0.4 - 0.5
1423  TPCIdBandMinK->SetBinContent(3, -3); //0.5 - 0.6
1424  TPCIdBandMinK->SetBinContent(4, -2); //0.6 - 0.9
1425  TPCIdBandMinK->SetBinContent(5, -3); //0.9 - 24
1426 
1427  Double_t TPCIdBandMaxKBins[] = {0, 0.6, 0.7, 24};
1428  TH1F *TPCIdBandMaxK = new TH1F("TPCIdBandMaxK", "TPC Id Band Max K", 3, TPCIdBandMaxKBins);
1429  TPCIdBandMaxK->SetBinContent(1, 3); //0 - 0.6
1430  TPCIdBandMaxK->SetBinContent(2, 2); //0.6 - 0.7
1431  TPCIdBandMaxK->SetBinContent(3, 3); //0.7 - 24
1432 
1433  SetIdBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCIdBandMinK, TPCIdBandMaxK);
1434  GetIdBandMin(AliPID::kKaon, AliPIDResponse::kTPC)->SetNpx(5000);
1435  GetIdBandMax(AliPID::kKaon, AliPIDResponse::kTPC)->SetNpx(5000);
1436 
1437  //TPC pi
1438  Double_t TPCIdBandMinpiBins[] = {0, 24};
1439  TH1F *TPCIdBandMinpi = new TH1F("TPCIdBandMinpi", "TPC Id Band Min pi", 1, TPCIdBandMinpiBins);
1440  TPCIdBandMinpi->SetBinContent(1, -3); //0 - 24
1441 
1442  Double_t TPCIdBandMaxpiBins[] = {0, 0.7, 0.9, 1.3, 1.4, 24};
1443  TH1F *TPCIdBandMaxpi = new TH1F("TPCIdBandMaxpi", "TPC Id Band Max pi", 5, TPCIdBandMaxpiBins);
1444  TPCIdBandMaxpi->SetBinContent(1, 3); //0 - 0.7
1445  TPCIdBandMaxpi->SetBinContent(2, 2); //0.7 - 0.9
1446  TPCIdBandMaxpi->SetBinContent(3, 3); //0.9 - 1.3
1447  TPCIdBandMaxpi->SetBinContent(4, 2); //1.3 - 1.4
1448  TPCIdBandMaxpi->SetBinContent(5, 3); //1.4 - 24
1449 
1450  SetIdBand(AliPID::kPion, AliPIDResponse::kTPC, TPCIdBandMinpi, TPCIdBandMaxpi);
1451  GetIdBandMin(AliPID::kPion, AliPIDResponse::kTPC)->SetNpx(5000);
1452  GetIdBandMax(AliPID::kPion, AliPIDResponse::kTPC)->SetNpx(5000);
1453 
1454  //TOF K
1455  TF1 *TOFIdBandMinK = new TF1("TOFIdBandMinK", "[0]", 0, 24); TOFIdBandMinK->SetParameter(0, -3);
1456  TF1 *TOFIdBandMaxK = new TF1("TOFIdBandMaxK", "[0]", 0, 24); TOFIdBandMaxK->SetParameter(0, 3);
1457 
1458  SetIdBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFIdBandMinK, TOFIdBandMaxK);
1459 
1460  //TOF pi
1461  TF1 *TOFIdBandMinPi = new TF1("TOFIdBandMinPi", "[0]", 0, 24); TOFIdBandMinPi->SetParameter(0, -3);
1462  TF1 *TOFIdBandMaxPi = new TF1("TOFIdBandMaxPi", "[0]", 0, 24); TOFIdBandMaxPi->SetParameter(0, 3);
1463 
1464  SetIdBand(AliPID::kPion, AliPIDResponse::kTOF, TOFIdBandMinPi, TOFIdBandMaxPi);
1465 }
1466 
1467 //------------------
1470 
1471  SetMatch(10);
1472  SetTPC(kTRUE);
1473  SetTOF(kTRUE);
1474 
1475  //TPC K
1476  TF1 *TPCCompBandMinK = new TF1("TPCCompBandMinK", "[0]", 0, 24); TPCCompBandMinK->SetParameter(0, -3);
1477  TF1 *TPCCompBandMaxK = new TF1("TPCCompBandMaxK", "[0]", 0, 24); TPCCompBandMaxK->SetParameter(0, 3);
1478 
1479  SetCompBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCCompBandMinK, TPCCompBandMaxK);
1480 
1481  Double_t TPCIdBandMinKBins[6] = {0, 0.45, 0.55, 0.7, 1.1, 24};
1482  TH1F *TPCIdBandMinK = new TH1F("TPCIdBandMinK", "TPC Id Band Min K", 5, TPCIdBandMinKBins);
1483  TPCIdBandMinK->SetBinContent(1, -2); //0-0.45
1484  TPCIdBandMinK->SetBinContent(2, -1); //0.45-0.55
1485  TPCIdBandMinK->SetBinContent(3, -2); //0.55-0.7
1486  TPCIdBandMinK->SetBinContent(4, -1); //0.7-1.1
1487  TPCIdBandMinK->SetBinContent(5, -2); //1.1-24
1488 
1489  Double_t TPCIdBandMaxKBins[4] = {0, 0.5, 0.7, 24};
1490  TH1F *TPCIdBandMaxK = new TH1F("TPCIdBandMaxK", "TPC Id Band Max K", 3, TPCIdBandMaxKBins);
1491  TPCIdBandMaxK->SetBinContent(1, 2); //0-0.5
1492  TPCIdBandMaxK->SetBinContent(2, 1); //0.5-0.7
1493  TPCIdBandMaxK->SetBinContent(3, 2); //0.7-24
1494 
1495  SetIdBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCIdBandMinK, TPCIdBandMaxK);
1496  GetIdBandMin(AliPID::kKaon, AliPIDResponse::kTPC)->SetNpx(5000);
1497  GetIdBandMax(AliPID::kKaon, AliPIDResponse::kTPC)->SetNpx(5000);
1498 
1499  //TPC pi
1500  TF1 *TPCCompBandMinpi = new TF1("TPCCompBandMinpi", "[0]", 0, 24); TPCCompBandMinpi->SetParameter(0, -3);
1501  TF1 *TPCCompBandMaxpi = new TF1("TPCCompBandMaxpi", "[0]", 0, 24); TPCCompBandMaxpi->SetParameter(0, 3);
1502 
1503  SetCompBand(AliPID::kPion, AliPIDResponse::kTPC, TPCCompBandMinpi, TPCCompBandMaxpi);
1504 
1505  Double_t TPCIdBandMinpiBins[2] = {0, 24};
1506  TH1F *TPCIdBandMinpi = new TH1F("TPCIdBandMinpi", "TPC Id Band Min pi", 1, TPCIdBandMinpiBins);
1507  TPCIdBandMinpi->SetBinContent(1, -2); //0-24
1508 
1509  Double_t TPCIdBandMaxpiBins[4] = {0, 0.7, 1.7, 24};
1510  TH1F *TPCIdBandMaxpi = new TH1F("TPCIdBandMaxpi", "TPC Id Band Max pi", 3, TPCIdBandMaxpiBins);
1511  TPCIdBandMaxpi->SetBinContent(1, 2); //0-0.7
1512  TPCIdBandMaxpi->SetBinContent(2, 1); //0.7-1.7
1513  TPCIdBandMaxpi->SetBinContent(3, 2); //1.7-24
1514 
1515  SetIdBand(AliPID::kPion, AliPIDResponse::kTPC, TPCIdBandMinpi, TPCIdBandMaxpi);
1516  GetIdBandMin(AliPID::kPion, AliPIDResponse::kTPC)->SetNpx(5000);
1517  GetIdBandMax(AliPID::kPion, AliPIDResponse::kTPC)->SetNpx(5000);
1518 
1519  //TOF K
1520  TF1 *TOFCompBandMinK = new TF1("TOFCompBandMinK", "[0]", 2, 24); TOFCompBandMinK->SetParameter(0, -3);
1521  TF1 *TOFCompBandMaxK = new TF1("TOFCompBandMaxK", "[0]", 2, 24); TOFCompBandMaxK->SetParameter(0, 3);
1522 
1523  SetCompBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFCompBandMinK, TOFCompBandMaxK);
1524 
1525  TF1 *TOFIdBandMinK = new TF1("TOFIdBandMinK", "[0]", 0, 2); TOFIdBandMinK->SetParameter(0, -3);
1526  TF1 *TOFIdBandMaxK = new TF1("TOFIdBandMaxK", "[0]", 0, 2); TOFIdBandMaxK->SetParameter(0, 3);
1527 
1528  SetIdBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFIdBandMinK, TOFIdBandMaxK);
1529 
1530  //TOF pi
1531  TF1 *TOFCompBandMinpi = new TF1("TOFCompBandMinpi", "[0]", 2, 24); TOFCompBandMinpi->SetParameter(0, -3);
1532  TF1 *TOFCompBandMaxpi = new TF1("TOFCompBandMaxpi", "[0]", 2, 24); TOFCompBandMaxpi->SetParameter(0, 3);
1533 
1534  SetCompBand(AliPID::kPion, AliPIDResponse::kTOF, TOFCompBandMinpi, TOFCompBandMaxpi);
1535 
1536  TF1 *TOFIdBandMinpi = new TF1("TOFIdBandMinpi", "[0]", 0, 2); TOFIdBandMinpi->SetParameter(0, -3);
1537  TF1 *TOFIdBandMaxpi = new TF1("TOFIdBandMaxpi", "[0]", 0, 2); TOFIdBandMaxpi->SetParameter(0, 3);
1538 
1539  SetIdBand(AliPID::kPion, AliPIDResponse::kTOF, TOFIdBandMinpi, TOFIdBandMaxpi);
1540 }
void SetIdAsymmetricPID()
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
void SetPriorsHistos(TString priorFileName)
Int_t fnNSigmaCompat
upper nsigma TOF (for fUseAsymTOF)
Definition: AliAODPidHF.h:260
Double_t fLownSigmaTOF
flag for using asymmetrig nSigmaCut in TOF for fMatch==1
Definition: AliAODPidHF.h:256
Bool_t fppLowEn2011
MC for low energy MC.
Definition: AliAODPidHF.h:271
Bool_t CheckITSPIDStatus(AliAODTrack *track) const
Bool_t IsTOFPiKexcluded(AliAODTrack *track, Double_t nsigmaK)
general method to perform PID using raw signals
Double_t fPtThresholdTPC
old PID method implemented
Definition: AliAODPidHF.h:275
Int_t GetnSigmaTOF(AliAODTrack *track, Int_t species, Double_t &sigma) const
Double_t * fPLimit
limit of p intervals for asimmetric PID: fPLimit<p[0], fPLimit[0]<p<fPLimit[1], p>fPLimit[1] ...
Definition: AliAODPidHF.h:245
Int_t RawSignalPID(AliAODTrack *track, TString detector) const
AliTPCPIDResponse * fTPCResponse
! TPC response
Definition: AliAODPidHF.h:280
Bool_t IsKaonRaw(AliAODTrack *track, TString detector) const
Double_t fMaxnSigmaCombined[3]
Definition: AliAODPidHF.h:263
Bool_t fMCLowEn2011
real data with one pad clusters
Definition: AliAODPidHF.h:270
Float_t NumberOfSigmas(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, AliAODTrack *track)
TF1 * GetIdBandMin(AliPID::EParticleType specie, AliPIDResponse::EDetector detector)
Definition: AliAODPidHF.h:217
Int_t GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &sigma) const
Bool_t CheckTOFPIDStatus(AliAODTrack *track) const
Bool_t CheckTPCPIDStatus(AliAODTrack *track) const
void SetPriors(Double_t *priors, Int_t npriors)
TF1 * fIdBandMax[AliPID::kSPECIES][4]
Definition: AliAODPidHF.h:289
Bool_t IsElectronRaw(AliAODTrack *track, TString detector) const
TF1 * fIdBandMin[AliPID::kSPECIES][4]
use default priors for combined PID
Definition: AliAODPidHF.h:288
Bool_t fMC
max. of nSigma range for pi,K,p in TOF (match==5)
Definition: AliAODPidHF.h:268
Bool_t fCompat
force TOF for kaons in mode fMatch==5
Definition: AliAODPidHF.h:253
Int_t fnNSigma
Definition: AliAODPidHF.h:234
Bool_t fITS
switch to include or exclude TOF
Definition: AliAODPidHF.h:249
Int_t ApplyPidTPCRaw(AliAODTrack *track, Int_t specie) const
Double_t fMaxnSigmaTOF[3]
min. of nSigma range for pi,K,p in TOF (match==5)
Definition: AliAODPidHF.h:267
Int_t ApplyPidITSRaw(AliAODTrack *track, Int_t specie) const
void SetCompBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TH1F *min, TH1F *max)
TH1F * fPriorsH[AliPID::kSPECIES]
Definition: AliAODPidHF.h:282
Int_t MatchTPCTOFMin(AliAODTrack *track, Int_t specie)
PID nSigma strategy closer to the Bayesian approach with Max. prob.
void PrintAll() const
Double_t fMaxTrackMomForCombinedPID
pT threshold to use TPC PID
Definition: AliAODPidHF.h:276
Double_t fMinnSigmaTOF[3]
max. of nSigma range for pi,K,p in TPC (match==5)
Definition: AliAODPidHF.h:266
Double_t fMinnSigmaTPC[3]
nSigma cut for pi,K,p (TPC^2+TOF^2)
Definition: AliAODPidHF.h:264
TF1 * fCompBandMin[AliPID::kSPECIES][4]
Definition: AliAODPidHF.h:290
void SetTOF(Bool_t tof)
Definition: AliAODPidHF.h:95
TF1 * GetIdBandMax(AliPID::EParticleType specie, AliPIDResponse::EDetector detector)
Definition: AliAODPidHF.h:218
Int_t fnPLimit
Definition: AliAODPidHF.h:243
Bool_t fOnePad
MC(kTRUE) or real data (kFALSE, default option)
Definition: AliAODPidHF.h:269
void SetIdBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TH1F *min, TH1F *max)
Assymetric PID using histograms.
Int_t CheckBands(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, AliAODTrack *track)
AliPIDResponse * fPidResponse
momentum threshold to use PID
Definition: AliAODPidHF.h:277
void DrawPrior(AliPID::EParticleType type)
Double_t * fPriors
set of priors
Definition: AliAODPidHF.h:242
virtual ~AliAODPidHF()
AliPIDCombined * GetPidCombined() const
Definition: AliAODPidHF.h:161
void GetTPCBetheBlochParams(Double_t alephParameters[5]) const
Bool_t fOldPid
real data PbPb
Definition: AliAODPidHF.h:274
void SetShiftedAsymmetricPID()
Some suggested asymmetric PID.
Bool_t fDefaultPriors
detectors to be involved for combined PID
Definition: AliAODPidHF.h:285
Bool_t CheckStatus(AliAODTrack *track, TString detectors) const
Double_t fPCompatTOF
compatibility region : useful only if fMatch=1
Definition: AliAODPidHF.h:254
Bool_t IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detector)
Bool_t fForceTOFforKaons
switch to combine the info from more detectors: 1 = || , 2 = &, 3 = p region
Definition: AliAODPidHF.h:252
Double_t nsigma
Bool_t fTOF
switch to include or exclude TPC
Definition: AliAODPidHF.h:248
void SetUpCombinedPID()
Int_t MakeRawPid(AliAODTrack *track, Int_t specie)
Int_t fMatch
switch to include or exclude TRD
Definition: AliAODPidHF.h:251
Int_t MatchTPCTOF(AliAODTrack *track, Int_t specie)
void SetIdCompAsymmetricPID()
void SetSigma(Double_t *sigma)
Definition: AliAODPidHF.h:39
Int_t fnPriors
Minimum TPC PID clusters cut.
Definition: AliAODPidHF.h:240
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Bool_t fTOFdecide
real data PbPb
Definition: AliAODPidHF.h:273
Int_t ApplyPidTOFRaw(AliAODTrack *track, Int_t specie) const
void SetPriorDistribution(AliPID::EParticleType type, TH1F *prior)
Double_t fMaxnSigmaTPC[3]
min. of nSigma range for pi,K,p in TPC (match==5)
Definition: AliAODPidHF.h:265
void SetBetheBloch()
UInt_t fMinNClustersTPCPID
Cut of TOF mismatch probability.
Definition: AliAODPidHF.h:239
Double_t fLownSigmaCompatTOF
upper nsigma TOF (for fUseAsymTOF)
Definition: AliAODPidHF.h:258
Int_t GetnSigmaITS(AliAODTrack *track, Int_t species, Double_t &sigma) const
AliPIDCombined * fPidCombined
! combined PID object
Definition: AliAODPidHF.h:278
Bool_t IsPionRaw(AliAODTrack *track, TString detector) const
Bool_t CheckDetectorPIDStatus(AliPIDResponse::EDetector detector, AliAODTrack *track)
Int_t ApplyTOFCompatibilityBand(AliAODTrack *track, Int_t specie) const
Double_t * fnSigma
sigma for the raw signal PID: 0-2 for TPC, 3 for TOF, 4 for ITS
Definition: AliAODPidHF.h:236
Bool_t fTPC
asimmetric PID required
Definition: AliAODPidHF.h:247
Bool_t fUseAsymTOF
compatibility p limit for TOF
Definition: AliAODPidHF.h:255
Double_t fUpnSigmaCompatTOF
lower nsigma TOF (for fUseAsymTOF)
Definition: AliAODPidHF.h:259
Bool_t fTRD
switch to include or exclude ITS
Definition: AliAODPidHF.h:250
void SetMatch(Int_t match)
Definition: AliAODPidHF.h:98
void SetPLimit(Double_t *plim, Int_t npLim)
Bool_t TPCRawAsym(AliAODTrack *track, Int_t specie) const
void SetTPC(Bool_t tpc)
Definition: AliAODPidHF.h:94
Bool_t fAsym
Definition: AliAODPidHF.h:246
Bool_t fPbPb
Data for low energy pp 2011.
Definition: AliAODPidHF.h:272
Double_t fUpnSigmaTOF
lower nsigma TOF (for fUseAsymTOF)
Definition: AliAODPidHF.h:257
ECombDetectors fCombDetectors
priors histos
Definition: AliAODPidHF.h:283
void CombinedProbability(AliAODTrack *track, Bool_t *type) const
Bool_t IsProtonRaw(AliAODTrack *track, TString detector) const
Double_t * fnSigmaCompat
0: n sigma for TPC compatibility band, 1: for TOF
Definition: AliAODPidHF.h:262
Double_t fCutTOFmismatch
TOF precision.
Definition: AliAODPidHF.h:238
Bool_t CheckTRDPIDStatus(AliAODTrack *track) const
TF1 * fCompBandMax[AliPID::kSPECIES][4]
Definition: AliAODPidHF.h:291