]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliAnalysisEt.cxx
1aa6d45a8201fcebe88fc3b5aa25eb88b6be2b89
[u/mrichter/AliRoot.git] / AliAnalysisEt.cxx
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 "AliESDCaloCluster.h"
20 #include "AliVEvent.h"
21 #include "Rtypes.h"
22 #include "TString.h"
23 #include "AliCentrality.h"
24                //#include "THnSparse.h"
25
26 using namespace std;
27 ClassImp(AliAnalysisEt);
28
29 /* Auxiliary Histogram variables */
30 Int_t AliAnalysisEt::fgnumOfEtaBins = 16;
31 Float_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};
32
33 Int_t AliAnalysisEt::fgNumOfPtBins = 111;
34 Float_t AliAnalysisEt::fgPtAxis[117]=
35    {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,
36         0.2, .22, .24, .26, .28, 0.30, 0.32, .34, .36, .38, 0.40, .42, .44, .46, .48,
37         0.5, .52, .54, .56, .58, 0.60, 0.62, .64, .66, .68, 0.70, .72, .74, .76, .78,
38         .80, .82, .84, .86, .88, 0.90, 0.92, .94, .96, .98, 1.00,1.05, 1.1,1.15, 1.2,
39         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,
40         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,
41         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,
42         20.0,25.0,30.0,35.0,40.0, 45.0, 50.0}; 
43
44 Int_t AliAnalysisEt::fgNumOfEBins = 78;
45 Float_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,
46                                                                         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.,
47                                                                         12.,13.,14.,15.,16.,17.,18.,19.,20.,21.,22.,23.,24.,25.,26.,27.,28.,29.,30.,31.,
48                                                                         32.,33.,34.,35.,36.,37.,38.,39.,40.,41.,42.,43.,44.,45.,46.,47.,48.,49.,50.};
49
50 Int_t AliAnalysisEt::fgNumOfRBins = 47;
51 Float_t AliAnalysisEt::fgRAxis[48]={-2.,-1.,0.,0.0005,0.001,0.0015,0.002,0.0025,0.003,0.0035,0.004,0.0045,0.005,0.0055,0.006,0.0065,0.007,0.0075,0.008,0.0085,0.009,0.0095,0.01,
52                                                                         0.011,0.012,0.013,0.014,0.015,0.016,0.017,0.018,0.019,0.020,0.022,0.024,0.026,0.028,0.03,0.032,0.034,0.036,0.038,0.04,0.042,0.044,0.046,0.048,0.05};
53
54
55 AliAnalysisEt::AliAnalysisEt() : AliAnalysisEtCommon()
56                                ,fTotEt(0)
57                                ,fTotEtAcc(0)
58                                ,fTotNeutralEt(0)
59                                ,fTotNeutralEtAcc(0)
60                                ,fTotChargedEt(0)
61                                ,fTotChargedEtAcc(0)
62                                ,fMultiplicity(0)
63                                ,fChargedMultiplicity(0)
64                                ,fNeutralMultiplicity(0)
65                                ,fBaryonEt(0)
66                                ,fAntiBaryonEt(0)
67                                ,fMesonEt(0)
68                                ,fProtonEt(0)
69                                ,fPionEt(0)
70                                ,fChargedKaonEt(0)
71                                ,fMuonEt(0)
72                                ,fElectronEt(0)
73                                ,fNeutronEt(0)
74                                ,fAntiNeutronEt(0)
75                                ,fGammaEt(0)
76                                ,fProtonEtAcc(0)
77                                ,fPionEtAcc(0)
78                                ,fChargedKaonEtAcc(0)
79                                ,fMuonEtAcc(0)
80                                ,fElectronEtAcc(0)
81                                ,fEnergyDeposited(0)
82                                ,fEnergyTPC(0)
83                                ,fCharge(0)
84                                ,fParticlePid(0)
85                                ,fPidProb(0)
86                                ,fTrackPassedCut(kFALSE)
87                                ,fCentClass(0)
88                                ,fEtaCut(0)
89                                ,fEtaCutAcc(0)
90                                ,fPhiCutAccMin(0)
91                                ,fPhiCutAccMax(0)
92                                ,fDetectorRadius(0)
93                                ,fClusterEnergyCut(0) 
94                                ,fSingleCellEnergyCut(0)
95                                ,fTrackDistanceCut(0)
96                                ,fTrackDxCut(0)
97                                ,fTrackDzCut(0)
98                                ,fHistEt(0)
99                                ,fHistChargedEt(0)
100                                ,fHistNeutralEt(0)
101                                ,fHistEtAcc(0)
102                                ,fHistChargedEtAcc(0)
103                                ,fHistNeutralEtAcc(0)
104                                ,fHistMult(0)
105                                ,fHistChargedMult(0)
106                                ,fHistNeutralMult(0)
107                                ,fHistPhivsPtPos(0)
108                                ,fHistPhivsPtNeg(0)
109                                ,fHistBaryonEt(0)
110                                ,fHistAntiBaryonEt(0)
111                                ,fHistMesonEt(0)
112                                ,fHistProtonEt(0)
113                                ,fHistPionEt(0)
114                                ,fHistChargedKaonEt(0)
115                                ,fHistMuonEt(0)
116                                ,fHistElectronEt(0)
117                                ,fHistNeutronEt(0)
118                                ,fHistAntiNeutronEt(0)
119                                ,fHistGammaEt(0)
120                                ,fHistProtonEtAcc(0)
121                                ,fHistPionEtAcc(0)
122                                ,fHistChargedKaonEtAcc(0)
123                                ,fHistMuonEtAcc(0)
124                                ,fHistElectronEtAcc(0)
125                                ,fHistTMDeltaR(0)
126                                ,fHistTMDxDz(0)
127                                ,fTree(0)
128                                ,fTreeDeposit(0)
129                                ,fCentrality(0)
130                                ,fDetector(0)
131                                ,fSparseHistTracks(0)
132                                ,fSparseHistClusters(0)
133                                ,fSparseHistEt(0)
134                                ,fSparseTracks(0)
135                                ,fSparseClusters(0)
136                                ,fSparseEt(0)
137                                
138 {}
139
140 AliAnalysisEt::~AliAnalysisEt()
141 {//Destructor
142   if(fTreeDeposit){
143     fTreeDeposit->Clear();
144     delete fTreeDeposit; // optional TTree
145   }
146   if(fTree){
147     fTree->Clear();
148     delete fTree; // optional TTree
149   }
150   delete fHistEt; //Et spectrum
151   delete fHistChargedEt; //Charged Et spectrum 
152   delete fHistNeutralEt; //Neutral Et spectrum
153   delete fHistEtAcc; //Et in acceptance
154   delete fHistChargedEtAcc; //Charged Et in acceptance
155   delete fHistNeutralEtAcc; //Et in acceptance
156   delete fHistMult; //Multiplicity
157   delete fHistChargedMult; //Charged multiplicity
158   delete fHistNeutralMult; //Neutral multiplicity
159   delete fHistPhivsPtPos; //phi vs pT plot for positive tracks
160   delete fHistPhivsPtNeg; //phi vs pT plot for negative tracks
161   delete fHistBaryonEt; /** Et of identified baryons */    
162   delete fHistAntiBaryonEt; /** Et of identified anti-baryons */
163   delete fHistMesonEt; /** Et of identified mesons */
164   delete fHistProtonEt; /** Et of identified protons */
165   delete fHistPionEt; /** Et of identified protons */
166   delete fHistChargedKaonEt; /** Et of identified charged kaons */
167   delete fHistMuonEt; /** Et of identified muons */
168   delete fHistElectronEt; /** Et of identified electrons */
169   delete fHistNeutronEt; /** Et of neutrons (MC only for now) */
170   delete fHistAntiNeutronEt; /** Et of anti-neutrons (MC only for now) */
171   delete fHistGammaEt; /** Et of gammas (MC only for now) */
172   delete fHistProtonEtAcc; /** Et of identified protons in calorimeter acceptance */    
173   delete fHistPionEtAcc; /** Et of identified protons in calorimeter acceptance */    
174   delete fHistChargedKaonEtAcc; /** Et of identified charged kaons in calorimeter acceptance */    
175   delete fHistMuonEtAcc; /** Et of identified muons in calorimeter acceptance */
176   delete fHistElectronEtAcc; /** Et of identified electrons in calorimeter acceptance */
177   delete fHistTMDeltaR; /* Track matching plots; Rec only for now */
178   delete fHistTMDxDz; /* Track matching plots; Rec only for now */
179   //arrays for axes were not dynamically created so don't need to be deleted
180   delete fTree;
181   delete fTreeDeposit;
182   //delete fCentrality;//this code does not actually own AliCentrality so we don't have to worry about deleting it...  we just borrow it...
183   delete fSparseHistTracks;
184   delete fSparseHistClusters;
185   delete fSparseHistEt;
186   delete [] fSparseTracks;
187   delete [] fSparseClusters;
188   delete [] fSparseEt;
189 }
190
191 void AliAnalysisEt::FillOutputList(TList *list)
192 { // histograms to be added to output
193     list->Add(fHistEt);
194     list->Add(fHistChargedEt);
195     list->Add(fHistNeutralEt);
196
197     list->Add(fHistEtAcc);
198     list->Add(fHistChargedEtAcc);
199     list->Add(fHistNeutralEtAcc);
200
201     list->Add(fHistMult);
202     list->Add(fHistChargedMult);
203     list->Add(fHistNeutralMult);
204
205     list->Add(fHistPhivsPtPos);
206     list->Add(fHistPhivsPtNeg);
207
208     list->Add(fHistBaryonEt);
209     list->Add(fHistAntiBaryonEt);
210     list->Add(fHistMesonEt);
211
212     list->Add(fHistProtonEt);
213     list->Add(fHistPionEt);
214     list->Add(fHistChargedKaonEt);
215     list->Add(fHistMuonEt);
216     list->Add(fHistElectronEt);
217     
218     list->Add(fHistNeutronEt);
219     list->Add(fHistAntiNeutronEt);
220     list->Add(fHistGammaEt);
221     
222     list->Add(fHistProtonEtAcc);
223     list->Add(fHistPionEtAcc);
224     list->Add(fHistChargedKaonEtAcc);
225     list->Add(fHistMuonEtAcc);
226     list->Add(fHistElectronEtAcc);
227
228     list->Add(fHistTMDeltaR);
229     list->Add(fHistTMDxDz);
230         
231     if (fCuts) {
232       if (fCuts->GetHistMakeTree()) {
233         list->Add(fTree);
234       }
235       if (fCuts->GetHistMakeTreeDeposit()) {
236         list->Add(fTreeDeposit);
237       }
238     }
239     
240    list->Add(fSparseHistTracks);
241    list->Add(fSparseHistClusters);
242    list->Add(fSparseHistEt);
243     
244
245 }
246
247 void AliAnalysisEt::Init()
248 {// clear variables, set up cuts and PDG info
249   AliAnalysisEtCommon::Init();
250   ResetEventValues();
251 }
252
253 void AliAnalysisEt::CreateHistograms()
254 { // create histograms..
255   // histogram binning for E_T, p_T and Multiplicity: defaults for p+p
256   Int_t nbinsEt = 10000;
257   Double_t minEt = 0.0;
258   Double_t maxEt = 1000;
259   Int_t nbinsPt = 200;
260   Double_t minPt = 0;
261   Double_t maxPt = 20;
262   Int_t nbinsMult = 200;
263   Double_t minMult = -0.5; // offset -0.5 to have integer bins centered around 0
264   Double_t maxMult = nbinsMult + minMult; // 1 bin per integer value
265
266   // see if we should change histogram limits etc, and possibly create a tree
267   if (fCuts) {
268     if (fCuts->GetHistMakeTree()) {
269       CreateTrees();
270     }
271
272     nbinsMult = fCuts->GetHistNbinsMult();
273     minMult = fCuts->GetHistMinMult();
274     maxMult = fCuts->GetHistMaxMult();
275
276     nbinsEt = fCuts->GetHistNbinsTotEt();
277     minEt = fCuts->GetHistMinTotEt();
278     maxEt = fCuts->GetHistMaxTotEt();
279
280     nbinsPt = fCuts->GetHistNbinsParticlePt();
281     minPt = fCuts->GetHistMinParticlePt();
282     maxPt = fCuts->GetHistMaxParticlePt();
283   }
284
285     TString histname = "fHistEt" + fHistogramNameSuffix;
286     fHistEt = new TH1F(histname.Data(), "Total E_{T} Distribution", nbinsEt, minEt, maxEt);
287     fHistEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
288     fHistEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
289
290     histname = "fHistChargedEt" + fHistogramNameSuffix;
291     fHistChargedEt = new TH1F(histname.Data(), "Total Charged E_{T} Distribution", nbinsEt, minEt, maxEt);
292     fHistChargedEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
293     fHistChargedEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
294
295     histname = "fHistNeutralEt" + fHistogramNameSuffix;
296     fHistNeutralEt = new TH1F(histname.Data(), "Total Neutral E_{T} Distribution", nbinsEt, minEt, maxEt);
297     fHistNeutralEt->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
298     fHistNeutralEt->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
299
300     histname = "fHistEtAcc" + fHistogramNameSuffix;
301     fHistEtAcc = new TH1F(histname.Data(), "Total E_{T} Distribution in Acceptance", nbinsEt, minEt, maxEt);
302     fHistEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
303     fHistEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
304
305     histname = "fHistChargedEtAcc" + fHistogramNameSuffix;
306     fHistChargedEtAcc = new TH1F(histname.Data(), "Total Charged E_{T} Distribution in Acceptance", nbinsEt, minEt, maxEt);
307     fHistChargedEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
308     fHistChargedEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
309
310     histname = "fHistNeutralEtAcc" + fHistogramNameSuffix;
311     fHistNeutralEtAcc = new TH1F(histname.Data(), "Total Neutral E_{T} Distribution in Acceptance", nbinsEt, minEt, maxEt);
312     fHistNeutralEtAcc->GetXaxis()->SetTitle("E_{T} (GeV/c^{2})");
313     fHistNeutralEtAcc->GetYaxis()->SetTitle("dN/dE_{T} (c^{2}/GeV)");
314     std::cout << histname << std::endl;
315
316         histname = "fHistMult" + fHistogramNameSuffix;
317     fHistMult = new TH1F(histname.Data(), "Total Multiplicity", nbinsMult, minMult, maxMult);
318     fHistMult->GetXaxis()->SetTitle("N");
319     fHistMult->GetYaxis()->SetTitle("Multiplicity");
320
321     histname = "fHistChargedMult" + fHistogramNameSuffix;
322     fHistChargedMult = new TH1F(histname.Data(), "Charged Multiplicity", nbinsMult, minMult, maxMult);
323     fHistChargedMult->GetXaxis()->SetTitle("N");
324     fHistChargedMult->GetYaxis()->SetTitle("Multiplicity");
325
326     histname = "fHistNeutralMult" + fHistogramNameSuffix;
327     fHistNeutralMult = new TH1F(histname.Data(), "Neutral Multiplicity", nbinsMult, minMult, maxMult);
328     fHistNeutralMult->GetXaxis()->SetTitle("N");
329     fHistNeutralMult->GetYaxis()->SetTitle("Multiplicity");
330
331     histname = "fHistPhivsPtPos" + fHistogramNameSuffix;
332     fHistPhivsPtPos = new TH2F(histname.Data(), "Phi vs pT of positively charged tracks hitting the calorimeter",       200, 0, 2*TMath::Pi(), nbinsPt, minPt, maxPt);
333
334     histname = "fHistPhivsPtNeg" + fHistogramNameSuffix;
335     fHistPhivsPtNeg = new TH2F(histname.Data(), "Phi vs pT of negatively charged tracks hitting the calorimeter",       200, 0, 2*TMath::Pi(), nbinsPt, minPt, maxPt);
336
337     histname = "fHistBaryonEt" + fHistogramNameSuffix;
338     fHistBaryonEt = new TH1F(histname.Data(), "E_{T} for baryons",  nbinsEt, minEt, maxEt);
339
340     histname = "fHistAntiBaryonEt" + fHistogramNameSuffix;
341     fHistAntiBaryonEt = new TH1F(histname.Data(), "E_{T} for anti baryons",  nbinsEt, minEt, maxEt);
342
343     histname = "fHistMesonEt" + fHistogramNameSuffix;
344     fHistMesonEt = new TH1F(histname.Data(), "E_{T} for mesons",  nbinsEt, minEt, maxEt);
345
346     histname = "fHistProtonEt" + fHistogramNameSuffix;
347     fHistProtonEt = new TH1F(histname.Data(), "E_{T} for (anti-)protons", nbinsEt, minEt, maxEt);
348
349     histname = "fHistPionEt" + fHistogramNameSuffix;
350     fHistPionEt = new TH1F(histname.Data(), "E_{T} for #pi^+/#pi^-", nbinsEt, minEt, maxEt);
351
352     histname = "fHistKaonEt" + fHistogramNameSuffix;
353     fHistChargedKaonEt = new TH1F(histname.Data(), "E_{T} for charged kaons", nbinsEt, minEt, maxEt);
354
355     histname = "fHistMuonEt" + fHistogramNameSuffix;
356     fHistMuonEt = new TH1F(histname.Data(), "E_{T} for muons", nbinsEt, minEt, maxEt);
357
358     histname = "fHistElectronEt" + fHistogramNameSuffix;
359     fHistElectronEt = new TH1F(histname.Data(), "E_{T} for electrons/positrons", nbinsEt, minEt, maxEt);
360
361     histname = "fHistNeutronEt" + fHistogramNameSuffix;
362     fHistNeutronEt = new TH1F(histname.Data(), "E_{T} for neutrons", nbinsEt, minEt, maxEt);
363
364     histname = "fHistAntiNeutronEt" + fHistogramNameSuffix;
365     fHistAntiNeutronEt = new TH1F(histname.Data(), "E_{T} for anti-neutrons", nbinsEt, minEt, maxEt);
366
367     histname = "fHistGammaEt" + fHistogramNameSuffix;
368     fHistGammaEt = new TH1F(histname.Data(), "E_{T} for gammas", nbinsEt, minEt, maxEt);
369
370     histname = "fHistProtonEtAcc" + fHistogramNameSuffix;
371     fHistProtonEtAcc = new TH1F(histname.Data(), "E_{T} for (anti-)protons in calorimeter acceptance", nbinsEt, minEt, maxEt);
372
373     histname = "fHistPionEtAcc" + fHistogramNameSuffix;
374     fHistPionEtAcc = new TH1F(histname.Data(), "E_{T} for #pi^+/#pi^- in calorimeter acceptance", nbinsEt, minEt, maxEt);
375
376     histname = "fHistKaonEtAcc" + fHistogramNameSuffix;
377     fHistChargedKaonEtAcc = new TH1F(histname.Data(), "E_{T} for charged kaons in calorimeter acceptance", nbinsEt, minEt, maxEt);
378
379     histname = "fHistMuonEtAcc" + fHistogramNameSuffix;
380     fHistMuonEtAcc = new TH1F(histname.Data(), "E_{T} for muons in calorimeter acceptance", nbinsEt, minEt, maxEt);
381
382     histname = "fHistElectronEtAcc" + fHistogramNameSuffix;
383     fHistElectronEtAcc = new TH1F(histname.Data(), "E_{T} for electrons/positrons in calorimeter acceptance", nbinsEt, minEt, maxEt);
384
385     //
386     histname = "fHistTMDeltaR" + fHistogramNameSuffix;
387     fHistTMDeltaR = new TH1F(histname.Data(), "#Delta R for calorimeter clusters", 200, 0, 50);
388     
389     histname = "fHistTMDxDz" + fHistogramNameSuffix;
390     fHistTMDxDz = new TH2F(histname.Data(), "#Delta x vs #Delta z for calorimeter clusters", 800, -200, 200, 800, -200, 200);
391     
392     histname = "fSparseHistTracks" + fHistogramNameSuffix;
393     const Int_t stsize = 7;
394     Int_t binsHist[stsize]   = {  1001,    7, 200000, 10000, 10000, 100,   11};
395     Double_t minHist[stsize] = {-500.5, -3.5,    0.0,   0.0,   0.0, -1.5, -0.5};
396     Double_t maxHist[stsize] = { 499.5,  3.5,  200.0, 100.0, 100.0,  1.5, 10.5};
397     fSparseTracks = new Double_t[stsize];
398     fSparseHistTracks = new THnSparseD(histname.Data(), "pid:charge:mass:et:pt:rap:cent", stsize, binsHist, minHist, maxHist);
399     
400     fSparseHistTracks->GetAxis(0)->SetTitle("pid");
401     fSparseHistTracks->GetAxis(1)->SetTitle("charge");
402     fSparseHistTracks->GetAxis(2)->SetTitle("mass");
403     fSparseHistTracks->GetAxis(3)->SetTitle("et");
404     fSparseHistTracks->GetAxis(4)->SetTitle("pt");
405     fSparseHistTracks->GetAxis(5)->SetTitle("rap");
406     fSparseHistTracks->GetAxis(6)->SetTitle("cent");
407
408     histname = "fSparseHistClusters" + fHistogramNameSuffix;
409     const Int_t scsize = 11;
410     //                            pid     ch    mass     et     pt   eta   et_t   pt_t  eta_t  cent   dist
411     Int_t scbinsHist[scsize]   = {  1001,    7, 200000, 10000, 10000,  100, 10000, 10000,  100,   11,   4000};
412     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};
413     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};
414     fSparseClusters = new Double_t[scsize];
415     fSparseHistClusters = new THnSparseD(histname.Data(), "pid:charge:mass:et:pt:rap:et_track:pt_track:eta_track:cent:dist_matched", scsize, scbinsHist, scminHist, scmaxHist);
416     
417     fSparseHistClusters->GetAxis(0)->SetTitle("pid");
418     fSparseHistClusters->GetAxis(1)->SetTitle("charge");
419     fSparseHistClusters->GetAxis(2)->SetTitle("mass");
420     fSparseHistClusters->GetAxis(3)->SetTitle("et");
421     fSparseHistClusters->GetAxis(4)->SetTitle("pt");
422     fSparseHistClusters->GetAxis(5)->SetTitle("rap");
423     fSparseHistClusters->GetAxis(6)->SetTitle("et_track");
424     fSparseHistClusters->GetAxis(7)->SetTitle("pt_track");
425     fSparseHistClusters->GetAxis(8)->SetTitle("rap_track");
426     fSparseHistClusters->GetAxis(9)->SetTitle("cent");
427     fSparseHistClusters->GetAxis(10)->SetTitle("dist_matched");
428
429     histname = "fSparseHistEt" + fHistogramNameSuffix;
430     const Int_t etsize = 7;
431     Int_t etbinsHist[etsize]   = { 10000, 10000,  10000,   3000,   500,   30000,   11};
432     Double_t etminHist[etsize] = {   0.0,   0.0,    0.0,   -0.5,  -0.5,    -0.5, -0.5};
433     Double_t etmaxHist[etsize] = { 200.0, 200.0,  200.0, 2999.5, 499.5,  2999.5, 10.5};
434     fSparseEt = new Double_t[etsize];
435     fSparseHistEt = new THnSparseD(histname.Data(), "tot_et:neutral_et:charged_et:tot_mult:neutral_mult:charged_mult:cent", etsize, etbinsHist, etminHist, etmaxHist);
436     
437     fSparseHistEt->GetAxis(0)->SetTitle("tot_et");
438     fSparseHistEt->GetAxis(1)->SetTitle("neutral_et");
439     fSparseHistEt->GetAxis(2)->SetTitle("charged_et");
440     fSparseHistEt->GetAxis(3)->SetTitle("tot_mult");
441     fSparseHistEt->GetAxis(4)->SetTitle("netral_mult");
442     fSparseHistEt->GetAxis(5)->SetTitle("charged_mult");
443     fSparseHistEt->GetAxis(6)->SetTitle("cent");
444   
445 }
446
447 TH2F* AliAnalysisEt::CreateEtaEHisto2D(TString name, TString title, TString ztitle)
448 {     //creates a 2-d histogram in eta and E and adds it to the list of histograms to be saved
449         TString histoname   = name + fHistogramNameSuffix;
450         
451         TH2F *histo = new TH2F(histoname.Data(),title.Data(),fgNumOfEBins, fgEAxis, fgnumOfEtaBins, fgEtaAxis);
452         histo->SetYTitle("#eta");
453         histo->SetXTitle("E (GeV)");
454         histo->SetZTitle(ztitle.Data());
455         histo->Sumw2();
456         
457         return histo; 
458 }
459
460
461 TH2F* AliAnalysisEt::CreateEtaPtHisto2D(TString name, TString title, TString ztitle)
462 {     //creates a 2-d histogram in eta and phi and adds it to the list of histograms to be saved
463         TString histoname   = name + fHistogramNameSuffix;
464         
465         TH2F *histo = new TH2F(histoname.Data(),title.Data(),fgNumOfPtBins, fgPtAxis, fgnumOfEtaBins, fgEtaAxis);
466         histo->SetYTitle("#eta");
467         histo->SetXTitle("p_{T}");
468         histo->SetZTitle(ztitle.Data());
469         histo->Sumw2();
470         
471         return histo; 
472 }
473
474 TH2F* AliAnalysisEt::CreateEtaEtHisto2D(TString name, TString title, TString ztitle)
475 {     //creates a 2-d histogram in eta and phi and adds it to the list of histograms to be saved
476         TString histoname   = name + fHistogramNameSuffix;
477         
478         TH2F *histo = new TH2F(histoname.Data(),title.Data(),fgNumOfEBins, fgEAxis, fgnumOfEtaBins, fgEtaAxis);
479         histo->SetYTitle("#eta");
480         histo->SetXTitle("E_{T}");
481         histo->SetZTitle(ztitle.Data());
482         histo->Sumw2();
483         
484         return histo; 
485 }
486
487 TH2F* AliAnalysisEt::CreateResEHisto2D(TString name, TString title, TString ztitle)
488 {     //creates a 2-d histogram in eta and E and adds it to the list of histograms to be saved
489         TString histoname   = name + fHistogramNameSuffix;
490         
491         TH2F *histo = new TH2F(histoname.Data(),title.Data(),fgNumOfEBins, fgEAxis, fgNumOfRBins, fgRAxis);
492         histo->SetYTitle("R");
493         histo->SetXTitle("E (GeV)");
494         histo->SetZTitle(ztitle.Data());
495         histo->Sumw2();
496         
497         return histo; 
498 }
499
500
501 TH2F* AliAnalysisEt::CreateResPtHisto2D(TString name, TString title, TString ztitle)
502 {     //creates a 2-d histogram in eta and phi and adds it to the list of histograms to be saved
503         TString histoname   = name + fHistogramNameSuffix;
504         
505         TH2F *histo = new TH2F(histoname.Data(),title.Data(),fgNumOfPtBins, fgPtAxis, fgNumOfRBins, fgRAxis);
506         histo->SetYTitle("R");
507         histo->SetXTitle("p_{T}");
508         histo->SetZTitle(ztitle.Data());
509         histo->Sumw2();
510         
511         return histo; 
512 }
513
514 THnSparseD* AliAnalysisEt::CreateClusterHistoSparse(TString name, TString title)
515 {     //creates a 2D sparse histogram
516         TString histoname   = name + fHistogramNameSuffix;
517         
518         Int_t nBins[4] = {200,200,240,20};
519         Double_t min[4] = {0.,-1.,70.,0.5};
520         Double_t max[4] = {50.,1.,190,20.5};
521         
522         THnSparseD *histo = new THnSparseD(histoname.Data(),title.Data(),4,nBins,min, max);
523     histo->GetAxis(0)->SetTitle("E");
524     histo->GetAxis(1)->SetTitle("#eta_{cluster}");
525     histo->GetAxis(2)->SetTitle("#phi_{cluster}");
526     histo->GetAxis(3)->SetTitle("n_{cells}");
527         histo->Sumw2();
528         
529         return histo; 
530 }
531
532 THnSparseD* AliAnalysisEt::CreateNeutralPartHistoSparse(TString name, TString title)
533 {     //creates a sparse neutral particle histogram
534         TString histoname   = name + fHistogramNameSuffix;
535         
536         Int_t nBins[6] = {20,200,200,200,240,20};
537         Double_t min[6] = {-1.,0.,0.,-1.,70.,0.5};
538         Double_t max[6] = {1.,50.,50.,1.,190,20.5};
539         
540         THnSparseD *histo = new THnSparseD(histoname.Data(),title.Data(),6,nBins,min, max);
541     histo->GetAxis(0)->SetTitle("#eta");
542     histo->GetAxis(1)->SetTitle("p_{T}");
543     histo->GetAxis(2)->SetTitle("E");
544     histo->GetAxis(3)->SetTitle("#eta_{cluster}");
545     histo->GetAxis(4)->SetTitle("#phi_{cluster}");
546     histo->GetAxis(5)->SetTitle("n_{cells}");
547         histo->Sumw2();
548         
549         return histo; 
550 }
551
552 THnSparseD* AliAnalysisEt::CreateChargedPartHistoSparse(TString name, TString title)
553 {     //creates a sparse charged particle histogram
554         TString histoname   = name + fHistogramNameSuffix;
555         
556         Int_t nBins[7] = {20,200,200,200,240,20,100};
557         Double_t min[7] = {-1.,0.,0.,-1.,70.,0.5,0.};
558         Double_t max[7] = {1.,50.,50.,1.,190,20.5,0.1};
559         
560         THnSparseD *histo = new THnSparseD(histoname.Data(),title.Data(),7,nBins,min, max);
561     histo->GetAxis(0)->SetTitle("#eta");
562     histo->GetAxis(1)->SetTitle("p_{T}");
563     histo->GetAxis(2)->SetTitle("E");
564     histo->GetAxis(3)->SetTitle("#eta_{cluster}");
565     histo->GetAxis(4)->SetTitle("#phi_{cluster}");
566     histo->GetAxis(5)->SetTitle("n_{cells}");
567     histo->GetAxis(6)->SetTitle("R_{match}");
568         histo->Sumw2();
569         
570         return histo; 
571 }
572
573
574 void AliAnalysisEt::CreateTrees()
575 { // create tree..
576   TString treename = "fTree" + fHistogramNameSuffix;
577   if(fCuts->GetHistMakeTree())
578   {
579   
580     fTree = new TTree(treename, treename);
581     fTree->Branch("fTotEt",&fTotEt,"fTotEt/D");
582     fTree->Branch("fTotEtAcc",&fTotEtAcc,"fTotEtAcc/D");
583     fTree->Branch("fTotNeutralEt",&fTotNeutralEt,"fTotNeutralEt/D");
584     fTree->Branch("fTotNeutralEtAcc",&fTotNeutralEtAcc,"fTotNeutralEtAcc/D");
585     fTree->Branch("fTotChargedEt",&fTotChargedEt,"fTotChargedEt/D");
586     fTree->Branch("fTotChargedEtAcc",&fTotChargedEtAcc,"fTotChargedEtAcc/D");
587     fTree->Branch("fMultiplicity",&fMultiplicity,"fMultiplicity/I");
588     fTree->Branch("fChargedMultiplicity",&fChargedMultiplicity,"fChargedMultiplicity/I");
589     fTree->Branch("fNeutralMultiplicity",&fNeutralMultiplicity,"fNeutralMultiplicity/I");
590     fTree->Branch("fCentClass",&fCentClass,"fCentClass/I");
591     
592     fTree->Branch("fBaryonEt",&fBaryonEt,"fBaryonEt/D");
593     fTree->Branch("fAntiBaryonEt",&fAntiBaryonEt,"fAntiBaryonEt/D");
594     fTree->Branch("fMesonEt",&fMesonEt,"fMesonEt/D");
595     fTree->Branch("fProtonEt",&fProtonEt,"fProtonEt/D");
596     fTree->Branch("fChargedKaonEt",&fChargedKaonEt,"fChargedKaonEt/D");
597     fTree->Branch("fMuonEt",&fMuonEt,"fMuonEt/D");
598     fTree->Branch("fElectronEt",&fElectronEt,"fElectronEt/D");
599     fTree->Branch("fProtonEtAcc",&fProtonEtAcc,"fProtonEtAcc/D");
600     fTree->Branch("fChargedKaonEtAcc",&fChargedKaonEtAcc,"fChargedKaonEtAcc/D");
601     fTree->Branch("fMuonEtAcc",&fMuonEtAcc,"fMuonEtAcc/D");
602     fTree->Branch("fElectronEtAcc",&fElectronEtAcc,"fElectronEtAcc/D");
603   }
604   
605   if(fCuts->GetHistMakeTreeDeposit())
606   {
607     treename = "fTreeDeposit" + fHistogramNameSuffix;
608     fTreeDeposit = new TTree(treename, treename);
609   
610     fTreeDeposit->Branch("fEnergyDeposited", &fEnergyDeposited, "fEnergyDeposited/F");
611     fTreeDeposit->Branch("fEnergyTPC", &fEnergyTPC, "fEnergyTPC/F");
612     fTreeDeposit->Branch("fCharge", &fCharge, "fCharge/S");
613     fTreeDeposit->Branch("fParticlePid", &fParticlePid, "fParticlePid/S");
614     fTreeDeposit->Branch("fPidProb", &fPidProb, "fPidProb/F");
615     fTreeDeposit->Branch("fTrackPassedCut", &fTrackPassedCut, "fTrackPassedCut/B");
616  
617   }
618
619   return;
620 }
621 void AliAnalysisEt::FillHistograms()
622 { // fill histograms..
623     fHistEt->Fill(fTotEt);
624     fHistChargedEt->Fill(fTotChargedEt);
625     fHistNeutralEt->Fill(fTotNeutralEt);
626
627     fHistEtAcc->Fill(fTotEtAcc);
628     fHistChargedEtAcc->Fill(fTotChargedEtAcc);
629     fHistNeutralEtAcc->Fill(fTotNeutralEtAcc);
630
631     fHistMult->Fill(fMultiplicity);
632     fHistChargedMult->Fill(fChargedMultiplicity);
633     fHistNeutralMult->Fill(fNeutralMultiplicity);
634
635     fHistBaryonEt->Fill(fBaryonEt);
636     fHistAntiBaryonEt->Fill(fAntiBaryonEt);
637     fHistMesonEt->Fill(fMesonEt);
638
639     fHistProtonEt->Fill(fProtonEt);
640     fHistPionEt->Fill(fPionEt);
641     fHistChargedKaonEt->Fill(fChargedKaonEt);
642     fHistMuonEt->Fill(fMuonEt);
643     fHistElectronEt->Fill(fElectronEt);
644     fHistNeutronEt->Fill(fNeutronEt);
645     fHistAntiNeutronEt->Fill(fAntiNeutronEt);
646     fHistGammaEt->Fill(fGammaEt);
647     
648     fHistProtonEtAcc->Fill(fProtonEtAcc);
649     fHistPionEtAcc->Fill(fPionEtAcc);
650     fHistChargedKaonEtAcc->Fill(fChargedKaonEtAcc);
651     fHistMuonEtAcc->Fill(fMuonEtAcc);
652     fHistElectronEtAcc->Fill(fElectronEtAcc);
653
654     if (fCuts) {
655       if (fCuts->GetHistMakeTree()) {
656         fTree->Fill();
657       }
658     }
659     
660     fSparseHistEt->Fill(fSparseEt);
661 }
662
663 Int_t AliAnalysisEt::AnalyseEvent(AliVEvent *event)
664 { //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.
665   AliAnalysisEtCommon::AnalyseEvent(event);
666   ResetEventValues();
667   return 0;
668 }
669
670 void AliAnalysisEt::ResetEventValues()
671 { // clear
672   AliAnalysisEtCommon::ResetEventValues();
673   fTotEt = 0;
674   fTotEtAcc = 0;
675   fTotNeutralEt = 0;
676   fTotNeutralEtAcc = 0;
677   fTotChargedEt  = 0;
678   fTotChargedEtAcc = 0;
679   fMultiplicity = 0;
680   fChargedMultiplicity = 0;
681   fNeutralMultiplicity = 0;
682   fBaryonEt = 0;
683   fAntiBaryonEt = 0;
684   fMesonEt = 0;
685   fProtonEt = 0;
686   fPionEt = 0;
687   fChargedKaonEt = 0;
688   fMuonEt = 0;
689   fElectronEt = 0;
690   fNeutronEt = 0;
691   fAntiNeutronEt = 0;
692   fGammaEt = 0;
693   fProtonEtAcc = 0;
694   fPionEtAcc = 0;
695   fChargedKaonEtAcc = 0;
696   fMuonEtAcc = 0;
697   fElectronEtAcc = 0;
698   return;
699 }
700
701 Double_t AliAnalysisEt::CalculateTransverseEnergy(AliESDCaloCluster* cluster)
702 { // based on cluster energy and cluster pos
703   
704   Float_t pos[3];
705   cluster->GetPosition(pos);
706   TVector3 cp(pos);
707   
708   return cluster->E() * TMath::Sin(cp.Theta());
709
710 }