]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWG2/SPECTRA/AliProtonAnalysisBase.h
Coverity fixes for BUFFER_SIZE
[u/mrichter/AliRoot.git] / PWG2 / SPECTRA / AliProtonAnalysisBase.h
... / ...
CommitLineData
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;
20class TList;
21
22#include "AliPhysicsSelection.h"
23#include "AliBackgroundSelection.h"
24#include "AliPID.h"
25class AliESDEvent;
26class AliESDtrack;
27class AliESDVertex;
28
29class AliProtonAnalysisBase : public TObject {
30 public:
31 enum TriggerMode { kMB1 = 0, kMB2, kSPDFASTOR };
32 enum AnalysisMode { kInvalid = -1, kTPC = 0, kHybrid, kFullHybrid, kGlobal };
33 enum PIDMode { kBayesian = 0, kRatio, kSigma};
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;}
41 void SetTriggerMode(TriggerMode triggermode) {
42 fAnalysisMC = kTRUE; fTriggerMode = triggermode;}
43 void SetPIDMode(PIDMode pidmode) {fProtonPIDMode = pidmode;}
44
45 const char *GetAnalysisLevel() {return fProtonAnalysisLevel.Data();}
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;}
50 Bool_t GetMCAnalysisMode() {return fAnalysisMC;}
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;}
59 Double_t GetVxMax() const {return fVxMax;}
60 Double_t GetVyMax() const {return fVyMax;}
61 Double_t GetVzMax() const {return fVzMax;}
62 void SetMinNumOfContributors(Int_t nContributors) {
63 fMinNumOfContributors = nContributors;}
64 Int_t GetMinNumOfContributors() {return fMinNumOfContributors;}
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 }
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;}
77
78 //Trigger
79 Bool_t IsOnlineTriggerUsed() {return kUseOnlineTrigger;}
80 void UseOnlineTrigger() {kUseOnlineTrigger = kTRUE;}
81 Bool_t IsEventTriggered(const AliESDEvent *esd,
82 TriggerMode trigger = kMB2);
83 void OfflineTriggerInit() {
84 kUseOfflineTrigger = kTRUE;
85 fPhysicsSelection = new AliPhysicsSelection();
86 fPhysicsSelection->AddBackgroundIdentification(new AliBackgroundSelection());
87 fPhysicsSelection->SetAnalyzeMC(fAnalysisMC);
88 }
89 Bool_t IsOfflineTriggerUsed() {return kUseOfflineTrigger;}
90 AliPhysicsSelection *GetPhysicsSelectionObject() {return fPhysicsSelection;}
91
92 Bool_t IsPrimary(AliESDEvent *esd,
93 const AliESDVertex *vertex,
94 AliESDtrack *track);
95 Bool_t IsAccepted(AliESDtrack *track);
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
102 void SetPointOnSPDLayers() {fPointOnSPDLayersFlag = kTRUE;}
103 void SetPointOnSDDLayers() {fPointOnSDDLayersFlag = kTRUE;}
104 void SetPointOnSSDLayers() {fPointOnSSDLayersFlag = kTRUE;}
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;}
111 Bool_t IsUsedPointOnSPDLayer() const {return fPointOnSPDLayersFlag;}
112 Bool_t IsUsedPointOnSDDLayer() const {return fPointOnSDDLayersFlag;}
113 Bool_t IsUsedPointOnSSDLayer() const {return fPointOnSSDLayersFlag;}
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;}
120 void SetMinITSClusters(Int_t minITSClusters) {
121 fMinITSClusters = minITSClusters;
122 fMinITSClustersFlag = kTRUE;
123 }
124 Int_t GetMinITSClusters() const {return fMinITSClusters;}
125 Bool_t IsUsedMinITSClusters() const {return fMinITSClustersFlag;}
126
127 void SetMaxChi2PerITSCluster(Double_t maxChi2PerITSCluster) {
128 fMaxChi2PerITSCluster = maxChi2PerITSCluster;
129 fMaxChi2PerITSClusterFlag = kTRUE;
130 }
131 Bool_t IsUsedMaxChi2PerITSCluster() const {return fMaxChi2PerITSClusterFlag;}
132 Double_t GetMaxChi2PerITSCluster() const {return fMaxChi2PerITSCluster;}
133
134 void SetMinTPCClusters(Int_t minTPCClusters) {
135 fMinTPCClusters = minTPCClusters;
136 fMinTPCClustersFlag = kTRUE;
137 }
138 Bool_t IsUsedMinTPCClusters() const {return fMinTPCClustersFlag;}
139 Int_t GetMinTPCClusters() const {return fMinTPCClusters;}
140
141 void SetMaxChi2PerTPCCluster(Double_t maxChi2PerTPCCluster) {
142 fMaxChi2PerTPCCluster = maxChi2PerTPCCluster;
143 fMaxChi2PerTPCClusterFlag = kTRUE;
144 }
145 Bool_t IsUsedMaxChi2PerTPCCluster() const {return fMaxChi2PerTPCClusterFlag;}
146 Double_t GetMaxChi2PerTPCCluster() const {return fMaxChi2PerTPCCluster;}
147
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;}
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;}
168
169 void SetMaxSigmaToVertex(Double_t maxSigmaToVertex) {
170 fMaxSigmaToVertex = maxSigmaToVertex;
171 fMaxSigmaToVertexFlag = kTRUE;
172 }
173 Bool_t IsUsedMaxSigmaToVertex() const {return fMaxSigmaToVertexFlag;}
174 Double_t GetMaxSigmaToVertex() const {return fMaxSigmaToVertex;}
175
176 void SetMaxSigmaToVertexTPC(Double_t maxSigmaToVertex) {
177 fMaxSigmaToVertexTPC = maxSigmaToVertex;
178 fMaxSigmaToVertexTPCFlag = kTRUE;
179 }
180 Bool_t IsUsedMaxSigmaToVertexTPC() const {return fMaxSigmaToVertexTPCFlag;}
181 Double_t GetMaxSigmaToVertexTPC() const {return fMaxSigmaToVertexTPC;}
182
183 void SetMaxDCAXY(Double_t maxDCAXY) {
184 fMaxDCAXY = maxDCAXY;
185 fMaxDCAXYFlag = kTRUE;
186 }
187 Bool_t IsUsedMaxDCAXY() const {return fMaxDCAXYFlag;}
188 Double_t GetMaxDCAXY() const {return fMaxDCAXY;}
189
190 void SetMaxDCAXYTPC(Double_t maxDCAXY) {
191 fMaxDCAXYTPC = maxDCAXY;
192 fMaxDCAXYTPCFlag = kTRUE;
193 }
194 Bool_t IsUsedMaxDCAXYTPC() const {return fMaxDCAXYTPCFlag;}
195 Double_t GetMaxDCAXYTPC() const {return fMaxDCAXYTPC;}
196
197 void SetMaxDCAZ(Double_t maxDCAZ) {
198 fMaxDCAZ = maxDCAZ;
199 fMaxDCAZFlag = kTRUE;
200 }
201 Bool_t IsUsedMaxDCAZ() const {return fMaxDCAZFlag;}
202 Double_t GetMaxDCAZ() const {return fMaxDCAZ;}
203
204 void SetMaxDCAZTPC(Double_t maxDCAZ) {
205 fMaxDCAZTPC = maxDCAZ;
206 fMaxDCAZTPCFlag = kTRUE;
207 }
208 Bool_t IsUsedMaxDCAZTPC() const {return fMaxDCAZTPCFlag;}
209 Double_t GetMaxDCAZTPC() const {return fMaxDCAZTPC;}
210
211 void SetMaxDCA3D(Double_t maxDCA3D) {
212 fMaxDCA3D = maxDCA3D;
213 fMaxDCA3DFlag = kTRUE;
214 }
215 Bool_t IsUsedMaxDCA3D() const {return fMaxDCA3DFlag;}
216 Double_t GetMaxDCA3D() const {return fMaxDCA3D;}
217
218 void SetPtDependentDCAxy(Int_t nSigma, Double_t p0,
219 Double_t p1, Double_t p2);
220 Bool_t IsUsedPtDependentDCAxy() const {return fPtDependentDcaXYFlag;}
221
222 void SetMaxDCA3DTPC(Double_t maxDCA3D) {
223 fMaxDCA3DTPC = maxDCA3D;
224 fMaxDCA3DTPCFlag = kTRUE;
225 }
226 Bool_t IsUsedMaxDCA3DTPC() const {return fMaxDCA3DTPCFlag;}
227 Double_t GetMaxDCA3DTPC() const {return fMaxDCA3DTPC;}
228
229 void SetMaxConstrainChi2(Double_t maxConstrainChi2) {
230 fMaxConstrainChi2 = maxConstrainChi2;
231 fMaxConstrainChi2Flag = kTRUE;
232 }
233 Bool_t IsUsedMaxConstrainChi2() const {return fMaxConstrainChi2Flag;}
234 Double_t GetMaxConstrainChi2() const {return fMaxConstrainChi2;}
235
236 void SetMinTPCdEdxPoints(Int_t mindEdxpoints) {
237 fMinTPCdEdxPoints = mindEdxpoints;
238 fMinTPCdEdxPointsFlag = kTRUE;
239 }
240 Bool_t IsUsedMinTPCdEdxPoints() const {return fMinTPCdEdxPointsFlag;}
241 Int_t GetMinTPCdEdxPoints() const {return fMinTPCdEdxPoints;}
242
243 void SetITSRefit() {fITSRefitFlag = kTRUE;}
244 Bool_t IsUsedITSRefit() const {return fITSRefitFlag;}
245 void SetTPCRefit() {fTPCRefitFlag = kTRUE;}
246 Bool_t IsUsedTPCRefit() const {return fTPCRefitFlag;}
247 void SetESDpid() {fESDpidFlag = kTRUE;}
248 Bool_t IsUsedESDpid() const {return fESDpidFlag;}
249 void SetTPCpid() {fTPCpidFlag = kTRUE;}
250 Bool_t IsUsedTPCpid() const {return fTPCpidFlag;}
251 void SetTOFpid() {fTOFpidFlag = kTRUE;}
252 Bool_t IsUsedTOFpid() const {return fTOFpidFlag;}
253
254 TCanvas *GetListOfCuts();
255
256 //PID related functions
257 Bool_t IsProton(AliESDtrack *track);
258 void SetNSigma(Int_t nsigma) {fNSigma = nsigma;}
259 Int_t GetNSigma() const {return fNSigma;}
260 void SetRatio(Double_t ratio) {fNRatio = ratio;}
261 Double_t GetRatio() {return fNRatio;}
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;
270 fElectronFunction = felectron; fMuonFunction = fmuon;
271 fPionFunction = fpion; fKaonFunction = fkaon; fProtonFunction = fproton;
272 }
273 Bool_t IsPriorProbabilityFunctionUsed() const {return fFunctionProbabilityFlag;}
274 Double_t GetParticleFraction(Int_t i, Double_t p);
275 //Double_t Bethe(Double_t bg) const;
276
277 void SetDebugMode() {fDebugMode = kTRUE;}
278 Bool_t GetDebugMode() const {return fDebugMode;}
279
280 void SetRunQA() {fRunQAAnalysis = kTRUE;}
281 Bool_t IsQARun() {return fRunQAAnalysis;}
282 TList *GetVertexQAList() {return fListVertexQA;}
283
284 private:
285 AliProtonAnalysisBase(const AliProtonAnalysisBase&); // Not implemented
286 AliProtonAnalysisBase& operator=(const AliProtonAnalysisBase&); // Not implemented
287
288 TString fProtonAnalysisLevel;//"ESD", "AOD" or "MC"
289 Bool_t fAnalysisMC; //kTRUE if MC analysis while reading the ESDs
290 TriggerMode fTriggerMode; //Trigger mode
291 Bool_t kUseOnlineTrigger; //use the online trigger or not
292 Bool_t kUseOfflineTrigger; //use the offline trigger or not
293 AliPhysicsSelection *fPhysicsSelection; //Trigger selection: offline
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
298 Bool_t fRunQAAnalysis; //boolnean to indicate to run the QA or not
299 Double_t fVxMax, fVyMax, fVzMax; //vertex diamond constrain
300 Int_t fMinNumOfContributors;//min number of contributors
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
317 Int_t fMinTPCdEdxPoints;//min number of TPC points used for the dE/dx
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
328 Bool_t fESDpidFlag, fTPCpidFlag, fTOFpidFlag; //shows if this cut is used or not
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
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
335 Bool_t fMinTPCdEdxPointsFlag; //shows if this cut is used or not
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)
339
340 //pid
341 Bool_t fFunctionProbabilityFlag; //flag: kTRUE if functions used
342 Int_t fNSigma; //N-sigma cut in the dE/dx band
343 Double_t fNRatio; //min value of the ratio of the measured dE/dx vs the expected
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
354 //QA list
355 TList *fListVertexQA; //vertex QA list
356
357 ClassDef(AliProtonAnalysisBase,1);
358};
359
360#endif