]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/totEt/AliAnalysisHadEt.cxx
totEt updates from Christine
[u/mrichter/AliRoot.git] / PWG4 / totEt / AliAnalysisHadEt.cxx
CommitLineData
641e1e0c 1//Create by Christine Nattrass, Rebecca Scott, Irakli Martashvili
2//University of Tennessee at Knoxville
3#include "AliAnalysisHadEt.h"
4#include "TMath.h"
5#include "TList.h"
6#include "TH1F.h"
7#include "TH2F.h"
8#include <iostream>
9#include "AliAnalysisEtCuts.h"
10#include "AliVEvent.h"
11
12using namespace std;
13
14ClassImp(AliAnalysisHadEt);
15
16
17Int_t AliAnalysisHadEt::numOfEtaBins = 46;
18Float_t AliAnalysisHadEt::etaAxis[47]={-0.78, -0.74, -0.7, -0.66, -0.62, -0.58, -0.54, -0.5, -0.46, -0.42, -0.38, -0.34, -0.3, -0.26, -0.22, -0.18, -0.14, -0.12, -0.1, -0.08, -0.06, -0.04, -0.02, -0.0, 0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.18, 0.22, 0.26, 0.3, 0.34, 0.38, 0.42, 0.46, 0.5, 0.54, 0.58, 0.62, 0.66, 0.7, 0.74, 0.78};
19Int_t AliAnalysisHadEt::numOfPtBins = 111;
20Float_t AliAnalysisHadEt::ptAxis[117]=
21 {0.0,0.01,0.02,0.03,0.04, 0.05, 0.06,0.07,0.08,0.09, 0.10,0.11, .12,0.13, .14,0.15, .16,0.17, .18,0.19,
22 0.2, .22, .24, .26, .28, 0.30, 0.32, .34, .36, .38, 0.40, .42, .44, .46, .48,
23 0.5, .52, .54, .56, .58, 0.60, 0.62, .64, .66, .68, 0.70, .72, .74, .76, .78,
24 .80, .82, .84, .86, .88, 0.90, 0.92, .94, .96, .98, 1.00,1.05, 1.1,1.15, 1.2,
25 1.25, 1.3,1.35,1.40,1.45, 1.50, 1.55, 1.6,1.65, 1.7, 1.75, 1.8,1.85, 1.9,1.95,
26 2.0, 2.2, 2.4, 2.6, 2.8, 3.00, 3.20, 3.4, 3.6, 3.8, 4.00, 4.2, 4.4, 4.6, 4.8,
27 5.0, 5.5, 6.0, 6.5, 7.0, 7.50, 8.00, 8.5, 9.0, 9.5, 10.0,12.0,14.0,16.0,18.0,
28 20.0,25.0,30.0,35.0,40.0, 45.0, 50.0};
29
30AliAnalysisHadEt::AliAnalysisHadEt() :
31 fHistogramNameSuffix("")
32 ,fPdgDB(0)
33 ,PiPlusCode(0)
34 ,PiMinusCode(0)
35 ,KPlusCode(0)
36 ,KMinusCode(0)
37 ,ProtonCode(0)
38 ,AntiProtonCode(0)
39 ,LambdaCode(0)
40 ,AntiLambdaCode(0)
41 ,K0SCode(0)
42 ,OmegaCode(0)
43 ,AntiOmegaCode(0)
44 ,Xi0Code(0)
45 ,AntiXi0Code(0)
46 ,XiCode(0)
47 ,AntiXiCode(0)
48 ,SigmaCode(0)
49 ,AntiSigmaCode(0)
50 ,K0LCode(0)
51 ,NeutronCode(0)
52 ,AntiNeutronCode(0)
53 ,EPlusCode(0)
54 ,EMinusCode(0)
55 ,PionMass(0)
56 ,fSumEt(0)
57 ,fSumEtAcc(0)
58 ,fTotEt(0)
59 ,fTotEtAcc(0)
60 ,fTotNeutralEt(0)
61 ,fTotNeutralEtAcc(0)
62 ,fTotChargedEt(0)
63 ,fTotChargedEtAcc(0)
64 ,fMultiplicity(0)
65 ,fChargedMultiplicity(0)
66 ,fNeutralMultiplicity(0)
67 ,fEtaCut(EtCommonCuts::kEtaCut)
68 ,fEtaCutAcc(0)
69 //,fPhiCutAccMin(0)
70 //,fPhiCutAccMax(360.)
71 ,fVertexXCut(0)
72 ,fVertexYCut(0)
73 ,fVertexZCut(0)
74 ,fIPxyCut(0)
75 ,fIPzCut(0)
76 //,fSingleCellEnergyCut(0)
77 //,fClusterEnergyCut(EtCommonCuts::kClusterEnergyCut)
78 //,fTrackPtCut(EtCommonCuts::kTrackPtCut)
79 ,esdtrackCutsITSTPC(0)
80 ,esdtrackCutsTPC(0)
81 ,esdtrackCutsITS(0)
82 ,histoList(0)
83{
84
85}
86
87AliAnalysisHadEt::~AliAnalysisHadEt()
88{
89
90}
91
92Int_t AliAnalysisHadEt::AnalyseEvent(AliVEvent *event)
93{
94 //this line is basically here to eliminate a compiler warning that event is not used. Making it a virtual function did not work with the plugin.
95 cout<<"This event has "<<event->GetNumberOfTracks()<<" tracks"<<endl;
96 return 0;
97}
98
99void AliAnalysisHadEt::FillOutputList()
100{
101}
102
103void AliAnalysisHadEt::Init()
104{
105 if(!fPdgDB) fPdgDB = new TDatabasePDG();
106 //the codes are defined in $ROOTSYS/etc/pdg_table.txt
107 PionMass = fPdgDB->GetParticle("pi+")->Mass();
108 PiPlusCode = fPdgDB->GetParticle("pi+")->PdgCode();
109 PiMinusCode = fPdgDB->GetParticle("pi-")->PdgCode();
110 KPlusCode = fPdgDB->GetParticle("K+")->PdgCode();
111 KMinusCode = fPdgDB->GetParticle("K-")->PdgCode();
112 ProtonCode = fPdgDB->GetParticle("proton")->PdgCode();
113 AntiProtonCode = fPdgDB->GetParticle("antiproton")->PdgCode();
114 LambdaCode = fPdgDB->GetParticle("Lambda0")->PdgCode();
115 AntiLambdaCode = fPdgDB->GetParticle("Lambda0_bar")->PdgCode();
116 K0SCode = fPdgDB->GetParticle("K_S0")->PdgCode();
117 OmegaCode = fPdgDB->GetParticle("Omega-")->PdgCode();
118 AntiOmegaCode = fPdgDB->GetParticle("Omega+")->PdgCode();
119 Xi0Code = fPdgDB->GetParticle("Xi0")->PdgCode();
120 AntiXi0Code = fPdgDB->GetParticle("Xi0_bar")->PdgCode();
121 XiCode = fPdgDB->GetParticle("Xi-")->PdgCode();
122 AntiXiCode = fPdgDB->GetParticle("Xi-_bar")->PdgCode();
123 SigmaCode = fPdgDB->GetParticle("Sigma-")->PdgCode();
124 AntiSigmaCode = fPdgDB->GetParticle("Sigma+")->PdgCode();
125 K0LCode = fPdgDB->GetParticle("K_L0")->PdgCode();
126 NeutronCode = fPdgDB->GetParticle("neutron")->PdgCode();
127 AntiNeutronCode = fPdgDB->GetParticle("antineutron")->PdgCode();
128 EPlusCode = fPdgDB->GetParticle("e+")->PdgCode();
129 EMinusCode = fPdgDB->GetParticle("e-")->PdgCode();
130}
131
132void AliAnalysisHadEt::CreateHistograms()
133{
134}
135
136void AliAnalysisHadEt::FillHistograms()
137{
138}
139
140void AliAnalysisHadEt::ResetEventValues()
141{
142 fTotEt = 0;
143 fTotEtAcc = 0;
144 fTotNeutralEt = 0;
145 fTotNeutralEtAcc = 0;
146 fTotChargedEt = 0;
147 fTotChargedEtAcc = 0;
148 fMultiplicity = 0;
149 fChargedMultiplicity = 0;
150 fNeutralMultiplicity = 0;
151}
152void AliAnalysisHadEt::CreateEtaPtHisto2D(TString name, TString title)
153{
154 TString *histoname = new TString();
155 TString *histotitle = new TString();
156
157 histoname->Append(name);
158 histotitle->Append(title);
159 //TH2F *h1 = new TH2F("h1", "Histogram with Gaussian random distribution", numOfPtBins, ptBinsArray, numOfEtaBins, etaBinsArray);
160
161 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),numOfPtBins, ptAxis, numOfEtaBins, etaAxis);
162 histo->SetYTitle("#eta");
163 histo->SetXTitle("p_{T}");
164 histo->SetZTitle("E_{T}");
165 histo->Sumw2();
166 histoList->Add(histo);
167 delete histoname;
168 delete histotitle;
169
170}
171
172void AliAnalysisHadEt::CreateHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Float_t xlow,Float_t xhigh)
173{
174 TString *histoname = new TString();
175 TString *histotitle = new TString();
176
177 //cout<<"creating "<<name<<endl;
178
179 histoname->Append(name);
180 histotitle->Append(title);
181 // printf("%s \n ",histoname->Data());
182 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
183 histo->SetYTitle(ytitle);
184 histo->SetXTitle(xtitle);
185 histo->Sumw2();
186 histoList->Add(histo);
187 delete histoname;
188 delete histotitle;
189
190}
191void AliAnalysisHadEt::CreateIntHisto1D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Int_t xlow,Int_t xhigh)
192{
193 TString *histoname = new TString();
194 TString *histotitle = new TString();
195
196 //cout<<"creating "<<name<<endl;
197
198 histoname->Append(name);
199 histotitle->Append(title);
200 // printf("%s \n ",histoname->Data());
201 TH1I *histo = new TH1I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh);
202 histo->SetYTitle(ytitle);
203 histo->SetXTitle(xtitle);
204 histo->Sumw2();
205 histoList->Add(histo);
206 delete histoname;
207 delete histotitle;
208
209}
210void AliAnalysisHadEt::CreateHisto2D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Float_t xlow,Float_t xhigh,Int_t ybins,Float_t ylow,Float_t yhigh)
211{
212 TString *histoname = new TString();
213 TString *histotitle = new TString();
214
215 //cout<<"creating "<<name<<endl;
216
217 histoname->Append(name);
218 histotitle->Append(title);
219 // printf("%s \n ",histoname->Data());
220 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
221 histo->SetYTitle(ytitle);
222 histo->SetXTitle(xtitle);
223 histo->Sumw2();
224 histoList->Add(histo);
225 delete histoname;
226 delete histotitle;
227
228}
229void AliAnalysisHadEt::CreateIntHisto2D(TString name, TString title, TString xtitle, TString ytitle,Int_t xbins, Int_t xlow,Int_t xhigh,Int_t ybins,Int_t ylow,Int_t yhigh)
230{
231 TString *histoname = new TString();
232 TString *histotitle = new TString();
233
234 //cout<<"creating "<<name<<endl;
235
236 histoname->Append(name);
237 histotitle->Append(title);
238 // printf("%s \n ",histoname->Data());
239 TH2I *histo = new TH2I(histoname->Data(),histotitle->Data(),xbins,xlow,xhigh,ybins,ylow,yhigh);
240 histo->SetYTitle(ytitle);
241 histo->SetXTitle(xtitle);
242 histo->Sumw2();
243 histoList->Add(histo);
244 delete histoname;
245 delete histotitle;
246
247}
248
249void AliAnalysisHadEt::CreateEtaHisto1D(TString name, TString title)
250{
251 TString *histoname = new TString();
252 TString *histotitle = new TString();
253
254
255 histoname->Append(name);
256 histotitle->Append(title);
257 TH1F *histo = new TH1F(histoname->Data(),histotitle->Data(),numOfEtaBins, etaAxis);
258 histo->SetYTitle("E_{T}");
259 histo->SetXTitle("#eta");
260 histo->Sumw2();
261 histoList->Add(histo);
262 delete histoname;
263 delete histotitle;
264
265}
266void AliAnalysisHadEt::FillHisto1D(TString histname, Float_t x, Float_t weight)
267{
268 TH1F *histo;
269 TString *name = new TString();
270
271 name->Append(histname);
272 histo = (TH1F *)histoList->FindObject(name->Data());
273 if(histo){
274 histo->Fill((Double_t)x, weight);
275 }
276 else{cerr<<"CorrelationMaker::FillHisto1D: no histogram "<< name->Data()<<endl;}
277 delete name;
278}
279void AliAnalysisHadEt::FillHisto2D(TString histname, Float_t x, Float_t y, Float_t weight)
280{
281 TH2F *histo;
282 TString *name = new TString();
283
284 name->Append(histname);
285 histo = (TH2F *)histoList->FindObject(name->Data());
286 if(histo){
287 histo->Fill((Double_t)x,(Double_t)y, weight);
288 }
289 else{cerr<<"CorrelationMaker::FillHisto2D: no histogram "<< name->Data()<<endl;}
290 delete name;
291}
292
293
294Float_t AliAnalysisHadEt::Et(TParticle *part, float mass){
295 if(mass == -1000){//if no mass given return default
296 if(TMath::Abs(part->GetPDG(0)->PdgCode())==2212 || TMath::Abs(part->GetPDG(0)->PdgCode())==2112){
297 if(part->GetPDG(0)->PdgCode()==-2212 || part->GetPDG(0)->PdgCode()==-2112){//antiproton or antineutron
298 //for antinucleons we specifically want to return the kinetic energy plus twice the rest mass
299 return (part->Energy()+part->GetMass())*TMath::Sin(part->Theta());
300 }
301 if(part->GetPDG(0)->PdgCode()==2212 || part->GetPDG(0)->PdgCode()==2112){//antiproton or antineutron
302 //for nucleons we specifically want to return the kinetic energy only
303 return (part->Energy()-part->GetMass())*TMath::Sin(part->Theta());
304 }
305 }
306 else{//otherwise go to the default
307 return part->Energy()*TMath::Sin(part->Theta());
308 }
309 }
310 else{//otherwise use the mass that was given
311 return (TMath::Sqrt(TMath::Power(part->P(),2.0)+TMath::Power(mass,2.0)))*TMath::Sin(part->Theta());
312 }
313 return 0.0;
314}