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