Coverity warnings
[u/mrichter/AliRoot.git] / ITS / AliITSdEdxAnalyzer.h
CommitLineData
75c74fab 1#ifndef ALIITSDEDXANALYZER_H
2#define ALIITSDEDXANALYZER_H
3/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8///////////////////////////////////////////////////////////////////
9// //
10// Class for: //
11// - building histograms of dE/dx in bins of pt/layer/particle //
12// - comparing dEdx signal with Bethe-Bloch expected value //
13// Origin: F.Prino, Torino, prino@to.infn.it //
14// //
15///////////////////////////////////////////////////////////////////
16
17#include <TObject.h>
18#include <TParticle.h>
19#include <TH1F.h>
20#include <TH2F.h>
21#include <TGraph.h>
22#include "AliStack.h"
23#include "AliLog.h"
24#include "AliESDEvent.h"
25
26class AliITSdEdxAnalyzer : public TObject {
27
28 public:
29 AliITSdEdxAnalyzer();
30 AliITSdEdxAnalyzer(const Int_t npbins, const Float_t pmin, const Float_t pmax);
31 virtual ~AliITSdEdxAnalyzer();
32
33 void SetMaterial(Float_t dens, Float_t thick){
34 fDensity=dens;
35 fThickness=thick;
36 }
37 void SetMomentumBins(const Int_t npbins, const Float_t pmin, const Float_t pmax);
38 void SetUseBBFromAliExternalTrackParam() {fBBmodel=0;}
39 void SetUseBBFromAliITSpidESD() {fBBmodel=1;}
40 void SetMIPdEdx(Float_t val){fMIP=val;}
41 void SetTPCMinimumPIDProb(Float_t min){fTPCpidCut=min;}
42
43 void ReadEvent(AliESDEvent* ev, AliStack* stack=0);
44
45
46 Double_t BetheBloch(TParticle* part) const{
47 return BetheBloch(part->P(),part->GetMass());
48 }
49 Double_t BetheBloch(const Float_t p, const Float_t m) const;
50
51
52 TH1F* GetSingleLayerdEdxHisto(const Int_t lay, const Int_t pdgcode, const Int_t pbin) const {
53 if(lay<3 || lay>6) AliFatal("Wrong LayerNumber");
54 return fHistodEdx[GetIndex(GetSpecieBin(pdgcode),pbin,lay-3)];
55 }
56 TH1F* GetTruncatedMeandEdxHisto(const Int_t pdgcode, const Int_t pbin) const {
57 return fHistodEdx[GetIndex(GetSpecieBin(pdgcode),pbin,4)];
58 }
59
60 TH1F* GetSingleLayerDeltadEdxHisto(const Int_t lay, const Int_t pdgcode, const Int_t pbin) const {
61 if(lay<3 || lay>6) AliFatal("Wrong LayerNumber");
62 return fHistoDeltadEdx[GetIndex(GetSpecieBin(pdgcode),pbin,lay-3)];
63 }
64 TH1F* GetTruncatedMeanDeltadEdxHisto(const Int_t pdgcode, const Int_t pbin) const {
65 return fHistoDeltadEdx[GetIndex(GetSpecieBin(pdgcode),pbin,4)];
66 }
67
68 TH2F* GetSingleLayerdEdxVsPHisto(const Int_t lay, const Int_t pdgcode) const {
69 if(lay<3 || lay>6) AliFatal("Wrong LayerNumber");
70 return fHistodEdxVsP[GetIndex2(GetSpecieBin(pdgcode),lay-3)];
71 }
72 TH2F* GetTruncatedMeandEdxVsPHisto(const Int_t pdgcode) const {
73 return fHistodEdxVsP[GetIndex2(GetSpecieBin(pdgcode),4)];
74 }
75
76 TGraph* GetBetheBlochGraph(const Int_t pdgcode) const;
77
78 void WriteHistos(TString filename="ITS.dEdx.root") const;
79
80 protected:
81
82 Int_t GetNHistos() const {return kNParticles*kNValuesdEdx*fNPBins;}
83 Int_t GetNHistos2() const {return kNParticles*kNValuesdEdx;}
84 Int_t GetIndex(const Int_t iSp, const Int_t iP, const Int_t iVal) const {
85 return iVal+kNValuesdEdx*iP+fNPBins*kNValuesdEdx*iSp;
86 }
87 Int_t GetIndex2(const Int_t iSp, const Int_t iVal) const {
88 return iVal+kNValuesdEdx*iSp;
89 }
90 Int_t GetMomentumBin(Float_t p) const{
91 Int_t iBin=(Int_t)((p-fPMin)/(fPMax-fPMin)*fNPBins);
92 if(iBin>=0 && iBin<fNPBins)return iBin;
93 return -1;
94 }
95 Int_t GetSpecieBin(Int_t absPdgCode) const {
96 for(Int_t iS=0; iS<kNParticles; iS++){
97 if(absPdgCode==fgkPdgCode[iS]) return iS;
98 }
99 return -1;
100 }
101
102 Int_t GetPaticleIdFromTPC(const AliESDtrack* track) const;
103 void BookHistos();
104 void DeleteHistos();
105
106 private:
107
108 AliITSdEdxAnalyzer(const AliITSdEdxAnalyzer& dum);
109 AliITSdEdxAnalyzer& operator=(const AliITSdEdxAnalyzer& dum);
110
111 enum {kNParticles=3};
112 enum {kNValuesdEdx=5};
113
114 static const Int_t fgkPdgCode[kNParticles]; // initialized in the cxx
115 static const Int_t fgkLayerCode[kNValuesdEdx]; // initialized in the cxx
116
117
118 Int_t fNPBins; // Number of Momentum bins
119 Float_t fPMin; // Minimum P
120 Float_t fPMax; // Maximum P
121 TH1F** fHistodEdx; // Array of histograms of dEdx_meas in bins of pt
122 TH1F** fHistoDeltadEdx; // Array of histograms of dEdx_meas-dEdx_expected in bins of pt
123 TH2F** fHistodEdxVsP; // Array of histograms of dEdx_meas vs. pt
124 Float_t fThickness; // detector thickness (cm)
125 Float_t fDensity; // detector density (g/cm3)
126 Int_t fBBmodel; // is there MC truth info?
127 Float_t fMIP; // normalization for MIP
128 Float_t fTPCpidCut; // minimum probability for PID in TPC
129
130 ClassDef(AliITSdEdxAnalyzer,0);
131};
132#endif