1 //_________________________________________________________________________
2 // Utility Class for transverse energy studies
3 // Base class for ESD analysis
4 // - reconstruction output
7 //*-- Authors: Oystein Djuvsland (Bergen), David Silvermyr (ORNL)
8 //_________________________________________________________________________
10 #include "AliAnalysisEtReconstructed.h"
11 #include "AliAnalysisEtCuts.h"
12 #include "AliESDtrack.h"
13 #include "AliEMCALTrack.h"
14 #include "AliESDCaloCluster.h"
16 #include "TGeoGlobalMagField.h"
18 #include "AliVEvent.h"
19 #include "AliESDEvent.h"
20 #include "AliESDtrackCuts.h"
21 #include "AliVParticle.h"
22 #include "TDatabasePDG.h"
24 #include "AliESDpid.h"
31 #include "AliAnalysisHadEtCorrections.h"
32 #include "AliAnalysisEtSelector.h"
34 #include "AliCentrality.h"
35 #include "AliPHOSGeoUtils.h"
36 #include "AliPHOSGeometry.h"
37 #include "AliAnalysisEtRecEffCorrection.h"
38 #include "AliESDpid.h"
43 ClassImp(AliAnalysisEtReconstructed);
46 AliAnalysisEtReconstructed::AliAnalysisEtReconstructed() :
50 ,fHistChargedPionEnergyDeposit(0)
51 ,fHistProtonEnergyDeposit(0)
52 ,fHistAntiProtonEnergyDeposit(0)
53 ,fHistChargedKaonEnergyDeposit(0)
54 ,fHistMuonEnergyDeposit(0)
55 ,fHistRemovedEnergy(0)
57 ,fEMinCorrection(1.0/0.687)
58 ,fRecEffCorrection(1.0)
59 ,fClusterPositionAccepted(0)
60 ,fClusterPositionAll(0)
61 ,fClusterPositionAcceptedEnergy(0)
62 ,fClusterPositionAllEnergy(0)
64 ,fClusterEnergyCent(0)
65 ,fClusterEnergyCentMatched(0)
66 ,fClusterEnergyCentNotMatched(0)
68 ,fHistChargedEnergyRemoved(0)
69 ,fHistNeutralEnergyRemoved(0)
70 ,fHistGammaEnergyAdded(0)
71 ,fHistMatchedTracksEvspTvsCent(0)
72 ,fHistMatchedTracksEvspTvsCentEffCorr(0)
73 ,fHistMatchedTracksEvspTvsCentEffTMCorr(0)
74 ,fHistMatchedTracksEvspTvsCentEffTMCorr500MeV(0)
75 ,fHistFoundHadronsvsCent(0)
76 ,fHistNotFoundHadronsvsCent(0)
77 ,fHistFoundHadronsEtvsCent(0)
78 ,fHistNotFoundHadronsEtvsCent(0)
79 ,fHistFoundHadronsvsCent500MeV(0)
80 ,fHistNotFoundHadronsvsCent500MeV(0)
81 ,fHistFoundHadronsEtvsCent500MeV(0)
82 ,fHistNotFoundHadronsEtvsCent500MeV(0)
84 ,fHistNominalNonLinHighEt(0)
85 ,fHistNominalNonLinLowEt(0)
86 ,fHistNominalEffHighEt(0)
87 ,fHistNominalEffLowEt(0)
88 ,fHistTotRawEtEffCorr(0)
90 ,fHistTotRawEtEffCorr500MeV(0)
92 ,fHistTotAllRawEtEffCorr(0)
93 ,fHistNClustersPhosVsEmcal(0)
94 ,fHistClusterSizeVsCent(0)
95 ,fHistMatchedClusterSizeVsCent(0)
96 ,fHistTotAllRawEtVsTotalPt(0)
97 ,fHistTotAllRawEtVsTotalPtVsCent(0)
98 ,fHistTotMatchedRawEtVsTotalPtVsCent(0)
99 ,fHistPIDProtonsTrackMatchedDepositedVsNch(0)
100 ,fHistPIDAntiProtonsTrackMatchedDepositedVsNch(0)
101 ,fHistPIDProtonsTrackMatchedDepositedVsNcl(0)
102 ,fHistPIDAntiProtonsTrackMatchedDepositedVsNcl(0)
103 ,fHistPiKPTrackMatchedDepositedVsNch(0)
104 ,fHistCentVsNchVsNclReco(0)
109 AliAnalysisEtReconstructed::~AliAnalysisEtReconstructed()
112 delete fHistChargedPionEnergyDeposit; /** Energy deposited in calorimeter by charged pions */
113 delete fHistProtonEnergyDeposit; /** Energy deposited in calorimeter by protons */
114 delete fHistAntiProtonEnergyDeposit; /** Energy deposited in calorimeter by anti-protons */
115 delete fHistChargedKaonEnergyDeposit; /** Energy deposited in calorimeter by charged kaons */
116 delete fHistMuonEnergyDeposit; /** Energy deposited in calorimeter by muons */
118 delete fHistRemovedEnergy; // removed energy
119 delete fClusterPositionAccepted;
120 delete fClusterPositionAll;
121 delete fClusterPositionAcceptedEnergy;
122 delete fClusterPositionAllEnergy;
123 delete fClusterEnergy;
124 delete fClusterEnergyCent;
125 delete fClusterEnergyCentMatched;
126 delete fClusterEnergyCentNotMatched;
128 delete fHistChargedEnergyRemoved;
129 delete fHistNeutralEnergyRemoved;
130 delete fHistGammaEnergyAdded;
131 delete fHistMatchedTracksEvspTvsCent;
132 delete fHistMatchedTracksEvspTvsCentEffCorr;
133 delete fHistMatchedTracksEvspTvsCentEffTMCorr;
134 delete fHistMatchedTracksEvspTvsCentEffTMCorr500MeV;
135 delete fHistFoundHadronsvsCent;
136 delete fHistNotFoundHadronsvsCent;
137 delete fHistFoundHadronsEtvsCent;
138 delete fHistNotFoundHadronsEtvsCent;
139 delete fHistFoundHadronsvsCent500MeV;
140 delete fHistNotFoundHadronsvsCent500MeV;
141 delete fHistFoundHadronsEtvsCent500MeV;
142 delete fHistNotFoundHadronsEtvsCent500MeV;
143 delete fHistNominalRawEt;
144 delete fHistNominalNonLinHighEt;
145 delete fHistNominalNonLinLowEt;
146 delete fHistNominalEffHighEt;
147 delete fHistNominalEffLowEt;
148 delete fHistTotRawEtEffCorr;
149 delete fHistTotRawEt;
150 delete fHistTotAllRawEt;
151 delete fHistTotAllRawEtEffCorr;
152 delete fHistTotRawEtEffCorr500MeV;
153 delete fHistNClustersPhosVsEmcal;
154 delete fHistClusterSizeVsCent;
155 delete fHistMatchedClusterSizeVsCent;
156 delete fHistTotAllRawEtVsTotalPt;
157 delete fHistTotAllRawEtVsTotalPtVsCent;
158 delete fHistTotMatchedRawEtVsTotalPtVsCent;
159 delete fHistPIDProtonsTrackMatchedDepositedVsNch;
160 delete fHistPIDAntiProtonsTrackMatchedDepositedVsNch;
161 delete fHistPIDProtonsTrackMatchedDepositedVsNcl;
162 delete fHistPIDAntiProtonsTrackMatchedDepositedVsNcl;
163 delete fHistPiKPTrackMatchedDepositedVsNch;
164 delete fHistCentVsNchVsNclReco;
167 Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
170 //AliAnalysisEt::AnalyseEvent(ev);
174 AliFatal("ERROR: Event does not exist");
178 AliESDEvent *event = dynamic_cast<AliESDEvent*>(ev);
180 AliFatal("ERROR: ESD Event does not exist");
184 AliFatal("ERROR: fSelector does not exist");
187 fSelector->SetEvent(event);
190 fCentrality = event->GetCentrality();
191 if (fCentrality && cent)
193 cent = fCentrality->GetCentralityClass5("V0M");
194 fCentClass = fCentrality->GetCentralityClass5("V0M");
199 AliESDpid *pID = new AliESDpid();
201 Float_t etPIDProtons = 0.0;
202 Float_t etPIDAntiProtons = 0.0;
203 Float_t etPiKPMatched = 0.0;
204 Float_t multiplicity = fEsdtrackCutsTPC->GetReferenceMultiplicity(event,kTRUE);
207 Float_t totalMatchedPt = 0.0;
208 Float_t totalPt = 0.0;
209 TObjArray* list = fEsdtrackCutsTPC->GetAcceptedTracks(event);
210 Int_t nGoodTracks = list->GetEntries();
211 for (Int_t iTrack = 0; iTrack < nGoodTracks; iTrack++){
212 AliESDtrack *track = dynamic_cast<AliESDtrack*> (list->At(iTrack));
215 Printf("ERROR: Could not get track %d", iTrack);
219 totalPt +=track->Pt();
220 pID->MakeITSPID(track);
226 //TRefArray *caloClusters = fSelector->GetClusters();//just gets the correct set of clusters - does not apply any cuts
227 //Float_t fClusterMult = caloClusters->GetEntries();
229 Float_t nominalRawEt = 0;
230 Float_t totEt500MeV = 0;
231 Float_t nonlinHighRawEt = 0;
232 Float_t nonlinLowRawEt = 0;
233 Float_t effHighRawEt = 0;
234 Float_t effLowRawEt = 0;
235 Float_t uncorrEt = 0;
237 Float_t nChargedHadronsMeasured = 0.0;
238 Float_t nChargedHadronsTotal = 0.0;
239 Float_t nChargedHadronsEtMeasured = 0.0;
240 Float_t nChargedHadronsEtTotal = 0.0;
241 Float_t nChargedHadronsMeasured500MeV = 0.0;
242 Float_t nChargedHadronsTotal500MeV = 0.0;
243 Float_t nChargedHadronsEtMeasured500MeV = 0.0;
244 Float_t nChargedHadronsEtTotal500MeV = 0.0;
245 Float_t fTotAllRawEt = 0.0;
246 Float_t fTotRawEt = 0.0;
247 Float_t fTotRawEtEffCorr = 0.0;
248 Float_t fTotAllRawEtEffCorr = 0.0;
249 Int_t nPhosClusters = 0;
250 Int_t nEmcalClusters = 0;
252 for (Int_t iCluster = 0; iCluster < event->GetNumberOfCaloClusters(); iCluster++)
254 AliESDCaloCluster* cluster = event->GetCaloCluster(iCluster);
257 AliError(Form("ERROR: Could not get cluster %d", iCluster));
262 if(cluster->IsEMCAL()) nEmcalClusters++;
263 else nPhosClusters++;
264 if(!fSelector->IsDetectorCluster(*cluster)) continue;
266 if(!fSelector->PassMinEnergyCut(*cluster)) continue;
268 if (!fSelector->PassDistanceToBadChannelCut(*cluster)) continue;
270 if (!fSelector->CutGeometricalAcceptance(*cluster)) continue;
271 //fCutFlow->Fill(x++);
274 cluster->GetPosition(pos);
276 fClusterPositionAll->Fill(cp.Phi(), cp.PseudoRapidity());
277 fClusterPositionAllEnergy->Fill(cp.Phi(), cp.PseudoRapidity(),cluster->E());
279 //if(TMath::Abs(cp.Eta())> fCuts->fCuts->GetGeometryEmcalEtaAccCut() || cp.Phi() > fCuts->GetGeometryEmcalPhiAccMaxCut()*TMath::Pi()/180. || cp.Phi() > fCuts->GetGeometryEmcalPhiAccMinCut()*TMath::Pi()/180.) continue;//Do not accept if cluster is not in the acceptance
280 fTotAllRawEt += TMath::Sin(cp.Theta())*cluster->E();
281 fTotAllRawEtEffCorr += CorrectForReconstructionEfficiency(*cluster,cent);
283 fClusterEnergyCent->Fill(cluster->E(),cent);
285 Bool_t matched = kTRUE;//default to no track matched
286 Int_t trackMatchedIndex = cluster->GetTrackMatchedIndex();//find the index of the matched track
287 matched = !(fSelector->PassTrackMatchingCut(*cluster));//PassTrackMatchingCut is false if there is a matched track
288 if(matched){//if the track match is good (, is the track good?
289 if(trackMatchedIndex < 0) matched=kFALSE;//If the index is bad, don't count it
291 AliESDtrack *track = event->GetTrack(trackMatchedIndex);
292 //if this is a good track, accept track will return true. The track matched is good, so not track matched is false
293 matched = fEsdtrackCutsTPC->AcceptTrack(track);//If the track is bad, don't count it
301 if (cluster->GetNTracksMatched() > 0 && trackMatchedIndex>=0)
303 AliVTrack *track = event->GetTrack(trackMatchedIndex);
305 AliError("Error: track does not exist");
308 totalMatchedPt +=track->Pt();
309 fClusterEnergyCentMatched->Fill(cluster->E(),cent);
310 fHistMatchedClusterSizeVsCent->Fill(cluster->GetNCells(),cent);
312 float eff = fTmCorrections->TrackMatchingEfficiency(track->Pt(),cent);
313 if(TMath::Abs(eff)<1e-5) eff = 1.0;
314 //cout<<"pt "<<track->Pt()<<" eff "<<eff<<" total "<<nChargedHadronsTotal<<endl;
315 nChargedHadronsMeasured++;
316 nChargedHadronsTotal += 1/eff;
317 Double_t effCorrEt = CorrectForReconstructionEfficiency(*cluster,cent);
318 nChargedHadronsEtMeasured+= TMath::Sin(cp.Theta())*cluster->E();
319 //One efficiency is the gamma efficiency and the other is the track matching efficiency.
320 nChargedHadronsEtTotal+= 1/eff *TMath::Sin(cp.Theta())*cluster->E();
322 Float_t nSigmaPion = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kPion);
323 Float_t nSigmaProton = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kProton);
324 bool isProton = (nSigmaPion>3.0 && nSigmaProton<3.0 && track->Pt()<0.9);
325 //cout<<"NSigmaProton "<<nSigmaProton<<endl;
326 etPiKPMatched += effCorrEt;
328 if(track->Charge()>0){
329 etPIDProtons += effCorrEt;
332 etPIDAntiProtons += effCorrEt;
335 if(TMath::Sin(cp.Theta())*cluster->E()>0.5){
336 nChargedHadronsMeasured500MeV++;
337 nChargedHadronsTotal500MeV += 1/eff;
338 nChargedHadronsEtMeasured500MeV+= TMath::Sin(cp.Theta())*cluster->E();
339 nChargedHadronsEtTotal500MeV+= 1/eff *TMath::Sin(cp.Theta())*cluster->E();
341 fHistMatchedTracksEvspTvsCent->Fill(track->P(),TMath::Sin(cp.Theta())*cluster->E(),cent);
342 fHistMatchedTracksEvspTvsCentEffCorr->Fill(track->P(),effCorrEt,cent);
343 //Weighed by the number of tracks we didn't find
344 fHistMatchedTracksEvspTvsCentEffTMCorr->Fill(track->P(), effCorrEt,cent, (1/eff-1) );
345 cluster->GetPosition(pos);
347 uncorrEt += TMath::Sin(p2.Theta())*cluster->E();
348 if(uncorrEt>=0.5) fHistMatchedTracksEvspTvsCentEffTMCorr500MeV->Fill(track->P(), effCorrEt,cent, (1/eff-1) );
349 const Double_t *pidWeights = track->PID();
351 Double_t maxpidweight = 0;
356 for (Int_t p =0; p < AliPID::kSPECIES; p++)
358 if (pidWeights[p] > maxpidweight)
360 maxpidweight = pidWeights[p];
364 if (fCuts->GetHistMakeTreeDeposit() && fDepositTree)
366 fEnergyDeposited = cluster->E();
367 fMomentumTPC = track->P();
368 fCharge = track->Charge();
369 fParticlePid = maxpid;
370 fPidProb = maxpidweight;
371 AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track);
373 AliError("Error: track does not exist");
376 if (esdTrack) fTrackPassedCut = fEsdtrackCutsTPC->AcceptTrack(esdTrack);
377 fDepositTree->Fill();
381 if (maxpidweight > fPidCut)
383 //Float_t dist = TMath::Sqrt(pos[0]*pos[0] + pos[1]*pos[1]);
385 //Float_t theta = TMath::ATan(pos[2]/dist)+TMath::Pi()/2;
387 //Float_t et = cluster->E() * TMath::Sin(theta);
388 if (maxpid == AliPID::kProton)
391 if (track->Charge() == 1)
393 fHistProtonEnergyDeposit->Fill(cluster->E(), track->E());
395 else if (track->Charge() == -1)
397 fHistAntiProtonEnergyDeposit->Fill(cluster->E(), track->E());
400 else if (maxpid == AliPID::kPion)
402 fHistChargedPionEnergyDeposit->Fill(cluster->E(), track->E());
404 else if (maxpid == AliPID::kKaon)
406 fHistChargedKaonEnergyDeposit->Fill(cluster->E(), track->E());
408 else if (maxpid == AliPID::kMuon)
410 fHistMuonEnergyDeposit->Fill(cluster->E(), track->E());
418 else{//these are clusters which were not track matched
420 //std::cout << x++ << std::endl;
422 //if (cluster->E() > fSingleCellEnergyCut && cluster->GetNCells() == fCuts->GetCommonSingleCell()) continue;
423 //if (cluster->E() < fClusterEnergyCut) continue;
424 cluster->GetPosition(pos);
428 fClusterPositionAccepted->Fill(p2.Phi(), p2.PseudoRapidity());
429 fClusterPositionAcceptedEnergy->Fill(p2.Phi(), p2.PseudoRapidity(),cluster->E());
430 fClusterEnergy->Fill(cluster->E());
431 fClusterEnergyCentNotMatched->Fill(cluster->E(),cent);
432 fHistClusterSizeVsCent->Fill(cluster->GetNCells(),cent);
433 fClusterEt->Fill(TMath::Sin(p2.Theta())*cluster->E());
434 uncorrEt += TMath::Sin(p2.Theta())*cluster->E();
435 float myuncorrEt = TMath::Sin(p2.Theta())*cluster->E();
436 fTotRawEt += myuncorrEt;
438 Double_t effCorrEt = CorrectForReconstructionEfficiency(*cluster,cent);
439 //cout<<"cluster energy "<<cluster->E()<<" eff corr Et "<<effCorrEt<<endl;
440 fTotRawEtEffCorr += effCorrEt;
441 fTotNeutralEt += effCorrEt;
442 nominalRawEt += effCorrEt;
444 totEt500MeV += effCorrEt;
445 //cout<<"test "<<myuncorrEt<<"> 0.5"<<endl;
448 //cout<<"test "<<myuncorrEt<<"< 0.5"<<endl;
450 nonlinHighRawEt += effCorrEt*GetCorrectionModification(*cluster,1,0,cent);
451 nonlinLowRawEt += effCorrEt*GetCorrectionModification(*cluster,-1,0,cent);
452 effHighRawEt += effCorrEt*GetCorrectionModification(*cluster,0,1,cent);
453 effLowRawEt += effCorrEt*GetCorrectionModification(*cluster,0,-1,cent);
454 fNeutralMultiplicity++;
459 fHistNClustersPhosVsEmcal->Fill(nPhosClusters,nEmcalClusters,cent);
460 fChargedEnergyRemoved = GetChargedContribution(fNeutralMultiplicity);
461 fNeutralEnergyRemoved = GetNeutralContribution(fNeutralMultiplicity);
462 fHistChargedEnergyRemoved->Fill(fChargedEnergyRemoved, fNeutralMultiplicity);
463 fHistNeutralEnergyRemoved->Fill(fNeutralEnergyRemoved, fNeutralMultiplicity);
465 fGammaEnergyAdded = GetGammaContribution(fNeutralMultiplicity);
466 fHistGammaEnergyAdded->Fill(fGammaEnergyAdded, fNeutralMultiplicity);
468 Double_t removedEnergy = GetChargedContribution(fNeutralMultiplicity) + GetNeutralContribution(fNeutralMultiplicity) + GetGammaContribution(fNeutralMultiplicity) + GetSecondaryContribution(fNeutralMultiplicity);
469 fHistRemovedEnergy->Fill(removedEnergy);
471 fTotNeutralEtAcc = fTotNeutralEt;
472 //fHistTotRawEtEffCorr->Fill(fTotNeutralEt,cent);
473 fHistTotRawEtEffCorr->Fill(fTotRawEtEffCorr,cent);
474 fHistTotRawEt->Fill(fTotRawEt,cent);
475 fHistTotAllRawEt->Fill(fTotAllRawEt,cent);
476 fHistTotAllRawEtVsTotalPt->Fill(fTotAllRawEt,totalPt);
477 fHistTotAllRawEtVsTotalPtVsCent->Fill(fTotAllRawEt,totalPt,cent);
478 fHistTotMatchedRawEtVsTotalPtVsCent->Fill(fTotAllRawEt,totalMatchedPt,cent);
479 fHistTotAllRawEtEffCorr->Fill(fTotAllRawEtEffCorr,cent);
480 //cout<<"fTotAllRawEtEffCorr "<<fTotAllRawEtEffCorr<<" fTotAllRawEt "<<fTotAllRawEt<<" fTotRawEtEffCorr "<<fTotRawEtEffCorr<<"("<<fTotNeutralEt<<")"<<" fTotRawEt "<<fTotRawEt<<endl;
481 //cout<<"uncorr "<<uncorrEt<<" raw "<<nominalRawEt<<" tot raw "<<fTotNeutralEt;
482 fTotNeutralEt = fGeomCorrection * fEMinCorrection * (fTotNeutralEt - removedEnergy);
483 //cout<<" tot corr "<<fTotNeutralEt<<endl;
484 fTotEt = fTotChargedEt + fTotNeutralEt;
485 // Fill the histograms...0
487 //std::cout << "fTotNeutralEt: " << fTotNeutralEt << ", Contribution from non-removed charged: " << GetChargedContribution(fNeutralMultiplicity) << ", neutral: " << GetNeutralContribution(fNeutralMultiplicity) << ", gammas: " << GetGammaContribution(fNeutralMultiplicity) << ", multiplicity: " << fNeutralMultiplicity<< std::endl;
488 //cout<<"cent "<<cent<<" cluster mult "<<fClusterMult<<" fTotNeutralEt "<<fTotNeutralEt<<" nominalRawEt "<<nominalRawEt<<endl;
489 fHistNominalRawEt->Fill(nominalRawEt,cent);
490 fHistTotRawEtEffCorr500MeV->Fill(totEt500MeV,cent);
491 fHistNominalNonLinHighEt->Fill(nonlinHighRawEt,cent);
492 fHistNominalNonLinLowEt->Fill(nonlinLowRawEt,cent);
493 fHistNominalEffHighEt->Fill(effHighRawEt,cent);
494 fHistNominalEffLowEt->Fill(effLowRawEt,cent);
495 fHistFoundHadronsvsCent->Fill(nChargedHadronsMeasured,cent);
496 fHistNotFoundHadronsvsCent->Fill(nChargedHadronsTotal-nChargedHadronsMeasured,cent);
497 fHistFoundHadronsEtvsCent->Fill(nChargedHadronsEtMeasured,cent);
498 fHistNotFoundHadronsEtvsCent->Fill(nChargedHadronsEtTotal-nChargedHadronsEtMeasured,cent);
499 //cout<<"found "<<nChargedHadronsMeasured<<" total "<<nChargedHadronsTotal<<" not found "<<nChargedHadronsTotal-nChargedHadronsMeasured<<" found "<< nChargedHadronsMeasured500MeV<<" not found "<< nChargedHadronsTotal500MeV-nChargedHadronsMeasured500MeV <<" total "<<nChargedHadronsTotal500MeV<<endl;
500 fHistFoundHadronsvsCent500MeV->Fill(nChargedHadronsMeasured500MeV,cent);
501 fHistNotFoundHadronsvsCent500MeV->Fill(nChargedHadronsTotal500MeV-nChargedHadronsMeasured500MeV,cent);
502 fHistFoundHadronsEtvsCent500MeV->Fill(nChargedHadronsEtMeasured500MeV,cent);
503 fHistNotFoundHadronsEtvsCent500MeV->Fill(nChargedHadronsEtTotal500MeV-nChargedHadronsEtMeasured500MeV,cent);
504 // cout<<"Number of hadrons measured: "<<nChargedHadronsMeasured<<" Estimated total number of hadrons "<<nChargedHadronsTotal<<" ET in track matched hadrons "<<
505 // nChargedHadronsEtMeasured;
506 // if(nChargedHadronsMeasured>0)cout<<" ("<<nChargedHadronsEtMeasured/nChargedHadronsMeasured<<") ";
507 // cout<<" ET in all hadrons ";
508 // cout<<nChargedHadronsEtTotal;
509 // if(nChargedHadronsTotal>0) cout<<" ("<<nChargedHadronsEtTotal/nChargedHadronsTotal<<") ";
511 fHistPIDProtonsTrackMatchedDepositedVsNch->Fill(etPIDProtons,multiplicity);
512 fHistPIDAntiProtonsTrackMatchedDepositedVsNch->Fill(etPIDAntiProtons,multiplicity);
513 fHistPIDProtonsTrackMatchedDepositedVsNcl->Fill(etPIDProtons,fMultiplicity);
514 fHistPIDAntiProtonsTrackMatchedDepositedVsNcl->Fill(etPIDAntiProtons,fMultiplicity);
515 fHistCentVsNchVsNclReco->Fill(cent,multiplicity,fMultiplicity);
516 fHistPiKPTrackMatchedDepositedVsNch->Fill(etPiKPMatched,multiplicity);
521 bool AliAnalysisEtReconstructed::CheckGoodVertex(AliVParticle* track)
527 AliError("ERROR: no track");
530 AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track);
532 AliError("ERROR: no track");
535 esdTrack->GetImpactParametersTPC(bxy,bz);
538 bool status = (TMath::Abs(track->Xv()) < fCuts->GetReconstructedVertexXCut()) &&
539 (TMath::Abs(track->Yv()) < fCuts->GetReconstructedVertexYCut()) &&
540 (TMath::Abs(track->Zv()) < fCuts->GetReconstructedVertexZCut()) &&
541 (TMath::Abs(bxy) < fCuts->GetReconstructedIPxyCut()) &&
542 (TMath::Abs(bz) < fCuts->GetReconstructedIPzCut());
547 void AliAnalysisEtReconstructed::Init()
549 AliAnalysisEt::Init();
550 fPidCut = fCuts->GetReconstructedPidCut();
551 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
553 cout<<"Warning! You have not set corrections. Your code will crash. You have to set the corrections."<<endl;
557 bool AliAnalysisEtReconstructed::TrackHitsCalorimeter(AliVParticle* track, Double_t magField)
558 { // propagate track to detector radius
560 cout<<"Warning: track empty"<<endl;
563 AliESDtrack *esdTrack= dynamic_cast<AliESDtrack*>(track);
565 AliError("ERROR: no ESD track");
568 // Printf("Propagating track: eta: %f, phi: %f, pt: %f", esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt());
570 Bool_t prop = esdTrack->PropagateTo(fDetectorRadius, magField);
572 // if (prop) Printf("Track propagated, eta: %f, phi: %f, pt: %f", esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt());
573 return prop && fSelector->CutGeometricalAcceptance(*esdTrack);
576 void AliAnalysisEtReconstructed::FillOutputList(TList* list)
577 { // add some extra histograms to the ones from base class
578 AliAnalysisEt::FillOutputList(list);
580 list->Add(fHistChargedPionEnergyDeposit);
581 list->Add(fHistProtonEnergyDeposit);
582 list->Add(fHistAntiProtonEnergyDeposit);
583 list->Add(fHistChargedKaonEnergyDeposit);
584 list->Add(fHistMuonEnergyDeposit);
586 list->Add(fHistRemovedEnergy);
587 list->Add(fClusterPositionAccepted);
588 list->Add(fClusterPositionAll);
589 list->Add(fClusterPositionAcceptedEnergy);
590 list->Add(fClusterPositionAllEnergy);
591 list->Add(fClusterEnergy);
592 list->Add(fClusterEnergyCent);
593 list->Add(fClusterEnergyCentMatched);
594 list->Add(fClusterEnergyCentNotMatched);
595 list->Add(fClusterEt);
597 list->Add(fHistChargedEnergyRemoved);
598 list->Add(fHistNeutralEnergyRemoved);
599 list->Add(fHistGammaEnergyAdded);
600 list->Add(fHistMatchedTracksEvspTvsCent);
601 list->Add(fHistMatchedTracksEvspTvsCentEffCorr);
602 list->Add(fHistMatchedTracksEvspTvsCentEffTMCorr);
603 list->Add(fHistMatchedTracksEvspTvsCentEffTMCorr500MeV);
604 list->Add(fHistFoundHadronsvsCent);
605 list->Add(fHistNotFoundHadronsvsCent);
606 list->Add(fHistFoundHadronsEtvsCent);
607 list->Add(fHistNotFoundHadronsEtvsCent);
608 list->Add(fHistFoundHadronsvsCent500MeV);
609 list->Add(fHistNotFoundHadronsvsCent500MeV);
610 list->Add(fHistFoundHadronsEtvsCent500MeV);
611 list->Add(fHistNotFoundHadronsEtvsCent500MeV);
612 list->Add(fHistNominalRawEt);
613 list->Add(fHistNominalNonLinHighEt);
614 list->Add(fHistNominalNonLinLowEt);
615 list->Add(fHistNominalEffHighEt);
616 list->Add(fHistNominalEffLowEt);
617 list->Add(fHistTotRawEtEffCorr);
618 list->Add(fHistTotRawEtEffCorr500MeV);
619 list->Add(fHistTotAllRawEtEffCorr);
620 list->Add(fHistTotRawEt);
621 list->Add(fHistTotAllRawEt);
622 list->Add(fHistNClustersPhosVsEmcal);
623 list->Add(fHistClusterSizeVsCent);
624 list->Add(fHistMatchedClusterSizeVsCent);
625 list->Add(fHistTotAllRawEtVsTotalPt);
626 list->Add(fHistTotAllRawEtVsTotalPtVsCent);
627 list->Add(fHistTotMatchedRawEtVsTotalPtVsCent);
628 list->Add(fHistPIDProtonsTrackMatchedDepositedVsNch);
629 list->Add(fHistPIDAntiProtonsTrackMatchedDepositedVsNch);
630 list->Add(fHistPIDProtonsTrackMatchedDepositedVsNcl);
631 list->Add(fHistPIDAntiProtonsTrackMatchedDepositedVsNcl);
632 list->Add(fHistPiKPTrackMatchedDepositedVsNch);
633 list->Add(fHistCentVsNchVsNclReco);
636 void AliAnalysisEtReconstructed::CreateHistograms()
637 { // add some extra histograms to the ones from base class
638 AliAnalysisEt::CreateHistograms();
640 Int_t nbinsEt = 1000;
644 // possibly change histogram limits
646 // nbinsEt = fCuts->GetHistNbinsParticleEt();
647 // minEt = fCuts->GetHistMinParticleEt();
648 // maxEt = fCuts->GetHistMaxParticleEt();
652 histname = "fHistChargedPionEnergyDeposit" + fHistogramNameSuffix;
653 fHistChargedPionEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by #pi^{+/-}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
654 fHistChargedPionEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
655 fHistChargedPionEnergyDeposit->SetYTitle("Energy of track");
657 histname = "fHistProtonEnergyDeposit" + fHistogramNameSuffix;
658 fHistProtonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by protons", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
659 fHistProtonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
660 fHistProtonEnergyDeposit->SetYTitle("Energy of track");
662 histname = "fHistAntiProtonEnergyDeposit" + fHistogramNameSuffix;
663 fHistAntiProtonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by anti-protons", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
664 fHistAntiProtonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
665 fHistAntiProtonEnergyDeposit->SetYTitle("Energy of track");
667 histname = "fHistChargedKaonEnergyDeposit" + fHistogramNameSuffix;
668 fHistChargedKaonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by K^{+/-}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
669 fHistChargedKaonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
670 fHistChargedKaonEnergyDeposit->SetYTitle("Energy of track");
672 histname = "fHistMuonEnergyDeposit" + fHistogramNameSuffix;
673 fHistMuonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by #mu^{+/-}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
674 fHistMuonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
675 fHistMuonEnergyDeposit->SetYTitle("Energy of track");
677 histname = "fHistRemovedEnergy" + fHistogramNameSuffix;
678 fHistRemovedEnergy = new TH1F(histname.Data(), histname.Data(), 1000, 0, 20);
679 //fHistMuonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
680 //fHistMuonEnergyDeposit->SetYTitle("Energy of track");
682 histname = "fClusterPositionAccepted" + fHistogramNameSuffix;
683 fClusterPositionAccepted = new TH2D(histname.Data(), "Position of accepted neutral clusters",300, -TMath::Pi(),TMath::Pi(), 100, -0.7 , 0.7);
684 fClusterPositionAccepted->SetXTitle("#phi");
685 fClusterPositionAccepted->SetYTitle("#eta");
687 histname = "fClusterPositionAll" + fHistogramNameSuffix;
688 fClusterPositionAll = new TH2D(histname.Data(), "Position of accepted neutral clusters",300, -TMath::Pi(),TMath::Pi(), 100, -0.7 , 0.7);
689 fClusterPositionAll->SetXTitle("#phi");
690 fClusterPositionAll->SetYTitle("#eta");
692 histname = "fClusterPositionAcceptedEnergy" + fHistogramNameSuffix;
693 fClusterPositionAcceptedEnergy = new TH2D(histname.Data(), "Position of accepted neutral clusters",300, -TMath::Pi(),TMath::Pi(), 100, -0.7 , 0.7);
694 fClusterPositionAcceptedEnergy->SetXTitle("#phi");
695 fClusterPositionAcceptedEnergy->SetYTitle("#eta");
697 histname = "fClusterPositionAllEnergy" + fHistogramNameSuffix;
698 fClusterPositionAllEnergy = new TH2D(histname.Data(), "Position of accepted neutral clusters",300, -TMath::Pi(),TMath::Pi(), 100, -0.7 , 0.7);
699 fClusterPositionAllEnergy->SetXTitle("#phi");
700 fClusterPositionAllEnergy->SetYTitle("#eta");
702 histname = "fClusterEnergy" + fHistogramNameSuffix;
703 fClusterEnergy = new TH1F(histname.Data(), histname.Data(), 100, 0, 5);
704 fClusterEnergy->SetYTitle("Number of clusters");
705 fClusterEnergy->SetXTitle("Energy of cluster");
707 histname = "fClusterEnergyCent" + fHistogramNameSuffix;
708 fClusterEnergyCent = new TH2F(histname.Data(), histname.Data(), 100, 0, 5,20,-0.5,19.5);
709 fClusterEnergyCent->SetXTitle("Energy of cluster");
710 fClusterEnergyCent->SetYTitle("Centrality Bin");
711 fClusterEnergyCent->SetZTitle("Number of clusters");
713 histname = "fClusterEnergyCentMatched" + fHistogramNameSuffix;
714 fClusterEnergyCentMatched = new TH2F(histname.Data(), histname.Data(), 100, 0, 5,20,-0.5,19.5);
715 fClusterEnergyCentMatched->SetXTitle("Energy of cluster");
716 fClusterEnergyCentMatched->SetYTitle("Centrality Bin");
717 fClusterEnergyCentMatched->SetZTitle("Number of Clusters");
719 histname = "fClusterEnergyCentNotMatched" + fHistogramNameSuffix;
720 fClusterEnergyCentNotMatched = new TH2F(histname.Data(), histname.Data(), 100, 0, 5,20,-0.5,19.5);
721 fClusterEnergyCentNotMatched->SetXTitle("Energy of cluster");
722 fClusterEnergyCentNotMatched->SetYTitle("Centrality Bin");
723 fClusterEnergyCentNotMatched->SetZTitle("Number of clusters");
725 histname = "fClusterEt" + fHistogramNameSuffix;
726 fClusterEt = new TH1F(histname.Data(), histname.Data(), 100, 0, 5);
727 fClusterEt->SetXTitle("Number of clusters");
728 fClusterEt->SetYTitle("E_{T} of cluster");
730 histname = "fHistChargedEnergyRemoved" + fHistogramNameSuffix;
731 fHistChargedEnergyRemoved = new TH2D(histname.Data(), histname.Data(), 1000, .0, 30, 100, -0.5 , 99.5);
733 histname = "fHistNeutralEnergyRemoved" + fHistogramNameSuffix;
734 fHistNeutralEnergyRemoved = new TH2D(histname.Data(), histname.Data(), 1000, .0, 30, 100, -0.5 , 99.5);
736 histname = "fHistGammaEnergyAdded" + fHistogramNameSuffix;
737 fHistGammaEnergyAdded = new TH2D(histname.Data(), histname.Data(), 1000, .0, 30, 100, -0.5 , 99.5);
739 fHistMatchedTracksEvspTvsCent = new TH3F("fHistMatchedTracksEvspTvsCent", "fHistMatchedTracksEvspTvsCent",100, 0, 3,100,0,3,20,-0.5,19.5);
740 fHistMatchedTracksEvspTvsCentEffCorr = new TH3F("fHistMatchedTracksEvspTvsCentEffCorr", "fHistMatchedTracksEvspTvsCentEffCorr",100, 0, 3,100,0,3,20,-0.5,19.5);
741 fHistMatchedTracksEvspTvsCentEffTMCorr = new TH3F("fHistMatchedTracksEvspTvsCentEffTMCorr", "fHistMatchedTracksEvspTvsCentEffTMCorr",100, 0, 3,100,0,3,20,-0.5,19.5);
742 fHistMatchedTracksEvspTvsCentEffTMCorr500MeV = new TH3F("fHistMatchedTracksEvspTvsCentEffTMCorr500MeV", "fHistMatchedTracksEvspTvsCentEffTMCorr500MeV",100, 0, 3,100,0,3,20,-0.5,19.5);
745 if(fHistogramNameSuffix.Contains("P")){max = 100;}
746 fHistFoundHadronsvsCent = new TH2F("fHistFoundHadronsvsCent","fHistFoundHadronsvsCent",100,0,max,20,-0.5,19.5);
747 fHistNotFoundHadronsvsCent = new TH2F("fHistNotFoundHadronsvsCent","fHistNotFoundHadronsvsCent",100,0,max,20,-0.5,19.5);
748 fHistFoundHadronsEtvsCent = new TH2F("fHistFoundHadronsEtvsCent","fHistFoundHadronsEtvsCent",100,0,max,20,-0.5,19.5);
749 fHistNotFoundHadronsEtvsCent = new TH2F("fHistNotFoundHadronsEtvsCent","fHistNotFoundHadronsEtvsCent",100,0,max,20,-0.5,19.5);
750 fHistFoundHadronsvsCent500MeV = new TH2F("fHistFoundHadronsvsCent500MeV","fHistFoundHadronsvsCent500MeV",100,0,max,20,-0.5,19.5);
751 fHistNotFoundHadronsvsCent500MeV = new TH2F("fHistNotFoundHadronsvsCent500MeV","fHistNotFoundHadronsvsCent500MeV",100,0,max,20,-0.5,19.5);
752 fHistFoundHadronsEtvsCent500MeV = new TH2F("fHistFoundHadronsEtvsCent500MeV","fHistFoundHadronsEtvsCent500MeV",100,0,max,20,-0.5,19.5);
753 fHistNotFoundHadronsEtvsCent500MeV = new TH2F("fHistNotFoundHadronsEtvsCent500MeV","fHistNotFoundHadronsEtvsCent500MeV",100,0,max,20,-0.5,19.5);
755 fHistTotRawEtEffCorr = new TH2F("fHistTotRawEtEffCorr","fHistTotRawEtEffCorr",250,0,250,20,-0.5,19.5);
756 fHistTotRawEt = new TH2F("fHistTotRawEt","fHistTotRawEt",250,0,250,20,-0.5,19.5);
757 fHistTotRawEtEffCorr500MeV = new TH2F("fHistTotRawEtEffCorr500MeV","fHistTotRawEtEffCorr500MeV",250,0,250,20,-0.5,19.5);
758 fHistTotAllRawEt = new TH2F("fHistTotAllRawEt","fHistTotAllRawEt",250,0,250,20,-0.5,19.5);
759 fHistTotAllRawEtEffCorr = new TH2F("fHistTotAllRawEtEffCorr","fHistTotAllRawEtEffCorr",250,0,250,20,-0.5,19.5);
760 fHistNClustersPhosVsEmcal = new TH3F("fHistNClustersPhosVsEmcal","fHistNClustersPhosVsEmcal",50,0,50,250,0,250,20,-0.5,19);
761 fHistClusterSizeVsCent = new TH2F("fHistClusterSizeVsCent","fHistClusterSizeVsCent",10,0.5,10.5,20,-0.5,19.5);
762 fHistMatchedClusterSizeVsCent = new TH2F("fHistMatchedClusterSizeVsCent","fHistMatchedClusterSizeVsCent",10,0.5,10.5,20,-0.5,19.5);
763 fHistTotAllRawEtVsTotalPt = new TH2F("fHistTotAllRawEtVsTotalPt","fHistTotAllRawEtVsTotalPt",125,0,250,200,0,2000);
764 fHistTotAllRawEtVsTotalPtVsCent = new TH3F("fHistTotAllRawEtVsTotalPtVsCent","fHistTotAllRawEtVsTotalPtVsCent",125,0,250,200,0,2000,20,-0.5,19.5);
765 fHistTotMatchedRawEtVsTotalPtVsCent = new TH3F("fHistTotMatchedRawEtVsTotalPtVsCent","fHistTotMatchedRawEtVsTotalPtVsCent",250,0,250,100,0,200,20,-0.5,19.5);
768 histname = "fHistNominalRawEt" + fHistogramNameSuffix;
769 fHistNominalRawEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
770 histname = "fHistNominalNonLinHighEt" + fHistogramNameSuffix;
771 fHistNominalNonLinHighEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
772 histname = "fHistNominalNonLinLowEt" + fHistogramNameSuffix;
773 fHistNominalNonLinLowEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
774 histname = "fHistNominalEffHighEt" + fHistogramNameSuffix;
775 fHistNominalEffHighEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
776 histname = "fHistNominalEffLowEt" + fHistogramNameSuffix;
777 fHistNominalEffLowEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
779 Float_t maxEtRange = 25;
780 Float_t maxEtRangeHigh = 125;
781 Float_t minEtRange = 0;
782 Int_t nbinsMult = 100;
783 Float_t maxMult = 3000;
788 fHistPIDProtonsTrackMatchedDepositedVsNch = new TH2F("fHistPIDProtonsTrackMatchedDepositedVsNch","PID'd protons deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRange,nbinsMult,minMult,maxMult);
789 fHistPIDAntiProtonsTrackMatchedDepositedVsNch = new TH2F("fHistPIDAntiProtonsTrackMatchedDepositedVsNch","PID'd #bar{p} E_{T} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRange,nbinsMult,minMult,maxMult);
790 fHistPIDProtonsTrackMatchedDepositedVsNcl = new TH2F("fHistPIDProtonsTrackMatchedDepositedVsNcl","PID'd protons deposited in calorimeter vs cluster multiplicity",nbinsEt,minEtRange,maxEtRange,nbinsCl,minCl,maxCl);
791 fHistPIDAntiProtonsTrackMatchedDepositedVsNcl = new TH2F("fHistPIDAntiProtonsTrackMatchedDepositedVsNcl","PID'd #bar{p} E_{T} deposited in calorimeter vs cluster multiplicity",nbinsEt,minEtRange,maxEtRange,nbinsCl,minCl,maxCl);
792 fHistPiKPTrackMatchedDepositedVsNch = new TH2F("fHistPiKPTrackMatchedDepositedVsNch","PiKP track matched",nbinsEt,minEtRange,maxEtRangeHigh,nbinsMult,minMult,maxMult);
793 fHistCentVsNchVsNclReco = new TH3F("fHistCentVsNchVsNclReco","Cent bin vs Nch Vs NCl",20,-0.5,19.5,nbinsMult,minMult,maxMult,nbinsCl,minCl,maxCl);
795 Double_t AliAnalysisEtReconstructed::ApplyModifiedCorrections(const AliESDCaloCluster& cluster,Int_t nonLinCorr, Int_t effCorr, Int_t cent)
798 cluster.GetPosition(pos);
800 Double_t corrEnergy = fReCorrections->CorrectedEnergy(cluster.E(),cent);
802 Double_t factorNonLin = GetCorrectionModification(cluster, nonLinCorr,effCorr,cent);
804 cout<<"Warning: This function should not get called!"<<endl;
805 //std::cout << "Original energy: " << cluster.E() << ", corrected energy: " << corrEnergy << std::endl;
806 return TMath::Sin(cp.Theta())*corrEnergy*factorNonLin;
809 Double_t AliAnalysisEtReconstructed::GetCorrectionModification(const AliESDCaloCluster& cluster,Int_t nonLinCorr, Int_t effCorr, Int_t cent){//nonLinCorr 0 = nominal 1 = high -1 = low, effCorr 0 = nominal 1 = high -1 = low
811 cout<<"Warning: This function should not get called!"<<endl;//this statement is basically here to avoid a compilation warning
814 cout<<"Warning: This function should not get called!"<<endl;//this statement is basically here to avoid a compilation warning
816 return cluster.E()*cent;