]>
Commit | Line | Data |
---|---|---|
29bf19f2 | 1 | #ifndef ALIPIDRESPONSE_H |
2 | #define ALIPIDRESPONSE_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | //---------------------------------------------------------------// | |
7 | // Base class for handling the pid response // | |
8 | // functions of all detectors // | |
9 | // and give access to the nsigmas // | |
10 | // // | |
11 | // Origin: Jens Wiechula, Uni Tuebingen, jens.wiechula@cern.ch // | |
12 | //---------------------------------------------------------------// | |
13 | ||
14 | #include "AliITSPIDResponse.h" | |
15 | #include "AliTPCPIDResponse.h" | |
16 | #include "AliTRDPIDResponse.h" | |
17 | #include "AliTOFPIDResponse.h" | |
e96b9916 | 18 | #include "AliEMCALPIDResponse.h" |
29bf19f2 | 19 | |
20 | #include "AliVParticle.h" | |
21 | #include "AliVTrack.h" | |
22 | ||
23 | #include "TNamed.h" | |
24 | ||
25 | class AliVEvent; | |
4ec8e76d | 26 | class TF1; |
29bf19f2 | 27 | |
28 | class AliPIDResponse : public TNamed { | |
29 | public: | |
4ec8e76d | 30 | AliPIDResponse(Bool_t isMC=kFALSE); |
31 | virtual ~AliPIDResponse(); | |
29bf19f2 | 32 | |
fd21ec8d | 33 | enum EDetCode { |
34 | kDetITS = 0x1, | |
35 | kDetTPC = 0x2, | |
36 | kDetTRD = 0x4, | |
37 | kDetTOF = 0x8, | |
38 | kDetHMPID = 0x10, | |
39 | kDetEMCAL = 0x20, | |
40 | kDetPHOS = 0x40 | |
41 | }; | |
42 | ||
29bf19f2 | 43 | enum EStartTimeType_t {kFILL_T0,kTOF_T0, kT0_T0, kBest_T0}; |
fd21ec8d | 44 | |
45 | enum ITSPIDmethod { kITSTruncMean, kITSLikelihood }; | |
46 | ||
47 | enum EDetPidStatus { | |
48 | kDetNoSignal=0, | |
49 | kDetPidOk=1, | |
50 | kDetMismatch=2 | |
51 | }; | |
29bf19f2 | 52 | |
53 | AliITSPIDResponse &GetITSResponse() {return fITSResponse;} | |
54 | AliTPCPIDResponse &GetTPCResponse() {return fTPCResponse;} | |
55 | AliTOFPIDResponse &GetTOFResponse() {return fTOFResponse;} | |
56 | AliTRDPIDResponse &GetTRDResponse() {return fTRDResponse;} | |
e96b9916 | 57 | AliEMCALPIDResponse &GetEMCALResponse() {return fEMCALResponse;} |
fd21ec8d | 58 | |
59 | Float_t NumberOfSigmas(EDetCode detCode, const AliVParticle *track, AliPID::EParticleType type) const; | |
29bf19f2 | 60 | |
61 | virtual Float_t NumberOfSigmasITS(const AliVParticle *track, AliPID::EParticleType type) const; | |
62 | virtual Float_t NumberOfSigmasTPC(const AliVParticle *track, AliPID::EParticleType type) const; | |
e96b9916 | 63 | virtual Float_t NumberOfSigmasEMCAL(const AliVTrack *track, AliPID::EParticleType type) const; |
29bf19f2 | 64 | virtual Float_t NumberOfSigmasTOF(const AliVParticle *track, AliPID::EParticleType type) const = 0; |
ea235c90 | 65 | virtual Bool_t IdentifiedAsElectronTRD(const AliVTrack *track, Double_t efficiencyLevel) const; |
29bf19f2 | 66 | |
fd21ec8d | 67 | EDetPidStatus ComputePIDProbability (EDetCode detCode, const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; |
68 | ||
69 | EDetPidStatus ComputeITSProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
70 | EDetPidStatus ComputeTPCProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
71 | EDetPidStatus ComputeTOFProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
72 | EDetPidStatus ComputeTRDProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
73 | EDetPidStatus ComputeEMCALProbability(const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
74 | EDetPidStatus ComputePHOSProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
75 | EDetPidStatus ComputeHMPIDProbability(const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
76 | ||
77 | ||
78 | void SetITSPIDmethod(ITSPIDmethod pmeth) { fITSPIDmethod = pmeth; } | |
4ec8e76d | 79 | virtual void SetTOFResponse(AliVEvent */*event*/,EStartTimeType_t /*option*/) {;} |
ea235c90 | 80 | void SetTRDslicesForPID(UInt_t slice1, UInt_t slice2) {fTRDslicesForPID[0]=slice1;fTRDslicesForPID[1]=slice2;} |
81 | ||
4ec8e76d | 82 | void SetOADBPath(const char* path) {fOADBPath=path;} |
80f28562 | 83 | const char *GetOADBPath() const {return fOADBPath.Data();} |
4ec8e76d | 84 | void InitialiseEvent(AliVEvent *event, Int_t pass); |
ea235c90 | 85 | void SetCurrentFile(const char* file) { fCurrentFile=file; } |
4ec8e76d | 86 | |
e96b9916 | 87 | AliVEvent * GetCurrentEvent() const {return fCurrentEvent;} |
88 | ||
fd21ec8d | 89 | // User settings for the MC period and reco pass |
90 | void SetMCperiod(const char *mcPeriod) {fMCperiodUser=mcPeriod;} | |
91 | void SetRecoPass(Int_t recoPass) {fRecoPassUser=recoPass;} | |
80f28562 | 92 | |
93 | // event info | |
94 | Float_t GetCurrentCentrality() const {return fCurrCentrality;}; | |
95 | ||
4ec8e76d | 96 | AliPIDResponse(const AliPIDResponse &other); |
97 | AliPIDResponse& operator=(const AliPIDResponse &other); | |
80f28562 | 98 | |
29bf19f2 | 99 | |
100 | protected: | |
101 | AliITSPIDResponse fITSResponse; //PID response function of the ITS | |
102 | AliTPCPIDResponse fTPCResponse; //PID response function of the TPC | |
103 | AliTRDPIDResponse fTRDResponse; //PID response function of the TRD | |
104 | AliTOFPIDResponse fTOFResponse; //PID response function of the TOF | |
e96b9916 | 105 | AliEMCALPIDResponse fEMCALResponse; //PID response function of the EMCAL |
4ec8e76d | 106 | |
fd21ec8d | 107 | Float_t fRange; // nSigma max in likelihood |
108 | ITSPIDmethod fITSPIDmethod; // 0 = trunc mean; 1 = likelihood | |
109 | ||
4ec8e76d | 110 | private: |
111 | Bool_t fIsMC; // If we run on MC data | |
112 | ||
113 | TString fOADBPath; // OADB path to use | |
114 | ||
115 | TString fBeamType; //! beam type (PP) or (PBPB) | |
116 | TString fLHCperiod; //! LHC period | |
117 | TString fMCperiodTPC; //! corresponding MC period to use for the TPC splines | |
fd21ec8d | 118 | TString fMCperiodUser; // MC prodution requested by the user |
ea235c90 | 119 | TString fCurrentFile; //! name of currently processed file |
4ec8e76d | 120 | Int_t fRecoPass; //! reconstruction pass |
fd21ec8d | 121 | Int_t fRecoPassUser; // reconstruction pass explicitly set by the user |
4ec8e76d | 122 | Int_t fRun; //! current run number |
123 | Int_t fOldRun; //! current run number | |
fd21ec8d | 124 | |
4ec8e76d | 125 | TObjArray *fArrPidResponseMaster; //! TPC pid splines |
126 | TF1 *fResolutionCorrection; //! TPC resolution correction | |
127 | ||
ce487a7f | 128 | AliTRDPIDParams *fTRDPIDParams; //! TRD PID Params |
ea235c90 | 129 | AliTRDPIDReference *fTRDPIDReference; //! TRD PID References |
130 | UInt_t fTRDslicesForPID[2]; //! TRD PID slices | |
131 | ||
4ec8e76d | 132 | Int_t fTOFTimeZeroType; //! default start time type for tof (ESD) |
133 | Float_t fTOFres; //! TOF resolution | |
e96b9916 | 134 | |
b2138b40 | 135 | TObjArray *fEMCALPIDParams; //! EMCAL PID Params |
136 | ||
e96b9916 | 137 | AliVEvent *fCurrentEvent; //! event currently being processed |
80f28562 | 138 | |
139 | Float_t fCurrCentrality; //! current centrality | |
4ec8e76d | 140 | |
141 | void ExecNewRun(); | |
142 | ||
143 | // | |
144 | //setup parametrisations | |
145 | // | |
146 | ||
147 | //ITS | |
148 | void SetITSParametrisation(); | |
149 | ||
150 | //TPC | |
151 | void SetTPCPidResponseMaster(); | |
152 | void SetTPCParametrisation(); | |
153 | Double_t GetTPCMultiplicityBin(const AliVEvent * const event); | |
154 | ||
ea235c90 | 155 | //TRD |
156 | void SetTRDPidResponseMaster(); | |
157 | void InitializeTRDResponse(); | |
158 | ||
4ec8e76d | 159 | //TOF |
b2138b40 | 160 | |
161 | //EMCAL | |
162 | void SetEMCALPidResponseMaster(); | |
163 | void InitializeEMCALResponse(); | |
164 | ||
4ec8e76d | 165 | // |
166 | void SetRecoInfo(); | |
29bf19f2 | 167 | |
80f28562 | 168 | ClassDef(AliPIDResponse,4); //PID response handling |
29bf19f2 | 169 | }; |
170 | ||
171 | inline Float_t AliPIDResponse::NumberOfSigmasTPC(const AliVParticle *vtrack, AliPID::EParticleType type) const { | |
172 | AliVTrack *track=(AliVTrack*)vtrack; | |
173 | Double_t mom = track->GetTPCmomentum(); | |
174 | Double_t sig = track->GetTPCsignal(); | |
175 | UInt_t sigN = track->GetTPCsignalN(); | |
176 | ||
177 | Double_t nSigma = -999.; | |
178 | if (sigN>0) nSigma=fTPCResponse.GetNumberOfSigmas(mom,sig,sigN,type); | |
179 | ||
180 | return nSigma; | |
181 | } | |
182 | ||
183 | inline Float_t AliPIDResponse::NumberOfSigmasITS(const AliVParticle *vtrack, AliPID::EParticleType type) const { | |
184 | AliVTrack *track=(AliVTrack*)vtrack; | |
185 | Float_t dEdx=track->GetITSsignal(); | |
186 | if (dEdx<=0) return -999.; | |
187 | ||
188 | UChar_t clumap=track->GetITSClusterMap(); | |
189 | Int_t nPointsForPid=0; | |
190 | for(Int_t i=2; i<6; i++){ | |
191 | if(clumap&(1<<i)) ++nPointsForPid; | |
192 | } | |
193 | Float_t mom=track->P(); | |
194 | Bool_t isSA=kTRUE; | |
195 | if(track->GetTPCNcls()>0) isSA=kFALSE; | |
196 | return fITSResponse.GetNumberOfSigmas(mom,dEdx,type,nPointsForPid,isSA); | |
197 | } | |
198 | ||
199 | #endif |