]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliPIDResponse.h
Coverity:
[u/mrichter/AliRoot.git] / STEER / AliPIDResponse.h
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;
25 class TF1;
26
27 class AliPIDResponse : public TNamed {
28 public:
29   AliPIDResponse(Bool_t isMC=kFALSE);
30   virtual ~AliPIDResponse();
31
32   enum EStartTimeType_t {kFILL_T0,kTOF_T0, kT0_T0, kBest_T0};
33   
34   AliITSPIDResponse &GetITSResponse() {return fITSResponse;}
35   AliTPCPIDResponse &GetTPCResponse() {return fTPCResponse;}
36   AliTOFPIDResponse &GetTOFResponse() {return fTOFResponse;}
37   AliTRDPIDResponse &GetTRDResponse() {return fTRDResponse;}
38   
39   virtual Float_t NumberOfSigmasITS(const AliVParticle *track, AliPID::EParticleType type) const;
40   virtual Float_t NumberOfSigmasTPC(const AliVParticle *track, AliPID::EParticleType type) const;
41   virtual Float_t NumberOfSigmasTOF(const AliVParticle *track, AliPID::EParticleType type) const = 0;
42
43   virtual void SetTOFResponse(AliVEvent */*event*/,EStartTimeType_t /*option*/) {;}
44
45   void SetOADBPath(const char* path) {fOADBPath=path;}
46   void InitialiseEvent(AliVEvent *event, Int_t pass);
47
48   AliPIDResponse(const AliPIDResponse &other);
49   AliPIDResponse& operator=(const AliPIDResponse &other);
50   
51 protected:
52   AliITSPIDResponse fITSResponse;    //PID response function of the ITS
53   AliTPCPIDResponse fTPCResponse;    //PID response function of the TPC
54   AliTRDPIDResponse fTRDResponse;    //PID response function of the TRD
55   AliTOFPIDResponse fTOFResponse;    //PID response function of the TOF
56
57 private:
58   Bool_t fIsMC;                        //  If we run on MC data
59
60   TString fOADBPath;                   // OADB path to use
61   
62   TString fBeamType;                   //! beam type (PP) or (PBPB)
63   TString fLHCperiod;                  //! LHC period
64   TString fMCperiodTPC;                //! corresponding MC period to use for the TPC splines
65   Int_t   fRecoPass;                   //! reconstruction pass
66   Int_t   fRun;                        //! current run number
67   Int_t   fOldRun;                     //! current run number
68
69   TObjArray *fArrPidResponseMaster;    //!  TPC pid splines
70   TF1       *fResolutionCorrection;    //! TPC resolution correction
71
72   Int_t   fTOFTimeZeroType;            //! default start time type for tof (ESD)
73   Float_t fTOFres;                     //! TOF resolution
74   
75   void ExecNewRun();
76   
77   //
78   //setup parametrisations
79   //
80
81   //ITS
82   void SetITSParametrisation();
83   
84   //TPC
85   void SetTPCPidResponseMaster();
86   void SetTPCParametrisation();
87   Double_t GetTPCMultiplicityBin(const AliVEvent * const event);
88
89   //TOF
90   
91   //
92   void SetRecoInfo();
93   
94   ClassDef(AliPIDResponse,2);  //PID response handling
95 };
96
97 inline Float_t AliPIDResponse::NumberOfSigmasTPC(const AliVParticle *vtrack, AliPID::EParticleType type) const {
98   AliVTrack *track=(AliVTrack*)vtrack;
99   Double_t mom  = track->GetTPCmomentum();
100   Double_t sig  = track->GetTPCsignal();
101   UInt_t   sigN = track->GetTPCsignalN();
102
103   Double_t nSigma = -999.;
104   if (sigN>0) nSigma=fTPCResponse.GetNumberOfSigmas(mom,sig,sigN,type);
105
106   return nSigma;
107 }
108
109 inline Float_t AliPIDResponse::NumberOfSigmasITS(const AliVParticle *vtrack, AliPID::EParticleType type) const {
110   AliVTrack *track=(AliVTrack*)vtrack;
111   Float_t dEdx=track->GetITSsignal();
112   if (dEdx<=0) return -999.;
113   
114   UChar_t clumap=track->GetITSClusterMap();
115   Int_t nPointsForPid=0;
116   for(Int_t i=2; i<6; i++){
117     if(clumap&(1<<i)) ++nPointsForPid;
118   }
119   Float_t mom=track->P();
120   Bool_t isSA=kTRUE;
121   if(track->GetTPCNcls()>0) isSA=kFALSE;
122   return fITSResponse.GetNumberOfSigmas(mom,dEdx,type,nPointsForPid,isSA);
123 }
124
125 #endif