1 #ifndef ALIDIELECTRONPID_H
2 #define ALIDIELECTRONPID_H
4 /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 //#############################################################
9 //# Class AliDielectronPID #
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 #
20 //#############################################################
23 #include <AliESDpid.h>
24 #include <AliAODTrack.h>
25 #include <AliAODPid.h>
27 #include <AliAnalysisCuts.h>
34 class AliDielectronPID : public AliAnalysisCuts {
36 enum DetType {kITS, kTPC, kTRD, kTOF};
37 enum PIDbitTupe {kIgnore=0, kRequire, kIfAvailable};
40 AliDielectronPID(const char*name, const char* title);
42 virtual ~AliDielectronPID();
44 void AddCut(DetType det, AliPID::EParticleType type, Double_t nSigmaLow, Double_t nSigmaUp=-99999.,
45 Double_t pMin=0, Double_t pMax=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire);
47 void AddCut(DetType det, AliPID::EParticleType type, Double_t nSigmaLow, TF1 * const funUp,
48 Double_t pMin=0, Double_t pMax=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire);
50 void AddCut(DetType det, AliPID::EParticleType type, TF1 * const funLow, Double_t nSigmaUp,
51 Double_t pMin=0, Double_t pMax=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire);
53 void AddCut(DetType det, AliPID::EParticleType type, TF1 * const funLow, TF1 * const funUp,
54 Double_t pMin=0, Double_t pMax=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire);
56 void SetDefaults(Int_t def);
59 //Analysis cuts interface
61 virtual Bool_t IsSelected(TObject* track);
62 virtual Bool_t IsSelected(TList* /* list */ ) {return kFALSE;}
64 static void SetCorrGraph(TGraph * const gr) { fgFitCorr=gr; }
65 static void SetCorrVal(Double_t run);
66 static Double_t GetCorrVal() { return fgCorr; }
67 static TGraph *GetCorrGraph() { return fgFitCorr; }
72 DetType fDetType[kNmaxPID]; //detector type of nsigma cut
73 AliPID::EParticleType fPartType[kNmaxPID]; //particle type
74 Float_t fNsigmaLow[kNmaxPID]; //lower nsigma bound
75 Float_t fNsigmaUp[kNmaxPID]; //upper nsigma bound
76 Double_t fPmin[kNmaxPID]; //lower momentum
77 Double_t fPmax[kNmaxPID]; //upper momentum
78 Bool_t fExclude[kNmaxPID]; //use as exclusion band
79 TF1 *fFunUpperCut[kNmaxPID];//use function as upper cut
80 TF1 *fFunLowerCut[kNmaxPID];//use function as lower cut
81 UChar_t fNcuts; //number of cuts
82 UChar_t fRequirePIDbit[kNmaxPID]; //How to make use of the pid bit (see)
84 AliESDpid *fESDpid; //! esd pid object
87 static TGraph *fgFitCorr; //spline fit object to correct the nsigma deviation in the TPC electron band
88 static Double_t fgCorr; //!correction value for current run. Set if fgFitCorr is set and SetCorrVal(run)
91 Bool_t IsSelectedITS(AliVTrack * const part, Int_t icut) const;
92 Bool_t IsSelectedTPC(AliVTrack * const part, Int_t icut) const;
93 Bool_t IsSelectedTRD(AliVTrack * const part, Int_t icut) const;
94 Bool_t IsSelectedTOF(AliVTrack * const part, Int_t icut) const;
96 Float_t NumberOfSigmasITS(const AliAODTrack *track, AliPID::EParticleType type) const;
97 Float_t NumberOfSigmasTPC(const AliAODTrack *track, AliPID::EParticleType type) const;
98 Float_t NumberOfSigmasTOF(const AliAODTrack *track, AliPID::EParticleType type) const;
100 AliDielectronPID(const AliDielectronPID &c);
101 AliDielectronPID &operator=(const AliDielectronPID &c);
103 ClassDef(AliDielectronPID,3) // Dielectron PID
108 // Inline functions for AOD as long as ther is no AOD pid object we have to fake it
111 inline Float_t AliDielectronPID::NumberOfSigmasITS(const AliAODTrack *track, AliPID::EParticleType type) const {
112 AliAODPid *pid=track->GetDetPid();
113 if (!pid) return -1000.;
115 return fESDpid->GetITSResponse().GetNumberOfSigmas(track->P(),pid->GetITSsignal(),type);
118 inline Float_t AliDielectronPID::NumberOfSigmasTPC(const AliAODTrack *track, AliPID::EParticleType type) const {
119 AliAODPid *pid=track->GetDetPid();
120 if (!pid) return -1000.;
122 Double_t mom = pid->GetTPCmomentum();
123 if (mom<0) mom=track->P();
125 //FIXME: rough estimate of the number of clusters used for PID. Needs to be fixed!!!
126 Int_t ncl=(Int_t)track->GetTPCClusterMap().CountBits();
127 return fESDpid->GetTPCResponse().GetNumberOfSigmas(mom,pid->GetTPCsignal(),ncl,type);
130 inline Float_t AliDielectronPID::NumberOfSigmasTOF(const AliAODTrack *track, AliPID::EParticleType type) const {
131 AliAODPid *pid=track->GetDetPid();
132 if (!pid) return -1000.;
134 Double_t times[AliPID::kSPECIES];
135 pid->GetIntegratedTimes(times);
136 Double_t tofRes = fESDpid->GetTOFResponse().GetExpectedSigma(track->P(),times[type],AliPID::ParticleMass(type));
137 return (pid->GetTOFsignal() - times[type])/ tofRes;