coverity fix
[u/mrichter/AliRoot.git] / PWG4 / totEt / AliAnalysisEt.cxx
CommitLineData
cf6522d1 1//_________________________________________________________________________
2// Utility Class for transverse energy studies
3// Base class for ESD & MC analysis
4// - reconstruction and MonteCarlo output
5// implementation file
6//
7//*-- Authors: Oystein Djuvsland (Bergen), David Silvermyr (ORNL)
8//_________________________________________________________________________
9
2fbf38ac 10#include "AliAnalysisEt.h"
11#include "TMath.h"
12#include "TList.h"
13#include "TH1F.h"
14#include "TH2F.h"
ce546038 15#include "TTree.h"
2fbf38ac 16#include <iostream>
17#include "AliAnalysisEtCuts.h"
951efd81 18#include "AliESDtrackCuts.h"
f9a4ed81 19#include "AliESDCaloCluster.h"
641e1e0c 20#include "AliVEvent.h"
cf6522d1 21#include "Rtypes.h"
0f97be4c 22#include "TString.h"
f9a4ed81 23//#include "THnSparse.h"
641e1e0c 24
25using namespace std;
2fbf38ac 26ClassImp(AliAnalysisEt);
27
0651f6b4 28/* Auxiliary Histogram variables */
29Int_t AliAnalysisEt::fgnumOfEtaBins = 16;
30Float_t AliAnalysisEt::fgEtaAxis[17]={-0.78, -0.7, -0.58, -0.46, -0.34, -0.22, -0.12, -0.06, -0.0, 0.06, 0.12, 0.22, 0.34, 0.46, 0.58, 0.7, 0.78};
31
32Int_t AliAnalysisEt::fgNumOfEBins = 78;
33Float_t AliAnalysisEt::fgEAxis[79]={0., 0.05, 0.10, 0.15, 0.20, 0.25, 0.30, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95,
34 1.,1.5,2.,2.5,3.,3.5,4.,4.5,5.,5.5,6.,6.5,7.,7.5,8.,8.5,9.,9.5,10.,11.,
35 12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.,24.,25.,26.,27.,28.,29.,30.,31.,
36 32.,33.,34.,35.,36.,37.,38.,39.,40.,41.,42.,43.,44.,45.,46.,47.,48.,49.,50.};
37
2fbf38ac 38
7d2d1773 39AliAnalysisEt::AliAnalysisEt() : AliAnalysisEtCommon()
7d2d1773 40 ,fTotEt(0)
41 ,fTotEtAcc(0)
42 ,fTotNeutralEt(0)
43 ,fTotNeutralEtAcc(0)
44 ,fTotChargedEt(0)
45 ,fTotChargedEtAcc(0)
46 ,fMultiplicity(0)
47 ,fChargedMultiplicity(0)
48 ,fNeutralMultiplicity(0)
49 ,fBaryonEt(0)
50 ,fAntiBaryonEt(0)
51 ,fMesonEt(0)
52 ,fProtonEt(0)
53 ,fPionEt(0)
54 ,fChargedKaonEt(0)
55 ,fMuonEt(0)
56 ,fElectronEt(0)
57 ,fNeutronEt(0)
58 ,fAntiNeutronEt(0)
59 ,fGammaEt(0)
60 ,fProtonEtAcc(0)
61 ,fPionEtAcc(0)
62 ,fChargedKaonEtAcc(0)
63 ,fMuonEtAcc(0)
64 ,fElectronEtAcc(0)
65 ,fEnergyDeposited(0)
66 ,fEnergyTPC(0)
67 ,fCharge(0)
68 ,fParticlePid(0)
69 ,fPidProb(0)
70 ,fTrackPassedCut(kFALSE)
f9a4ed81 71 ,fCentClass(0)
7d2d1773 72 ,fEtaCut(0)
73 ,fEtaCutAcc(0)
74 ,fPhiCutAccMin(0)
75 ,fPhiCutAccMax(0)
76 ,fDetectorRadius(0)
77 ,fClusterEnergyCut(0)
78 ,fSingleCellEnergyCut(0)
f9a4ed81 79 ,fTrackDistanceCut(0)
476828ae 80 ,fTrackDxCut(0)
81 ,fTrackDzCut(0)
7d2d1773 82 ,fHistEt(0)
83 ,fHistChargedEt(0)
84 ,fHistNeutralEt(0)
85 ,fHistEtAcc(0)
86 ,fHistChargedEtAcc(0)
87 ,fHistNeutralEtAcc(0)
88 ,fHistMult(0)
89 ,fHistChargedMult(0)
90 ,fHistNeutralMult(0)
91 ,fHistPhivsPtPos(0)
92 ,fHistPhivsPtNeg(0)
93 ,fHistBaryonEt(0)
94 ,fHistAntiBaryonEt(0)
95 ,fHistMesonEt(0)
96 ,fHistProtonEt(0)
97 ,fHistPionEt(0)
98 ,fHistChargedKaonEt(0)
99 ,fHistMuonEt(0)
100 ,fHistElectronEt(0)
101 ,fHistNeutronEt(0)
102 ,fHistAntiNeutronEt(0)
103 ,fHistGammaEt(0)
104 ,fHistProtonEtAcc(0)
105 ,fHistPionEtAcc(0)
106 ,fHistChargedKaonEtAcc(0)
107 ,fHistMuonEtAcc(0)
108 ,fHistElectronEtAcc(0)
109 ,fHistTMDeltaR(0)
f9a4ed81 110 ,fHistTMDxDz(0)
7d2d1773 111 ,fTree(0)
112 ,fTreeDeposit(0)
5501aa9c 113 ,fCentrality(0)
f9a4ed81 114 ,fDetector(0)
115 ,fSparseHistTracks(0)
116 ,fSparseHistClusters(0)
117 ,fSparseHistEt(0)
118 ,fSparseTracks(0)
119 ,fSparseClusters(0)
120 ,fSparseEt(0)
121
0651f6b4 122{}
2fbf38ac 123
124AliAnalysisEt::~AliAnalysisEt()
464aa50c 125{//Destructor
951efd81 126 if(fTreeDeposit){
127 fTreeDeposit->Clear();
128 delete fTreeDeposit; // optional TTree
129 }
130 if(fTree){
131 fTree->Clear();
132 delete fTree; // optional TTree
133 }
7d2d1773 134 delete fHistEt; //Et spectrum
135 delete fHistChargedEt; //Charged Et spectrum
136 delete fHistNeutralEt; //Neutral Et spectrum
137 delete fHistEtAcc; //Et in acceptance
138 delete fHistChargedEtAcc; //Charged Et in acceptance
139 delete fHistNeutralEtAcc; //Et in acceptance
140 delete fHistMult; //Multiplicity
141 delete fHistChargedMult; //Charged multiplicity
142 delete fHistNeutralMult; //Neutral multiplicity
143 delete fHistPhivsPtPos; //phi vs pT plot for positive tracks
144 delete fHistPhivsPtNeg; //phi vs pT plot for negative tracks
145 delete fHistBaryonEt; /** Et of identified baryons */
146 delete fHistAntiBaryonEt; /** Et of identified anti-baryons */
147 delete fHistMesonEt; /** Et of identified mesons */
148 delete fHistProtonEt; /** Et of identified protons */
149 delete fHistPionEt; /** Et of identified protons */
150 delete fHistChargedKaonEt; /** Et of identified charged kaons */
151 delete fHistMuonEt; /** Et of identified muons */
152 delete fHistElectronEt; /** Et of identified electrons */
153 delete fHistNeutronEt; /** Et of neutrons (MC only for now) */
154 delete fHistAntiNeutronEt; /** Et of anti-neutrons (MC only for now) */
155 delete fHistGammaEt; /** Et of gammas (MC only for now) */
156 delete fHistProtonEtAcc; /** Et of identified protons in calorimeter acceptance */
157 delete fHistPionEtAcc; /** Et of identified protons in calorimeter acceptance */
158 delete fHistChargedKaonEtAcc; /** Et of identified charged kaons in calorimeter acceptance */
159 delete fHistMuonEtAcc; /** Et of identified muons in calorimeter acceptance */
160 delete fHistElectronEtAcc; /** Et of identified electrons in calorimeter acceptance */
161 delete fHistTMDeltaR; /* Track matching plots; Rec only for now */
f9a4ed81 162 delete fHistTMDxDz; /* Track matching plots; Rec only for now */
2fbf38ac 163}
164
165void AliAnalysisEt::FillOutputList(TList *list)
cf6522d1 166{ // histograms to be added to output
2fbf38ac 167 list->Add(fHistEt);
168 list->Add(fHistChargedEt);
169 list->Add(fHistNeutralEt);
170
171 list->Add(fHistEtAcc);
172 list->Add(fHistChargedEtAcc);
173 list->Add(fHistNeutralEtAcc);
174
175 list->Add(fHistMult);
176 list->Add(fHistChargedMult);
177 list->Add(fHistNeutralMult);
178
179 list->Add(fHistPhivsPtPos);
180 list->Add(fHistPhivsPtNeg);
181
182 list->Add(fHistBaryonEt);
183 list->Add(fHistAntiBaryonEt);
184 list->Add(fHistMesonEt);
185
43056f1b 186 list->Add(fHistProtonEt);
187 list->Add(fHistPionEt);
188 list->Add(fHistChargedKaonEt);
189 list->Add(fHistMuonEt);
190 list->Add(fHistElectronEt);
191
192 list->Add(fHistNeutronEt);
193 list->Add(fHistAntiNeutronEt);
194 list->Add(fHistGammaEt);
195
87efb15c 196 list->Add(fHistProtonEtAcc);
43056f1b 197 list->Add(fHistPionEtAcc);
87efb15c 198 list->Add(fHistChargedKaonEtAcc);
199 list->Add(fHistMuonEtAcc);
200 list->Add(fHistElectronEtAcc);
201
2fbf38ac 202 list->Add(fHistTMDeltaR);
f9a4ed81 203 list->Add(fHistTMDxDz);
0651f6b4 204
ce546038 205 if (fCuts) {
206 if (fCuts->GetHistMakeTree()) {
207 list->Add(fTree);
208 }
f9a4ed81 209 if (fCuts->GetHistMakeTreeDeposit()) {
210 list->Add(fTreeDeposit);
211 }
ce546038 212 }
f9a4ed81 213
214 list->Add(fSparseHistTracks);
215 list->Add(fSparseHistClusters);
216 list->Add(fSparseHistEt);
217
ce546038 218
2fbf38ac 219}
220
221void AliAnalysisEt::Init()
0065531a 222{// clear variables, set up cuts and PDG info
7d2d1773 223 AliAnalysisEtCommon::Init();
0065531a 224 ResetEventValues();
2fbf38ac 225}
226
227void AliAnalysisEt::CreateHistograms()
cf6522d1 228{ // create histograms..
13b0d3c1 229 // histogram binning for E_T, p_T and Multiplicity: defaults for p+p
f9a4ed81 230 Int_t nbinsEt = 10000;
231 Double_t minEt = 0.0;
232 Double_t maxEt = 1000;
13b0d3c1 233 Int_t nbinsPt = 200;
234 Double_t minPt = 0;
235 Double_t maxPt = 20;
236 Int_t nbinsMult = 200;
237 Double_t minMult = -0.5; // offset -0.5 to have integer bins centered around 0
238 Double_t maxMult = nbinsMult + minMult; // 1 bin per integer value
2fbf38ac 239
ce546038 240 // see if we should change histogram limits etc, and possibly create a tree
241 if (fCuts) {
bf4eaf10 242 if (fCuts->GetHistMakeTree()) {
8ea99ab0 243 CreateTrees();
bf4eaf10 244 }
0fa8c632 245
246 nbinsMult = fCuts->GetHistNbinsMult();
247 minMult = fCuts->GetHistMinMult();
248 maxMult = fCuts->GetHistMaxMult();
249
250 nbinsEt = fCuts->GetHistNbinsTotEt();
251 minEt = fCuts->GetHistMinTotEt();
252 maxEt = fCuts->GetHistMaxTotEt();
253
254 nbinsPt = fCuts->GetHistNbinsParticlePt();
255 minPt = fCuts->GetHistMinParticlePt();
256 maxPt = fCuts->GetHistMaxParticlePt();
ce546038 257 }
258
2fbf38ac 259 TString histname = "fHistEt" + fHistogramNameSuffix;
13b0d3c1 260 fHistEt = new TH1F(histname.Data(), "Total E_{T} Distribution", nbinsEt, minEt, maxEt);
2fbf38ac 261 fHistEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
262 fHistEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
263
264 histname = "fHistChargedEt" + fHistogramNameSuffix;
13b0d3c1 265 fHistChargedEt = new TH1F(histname.Data(), "Total Charged E_{T} Distribution", nbinsEt, minEt, maxEt);
2fbf38ac 266 fHistChargedEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
267 fHistChargedEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
268
269 histname = "fHistNeutralEt" + fHistogramNameSuffix;
13b0d3c1 270 fHistNeutralEt = new TH1F(histname.Data(), "Total Neutral E_{T} Distribution", nbinsEt, minEt, maxEt);
2fbf38ac 271 fHistNeutralEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
272 fHistNeutralEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
273
274 histname = "fHistEtAcc" + fHistogramNameSuffix;
13b0d3c1 275 fHistEtAcc = new TH1F(histname.Data(), "Total E_{T} Distribution in Acceptance", nbinsEt, minEt, maxEt);
2fbf38ac 276 fHistEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
277 fHistEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
278
279 histname = "fHistChargedEtAcc" + fHistogramNameSuffix;
13b0d3c1 280 fHistChargedEtAcc = new TH1F(histname.Data(), "Total Charged E_{T} Distribution in Acceptance", nbinsEt, minEt, maxEt);
2fbf38ac 281 fHistChargedEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
282 fHistChargedEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
283
284 histname = "fHistNeutralEtAcc" + fHistogramNameSuffix;
13b0d3c1 285 fHistNeutralEtAcc = new TH1F(histname.Data(), "Total Neutral E_{T} Distribution in Acceptance", nbinsEt, minEt, maxEt);
2fbf38ac 286 fHistNeutralEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
287 fHistNeutralEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
288 std::cout << histname << std::endl;
0651f6b4 289
290 histname = "fHistMult" + fHistogramNameSuffix;
13b0d3c1 291 fHistMult = new TH1F(histname.Data(), "Total Multiplicity", nbinsMult, minMult, maxMult);
2fbf38ac 292 fHistMult->GetXaxis()->SetTitle("N");
293 fHistMult->GetYaxis()->SetTitle("Multiplicity");
294
295 histname = "fHistChargedMult" + fHistogramNameSuffix;
13b0d3c1 296 fHistChargedMult = new TH1F(histname.Data(), "Charged Multiplicity", nbinsMult, minMult, maxMult);
2fbf38ac 297 fHistChargedMult->GetXaxis()->SetTitle("N");
298 fHistChargedMult->GetYaxis()->SetTitle("Multiplicity");
299
300 histname = "fHistNeutralMult" + fHistogramNameSuffix;
13b0d3c1 301 fHistNeutralMult = new TH1F(histname.Data(), "Neutral Multiplicity", nbinsMult, minMult, maxMult);
2fbf38ac 302 fHistNeutralMult->GetXaxis()->SetTitle("N");
303 fHistNeutralMult->GetYaxis()->SetTitle("Multiplicity");
304
305 histname = "fHistPhivsPtPos" + fHistogramNameSuffix;
13b0d3c1 306 fHistPhivsPtPos = new TH2F(histname.Data(), "Phi vs pT of positively charged tracks hitting the calorimeter", 200, 0, 2*TMath::Pi(), nbinsPt, minPt, maxPt);
2fbf38ac 307
308 histname = "fHistPhivsPtNeg" + fHistogramNameSuffix;
13b0d3c1 309 fHistPhivsPtNeg = new TH2F(histname.Data(), "Phi vs pT of negatively charged tracks hitting the calorimeter", 200, 0, 2*TMath::Pi(), nbinsPt, minPt, maxPt);
2fbf38ac 310
311 histname = "fHistBaryonEt" + fHistogramNameSuffix;
13b0d3c1 312 fHistBaryonEt = new TH1F(histname.Data(), "E_{T} for baryons", nbinsEt, minEt, maxEt);
2fbf38ac 313
314 histname = "fHistAntiBaryonEt" + fHistogramNameSuffix;
13b0d3c1 315 fHistAntiBaryonEt = new TH1F(histname.Data(), "E_{T} for anti baryons", nbinsEt, minEt, maxEt);
2fbf38ac 316
317 histname = "fHistMesonEt" + fHistogramNameSuffix;
13b0d3c1 318 fHistMesonEt = new TH1F(histname.Data(), "E_{T} for mesons", nbinsEt, minEt, maxEt);
2fbf38ac 319
87efb15c 320 histname = "fHistProtonEt" + fHistogramNameSuffix;
321 fHistProtonEt = new TH1F(histname.Data(), "E_{T} for (anti-)protons", nbinsEt, minEt, maxEt);
322
43056f1b 323 histname = "fHistPionEt" + fHistogramNameSuffix;
324 fHistPionEt = new TH1F(histname.Data(), "E_{T} for #pi^+/#pi^-", nbinsEt, minEt, maxEt);
325
87efb15c 326 histname = "fHistKaonEt" + fHistogramNameSuffix;
327 fHistChargedKaonEt = new TH1F(histname.Data(), "E_{T} for charged kaons", nbinsEt, minEt, maxEt);
328
329 histname = "fHistMuonEt" + fHistogramNameSuffix;
330 fHistMuonEt = new TH1F(histname.Data(), "E_{T} for muons", nbinsEt, minEt, maxEt);
331
332 histname = "fHistElectronEt" + fHistogramNameSuffix;
333 fHistElectronEt = new TH1F(histname.Data(), "E_{T} for electrons/positrons", nbinsEt, minEt, maxEt);
334
43056f1b 335 histname = "fHistNeutronEt" + fHistogramNameSuffix;
336 fHistNeutronEt = new TH1F(histname.Data(), "E_{T} for neutrons", nbinsEt, minEt, maxEt);
337
338 histname = "fHistAntiNeutronEt" + fHistogramNameSuffix;
339 fHistAntiNeutronEt = new TH1F(histname.Data(), "E_{T} for anti-neutrons", nbinsEt, minEt, maxEt);
340
341 histname = "fHistGammaEt" + fHistogramNameSuffix;
342 fHistGammaEt = new TH1F(histname.Data(), "E_{T} for gammas", nbinsEt, minEt, maxEt);
343
87efb15c 344 histname = "fHistProtonEtAcc" + fHistogramNameSuffix;
345 fHistProtonEtAcc = new TH1F(histname.Data(), "E_{T} for (anti-)protons in calorimeter acceptance", nbinsEt, minEt, maxEt);
346
43056f1b 347 histname = "fHistPionEtAcc" + fHistogramNameSuffix;
348 fHistPionEtAcc = new TH1F(histname.Data(), "E_{T} for #pi^+/#pi^- in calorimeter acceptance", nbinsEt, minEt, maxEt);
349
87efb15c 350 histname = "fHistKaonEtAcc" + fHistogramNameSuffix;
351 fHistChargedKaonEtAcc = new TH1F(histname.Data(), "E_{T} for charged kaons in calorimeter acceptance", nbinsEt, minEt, maxEt);
352
353 histname = "fHistMuonEtAcc" + fHistogramNameSuffix;
354 fHistMuonEtAcc = new TH1F(histname.Data(), "E_{T} for muons in calorimeter acceptance", nbinsEt, minEt, maxEt);
355
356 histname = "fHistElectronEtAcc" + fHistogramNameSuffix;
357 fHistElectronEtAcc = new TH1F(histname.Data(), "E_{T} for electrons/positrons in calorimeter acceptance", nbinsEt, minEt, maxEt);
358
cf6522d1 359 //
2fbf38ac 360 histname = "fHistTMDeltaR" + fHistogramNameSuffix;
361 fHistTMDeltaR = new TH1F(histname.Data(), "#Delta R for calorimeter clusters", 200, 0, 50);
f9a4ed81 362
363 histname = "fHistTMDxDz" + fHistogramNameSuffix;
364 fHistTMDxDz = new TH2F(histname.Data(), "#Delta x vs #Delta z for calorimeter clusters", 800, -200, 200, 800, -200, 200);
365
366 histname = "fSparseHistTracks" + fHistogramNameSuffix;
367 const Int_t stsize = 7;
368 Int_t binsHist[stsize] = { 1001, 7, 200000, 10000, 10000, 100, 11};
369 Double_t minHist[stsize] = {-500.5, -3.5, 0.0, 0.0, 0.0, -1.5, -0.5};
370 Double_t maxHist[stsize] = { 499.5, 3.5, 200.0, 100.0, 100.0, 1.5, 10.5};
371 fSparseTracks = new Double_t[stsize];
372 fSparseHistTracks = new THnSparseD(histname.Data(), "pid:charge:mass:et:pt:rap:cent", stsize, binsHist, minHist, maxHist);
373
374 fSparseHistTracks->GetAxis(0)->SetTitle("pid");
375 fSparseHistTracks->GetAxis(1)->SetTitle("charge");
376 fSparseHistTracks->GetAxis(2)->SetTitle("mass");
377 fSparseHistTracks->GetAxis(3)->SetTitle("et");
378 fSparseHistTracks->GetAxis(4)->SetTitle("pt");
379 fSparseHistTracks->GetAxis(5)->SetTitle("rap");
380 fSparseHistTracks->GetAxis(6)->SetTitle("cent");
381
382 histname = "fSparseHistClusters" + fHistogramNameSuffix;
383 const Int_t scsize = 11;
384 // pid ch mass et pt eta et_t pt_t eta_t cent dist
385 Int_t scbinsHist[scsize] = { 1001, 7, 200000, 10000, 10000, 100, 10000, 10000, 100, 11, 4000};
386 Double_t scminHist[scsize] = {-500.5, -3.5, 0.0, 0.0, 0.0, -1.5, 0.0, 0.0, -1.5, -0.5, -200.0};
387 Double_t scmaxHist[scsize] = { 499.5, 3.5, 200.0, 100.0, 100.0, 1.5, 100.0, 100.0, 1.5, 10.5, 200.0};
388 fSparseClusters = new Double_t[scsize];
389 fSparseHistClusters = new THnSparseD(histname.Data(), "pid:charge:mass:et:pt:rap:et_track:pt_track:eta_track:cent:dist_matched", scsize, scbinsHist, scminHist, scmaxHist);
390
391 fSparseHistClusters->GetAxis(0)->SetTitle("pid");
392 fSparseHistClusters->GetAxis(1)->SetTitle("charge");
393 fSparseHistClusters->GetAxis(2)->SetTitle("mass");
394 fSparseHistClusters->GetAxis(3)->SetTitle("et");
395 fSparseHistClusters->GetAxis(4)->SetTitle("pt");
396 fSparseHistClusters->GetAxis(5)->SetTitle("rap");
397 fSparseHistClusters->GetAxis(6)->SetTitle("et_track");
398 fSparseHistClusters->GetAxis(7)->SetTitle("pt_track");
399 fSparseHistClusters->GetAxis(8)->SetTitle("rap_track");
400 fSparseHistClusters->GetAxis(9)->SetTitle("cent");
401 fSparseHistClusters->GetAxis(10)->SetTitle("dist_matched");
402
403 histname = "fSparseHistEt" + fHistogramNameSuffix;
404 const Int_t etsize = 7;
405 Int_t etbinsHist[etsize] = { 10000, 10000, 10000, 3000, 500, 30000, 11};
406 Double_t etminHist[etsize] = { 0.0, 0.0, 0.0, -0.5, -0.5, -0.5, -0.5};
407 Double_t etmaxHist[etsize] = { 200.0, 200.0, 200.0, 2999.5, 499.5, 2999.5, 10.5};
408 fSparseEt = new Double_t[etsize];
409 fSparseHistEt = new THnSparseD(histname.Data(), "tot_et:neutral_et:charged_et:tot_mult:neutral_mult:charged_mult:cent", etsize, etbinsHist, etminHist, etmaxHist);
410
411 fSparseHistEt->GetAxis(0)->SetTitle("tot_et");
412 fSparseHistEt->GetAxis(1)->SetTitle("neutral_et");
413 fSparseHistEt->GetAxis(2)->SetTitle("charged_et");
414 fSparseHistEt->GetAxis(3)->SetTitle("tot_mult");
415 fSparseHistEt->GetAxis(4)->SetTitle("netral_mult");
416 fSparseHistEt->GetAxis(5)->SetTitle("charged_mult");
417 fSparseHistEt->GetAxis(6)->SetTitle("cent");
418
0651f6b4 419}
2fbf38ac 420
0651f6b4 421TH2F* AliAnalysisEt::CreateEtaEHisto2D(TString name, TString title, TString ztitle)
422{ //creates a 2-d histogram in eta and E and adds it to the list of histograms to be saved
423 TString *histoname = new TString();
424 TString *histotitle = new TString();
425 TString *zaxistitle = new TString();
426
427 histoname->Append(name);
428 histotitle->Append(title);
429 zaxistitle->Append(ztitle);
430
431 TH2F *histo = new TH2F(histoname->Data(),histotitle->Data(),fgNumOfEBins, fgEAxis, fgnumOfEtaBins, fgEtaAxis);
432 histo->SetYTitle("#eta");
433 histo->SetXTitle("E (GeV)");
434 histo->SetZTitle(zaxistitle->Data());
435 histo->Sumw2();
436 //fhistoList->Add(histo);
437 delete histoname;
438 delete histotitle;
439 delete zaxistitle;
440
441 return histo;
2fbf38ac 442}
443
0651f6b4 444
8ea99ab0 445void AliAnalysisEt::CreateTrees()
ce546038 446{ // create tree..
447 TString treename = "fTree" + fHistogramNameSuffix;
8ea99ab0 448 if(fCuts->GetHistMakeTree())
449 {
450
451 fTree = new TTree(treename, treename);
452 fTree->Branch("fTotEt",&fTotEt,"fTotEt/D");
453 fTree->Branch("fTotEtAcc",&fTotEtAcc,"fTotEtAcc/D");
454 fTree->Branch("fTotNeutralEt",&fTotNeutralEt,"fTotNeutralEt/D");
455 fTree->Branch("fTotNeutralEtAcc",&fTotNeutralEtAcc,"fTotNeutralEtAcc/D");
456 fTree->Branch("fTotChargedEt",&fTotChargedEt,"fTotChargedEt/D");
457 fTree->Branch("fTotChargedEtAcc",&fTotChargedEtAcc,"fTotChargedEtAcc/D");
458 fTree->Branch("fMultiplicity",&fMultiplicity,"fMultiplicity/I");
459 fTree->Branch("fChargedMultiplicity",&fChargedMultiplicity,"fChargedMultiplicity/I");
460 fTree->Branch("fNeutralMultiplicity",&fNeutralMultiplicity,"fNeutralMultiplicity/I");
f9a4ed81 461 fTree->Branch("fCentClass",&fCentClass,"fCentClass/I");
462
8ea99ab0 463 fTree->Branch("fBaryonEt",&fBaryonEt,"fBaryonEt/D");
464 fTree->Branch("fAntiBaryonEt",&fAntiBaryonEt,"fAntiBaryonEt/D");
465 fTree->Branch("fMesonEt",&fMesonEt,"fMesonEt/D");
8ea99ab0 466 fTree->Branch("fProtonEt",&fProtonEt,"fProtonEt/D");
467 fTree->Branch("fChargedKaonEt",&fChargedKaonEt,"fChargedKaonEt/D");
468 fTree->Branch("fMuonEt",&fMuonEt,"fMuonEt/D");
469 fTree->Branch("fElectronEt",&fElectronEt,"fElectronEt/D");
470 fTree->Branch("fProtonEtAcc",&fProtonEtAcc,"fProtonEtAcc/D");
471 fTree->Branch("fChargedKaonEtAcc",&fChargedKaonEtAcc,"fChargedKaonEtAcc/D");
472 fTree->Branch("fMuonEtAcc",&fMuonEtAcc,"fMuonEtAcc/D");
473 fTree->Branch("fElectronEtAcc",&fElectronEtAcc,"fElectronEtAcc/D");
474 }
475
476 if(fCuts->GetHistMakeTreeDeposit())
477 {
478 treename = "fTreeDeposit" + fHistogramNameSuffix;
479 fTreeDeposit = new TTree(treename, treename);
480
481 fTreeDeposit->Branch("fEnergyDeposited", &fEnergyDeposited, "fEnergyDeposited/F");
482 fTreeDeposit->Branch("fEnergyTPC", &fEnergyTPC, "fEnergyTPC/F");
483 fTreeDeposit->Branch("fCharge", &fCharge, "fCharge/S");
484 fTreeDeposit->Branch("fParticlePid", &fParticlePid, "fParticlePid/S");
485 fTreeDeposit->Branch("fPidProb", &fPidProb, "fPidProb/F");
486 fTreeDeposit->Branch("fTrackPassedCut", &fTrackPassedCut, "fTrackPassedCut/B");
487
488 }
7b873813 489
ce546038 490 return;
491}
2fbf38ac 492void AliAnalysisEt::FillHistograms()
cf6522d1 493{ // fill histograms..
2fbf38ac 494 fHistEt->Fill(fTotEt);
495 fHistChargedEt->Fill(fTotChargedEt);
496 fHistNeutralEt->Fill(fTotNeutralEt);
497
498 fHistEtAcc->Fill(fTotEtAcc);
499 fHistChargedEtAcc->Fill(fTotChargedEtAcc);
500 fHistNeutralEtAcc->Fill(fTotNeutralEtAcc);
501
502 fHistMult->Fill(fMultiplicity);
503 fHistChargedMult->Fill(fChargedMultiplicity);
504 fHistNeutralMult->Fill(fNeutralMultiplicity);
505
ce546038 506 fHistBaryonEt->Fill(fBaryonEt);
507 fHistAntiBaryonEt->Fill(fAntiBaryonEt);
508 fHistMesonEt->Fill(fMesonEt);
2fbf38ac 509
87efb15c 510 fHistProtonEt->Fill(fProtonEt);
43056f1b 511 fHistPionEt->Fill(fPionEt);
87efb15c 512 fHistChargedKaonEt->Fill(fChargedKaonEt);
513 fHistMuonEt->Fill(fMuonEt);
514 fHistElectronEt->Fill(fElectronEt);
43056f1b 515 fHistNeutronEt->Fill(fNeutronEt);
516 fHistAntiNeutronEt->Fill(fAntiNeutronEt);
517 fHistGammaEt->Fill(fGammaEt);
87efb15c 518
519 fHistProtonEtAcc->Fill(fProtonEtAcc);
43056f1b 520 fHistPionEtAcc->Fill(fPionEtAcc);
87efb15c 521 fHistChargedKaonEtAcc->Fill(fChargedKaonEtAcc);
522 fHistMuonEtAcc->Fill(fMuonEtAcc);
523 fHistElectronEtAcc->Fill(fElectronEtAcc);
ce546038 524
525 if (fCuts) {
526 if (fCuts->GetHistMakeTree()) {
527 fTree->Fill();
528 }
529 }
f9a4ed81 530
531 fSparseHistEt->Fill(fSparseEt);
2fbf38ac 532}
0065531a 533
641e1e0c 534Int_t AliAnalysisEt::AnalyseEvent(AliVEvent *event)
0065531a 535{ //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.
7d2d1773 536 AliAnalysisEtCommon::AnalyseEvent(event);
0065531a 537 ResetEventValues();
641e1e0c 538 return 0;
539}
2fbf38ac 540
541void AliAnalysisEt::ResetEventValues()
cf6522d1 542{ // clear
7d2d1773 543 AliAnalysisEtCommon::ResetEventValues();
0065531a 544 fTotEt = 0;
545 fTotEtAcc = 0;
546 fTotNeutralEt = 0;
547 fTotNeutralEtAcc = 0;
548 fTotChargedEt = 0;
549 fTotChargedEtAcc = 0;
550 fMultiplicity = 0;
551 fChargedMultiplicity = 0;
552 fNeutralMultiplicity = 0;
87efb15c 553 fBaryonEt = 0;
554 fAntiBaryonEt = 0;
555 fMesonEt = 0;
87efb15c 556 fProtonEt = 0;
7b873813 557 fPionEt = 0;
87efb15c 558 fChargedKaonEt = 0;
559 fMuonEt = 0;
560 fElectronEt = 0;
7b873813 561 fNeutronEt = 0;
562 fAntiNeutronEt = 0;
563 fGammaEt = 0;
87efb15c 564 fProtonEtAcc = 0;
7b873813 565 fPionEtAcc = 0;
87efb15c 566 fChargedKaonEtAcc = 0;
567 fMuonEtAcc = 0;
ce546038 568 fElectronEtAcc = 0;
0065531a 569 return;
2fbf38ac 570}
99a6613d 571
f9a4ed81 572Double_t AliAnalysisEt::CalculateTransverseEnergy(AliESDCaloCluster* cluster)
537e541d 573{ // based on cluster energy and cluster pos
f9a4ed81 574
575 Float_t pos[3];
576 cluster->GetPosition(pos);
577 TVector3 cp(pos);
578
579 return cluster->E() * TMath::Sin(cp.Theta());
580
581}