]>
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 | ||
4ec8e76d | 26 | class TF1; |
00a38d07 | 27 | class TObjArray; |
f84b18dd | 28 | class TLinearFitter; |
00a38d07 | 29 | |
30 | class AliVEvent; | |
31 | class AliTRDPIDResponseObject; | |
32 | class AliTOFPIDParams; | |
1c9d11be | 33 | class AliOADBContainer; |
29bf19f2 | 34 | |
35 | class AliPIDResponse : public TNamed { | |
36 | public: | |
4ec8e76d | 37 | AliPIDResponse(Bool_t isMC=kFALSE); |
38 | virtual ~AliPIDResponse(); | |
29bf19f2 | 39 | |
00a38d07 | 40 | enum EDetector { |
41 | kITS=0, | |
42 | kTPC=1, | |
43 | kTRD=2, | |
44 | kTOF=3, | |
45 | kHMPID=4, | |
46 | kEMCAL=5, | |
47 | kPHOS=6, | |
48 | kNdetectors=7 | |
49 | }; | |
50 | ||
fd21ec8d | 51 | enum EDetCode { |
52 | kDetITS = 0x1, | |
53 | kDetTPC = 0x2, | |
54 | kDetTRD = 0x4, | |
55 | kDetTOF = 0x8, | |
56 | kDetHMPID = 0x10, | |
57 | kDetEMCAL = 0x20, | |
58 | kDetPHOS = 0x40 | |
59 | }; | |
60 | ||
29bf19f2 | 61 | enum EStartTimeType_t {kFILL_T0,kTOF_T0, kT0_T0, kBest_T0}; |
fd21ec8d | 62 | |
63 | enum ITSPIDmethod { kITSTruncMean, kITSLikelihood }; | |
64 | ||
65 | enum EDetPidStatus { | |
66 | kDetNoSignal=0, | |
67 | kDetPidOk=1, | |
68 | kDetMismatch=2 | |
69 | }; | |
f84b18dd | 70 | |
29bf19f2 | 71 | AliITSPIDResponse &GetITSResponse() {return fITSResponse;} |
72 | AliTPCPIDResponse &GetTPCResponse() {return fTPCResponse;} | |
73 | AliTOFPIDResponse &GetTOFResponse() {return fTOFResponse;} | |
74 | AliTRDPIDResponse &GetTRDResponse() {return fTRDResponse;} | |
e96b9916 | 75 | AliEMCALPIDResponse &GetEMCALResponse() {return fEMCALResponse;} |
f84b18dd | 76 | |
1c9d11be | 77 | //buffered PID calculation |
00a38d07 | 78 | Float_t NumberOfSigmas(EDetector detCode, const AliVParticle *track, AliPID::EParticleType type) const; |
79 | Float_t NumberOfSigmas(EDetCode detCode, const AliVParticle *track, AliPID::EParticleType type) const; | |
29bf19f2 | 80 | |
00a38d07 | 81 | virtual Float_t NumberOfSigmasITS (const AliVParticle *track, AliPID::EParticleType type) const; |
82 | virtual Float_t NumberOfSigmasTPC (const AliVParticle *track, AliPID::EParticleType type) const; | |
f84b18dd | 83 | virtual Float_t NumberOfSigmasTPC (const AliVParticle *track, AliPID::EParticleType type, AliTPCPIDResponse::ETPCdEdxSource dedxSource) const; |
00a38d07 | 84 | virtual Float_t NumberOfSigmasEMCAL(const AliVParticle *track, AliPID::EParticleType type, Double_t &eop, Double_t showershape[4]) const; |
1c9d11be | 85 | virtual Float_t NumberOfSigmasTOF (const AliVParticle *track, AliPID::EParticleType type) const; |
00a38d07 | 86 | virtual Float_t NumberOfSigmasEMCAL(const AliVParticle *track, AliPID::EParticleType type) const; |
87 | ||
1c9d11be | 88 | Bool_t IdentifiedAsElectronTRD(const AliVTrack *track, Double_t efficiencyLevel,Double_t centrality=-1,AliTRDPIDResponse::ETRDPIDMethod PIDmethod=AliTRDPIDResponse::kLQ1D) const; |
29bf19f2 | 89 | |
00a38d07 | 90 | EDetPidStatus ComputePIDProbability (EDetector detCode, const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; |
91 | EDetPidStatus ComputePIDProbability (EDetCode detCode, const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
fd21ec8d | 92 | |
1c9d11be | 93 | virtual EDetPidStatus ComputeITSProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; |
94 | virtual EDetPidStatus ComputeTPCProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
95 | virtual EDetPidStatus ComputeTOFProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
96 | virtual EDetPidStatus ComputeTRDProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[],AliTRDPIDResponse::ETRDPIDMethod PIDmethod=AliTRDPIDResponse::kLQ1D) const; | |
97 | virtual EDetPidStatus ComputeEMCALProbability(const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
98 | virtual EDetPidStatus ComputePHOSProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
99 | virtual EDetPidStatus ComputeHMPIDProbability(const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
fd21ec8d | 100 | |
fd21ec8d | 101 | void SetITSPIDmethod(ITSPIDmethod pmeth) { fITSPIDmethod = pmeth; } |
ea235c90 | 102 | |
4ec8e76d | 103 | void SetOADBPath(const char* path) {fOADBPath=path;} |
80f28562 | 104 | const char *GetOADBPath() const {return fOADBPath.Data();} |
00a38d07 | 105 | |
106 | void SetCustomTPCpidResponse(const char* tpcpid) { fCustomTPCpidResponse = tpcpid; } | |
107 | const char* GetCustomTPCpidResponse() const { return fCustomTPCpidResponse.Data(); } | |
108 | ||
109 | void InitialiseEvent(AliVEvent *event, Int_t pass, Int_t run=-1); | |
ea235c90 | 110 | void SetCurrentFile(const char* file) { fCurrentFile=file; } |
4ec8e76d | 111 | |
00a38d07 | 112 | // cache PID in the track |
1c9d11be | 113 | void SetCachePID(Bool_t cache) { fCachePID=cache; } |
114 | Bool_t GetCachePID() const { return fCachePID; } | |
115 | void FillTrackDetectorPID(const AliVTrack *track, EDetector detector) const; | |
00a38d07 | 116 | void FillTrackDetectorPID(); |
117 | ||
e96b9916 | 118 | AliVEvent * GetCurrentEvent() const {return fCurrentEvent;} |
119 | ||
fd21ec8d | 120 | // User settings for the MC period and reco pass |
121 | void SetMCperiod(const char *mcPeriod) {fMCperiodUser=mcPeriod;} | |
122 | void SetRecoPass(Int_t recoPass) {fRecoPassUser=recoPass;} | |
80f28562 | 123 | |
124 | // event info | |
125 | Float_t GetCurrentCentrality() const {return fCurrCentrality;}; | |
126 | ||
f84b18dd | 127 | // TPC setting |
128 | void SetUseTPCEtaCorrection(Bool_t useEtaCorrection = kTRUE) { fUseTPCEtaCorrection = useEtaCorrection; }; | |
129 | Bool_t UseTPCEtaCorrection() const { return fUseTPCEtaCorrection; }; | |
130 | ||
0b39f221 | 131 | // TOF setting |
132 | 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 | 133 | void SetTOFResponse(AliVEvent *vevent,EStartTimeType_t option); |
0b39f221 | 134 | |
539a5a59 | 135 | virtual Float_t GetTPCsignalTunedOnData(const AliVTrack *t) const {return t->GetTPCsignal();}; |
136 | Bool_t IsTunedOnData() const {return fTuneMConData;}; | |
137 | void SetTunedOnData(Bool_t flag=kTRUE,Int_t recoPass=0){fTuneMConData = flag; if(recoPass>0) fRecoPassUser = recoPass;}; | |
138 | ||
4ec8e76d | 139 | AliPIDResponse(const AliPIDResponse &other); |
140 | AliPIDResponse& operator=(const AliPIDResponse &other); | |
80f28562 | 141 | |
29bf19f2 | 142 | |
143 | protected: | |
144 | AliITSPIDResponse fITSResponse; //PID response function of the ITS | |
145 | AliTPCPIDResponse fTPCResponse; //PID response function of the TPC | |
146 | AliTRDPIDResponse fTRDResponse; //PID response function of the TRD | |
147 | AliTOFPIDResponse fTOFResponse; //PID response function of the TOF | |
e96b9916 | 148 | AliEMCALPIDResponse fEMCALResponse; //PID response function of the EMCAL |
4ec8e76d | 149 | |
fd21ec8d | 150 | Float_t fRange; // nSigma max in likelihood |
151 | ITSPIDmethod fITSPIDmethod; // 0 = trunc mean; 1 = likelihood | |
152 | ||
1c9d11be | 153 | //unbuffered PID calculation |
154 | virtual Float_t GetNumberOfSigmasTOF (const AliVParticle */*track*/, AliPID::EParticleType /*type*/) const {return 0;} | |
155 | EDetPidStatus GetComputeTRDProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[],AliTRDPIDResponse::ETRDPIDMethod PIDmethod=AliTRDPIDResponse::kLQ1D) const; | |
156 | ||
4ec8e76d | 157 | private: |
158 | Bool_t fIsMC; // If we run on MC data | |
1c9d11be | 159 | Bool_t fCachePID; |
4ec8e76d | 160 | |
161 | TString fOADBPath; // OADB path to use | |
00a38d07 | 162 | TString fCustomTPCpidResponse; // Custom TPC Pid Response file for debugging purposes |
4ec8e76d | 163 | |
164 | TString fBeamType; //! beam type (PP) or (PBPB) | |
165 | TString fLHCperiod; //! LHC period | |
166 | TString fMCperiodTPC; //! corresponding MC period to use for the TPC splines | |
fd21ec8d | 167 | TString fMCperiodUser; // MC prodution requested by the user |
ea235c90 | 168 | TString fCurrentFile; //! name of currently processed file |
4ec8e76d | 169 | Int_t fRecoPass; //! reconstruction pass |
fd21ec8d | 170 | Int_t fRecoPassUser; // reconstruction pass explicitly set by the user |
4ec8e76d | 171 | Int_t fRun; //! current run number |
172 | Int_t fOldRun; //! current run number | |
78cbd205 | 173 | Float_t fResT0A; //! T0A resolution in current run |
174 | Float_t fResT0C; //! T0C resolution in current run | |
175 | Float_t fResT0AC; //! T0A.and.T0C resolution in current run | |
fd21ec8d | 176 | |
4ec8e76d | 177 | TObjArray *fArrPidResponseMaster; //! TPC pid splines |
178 | TF1 *fResolutionCorrection; //! TPC resolution correction | |
644666df | 179 | AliOADBContainer* fOADBvoltageMaps; //! container with the voltage maps |
f84b18dd | 180 | Bool_t fUseTPCEtaCorrection; // Use TPC eta correction |
181 | ||
db0e2c5f | 182 | AliTRDPIDResponseObject *fTRDPIDResponseObject; //! TRD PID Response Object |
ea235c90 | 183 | |
0b39f221 | 184 | Float_t fTOFtail; //! TOF tail effect used in TOF probability |
b79db598 | 185 | AliTOFPIDParams *fTOFPIDParams; //! TOF PID Params - period depending (OADB loaded) |
e96b9916 | 186 | |
b2138b40 | 187 | TObjArray *fEMCALPIDParams; //! EMCAL PID Params |
188 | ||
e96b9916 | 189 | AliVEvent *fCurrentEvent; //! event currently being processed |
80f28562 | 190 | |
191 | Float_t fCurrCentrality; //! current centrality | |
4ec8e76d | 192 | |
539a5a59 | 193 | Bool_t fTuneMConData; // switch to force the MC to be similar to data (dE/dx) |
194 | ||
4ec8e76d | 195 | void ExecNewRun(); |
196 | ||
197 | // | |
198 | //setup parametrisations | |
199 | // | |
200 | ||
201 | //ITS | |
202 | void SetITSParametrisation(); | |
203 | ||
204 | //TPC | |
f84b18dd | 205 | void SetTPCEtaMaps(Double_t refineFactorMapX = 6.0, Double_t refineFactorMapY = 6.0, Double_t refineFactorSigmaMapX = 6.0, |
206 | Double_t refineFactorSigmaMapY = 6.0); | |
4ec8e76d | 207 | void SetTPCPidResponseMaster(); |
208 | void SetTPCParametrisation(); | |
209 | Double_t GetTPCMultiplicityBin(const AliVEvent * const event); | |
f84b18dd | 210 | |
211 | // TPC helpers for the eta maps | |
212 | void AddPointToHyperplane(TH2D* h, TLinearFitter* linExtrapolation, Int_t binX, Int_t binY); | |
213 | TH2D* RefineHistoViaLinearInterpolation(TH2D* h, Double_t refineFactorX = 6.0, Double_t refineFactorY = 6.0); | |
4ec8e76d | 214 | |
ea235c90 | 215 | //TRD |
216 | void SetTRDPidResponseMaster(); | |
217 | void InitializeTRDResponse(); | |
bd58d4b9 | 218 | void SetTRDSlices(UInt_t TRDslicesForPID[2],AliTRDPIDResponse::ETRDPIDMethod method) const; |
ea235c90 | 219 | |
4ec8e76d | 220 | //TOF |
b79db598 | 221 | void SetTOFPidResponseMaster(); |
222 | void InitializeTOFResponse(); | |
b2138b40 | 223 | |
224 | //EMCAL | |
225 | void SetEMCALPidResponseMaster(); | |
226 | void InitializeEMCALResponse(); | |
227 | ||
4ec8e76d | 228 | // |
229 | void SetRecoInfo(); | |
1c9d11be | 230 | |
231 | //unbuffered PID calculation | |
232 | Float_t GetNumberOfSigmas(EDetector detCode, const AliVParticle *track, AliPID::EParticleType type) const; | |
233 | Float_t GetNumberOfSigmasITS (const AliVParticle *track, AliPID::EParticleType type) const; | |
234 | Float_t GetNumberOfSigmasTPC (const AliVParticle *track, AliPID::EParticleType type) const; | |
235 | Float_t GetNumberOfSigmasEMCAL(const AliVParticle *track, AliPID::EParticleType type, Double_t &eop, Double_t showershape[4]) const; | |
236 | Float_t GetNumberOfSigmasEMCAL(const AliVParticle *track, AliPID::EParticleType type) const; | |
237 | ||
238 | EDetPidStatus GetComputePIDProbability (EDetector detCode, const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
239 | EDetPidStatus GetComputeITSProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
240 | EDetPidStatus GetComputeTPCProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
241 | EDetPidStatus GetComputeTOFProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
242 | EDetPidStatus GetComputeEMCALProbability(const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
243 | EDetPidStatus GetComputePHOSProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
244 | EDetPidStatus GetComputeHMPIDProbability(const AliVTrack *track, Int_t nSpecies, Double_t p[]) const; | |
29bf19f2 | 245 | |
f84b18dd | 246 | ClassDef(AliPIDResponse, 11); //PID response handling |
29bf19f2 | 247 | }; |
248 | ||
29bf19f2 | 249 | #endif |