]>
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;} |
83 | void InitialiseEvent(AliVEvent *event, Int_t pass); | |
ea235c90 | 84 | void SetCurrentFile(const char* file) { fCurrentFile=file; } |
4ec8e76d | 85 | |
e96b9916 | 86 | AliVEvent * GetCurrentEvent() const {return fCurrentEvent;} |
87 | ||
fd21ec8d | 88 | // User settings for the MC period and reco pass |
89 | void SetMCperiod(const char *mcPeriod) {fMCperiodUser=mcPeriod;} | |
90 | void SetRecoPass(Int_t recoPass) {fRecoPassUser=recoPass;} | |
91 | ||
4ec8e76d | 92 | AliPIDResponse(const AliPIDResponse &other); |
93 | AliPIDResponse& operator=(const AliPIDResponse &other); | |
29bf19f2 | 94 | |
95 | protected: | |
96 | AliITSPIDResponse fITSResponse; //PID response function of the ITS | |
97 | AliTPCPIDResponse fTPCResponse; //PID response function of the TPC | |
98 | AliTRDPIDResponse fTRDResponse; //PID response function of the TRD | |
99 | AliTOFPIDResponse fTOFResponse; //PID response function of the TOF | |
e96b9916 | 100 | AliEMCALPIDResponse fEMCALResponse; //PID response function of the EMCAL |
4ec8e76d | 101 | |
fd21ec8d | 102 | Float_t fRange; // nSigma max in likelihood |
103 | ITSPIDmethod fITSPIDmethod; // 0 = trunc mean; 1 = likelihood | |
104 | ||
4ec8e76d | 105 | private: |
106 | Bool_t fIsMC; // If we run on MC data | |
107 | ||
108 | TString fOADBPath; // OADB path to use | |
109 | ||
110 | TString fBeamType; //! beam type (PP) or (PBPB) | |
111 | TString fLHCperiod; //! LHC period | |
112 | TString fMCperiodTPC; //! corresponding MC period to use for the TPC splines | |
fd21ec8d | 113 | TString fMCperiodUser; // MC prodution requested by the user |
ea235c90 | 114 | TString fCurrentFile; //! name of currently processed file |
4ec8e76d | 115 | Int_t fRecoPass; //! reconstruction pass |
fd21ec8d | 116 | Int_t fRecoPassUser; // reconstruction pass explicitly set by the user |
4ec8e76d | 117 | Int_t fRun; //! current run number |
118 | Int_t fOldRun; //! current run number | |
fd21ec8d | 119 | |
4ec8e76d | 120 | TObjArray *fArrPidResponseMaster; //! TPC pid splines |
121 | TF1 *fResolutionCorrection; //! TPC resolution correction | |
122 | ||
ea235c90 | 123 | TObjArray *fTRDPIDParams; //! TRD PID Params |
124 | AliTRDPIDReference *fTRDPIDReference; //! TRD PID References | |
125 | UInt_t fTRDslicesForPID[2]; //! TRD PID slices | |
126 | ||
4ec8e76d | 127 | Int_t fTOFTimeZeroType; //! default start time type for tof (ESD) |
128 | Float_t fTOFres; //! TOF resolution | |
e96b9916 | 129 | |
130 | AliVEvent *fCurrentEvent; //! event currently being processed | |
4ec8e76d | 131 | |
132 | void ExecNewRun(); | |
133 | ||
134 | // | |
135 | //setup parametrisations | |
136 | // | |
137 | ||
138 | //ITS | |
139 | void SetITSParametrisation(); | |
140 | ||
141 | //TPC | |
142 | void SetTPCPidResponseMaster(); | |
143 | void SetTPCParametrisation(); | |
144 | Double_t GetTPCMultiplicityBin(const AliVEvent * const event); | |
145 | ||
ea235c90 | 146 | //TRD |
147 | void SetTRDPidResponseMaster(); | |
148 | void InitializeTRDResponse(); | |
149 | ||
4ec8e76d | 150 | //TOF |
151 | ||
152 | // | |
153 | void SetRecoInfo(); | |
29bf19f2 | 154 | |
4ec8e76d | 155 | ClassDef(AliPIDResponse,2); //PID response handling |
29bf19f2 | 156 | }; |
157 | ||
158 | inline Float_t AliPIDResponse::NumberOfSigmasTPC(const AliVParticle *vtrack, AliPID::EParticleType type) const { | |
159 | AliVTrack *track=(AliVTrack*)vtrack; | |
160 | Double_t mom = track->GetTPCmomentum(); | |
161 | Double_t sig = track->GetTPCsignal(); | |
162 | UInt_t sigN = track->GetTPCsignalN(); | |
163 | ||
164 | Double_t nSigma = -999.; | |
165 | if (sigN>0) nSigma=fTPCResponse.GetNumberOfSigmas(mom,sig,sigN,type); | |
166 | ||
167 | return nSigma; | |
168 | } | |
169 | ||
170 | inline Float_t AliPIDResponse::NumberOfSigmasITS(const AliVParticle *vtrack, AliPID::EParticleType type) const { | |
171 | AliVTrack *track=(AliVTrack*)vtrack; | |
172 | Float_t dEdx=track->GetITSsignal(); | |
173 | if (dEdx<=0) return -999.; | |
174 | ||
175 | UChar_t clumap=track->GetITSClusterMap(); | |
176 | Int_t nPointsForPid=0; | |
177 | for(Int_t i=2; i<6; i++){ | |
178 | if(clumap&(1<<i)) ++nPointsForPid; | |
179 | } | |
180 | Float_t mom=track->P(); | |
181 | Bool_t isSA=kTRUE; | |
182 | if(track->GetTPCNcls()>0) isSA=kFALSE; | |
183 | return fITSResponse.GetNumberOfSigmas(mom,dEdx,type,nPointsForPid,isSA); | |
184 | } | |
185 | ||
186 | #endif |