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