]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/SPECTRA/AliProtonAnalysisBase.h
Moving the QA task to the spectra dir (Mihaela's request)
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonAnalysisBase.h
1 #ifndef ALIPROTONANALYSISBASE_H
2 #define ALIPROTONANALYSISBASE_H
3
4 /*  See cxx source for full Copyright notice */
5
6
7 /* $Id: AliProtonAnalysisBase.h 31056 2009-02-16 14:31:41Z pchrist $ */
8
9 //-------------------------------------------------------------------------
10 //                       Class AliProtonAnalysisBase
11 //   This is the base class for the baryon (proton) analysis
12 //
13 //    Origin: Panos Christakoglou | Panos.Christakoglou@cern.ch
14 //-------------------------------------------------------------------------
15
16 #include "TObject.h"
17 #include "TString.h"
18 class TF1;
19 class TCanvas;
20
21 #include "AliPID.h"
22 class AliESDEvent;
23 class AliESDtrack;
24 class AliESDVertex;
25
26 class AliProtonAnalysisBase : public TObject {
27  public:
28   enum TriggerMode { kMB1 = 0, kMB2, kSPDFASTOR };
29   enum AnalysisMode { kInvalid = -1, kTPC = 0, kHybrid, kGlobal };
30   enum PIDMode { kBayesian = 0, kRatio, kSigma };
31
32   AliProtonAnalysisBase();
33   virtual ~AliProtonAnalysisBase();
34
35   void SetAnalysisLevel(const char* type) {fProtonAnalysisLevel = type;}
36   void SetAnalysisMode(AnalysisMode analysismode) {fProtonAnalysisMode = analysismode;}
37   void SetEtaMode() {fAnalysisEtaMode = kTRUE;}
38   void SetTriggerMode(TriggerMode triggermode) {fTriggerMode = triggermode;}
39   void SetPIDMode(PIDMode pidmode) {fProtonPIDMode = pidmode;}
40
41   const char *GetAnalysisLevel() {return fProtonAnalysisLevel.Data();}
42   AnalysisMode GetAnalysisMode() {return fProtonAnalysisMode;}
43   Bool_t GetEtaMode() {return fAnalysisEtaMode;}
44   TriggerMode GetTriggerMode() {return fTriggerMode;}
45   PIDMode GetPIDMode() {return fProtonPIDMode;}
46
47   const  AliESDVertex *GetVertex(AliESDEvent *esd,
48                                  AnalysisMode mode,
49                                  Double_t gVx = 100.,
50                                  Double_t gVy = 100.,
51                                  Double_t gVz = 100.);
52   void SetAcceptedVertexDiamond(Double_t gVx, Double_t gVy, Double_t gVz) {
53     fVxMax = gVx; fVyMax = gVy; fVzMax = gVz;}
54   Double_t GetVxMax() {return fVxMax;}
55   Double_t GetVyMax() {return fVyMax;}
56   Double_t GetVzMax() {return fVzMax;}
57
58   void SetPhaseSpace(Int_t nBinsX, Double_t gXmin, Double_t gXmax,
59                      Int_t nBinsY, Double_t gYmin, Double_t gYmax) {
60     fNBinsX = nBinsX; fMinX = gXmin; fMaxX = gXmax;
61     fNBinsY = nBinsY; fMinY = gYmin; fMaxY = gYmax;
62   }
63   Int_t GetNBinsX() {return fNBinsX;}
64   Int_t GetNBinsY() {return fNBinsY;}
65   Double_t GetMinX() {return fMinX;}
66   Double_t GetMinY() {return fMinY;}
67   Double_t GetMaxX() {return fMaxX;}
68   Double_t GetMaxY() {return fMaxY;}
69
70   static Bool_t IsEventTriggered(const AliESDEvent *esd,
71                                  TriggerMode trigger = kMB2);
72   Bool_t IsAccepted(AliESDEvent *esd,
73                     const AliESDVertex *vertex, 
74                     AliESDtrack *track);
75   Bool_t IsInPhaseSpace(AliESDtrack *track);
76
77   Float_t GetSigmaToVertex(AliESDtrack* esdTrack) const; 
78   Double_t Rapidity(Double_t Px, Double_t Py, Double_t Pz) const;
79   
80   //Cut functions
81   void    SetPointOnITSLayer1() {fPointOnITSLayer1Flag = kTRUE;}
82   void    SetPointOnITSLayer2() {fPointOnITSLayer2Flag = kTRUE;}
83   void    SetPointOnITSLayer3() {fPointOnITSLayer3Flag = kTRUE;}
84   void    SetPointOnITSLayer4() {fPointOnITSLayer4Flag = kTRUE;}
85   void    SetPointOnITSLayer5() {fPointOnITSLayer5Flag = kTRUE;}
86   void    SetPointOnITSLayer6() {fPointOnITSLayer6Flag = kTRUE;}
87   void    SetMinITSClusters(Int_t minITSClusters) {
88     fMinITSClusters = minITSClusters;
89     fMinITSClustersFlag = kTRUE;
90   }
91   void    SetMaxChi2PerITSCluster(Double_t maxChi2PerITSCluster) {
92     fMaxChi2PerITSCluster = maxChi2PerITSCluster;
93     fMaxChi2PerITSClusterFlag = kTRUE;
94   }
95   void    SetMinTPCClusters(Int_t minTPCClusters) {
96     fMinTPCClusters = minTPCClusters;
97     fMinTPCClustersFlag = kTRUE;
98   }
99   void    SetMaxChi2PerTPCCluster(Double_t maxChi2PerTPCCluster) {
100     fMaxChi2PerTPCCluster = maxChi2PerTPCCluster;
101     fMaxChi2PerTPCClusterFlag = kTRUE;
102   }
103   void    SetMaxCov11(Double_t maxCov11) {
104     fMaxCov11 = maxCov11; fMaxCov11Flag = kTRUE;}
105   void    SetMaxCov22(Double_t maxCov22) {
106     fMaxCov22 = maxCov22; fMaxCov22Flag = kTRUE;}
107   void    SetMaxCov33(Double_t maxCov33) {
108     fMaxCov33 = maxCov33; fMaxCov33Flag = kTRUE;}
109   void    SetMaxCov44(Double_t maxCov44) {
110     fMaxCov44 = maxCov44; fMaxCov44Flag = kTRUE;}
111   void    SetMaxCov55(Double_t maxCov55) {
112     fMaxCov55 = maxCov55; fMaxCov55Flag = kTRUE;}
113   void    SetMaxSigmaToVertex(Double_t maxSigmaToVertex) {
114     fMaxSigmaToVertex = maxSigmaToVertex;
115     fMaxSigmaToVertexFlag = kTRUE;
116   }
117   void    SetMaxSigmaToVertexTPC(Double_t maxSigmaToVertex) {
118     fMaxSigmaToVertexTPC = maxSigmaToVertex;
119     fMaxSigmaToVertexTPCFlag = kTRUE;
120   }
121   void    SetMaxDCAXY(Double_t maxDCAXY) {
122     fMaxDCAXY = maxDCAXY;
123     fMaxDCAXYFlag = kTRUE;
124   }
125   void    SetMaxDCAXYTPC(Double_t maxDCAXY) {
126     fMaxDCAXYTPC = maxDCAXY;
127     fMaxDCAXYTPCFlag = kTRUE;
128   }
129   void    SetMaxDCAZ(Double_t maxDCAZ) {
130     fMaxDCAZ = maxDCAZ;
131     fMaxDCAZFlag = kTRUE;
132   }
133   void    SetMaxDCAZTPC(Double_t maxDCAZ) {
134     fMaxDCAZTPC = maxDCAZ;
135     fMaxDCAZTPCFlag = kTRUE;
136   }
137   void    SetMaxDCA3D(Double_t maxDCA3D) {
138     fMaxDCA3D = maxDCA3D;
139     fMaxDCA3DFlag = kTRUE;
140   }
141   void    SetMaxDCA3DTPC(Double_t maxDCA3D) {
142     fMaxDCA3DTPC = maxDCA3D;
143     fMaxDCA3DTPCFlag = kTRUE;
144   }
145   void    SetMaxConstrainChi2(Double_t maxConstrainChi2) {
146     fMaxConstrainChi2 = maxConstrainChi2;
147     fMaxConstrainChi2Flag = kTRUE;
148   }
149   void    SetITSRefit() {fITSRefitFlag = kTRUE;}
150   void    SetTPCRefit() {fTPCRefitFlag = kTRUE;}
151   void    SetESDpid() {fESDpidFlag = kTRUE;}
152   void    SetTPCpid() {fTPCpidFlag = kTRUE;}
153
154   TCanvas *GetListOfCuts();
155
156   //PID related functions
157   Bool_t IsProton(AliESDtrack *track);
158   void SetPriorProbabilities(Double_t * const partFrac) {
159     for(Int_t i = 0; i < AliPID::kSPECIESN; i++) fPartFrac[i] = partFrac[i];} 
160   void SetPriorProbabilityFunctions(TF1 *const felectron, 
161                                     TF1 *const fmuon, 
162                                     TF1 *const fpion, 
163                                     TF1 *const fkaon, 
164                                     TF1 *const fproton) {
165     fFunctionProbabilityFlag = kTRUE;
166     fElectronFunction = felectron; 
167     fMuonFunction = fmuon; 
168     fPionFunction = fpion;
169     fKaonFunction = fkaon;
170     fProtonFunction = fproton;
171   }
172   Bool_t IsPriorProbabilityFunctionUsed() {return fFunctionProbabilityFlag;}
173   Double_t GetParticleFraction(Int_t i, Double_t p);
174
175   void SetDebugMode() {fDebugMode = kTRUE;}
176   Bool_t GetDebugMode() {return fDebugMode;}
177
178  private:
179   AliProtonAnalysisBase(const AliProtonAnalysisBase&); // Not implemented
180   AliProtonAnalysisBase& operator=(const AliProtonAnalysisBase&); // Not implemented
181
182   TString fProtonAnalysisLevel;//"ESD", "AOD" or "MC"
183   TriggerMode fTriggerMode; //Trigger mode
184   AnalysisMode fProtonAnalysisMode; //Analysis mode: TPC-Hybrid-Global
185   PIDMode fProtonPIDMode; //PID mode: Bayesian-dE/dx ratio-Nsigma areas
186   Bool_t fAnalysisEtaMode; //run the analysis in eta or y
187
188   Double_t fVxMax, fVyMax, fVzMax; //vertex diamond constrain 
189
190   Int_t fNBinsX; //number of bins in y or eta
191   Double_t fMinX, fMaxX; //min & max value of y or eta
192   Int_t fNBinsY;  //number of bins in pT
193   Double_t fMinY, fMaxY; //min & max value of pT
194   
195   //cuts
196   Int_t fMinTPCClusters, fMinITSClusters; //min TPC & ITS clusters
197   Double_t fMaxChi2PerTPCCluster, fMaxChi2PerITSCluster; //max chi2 per TPC & ITS cluster
198   Double_t fMaxCov11, fMaxCov22, fMaxCov33, fMaxCov44, fMaxCov55; //max values of cov. matrix
199   Double_t fMaxSigmaToVertex; //max sigma to vertex cut
200   Double_t fMaxSigmaToVertexTPC; //max sigma to vertex cut
201   Double_t fMaxDCAXY, fMaxDCAXYTPC; //max DCA xy
202   Double_t fMaxDCAZ, fMaxDCAZTPC; //max DCA z
203   Double_t fMaxDCA3D, fMaxDCA3DTPC; //max DCA 3D
204   Double_t fMaxConstrainChi2; //max constrain chi2 - vertex
205   Bool_t fMinTPCClustersFlag, fMinITSClustersFlag; //shows if this cut is used or not
206   Bool_t fMaxChi2PerTPCClusterFlag, fMaxChi2PerITSClusterFlag; //shows if this cut is used or not
207   Bool_t fMaxCov11Flag, fMaxCov22Flag, fMaxCov33Flag, fMaxCov44Flag, fMaxCov55Flag; //shows if this cut is used or not
208   Bool_t fMaxSigmaToVertexFlag; //shows if this cut is used or not
209   Bool_t fMaxSigmaToVertexTPCFlag; //shows if this cut is used or not
210   Bool_t fMaxDCAXYFlag, fMaxDCAXYTPCFlag; //shows if this cut is used or not
211   Bool_t fMaxDCAZFlag, fMaxDCAZTPCFlag; //shows if this cut is used or not
212   Bool_t fMaxDCA3DFlag, fMaxDCA3DTPCFlag; //shows if this cut is used or not
213   Bool_t fMaxConstrainChi2Flag; //shows if this cut is used or not
214   Bool_t fITSRefitFlag, fTPCRefitFlag; //shows if this cut is used or not
215   Bool_t fESDpidFlag, fTPCpidFlag; //shows if this cut is used or not
216   Bool_t fPointOnITSLayer1Flag, fPointOnITSLayer2Flag; //shows if this cut is used or not
217   Bool_t fPointOnITSLayer3Flag, fPointOnITSLayer4Flag; //shows if this cut is used or not
218   Bool_t fPointOnITSLayer5Flag, fPointOnITSLayer6Flag; //shows if this cut is used or not
219   
220   //pid
221   Bool_t fFunctionProbabilityFlag; //flag: kTRUE if functions used
222   Double_t fPartFrac[10]; //prior probabilities
223   TF1  *fElectronFunction; //momentum dependence of the prior probs
224   TF1  *fMuonFunction; //momentum dependence of the prior probs
225   TF1  *fPionFunction; //momentum dependence of the prior probs
226   TF1  *fKaonFunction; //momentum dependence of the prior probs
227   TF1  *fProtonFunction; //momentum dependence of the prior probs
228
229   //Debug
230   Bool_t fDebugMode; //Enable the debug mode
231
232   ClassDef(AliProtonAnalysisBase,0);
233 };
234
235 #endif