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>
33 class AliDielectronPID : public AliAnalysisCuts {
35 enum DetType {kITS, kTPC, kTRD, kTOF};
36 enum PIDbitTupe {kIgnore=0, kRequire, kIfAvailable};
39 AliDielectronPID(const char*name, const char* title);
41 virtual ~AliDielectronPID();
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);
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);
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);
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);
55 void SetDefaults(Int_t def);
58 //Analysis cuts interface
60 virtual Bool_t IsSelected(TObject* track);
61 virtual Bool_t IsSelected(TList* /* list */ ) {return kFALSE;}
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)
78 AliESDpid *fESDpid; //! esd pid object
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;
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;
90 AliDielectronPID(const AliDielectronPID &c);
91 AliDielectronPID &operator=(const AliDielectronPID &c);
93 ClassDef(AliDielectronPID,2) // Dielectron PID
98 // Inline functions for AOD as long as ther is no AOD pid object we have to fake it
101 inline Float_t AliDielectronPID::NumberOfSigmasITS(const AliAODTrack *track, AliPID::EParticleType type) const {
102 AliAODPid *pid=track->GetDetPid();
103 if (!pid) return -1000.;
105 return fESDpid->GetITSResponse().GetNumberOfSigmas(track->P(),pid->GetITSsignal(),type);
108 inline Float_t AliDielectronPID::NumberOfSigmasTPC(const AliAODTrack *track, AliPID::EParticleType type) const {
109 AliAODPid *pid=track->GetDetPid();
110 if (!pid) return -1000.;
112 Double_t mom = pid->GetTPCmomentum();
113 if (mom<0) mom=track->P();
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);
120 inline Float_t AliDielectronPID::NumberOfSigmasTOF(const AliAODTrack *track, AliPID::EParticleType type) const {
121 AliAODPid *pid=track->GetDetPid();
122 if (!pid) return -1000.;
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;