]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWG4/totEt/AliAnalysisEt.cxx
Fixing some more coding violations, fix in reweighting of V0s, changed GetCorrections...
[u/mrichter/AliRoot.git] / PWG4 / totEt / AliAnalysisEt.cxx
... / ...
CommitLineData
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
10#include "AliAnalysisEt.h"
11#include "TMath.h"
12#include "TList.h"
13#include "TH1F.h"
14#include "TH2F.h"
15#include "TTree.h"
16#include <iostream>
17#include "AliAnalysisEtCuts.h"
18#include "AliESDtrackCuts.h"
19#include "AliVEvent.h"
20#include "Rtypes.h"
21#include "TString.h"
22
23using namespace std;
24ClassImp(AliAnalysisEt);
25
26
27AliAnalysisEt::AliAnalysisEt() : AliAnalysisEtCommon()
28 ,fTotEt(0)
29 ,fTotEtAcc(0)
30 ,fTotNeutralEt(0)
31 ,fTotNeutralEtAcc(0)
32 ,fTotChargedEt(0)
33 ,fTotChargedEtAcc(0)
34 ,fMultiplicity(0)
35 ,fChargedMultiplicity(0)
36 ,fNeutralMultiplicity(0)
37 ,fBaryonEt(0)
38 ,fAntiBaryonEt(0)
39 ,fMesonEt(0)
40 ,fProtonEt(0)
41 ,fPionEt(0)
42 ,fChargedKaonEt(0)
43 ,fMuonEt(0)
44 ,fElectronEt(0)
45 ,fNeutronEt(0)
46 ,fAntiNeutronEt(0)
47 ,fGammaEt(0)
48 ,fProtonEtAcc(0)
49 ,fPionEtAcc(0)
50 ,fChargedKaonEtAcc(0)
51 ,fMuonEtAcc(0)
52 ,fElectronEtAcc(0)
53 ,fEnergyDeposited(0)
54 ,fEnergyTPC(0)
55 ,fCharge(0)
56 ,fParticlePid(0)
57 ,fPidProb(0)
58 ,fTrackPassedCut(kFALSE)
59 ,fEtaCut(0)
60 ,fEtaCutAcc(0)
61 ,fPhiCutAccMin(0)
62 ,fPhiCutAccMax(0)
63 ,fDetectorRadius(0)
64 ,fClusterEnergyCut(0)
65 ,fSingleCellEnergyCut(0)
66 ,fHistEt(0)
67 ,fHistChargedEt(0)
68 ,fHistNeutralEt(0)
69 ,fHistEtAcc(0)
70 ,fHistChargedEtAcc(0)
71 ,fHistNeutralEtAcc(0)
72 ,fHistMult(0)
73 ,fHistChargedMult(0)
74 ,fHistNeutralMult(0)
75 ,fHistPhivsPtPos(0)
76 ,fHistPhivsPtNeg(0)
77 ,fHistBaryonEt(0)
78 ,fHistAntiBaryonEt(0)
79 ,fHistMesonEt(0)
80 ,fHistProtonEt(0)
81 ,fHistPionEt(0)
82 ,fHistChargedKaonEt(0)
83 ,fHistMuonEt(0)
84 ,fHistElectronEt(0)
85 ,fHistNeutronEt(0)
86 ,fHistAntiNeutronEt(0)
87 ,fHistGammaEt(0)
88 ,fHistProtonEtAcc(0)
89 ,fHistPionEtAcc(0)
90 ,fHistChargedKaonEtAcc(0)
91 ,fHistMuonEtAcc(0)
92 ,fHistElectronEtAcc(0)
93 ,fHistTMDeltaR(0)
94 ,fTree(0)
95 ,fTreeDeposit(0)
96{
97}
98
99AliAnalysisEt::~AliAnalysisEt()
100{//Destructor
101 if(fTreeDeposit){
102 fTreeDeposit->Clear();
103 delete fTreeDeposit; // optional TTree
104 }
105 if(fTree){
106 fTree->Clear();
107 delete fTree; // optional TTree
108 }
109 delete fHistEt; //Et spectrum
110 delete fHistChargedEt; //Charged Et spectrum
111 delete fHistNeutralEt; //Neutral Et spectrum
112 delete fHistEtAcc; //Et in acceptance
113 delete fHistChargedEtAcc; //Charged Et in acceptance
114 delete fHistNeutralEtAcc; //Et in acceptance
115 delete fHistMult; //Multiplicity
116 delete fHistChargedMult; //Charged multiplicity
117 delete fHistNeutralMult; //Neutral multiplicity
118 delete fHistPhivsPtPos; //phi vs pT plot for positive tracks
119 delete fHistPhivsPtNeg; //phi vs pT plot for negative tracks
120 delete fHistBaryonEt; /** Et of identified baryons */
121 delete fHistAntiBaryonEt; /** Et of identified anti-baryons */
122 delete fHistMesonEt; /** Et of identified mesons */
123 delete fHistProtonEt; /** Et of identified protons */
124 delete fHistPionEt; /** Et of identified protons */
125 delete fHistChargedKaonEt; /** Et of identified charged kaons */
126 delete fHistMuonEt; /** Et of identified muons */
127 delete fHistElectronEt; /** Et of identified electrons */
128 delete fHistNeutronEt; /** Et of neutrons (MC only for now) */
129 delete fHistAntiNeutronEt; /** Et of anti-neutrons (MC only for now) */
130 delete fHistGammaEt; /** Et of gammas (MC only for now) */
131 delete fHistProtonEtAcc; /** Et of identified protons in calorimeter acceptance */
132 delete fHistPionEtAcc; /** Et of identified protons in calorimeter acceptance */
133 delete fHistChargedKaonEtAcc; /** Et of identified charged kaons in calorimeter acceptance */
134 delete fHistMuonEtAcc; /** Et of identified muons in calorimeter acceptance */
135 delete fHistElectronEtAcc; /** Et of identified electrons in calorimeter acceptance */
136 delete fHistTMDeltaR; /* Track matching plots; Rec only for now */
137}
138
139void AliAnalysisEt::FillOutputList(TList *list)
140{ // histograms to be added to output
141 list->Add(fHistEt);
142 list->Add(fHistChargedEt);
143 list->Add(fHistNeutralEt);
144
145 list->Add(fHistEtAcc);
146 list->Add(fHistChargedEtAcc);
147 list->Add(fHistNeutralEtAcc);
148
149 list->Add(fHistMult);
150 list->Add(fHistChargedMult);
151 list->Add(fHistNeutralMult);
152
153 list->Add(fHistPhivsPtPos);
154 list->Add(fHistPhivsPtNeg);
155
156 list->Add(fHistBaryonEt);
157 list->Add(fHistAntiBaryonEt);
158 list->Add(fHistMesonEt);
159
160 list->Add(fHistProtonEt);
161 list->Add(fHistPionEt);
162 list->Add(fHistChargedKaonEt);
163 list->Add(fHistMuonEt);
164 list->Add(fHistElectronEt);
165
166 list->Add(fHistNeutronEt);
167 list->Add(fHistAntiNeutronEt);
168 list->Add(fHistGammaEt);
169
170 list->Add(fHistProtonEtAcc);
171 list->Add(fHistPionEtAcc);
172 list->Add(fHistChargedKaonEtAcc);
173 list->Add(fHistMuonEtAcc);
174 list->Add(fHistElectronEtAcc);
175
176 list->Add(fHistTMDeltaR);
177
178 if (fCuts) {
179 if (fCuts->GetHistMakeTree()) {
180 list->Add(fTree);
181 }
182 }
183 list->Add(fTreeDeposit);
184
185}
186
187void AliAnalysisEt::Init()
188{// clear variables, set up cuts and PDG info
189 AliAnalysisEtCommon::Init();
190 ResetEventValues();
191}
192
193void AliAnalysisEt::CreateHistograms()
194{ // create histograms..
195 // histogram binning for E_T, p_T and Multiplicity: defaults for p+p
196 Int_t nbinsEt = 1000;
197 Double_t minEt = 0.0001;
198 Double_t maxEt = 100;
199 Int_t nbinsPt = 200;
200 Double_t minPt = 0;
201 Double_t maxPt = 20;
202 Int_t nbinsMult = 200;
203 Double_t minMult = -0.5; // offset -0.5 to have integer bins centered around 0
204 Double_t maxMult = nbinsMult + minMult; // 1 bin per integer value
205
206 // see if we should change histogram limits etc, and possibly create a tree
207 if (fCuts) {
208 //if (fCuts->GetHistMakeTree()) {
209 CreateTrees();
210 //}
211
212 nbinsMult = fCuts->GetHistNbinsMult();
213 minMult = fCuts->GetHistMinMult();
214 maxMult = fCuts->GetHistMaxMult();
215
216 nbinsEt = fCuts->GetHistNbinsTotEt();
217 minEt = fCuts->GetHistMinTotEt();
218 maxEt = fCuts->GetHistMaxTotEt();
219
220 nbinsPt = fCuts->GetHistNbinsParticlePt();
221 minPt = fCuts->GetHistMinParticlePt();
222 maxPt = fCuts->GetHistMaxParticlePt();
223 }
224
225 TString histname = "fHistEt" + fHistogramNameSuffix;
226 fHistEt = new TH1F(histname.Data(), "Total E_{T} Distribution", nbinsEt, minEt, maxEt);
227 fHistEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
228 fHistEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
229
230 histname = "fHistChargedEt" + fHistogramNameSuffix;
231 fHistChargedEt = new TH1F(histname.Data(), "Total Charged E_{T} Distribution", nbinsEt, minEt, maxEt);
232 fHistChargedEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
233 fHistChargedEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
234
235 histname = "fHistNeutralEt" + fHistogramNameSuffix;
236 fHistNeutralEt = new TH1F(histname.Data(), "Total Neutral E_{T} Distribution", nbinsEt, minEt, maxEt);
237 fHistNeutralEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
238 fHistNeutralEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
239
240 histname = "fHistEtAcc" + fHistogramNameSuffix;
241 fHistEtAcc = new TH1F(histname.Data(), "Total E_{T} Distribution in Acceptance", nbinsEt, minEt, maxEt);
242 fHistEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
243 fHistEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
244
245 histname = "fHistChargedEtAcc" + fHistogramNameSuffix;
246 fHistChargedEtAcc = new TH1F(histname.Data(), "Total Charged E_{T} Distribution in Acceptance", nbinsEt, minEt, maxEt);
247 fHistChargedEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
248 fHistChargedEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
249
250 histname = "fHistNeutralEtAcc" + fHistogramNameSuffix;
251 fHistNeutralEtAcc = new TH1F(histname.Data(), "Total Neutral E_{T} Distribution in Acceptance", nbinsEt, minEt, maxEt);
252 fHistNeutralEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
253 fHistNeutralEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
254 std::cout << histname << std::endl;
255 histname = "fHistMult" + fHistogramNameSuffix;
256 fHistMult = new TH1F(histname.Data(), "Total Multiplicity", nbinsMult, minMult, maxMult);
257 fHistMult->GetXaxis()->SetTitle("N");
258 fHistMult->GetYaxis()->SetTitle("Multiplicity");
259
260 histname = "fHistChargedMult" + fHistogramNameSuffix;
261 fHistChargedMult = new TH1F(histname.Data(), "Charged Multiplicity", nbinsMult, minMult, maxMult);
262 fHistChargedMult->GetXaxis()->SetTitle("N");
263 fHistChargedMult->GetYaxis()->SetTitle("Multiplicity");
264
265 histname = "fHistNeutralMult" + fHistogramNameSuffix;
266 fHistNeutralMult = new TH1F(histname.Data(), "Neutral Multiplicity", nbinsMult, minMult, maxMult);
267 fHistNeutralMult->GetXaxis()->SetTitle("N");
268 fHistNeutralMult->GetYaxis()->SetTitle("Multiplicity");
269
270 histname = "fHistPhivsPtPos" + fHistogramNameSuffix;
271 fHistPhivsPtPos = new TH2F(histname.Data(), "Phi vs pT of positively charged tracks hitting the calorimeter", 200, 0, 2*TMath::Pi(), nbinsPt, minPt, maxPt);
272
273 histname = "fHistPhivsPtNeg" + fHistogramNameSuffix;
274 fHistPhivsPtNeg = new TH2F(histname.Data(), "Phi vs pT of negatively charged tracks hitting the calorimeter", 200, 0, 2*TMath::Pi(), nbinsPt, minPt, maxPt);
275
276 histname = "fHistBaryonEt" + fHistogramNameSuffix;
277 fHistBaryonEt = new TH1F(histname.Data(), "E_{T} for baryons", nbinsEt, minEt, maxEt);
278
279 histname = "fHistAntiBaryonEt" + fHistogramNameSuffix;
280 fHistAntiBaryonEt = new TH1F(histname.Data(), "E_{T} for anti baryons", nbinsEt, minEt, maxEt);
281
282 histname = "fHistMesonEt" + fHistogramNameSuffix;
283 fHistMesonEt = new TH1F(histname.Data(), "E_{T} for mesons", nbinsEt, minEt, maxEt);
284
285 histname = "fHistProtonEt" + fHistogramNameSuffix;
286 fHistProtonEt = new TH1F(histname.Data(), "E_{T} for (anti-)protons", nbinsEt, minEt, maxEt);
287
288 histname = "fHistPionEt" + fHistogramNameSuffix;
289 fHistPionEt = new TH1F(histname.Data(), "E_{T} for #pi^+/#pi^-", nbinsEt, minEt, maxEt);
290
291 histname = "fHistKaonEt" + fHistogramNameSuffix;
292 fHistChargedKaonEt = new TH1F(histname.Data(), "E_{T} for charged kaons", nbinsEt, minEt, maxEt);
293
294 histname = "fHistMuonEt" + fHistogramNameSuffix;
295 fHistMuonEt = new TH1F(histname.Data(), "E_{T} for muons", nbinsEt, minEt, maxEt);
296
297 histname = "fHistElectronEt" + fHistogramNameSuffix;
298 fHistElectronEt = new TH1F(histname.Data(), "E_{T} for electrons/positrons", nbinsEt, minEt, maxEt);
299
300 histname = "fHistNeutronEt" + fHistogramNameSuffix;
301 fHistNeutronEt = new TH1F(histname.Data(), "E_{T} for neutrons", nbinsEt, minEt, maxEt);
302
303 histname = "fHistAntiNeutronEt" + fHistogramNameSuffix;
304 fHistAntiNeutronEt = new TH1F(histname.Data(), "E_{T} for anti-neutrons", nbinsEt, minEt, maxEt);
305
306 histname = "fHistGammaEt" + fHistogramNameSuffix;
307 fHistGammaEt = new TH1F(histname.Data(), "E_{T} for gammas", nbinsEt, minEt, maxEt);
308
309 histname = "fHistProtonEtAcc" + fHistogramNameSuffix;
310 fHistProtonEtAcc = new TH1F(histname.Data(), "E_{T} for (anti-)protons in calorimeter acceptance", nbinsEt, minEt, maxEt);
311
312 histname = "fHistPionEtAcc" + fHistogramNameSuffix;
313 fHistPionEtAcc = new TH1F(histname.Data(), "E_{T} for #pi^+/#pi^- in calorimeter acceptance", nbinsEt, minEt, maxEt);
314
315 histname = "fHistKaonEtAcc" + fHistogramNameSuffix;
316 fHistChargedKaonEtAcc = new TH1F(histname.Data(), "E_{T} for charged kaons in calorimeter acceptance", nbinsEt, minEt, maxEt);
317
318 histname = "fHistMuonEtAcc" + fHistogramNameSuffix;
319 fHistMuonEtAcc = new TH1F(histname.Data(), "E_{T} for muons in calorimeter acceptance", nbinsEt, minEt, maxEt);
320
321 histname = "fHistElectronEtAcc" + fHistogramNameSuffix;
322 fHistElectronEtAcc = new TH1F(histname.Data(), "E_{T} for electrons/positrons in calorimeter acceptance", nbinsEt, minEt, maxEt);
323
324 //
325 histname = "fHistTMDeltaR" + fHistogramNameSuffix;
326 fHistTMDeltaR = new TH1F(histname.Data(), "#Delta R for calorimeter clusters", 200, 0, 50);
327
328}
329
330void AliAnalysisEt::CreateTrees()
331{ // create tree..
332 TString treename = "fTree" + fHistogramNameSuffix;
333 if(fCuts->GetHistMakeTree())
334 {
335
336 fTree = new TTree(treename, treename);
337 fTree->Branch("fTotEt",&fTotEt,"fTotEt/D");
338 fTree->Branch("fTotEtAcc",&fTotEtAcc,"fTotEtAcc/D");
339 fTree->Branch("fTotNeutralEt",&fTotNeutralEt,"fTotNeutralEt/D");
340 fTree->Branch("fTotNeutralEtAcc",&fTotNeutralEtAcc,"fTotNeutralEtAcc/D");
341 fTree->Branch("fTotChargedEt",&fTotChargedEt,"fTotChargedEt/D");
342 fTree->Branch("fTotChargedEtAcc",&fTotChargedEtAcc,"fTotChargedEtAcc/D");
343 fTree->Branch("fMultiplicity",&fMultiplicity,"fMultiplicity/I");
344 fTree->Branch("fChargedMultiplicity",&fChargedMultiplicity,"fChargedMultiplicity/I");
345 fTree->Branch("fNeutralMultiplicity",&fNeutralMultiplicity,"fNeutralMultiplicity/I");
346 fTree->Branch("fBaryonEt",&fBaryonEt,"fBaryonEt/D");
347 fTree->Branch("fAntiBaryonEt",&fAntiBaryonEt,"fAntiBaryonEt/D");
348 fTree->Branch("fMesonEt",&fMesonEt,"fMesonEt/D");
349 fTree->Branch("fProtonEt",&fProtonEt,"fProtonEt/D");
350 fTree->Branch("fChargedKaonEt",&fChargedKaonEt,"fChargedKaonEt/D");
351 fTree->Branch("fMuonEt",&fMuonEt,"fMuonEt/D");
352 fTree->Branch("fElectronEt",&fElectronEt,"fElectronEt/D");
353 fTree->Branch("fProtonEtAcc",&fProtonEtAcc,"fProtonEtAcc/D");
354 fTree->Branch("fChargedKaonEtAcc",&fChargedKaonEtAcc,"fChargedKaonEtAcc/D");
355 fTree->Branch("fMuonEtAcc",&fMuonEtAcc,"fMuonEtAcc/D");
356 fTree->Branch("fElectronEtAcc",&fElectronEtAcc,"fElectronEtAcc/D");
357 }
358
359 if(fCuts->GetHistMakeTreeDeposit())
360 {
361 treename = "fTreeDeposit" + fHistogramNameSuffix;
362 fTreeDeposit = new TTree(treename, treename);
363
364 fTreeDeposit->Branch("fEnergyDeposited", &fEnergyDeposited, "fEnergyDeposited/F");
365 fTreeDeposit->Branch("fEnergyTPC", &fEnergyTPC, "fEnergyTPC/F");
366 fTreeDeposit->Branch("fCharge", &fCharge, "fCharge/S");
367 fTreeDeposit->Branch("fParticlePid", &fParticlePid, "fParticlePid/S");
368 fTreeDeposit->Branch("fPidProb", &fPidProb, "fPidProb/F");
369 fTreeDeposit->Branch("fTrackPassedCut", &fTrackPassedCut, "fTrackPassedCut/B");
370
371 }
372
373 return;
374}
375void AliAnalysisEt::FillHistograms()
376{ // fill histograms..
377 fHistEt->Fill(fTotEt);
378 fHistChargedEt->Fill(fTotChargedEt);
379 fHistNeutralEt->Fill(fTotNeutralEt);
380
381 fHistEtAcc->Fill(fTotEtAcc);
382 fHistChargedEtAcc->Fill(fTotChargedEtAcc);
383 fHistNeutralEtAcc->Fill(fTotNeutralEtAcc);
384
385 fHistMult->Fill(fMultiplicity);
386 fHistChargedMult->Fill(fChargedMultiplicity);
387 fHistNeutralMult->Fill(fNeutralMultiplicity);
388
389 fHistBaryonEt->Fill(fBaryonEt);
390 fHistAntiBaryonEt->Fill(fAntiBaryonEt);
391 fHistMesonEt->Fill(fMesonEt);
392
393 fHistProtonEt->Fill(fProtonEt);
394 fHistPionEt->Fill(fPionEt);
395 fHistChargedKaonEt->Fill(fChargedKaonEt);
396 fHistMuonEt->Fill(fMuonEt);
397 fHistElectronEt->Fill(fElectronEt);
398 fHistNeutronEt->Fill(fNeutronEt);
399 fHistAntiNeutronEt->Fill(fAntiNeutronEt);
400 fHistGammaEt->Fill(fGammaEt);
401
402 fHistProtonEtAcc->Fill(fProtonEtAcc);
403 fHistPionEtAcc->Fill(fPionEtAcc);
404 fHistChargedKaonEtAcc->Fill(fChargedKaonEtAcc);
405 fHistMuonEtAcc->Fill(fMuonEtAcc);
406 fHistElectronEtAcc->Fill(fElectronEtAcc);
407
408 if (fCuts) {
409 if (fCuts->GetHistMakeTree()) {
410 fTree->Fill();
411 }
412 }
413
414}
415
416Int_t AliAnalysisEt::AnalyseEvent(AliVEvent *event)
417{ //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.
418 AliAnalysisEtCommon::AnalyseEvent(event);
419 ResetEventValues();
420 return 0;
421}
422
423void AliAnalysisEt::ResetEventValues()
424{ // clear
425 AliAnalysisEtCommon::ResetEventValues();
426 fTotEt = 0;
427 fTotEtAcc = 0;
428 fTotNeutralEt = 0;
429 fTotNeutralEtAcc = 0;
430 fTotChargedEt = 0;
431 fTotChargedEtAcc = 0;
432 fMultiplicity = 0;
433 fChargedMultiplicity = 0;
434 fNeutralMultiplicity = 0;
435 fBaryonEt = 0;
436 fAntiBaryonEt = 0;
437 fMesonEt = 0;
438 fProtonEt = 0;
439 fPionEt = 0;
440 fChargedKaonEt = 0;
441 fMuonEt = 0;
442 fElectronEt = 0;
443 fNeutronEt = 0;
444 fAntiNeutronEt = 0;
445 fGammaEt = 0;
446 fProtonEtAcc = 0;
447 fPionEtAcc = 0;
448 fChargedKaonEtAcc = 0;
449 fMuonEtAcc = 0;
450 fElectronEtAcc = 0;
451 return;
452}
453