Line data Source code
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 <AliLog.h>
23 :
24 : class AliESDEvent;
25 : class AliESDtrack;
26 : class AliStack;
27 : class AliLog;
28 :
29 : class AliITSdEdxAnalyzer : public TObject {
30 :
31 : public:
32 : AliITSdEdxAnalyzer();
33 : AliITSdEdxAnalyzer(const Int_t npbins, const Float_t pmin, const Float_t pmax);
34 : virtual ~AliITSdEdxAnalyzer();
35 :
36 : void SetMaterial(Float_t dens, Float_t thick){
37 0 : fDensity=dens;
38 0 : fThickness=thick;
39 0 : }
40 : void SetMomentumBins(const Int_t npbins, const Float_t pmin, const Float_t pmax);
41 0 : void SetUseBBFromAliExternalTrackParam() {fBBmodel=0;}
42 0 : void SetUseBBFromAliITSpidESD() {fBBmodel=1;}
43 0 : void SetMIPdEdx(Float_t val){fMIP=val;}
44 0 : void SetTPCMinimumPIDProb(Float_t min){fTPCpidCut=min;}
45 :
46 : void ReadEvent(const AliESDEvent* ev, AliStack* stack=0);
47 :
48 :
49 : Double_t BetheBloch(TParticle* part) const{
50 0 : return BetheBloch(part->P(),part->GetMass());
51 : }
52 : Double_t BetheBloch(const Float_t p, const Float_t m) const;
53 :
54 :
55 : TH1F* GetSingleLayerdEdxHisto(const Int_t lay, const Int_t pdgcode, const Int_t pbin) const {
56 0 : if(lay<3 || lay>6) AliFatal("Wrong LayerNumber");
57 0 : return fHistodEdx[GetIndex(GetSpecieBin(pdgcode),pbin,lay-3)];
58 : }
59 : TH1F* GetTruncatedMeandEdxHisto(const Int_t pdgcode, const Int_t pbin) const {
60 0 : return fHistodEdx[GetIndex(GetSpecieBin(pdgcode),pbin,4)];
61 : }
62 :
63 : TH1F* GetSingleLayerDeltadEdxHisto(const Int_t lay, const Int_t pdgcode, const Int_t pbin) const {
64 0 : if(lay<3 || lay>6) AliFatal("Wrong LayerNumber");
65 0 : return fHistoDeltadEdx[GetIndex(GetSpecieBin(pdgcode),pbin,lay-3)];
66 : }
67 : TH1F* GetTruncatedMeanDeltadEdxHisto(const Int_t pdgcode, const Int_t pbin) const {
68 0 : return fHistoDeltadEdx[GetIndex(GetSpecieBin(pdgcode),pbin,4)];
69 : }
70 :
71 : TH2F* GetSingleLayerdEdxVsPHisto(const Int_t lay, const Int_t pdgcode) const {
72 0 : if(lay<3 || lay>6) AliFatal("Wrong LayerNumber");
73 0 : return fHistodEdxVsP[GetIndex2(GetSpecieBin(pdgcode),lay-3)];
74 : }
75 : TH2F* GetTruncatedMeandEdxVsPHisto(const Int_t pdgcode) const {
76 0 : return fHistodEdxVsP[GetIndex2(GetSpecieBin(pdgcode),4)];
77 : }
78 :
79 : TGraph* GetBetheBlochGraph(const Int_t pdgcode) const;
80 :
81 : void WriteHistos(TString filename="ITS.dEdx.root") const;
82 :
83 : protected:
84 :
85 0 : Int_t GetNHistos() const {return kNParticles*kNValuesdEdx*fNPBins;}
86 0 : Int_t GetNHistos2() const {return kNParticles*kNValuesdEdx;}
87 : Int_t GetIndex(const Int_t iSp, const Int_t iP, const Int_t iVal) const {
88 0 : return iVal+kNValuesdEdx*iP+fNPBins*kNValuesdEdx*iSp;
89 : }
90 : Int_t GetIndex2(const Int_t iSp, const Int_t iVal) const {
91 0 : return iVal+kNValuesdEdx*iSp;
92 : }
93 : Int_t GetMomentumBin(Float_t p) const{
94 0 : Int_t iBin=(Int_t)((p-fPMin)/(fPMax-fPMin)*fNPBins);
95 0 : if(iBin>=0 && iBin<fNPBins)return iBin;
96 0 : return -1;
97 0 : }
98 : Int_t GetSpecieBin(Int_t absPdgCode) const {
99 0 : for(Int_t iS=0; iS<kNParticles; iS++) if(absPdgCode==fgkPdgCode[iS]) return iS;
100 0 : return -1;
101 0 : }
102 :
103 : Int_t GetPaticleIdFromTPC(const AliESDtrack* track) const;
104 : void BookHistos();
105 : void DeleteHistos();
106 :
107 : private:
108 :
109 : AliITSdEdxAnalyzer(const AliITSdEdxAnalyzer& dum);
110 : AliITSdEdxAnalyzer& operator=(const AliITSdEdxAnalyzer& dum);
111 :
112 : enum {kNParticles=3};
113 : enum {kNValuesdEdx=5};
114 :
115 : static const Int_t fgkPdgCode[kNParticles]; // initialized in the cxx
116 : static const Int_t fgkLayerCode[kNValuesdEdx]; // initialized in the cxx
117 :
118 :
119 : Int_t fNPBins; // Number of Momentum bins
120 : Float_t fPMin; // Minimum P
121 : Float_t fPMax; // Maximum P
122 : TH1F** fHistodEdx; // Array of histograms of dEdx_meas in bins of pt
123 : TH1F** fHistoDeltadEdx; // Array of histograms of dEdx_meas-dEdx_expected in bins of pt
124 : TH2F** fHistodEdxVsP; // Array of histograms of dEdx_meas vs. pt
125 : Float_t fThickness; // detector thickness (cm)
126 : Float_t fDensity; // detector density (g/cm3)
127 : Int_t fBBmodel; // is there MC truth info?
128 : Float_t fMIP; // normalization for MIP
129 : Float_t fTPCpidCut; // minimum probability for PID in TPC
130 :
131 116 : ClassDef(AliITSdEdxAnalyzer,0);
132 : };
133 : #endif
|