]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/totEt/AliAnalysisEtReconstructed.cxx
fixing a bug in the track matching logic
[u/mrichter/AliRoot.git] / PWGLF / totEt / AliAnalysisEtReconstructed.cxx
1 //_________________________________________________________________________
2 //  Utility Class for transverse energy studies
3 //  Base class for ESD analysis
4 //  - reconstruction output
5 //  implementation file
6 //
7 //*-- Authors: Oystein Djuvsland (Bergen), David Silvermyr (ORNL)
8 //_________________________________________________________________________
9
10 #include "AliAnalysisEtReconstructed.h"
11 #include "AliAnalysisEtCuts.h"
12 #include "AliESDtrack.h"
13 #include "AliEMCALTrack.h"
14 #include "AliESDCaloCluster.h"
15 #include "TVector3.h"
16 #include "TGeoGlobalMagField.h"
17 #include "AliMagF.h"
18 #include "AliVEvent.h"
19 #include "AliESDEvent.h"
20 #include "AliESDtrackCuts.h"
21 #include "AliVParticle.h"
22 #include "TDatabasePDG.h"
23 #include "TList.h"
24 #include "AliESDpid.h"
25 #include <iostream>
26 #include "TH3F.h"
27 #include "TH2F.h"
28 #include "TH2I.h"
29 #include "TH1I.h"
30 #include "TFile.h"
31 #include "AliAnalysisHadEtCorrections.h"
32 #include "AliAnalysisEtSelector.h"
33 #include "AliLog.h"
34 #include "AliCentrality.h"
35 #include "AliPHOSGeoUtils.h"
36 #include "AliPHOSGeometry.h"
37 #include "AliAnalysisEtRecEffCorrection.h"
38
39
40 using namespace std;
41
42 ClassImp(AliAnalysisEtReconstructed);
43
44
45 AliAnalysisEtReconstructed::AliAnalysisEtReconstructed() :
46         AliAnalysisEt()
47         ,fCorrections(0)
48         ,fPidCut(0)
49         ,fHistChargedPionEnergyDeposit(0)
50         ,fHistProtonEnergyDeposit(0)
51         ,fHistAntiProtonEnergyDeposit(0)
52         ,fHistChargedKaonEnergyDeposit(0)
53         ,fHistMuonEnergyDeposit(0)
54         ,fHistRemovedEnergy(0)
55         ,fGeomCorrection(1.0)
56         ,fEMinCorrection(1.0/0.687)
57         ,fRecEffCorrection(1.0)
58         ,fClusterPosition(0)
59         ,fClusterEnergy(0)
60         ,fClusterEt(0)
61         ,fHistChargedEnergyRemoved(0)
62         ,fHistNeutralEnergyRemoved(0)
63         ,fHistGammaEnergyAdded(0)
64         ,fHistMatchedTracksEvspTvsCent(0)
65         ,fHistMatchedTracksEvspTvsCentEffCorr(0)
66         ,fHistFoundHadronsvsCent(0)
67         ,fHistNotFoundHadronsvsCent(0)
68         ,fHistFoundHadronsEtvsCent(0)
69         ,fHistNotFoundHadronsEtvsCent(0)
70         ,fHistNominalRawEt(0)
71         ,fHistNominalNonLinHighEt(0)
72         ,fHistNominalNonLinLowEt(0)
73         ,fHistNominalEffHighEt(0)
74         ,fHistNominalEffLowEt(0)
75 {
76
77 }
78
79 AliAnalysisEtReconstructed::~AliAnalysisEtReconstructed()
80 {//destructor
81     delete fCorrections;
82     delete fHistChargedPionEnergyDeposit; /** Energy deposited in calorimeter by charged pions */
83     delete fHistProtonEnergyDeposit; /** Energy deposited in calorimeter by protons */
84     delete fHistAntiProtonEnergyDeposit; /** Energy deposited in calorimeter by anti-protons */
85     delete fHistChargedKaonEnergyDeposit; /** Energy deposited in calorimeter by charged kaons */
86     delete fHistMuonEnergyDeposit; /** Energy deposited in calorimeter by muons */
87
88     delete fHistRemovedEnergy; // removed energy
89     delete fClusterPosition;
90     delete fClusterEnergy;
91     delete fClusterEt;
92     delete fHistChargedEnergyRemoved;
93     delete fHistNeutralEnergyRemoved;
94     delete fHistGammaEnergyAdded;
95     delete fHistMatchedTracksEvspTvsCent;
96     delete fHistMatchedTracksEvspTvsCentEffCorr;
97     delete fHistFoundHadronsvsCent;
98     delete fHistNotFoundHadronsvsCent;
99     delete fHistFoundHadronsEtvsCent;
100     delete fHistNotFoundHadronsEtvsCent;
101     delete fHistNominalRawEt;
102     delete fHistNominalNonLinHighEt;
103     delete fHistNominalNonLinLowEt;
104     delete fHistNominalEffHighEt;
105     delete fHistNominalEffLowEt;
106 }
107
108 Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
109 {
110
111     //AliAnalysisEt::AnalyseEvent(ev);
112     // analyse ESD event
113     ResetEventValues();
114     if (!ev) {
115         AliFatal("ERROR: Event does not exist");
116         return 0;
117     }
118
119     AliESDEvent *event = dynamic_cast<AliESDEvent*>(ev);
120     if (!event) {
121         AliFatal("ERROR: ESD Event does not exist");
122         return 0;
123     }
124     if(!fSelector){
125         AliFatal("ERROR: fSelector does not exist");
126         return 0;
127     }
128     fSelector->SetEvent(event);
129     
130     Int_t cent = -1;
131     fCentrality = event->GetCentrality();
132     if (fCentrality && cent)
133     {
134         cent = fCentrality->GetCentralityClass5("V0M");
135         fCentClass = fCentrality->GetCentralityClass5("V0M");
136     }
137
138     TRefArray *caloClusters = fSelector->GetClusters();
139     Float_t fClusterMult = caloClusters->GetEntries();
140
141     Float_t nominalRawEt = 0;
142     Float_t nonlinHighRawEt = 0;
143     Float_t nonlinLowRawEt = 0;
144     Float_t effHighRawEt = 0;
145     Float_t effLowRawEt = 0;
146
147     Float_t nChargedHadronsMeasured = 0.0;
148     Float_t nChargedHadronsTotal = 0.0;
149     Float_t nChargedHadronsEtMeasured = 0.0;
150     Float_t nChargedHadronsEtTotal = 0.0;
151
152
153     for (Int_t iCluster = 0; iCluster < event->GetNumberOfCaloClusters(); iCluster++)
154     {
155         AliESDCaloCluster* cluster = event->GetCaloCluster(iCluster);
156         if (!cluster)
157         {
158             AliError(Form("ERROR: Could not get cluster %d", iCluster));
159             continue;
160         }
161         int x = 0;
162         fCutFlow->Fill(x++);
163         if(!fSelector->IsDetectorCluster(*cluster)) continue;
164         fCutFlow->Fill(x++);
165         if(!fSelector->PassMinEnergyCut(*cluster)) continue;
166         fCutFlow->Fill(x++);
167         if (!fSelector->PassDistanceToBadChannelCut(*cluster)) continue;
168         fCutFlow->Fill(x++);
169
170         Float_t pos[3];
171
172         cluster->GetPosition(pos);
173         TVector3 cp(pos);
174
175         Bool_t matched = kTRUE;//default to no track matched
176         Int_t trackMatchedIndex = cluster->GetTrackMatchedIndex();//find the index of the matched track
177         matched = !(fSelector->PassTrackMatchingCut(*cluster));//PassTrackMatchingCut is false if there is a matched track
178         if(matched){//if the track match is good (, is the track good?
179           if(trackMatchedIndex < 0) matched=kFALSE;//If the index is bad, don't count it
180           if(matched){
181             AliESDtrack *track = event->GetTrack(trackMatchedIndex);
182             //if this is a good track, accept track will return true.  The track matched is good, so not track matched is false
183             matched = fEsdtrackCutsTPC->AcceptTrack(track);//If the track is bad, don't count it
184           }
185         }
186
187
188         if (matched)
189         {
190           
191             if (cluster->GetNTracksMatched() > 0 && trackMatchedIndex>=0)
192             {
193                 AliVTrack *track = event->GetTrack(trackMatchedIndex);
194                 if (!track) {
195                     AliError("Error: track does not exist");
196                 }
197                 else {
198                   float eff = fTmCorrections->TrackMatchingEfficiency(track->Pt(),fClusterMult);
199                   if(TMath::Abs(eff)<1e-5) eff = 1.0;
200                   //cout<<"pt "<<track->Pt()<<" eff "<<eff<<endl;
201                   nChargedHadronsMeasured++;
202                   nChargedHadronsTotal += 1/eff;
203                   Double_t effCorrEt = CorrectForReconstructionEfficiency(*cluster,fClusterMult);
204                   nChargedHadronsEtMeasured+= TMath::Sin(cp.Theta())*effCorrEt;
205                   nChargedHadronsEtTotal+= 1/eff *effCorrEt;
206                   fHistMatchedTracksEvspTvsCent->Fill(track->P(),TMath::Sin(cp.Theta())*cluster->E(),cent);
207                   fHistMatchedTracksEvspTvsCentEffCorr->Fill(track->P(),CorrectForReconstructionEfficiency(*cluster,fClusterMult),cent);
208                     const Double_t *pidWeights = track->PID();
209
210                     Double_t maxpidweight = 0;
211                     Int_t maxpid = 0;
212
213                     if (pidWeights)
214                     {
215                         for (Int_t p =0; p < AliPID::kSPECIES; p++)
216                         {
217                             if (pidWeights[p] > maxpidweight)
218                             {
219                                 maxpidweight = pidWeights[p];
220                                 maxpid = p;
221                             }
222                         }
223                         if (fCuts->GetHistMakeTreeDeposit() && fDepositTree)
224                         {
225                             fEnergyDeposited = cluster->E();
226                             fMomentumTPC = track->P();
227                             fCharge = track->Charge();
228                             fParticlePid = maxpid;
229                             fPidProb = maxpidweight;
230                             AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track);
231                             if (!esdTrack) {
232                                 AliError("Error: track does not exist");
233                             }
234                             else {
235                                 if (esdTrack) fTrackPassedCut = fEsdtrackCutsTPC->AcceptTrack(esdTrack);
236                                 fDepositTree->Fill();
237                             }
238                         }
239
240                         if (maxpidweight > fPidCut)
241                         {
242                             //Float_t dist = TMath::Sqrt(pos[0]*pos[0] + pos[1]*pos[1]);
243
244                             //Float_t theta = TMath::ATan(pos[2]/dist)+TMath::Pi()/2;
245
246                             //Float_t et = cluster->E() * TMath::Sin(theta);
247                             if (maxpid == AliPID::kProton)
248                             {
249
250                                 if (track->Charge() == 1)
251                                 {
252                                     fHistProtonEnergyDeposit->Fill(cluster->E(), track->E());
253                                 }
254                                 else if (track->Charge() == -1)
255                                 {
256                                     fHistAntiProtonEnergyDeposit->Fill(cluster->E(), track->E());
257                                 }
258                             }
259                             else if (maxpid == AliPID::kPion)
260                             {
261                                 fHistChargedPionEnergyDeposit->Fill(cluster->E(), track->E());
262                             }
263                             else if (maxpid == AliPID::kKaon)
264                             {
265                                 fHistChargedKaonEnergyDeposit->Fill(cluster->E(), track->E());
266                             }
267                             else if (maxpid == AliPID::kMuon)
268                             {
269                                 fHistMuonEnergyDeposit->Fill(cluster->E(), track->E());
270                             }
271                         }
272                     }
273                 }
274             }
275             //continue;
276         } // distance
277         else{//these are clusters which were not track matched
278           fCutFlow->Fill(x++);
279           //std::cout << x++ << std::endl;
280           
281           //if (cluster->E() >  fSingleCellEnergyCut && cluster->GetNCells() == fCuts->GetCommonSingleCell()) continue;
282           //if (cluster->E() < fClusterEnergyCut) continue;
283           cluster->GetPosition(pos);
284           
285             TVector3 p2(pos);
286             
287             fClusterPosition->Fill(p2.Phi(), p2.PseudoRapidity());
288             fClusterEnergy->Fill(cluster->E());
289             fClusterEt->Fill(TMath::Sin(p2.Theta())*cluster->E());
290
291             Double_t effCorrEt = CorrectForReconstructionEfficiency(*cluster,fClusterMult);
292             fTotNeutralEt += effCorrEt;
293             nominalRawEt += effCorrEt;
294             nonlinHighRawEt += effCorrEt*GetCorrectionModification(*cluster,1,0,fClusterMult);
295             nonlinLowRawEt += effCorrEt*GetCorrectionModification(*cluster,-1,0,fClusterMult);
296             effHighRawEt += effCorrEt*GetCorrectionModification(*cluster,0,1,fClusterMult);
297             effLowRawEt += effCorrEt*GetCorrectionModification(*cluster,0,-1,fClusterMult);
298             fNeutralMultiplicity++;
299         }
300         fMultiplicity++;
301     }
302     
303     fChargedEnergyRemoved = GetChargedContribution(fNeutralMultiplicity);
304     fNeutralEnergyRemoved = GetNeutralContribution(fNeutralMultiplicity);
305     fHistChargedEnergyRemoved->Fill(fChargedEnergyRemoved, fNeutralMultiplicity);
306     fHistNeutralEnergyRemoved->Fill(fNeutralEnergyRemoved, fNeutralMultiplicity);
307     
308     fGammaEnergyAdded = GetGammaContribution(fNeutralMultiplicity);
309     fHistGammaEnergyAdded->Fill(fGammaEnergyAdded, fNeutralMultiplicity);
310
311     Double_t removedEnergy = GetChargedContribution(fNeutralMultiplicity) + GetNeutralContribution(fNeutralMultiplicity) + GetGammaContribution(fNeutralMultiplicity) + GetSecondaryContribution(fNeutralMultiplicity);
312     fHistRemovedEnergy->Fill(removedEnergy);
313     
314     fTotNeutralEt = fGeomCorrection * fEMinCorrection * (fTotNeutralEt - removedEnergy);
315     fTotEt = fTotChargedEt + fTotNeutralEt;
316 // Fill the histograms...0
317     FillHistograms();
318     //std::cout << "fTotNeutralEt: " << fTotNeutralEt << ", Contribution from non-removed charged: " << GetChargedContribution(fNeutralMultiplicity) << ", neutral: " << GetNeutralContribution(fNeutralMultiplicity) << ", gammas: " << GetGammaContribution(fNeutralMultiplicity) << ", multiplicity: " << fNeutralMultiplicity<< std::endl;
319     //cout<<"cent "<<cent<<" cluster mult "<<fClusterMult<<" fTotNeutralEt "<<fTotNeutralEt<<" nominalRawEt "<<nominalRawEt<<endl;
320     fHistNominalRawEt->Fill(nominalRawEt,cent);
321     fHistNominalNonLinHighEt->Fill(nonlinHighRawEt,cent);
322     fHistNominalNonLinLowEt->Fill(nonlinLowRawEt,cent);
323     fHistNominalEffHighEt->Fill(effHighRawEt,cent);
324     fHistNominalEffLowEt->Fill(effLowRawEt,cent);
325     fHistFoundHadronsvsCent->Fill(nChargedHadronsMeasured,cent);
326     fHistNotFoundHadronsvsCent->Fill(nChargedHadronsTotal-nChargedHadronsMeasured,cent);
327     fHistFoundHadronsEtvsCent->Fill(nChargedHadronsEtMeasured,cent);
328     fHistNotFoundHadronsEtvsCent->Fill(nChargedHadronsEtTotal-nChargedHadronsEtMeasured,cent);
329 //     cout<<"Number of hadrons measured:  "<<nChargedHadronsMeasured<<" Estimated total number of hadrons "<<nChargedHadronsTotal<<" ET in track matched hadrons "<<
330 //       nChargedHadronsEtMeasured;
331 //     if(nChargedHadronsMeasured>0)cout<<" ("<<nChargedHadronsEtMeasured/nChargedHadronsMeasured<<") ";
332 //     cout<<" ET in all hadrons ";
333 //     cout<<nChargedHadronsEtTotal;
334 //     if(nChargedHadronsTotal>0) cout<<" ("<<nChargedHadronsEtTotal/nChargedHadronsTotal<<") ";
335 //     cout<<endl;
336     return 0;
337 }
338
339 bool AliAnalysisEtReconstructed::CheckGoodVertex(AliVParticle* track)
340 { // check vertex
341
342     Float_t bxy = 999.;
343     Float_t bz = 999.;
344     if (!track) {
345         AliError("ERROR: no track");
346         return kFALSE;
347     }
348     AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track);
349     if (!esdTrack) {
350         AliError("ERROR: no track");
351         return kFALSE;
352     }
353     esdTrack->GetImpactParametersTPC(bxy,bz);
354
355
356     bool status = (TMath::Abs(track->Xv()) < fCuts->GetReconstructedVertexXCut()) &&
357                   (TMath::Abs(track->Yv()) < fCuts->GetReconstructedVertexYCut()) &&
358                   (TMath::Abs(track->Zv()) < fCuts->GetReconstructedVertexZCut()) &&
359                   (TMath::Abs(bxy) < fCuts->GetReconstructedIPxyCut()) &&
360                   (TMath::Abs(bz) < fCuts->GetReconstructedIPzCut());
361
362     return status;
363 }
364
365 void AliAnalysisEtReconstructed::Init()
366 { // Init
367     AliAnalysisEt::Init();
368     fPidCut = fCuts->GetReconstructedPidCut();
369     TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
370     if (!fCorrections) {
371         cout<<"Warning!  You have not set corrections.  Your code will crash.  You have to set the corrections."<<endl;
372     }
373 }
374
375 bool AliAnalysisEtReconstructed::TrackHitsCalorimeter(AliVParticle* track, Double_t magField)
376 { // propagate track to detector radius
377     if (!track) {
378         cout<<"Warning: track empty"<<endl;
379         return kFALSE;
380     }
381     AliESDtrack *esdTrack= dynamic_cast<AliESDtrack*>(track);
382     if (!esdTrack) {
383         AliError("ERROR: no ESD track");
384         return kFALSE;
385     }
386     // Printf("Propagating track: eta: %f, phi: %f, pt: %f", esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt());
387
388     Bool_t prop = esdTrack->PropagateTo(fDetectorRadius, magField);
389
390     // if (prop) Printf("Track propagated, eta: %f, phi: %f, pt: %f", esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt());
391     return prop && fSelector->CutGeometricalAcceptance(*esdTrack);
392 }
393
394 void AliAnalysisEtReconstructed::FillOutputList(TList* list)
395 { // add some extra histograms to the ones from base class
396     AliAnalysisEt::FillOutputList(list);
397
398     list->Add(fHistChargedPionEnergyDeposit);
399     list->Add(fHistProtonEnergyDeposit);
400     list->Add(fHistAntiProtonEnergyDeposit);
401     list->Add(fHistChargedKaonEnergyDeposit);
402     list->Add(fHistMuonEnergyDeposit);
403
404     list->Add(fHistRemovedEnergy);
405     list->Add(fClusterPosition);
406     list->Add(fClusterEnergy);
407     list->Add(fClusterEt);
408     
409     list->Add(fHistChargedEnergyRemoved);
410     list->Add(fHistNeutralEnergyRemoved);
411     list->Add(fHistGammaEnergyAdded);
412     list->Add(fHistMatchedTracksEvspTvsCent);
413     list->Add(fHistMatchedTracksEvspTvsCentEffCorr);
414     list->Add(fHistFoundHadronsvsCent);
415     list->Add(fHistNotFoundHadronsvsCent);
416     list->Add(fHistFoundHadronsEtvsCent);
417     list->Add(fHistNotFoundHadronsEtvsCent);
418     list->Add(fHistNominalRawEt);
419     list->Add(fHistNominalNonLinHighEt);
420     list->Add(fHistNominalNonLinLowEt);
421     list->Add(fHistNominalEffHighEt);
422     list->Add(fHistNominalEffLowEt);
423 }
424
425 void AliAnalysisEtReconstructed::CreateHistograms()
426 { // add some extra histograms to the ones from base class
427     AliAnalysisEt::CreateHistograms();
428
429     Int_t nbinsEt = 1000;
430     Double_t minEt = 0;
431     Double_t maxEt = 10;
432
433     // possibly change histogram limits
434 //     if (fCuts) {
435 //         nbinsEt = fCuts->GetHistNbinsParticleEt();
436 //         minEt = fCuts->GetHistMinParticleEt();
437 //         maxEt = fCuts->GetHistMaxParticleEt();
438 //     }
439
440     TString histname;
441     histname = "fHistChargedPionEnergyDeposit" + fHistogramNameSuffix;
442     fHistChargedPionEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by #pi^{+/-}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
443     fHistChargedPionEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
444     fHistChargedPionEnergyDeposit->SetYTitle("Energy of track");
445
446     histname = "fHistProtonEnergyDeposit" + fHistogramNameSuffix;
447     fHistProtonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by protons", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
448     fHistProtonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
449     fHistProtonEnergyDeposit->SetYTitle("Energy of track");
450
451     histname = "fHistAntiProtonEnergyDeposit" + fHistogramNameSuffix;
452     fHistAntiProtonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by anti-protons", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
453     fHistAntiProtonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
454     fHistAntiProtonEnergyDeposit->SetYTitle("Energy of track");
455
456     histname = "fHistChargedKaonEnergyDeposit" + fHistogramNameSuffix;
457     fHistChargedKaonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by K^{+/-}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
458     fHistChargedKaonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
459     fHistChargedKaonEnergyDeposit->SetYTitle("Energy of track");
460
461     histname = "fHistMuonEnergyDeposit" + fHistogramNameSuffix;
462     fHistMuonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by #mu^{+/-}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
463     fHistMuonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
464     fHistMuonEnergyDeposit->SetYTitle("Energy of track");
465
466     histname = "fHistRemovedEnergy" + fHistogramNameSuffix;
467     fHistRemovedEnergy = new TH1F(histname.Data(), histname.Data(), 1000, 0, 20);
468     //fHistMuonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
469     //fHistMuonEnergyDeposit->SetYTitle("Energy of track");
470
471     histname = "fClusterPosition" + fHistogramNameSuffix;
472     fClusterPosition = new TH2D(histname.Data(), "Position of accepted neutral clusters",1000, -2.0, -.5, 1000, -.13 , 0.13);
473     fClusterPosition->SetXTitle("Energy deposited in calorimeter");
474     fClusterPosition->SetYTitle("Energy of track");
475
476     histname = "fClusterEnergy" + fHistogramNameSuffix;
477     fClusterEnergy = new TH1F(histname.Data(), histname.Data(), 100, 0, 5);
478     fClusterEnergy->SetXTitle("Number of clusters");
479     fClusterEnergy->SetYTitle("Energy of cluster");
480
481     histname = "fClusterEt" + fHistogramNameSuffix;
482     fClusterEt = new TH1F(histname.Data(), histname.Data(), 100, 0, 5);
483     fClusterEt->SetXTitle("Number of clusters");
484     fClusterEt->SetYTitle("E_{T} of cluster");
485
486     histname = "fHistChargedEnergyRemoved" + fHistogramNameSuffix;
487     fHistChargedEnergyRemoved = new TH2D(histname.Data(), histname.Data(), 1000, .0, 30, 100, -0.5 , 99.5);
488
489     histname = "fHistNeutralEnergyRemoved" + fHistogramNameSuffix;
490     fHistNeutralEnergyRemoved = new TH2D(histname.Data(), histname.Data(), 1000, .0, 30, 100, -0.5 , 99.5);
491
492     histname = "fHistGammaEnergyAdded" + fHistogramNameSuffix;
493     fHistGammaEnergyAdded = new TH2D(histname.Data(), histname.Data(), 1000, .0, 30, 100, -0.5 , 99.5);
494
495     fHistMatchedTracksEvspTvsCent = new TH3F("fHistMatchedTracksEvspTvsCent", "fHistMatchedTracksEvspTvsCent",100, 0, 3,100,0,3,20,0,20);
496     fHistMatchedTracksEvspTvsCentEffCorr = new TH3F("fHistMatchedTracksEvspTvsCentEffCorr", "fHistMatchedTracksEvspTvsCentEffCorr",100, 0, 3,100,0,3,20,0,20);
497     fHistFoundHadronsvsCent = new TH2F("fHistFoundHadronsvsCent","fHistFoundHadronsvsCent",100,0,100,20,0,20);
498     fHistNotFoundHadronsvsCent = new TH2F("fHistNotFoundHadronsvsCent","fHistNotFoundHadronsvsCent",100,0,200,20,0,20);
499     fHistFoundHadronsEtvsCent = new TH2F("fHistFoundHadronsEtvsCent","fHistFoundHadronsEtvsCent",100,0,200,20,0,20);
500     fHistNotFoundHadronsEtvsCent = new TH2F("fHistNotFoundHadronsEtvsCent","fHistNotFoundHadronsEtvsCent",100,0,300,20,0,20);
501     
502     maxEt = 100;
503     histname = "fHistNominalRawEt" + fHistogramNameSuffix;
504     fHistNominalRawEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
505     histname = "fHistNominalNonLinHighEt" + fHistogramNameSuffix;
506     fHistNominalNonLinHighEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
507     histname = "fHistNominalNonLinLowEt" + fHistogramNameSuffix;
508     fHistNominalNonLinLowEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
509     histname = "fHistNominalEffHighEt" + fHistogramNameSuffix;
510     fHistNominalEffHighEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
511     histname = "fHistNominalEffLowEt" + fHistogramNameSuffix;
512     fHistNominalEffLowEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
513
514 }
515 Double_t AliAnalysisEtReconstructed::ApplyModifiedCorrections(const AliESDCaloCluster& cluster,Int_t nonLinCorr, Int_t effCorr, Int_t mult)
516 {
517   Float_t pos[3];
518   cluster.GetPosition(pos);
519   TVector3 cp(pos);
520   Double_t corrEnergy = fReCorrections->CorrectedEnergy(cluster.E(),mult);
521   
522   Double_t factorNonLin = GetCorrectionModification(cluster, nonLinCorr,effCorr,mult);
523
524   //std::cout << "Original energy: " << cluster.E() << ", corrected energy: " << corrEnergy << std::endl;
525   return TMath::Sin(cp.Theta())*corrEnergy*factorNonLin;
526 }
527
528 Double_t AliAnalysisEtReconstructed::GetCorrectionModification(const AliESDCaloCluster& cluster,Int_t nonLinCorr, Int_t effCorr, Int_t mult){//nonLinCorr 0 = nominal 1 = high -1 = low, effCorr  0 = nominal 1 = high -1 = low
529   if(nonLinCorr==0){
530     cout<<"Warning:  This function should not get called!"<<endl;//this statement is basically here to avoid a compilation warning
531   }
532   if(effCorr==0){
533     cout<<"Warning:  This function should not get called!"<<endl;//this statement is basically here to avoid a compilation warning
534   }
535   return cluster.E()*mult;
536 }