AliPhysics  3337bb0 (3337bb0)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliHelperPID.h
Go to the documentation of this file.
1 #ifndef ALIHELPERPID_H
2 #define ALIHELPERPID_H
3 
4 class AliAODEvent;
5 class AliVEvent;
6 class TH1F;
7 class TH2F;
8 class TList;
9 class AliVTrack;
10 class AliVParticle;
11 class AliStack;
12 class TParticle;
13 class AliPIDResponse;
14 class AliPIDCombined;
15 
16 #include "TNamed.h"
17 
18 namespace AliHelperPIDNameSpace {
19 
20  enum PIDType_t
21  {
24  kNSigmaTPCTOF, // squared sum
26  };
27 
28  const Int_t kNSigmaPIDType=kNSigmaTPCTOF;//number of Nsigma PID types
29 
31  {
32  kITS = 0,
36  };
37 
38 
40  {
41  kSpPion = 0,
46  }; // Particle species used in plotting
47 
48 
50  {
51  kChPos = 0,
54  };
55 }
56 
57 using namespace AliHelperPIDNameSpace;
58 
59 class AliHelperPID : public TNamed
60 {
61  public:
62 
63  AliHelperPID();
64  virtual ~AliHelperPID() {}
65 
66  //MC or data
67  Bool_t GetisMC(){return fisMC;}
68  void SetisMC(Bool_t mc){fisMC=mc;}
69  //PID Type
70  void SetPIDType(PIDType_t PIDType) { fPIDType = PIDType; }
71  PIDType_t GetPIDType() {return fPIDType; }
72  //NSigma cut
73  void SetNSigmaCut(Double_t nsigma) { fNSigmaPID = nsigma; }
74  Double_t GetNSigmaCut() {return fNSigmaPID; }
75  //TOF PID
76  void SetfRequestTOFPID(Bool_t tof){fRequestTOFPID=tof;}//fRequestTOFPID
77  Bool_t GetfRequestTOFPID(){return fRequestTOFPID;}//fRequestTOFPID
78  void SetfRemoveTracksT0Fill(Bool_t tof){fRemoveTracksT0Fill=tof;}//fRemoveTracksT0Fill
79  Bool_t GetfRemoveTracksT0Fill(){return fRemoveTracksT0Fill;}//fRemoveTracksT0Fill
80  //Exclusive NSIgma
81  void SetfUseExclusiveNSigma(Bool_t nsigEx){fUseExclusiveNSigma=nsigEx;}//fUseExclusiveNSigma
82  Bool_t GetfUseExclusiveNSigma(){return fUseExclusiveNSigma;}//fUseExclusiveNSigma
83  //lower pt fot TOF PID
84  Double_t GetPtTOFPID(){return fPtTOFPID;}
85  void SetfPtTOFPID(Double_t pttof){fPtTOFPID=pttof;}
86  //set PID Combined
87  void SetPIDCombined(AliPIDCombined *obj){fPIDCombined=obj;}
88  //void SetPIDCombined(AliPIDCombined *obj){Printf("void AliHelperPID::SetPIDCombined(AliPIDCombined *obj) not implemented");} //FIXME Left for backward compatibility, not the PIDCombined onject is created in the constructor as done in /ANALYSIS/AliAnalysisTaskPIDCombined.cxx (Jul 15th 2014)
89  AliPIDCombined *GetPIDCombined(){return fPIDCombined;}
90  //set cut on beyesian probability
91  void SetBayesCut(Double_t cut){fBayesCut=cut;}
92  Double_t GetBayesCut(){return fBayesCut;}
93 
94  //getters of the other data members
95  TList * GetOutputList() {return fOutputList;}//get the TList with histos
96  Double_t* GetNSigmas(AliHelperParticleSpecies_t species) {return fnsigmas[species];}//get nsigma[ipart][idet], calculated in CalculateNSigmas(trk)
97  Bool_t* GetfHasDoubleCounting() {return fHasDoubleCounting;}//get fHasDoubleCounting[ipart], calculated in GetDoubleCounting(trk)
98  //getter of histo "name" from fOutput
99  TH2F* GetHistogram2D(const char * name);//return histogram "name" from fOutputList
100 
101  //PID functions
102  // User should call ONLY the function GetParticleSpecies and set the PID strategy in the steering macro!
103  Int_t GetParticleSpecies(AliVTrack * trk, Bool_t FIllQAHistos);//calculate the PID according to the slected method.
104  Int_t GetParticleSpecies(AliVParticle * part);
105 
106  Int_t GetIDBayes(AliVTrack * trk, Bool_t FIllQAHistos);//calculate the PID according to bayesian PID
107  UInt_t CalcPIDCombined(const AliVTrack *track,const AliPIDResponse *PIDResponse, Int_t detMask, Double_t* prob) const;
108  void CalculateNSigmas(AliVTrack * trk, Bool_t FIllQAHistos);//Calcuate nsigma[ipart][idet], fill NSigma histos
109  Int_t FindMinNSigma(AliVTrack * trk, Bool_t FIllQAHistos);//retun the minimum Nsigma
110  Bool_t* GetDoubleCounting(AliVTrack * trk, Bool_t FIllQAHistos);//if a particle has double counting set fHasDoubleCounting[ipart]=kTRUE (only for the second or third identity)
111  Bool_t* GetAllCompatibleIdentitiesNSigma(AliVTrack * trk, Bool_t FIllQAHistos);//All the identities are true
112  Int_t GetMCParticleSpecie(AliVEvent* event, AliVTrack * trk, Bool_t FIllQAHistos);//calculate the PID according to MC truth
113  void CheckTOF(AliVTrack * trk);//check the TOF matching and set fHasTOFPID
114  Double_t TOFBetaCalc(AliVTrack *track) const;
115  Double_t GetMass(AliHelperParticleSpecies_t id) const;
117 
118  private:
119 
121  PIDType_t fPIDType; // PID type
122  Double_t fNSigmaPID; // number of sigma for PID cut
123  Double_t fBayesCut; // Cut on Bayesian probability
124  AliPIDResponse *fPIDResponse;
125  AliPIDCombined *fPIDCombined; // PIDCombined
126  TList *fOutputList; // List Histo's
127  Double_t fnsigmas[kNSpecies][kNSigmaPIDType+1]; //nsigma values
128  Bool_t fHasDoubleCounting[kNSpecies];//array with compatible identities
129  Bool_t fRequestTOFPID;//if true returns kSpUndefined if the TOF signal is missing
130  Bool_t fRemoveTracksT0Fill;//if true remove tracks for which only StartTime from To-Fill is available (worst resolution)
131  Bool_t fUseExclusiveNSigma;//if true returns the identity only if no double counting
132  Double_t fPtTOFPID; //lower pt bound for the TOF pid
134 
135  AliHelperPID(const AliHelperPID&);
136  AliHelperPID& operator=(const AliHelperPID&);
137 
138  ClassDef(AliHelperPID, 8);
139 
140 };
141 #endif
142 
143 
Bool_t fHasTOFPID
Definition: AliHelperPID.h:133
Bool_t GetfRequestTOFPID()
Definition: AliHelperPID.h:77
double Double_t
Definition: External.C:58
void SetfPtTOFPID(Double_t pttof)
Definition: AliHelperPID.h:85
Definition: External.C:236
void SetisMC(Bool_t mc)
Definition: AliHelperPID.h:68
Bool_t fRequestTOFPID
Definition: AliHelperPID.h:129
long long Long64_t
Definition: External.C:43
Bool_t fUseExclusiveNSigma
Definition: AliHelperPID.h:131
Double_t GetNSigmaCut()
Definition: AliHelperPID.h:74
TList * list
TDirectory file where lists per trigger are stored in train ouput.
PIDType_t GetPIDType()
Definition: AliHelperPID.h:71
void SetNSigmaCut(Double_t nsigma)
Definition: AliHelperPID.h:73
Double_t GetPtTOFPID()
Definition: AliHelperPID.h:84
void SetfUseExclusiveNSigma(Bool_t nsigEx)
Definition: AliHelperPID.h:81
Bool_t GetfUseExclusiveNSigma()
Definition: AliHelperPID.h:82
Double_t fNSigmaPID
Definition: AliHelperPID.h:122
void SetBayesCut(Double_t cut)
Definition: AliHelperPID.h:91
void SetPIDType(PIDType_t PIDType)
Definition: AliHelperPID.h:70
AliPIDResponse * fPIDResponse
Definition: AliHelperPID.h:124
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
AliPIDCombined * fPIDCombined
PID response object.
Definition: AliHelperPID.h:125
PIDType_t fPIDType
Definition: AliHelperPID.h:121
Double_t fBayesCut
Definition: AliHelperPID.h:123
void SetfRequestTOFPID(Bool_t tof)
Definition: AliHelperPID.h:76
Double_t nsigma
void SetfRemoveTracksT0Fill(Bool_t tof)
Definition: AliHelperPID.h:78
Double_t fPtTOFPID
Definition: AliHelperPID.h:132
Bool_t GetfRemoveTracksT0Fill()
Definition: AliHelperPID.h:79
TH1 * Merge(const TH1 *cen, const TH1 *fwd, Double_t &xlow, Double_t &xhigh)
TList * fOutputList
Definition: AliHelperPID.h:126
virtual ~AliHelperPID()
Definition: AliHelperPID.h:64
AliPIDCombined * GetPIDCombined()
Definition: AliHelperPID.h:89
Double_t GetBayesCut()
Definition: AliHelperPID.h:92
Double_t * GetNSigmas(AliHelperParticleSpecies_t species)
Definition: AliHelperPID.h:96
TList * GetOutputList()
Definition: AliHelperPID.h:95
bool Bool_t
Definition: External.C:53
Bool_t fRemoveTracksT0Fill
Definition: AliHelperPID.h:130
Bool_t * GetfHasDoubleCounting()
Definition: AliHelperPID.h:97
Bool_t GetisMC()
Definition: AliHelperPID.h:67
void SetPIDCombined(AliPIDCombined *obj)
Definition: AliHelperPID.h:87
const Int_t kNSigmaPIDType
Definition: AliHelperPID.h:28