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