]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/SPECTRA/AliProtonAnalysisBase.h
Coverity fixes for BUFFER_SIZE
[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;
735cc63d 20class TList;
0ab648ea 21
f203beb9 22#include "AliPhysicsSelection.h"
df201289 23#include "AliBackgroundSelection.h"
0ab648ea 24#include "AliPID.h"
25class AliESDEvent;
26class AliESDtrack;
27class AliESDVertex;
28
29class AliProtonAnalysisBase : public TObject {
30 public:
31 enum TriggerMode { kMB1 = 0, kMB2, kSPDFASTOR };
afc2ac17 32 enum AnalysisMode { kInvalid = -1, kTPC = 0, kHybrid, kFullHybrid, kGlobal };
c6909683 33 enum PIDMode { kBayesian = 0, kRatio, kSigma};
0ab648ea 34
35 AliProtonAnalysisBase();
36 virtual ~AliProtonAnalysisBase();
37
38 void SetAnalysisLevel(const char* type) {fProtonAnalysisLevel = type;}
39 void SetAnalysisMode(AnalysisMode analysismode) {fProtonAnalysisMode = analysismode;}
40 void SetEtaMode() {fAnalysisEtaMode = kTRUE;}
790140ac 41 void SetTriggerMode(TriggerMode triggermode) {
42 fAnalysisMC = kTRUE; fTriggerMode = triggermode;}
0ab648ea 43 void SetPIDMode(PIDMode pidmode) {fProtonPIDMode = pidmode;}
44
45 const char *GetAnalysisLevel() {return fProtonAnalysisLevel.Data();}
73aba974 46 AnalysisMode GetAnalysisMode() const {return fProtonAnalysisMode;}
47 Bool_t GetEtaMode() const {return fAnalysisEtaMode;}
48 TriggerMode GetTriggerMode() const {return fTriggerMode;}
49 PIDMode GetPIDMode() const {return fProtonPIDMode;}
790140ac 50 Bool_t GetMCAnalysisMode() {return fAnalysisMC;}
0ab648ea 51
52 const AliESDVertex *GetVertex(AliESDEvent *esd,
53 AnalysisMode mode,
54 Double_t gVx = 100.,
55 Double_t gVy = 100.,
56 Double_t gVz = 100.);
57 void SetAcceptedVertexDiamond(Double_t gVx, Double_t gVy, Double_t gVz) {
58 fVxMax = gVx; fVyMax = gVy; fVzMax = gVz;}
73aba974 59 Double_t GetVxMax() const {return fVxMax;}
60 Double_t GetVyMax() const {return fVyMax;}
61 Double_t GetVzMax() const {return fVzMax;}
e56f08ed 62 void SetMinNumOfContributors(Int_t nContributors) {
63 fMinNumOfContributors = nContributors;}
64 Int_t GetMinNumOfContributors() {return fMinNumOfContributors;}
0ab648ea 65
66 void SetPhaseSpace(Int_t nBinsX, Double_t gXmin, Double_t gXmax,
67 Int_t nBinsY, Double_t gYmin, Double_t gYmax) {
68 fNBinsX = nBinsX; fMinX = gXmin; fMaxX = gXmax;
69 fNBinsY = nBinsY; fMinY = gYmin; fMaxY = gYmax;
70 }
73aba974 71 Int_t GetNBinsX() const {return fNBinsX;}
72 Int_t GetNBinsY() const {return fNBinsY;}
73 Double_t GetMinX() const {return fMinX;}
74 Double_t GetMinY() const {return fMinY;}
75 Double_t GetMaxX() const {return fMaxX;}
76 Double_t GetMaxY() const {return fMaxY;}
0ab648ea 77
c21b8f31 78 //Trigger
e56f08ed 79 Bool_t IsOnlineTriggerUsed() {return kUseOnlineTrigger;}
80 void UseOnlineTrigger() {kUseOnlineTrigger = kTRUE;}
42270c4c 81 Bool_t IsEventTriggered(const AliESDEvent *esd,
82 TriggerMode trigger = kMB2);
df201289 83 void OfflineTriggerInit() {
f203beb9 84 kUseOfflineTrigger = kTRUE;
85 fPhysicsSelection = new AliPhysicsSelection();
c21b8f31 86 fPhysicsSelection->AddBackgroundIdentification(new AliBackgroundSelection());
df201289 87 fPhysicsSelection->SetAnalyzeMC(fAnalysisMC);
f203beb9 88 }
89 Bool_t IsOfflineTriggerUsed() {return kUseOfflineTrigger;}
90 AliPhysicsSelection *GetPhysicsSelectionObject() {return fPhysicsSelection;}
c21b8f31 91
e56f08ed 92 Bool_t IsPrimary(AliESDEvent *esd,
93 const AliESDVertex *vertex,
94 AliESDtrack *track);
30f87a5b 95 Bool_t IsAccepted(AliESDtrack *track);
0ab648ea 96 Bool_t IsInPhaseSpace(AliESDtrack *track);
97
98 Float_t GetSigmaToVertex(AliESDtrack* esdTrack) const;
99 Double_t Rapidity(Double_t Px, Double_t Py, Double_t Pz) const;
100
101 //Cut functions
4787e0ca 102 void SetPointOnSPDLayers() {fPointOnSPDLayersFlag = kTRUE;}
103 void SetPointOnSDDLayers() {fPointOnSDDLayersFlag = kTRUE;}
104 void SetPointOnSSDLayers() {fPointOnSSDLayersFlag = kTRUE;}
0ab648ea 105 void SetPointOnITSLayer1() {fPointOnITSLayer1Flag = kTRUE;}
106 void SetPointOnITSLayer2() {fPointOnITSLayer2Flag = kTRUE;}
107 void SetPointOnITSLayer3() {fPointOnITSLayer3Flag = kTRUE;}
108 void SetPointOnITSLayer4() {fPointOnITSLayer4Flag = kTRUE;}
109 void SetPointOnITSLayer5() {fPointOnITSLayer5Flag = kTRUE;}
110 void SetPointOnITSLayer6() {fPointOnITSLayer6Flag = kTRUE;}
4787e0ca 111 Bool_t IsUsedPointOnSPDLayer() const {return fPointOnSPDLayersFlag;}
112 Bool_t IsUsedPointOnSDDLayer() const {return fPointOnSDDLayersFlag;}
113 Bool_t IsUsedPointOnSSDLayer() const {return fPointOnSSDLayersFlag;}
73aba974 114 Bool_t IsUsedPointOnITSLayer1() const {return fPointOnITSLayer1Flag;}
115 Bool_t IsUsedPointOnITSLayer2() const {return fPointOnITSLayer2Flag;}
116 Bool_t IsUsedPointOnITSLayer3() const {return fPointOnITSLayer3Flag;}
117 Bool_t IsUsedPointOnITSLayer4() const {return fPointOnITSLayer4Flag;}
118 Bool_t IsUsedPointOnITSLayer5() const {return fPointOnITSLayer5Flag;}
119 Bool_t IsUsedPointOnITSLayer6() const {return fPointOnITSLayer6Flag;}
0ab648ea 120 void SetMinITSClusters(Int_t minITSClusters) {
121 fMinITSClusters = minITSClusters;
122 fMinITSClustersFlag = kTRUE;
123 }
73aba974 124 Int_t GetMinITSClusters() const {return fMinITSClusters;}
125 Bool_t IsUsedMinITSClusters() const {return fMinITSClustersFlag;}
e7df5638 126
0ab648ea 127 void SetMaxChi2PerITSCluster(Double_t maxChi2PerITSCluster) {
128 fMaxChi2PerITSCluster = maxChi2PerITSCluster;
129 fMaxChi2PerITSClusterFlag = kTRUE;
130 }
73aba974 131 Bool_t IsUsedMaxChi2PerITSCluster() const {return fMaxChi2PerITSClusterFlag;}
132 Double_t GetMaxChi2PerITSCluster() const {return fMaxChi2PerITSCluster;}
e7df5638 133
0ab648ea 134 void SetMinTPCClusters(Int_t minTPCClusters) {
135 fMinTPCClusters = minTPCClusters;
136 fMinTPCClustersFlag = kTRUE;
137 }
73aba974 138 Bool_t IsUsedMinTPCClusters() const {return fMinTPCClustersFlag;}
139 Int_t GetMinTPCClusters() const {return fMinTPCClusters;}
e7df5638 140
0ab648ea 141 void SetMaxChi2PerTPCCluster(Double_t maxChi2PerTPCCluster) {
142 fMaxChi2PerTPCCluster = maxChi2PerTPCCluster;
143 fMaxChi2PerTPCClusterFlag = kTRUE;
144 }
73aba974 145 Bool_t IsUsedMaxChi2PerTPCCluster() const {return fMaxChi2PerTPCClusterFlag;}
146 Double_t GetMaxChi2PerTPCCluster() const {return fMaxChi2PerTPCCluster;}
e7df5638 147
0ab648ea 148 void SetMaxCov11(Double_t maxCov11) {
149 fMaxCov11 = maxCov11; fMaxCov11Flag = kTRUE;}
150 void SetMaxCov22(Double_t maxCov22) {
151 fMaxCov22 = maxCov22; fMaxCov22Flag = kTRUE;}
152 void SetMaxCov33(Double_t maxCov33) {
153 fMaxCov33 = maxCov33; fMaxCov33Flag = kTRUE;}
154 void SetMaxCov44(Double_t maxCov44) {
155 fMaxCov44 = maxCov44; fMaxCov44Flag = kTRUE;}
156 void SetMaxCov55(Double_t maxCov55) {
157 fMaxCov55 = maxCov55; fMaxCov55Flag = kTRUE;}
73aba974 158 Bool_t IsUsedMaxCov11() const {return fMaxCov11Flag;}
159 Bool_t IsUsedMaxCov22() const {return fMaxCov22Flag;}
160 Bool_t IsUsedMaxCov33() const {return fMaxCov33Flag;}
161 Bool_t IsUsedMaxCov44() const {return fMaxCov44Flag;}
162 Bool_t IsUsedMaxCov55() const {return fMaxCov55Flag;}
163 Double_t GetMaxCov11() const {return fMaxCov11;}
164 Double_t GetMaxCov22() const {return fMaxCov22;}
165 Double_t GetMaxCov33() const {return fMaxCov33;}
166 Double_t GetMaxCov44() const {return fMaxCov44;}
167 Double_t GetMaxCov55() const {return fMaxCov55;}
e7df5638 168
0ab648ea 169 void SetMaxSigmaToVertex(Double_t maxSigmaToVertex) {
170 fMaxSigmaToVertex = maxSigmaToVertex;
171 fMaxSigmaToVertexFlag = kTRUE;
172 }
73aba974 173 Bool_t IsUsedMaxSigmaToVertex() const {return fMaxSigmaToVertexFlag;}
174 Double_t GetMaxSigmaToVertex() const {return fMaxSigmaToVertex;}
e7df5638 175
0ab648ea 176 void SetMaxSigmaToVertexTPC(Double_t maxSigmaToVertex) {
177 fMaxSigmaToVertexTPC = maxSigmaToVertex;
178 fMaxSigmaToVertexTPCFlag = kTRUE;
179 }
73aba974 180 Bool_t IsUsedMaxSigmaToVertexTPC() const {return fMaxSigmaToVertexTPCFlag;}
181 Double_t GetMaxSigmaToVertexTPC() const {return fMaxSigmaToVertexTPC;}
e7df5638 182
0ab648ea 183 void SetMaxDCAXY(Double_t maxDCAXY) {
184 fMaxDCAXY = maxDCAXY;
185 fMaxDCAXYFlag = kTRUE;
186 }
73aba974 187 Bool_t IsUsedMaxDCAXY() const {return fMaxDCAXYFlag;}
188 Double_t GetMaxDCAXY() const {return fMaxDCAXY;}
e7df5638 189
0ab648ea 190 void SetMaxDCAXYTPC(Double_t maxDCAXY) {
191 fMaxDCAXYTPC = maxDCAXY;
192 fMaxDCAXYTPCFlag = kTRUE;
193 }
73aba974 194 Bool_t IsUsedMaxDCAXYTPC() const {return fMaxDCAXYTPCFlag;}
195 Double_t GetMaxDCAXYTPC() const {return fMaxDCAXYTPC;}
e7df5638 196
0ab648ea 197 void SetMaxDCAZ(Double_t maxDCAZ) {
198 fMaxDCAZ = maxDCAZ;
199 fMaxDCAZFlag = kTRUE;
200 }
73aba974 201 Bool_t IsUsedMaxDCAZ() const {return fMaxDCAZFlag;}
202 Double_t GetMaxDCAZ() const {return fMaxDCAZ;}
e7df5638 203
0ab648ea 204 void SetMaxDCAZTPC(Double_t maxDCAZ) {
205 fMaxDCAZTPC = maxDCAZ;
206 fMaxDCAZTPCFlag = kTRUE;
207 }
73aba974 208 Bool_t IsUsedMaxDCAZTPC() const {return fMaxDCAZTPCFlag;}
209 Double_t GetMaxDCAZTPC() const {return fMaxDCAZTPC;}
e7df5638 210
0ab648ea 211 void SetMaxDCA3D(Double_t maxDCA3D) {
212 fMaxDCA3D = maxDCA3D;
213 fMaxDCA3DFlag = kTRUE;
214 }
73aba974 215 Bool_t IsUsedMaxDCA3D() const {return fMaxDCA3DFlag;}
216 Double_t GetMaxDCA3D() const {return fMaxDCA3D;}
e7df5638 217
ff1c9f70 218 void SetPtDependentDCAxy(Int_t nSigma, Double_t p0,
219 Double_t p1, Double_t p2);
220 Bool_t IsUsedPtDependentDCAxy() const {return fPtDependentDcaXYFlag;}
221
0ab648ea 222 void SetMaxDCA3DTPC(Double_t maxDCA3D) {
223 fMaxDCA3DTPC = maxDCA3D;
224 fMaxDCA3DTPCFlag = kTRUE;
225 }
73aba974 226 Bool_t IsUsedMaxDCA3DTPC() const {return fMaxDCA3DTPCFlag;}
227 Double_t GetMaxDCA3DTPC() const {return fMaxDCA3DTPC;}
e7df5638 228
0ab648ea 229 void SetMaxConstrainChi2(Double_t maxConstrainChi2) {
230 fMaxConstrainChi2 = maxConstrainChi2;
231 fMaxConstrainChi2Flag = kTRUE;
232 }
73aba974 233 Bool_t IsUsedMaxConstrainChi2() const {return fMaxConstrainChi2Flag;}
234 Double_t GetMaxConstrainChi2() const {return fMaxConstrainChi2;}
e7df5638 235
87a55728 236 void SetMinTPCdEdxPoints(Int_t mindEdxpoints) {
237 fMinTPCdEdxPoints = mindEdxpoints;
238 fMinTPCdEdxPointsFlag = kTRUE;
239 }
73aba974 240 Bool_t IsUsedMinTPCdEdxPoints() const {return fMinTPCdEdxPointsFlag;}
241 Int_t GetMinTPCdEdxPoints() const {return fMinTPCdEdxPoints;}
87a55728 242
0ab648ea 243 void SetITSRefit() {fITSRefitFlag = kTRUE;}
73aba974 244 Bool_t IsUsedITSRefit() const {return fITSRefitFlag;}
0ab648ea 245 void SetTPCRefit() {fTPCRefitFlag = kTRUE;}
73aba974 246 Bool_t IsUsedTPCRefit() const {return fTPCRefitFlag;}
0ab648ea 247 void SetESDpid() {fESDpidFlag = kTRUE;}
73aba974 248 Bool_t IsUsedESDpid() const {return fESDpidFlag;}
0ab648ea 249 void SetTPCpid() {fTPCpidFlag = kTRUE;}
73aba974 250 Bool_t IsUsedTPCpid() const {return fTPCpidFlag;}
f62e9410 251 void SetTOFpid() {fTOFpidFlag = kTRUE;}
252 Bool_t IsUsedTOFpid() const {return fTOFpidFlag;}
0ab648ea 253
254 TCanvas *GetListOfCuts();
255
256 //PID related functions
257 Bool_t IsProton(AliESDtrack *track);
87a55728 258 void SetNSigma(Int_t nsigma) {fNSigma = nsigma;}
73aba974 259 Int_t GetNSigma() const {return fNSigma;}
c6909683 260 void SetRatio(Double_t ratio) {fNRatio = ratio;}
261 Double_t GetRatio() {return fNRatio;}
0ab648ea 262 void SetPriorProbabilities(Double_t * const partFrac) {
263 for(Int_t i = 0; i < AliPID::kSPECIESN; i++) fPartFrac[i] = partFrac[i];}
264 void SetPriorProbabilityFunctions(TF1 *const felectron,
265 TF1 *const fmuon,
266 TF1 *const fpion,
267 TF1 *const fkaon,
268 TF1 *const fproton) {
269 fFunctionProbabilityFlag = kTRUE;
73aba974 270 fElectronFunction = felectron; fMuonFunction = fmuon;
271 fPionFunction = fpion; fKaonFunction = fkaon; fProtonFunction = fproton;
0ab648ea 272 }
73aba974 273 Bool_t IsPriorProbabilityFunctionUsed() const {return fFunctionProbabilityFlag;}
0ab648ea 274 Double_t GetParticleFraction(Int_t i, Double_t p);
c6909683 275 //Double_t Bethe(Double_t bg) const;
0ab648ea 276
277 void SetDebugMode() {fDebugMode = kTRUE;}
73aba974 278 Bool_t GetDebugMode() const {return fDebugMode;}
0ab648ea 279
2f6dae44 280 void SetRunQA() {fRunQAAnalysis = kTRUE;}
281 Bool_t IsQARun() {return fRunQAAnalysis;}
735cc63d 282 TList *GetVertexQAList() {return fListVertexQA;}
283
0ab648ea 284 private:
285 AliProtonAnalysisBase(const AliProtonAnalysisBase&); // Not implemented
286 AliProtonAnalysisBase& operator=(const AliProtonAnalysisBase&); // Not implemented
287
288 TString fProtonAnalysisLevel;//"ESD", "AOD" or "MC"
0bb8f6b4 289 Bool_t fAnalysisMC; //kTRUE if MC analysis while reading the ESDs
0ab648ea 290 TriggerMode fTriggerMode; //Trigger mode
e56f08ed 291 Bool_t kUseOnlineTrigger; //use the online trigger or not
f203beb9 292 Bool_t kUseOfflineTrigger; //use the offline trigger or not
293 AliPhysicsSelection *fPhysicsSelection; //Trigger selection: offline
0ab648ea 294 AnalysisMode fProtonAnalysisMode; //Analysis mode: TPC-Hybrid-Global
295 PIDMode fProtonPIDMode; //PID mode: Bayesian-dE/dx ratio-Nsigma areas
296 Bool_t fAnalysisEtaMode; //run the analysis in eta or y
297
2f6dae44 298 Bool_t fRunQAAnalysis; //boolnean to indicate to run the QA or not
0ab648ea 299 Double_t fVxMax, fVyMax, fVzMax; //vertex diamond constrain
e56f08ed 300 Int_t fMinNumOfContributors;//min number of contributors
0ab648ea 301
302 Int_t fNBinsX; //number of bins in y or eta
303 Double_t fMinX, fMaxX; //min & max value of y or eta
304 Int_t fNBinsY; //number of bins in pT
305 Double_t fMinY, fMaxY; //min & max value of pT
306
307 //cuts
308 Int_t fMinTPCClusters, fMinITSClusters; //min TPC & ITS clusters
309 Double_t fMaxChi2PerTPCCluster, fMaxChi2PerITSCluster; //max chi2 per TPC & ITS cluster
310 Double_t fMaxCov11, fMaxCov22, fMaxCov33, fMaxCov44, fMaxCov55; //max values of cov. matrix
311 Double_t fMaxSigmaToVertex; //max sigma to vertex cut
312 Double_t fMaxSigmaToVertexTPC; //max sigma to vertex cut
313 Double_t fMaxDCAXY, fMaxDCAXYTPC; //max DCA xy
314 Double_t fMaxDCAZ, fMaxDCAZTPC; //max DCA z
315 Double_t fMaxDCA3D, fMaxDCA3DTPC; //max DCA 3D
316 Double_t fMaxConstrainChi2; //max constrain chi2 - vertex
87a55728 317 Int_t fMinTPCdEdxPoints;//min number of TPC points used for the dE/dx
0ab648ea 318 Bool_t fMinTPCClustersFlag, fMinITSClustersFlag; //shows if this cut is used or not
319 Bool_t fMaxChi2PerTPCClusterFlag, fMaxChi2PerITSClusterFlag; //shows if this cut is used or not
320 Bool_t fMaxCov11Flag, fMaxCov22Flag, fMaxCov33Flag, fMaxCov44Flag, fMaxCov55Flag; //shows if this cut is used or not
321 Bool_t fMaxSigmaToVertexFlag; //shows if this cut is used or not
322 Bool_t fMaxSigmaToVertexTPCFlag; //shows if this cut is used or not
323 Bool_t fMaxDCAXYFlag, fMaxDCAXYTPCFlag; //shows if this cut is used or not
324 Bool_t fMaxDCAZFlag, fMaxDCAZTPCFlag; //shows if this cut is used or not
325 Bool_t fMaxDCA3DFlag, fMaxDCA3DTPCFlag; //shows if this cut is used or not
326 Bool_t fMaxConstrainChi2Flag; //shows if this cut is used or not
327 Bool_t fITSRefitFlag, fTPCRefitFlag; //shows if this cut is used or not
f62e9410 328 Bool_t fESDpidFlag, fTPCpidFlag, fTOFpidFlag; //shows if this cut is used or not
4787e0ca 329 Bool_t fPointOnSPDLayersFlag;//shows if this cut is used or not
330 Bool_t fPointOnSDDLayersFlag;//shows if this cut is used or not
331 Bool_t fPointOnSSDLayersFlag;//shows if this cut is used or not
0ab648ea 332 Bool_t fPointOnITSLayer1Flag, fPointOnITSLayer2Flag; //shows if this cut is used or not
333 Bool_t fPointOnITSLayer3Flag, fPointOnITSLayer4Flag; //shows if this cut is used or not
334 Bool_t fPointOnITSLayer5Flag, fPointOnITSLayer6Flag; //shows if this cut is used or not
87a55728 335 Bool_t fMinTPCdEdxPointsFlag; //shows if this cut is used or not
ff1c9f70 336 TF1 *fPtDependentDcaXY; //pt dependence dca cut (xy)
337 Bool_t fPtDependentDcaXYFlag; //shows if this cut is used or not
338 Int_t fNSigmaDCAXY; //n-sigma dca xy cut (pt dependent)
87a55728 339
0ab648ea 340 //pid
341 Bool_t fFunctionProbabilityFlag; //flag: kTRUE if functions used
87a55728 342 Int_t fNSigma; //N-sigma cut in the dE/dx band
c6909683 343 Double_t fNRatio; //min value of the ratio of the measured dE/dx vs the expected
0ab648ea 344 Double_t fPartFrac[10]; //prior probabilities
345 TF1 *fElectronFunction; //momentum dependence of the prior probs
346 TF1 *fMuonFunction; //momentum dependence of the prior probs
347 TF1 *fPionFunction; //momentum dependence of the prior probs
348 TF1 *fKaonFunction; //momentum dependence of the prior probs
349 TF1 *fProtonFunction; //momentum dependence of the prior probs
350
351 //Debug
352 Bool_t fDebugMode; //Enable the debug mode
353
735cc63d 354 //QA list
355 TList *fListVertexQA; //vertex QA list
356
e7df5638 357 ClassDef(AliProtonAnalysisBase,1);
0ab648ea 358};
359
360#endif