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