AliPhysics  95775ff (95775ff)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 {
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 
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  return kTRUE;
452 }
453 //--------------------------------
454 Bool_t AliAODPidHF::CheckTRDPIDStatus(AliAODTrack *track) const{
456  AliPIDResponse::EDetPidStatus status = fPidResponse->CheckPIDStatus(AliPIDResponse::kTRD,track);
457  if (status != AliPIDResponse::kDetPidOk) return kFALSE;
458  return kTRUE;
459 }
460 //--------------------------------
461 Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{
463  if(detectors.Contains("ITS")) return CheckITSPIDStatus(track);
464  else if(detectors.Contains("TPC")) return CheckTPCPIDStatus(track);
465  else if(detectors.Contains("TOF")) return CheckTOFPIDStatus(track);
466  else if(detectors.Contains("TRD")) return CheckTRDPIDStatus(track);
467  else{
468  AliError("Wrong detector name");
469  return kFALSE;
470  }
471 }
472 //--------------------------------------------
473 Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{
475 
476  AliAODPid *pidObj = track->GetDetPid();
477  Double_t mom = pidObj->GetTPCmomentum();
478  if(mom>fPtThresholdTPC) return kTRUE;
479 
481  if(GetnSigmaTPC(track,specie,nsigma)!=1) return kFALSE;
482  nsigma=TMath::Abs(nsigma);
483 
484 
485  if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE;
486  if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE;
487  if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE;
488 
489  return kFALSE;
490 }
491 //------------------
492 Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track, Int_t specie){
494 
495  Double_t ptrack=track->P();
496  if(ptrack>fMaxTrackMomForCombinedPID) return 1;
497 
498  Bool_t okTPC=CheckTPCPIDStatus(track);
499  if(ptrack>fPtThresholdTPC) okTPC=kFALSE;
500  Bool_t okTOF=CheckTOFPIDStatus(track);
501 
502  if(fMatch==1){
503  //TOF || TPC (a la' Andrea R.)
504  // convention:
505  // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible
506  // the method returns the sum of the response of the 2 detectors
507 
508  if(fTPC && fTOF) {
509  if(!okTPC && !okTOF) return 0;
510  }
511 
512  Int_t tTPCinfo=0;
513  if(fTPC && okTPC){
514  tTPCinfo=-1;
515  if(fAsym) {
516  if(TPCRawAsym(track,specie)) tTPCinfo=1;
517  }else{
518  if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
519  }
520  if(fCompat && tTPCinfo<0){
521  Double_t sig0tmp=fnSigma[0];
522  SetSigma(0,fnSigmaCompat[0]);
523  if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=0;
524  SetSigma(0,sig0tmp);
525  }
526  }
527 
528  Int_t tTOFinfo=0;
529  if(fTOF){
530  if(!okTOF && fTPC) return tTPCinfo;
531  tTOFinfo=-1;
532  if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
533  if(fCompat && tTOFinfo>0){
534  if(ptrack>fPCompatTOF) {
535  if(ApplyTOFCompatibilityBand(track,specie)==specie) tTOFinfo=0;
536  }
537  }
538  }
539 
540 
541  if(tTPCinfo+tTOFinfo==0 && fTOFdecide){
542  if(!okTOF) return tTPCinfo;
543  return tTOFinfo;
544  }
545 
546  if(tTPCinfo+tTOFinfo==0 && fITS){
547  if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
548  Int_t tITSinfo = -1;
549  if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
550  return tITSinfo;
551  }
552  return tTPCinfo+tTOFinfo;
553  }
554 
555  if(fMatch==2){
556  //TPC & TOF (a la' Yifei)
557  // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified
558  Int_t tTPCinfo=0;
559 
560  if(fTPC && okTPC) {
561  tTPCinfo=1;
562  if(fAsym){
563  if(!TPCRawAsym(track,specie)) tTPCinfo=-1;
564  }else{
565  if(ApplyPidTPCRaw(track,specie)!=specie) tTPCinfo=-1;
566  }
567  }
568 
569  Int_t tTOFinfo=1;
570  if(fTOF){
571  if(fTPC && !okTOF) return tTPCinfo;
572  if(ApplyPidTPCRaw(track,specie)!=specie) tTOFinfo=-1;
573  }
574 
575  if(tTOFinfo==1 && tTPCinfo==1) return 1;
576 
577  if(tTPCinfo+tTOFinfo==0 && fITS){
578  if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
579  Int_t tITSinfo = -1;
580  if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
581  return tITSinfo;
582  }
583  return -1;
584  }
585 
586  if(fMatch==3){
587  //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.)
588  // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified
589  if(fTPC && fTOF) if(!okTPC && !okTOF) return 0;
590 
591 
592  Int_t tTPCinfo=-1;
593  if(ptrack>=fPLimit[0] && ptrack<fPLimit[1] && fTPC) {
594  if(!okTPC) return 0;
595  if(fAsym) {
596  if(TPCRawAsym(track,specie)) tTPCinfo=1;
597  }else{
598  if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
599  }
600  return tTPCinfo;
601  }
602 
603  Int_t tTOFinfo=-1;
604  if(ptrack>=fPLimit[1] && fTOF){
605  if(!okTOF) return 0;
606  if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
607  return tTOFinfo;
608  }
609 
610  Int_t tITSinfo=-1;
611  if(ptrack<fPLimit[0] && fITS){
612  if(!CheckITSPIDStatus(track)) return 0;
613  if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
614  return tITSinfo;
615  }
616  }
617 
618  if(fMatch==4 || fMatch==5){
619 
620  // fMatch == 4 ---> "circular cut" in nSigmaTPC, nSimgaTOF plane
621  // ---> nsigmaTPC^2+nsigmaTOF^2 < cut^2
622  // fMatch == 5 ---> "rectangular cut" in nSigmaTPC, nsigmaTOF plane
623  // ---> ns1<nSigmaTPC<NS1 && ns2<nSigmaTOF<NS2
624 
625  Double_t nSigmaTPC=0.;
626  if(okTPC) {
627  nSigmaTPC=fPidResponse->NumberOfSigmasTPC(track,(AliPID::EParticleType)specie);
628  if(nSigmaTPC<-990.) nSigmaTPC=0.;
629  }
630  Double_t nSigmaTOF=0.;
631  if(okTOF) {
632  nSigmaTOF=fPidResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)specie);
633  }
634  Int_t iPart=specie-2; //species is 2 for pions,3 for kaons and 4 for protons
635  if(iPart<0 || iPart>2) return -1;
636  if(fMatch==4){
637  Double_t nSigma2=nSigmaTPC*nSigmaTPC+nSigmaTOF*nSigmaTOF;
638  if(nSigma2<fMaxnSigmaCombined[iPart]*fMaxnSigmaCombined[iPart]) return 1;
639  else return -1;
640  }
641  else if(fMatch==5){
642  if(fForceTOFforKaons && iPart==1 && !okTOF) return -1;
643  if((nSigmaTPC>fMinnSigmaTPC[iPart] && nSigmaTPC<fMaxnSigmaTPC[iPart]) &&
644  (nSigmaTOF>fMinnSigmaTOF[iPart] && nSigmaTOF<fMaxnSigmaTOF[iPart])) return 1;
645  else return -1;
646  }
647  }
648 
649  //Asymmetric cuts using user defined bands
650  if (fMatch == 10) {
651  if (fTPC && fTOF && !okTPC && !okTOF) {
652  return 0;
653  }
654 
655  Int_t tTPCinfo = 0;
656  if (fTPC && okTPC) {
657  tTPCinfo = CheckBands((AliPID::EParticleType) specie, AliPIDResponse::kTPC, track);
658  }
659 
660  Int_t tTOFinfo = 0;
661  if (fTOF) {
662  if (!okTOF && fTPC) {
663  return tTPCinfo;
664  }
665  tTOFinfo = CheckBands((AliPID::EParticleType) specie, AliPIDResponse::kTOF, track);
666  }
667 
668 
669  if (tTPCinfo+tTOFinfo == 0 && fTOFdecide) {
670  if (!okTOF) {
671  return tTPCinfo;
672  }
673  return tTOFinfo;
674  }
675 
676  if (tTPCinfo+tTOFinfo == 0 && fITS) {
677  if (!CheckITSPIDStatus(track)) {
678  return tTPCinfo+tTOFinfo;
679  }
680  Int_t tITSinfo = CheckBands((AliPID::EParticleType) specie, AliPIDResponse::kITS, track);
681  return tITSinfo;
682  }
683  return tTPCinfo+tTOFinfo;
684  }
685 
686  return -1;
687 
688 }
689 
690 //--------------------------------------------------------------
691 Int_t AliAODPidHF::MatchTPCTOFMin(AliAODTrack *track, Int_t specie){
693 
694  Bool_t okTPC=CheckTPCPIDStatus(track);
695  Bool_t okTOF=CheckTOFPIDStatus(track);
696 
697  if(fTPC && fTOF){
698  if(!okTPC && !okTOF) return 0;
699  }
700 
701  Int_t pid=-1;
702  Double_t nsigmaTPC[5]={999.,999.,999.,999.,999.};
703  Double_t nsigmaTOF[5]={999.,999.,999.,999.,999.};
704  Double_t nsigmaMin=999.;
705  Double_t nsigma[5]={999.,999.,999.,999.,999.};
706 
707  if(okTPC) {
708  for(Int_t ipart=0;ipart<5;ipart++){
709  if(GetnSigmaTPC(track,ipart,nsigmaTPC[ipart])<1) nsigmaTPC[ipart]=0.;
710  }
711  }else{
712  for(Int_t ipart=0;ipart<5;ipart++){nsigmaTPC[ipart]=0.;}
713  }
714 
715  if(okTOF){
716  for(Int_t ipart=0;ipart<5;ipart++){
717  if(GetnSigmaTOF(track,ipart,nsigmaTOF[ipart])<1) nsigmaTOF[ipart]=0.;
718  }
719  }else{
720  for(Int_t ipart=0;ipart<5;ipart++){nsigmaTOF[ipart]=0.;}
721  }
722 
723  for(Int_t ipart=0;ipart<5;ipart++){
724  nsigma[ipart]=TMath::Sqrt(nsigmaTPC[ipart]*nsigmaTPC[ipart]+nsigmaTOF[ipart]*nsigmaTOF[ipart]);
725  if(nsigma[ipart]<nsigmaMin) {nsigmaMin=nsigma[ipart];pid=ipart;}
726  }
727 
728  if(pid==specie) return 1;
729 
730  return 0;
731 }
732 
733 
734 //----------------------------------
735 Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){
737  if(fMatch>0){
738  return MatchTPCTOF(track,specie);
739  }else{
740  if(fTPC && !fTOF && !fITS) {
741  Int_t tTPCres=0;
742  if(!fAsym){
743  tTPCres=ApplyPidTPCRaw(track,specie);
744  if(tTPCres==specie) return 1;
745  else return tTPCres;
746  }else{
747  if(TPCRawAsym(track,specie)) tTPCres=1;
748  else tTPCres=-1;
749  }
750  return tTPCres;
751  }else if(fTOF && !fTPC && !fITS) {
752  Int_t tTOFres=ApplyPidTOFRaw(track,specie);
753  if(tTOFres==specie) return 1;
754  else return tTOFres;
755  }else if(fITS && !fTPC && !fTOF) {
756  Int_t tITSres=ApplyPidITSRaw(track,specie);
757  if(tITSres==specie) return 1;
758  else return tITSres;
759  }else{
760  AliError("You should enable just one detector if you don't want to match");
761  return 0;
762  }
763  }
764 }
765 //--------------------------------------------
766 void AliAODPidHF::GetTPCBetheBlochParams(Double_t alephParameters[5]) const {
768  if(fMC) { // MC
769 
770  if(fPbPb) { // PbPb MC
771 
772  alephParameters[0] = 1.44405/50.;
773  alephParameters[1] = 2.35409e+01;
774  alephParameters[2] = TMath::Exp(-2.90330e+01);
775  alephParameters[3] = 2.10681e+00;
776  alephParameters[4] = 4.62254e+00;
777 
778  } else { // pp MC
779  if(fMCLowEn2011){
780  alephParameters[0]=0.0207667;
781  alephParameters[1]=29.9936;
782  alephParameters[2]=3.87866e-11;
783  alephParameters[3]=2.17291;
784  alephParameters[4]=7.1623;
785  }else if(fOnePad){
786  alephParameters[0]=0.029021;
787  alephParameters[1]=25.4181;
788  alephParameters[2]=4.66596e-08;
789  alephParameters[3]=1.90008;
790  alephParameters[4]=4.63783;
791  }else{
792  alephParameters[0] = 2.15898/50.;
793  alephParameters[1] = 1.75295e+01;
794  alephParameters[2] = 3.40030e-09;
795  alephParameters[3] = 1.96178e+00;
796  alephParameters[4] = 3.91720e+00;
797  }
798  }
799 
800  } else { // Real Data
801 
802  if(fOnePad) { // pp 1-pad (since LHC10d)
803 
804  alephParameters[0] =1.34490e+00/50.;
805  alephParameters[1] = 2.69455e+01;
806  alephParameters[2] = TMath::Exp(-2.97552e+01);
807  alephParameters[3] = 2.35339e+00;
808  alephParameters[4] = 5.98079e+00;
809 
810  } else if(fPbPb) { // PbPb
811 
812  // alephParameters[0] = 1.25202/50.;
813  // alephParameters[1] = 2.74992e+01;
814  // alephParameters[2] = TMath::Exp(-3.31517e+01);
815  // alephParameters[3] = 2.46246;
816  // alephParameters[4] = 6.78938;
817 
818  alephParameters[0] = 5.10207e+00/50.;
819  alephParameters[1] = 7.94982e+00;
820  alephParameters[2] = TMath::Exp(-9.07942e+00);
821  alephParameters[3] = 2.38808e+00;
822  alephParameters[4] = 1.68165e+00;
823 
824  } else if(fppLowEn2011){ // pp low energy
825 
826  alephParameters[0]=0.031642;
827  alephParameters[1]=22.353;
828  alephParameters[2]=4.16239e-12;
829  alephParameters[3]=2.61952;
830  alephParameters[4]=5.76086;
831 
832  } else { // pp no 1-pad (LHC10bc)
833 
834  alephParameters[0] = 0.0283086/0.97;
835  alephParameters[1] = 2.63394e+01;
836  alephParameters[2] = 5.04114e-11;
837  alephParameters[3] = 2.12543e+00;
838  alephParameters[4] = 4.88663e+00;
839 
840  }
841 
842  }
843 
844 }
845 
846 //-----------------------
849 
850  Double_t alephParameters[5];
851  GetTPCBetheBlochParams(alephParameters);
852  fTPCResponse->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
853 
854  return;
855 }
856 
857 
858 //--------------------------------------------------------------------------
859 Int_t AliAODPidHF::GetnSigmaITS(AliAODTrack *track,Int_t species, Double_t &nsigma) const{
861 
862 
863  if (!CheckITSPIDStatus(track)) return -1;
864 
865  Double_t nsigmaITS=-999;
866 
867  if (fOldPid) {
868  Double_t mom=track->P();
869  AliAODPid *pidObj = track->GetDetPid();
870  Double_t dedx=pidObj->GetITSsignal();
871 
872  AliITSPIDResponse itsResponse;
873  AliPID::EParticleType type=AliPID::EParticleType(species);
874  nsigmaITS = itsResponse.GetNumberOfSigmas(mom,dedx,type);
875 
876  } // old pid
877  else { // new pid
878 
879  AliPID::EParticleType type=AliPID::EParticleType(species);
880  nsigmaITS = fPidResponse->NumberOfSigmasITS(track,type);
881 
882  } //new pid
883 
884  nsigma = nsigmaITS;
885 
886  return 1;
887 
888 }
889 //--------------------------------------------------------------------------
890 Int_t AliAODPidHF::GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &nsigma) const{
892 
893  if(!CheckTPCPIDStatus(track)) return -1;
894 
895  Double_t nsigmaTPC=-999;
896 
897  if(fOldPid){
898  AliAODPid *pidObj = track->GetDetPid();
899  Double_t dedx=pidObj->GetTPCsignal();
900  Double_t mom = pidObj->GetTPCmomentum();
901  if(mom>fPtThresholdTPC) return -2;
902  UShort_t nTPCClus=pidObj->GetTPCsignalN();
903  if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
904  AliPID::EParticleType type=AliPID::EParticleType(species);
905  nsigmaTPC = fTPCResponse->GetNumberOfSigmas(mom,dedx,nTPCClus,type);
906  nsigma=nsigmaTPC;
907  } else{
908  if(!fPidResponse) return -1;
909  AliPID::EParticleType type=AliPID::EParticleType(species);
910  nsigmaTPC = fPidResponse->NumberOfSigmasTPC(track,type);
911  nsigma=nsigmaTPC;
912  }
913  return 1;
914 }
915 
916 //-----------------------------
917 
918 Int_t AliAODPidHF::GetnSigmaTOF(AliAODTrack *track,Int_t species, Double_t &nsigma) const{
920 
921  if(!CheckTOFPIDStatus(track)) return -1;
922 
923  if(fPidResponse){
924  nsigma = fPidResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)species);
925  return 1;
926  }else{
927  AliFatal("To use TOF PID you need to attach AliPIDResponseTask");
928  nsigma=-999.;
929  return -1;
930  }
931 }
932 
933 //-----------------------
934 Bool_t AliAODPidHF::IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detectors) {
936 
937  if (detectors.Contains("ITS")) {
938 
939  AliInfo("Nothing to be done");
940  /*
941  Double_t nsigma=0.;
942  if (GetnSigmaITS(track,labelTrack,nsigma)==1){
943  if(nsigma>nsigmaCut) return kTRUE;
944  }
945  */
946  return kFALSE;
947 
948  } else if (detectors.Contains("TPC")) {
949 
950  Double_t nsigma=0.;
951  if (GetnSigmaTPC(track,labelTrack,nsigma)==1){
952  if(nsigma>nsigmaCut) return kTRUE;
953  }
954  return kFALSE;
955 
956  } else if (detectors.Contains("TOF")) {
957 
958  Double_t nsigma=0.;
959  if (GetnSigmaTOF(track,labelTrack,nsigma)==1){
960  if(nsigma>nsigmaCut) return kTRUE;
961  }
962  return kFALSE;
963 
964  }
965  return kFALSE;
966 
967 }
968 //-----------------------
969 Bool_t AliAODPidHF::IsTOFPiKexcluded(AliAODTrack *track,Double_t nsigmaK){
971 
972  if(!CheckTOFPIDStatus(track)) return 0;
973 
975  if(GetnSigmaTOF(track,3,nsigma)==1){
976  if(nsigma>nsigmaK) return kTRUE;
977  }
978  return kFALSE;
979  /* Double_t time[AliPID::kSPECIESN];
980  Double_t sigmaTOFPid[AliPID::kSPECIES];
981  AliAODPid *pidObj = track->GetDetPid();
982  pidObj->GetIntegratedTimes(time);
983  Double_t sigTOF=pidObj->GetTOFsignal();
984 
985  AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
986  if (event) {
987  AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
988  if (tofH && fPidResponse) {
989  AliTOFPIDResponse TOFres = (AliTOFPIDResponse)fPidResponse->GetTOFResponse();
990  sigTOF -= TOFres.GetStartTime(track->P());
991  sigmaTOFPid[3]=TOFres.GetExpectedSigma(track->P(),time[3],AliPID::ParticleMass(3));
992  }
993  else pidObj->GetTOFpidResolution(sigmaTOFPid);
994  } else pidObj->GetTOFpidResolution(sigmaTOFPid);
995  Double_t sigmaTOFtrack;
996  if (sigmaTOFPid[3]>0) sigmaTOFtrack=sigmaTOFPid[3];
997  else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
998 
999  if((sigTOF-time[3])>nsigmaK*sigmaTOFtrack)return kTRUE;// K, Pi excluded (->LIKELY A PROTON)
1000 
1001  return kFALSE;
1002  */
1003 }
1004 
1005 //--------------------------------------------------------------------------
1006 void AliAODPidHF::SetPriorDistribution(AliPID::EParticleType type,TH1F *prior){
1007 
1012 
1013  GetPidCombined()->SetPriorDistribution(type,prior);
1014 }
1015 //--------------------------------------------------------------------------
1016 void AliAODPidHF::DrawPrior(AliPID::EParticleType type){
1017 
1020 
1021  new TCanvas();
1022  GetPidCombined()->GetPriorDistribution(type)->Draw();
1023 }
1024 
1025 //-----------------------------
1026 void AliAODPidHF::SetPriors(Double_t *priors, Int_t npriors){
1028  if (fnPriors != npriors) {
1029  if (fPriors) delete fPriors;
1030  fPriors = new Double_t[npriors];
1031  fnPriors = npriors;
1032  }
1033  for(Int_t i = 0; i < fnPriors; i++) fPriors[i] = priors[i];
1034 }
1035 
1036 //-----------------------------
1039  if (fnPLimit != npLim) {
1040  if (fPLimit) delete fPLimit;
1041  fPLimit = new Double_t[npLim];
1042  fnPLimit = npLim;
1043  }
1044  for(Int_t i = 0; i < fnPLimit; i++) fPLimit[i] = plim[i];
1045 }
1046 //-----------------------------
1049 
1050  for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
1051  if(fPriorsH[ispecies]) delete fPriorsH[ispecies];
1052  TString nt ="name";
1053  nt+="_prior_";
1054  nt+=AliPID::ParticleName(ispecies);
1055  }
1056  TDirectory *current = gDirectory;
1057  TFile *priorFile=TFile::Open(priorFileName);
1058  if (priorFile) {
1059  TH1F* h3=static_cast<TH1F*>(priorFile->Get("priors3step9"));
1060  TH1F* h2=static_cast<TH1F*>(priorFile->Get("priors2step9"));
1061  TH1F* h1=static_cast<TH1F*>(priorFile->Get("priors1step9"));
1062  current->cd();
1063  fPriorsH[AliPID::kProton] = new TH1F(*h3);
1064  fPriorsH[AliPID::kKaon ] = new TH1F(*h2);
1065  fPriorsH[AliPID::kPion ] = new TH1F(*h1);
1066  priorFile->Close();
1067  delete priorFile;
1068  TF1 *salt=new TF1("salt","1.e-10",0,10);
1069  fPriorsH[AliPID::kProton]->Add(salt);
1070  fPriorsH[AliPID::kKaon ]->Add(salt);
1071  fPriorsH[AliPID::kPion ]->Add(salt);
1072  delete salt;
1073  }
1074 }
1075 //----------------------------------
1078 
1079  fPidCombined->SetSelectedSpecies(AliPID::kSPECIES);
1080  if(!fDefaultPriors){
1081  for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
1082  fPidCombined->SetPriorDistribution(static_cast<AliPID::EParticleType>(ispecies),fPriorsH[ispecies]);
1083  }
1084  }else{
1085  fPidCombined->SetDefaultTPCPriors();
1086  }
1087  switch (fCombDetectors){
1088  case kTPCTOF:
1089  fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
1090  break;
1091  case kTPCITS:
1092  fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetITS);
1093  break;
1094  case kTPC:
1095  fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC);
1096  break;
1097  case kTOF:
1098  fPidCombined->SetDetectorMask(AliPIDResponse::kDetTOF);
1099  break;
1100  }
1101 }
1102 
1103 
1104 //-----------------------------
1107  printf("Detectors used for PID: ");
1108  if(fITS) printf("ITS ");
1109  if(fTPC) printf("TPC ");
1110  if(fTRD) printf("TRD ");
1111  if(fTOF) printf("TOF ");
1112  printf("\n");
1113  printf("Minimum TPC PID clusters = %d\n",fMinNClustersTPCPID);
1114  printf("Maximum momentum for using TPC PID = %f\n",fPtThresholdTPC);
1115  printf("TOF Mismatch probablility cut = %f\n",fCutTOFmismatch);
1116  printf("Maximum momentum for combined PID TPC PID = %f\n",fMaxTrackMomForCombinedPID);
1117  if(fOldPid){
1118  printf("Use OLD PID");
1119  printf(" fMC = %d\n",fMC);
1120  printf(" fPbPb = %d\n",fPbPb);
1121  printf(" fOnePad = %d\n",fOnePad);
1122  printf(" fMCLowEn2011 = %d\n",fMCLowEn2011);
1123  printf(" fppLowEn2011 = %d\n",fppLowEn2011);
1124  }
1125  printf("--- Matching algorithm = %d ---\n",fMatch);
1126  if(fMatch==1){
1127  if(fITS) printf("nSigmaITS = %.2f\n",fnSigma[4]);
1128  if(fTOF){
1129  printf("nSigmaTOF = %.2f\n",fnSigma[3]);
1130  if(fCompat) printf("Compatibility band at nSigmaTOF=%.2f for p>%.2f\n",fnSigmaCompat[1],fPCompatTOF);
1131  }
1132  if(fTPC){
1133  if(fAsym){
1134  printf("nSigmaTPC:\n");
1135  printf(" pt<%.2f \t nsigmaTPC= %.2f\n",fPLimit[0],fnSigma[0]);
1136  printf(" %.2f<pt<%.2f \t nsigmaTPC= %.2f\n",fPLimit[0],fPLimit[1],fnSigma[1]);
1137  printf(" pt>%.2f \t nsigmaTPC= %.2f\n",fPLimit[1],fnSigma[2]);
1138  }else{
1139  printf("nSigmaTPC = %.2f\n",fnSigma[0]);
1140  }
1141  if(fCompat) printf("Compatibility band at nSigmaTPC=%.2f\n",fnSigmaCompat[0]);
1142  }
1143  }else if(fMatch==4){
1144  printf("Cuts on sqrt(nSigmaTPC^2+nSigmaTOF^2):\n");
1145  printf(" Pions: nSigma = %.2f\n",fMaxnSigmaCombined[0]);
1146  printf(" Kaons: nSigma = %.2f\n",fMaxnSigmaCombined[1]);
1147  printf(" Protons: nSigma = %.2f\n",fMaxnSigmaCombined[2]);
1148  }else if(fMatch==5){
1149  printf("nSigma ranges:\n");
1150  printf(" Pions: %.2f<nSigmaTPC<%.2f %.2f<nSigmaTOF<%.2f\n",
1152  printf(" Kaons: %.2f<nSigmaTPC<%.2f %.2f<nSigmaTOF<%.2f\n",
1154  printf(" Protons: %.2f<nSigmaTPC<%.2f %.2f<nSigmaTOF<%.2f\n",
1156  } else if (fMatch == 10) {
1157  printf("Asymmetric PID using identification/compatibility bands as a function of track momentum p\n");
1158  printf("The following bands are set:\n");
1159  TString species[] = {"electron", "muon", "pion", "kaon", "proton"};
1160  TString detectors[] = {"ITS", "TPC", "TRD", "TOF"};
1161  for (Int_t s=0;s<AliPID::kSPECIES;s++) {
1162  for (Int_t d=0;d<4;d++) {
1163  if (fIdBandMin[s][d] && fIdBandMax[s][d]) {
1164  printf(" Identification band %s %s\n", species[s].Data(), detectors[d].Data());
1165  }
1166  if (fCompBandMin[s][d] && fCompBandMax[s][d]) {
1167  printf(" Compatibility band %s %s\n", species[s].Data(), detectors[d].Data());
1168  }
1169  }
1170  }
1171  }
1172 }
1173 
1174 //------------------
1175 void AliAODPidHF::SetIdBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TH1F *min, TH1F *max) {
1176  Int_t spe = (Int_t) specie;
1177  Int_t det = (Int_t) detector;
1178 
1179  if (spe >= AliPID::kSPECIES || det > 3 || !min || !max) {
1180  AliError("Identification band not set");
1181  return;
1182  }
1183 
1184  TAxis *axis;
1185  HistFunc *histFunc;
1186 
1187  axis = min->GetXaxis();
1188  histFunc = new HistFunc(min);
1189  TF1 *minFunc = new TF1(Form("IdMin_%d_%d", spe, det), histFunc, axis->GetBinLowEdge(axis->GetFirst()), axis->GetBinUpEdge(axis->GetLast()), 0, "HistFunc");
1190 
1191  axis = max->GetXaxis();
1192  histFunc = new HistFunc(max);
1193  TF1 *maxFunc = new TF1(Form("IdMax_%d_%d", spe, det), histFunc, axis->GetBinLowEdge(axis->GetFirst()), axis->GetBinUpEdge(axis->GetLast()), 0, "HistFunc");
1194 
1195  SetIdBand(specie, detector, minFunc, maxFunc);
1196 }
1197 
1198 //------------------
1199 void AliAODPidHF::SetIdBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TF1 *min, TF1 *max) {
1200  Int_t spe = (Int_t) specie;
1201  Int_t det = (Int_t) detector;
1202 
1203  if (spe >= AliPID::kSPECIES || det > 3 || !min || !max) {
1204  AliError("Identification band not set");
1205  return;
1206  }
1207 
1208  if (fIdBandMin[spe][det]) {
1209  delete fIdBandMin[spe][det];
1210  }
1211  fIdBandMin[spe][det] = new TF1(*min);
1212 
1213  if (fIdBandMax[spe][det]) {
1214  delete fIdBandMax[spe][det];
1215  }
1216  fIdBandMax[spe][det] = new TF1(*max);
1217 }
1218 
1219 //------------------
1220 void AliAODPidHF::SetCompBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TH1F *min, TH1F *max) {
1221  Int_t spe = (Int_t) specie;
1222  Int_t det = (Int_t) detector;
1223 
1224  if (spe >= AliPID::kSPECIES || det > 3 || !min || !max) {
1225  AliError("Compatibility band not set");
1226  return;
1227  }
1228 
1229  TAxis *axis;
1230  HistFunc *histFunc;
1231 
1232  axis = min->GetXaxis();
1233  histFunc = new HistFunc(min);
1234  TF1 *minFunc = new TF1(Form("CompMin_%d_%d", spe, det), histFunc, axis->GetBinLowEdge(axis->GetFirst()), axis->GetBinUpEdge(axis->GetLast()), 0, "HistFunc");
1235 
1236  axis = max->GetXaxis();
1237  histFunc = new HistFunc(max);
1238  TF1 *maxFunc = new TF1(Form("CompMax_%d_%d", spe, det), histFunc, axis->GetBinLowEdge(axis->GetFirst()), axis->GetBinUpEdge(axis->GetLast()), 0, "HistFunc");
1239 
1240  SetCompBand(specie, detector, minFunc, maxFunc);
1241 }
1242 
1243 //------------------
1244 void AliAODPidHF::SetCompBand(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, TF1 *min, TF1 *max) {
1245  Int_t spe = (Int_t) specie;
1246  Int_t det = (Int_t) detector;
1247 
1248  if (spe >= AliPID::kSPECIES || det > 3 || !min || !max) {
1249  AliError("Compatibility band not set");
1250  return;
1251  }
1252 
1253  if (fCompBandMin[spe][det]) {
1254  delete fCompBandMin[spe][det];
1255  }
1256  fCompBandMin[spe][det] = new TF1(*min);
1257 
1258  if (fCompBandMax[spe][det]) {
1259  delete fCompBandMax[spe][det];
1260  }
1261  fCompBandMax[spe][det] = new TF1(*max);
1262 }
1263 
1264 //------------------
1265 Bool_t AliAODPidHF::CheckDetectorPIDStatus(AliPIDResponse::EDetector detector, AliAODTrack* track) {
1266  switch (detector) {
1267  case AliPIDResponse::kITS:
1268  return CheckITSPIDStatus(track);
1269  break;
1270  case AliPIDResponse::kTPC:
1271  return CheckTPCPIDStatus(track);
1272  break;
1273  case AliPIDResponse::kTRD:
1274  return CheckTRDPIDStatus(track);
1275  break;
1276  case AliPIDResponse::kTOF:
1277  return CheckTOFPIDStatus(track);
1278  break;
1279  default:
1280  return kFALSE;
1281  break;
1282  }
1283 }
1284 
1285 //------------------
1286 Float_t AliAODPidHF::NumberOfSigmas(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, AliAODTrack *track) {
1287  switch (detector) {
1288  case AliPIDResponse::kITS:
1289  return fPidResponse->NumberOfSigmasITS(track, specie);
1290  break;
1291  case AliPIDResponse::kTPC:
1292  return fPidResponse->NumberOfSigmasTPC(track, specie);
1293  break;
1294  case AliPIDResponse::kTOF:
1295  return fPidResponse->NumberOfSigmasTOF(track, specie);
1296  break;
1297  default:
1298  return -999.;
1299  break;
1300  }
1301 }
1302 
1303 //------------------
1304 Int_t AliAODPidHF::CheckBands(AliPID::EParticleType specie, AliPIDResponse::EDetector detector, AliAODTrack *track) {
1306 
1307  Int_t spe = (Int_t) specie;
1308  Int_t det = (Int_t) detector;
1309 
1310  if (!fPidResponse || spe >= AliPID::kSPECIES) {
1311  return -1;
1312  }
1313 
1314  if (!CheckDetectorPIDStatus(detector, track)) {
1315  return 0;
1316  }
1317 
1318  Double_t P = track->P();
1319 
1320  Float_t nSigma = NumberOfSigmas(specie, detector, track);
1321  Float_t minContent, maxContent;
1322  Bool_t hasAnyBand = kFALSE;
1323 
1324  //Check if within identification band, return 1
1325  TF1 *IdBandMin = fIdBandMin[spe][det];
1326  TF1 *IdBandMax = fIdBandMax[spe][det];
1327 
1328  if (IdBandMin && IdBandMax) {
1329  minContent = IdBandMin->IsInside(&P) ? IdBandMin->Eval(P) : 0;
1330  maxContent = IdBandMax->IsInside(&P) ? IdBandMax->Eval(P) : 0;
1331  if (minContent != 0 || maxContent != 0) {
1332  //At least one identification band is set at this momentum
1333  hasAnyBand = kTRUE;
1334  if ((minContent == 0 || nSigma >= minContent) && (maxContent == 0 || nSigma <= maxContent)) {
1335  return 1;
1336  }
1337  }
1338  }
1339 
1340  //Check if within compatibility band, return 0
1341  TF1 *CompBandMin = fCompBandMin[spe][det];
1342  TF1 *CompBandMax = fCompBandMax[spe][det];
1343 
1344  if (CompBandMin && CompBandMax) {
1345  minContent = CompBandMin->IsInside(&P) ? CompBandMin->Eval(P) : 0;
1346  maxContent = CompBandMax->IsInside(&P) ? CompBandMax->Eval(P) : 0;
1347  if (minContent != 0 || maxContent != 0) {
1348  //At least one compatibility band is set at this momentum
1349  hasAnyBand = kTRUE;
1350  if ((minContent == 0 || nSigma >= minContent) && (maxContent == 0 || nSigma <= maxContent)) {
1351  return 0;
1352  }
1353  }
1354  }
1355 
1356  if (!hasAnyBand) {
1357  //No bands
1358  return 0;
1359  }
1360 
1361  //Bands were set and checked, but no match
1362  return -1;
1363 }
1364 
1365 //------------------
1367  SetMatch(10);
1368  SetTPC(kTRUE);
1369  SetTOF(kTRUE);
1370 
1371  //TPC K: shift by -0.2
1372  TF1 *TPCCompBandMinK = new TF1("TPCCompBandMinK", "[0]", 0, 24); TPCCompBandMinK->SetParameter(0, -3.2);
1373  TF1 *TPCCompBandMaxK = new TF1("TPCCompBandMaxK", "[0]", 0, 24); TPCCompBandMaxK->SetParameter(0, 2.8);
1374  SetCompBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCCompBandMinK, TPCCompBandMaxK);
1375 
1376  TF1 *TPCIdBandMinK = new TF1("TPCIdBandMinK", "[0]", 0, 24); TPCIdBandMinK->SetParameter(0, -2.2);
1377  TF1 *TPCIdBandMaxK = new TF1("TPCIdBandMaxK", "[0]", 0, 24); TPCIdBandMaxK->SetParameter(0, 1.8);
1378  SetIdBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCIdBandMinK, TPCIdBandMaxK);
1379 
1380  //TPC pi: shift by -0.14
1381  TF1 *TPCCompBandMinPi = new TF1("TPCCompBandMinPi", "[0]", 0, 24); TPCCompBandMinPi->SetParameter(0, -3.14);
1382  TF1 *TPCCompBandMaxPi = new TF1("TPCCompBandMaxPi", "[0]", 0, 24); TPCCompBandMaxPi->SetParameter(0, 2.86);
1383  SetCompBand(AliPID::kPion, AliPIDResponse::kTPC, TPCCompBandMinPi, TPCCompBandMaxPi);
1384 
1385  TF1 *TPCIdBandMinPi = new TF1("TPCIdBandMinPi", "[0]", 0, 24); TPCIdBandMinPi->SetParameter(0, -2.14);
1386  TF1 *TPCIdBandMaxPi = new TF1("TPCIdBandMaxPi", "[0]", 0, 24); TPCIdBandMaxPi->SetParameter(0, 1.86);
1387  SetIdBand(AliPID::kPion, AliPIDResponse::kTPC, TPCIdBandMinPi, TPCIdBandMaxPi);
1388 
1389  //TOF K: shift by -0.1
1390  TF1 *TOFCompBandMinK = new TF1("TOFCompBandMinK", "[0]", 2, 24); TOFCompBandMinK->SetParameter(0, -3.1);
1391  TF1 *TOFCompBandMaxK = new TF1("TOFCompBandMaxK", "[0]", 2, 24); TOFCompBandMaxK->SetParameter(0, 2.9);
1392  SetCompBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFCompBandMinK, TOFCompBandMaxK);
1393 
1394  TF1 *TOFIdBandMinK = new TF1("TOFIdBandMinK", "[0]", 0, 2); TOFIdBandMinK->SetParameter(0, -3.1);
1395  TF1 *TOFIdBandMaxK = new TF1("TOFIdBandMaxK", "[0]", 0, 2); TOFIdBandMaxK->SetParameter(0, 2.9);
1396  SetIdBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFIdBandMinK, TOFIdBandMaxK);
1397 
1398  //TOF pi: shift by -0.15
1399  TF1 *TOFCompBandMinPi = new TF1("TOFCompBandMinPi", "[0]", 2, 24); TOFCompBandMinPi->SetParameter(0, -3.15);
1400  TF1 *TOFCompBandMaxPi = new TF1("TOFCompBandMaxPi", "[0]", 2, 24); TOFCompBandMaxPi->SetParameter(0, 2.85);
1401  SetCompBand(AliPID::kPion, AliPIDResponse::kTOF, TOFCompBandMinPi, TOFCompBandMaxPi);
1402 
1403  TF1 *TOFIdBandMinPi = new TF1("TOFIdBandMinPi", "[0]", 0, 2); TOFIdBandMinPi->SetParameter(0, -3.15);
1404  TF1 *TOFIdBandMaxPi = new TF1("TOFIdBandMaxPi", "[0]", 0, 2); TOFIdBandMaxPi->SetParameter(0, 2.85);
1405  SetIdBand(AliPID::kPion, AliPIDResponse::kTOF, TOFIdBandMinPi, TOFIdBandMaxPi);
1406 }
1407 
1408 //------------------
1411 
1412  SetMatch(10);
1413  SetTPC(kTRUE);
1414  SetTOF(kTRUE);
1415 
1416  //TPC K
1417  Double_t TPCIdBandMinKBins[] = {0, 0.4, 0.5, 0.6, 0.9, 24};
1418  TH1F *TPCIdBandMinK = new TH1F("TPCIdBandMinK", "TPC Id Band Min K", 5, TPCIdBandMinKBins);
1419  TPCIdBandMinK->SetBinContent(1, -3); //0 - 0.4
1420  TPCIdBandMinK->SetBinContent(2, -2); //0.4 - 0.5
1421  TPCIdBandMinK->SetBinContent(3, -3); //0.5 - 0.6
1422  TPCIdBandMinK->SetBinContent(4, -2); //0.6 - 0.9
1423  TPCIdBandMinK->SetBinContent(5, -3); //0.9 - 24
1424 
1425  Double_t TPCIdBandMaxKBins[] = {0, 0.6, 0.7, 24};
1426  TH1F *TPCIdBandMaxK = new TH1F("TPCIdBandMaxK", "TPC Id Band Max K", 3, TPCIdBandMaxKBins);
1427  TPCIdBandMaxK->SetBinContent(1, 3); //0 - 0.6
1428  TPCIdBandMaxK->SetBinContent(2, 2); //0.6 - 0.7
1429  TPCIdBandMaxK->SetBinContent(3, 3); //0.7 - 24
1430 
1431  SetIdBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCIdBandMinK, TPCIdBandMaxK);
1432  GetIdBandMin(AliPID::kKaon, AliPIDResponse::kTPC)->SetNpx(5000);
1433  GetIdBandMax(AliPID::kKaon, AliPIDResponse::kTPC)->SetNpx(5000);
1434 
1435  //TPC pi
1436  Double_t TPCIdBandMinpiBins[] = {0, 24};
1437  TH1F *TPCIdBandMinpi = new TH1F("TPCIdBandMinpi", "TPC Id Band Min pi", 1, TPCIdBandMinpiBins);
1438  TPCIdBandMinpi->SetBinContent(1, -3); //0 - 24
1439 
1440  Double_t TPCIdBandMaxpiBins[] = {0, 0.7, 0.9, 1.3, 1.4, 24};
1441  TH1F *TPCIdBandMaxpi = new TH1F("TPCIdBandMaxpi", "TPC Id Band Max pi", 5, TPCIdBandMaxpiBins);
1442  TPCIdBandMaxpi->SetBinContent(1, 3); //0 - 0.7
1443  TPCIdBandMaxpi->SetBinContent(2, 2); //0.7 - 0.9
1444  TPCIdBandMaxpi->SetBinContent(3, 3); //0.9 - 1.3
1445  TPCIdBandMaxpi->SetBinContent(4, 2); //1.3 - 1.4
1446  TPCIdBandMaxpi->SetBinContent(5, 3); //1.4 - 24
1447 
1448  SetIdBand(AliPID::kPion, AliPIDResponse::kTPC, TPCIdBandMinpi, TPCIdBandMaxpi);
1449  GetIdBandMin(AliPID::kPion, AliPIDResponse::kTPC)->SetNpx(5000);
1450  GetIdBandMax(AliPID::kPion, AliPIDResponse::kTPC)->SetNpx(5000);
1451 
1452  //TOF K
1453  TF1 *TOFIdBandMinK = new TF1("TOFIdBandMinK", "[0]", 0, 24); TOFIdBandMinK->SetParameter(0, -3);
1454  TF1 *TOFIdBandMaxK = new TF1("TOFIdBandMaxK", "[0]", 0, 24); TOFIdBandMaxK->SetParameter(0, 3);
1455 
1456  SetIdBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFIdBandMinK, TOFIdBandMaxK);
1457 
1458  //TOF pi
1459  TF1 *TOFIdBandMinPi = new TF1("TOFIdBandMinPi", "[0]", 0, 24); TOFIdBandMinPi->SetParameter(0, -3);
1460  TF1 *TOFIdBandMaxPi = new TF1("TOFIdBandMaxPi", "[0]", 0, 24); TOFIdBandMaxPi->SetParameter(0, 3);
1461 
1462  SetIdBand(AliPID::kPion, AliPIDResponse::kTOF, TOFIdBandMinPi, TOFIdBandMaxPi);
1463 }
1464 
1465 //------------------
1468 
1469  SetMatch(10);
1470  SetTPC(kTRUE);
1471  SetTOF(kTRUE);
1472 
1473  //TPC K
1474  TF1 *TPCCompBandMinK = new TF1("TPCCompBandMinK", "[0]", 0, 24); TPCCompBandMinK->SetParameter(0, -3);
1475  TF1 *TPCCompBandMaxK = new TF1("TPCCompBandMaxK", "[0]", 0, 24); TPCCompBandMaxK->SetParameter(0, 3);
1476 
1477  SetCompBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCCompBandMinK, TPCCompBandMaxK);
1478 
1479  Double_t TPCIdBandMinKBins[6] = {0, 0.45, 0.55, 0.7, 1.1, 24};
1480  TH1F *TPCIdBandMinK = new TH1F("TPCIdBandMinK", "TPC Id Band Min K", 5, TPCIdBandMinKBins);
1481  TPCIdBandMinK->SetBinContent(1, -2); //0-0.45
1482  TPCIdBandMinK->SetBinContent(2, -1); //0.45-0.55
1483  TPCIdBandMinK->SetBinContent(3, -2); //0.55-0.7
1484  TPCIdBandMinK->SetBinContent(4, -1); //0.7-1.1
1485  TPCIdBandMinK->SetBinContent(5, -2); //1.1-24
1486 
1487  Double_t TPCIdBandMaxKBins[4] = {0, 0.5, 0.7, 24};
1488  TH1F *TPCIdBandMaxK = new TH1F("TPCIdBandMaxK", "TPC Id Band Max K", 3, TPCIdBandMaxKBins);
1489  TPCIdBandMaxK->SetBinContent(1, 2); //0-0.5
1490  TPCIdBandMaxK->SetBinContent(2, 1); //0.5-0.7
1491  TPCIdBandMaxK->SetBinContent(3, 2); //0.7-24
1492 
1493  SetIdBand(AliPID::kKaon, AliPIDResponse::kTPC, TPCIdBandMinK, TPCIdBandMaxK);
1494  GetIdBandMin(AliPID::kKaon, AliPIDResponse::kTPC)->SetNpx(5000);
1495  GetIdBandMax(AliPID::kKaon, AliPIDResponse::kTPC)->SetNpx(5000);
1496 
1497  //TPC pi
1498  TF1 *TPCCompBandMinpi = new TF1("TPCCompBandMinpi", "[0]", 0, 24); TPCCompBandMinpi->SetParameter(0, -3);
1499  TF1 *TPCCompBandMaxpi = new TF1("TPCCompBandMaxpi", "[0]", 0, 24); TPCCompBandMaxpi->SetParameter(0, 3);
1500 
1501  SetCompBand(AliPID::kPion, AliPIDResponse::kTPC, TPCCompBandMinpi, TPCCompBandMaxpi);
1502 
1503  Double_t TPCIdBandMinpiBins[2] = {0, 24};
1504  TH1F *TPCIdBandMinpi = new TH1F("TPCIdBandMinpi", "TPC Id Band Min pi", 1, TPCIdBandMinpiBins);
1505  TPCIdBandMinpi->SetBinContent(1, -2); //0-24
1506 
1507  Double_t TPCIdBandMaxpiBins[4] = {0, 0.7, 1.7, 24};
1508  TH1F *TPCIdBandMaxpi = new TH1F("TPCIdBandMaxpi", "TPC Id Band Max pi", 3, TPCIdBandMaxpiBins);
1509  TPCIdBandMaxpi->SetBinContent(1, 2); //0-0.7
1510  TPCIdBandMaxpi->SetBinContent(2, 1); //0.7-1.7
1511  TPCIdBandMaxpi->SetBinContent(3, 2); //1.7-24
1512 
1513  SetIdBand(AliPID::kPion, AliPIDResponse::kTPC, TPCIdBandMinpi, TPCIdBandMaxpi);
1514  GetIdBandMin(AliPID::kPion, AliPIDResponse::kTPC)->SetNpx(5000);
1515  GetIdBandMax(AliPID::kPion, AliPIDResponse::kTPC)->SetNpx(5000);
1516 
1517  //TOF K
1518  TF1 *TOFCompBandMinK = new TF1("TOFCompBandMinK", "[0]", 2, 24); TOFCompBandMinK->SetParameter(0, -3);
1519  TF1 *TOFCompBandMaxK = new TF1("TOFCompBandMaxK", "[0]", 2, 24); TOFCompBandMaxK->SetParameter(0, 3);
1520 
1521  SetCompBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFCompBandMinK, TOFCompBandMaxK);
1522 
1523  TF1 *TOFIdBandMinK = new TF1("TOFIdBandMinK", "[0]", 0, 2); TOFIdBandMinK->SetParameter(0, -3);
1524  TF1 *TOFIdBandMaxK = new TF1("TOFIdBandMaxK", "[0]", 0, 2); TOFIdBandMaxK->SetParameter(0, 3);
1525 
1526  SetIdBand(AliPID::kKaon, AliPIDResponse::kTOF, TOFIdBandMinK, TOFIdBandMaxK);
1527 
1528  //TOF pi
1529  TF1 *TOFCompBandMinpi = new TF1("TOFCompBandMinpi", "[0]", 2, 24); TOFCompBandMinpi->SetParameter(0, -3);
1530  TF1 *TOFCompBandMaxpi = new TF1("TOFCompBandMaxpi", "[0]", 2, 24); TOFCompBandMaxpi->SetParameter(0, 3);
1531 
1532  SetCompBand(AliPID::kPion, AliPIDResponse::kTOF, TOFCompBandMinpi, TOFCompBandMaxpi);
1533 
1534  TF1 *TOFIdBandMinpi = new TF1("TOFIdBandMinpi", "[0]", 0, 2); TOFIdBandMinpi->SetParameter(0, -3);
1535  TF1 *TOFIdBandMaxpi = new TF1("TOFIdBandMaxpi", "[0]", 0, 2); TOFIdBandMaxpi->SetParameter(0, 3);
1536 
1537  SetIdBand(AliPID::kPion, AliPIDResponse::kTOF, TOFIdBandMinpi, TOFIdBandMaxpi);
1538 }
void SetIdAsymmetricPID()
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
#define P(T, U, S)
Bool_t fppLowEn2011
MC for low energy MC.
Definition: AliAODPidHF.h:271
double Double_t
Definition: External.C:58
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
int Int_t
Definition: External.C:63
virtual ~AliAODPidHF()
unsigned int UInt_t
Definition: External.C:33
AliPIDCombined * GetPidCombined() const
Definition: AliAODPidHF.h:161
float Float_t
Definition: External.C:68
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
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
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
unsigned short UShort_t
Definition: External.C:28
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 Bool_t
Definition: External.C:53
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