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