Taking into account that only 1 or 2 values may be present for the
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonAnalysisBase.h
CommitLineData
0ab648ea 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"
18class TF1;
19class TCanvas;
20
21#include "AliPID.h"
22class AliESDEvent;
23class AliESDtrack;
24class AliESDVertex;
25
26class AliProtonAnalysisBase : public TObject {
27 public:
28 enum TriggerMode { kMB1 = 0, kMB2, kSPDFASTOR };
29 enum AnalysisMode { kInvalid = -1, kTPC = 0, kHybrid, kGlobal };
87a55728 30 enum PIDMode { kBayesian = 0, kRatio, kSigma1, kSigma2 };
0ab648ea 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();}
73aba974 42 AnalysisMode GetAnalysisMode() const {return fProtonAnalysisMode;}
43 Bool_t GetEtaMode() const {return fAnalysisEtaMode;}
44 TriggerMode GetTriggerMode() const {return fTriggerMode;}
45 PIDMode GetPIDMode() const {return fProtonPIDMode;}
0ab648ea 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;}
73aba974 54 Double_t GetVxMax() const {return fVxMax;}
55 Double_t GetVyMax() const {return fVyMax;}
56 Double_t GetVzMax() const {return fVzMax;}
0ab648ea 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 }
73aba974 63 Int_t GetNBinsX() const {return fNBinsX;}
64 Int_t GetNBinsY() const {return fNBinsY;}
65 Double_t GetMinX() const {return fMinX;}
66 Double_t GetMinY() const {return fMinY;}
67 Double_t GetMaxX() const {return fMaxX;}
68 Double_t GetMaxY() const {return fMaxY;}
0ab648ea 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;}
73aba974 87 Bool_t IsUsedPointOnITSLayer1() const {return fPointOnITSLayer1Flag;}
88 Bool_t IsUsedPointOnITSLayer2() const {return fPointOnITSLayer2Flag;}
89 Bool_t IsUsedPointOnITSLayer3() const {return fPointOnITSLayer3Flag;}
90 Bool_t IsUsedPointOnITSLayer4() const {return fPointOnITSLayer4Flag;}
91 Bool_t IsUsedPointOnITSLayer5() const {return fPointOnITSLayer5Flag;}
92 Bool_t IsUsedPointOnITSLayer6() const {return fPointOnITSLayer6Flag;}
0ab648ea 93 void SetMinITSClusters(Int_t minITSClusters) {
94 fMinITSClusters = minITSClusters;
95 fMinITSClustersFlag = kTRUE;
96 }
73aba974 97 Int_t GetMinITSClusters() const {return fMinITSClusters;}
98 Bool_t IsUsedMinITSClusters() const {return fMinITSClustersFlag;}
e7df5638 99
0ab648ea 100 void SetMaxChi2PerITSCluster(Double_t maxChi2PerITSCluster) {
101 fMaxChi2PerITSCluster = maxChi2PerITSCluster;
102 fMaxChi2PerITSClusterFlag = kTRUE;
103 }
73aba974 104 Bool_t IsUsedMaxChi2PerITSCluster() const {return fMaxChi2PerITSClusterFlag;}
105 Double_t GetMaxChi2PerITSCluster() const {return fMaxChi2PerITSCluster;}
e7df5638 106
0ab648ea 107 void SetMinTPCClusters(Int_t minTPCClusters) {
108 fMinTPCClusters = minTPCClusters;
109 fMinTPCClustersFlag = kTRUE;
110 }
73aba974 111 Bool_t IsUsedMinTPCClusters() const {return fMinTPCClustersFlag;}
112 Int_t GetMinTPCClusters() const {return fMinTPCClusters;}
e7df5638 113
0ab648ea 114 void SetMaxChi2PerTPCCluster(Double_t maxChi2PerTPCCluster) {
115 fMaxChi2PerTPCCluster = maxChi2PerTPCCluster;
116 fMaxChi2PerTPCClusterFlag = kTRUE;
117 }
73aba974 118 Bool_t IsUsedMaxChi2PerTPCCluster() const {return fMaxChi2PerTPCClusterFlag;}
119 Double_t GetMaxChi2PerTPCCluster() const {return fMaxChi2PerTPCCluster;}
e7df5638 120
0ab648ea 121 void SetMaxCov11(Double_t maxCov11) {
122 fMaxCov11 = maxCov11; fMaxCov11Flag = kTRUE;}
123 void SetMaxCov22(Double_t maxCov22) {
124 fMaxCov22 = maxCov22; fMaxCov22Flag = kTRUE;}
125 void SetMaxCov33(Double_t maxCov33) {
126 fMaxCov33 = maxCov33; fMaxCov33Flag = kTRUE;}
127 void SetMaxCov44(Double_t maxCov44) {
128 fMaxCov44 = maxCov44; fMaxCov44Flag = kTRUE;}
129 void SetMaxCov55(Double_t maxCov55) {
130 fMaxCov55 = maxCov55; fMaxCov55Flag = kTRUE;}
73aba974 131 Bool_t IsUsedMaxCov11() const {return fMaxCov11Flag;}
132 Bool_t IsUsedMaxCov22() const {return fMaxCov22Flag;}
133 Bool_t IsUsedMaxCov33() const {return fMaxCov33Flag;}
134 Bool_t IsUsedMaxCov44() const {return fMaxCov44Flag;}
135 Bool_t IsUsedMaxCov55() const {return fMaxCov55Flag;}
136 Double_t GetMaxCov11() const {return fMaxCov11;}
137 Double_t GetMaxCov22() const {return fMaxCov22;}
138 Double_t GetMaxCov33() const {return fMaxCov33;}
139 Double_t GetMaxCov44() const {return fMaxCov44;}
140 Double_t GetMaxCov55() const {return fMaxCov55;}
e7df5638 141
0ab648ea 142 void SetMaxSigmaToVertex(Double_t maxSigmaToVertex) {
143 fMaxSigmaToVertex = maxSigmaToVertex;
144 fMaxSigmaToVertexFlag = kTRUE;
145 }
73aba974 146 Bool_t IsUsedMaxSigmaToVertex() const {return fMaxSigmaToVertexFlag;}
147 Double_t GetMaxSigmaToVertex() const {return fMaxSigmaToVertex;}
e7df5638 148
0ab648ea 149 void SetMaxSigmaToVertexTPC(Double_t maxSigmaToVertex) {
150 fMaxSigmaToVertexTPC = maxSigmaToVertex;
151 fMaxSigmaToVertexTPCFlag = kTRUE;
152 }
73aba974 153 Bool_t IsUsedMaxSigmaToVertexTPC() const {return fMaxSigmaToVertexTPCFlag;}
154 Double_t GetMaxSigmaToVertexTPC() const {return fMaxSigmaToVertexTPC;}
e7df5638 155
0ab648ea 156 void SetMaxDCAXY(Double_t maxDCAXY) {
157 fMaxDCAXY = maxDCAXY;
158 fMaxDCAXYFlag = kTRUE;
159 }
73aba974 160 Bool_t IsUsedMaxDCAXY() const {return fMaxDCAXYFlag;}
161 Double_t GetMaxDCAXY() const {return fMaxDCAXY;}
e7df5638 162
0ab648ea 163 void SetMaxDCAXYTPC(Double_t maxDCAXY) {
164 fMaxDCAXYTPC = maxDCAXY;
165 fMaxDCAXYTPCFlag = kTRUE;
166 }
73aba974 167 Bool_t IsUsedMaxDCAXYTPC() const {return fMaxDCAXYTPCFlag;}
168 Double_t GetMaxDCAXYTPC() const {return fMaxDCAXYTPC;}
e7df5638 169
0ab648ea 170 void SetMaxDCAZ(Double_t maxDCAZ) {
171 fMaxDCAZ = maxDCAZ;
172 fMaxDCAZFlag = kTRUE;
173 }
73aba974 174 Bool_t IsUsedMaxDCAZ() const {return fMaxDCAZFlag;}
175 Double_t GetMaxDCAZ() const {return fMaxDCAZ;}
e7df5638 176
0ab648ea 177 void SetMaxDCAZTPC(Double_t maxDCAZ) {
178 fMaxDCAZTPC = maxDCAZ;
179 fMaxDCAZTPCFlag = kTRUE;
180 }
73aba974 181 Bool_t IsUsedMaxDCAZTPC() const {return fMaxDCAZTPCFlag;}
182 Double_t GetMaxDCAZTPC() const {return fMaxDCAZTPC;}
e7df5638 183
0ab648ea 184 void SetMaxDCA3D(Double_t maxDCA3D) {
185 fMaxDCA3D = maxDCA3D;
186 fMaxDCA3DFlag = kTRUE;
187 }
73aba974 188 Bool_t IsUsedMaxDCA3D() const {return fMaxDCA3DFlag;}
189 Double_t GetMaxDCA3D() const {return fMaxDCA3D;}
e7df5638 190
0ab648ea 191 void SetMaxDCA3DTPC(Double_t maxDCA3D) {
192 fMaxDCA3DTPC = maxDCA3D;
193 fMaxDCA3DTPCFlag = kTRUE;
194 }
73aba974 195 Bool_t IsUsedMaxDCA3DTPC() const {return fMaxDCA3DTPCFlag;}
196 Double_t GetMaxDCA3DTPC() const {return fMaxDCA3DTPC;}
e7df5638 197
0ab648ea 198 void SetMaxConstrainChi2(Double_t maxConstrainChi2) {
199 fMaxConstrainChi2 = maxConstrainChi2;
200 fMaxConstrainChi2Flag = kTRUE;
201 }
73aba974 202 Bool_t IsUsedMaxConstrainChi2() const {return fMaxConstrainChi2Flag;}
203 Double_t GetMaxConstrainChi2() const {return fMaxConstrainChi2;}
e7df5638 204
87a55728 205 void SetMinTPCdEdxPoints(Int_t mindEdxpoints) {
206 fMinTPCdEdxPoints = mindEdxpoints;
207 fMinTPCdEdxPointsFlag = kTRUE;
208 }
73aba974 209 Bool_t IsUsedMinTPCdEdxPoints() const {return fMinTPCdEdxPointsFlag;}
210 Int_t GetMinTPCdEdxPoints() const {return fMinTPCdEdxPoints;}
87a55728 211
0ab648ea 212 void SetITSRefit() {fITSRefitFlag = kTRUE;}
73aba974 213 Bool_t IsUsedITSRefit() const {return fITSRefitFlag;}
0ab648ea 214 void SetTPCRefit() {fTPCRefitFlag = kTRUE;}
73aba974 215 Bool_t IsUsedTPCRefit() const {return fTPCRefitFlag;}
0ab648ea 216 void SetESDpid() {fESDpidFlag = kTRUE;}
73aba974 217 Bool_t IsUsedESDpid() const {return fESDpidFlag;}
0ab648ea 218 void SetTPCpid() {fTPCpidFlag = kTRUE;}
73aba974 219 Bool_t IsUsedTPCpid() const {return fTPCpidFlag;}
f62e9410 220 void SetTOFpid() {fTOFpidFlag = kTRUE;}
221 Bool_t IsUsedTOFpid() const {return fTOFpidFlag;}
0ab648ea 222
223 TCanvas *GetListOfCuts();
224
225 //PID related functions
226 Bool_t IsProton(AliESDtrack *track);
87a55728 227 void SetNSigma(Int_t nsigma) {fNSigma = nsigma;}
73aba974 228 Int_t GetNSigma() const {return fNSigma;}
87a55728 229 void SetdEdxBandInfo(const char* filename);
0ab648ea 230 void SetPriorProbabilities(Double_t * const partFrac) {
231 for(Int_t i = 0; i < AliPID::kSPECIESN; i++) fPartFrac[i] = partFrac[i];}
232 void SetPriorProbabilityFunctions(TF1 *const felectron,
233 TF1 *const fmuon,
234 TF1 *const fpion,
235 TF1 *const fkaon,
236 TF1 *const fproton) {
237 fFunctionProbabilityFlag = kTRUE;
73aba974 238 fElectronFunction = felectron; fMuonFunction = fmuon;
239 fPionFunction = fpion; fKaonFunction = fkaon; fProtonFunction = fproton;
0ab648ea 240 }
73aba974 241 Bool_t IsPriorProbabilityFunctionUsed() const {return fFunctionProbabilityFlag;}
0ab648ea 242 Double_t GetParticleFraction(Int_t i, Double_t p);
73aba974 243 Double_t Bethe(Double_t bg) const;
0ab648ea 244
245 void SetDebugMode() {fDebugMode = kTRUE;}
73aba974 246 Bool_t GetDebugMode() const {return fDebugMode;}
0ab648ea 247
248 private:
249 AliProtonAnalysisBase(const AliProtonAnalysisBase&); // Not implemented
250 AliProtonAnalysisBase& operator=(const AliProtonAnalysisBase&); // Not implemented
251
252 TString fProtonAnalysisLevel;//"ESD", "AOD" or "MC"
253 TriggerMode fTriggerMode; //Trigger mode
254 AnalysisMode fProtonAnalysisMode; //Analysis mode: TPC-Hybrid-Global
255 PIDMode fProtonPIDMode; //PID mode: Bayesian-dE/dx ratio-Nsigma areas
256 Bool_t fAnalysisEtaMode; //run the analysis in eta or y
257
258 Double_t fVxMax, fVyMax, fVzMax; //vertex diamond constrain
259
260 Int_t fNBinsX; //number of bins in y or eta
261 Double_t fMinX, fMaxX; //min & max value of y or eta
262 Int_t fNBinsY; //number of bins in pT
263 Double_t fMinY, fMaxY; //min & max value of pT
264
265 //cuts
266 Int_t fMinTPCClusters, fMinITSClusters; //min TPC & ITS clusters
267 Double_t fMaxChi2PerTPCCluster, fMaxChi2PerITSCluster; //max chi2 per TPC & ITS cluster
268 Double_t fMaxCov11, fMaxCov22, fMaxCov33, fMaxCov44, fMaxCov55; //max values of cov. matrix
269 Double_t fMaxSigmaToVertex; //max sigma to vertex cut
270 Double_t fMaxSigmaToVertexTPC; //max sigma to vertex cut
271 Double_t fMaxDCAXY, fMaxDCAXYTPC; //max DCA xy
272 Double_t fMaxDCAZ, fMaxDCAZTPC; //max DCA z
273 Double_t fMaxDCA3D, fMaxDCA3DTPC; //max DCA 3D
274 Double_t fMaxConstrainChi2; //max constrain chi2 - vertex
87a55728 275 Int_t fMinTPCdEdxPoints;//min number of TPC points used for the dE/dx
0ab648ea 276 Bool_t fMinTPCClustersFlag, fMinITSClustersFlag; //shows if this cut is used or not
277 Bool_t fMaxChi2PerTPCClusterFlag, fMaxChi2PerITSClusterFlag; //shows if this cut is used or not
278 Bool_t fMaxCov11Flag, fMaxCov22Flag, fMaxCov33Flag, fMaxCov44Flag, fMaxCov55Flag; //shows if this cut is used or not
279 Bool_t fMaxSigmaToVertexFlag; //shows if this cut is used or not
280 Bool_t fMaxSigmaToVertexTPCFlag; //shows if this cut is used or not
281 Bool_t fMaxDCAXYFlag, fMaxDCAXYTPCFlag; //shows if this cut is used or not
282 Bool_t fMaxDCAZFlag, fMaxDCAZTPCFlag; //shows if this cut is used or not
283 Bool_t fMaxDCA3DFlag, fMaxDCA3DTPCFlag; //shows if this cut is used or not
284 Bool_t fMaxConstrainChi2Flag; //shows if this cut is used or not
285 Bool_t fITSRefitFlag, fTPCRefitFlag; //shows if this cut is used or not
f62e9410 286 Bool_t fESDpidFlag, fTPCpidFlag, fTOFpidFlag; //shows if this cut is used or not
0ab648ea 287 Bool_t fPointOnITSLayer1Flag, fPointOnITSLayer2Flag; //shows if this cut is used or not
288 Bool_t fPointOnITSLayer3Flag, fPointOnITSLayer4Flag; //shows if this cut is used or not
289 Bool_t fPointOnITSLayer5Flag, fPointOnITSLayer6Flag; //shows if this cut is used or not
87a55728 290 Bool_t fMinTPCdEdxPointsFlag; //shows if this cut is used or not
291
0ab648ea 292 //pid
293 Bool_t fFunctionProbabilityFlag; //flag: kTRUE if functions used
87a55728 294 Int_t fNSigma; //N-sigma cut in the dE/dx band
295 Double_t fdEdxMean[24]; //mean values of the dE/dx distributions for the proton band - P slices
296 Double_t fdEdxSigma[24]; //sigma values of the dE/dx distributions for the proton band - P slices
0ab648ea 297 Double_t fPartFrac[10]; //prior probabilities
298 TF1 *fElectronFunction; //momentum dependence of the prior probs
299 TF1 *fMuonFunction; //momentum dependence of the prior probs
300 TF1 *fPionFunction; //momentum dependence of the prior probs
301 TF1 *fKaonFunction; //momentum dependence of the prior probs
302 TF1 *fProtonFunction; //momentum dependence of the prior probs
303
304 //Debug
305 Bool_t fDebugMode; //Enable the debug mode
306
e7df5638 307 ClassDef(AliProtonAnalysisBase,1);
0ab648ea 308};
309
310#endif