]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGDQ/dielectron/AliDielectronPID.h
Clean AODEvent before adding to UserInfo
[u/mrichter/AliRoot.git] / PWGDQ / 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 <AliAnalysisCuts.h>
24 #include <AliTRDPIDResponse.h>
25
26 class TF1;
27 class TList;
28 class AliVTrack;
29 class TGraph;
30 class AliPIDResponse;
31 class AliDielectronVarManager;
32 class AliDielectronVarCuts;
33
34 class AliDielectronPID : public AliAnalysisCuts {
35 public:
36   enum DetType {kITS, kTPC, kTRD, kTRDeleEff, kTRDeleEff2D, kTOF, kEMCAL};
37   enum PIDbitType {kIgnore=0, kRequire, kIfAvailable};
38   
39   AliDielectronPID();
40   AliDielectronPID(const char*name, const char* title);
41
42   virtual ~AliDielectronPID();
43
44   void AddCut(DetType det, AliPID::EParticleType type, Double_t nSigmaLow, Double_t nSigmaUp=-99999.,
45               Double_t min=0, Double_t max=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire, 
46               Int_t var=-1);
47
48   void AddCut(DetType det, AliPID::EParticleType type, Double_t nSigmaLow, TF1 * const funUp,
49               Double_t min=0, Double_t max=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire, 
50               Int_t var=-1);
51
52   void AddCut(DetType det, AliPID::EParticleType type, TF1 * const funLow, Double_t nSigmaUp,
53               Double_t min=0, Double_t max=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire, 
54               Int_t var=-1);
55
56   void AddCut(DetType det, AliPID::EParticleType type, TF1 * const funLow, TF1 * const funUp,
57               Double_t min=0, Double_t max=0, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire, 
58               Int_t var=-1);
59   void AddCut(DetType det, AliPID::EParticleType type, Double_t nSigmaLow, Double_t nSigmaUp, Double_t min, Double_t max, Bool_t exclude, UInt_t pidBitType,              TF1 * const funSigma);
60   void AddCut(DetType det, AliPID::EParticleType type, Double_t nSigmaLow, Double_t nSigmaUp,
61               AliDielectronVarCuts *varcuts, Bool_t exclude=kFALSE, UInt_t pidBitType=AliDielectronPID::kRequire );
62   
63   void SetDefaults(Int_t def);
64
65   //
66   //Analysis cuts interface
67   //const
68   virtual Bool_t IsSelected(TObject* track);
69   virtual Bool_t IsSelected(TList*   /* list */ ) {return kFALSE;}
70
71   static void SetCorrGraph(TGraph * const gr) { fgFitCorr=gr; }
72   static TGraph *GetCorrGraph()  { return fgFitCorr; }
73   
74   static void SetCorrVal(Double_t run);
75   static Double_t GetCorrVal()   { return fgCorr; }
76   static Double_t GetCorrValdEdx()   { return fgCorrdEdx; }
77   
78   static void SetCorrGraphdEdx(TGraph * const gr) { fgdEdxRunCorr=gr; }
79   static TGraph *GetCorrGraphdEdx()  { return fgdEdxRunCorr; }
80
81   static void SetEtaCorrFunction(TF1 *fun) {fgFunEtaCorr=fun;}
82   static void SetCentroidCorrFunction(TF1 *fun) { fgFunCntrdCorr=fun; }
83   static void SetWidthCorrFunction(TF1 *fun) { fgFunWdthCorr=fun; }
84   static TF1* GetEtaCorrFunction() { return fgFunEtaCorr; }
85   static TF1* GetCentroidCorrFunction() { return fgFunCntrdCorr; }
86   static TF1* GetWidthCorrFunction() { return fgFunWdthCorr; }
87
88   static Double_t GetEtaCorr(const AliVTrack *track);
89   static Double_t GetCntrdCorr(const AliVTrack *track) { return (fgFunCntrdCorr ? GetPIDCorr(track,fgFunCntrdCorr) : 0.0); }
90   static Double_t GetWdthCorr(const AliVTrack *track)  { return (fgFunWdthCorr  ? GetPIDCorr(track,fgFunWdthCorr)  : 1.0); }
91
92 private:
93   enum {kNmaxPID=30};
94
95   DetType  fDetType[kNmaxPID];    //detector type of nsigma cut
96   AliPID::EParticleType fPartType[kNmaxPID]; //particle type
97   Float_t  fNsigmaLow[kNmaxPID];  //lower nsigma bound
98   Float_t  fNsigmaUp[kNmaxPID];   //upper nsigma bound
99   Double_t fmin[kNmaxPID];        //lower cut limit
100   Double_t fmax[kNmaxPID];        //upper cut limit
101   Bool_t   fExclude[kNmaxPID];    //use as exclusion band
102   TF1     *fFunUpperCut[kNmaxPID];//use function as upper cut
103   TF1     *fFunLowerCut[kNmaxPID];//use function as lower cut
104   UChar_t  fNcuts;                //number of cuts
105   UChar_t  fRequirePIDbit[kNmaxPID]; //How to make use of the pid bit (see)
106   UShort_t fActiveCuts[kNmaxPID]; // list of activated cuts
107   Double_t fSigmaFunLow[kNmaxPID]; // lower bound for fFunSigma
108   Double_t fSigmaFunUp[kNmaxPID];  // upper bound for fFunSigma
109   TF1      *fFunSigma[kNmaxPID];   // use function as cut range
110   AliDielectronVarCuts *fVarCuts[kNmaxPID]; // varcuts
111
112   AliPIDResponse *fPIDResponse;   //! pid response object
113   
114   static TGraph *fgFitCorr;       //spline fit object to correct the nsigma deviation in the TPC electron band
115   static Double_t fgCorr;         //!correction value for current run. Set if fgFitCorr is set and SetCorrVal(run)
116                                   // was called
117   static Double_t fgCorrdEdx;     //!dEdx correction value for current run. Set if fgFitCorr is set and SetCorrVal(run)
118                                   // was called
119   static TF1    *fgFunEtaCorr;    //function for eta correction of electron sigma
120   static TF1    *fgFunCntrdCorr;  //function for correction of electron sigma (centroid)
121   static TF1    *fgFunWdthCorr;   //function for correction of electron sigma (width)
122   static TGraph *fgdEdxRunCorr;   //run by run correction for dEdx
123
124   static Double_t GetPIDCorr(const AliVTrack *track, TF1 *fun);
125   
126   Bool_t IsSelectedITS(AliVTrack * const part, Int_t icut);
127   Bool_t IsSelectedTPC(AliVTrack * const part, Int_t icut);
128   Bool_t IsSelectedTRD(AliVTrack * const part, Int_t icut);
129   Bool_t IsSelectedTRDeleEff(AliVTrack * const part, Int_t icut, AliTRDPIDResponse::ETRDPIDMethod PIDmethod=AliTRDPIDResponse::kLQ1D);
130   Bool_t IsSelectedTOF(AliVTrack * const part, Int_t icut);
131   Bool_t IsSelectedEMCAL(AliVTrack * const part, Int_t icut);
132
133   AliDielectronPID(const AliDielectronPID &c);
134   AliDielectronPID &operator=(const AliDielectronPID &c);
135
136   ClassDef(AliDielectronPID,5)         // Dielectron PID
137 };
138
139 #endif