Small update of the calibration code for the case of runs without TRD (Raphaelle)
[u/mrichter/AliRoot.git] / STEER / 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"
18
19#include "AliVParticle.h"
20#include "AliVTrack.h"
21
22#include "TNamed.h"
23
24class AliVEvent;
4ec8e76d 25class TF1;
29bf19f2 26
27class AliPIDResponse : public TNamed {
28public:
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;
62
fd21ec8d 63 EDetPidStatus ComputePIDProbability (EDetCode detCode, const AliVTrack *track, Int_t nSpecies, Double_t p[]) const;
64
65 EDetPidStatus ComputeITSProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const;
66 EDetPidStatus ComputeTPCProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const;
67 EDetPidStatus ComputeTOFProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const;
68 EDetPidStatus ComputeTRDProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const;
69 EDetPidStatus ComputeEMCALProbability(const AliVTrack *track, Int_t nSpecies, Double_t p[]) const;
70 EDetPidStatus ComputePHOSProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const;
71 EDetPidStatus ComputeHMPIDProbability(const AliVTrack *track, Int_t nSpecies, Double_t p[]) const;
72
73
74 void SetITSPIDmethod(ITSPIDmethod pmeth) { fITSPIDmethod = pmeth; }
4ec8e76d 75 virtual void SetTOFResponse(AliVEvent */*event*/,EStartTimeType_t /*option*/) {;}
76
77 void SetOADBPath(const char* path) {fOADBPath=path;}
78 void InitialiseEvent(AliVEvent *event, Int_t pass);
79
fd21ec8d 80 // User settings for the MC period and reco pass
81 void SetMCperiod(const char *mcPeriod) {fMCperiodUser=mcPeriod;}
82 void SetRecoPass(Int_t recoPass) {fRecoPassUser=recoPass;}
83
4ec8e76d 84 AliPIDResponse(const AliPIDResponse &other);
85 AliPIDResponse& operator=(const AliPIDResponse &other);
29bf19f2 86
87protected:
88 AliITSPIDResponse fITSResponse; //PID response function of the ITS
89 AliTPCPIDResponse fTPCResponse; //PID response function of the TPC
90 AliTRDPIDResponse fTRDResponse; //PID response function of the TRD
91 AliTOFPIDResponse fTOFResponse; //PID response function of the TOF
4ec8e76d 92
fd21ec8d 93 Float_t fRange; // nSigma max in likelihood
94 ITSPIDmethod fITSPIDmethod; // 0 = trunc mean; 1 = likelihood
95
4ec8e76d 96private:
97 Bool_t fIsMC; // If we run on MC data
98
99 TString fOADBPath; // OADB path to use
100
101 TString fBeamType; //! beam type (PP) or (PBPB)
102 TString fLHCperiod; //! LHC period
103 TString fMCperiodTPC; //! corresponding MC period to use for the TPC splines
fd21ec8d 104 TString fMCperiodUser; // MC prodution requested by the user
4ec8e76d 105 Int_t fRecoPass; //! reconstruction pass
fd21ec8d 106 Int_t fRecoPassUser; // reconstruction pass explicitly set by the user
4ec8e76d 107 Int_t fRun; //! current run number
108 Int_t fOldRun; //! current run number
fd21ec8d 109
4ec8e76d 110 TObjArray *fArrPidResponseMaster; //! TPC pid splines
111 TF1 *fResolutionCorrection; //! TPC resolution correction
112
113 Int_t fTOFTimeZeroType; //! default start time type for tof (ESD)
114 Float_t fTOFres; //! TOF resolution
115
116 void ExecNewRun();
117
118 //
119 //setup parametrisations
120 //
121
122 //ITS
123 void SetITSParametrisation();
124
125 //TPC
126 void SetTPCPidResponseMaster();
127 void SetTPCParametrisation();
128 Double_t GetTPCMultiplicityBin(const AliVEvent * const event);
129
130 //TOF
131
132 //
133 void SetRecoInfo();
29bf19f2 134
4ec8e76d 135 ClassDef(AliPIDResponse,2); //PID response handling
29bf19f2 136};
137
138inline Float_t AliPIDResponse::NumberOfSigmasTPC(const AliVParticle *vtrack, AliPID::EParticleType type) const {
139 AliVTrack *track=(AliVTrack*)vtrack;
140 Double_t mom = track->GetTPCmomentum();
141 Double_t sig = track->GetTPCsignal();
142 UInt_t sigN = track->GetTPCsignalN();
143
144 Double_t nSigma = -999.;
145 if (sigN>0) nSigma=fTPCResponse.GetNumberOfSigmas(mom,sig,sigN,type);
146
147 return nSigma;
148}
149
150inline Float_t AliPIDResponse::NumberOfSigmasITS(const AliVParticle *vtrack, AliPID::EParticleType type) const {
151 AliVTrack *track=(AliVTrack*)vtrack;
152 Float_t dEdx=track->GetITSsignal();
153 if (dEdx<=0) return -999.;
154
155 UChar_t clumap=track->GetITSClusterMap();
156 Int_t nPointsForPid=0;
157 for(Int_t i=2; i<6; i++){
158 if(clumap&(1<<i)) ++nPointsForPid;
159 }
160 Float_t mom=track->P();
161 Bool_t isSA=kTRUE;
162 if(track->GetTPCNcls()>0) isSA=kFALSE;
163 return fITSResponse.GetNumberOfSigmas(mom,dEdx,type,nPointsForPid,isSA);
164}
165
166#endif