]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/dielectron/AliDielectronPID.h
Corrected library order + fixes needed to compile static libraries and executables...
[u/mrichter/AliRoot.git] / PWG3 / dielectron / AliDielectronPID.h
1 #ifndef ALIDIELECTRONPID_H
2 #define ALIDIELECTRONPID_H
3
4 /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 //#############################################################
8 //#                                                           # 
9 //#         Class AliDielectronPID                     #
10 //#                                                           #
11 //#  Authors:                                                 #
12 //#   Anton     Andronic, GSI / A.Andronic@gsi.de             #
13 //#   Ionut C.  Arsene,   GSI / I.C.Arsene@gsi.de             #
14 //#   Julian    Book,     Uni Ffm / Julian.Book@cern.ch       #
15 //#   Frederick Kramer,   Uni Ffm, / Frederick.Kramer@cern.ch #
16 //#   Magnus    Mager,    CERN / Magnus.Mager@cern.ch         #
17 //#   WooJin J. Park,     GSI / W.J.Park@gsi.de               #
18 //#   Jens      Wiechula, Uni HD / Jens.Wiechula@cern.ch      #
19 //#                                                           #
20 //#############################################################
21
22 #include <AliPID.h>
23 #include <AliESDpid.h>
24 #include <AliAODTrack.h>
25 #include <AliAODPid.h>
26
27 #include <AliAnalysisCuts.h>
28
29 class TF1;
30
31 class TList;
32
33 class AliDielectronPID : public AliAnalysisCuts {
34 public:
35   enum DetType {kITS, kTPC, kTRD, kTOF};
36   enum PIDbitTupe {kIgnore=0, kRequire, kIfAvailable};
37   
38   AliDielectronPID();
39   AliDielectronPID(const char*name, const char* title);
40
41   virtual ~AliDielectronPID();
42
43   void AddCut(DetType det, AliPID::EParticleType type, Double_t nSigmaLow, Double_t nSigmaUp=-99999.,
44               Double_t pMin=0, Double_t pMax=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire);
45
46   void AddCut(DetType det, AliPID::EParticleType type, Double_t nSigmaLow, TF1 * const funUp,
47               Double_t pMin=0, Double_t pMax=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire);
48
49   void AddCut(DetType det, AliPID::EParticleType type, TF1 * const funLow, Double_t nSigmaUp,
50               Double_t pMin=0, Double_t pMax=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire);
51
52   void AddCut(DetType det, AliPID::EParticleType type, TF1 * const funLow, TF1 * const funUp,
53               Double_t pMin=0, Double_t pMax=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire);
54   
55   void SetDefaults(Int_t def);
56
57   //
58   //Analysis cuts interface
59   //const
60   virtual Bool_t IsSelected(TObject* track);
61   virtual Bool_t IsSelected(TList*   /* list */ ) {return kFALSE;}
62   
63 private:
64   enum {kNmaxPID=10};
65   
66   DetType  fDetType[kNmaxPID];    //detector type of nsigma cut
67   AliPID::EParticleType fPartType[kNmaxPID]; //particle type
68   Float_t  fNsigmaLow[kNmaxPID];  //lower nsigma bound
69   Float_t  fNsigmaUp[kNmaxPID];   //upper nsigma bound
70   Double_t fPmin[kNmaxPID];       //lower momentum
71   Double_t fPmax[kNmaxPID];       //upper momentum
72   Bool_t   fExclude[kNmaxPID];    //use as exclusion band
73   TF1     *fFunUpperCut[kNmaxPID];//use function as upper cut
74   TF1     *fFunLowerCut[kNmaxPID];//use function as lower cut
75   UChar_t  fNcuts;                //number of cuts
76   UChar_t  fRequirePIDbit[kNmaxPID]; //How to make use of the pid bit (see)
77
78   AliESDpid *fESDpid;             //! esd pid object
79
80   
81   Bool_t IsSelectedITS(AliVParticle * const part, Int_t icut) const;
82   Bool_t IsSelectedTPC(AliVParticle * const part, Int_t icut) const;
83   Bool_t IsSelectedTRD(AliVParticle * const part, Int_t icut) const;
84   Bool_t IsSelectedTOF(AliVParticle * const part, Int_t icut) const;
85
86   Float_t NumberOfSigmasITS(const AliAODTrack *track, AliPID::EParticleType type) const;
87   Float_t NumberOfSigmasTPC(const AliAODTrack *track, AliPID::EParticleType type) const;
88   Float_t NumberOfSigmasTOF(const AliAODTrack *track, AliPID::EParticleType type) const;
89   
90   AliDielectronPID(const AliDielectronPID &c);
91   AliDielectronPID &operator=(const AliDielectronPID &c);
92
93   ClassDef(AliDielectronPID,2)         // Dielectron PID
94 };
95
96
97 //
98 // Inline functions for AOD as long as ther is no AOD pid object we have to fake it
99 //
100
101 inline Float_t AliDielectronPID::NumberOfSigmasITS(const AliAODTrack *track, AliPID::EParticleType type) const {
102   AliAODPid *pid=track->GetDetPid();
103   if (!pid) return -1000.;
104   
105   return fESDpid->GetITSResponse().GetNumberOfSigmas(track->P(),pid->GetITSsignal(),type);
106 }
107
108 inline Float_t AliDielectronPID::NumberOfSigmasTPC(const AliAODTrack *track, AliPID::EParticleType type) const {
109   AliAODPid *pid=track->GetDetPid();
110   if (!pid) return -1000.;
111     
112   Double_t mom = pid->GetTPCmomentum();
113   if (mom<0) mom=track->P();
114
115   //FIXME: rough estimate of the number of clusters used for PID. Needs to be fixed!!!
116   Int_t ncl=(Int_t)track->GetTPCClusterMap().CountBits();
117   return fESDpid->GetTPCResponse().GetNumberOfSigmas(mom,pid->GetTPCsignal(),ncl,type);
118 }
119
120 inline Float_t AliDielectronPID::NumberOfSigmasTOF(const AliAODTrack *track, AliPID::EParticleType type) const {
121   AliAODPid *pid=track->GetDetPid();
122   if (!pid) return -1000.;
123   
124   Double_t times[AliPID::kSPECIES];
125   pid->GetIntegratedTimes(times);
126   Double_t tofRes = fESDpid->GetTOFResponse().GetExpectedSigma(track->P(),times[type],AliPID::ParticleMass(type));
127   return (pid->GetTOFsignal() - times[type])/ tofRes;
128 }
129
130
131
132 #endif