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 ,fHistPiKPTrackMatchedDepositedVsNch(0)
102 ,fHistCentVsNchVsNclReco(0)
107 AliAnalysisEtReconstructed::~AliAnalysisEtReconstructed()
110 delete fHistChargedPionEnergyDeposit; /** Energy deposited in calorimeter by charged pions */
111 delete fHistProtonEnergyDeposit; /** Energy deposited in calorimeter by protons */
112 delete fHistAntiProtonEnergyDeposit; /** Energy deposited in calorimeter by anti-protons */
113 delete fHistChargedKaonEnergyDeposit; /** Energy deposited in calorimeter by charged kaons */
114 delete fHistMuonEnergyDeposit; /** Energy deposited in calorimeter by muons */
116 delete fHistRemovedEnergy; // removed energy
117 delete fClusterPositionAccepted;
118 delete fClusterPositionAll;
119 delete fClusterPositionAcceptedEnergy;
120 delete fClusterPositionAllEnergy;
121 delete fClusterEnergy;
122 delete fClusterEnergyCent;
123 delete fClusterEnergyCentMatched;
124 delete fClusterEnergyCentNotMatched;
126 delete fHistChargedEnergyRemoved;
127 delete fHistNeutralEnergyRemoved;
128 delete fHistGammaEnergyAdded;
129 delete fHistMatchedTracksEvspTvsCent;
130 delete fHistMatchedTracksEvspTvsCentEffCorr;
131 delete fHistMatchedTracksEvspTvsCentEffTMCorr;
132 delete fHistMatchedTracksEvspTvsCentEffTMCorr500MeV;
133 delete fHistFoundHadronsvsCent;
134 delete fHistNotFoundHadronsvsCent;
135 delete fHistFoundHadronsEtvsCent;
136 delete fHistNotFoundHadronsEtvsCent;
137 delete fHistFoundHadronsvsCent500MeV;
138 delete fHistNotFoundHadronsvsCent500MeV;
139 delete fHistFoundHadronsEtvsCent500MeV;
140 delete fHistNotFoundHadronsEtvsCent500MeV;
141 delete fHistNominalRawEt;
142 delete fHistNominalNonLinHighEt;
143 delete fHistNominalNonLinLowEt;
144 delete fHistNominalEffHighEt;
145 delete fHistNominalEffLowEt;
146 delete fHistTotRawEtEffCorr;
147 delete fHistTotRawEt;
148 delete fHistTotAllRawEt;
149 delete fHistTotAllRawEtEffCorr;
150 delete fHistTotRawEtEffCorr500MeV;
151 delete fHistNClustersPhosVsEmcal;
152 delete fHistClusterSizeVsCent;
153 delete fHistMatchedClusterSizeVsCent;
154 delete fHistTotAllRawEtVsTotalPt;
155 delete fHistTotAllRawEtVsTotalPtVsCent;
156 delete fHistTotMatchedRawEtVsTotalPtVsCent;
157 delete fHistPIDProtonsTrackMatchedDepositedVsNch;
158 delete fHistPIDAntiProtonsTrackMatchedDepositedVsNch;
159 delete fHistPiKPTrackMatchedDepositedVsNch;
160 delete fHistCentVsNchVsNclReco;
163 Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
166 //AliAnalysisEt::AnalyseEvent(ev);
170 AliFatal("ERROR: Event does not exist");
174 AliESDEvent *event = dynamic_cast<AliESDEvent*>(ev);
176 AliFatal("ERROR: ESD Event does not exist");
180 AliFatal("ERROR: fSelector does not exist");
183 fSelector->SetEvent(event);
186 fCentrality = event->GetCentrality();
187 if (fCentrality && cent)
189 cent = fCentrality->GetCentralityClass5("V0M");
190 fCentClass = fCentrality->GetCentralityClass5("V0M");
195 AliESDpid *pID = new AliESDpid();
197 Float_t etPIDProtons = 0.0;
198 Float_t etPIDAntiProtons = 0.0;
199 Float_t etPiKPMatched = 0.0;
200 Float_t multiplicity = fEsdtrackCutsTPC->GetReferenceMultiplicity(event,kTRUE);
203 Float_t totalMatchedPt = 0.0;
204 Float_t totalPt = 0.0;
205 TObjArray* list = fEsdtrackCutsTPC->GetAcceptedTracks(event);
206 Int_t nGoodTracks = list->GetEntries();
207 for (Int_t iTrack = 0; iTrack < nGoodTracks; iTrack++){
208 AliESDtrack *track = dynamic_cast<AliESDtrack*> (list->At(iTrack));
211 Printf("ERROR: Could not get track %d", iTrack);
215 totalPt +=track->Pt();
216 pID->MakeITSPID(track);
222 //TRefArray *caloClusters = fSelector->GetClusters();//just gets the correct set of clusters - does not apply any cuts
223 //Float_t fClusterMult = caloClusters->GetEntries();
225 Float_t nominalRawEt = 0;
226 Float_t totEt500MeV = 0;
227 Float_t nonlinHighRawEt = 0;
228 Float_t nonlinLowRawEt = 0;
229 Float_t effHighRawEt = 0;
230 Float_t effLowRawEt = 0;
231 Float_t uncorrEt = 0;
233 Float_t nChargedHadronsMeasured = 0.0;
234 Float_t nChargedHadronsTotal = 0.0;
235 Float_t nChargedHadronsEtMeasured = 0.0;
236 Float_t nChargedHadronsEtTotal = 0.0;
237 Float_t nChargedHadronsMeasured500MeV = 0.0;
238 Float_t nChargedHadronsTotal500MeV = 0.0;
239 Float_t nChargedHadronsEtMeasured500MeV = 0.0;
240 Float_t nChargedHadronsEtTotal500MeV = 0.0;
241 Float_t fTotAllRawEt = 0.0;
242 Float_t fTotRawEt = 0.0;
243 Float_t fTotAllRawEtEffCorr = 0.0;
244 Int_t nPhosClusters = 0;
245 Int_t nEmcalClusters = 0;
247 for (Int_t iCluster = 0; iCluster < event->GetNumberOfCaloClusters(); iCluster++)
249 AliESDCaloCluster* cluster = event->GetCaloCluster(iCluster);
252 AliError(Form("ERROR: Could not get cluster %d", iCluster));
257 if(cluster->IsEMCAL()) nEmcalClusters++;
258 else nPhosClusters++;
259 if(!fSelector->IsDetectorCluster(*cluster)) continue;
261 if(!fSelector->PassMinEnergyCut(*cluster)) continue;
263 if (!fSelector->PassDistanceToBadChannelCut(*cluster)) continue;
265 if (!fSelector->CutGeometricalAcceptance(*cluster)) continue;
266 //fCutFlow->Fill(x++);
269 cluster->GetPosition(pos);
271 fClusterPositionAll->Fill(cp.Phi(), cp.PseudoRapidity());
272 fClusterPositionAllEnergy->Fill(cp.Phi(), cp.PseudoRapidity(),cluster->E());
274 //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
275 fTotAllRawEt += TMath::Sin(cp.Theta())*cluster->E();
276 fTotAllRawEtEffCorr += CorrectForReconstructionEfficiency(*cluster,cent);
278 fClusterEnergyCent->Fill(cluster->E(),cent);
280 Bool_t matched = kTRUE;//default to no track matched
281 Int_t trackMatchedIndex = cluster->GetTrackMatchedIndex();//find the index of the matched track
282 matched = !(fSelector->PassTrackMatchingCut(*cluster));//PassTrackMatchingCut is false if there is a matched track
283 if(matched){//if the track match is good (, is the track good?
284 if(trackMatchedIndex < 0) matched=kFALSE;//If the index is bad, don't count it
286 AliESDtrack *track = event->GetTrack(trackMatchedIndex);
287 //if this is a good track, accept track will return true. The track matched is good, so not track matched is false
288 matched = fEsdtrackCutsTPC->AcceptTrack(track);//If the track is bad, don't count it
296 if (cluster->GetNTracksMatched() > 0 && trackMatchedIndex>=0)
298 AliVTrack *track = event->GetTrack(trackMatchedIndex);
300 AliError("Error: track does not exist");
303 totalMatchedPt +=track->Pt();
304 fClusterEnergyCentMatched->Fill(cluster->E(),cent);
305 fHistMatchedClusterSizeVsCent->Fill(cluster->GetNCells(),cent);
307 float eff = fTmCorrections->TrackMatchingEfficiency(track->Pt(),cent);
308 if(TMath::Abs(eff)<1e-5) eff = 1.0;
309 //cout<<"pt "<<track->Pt()<<" eff "<<eff<<" total "<<nChargedHadronsTotal<<endl;
310 nChargedHadronsMeasured++;
311 nChargedHadronsTotal += 1/eff;
312 Double_t effCorrEt = CorrectForReconstructionEfficiency(*cluster,cent);
313 nChargedHadronsEtMeasured+= TMath::Sin(cp.Theta())*cluster->E();
314 //One efficiency is the gamma efficiency and the other is the track matching efficiency.
315 nChargedHadronsEtTotal+= 1/eff *TMath::Sin(cp.Theta())*cluster->E();
317 Float_t nSigmaPion = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kPion);
318 Float_t nSigmaProton = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kProton);
319 bool isProton = (nSigmaPion>3.0 && nSigmaProton<3.0 && track->Pt()<0.9);
320 //cout<<"NSigmaProton "<<nSigmaProton<<endl;
321 etPiKPMatched += effCorrEt;
323 if(track->Charge()>0){
324 etPIDProtons += effCorrEt;
327 etPIDAntiProtons += effCorrEt;
330 if(TMath::Sin(cp.Theta())*cluster->E()>0.5){
331 nChargedHadronsMeasured500MeV++;
332 nChargedHadronsTotal500MeV += 1/eff;
333 nChargedHadronsEtMeasured500MeV+= TMath::Sin(cp.Theta())*cluster->E();
334 nChargedHadronsEtTotal500MeV+= 1/eff *TMath::Sin(cp.Theta())*cluster->E();
336 fHistMatchedTracksEvspTvsCent->Fill(track->P(),TMath::Sin(cp.Theta())*cluster->E(),cent);
337 fHistMatchedTracksEvspTvsCentEffCorr->Fill(track->P(),effCorrEt,cent);
338 //Weighed by the number of tracks we didn't find
339 fHistMatchedTracksEvspTvsCentEffTMCorr->Fill(track->P(), effCorrEt,cent, (1/eff-1) );
340 cluster->GetPosition(pos);
342 uncorrEt += TMath::Sin(p2.Theta())*cluster->E();
343 if(uncorrEt>=0.5) fHistMatchedTracksEvspTvsCentEffTMCorr500MeV->Fill(track->P(), effCorrEt,cent, (1/eff-1) );
344 const Double_t *pidWeights = track->PID();
346 Double_t maxpidweight = 0;
351 for (Int_t p =0; p < AliPID::kSPECIES; p++)
353 if (pidWeights[p] > maxpidweight)
355 maxpidweight = pidWeights[p];
359 if (fCuts->GetHistMakeTreeDeposit() && fDepositTree)
361 fEnergyDeposited = cluster->E();
362 fMomentumTPC = track->P();
363 fCharge = track->Charge();
364 fParticlePid = maxpid;
365 fPidProb = maxpidweight;
366 AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track);
368 AliError("Error: track does not exist");
371 if (esdTrack) fTrackPassedCut = fEsdtrackCutsTPC->AcceptTrack(esdTrack);
372 fDepositTree->Fill();
376 if (maxpidweight > fPidCut)
378 //Float_t dist = TMath::Sqrt(pos[0]*pos[0] + pos[1]*pos[1]);
380 //Float_t theta = TMath::ATan(pos[2]/dist)+TMath::Pi()/2;
382 //Float_t et = cluster->E() * TMath::Sin(theta);
383 if (maxpid == AliPID::kProton)
386 if (track->Charge() == 1)
388 fHistProtonEnergyDeposit->Fill(cluster->E(), track->E());
390 else if (track->Charge() == -1)
392 fHistAntiProtonEnergyDeposit->Fill(cluster->E(), track->E());
395 else if (maxpid == AliPID::kPion)
397 fHistChargedPionEnergyDeposit->Fill(cluster->E(), track->E());
399 else if (maxpid == AliPID::kKaon)
401 fHistChargedKaonEnergyDeposit->Fill(cluster->E(), track->E());
403 else if (maxpid == AliPID::kMuon)
405 fHistMuonEnergyDeposit->Fill(cluster->E(), track->E());
413 else{//these are clusters which were not track matched
415 //std::cout << x++ << std::endl;
417 //if (cluster->E() > fSingleCellEnergyCut && cluster->GetNCells() == fCuts->GetCommonSingleCell()) continue;
418 //if (cluster->E() < fClusterEnergyCut) continue;
419 cluster->GetPosition(pos);
423 fClusterPositionAccepted->Fill(p2.Phi(), p2.PseudoRapidity());
424 fClusterPositionAcceptedEnergy->Fill(p2.Phi(), p2.PseudoRapidity(),cluster->E());
425 fClusterEnergy->Fill(cluster->E());
426 fClusterEnergyCentNotMatched->Fill(cluster->E(),cent);
427 fHistClusterSizeVsCent->Fill(cluster->GetNCells(),cent);
428 fClusterEt->Fill(TMath::Sin(p2.Theta())*cluster->E());
429 uncorrEt += TMath::Sin(p2.Theta())*cluster->E();
430 float myuncorrEt = TMath::Sin(p2.Theta())*cluster->E();
431 fTotRawEt += myuncorrEt;
433 Double_t effCorrEt = CorrectForReconstructionEfficiency(*cluster,cent);
434 //cout<<"cluster energy "<<cluster->E()<<" eff corr Et "<<effCorrEt<<endl;
435 fTotNeutralEt += effCorrEt;
436 nominalRawEt += effCorrEt;
438 totEt500MeV += effCorrEt;
439 //cout<<"test "<<myuncorrEt<<"> 0.5"<<endl;
442 //cout<<"test "<<myuncorrEt<<"< 0.5"<<endl;
444 nonlinHighRawEt += effCorrEt*GetCorrectionModification(*cluster,1,0,cent);
445 nonlinLowRawEt += effCorrEt*GetCorrectionModification(*cluster,-1,0,cent);
446 effHighRawEt += effCorrEt*GetCorrectionModification(*cluster,0,1,cent);
447 effLowRawEt += effCorrEt*GetCorrectionModification(*cluster,0,-1,cent);
448 fNeutralMultiplicity++;
453 fHistNClustersPhosVsEmcal->Fill(nPhosClusters,nEmcalClusters,cent);
454 fChargedEnergyRemoved = GetChargedContribution(fNeutralMultiplicity);
455 fNeutralEnergyRemoved = GetNeutralContribution(fNeutralMultiplicity);
456 fHistChargedEnergyRemoved->Fill(fChargedEnergyRemoved, fNeutralMultiplicity);
457 fHistNeutralEnergyRemoved->Fill(fNeutralEnergyRemoved, fNeutralMultiplicity);
459 fGammaEnergyAdded = GetGammaContribution(fNeutralMultiplicity);
460 fHistGammaEnergyAdded->Fill(fGammaEnergyAdded, fNeutralMultiplicity);
462 Double_t removedEnergy = GetChargedContribution(fNeutralMultiplicity) + GetNeutralContribution(fNeutralMultiplicity) + GetGammaContribution(fNeutralMultiplicity) + GetSecondaryContribution(fNeutralMultiplicity);
463 fHistRemovedEnergy->Fill(removedEnergy);
465 fTotNeutralEtAcc = fTotNeutralEt;
466 fHistTotRawEtEffCorr->Fill(fTotNeutralEt,cent);
467 fHistTotRawEt->Fill(fTotRawEt,cent);
468 fHistTotAllRawEt->Fill(fTotAllRawEt,cent);
469 fHistTotAllRawEtVsTotalPt->Fill(fTotAllRawEt,totalPt);
470 fHistTotAllRawEtVsTotalPtVsCent->Fill(fTotAllRawEt,totalPt,cent);
471 fHistTotMatchedRawEtVsTotalPtVsCent->Fill(fTotAllRawEt,totalMatchedPt,cent);
472 fHistTotAllRawEtEffCorr->Fill(fTotAllRawEtEffCorr,cent);
473 //cout<<"uncorr "<<uncorrEt<<" raw "<<nominalRawEt<<" tot raw "<<fTotNeutralEt;
474 fTotNeutralEt = fGeomCorrection * fEMinCorrection * (fTotNeutralEt - removedEnergy);
475 //cout<<" tot corr "<<fTotNeutralEt<<endl;
476 fTotEt = fTotChargedEt + fTotNeutralEt;
477 // Fill the histograms...0
479 //std::cout << "fTotNeutralEt: " << fTotNeutralEt << ", Contribution from non-removed charged: " << GetChargedContribution(fNeutralMultiplicity) << ", neutral: " << GetNeutralContribution(fNeutralMultiplicity) << ", gammas: " << GetGammaContribution(fNeutralMultiplicity) << ", multiplicity: " << fNeutralMultiplicity<< std::endl;
480 //cout<<"cent "<<cent<<" cluster mult "<<fClusterMult<<" fTotNeutralEt "<<fTotNeutralEt<<" nominalRawEt "<<nominalRawEt<<endl;
481 fHistNominalRawEt->Fill(nominalRawEt,cent);
482 fHistTotRawEtEffCorr500MeV->Fill(totEt500MeV,cent);
483 fHistNominalNonLinHighEt->Fill(nonlinHighRawEt,cent);
484 fHistNominalNonLinLowEt->Fill(nonlinLowRawEt,cent);
485 fHistNominalEffHighEt->Fill(effHighRawEt,cent);
486 fHistNominalEffLowEt->Fill(effLowRawEt,cent);
487 fHistFoundHadronsvsCent->Fill(nChargedHadronsMeasured,cent);
488 fHistNotFoundHadronsvsCent->Fill(nChargedHadronsTotal-nChargedHadronsMeasured,cent);
489 fHistFoundHadronsEtvsCent->Fill(nChargedHadronsEtMeasured,cent);
490 fHistNotFoundHadronsEtvsCent->Fill(nChargedHadronsEtTotal-nChargedHadronsEtMeasured,cent);
491 //cout<<"found "<<nChargedHadronsMeasured<<" total "<<nChargedHadronsTotal<<" not found "<<nChargedHadronsTotal-nChargedHadronsMeasured<<" found "<< nChargedHadronsMeasured500MeV<<" not found "<< nChargedHadronsTotal500MeV-nChargedHadronsMeasured500MeV <<" total "<<nChargedHadronsTotal500MeV<<endl;
492 fHistFoundHadronsvsCent500MeV->Fill(nChargedHadronsMeasured500MeV,cent);
493 fHistNotFoundHadronsvsCent500MeV->Fill(nChargedHadronsTotal500MeV-nChargedHadronsMeasured500MeV,cent);
494 fHistFoundHadronsEtvsCent500MeV->Fill(nChargedHadronsEtMeasured500MeV,cent);
495 fHistNotFoundHadronsEtvsCent500MeV->Fill(nChargedHadronsEtTotal500MeV-nChargedHadronsEtMeasured500MeV,cent);
496 // cout<<"Number of hadrons measured: "<<nChargedHadronsMeasured<<" Estimated total number of hadrons "<<nChargedHadronsTotal<<" ET in track matched hadrons "<<
497 // nChargedHadronsEtMeasured;
498 // if(nChargedHadronsMeasured>0)cout<<" ("<<nChargedHadronsEtMeasured/nChargedHadronsMeasured<<") ";
499 // cout<<" ET in all hadrons ";
500 // cout<<nChargedHadronsEtTotal;
501 // if(nChargedHadronsTotal>0) cout<<" ("<<nChargedHadronsEtTotal/nChargedHadronsTotal<<") ";
503 fHistPIDProtonsTrackMatchedDepositedVsNch->Fill(etPIDProtons,multiplicity);
504 fHistPIDAntiProtonsTrackMatchedDepositedVsNch->Fill(etPIDAntiProtons,multiplicity);
505 fHistCentVsNchVsNclReco->Fill(cent,multiplicity,fMultiplicity);
506 fHistPiKPTrackMatchedDepositedVsNch->Fill(etPiKPMatched,multiplicity);
511 bool AliAnalysisEtReconstructed::CheckGoodVertex(AliVParticle* track)
517 AliError("ERROR: no track");
520 AliESDtrack *esdTrack = dynamic_cast<AliESDtrack*>(track);
522 AliError("ERROR: no track");
525 esdTrack->GetImpactParametersTPC(bxy,bz);
528 bool status = (TMath::Abs(track->Xv()) < fCuts->GetReconstructedVertexXCut()) &&
529 (TMath::Abs(track->Yv()) < fCuts->GetReconstructedVertexYCut()) &&
530 (TMath::Abs(track->Zv()) < fCuts->GetReconstructedVertexZCut()) &&
531 (TMath::Abs(bxy) < fCuts->GetReconstructedIPxyCut()) &&
532 (TMath::Abs(bz) < fCuts->GetReconstructedIPzCut());
537 void AliAnalysisEtReconstructed::Init()
539 AliAnalysisEt::Init();
540 fPidCut = fCuts->GetReconstructedPidCut();
541 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
543 cout<<"Warning! You have not set corrections. Your code will crash. You have to set the corrections."<<endl;
547 bool AliAnalysisEtReconstructed::TrackHitsCalorimeter(AliVParticle* track, Double_t magField)
548 { // propagate track to detector radius
550 cout<<"Warning: track empty"<<endl;
553 AliESDtrack *esdTrack= dynamic_cast<AliESDtrack*>(track);
555 AliError("ERROR: no ESD track");
558 // Printf("Propagating track: eta: %f, phi: %f, pt: %f", esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt());
560 Bool_t prop = esdTrack->PropagateTo(fDetectorRadius, magField);
562 // if (prop) Printf("Track propagated, eta: %f, phi: %f, pt: %f", esdTrack->Eta(), esdTrack->Phi(), esdTrack->Pt());
563 return prop && fSelector->CutGeometricalAcceptance(*esdTrack);
566 void AliAnalysisEtReconstructed::FillOutputList(TList* list)
567 { // add some extra histograms to the ones from base class
568 AliAnalysisEt::FillOutputList(list);
570 list->Add(fHistChargedPionEnergyDeposit);
571 list->Add(fHistProtonEnergyDeposit);
572 list->Add(fHistAntiProtonEnergyDeposit);
573 list->Add(fHistChargedKaonEnergyDeposit);
574 list->Add(fHistMuonEnergyDeposit);
576 list->Add(fHistRemovedEnergy);
577 list->Add(fClusterPositionAccepted);
578 list->Add(fClusterPositionAll);
579 list->Add(fClusterPositionAcceptedEnergy);
580 list->Add(fClusterPositionAllEnergy);
581 list->Add(fClusterEnergy);
582 list->Add(fClusterEnergyCent);
583 list->Add(fClusterEnergyCentMatched);
584 list->Add(fClusterEnergyCentNotMatched);
585 list->Add(fClusterEt);
587 list->Add(fHistChargedEnergyRemoved);
588 list->Add(fHistNeutralEnergyRemoved);
589 list->Add(fHistGammaEnergyAdded);
590 list->Add(fHistMatchedTracksEvspTvsCent);
591 list->Add(fHistMatchedTracksEvspTvsCentEffCorr);
592 list->Add(fHistMatchedTracksEvspTvsCentEffTMCorr);
593 list->Add(fHistMatchedTracksEvspTvsCentEffTMCorr500MeV);
594 list->Add(fHistFoundHadronsvsCent);
595 list->Add(fHistNotFoundHadronsvsCent);
596 list->Add(fHistFoundHadronsEtvsCent);
597 list->Add(fHistNotFoundHadronsEtvsCent);
598 list->Add(fHistFoundHadronsvsCent500MeV);
599 list->Add(fHistNotFoundHadronsvsCent500MeV);
600 list->Add(fHistFoundHadronsEtvsCent500MeV);
601 list->Add(fHistNotFoundHadronsEtvsCent500MeV);
602 list->Add(fHistNominalRawEt);
603 list->Add(fHistNominalNonLinHighEt);
604 list->Add(fHistNominalNonLinLowEt);
605 list->Add(fHistNominalEffHighEt);
606 list->Add(fHistNominalEffLowEt);
607 list->Add(fHistTotRawEtEffCorr);
608 list->Add(fHistTotRawEtEffCorr500MeV);
609 list->Add(fHistTotAllRawEtEffCorr);
610 list->Add(fHistTotRawEt);
611 list->Add(fHistTotAllRawEt);
612 list->Add(fHistNClustersPhosVsEmcal);
613 list->Add(fHistClusterSizeVsCent);
614 list->Add(fHistMatchedClusterSizeVsCent);
615 list->Add(fHistTotAllRawEtVsTotalPt);
616 list->Add(fHistTotAllRawEtVsTotalPtVsCent);
617 list->Add(fHistTotMatchedRawEtVsTotalPtVsCent);
618 list->Add(fHistPIDProtonsTrackMatchedDepositedVsNch);
619 list->Add(fHistPIDAntiProtonsTrackMatchedDepositedVsNch);
620 list->Add(fHistPiKPTrackMatchedDepositedVsNch);
621 list->Add(fHistCentVsNchVsNclReco);
624 void AliAnalysisEtReconstructed::CreateHistograms()
625 { // add some extra histograms to the ones from base class
626 AliAnalysisEt::CreateHistograms();
628 Int_t nbinsEt = 1000;
632 // possibly change histogram limits
634 // nbinsEt = fCuts->GetHistNbinsParticleEt();
635 // minEt = fCuts->GetHistMinParticleEt();
636 // maxEt = fCuts->GetHistMaxParticleEt();
640 histname = "fHistChargedPionEnergyDeposit" + fHistogramNameSuffix;
641 fHistChargedPionEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by #pi^{+/-}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
642 fHistChargedPionEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
643 fHistChargedPionEnergyDeposit->SetYTitle("Energy of track");
645 histname = "fHistProtonEnergyDeposit" + fHistogramNameSuffix;
646 fHistProtonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by protons", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
647 fHistProtonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
648 fHistProtonEnergyDeposit->SetYTitle("Energy of track");
650 histname = "fHistAntiProtonEnergyDeposit" + fHistogramNameSuffix;
651 fHistAntiProtonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by anti-protons", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
652 fHistAntiProtonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
653 fHistAntiProtonEnergyDeposit->SetYTitle("Energy of track");
655 histname = "fHistChargedKaonEnergyDeposit" + fHistogramNameSuffix;
656 fHistChargedKaonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by K^{+/-}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
657 fHistChargedKaonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
658 fHistChargedKaonEnergyDeposit->SetYTitle("Energy of track");
660 histname = "fHistMuonEnergyDeposit" + fHistogramNameSuffix;
661 fHistMuonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by #mu^{+/-}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
662 fHistMuonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
663 fHistMuonEnergyDeposit->SetYTitle("Energy of track");
665 histname = "fHistRemovedEnergy" + fHistogramNameSuffix;
666 fHistRemovedEnergy = new TH1F(histname.Data(), histname.Data(), 1000, 0, 20);
667 //fHistMuonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
668 //fHistMuonEnergyDeposit->SetYTitle("Energy of track");
670 histname = "fClusterPositionAccepted" + fHistogramNameSuffix;
671 fClusterPositionAccepted = new TH2D(histname.Data(), "Position of accepted neutral clusters",300, -TMath::Pi(),TMath::Pi(), 100, -0.7 , 0.7);
672 fClusterPositionAccepted->SetXTitle("#phi");
673 fClusterPositionAccepted->SetYTitle("#eta");
675 histname = "fClusterPositionAll" + fHistogramNameSuffix;
676 fClusterPositionAll = new TH2D(histname.Data(), "Position of accepted neutral clusters",300, -TMath::Pi(),TMath::Pi(), 100, -0.7 , 0.7);
677 fClusterPositionAll->SetXTitle("#phi");
678 fClusterPositionAll->SetYTitle("#eta");
680 histname = "fClusterPositionAcceptedEnergy" + fHistogramNameSuffix;
681 fClusterPositionAcceptedEnergy = new TH2D(histname.Data(), "Position of accepted neutral clusters",300, -TMath::Pi(),TMath::Pi(), 100, -0.7 , 0.7);
682 fClusterPositionAcceptedEnergy->SetXTitle("#phi");
683 fClusterPositionAcceptedEnergy->SetYTitle("#eta");
685 histname = "fClusterPositionAllEnergy" + fHistogramNameSuffix;
686 fClusterPositionAllEnergy = new TH2D(histname.Data(), "Position of accepted neutral clusters",300, -TMath::Pi(),TMath::Pi(), 100, -0.7 , 0.7);
687 fClusterPositionAllEnergy->SetXTitle("#phi");
688 fClusterPositionAllEnergy->SetYTitle("#eta");
690 histname = "fClusterEnergy" + fHistogramNameSuffix;
691 fClusterEnergy = new TH1F(histname.Data(), histname.Data(), 100, 0, 5);
692 fClusterEnergy->SetYTitle("Number of clusters");
693 fClusterEnergy->SetXTitle("Energy of cluster");
695 histname = "fClusterEnergyCent" + fHistogramNameSuffix;
696 fClusterEnergyCent = new TH2F(histname.Data(), histname.Data(), 100, 0, 5,20,-0.5,19.5);
697 fClusterEnergyCent->SetXTitle("Energy of cluster");
698 fClusterEnergyCent->SetYTitle("Centrality Bin");
699 fClusterEnergyCent->SetZTitle("Number of clusters");
701 histname = "fClusterEnergyCentMatched" + fHistogramNameSuffix;
702 fClusterEnergyCentMatched = new TH2F(histname.Data(), histname.Data(), 100, 0, 5,20,-0.5,19.5);
703 fClusterEnergyCentMatched->SetXTitle("Energy of cluster");
704 fClusterEnergyCentMatched->SetYTitle("Centrality Bin");
705 fClusterEnergyCentMatched->SetZTitle("Number of Clusters");
707 histname = "fClusterEnergyCentNotMatched" + fHistogramNameSuffix;
708 fClusterEnergyCentNotMatched = new TH2F(histname.Data(), histname.Data(), 100, 0, 5,20,-0.5,19.5);
709 fClusterEnergyCentNotMatched->SetXTitle("Energy of cluster");
710 fClusterEnergyCentNotMatched->SetYTitle("Centrality Bin");
711 fClusterEnergyCentNotMatched->SetZTitle("Number of clusters");
713 histname = "fClusterEt" + fHistogramNameSuffix;
714 fClusterEt = new TH1F(histname.Data(), histname.Data(), 100, 0, 5);
715 fClusterEt->SetXTitle("Number of clusters");
716 fClusterEt->SetYTitle("E_{T} of cluster");
718 histname = "fHistChargedEnergyRemoved" + fHistogramNameSuffix;
719 fHistChargedEnergyRemoved = new TH2D(histname.Data(), histname.Data(), 1000, .0, 30, 100, -0.5 , 99.5);
721 histname = "fHistNeutralEnergyRemoved" + fHistogramNameSuffix;
722 fHistNeutralEnergyRemoved = new TH2D(histname.Data(), histname.Data(), 1000, .0, 30, 100, -0.5 , 99.5);
724 histname = "fHistGammaEnergyAdded" + fHistogramNameSuffix;
725 fHistGammaEnergyAdded = new TH2D(histname.Data(), histname.Data(), 1000, .0, 30, 100, -0.5 , 99.5);
727 fHistMatchedTracksEvspTvsCent = new TH3F("fHistMatchedTracksEvspTvsCent", "fHistMatchedTracksEvspTvsCent",100, 0, 3,100,0,3,20,-0.5,19.5);
728 fHistMatchedTracksEvspTvsCentEffCorr = new TH3F("fHistMatchedTracksEvspTvsCentEffCorr", "fHistMatchedTracksEvspTvsCentEffCorr",100, 0, 3,100,0,3,20,-0.5,19.5);
729 fHistMatchedTracksEvspTvsCentEffTMCorr = new TH3F("fHistMatchedTracksEvspTvsCentEffTMCorr", "fHistMatchedTracksEvspTvsCentEffTMCorr",100, 0, 3,100,0,3,20,-0.5,19.5);
730 fHistMatchedTracksEvspTvsCentEffTMCorr500MeV = new TH3F("fHistMatchedTracksEvspTvsCentEffTMCorr500MeV", "fHistMatchedTracksEvspTvsCentEffTMCorr500MeV",100, 0, 3,100,0,3,20,-0.5,19.5);
733 if(fHistogramNameSuffix.Contains("P")){max = 100;}
734 fHistFoundHadronsvsCent = new TH2F("fHistFoundHadronsvsCent","fHistFoundHadronsvsCent",100,0,max,20,-0.5,19.5);
735 fHistNotFoundHadronsvsCent = new TH2F("fHistNotFoundHadronsvsCent","fHistNotFoundHadronsvsCent",100,0,max,20,-0.5,19.5);
736 fHistFoundHadronsEtvsCent = new TH2F("fHistFoundHadronsEtvsCent","fHistFoundHadronsEtvsCent",100,0,max,20,-0.5,19.5);
737 fHistNotFoundHadronsEtvsCent = new TH2F("fHistNotFoundHadronsEtvsCent","fHistNotFoundHadronsEtvsCent",100,0,max,20,-0.5,19.5);
738 fHistFoundHadronsvsCent500MeV = new TH2F("fHistFoundHadronsvsCent500MeV","fHistFoundHadronsvsCent500MeV",100,0,max,20,-0.5,19.5);
739 fHistNotFoundHadronsvsCent500MeV = new TH2F("fHistNotFoundHadronsvsCent500MeV","fHistNotFoundHadronsvsCent500MeV",100,0,max,20,-0.5,19.5);
740 fHistFoundHadronsEtvsCent500MeV = new TH2F("fHistFoundHadronsEtvsCent500MeV","fHistFoundHadronsEtvsCent500MeV",100,0,max,20,-0.5,19.5);
741 fHistNotFoundHadronsEtvsCent500MeV = new TH2F("fHistNotFoundHadronsEtvsCent500MeV","fHistNotFoundHadronsEtvsCent500MeV",100,0,max,20,-0.5,19.5);
743 fHistTotRawEtEffCorr = new TH2F("fHistTotRawEtEffCorr","fHistTotRawEtEffCorr",250,0,250,20,-0.5,19.5);
744 fHistTotRawEt = new TH2F("fHistTotRawEt","fHistTotRawEt",250,0,250,20,-0.5,19.5);
745 fHistTotRawEtEffCorr500MeV = new TH2F("fHistTotRawEtEffCorr500MeV","fHistTotRawEtEffCorr500MeV",250,0,250,20,-0.5,19.5);
746 fHistTotAllRawEt = new TH2F("fHistTotAllRawEt","fHistTotAllRawEt",250,0,250,20,-0.5,19.5);
747 fHistTotAllRawEtEffCorr = new TH2F("fHistTotAllRawEtEffCorr","fHistTotAllRawEtEffCorr",250,0,250,20,-0.5,19.5);
748 fHistNClustersPhosVsEmcal = new TH3F("fHistNClustersPhosVsEmcal","fHistNClustersPhosVsEmcal",50,0,50,250,0,250,20,-0.5,19);
749 fHistClusterSizeVsCent = new TH2F("fHistClusterSizeVsCent","fHistClusterSizeVsCent",10,0.5,10.5,20,-0.5,19.5);
750 fHistMatchedClusterSizeVsCent = new TH2F("fHistMatchedClusterSizeVsCent","fHistMatchedClusterSizeVsCent",10,0.5,10.5,20,-0.5,19.5);
751 fHistTotAllRawEtVsTotalPt = new TH2F("fHistTotAllRawEtVsTotalPt","fHistTotAllRawEtVsTotalPt",125,0,250,200,0,2000);
752 fHistTotAllRawEtVsTotalPtVsCent = new TH3F("fHistTotAllRawEtVsTotalPtVsCent","fHistTotAllRawEtVsTotalPtVsCent",125,0,250,200,0,2000,20,-0.5,19.5);
753 fHistTotMatchedRawEtVsTotalPtVsCent = new TH3F("fHistTotMatchedRawEtVsTotalPtVsCent","fHistTotMatchedRawEtVsTotalPtVsCent",250,0,250,100,0,200,20,-0.5,19.5);
756 histname = "fHistNominalRawEt" + fHistogramNameSuffix;
757 fHistNominalRawEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
758 histname = "fHistNominalNonLinHighEt" + fHistogramNameSuffix;
759 fHistNominalNonLinHighEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
760 histname = "fHistNominalNonLinLowEt" + fHistogramNameSuffix;
761 fHistNominalNonLinLowEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
762 histname = "fHistNominalEffHighEt" + fHistogramNameSuffix;
763 fHistNominalEffHighEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
764 histname = "fHistNominalEffLowEt" + fHistogramNameSuffix;
765 fHistNominalEffLowEt = new TH2D(histname.Data(), histname.Data(),nbinsEt,minEt,maxEt,20,-0.5,19.5);
767 Float_t maxEtRange = 25;
768 Float_t maxEtRangeHigh = 125;
769 Float_t minEtRange = 0;
770 Int_t nbinsMult = 100;
771 Float_t maxMult = 3000;
776 fHistPIDProtonsTrackMatchedDepositedVsNch = new TH2F("fHistPIDProtonsTrackMatchedDepositedVsNch","PID'd protons deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRange,nbinsMult,minMult,maxMult);
777 fHistPIDAntiProtonsTrackMatchedDepositedVsNch = new TH2F("fHistPIDAntiProtonsTrackMatchedDepositedVsNch","PID'd #bar{p} E_{T} deposited in calorimeter vs multiplicity",nbinsEt,minEtRange,maxEtRange,nbinsMult,minMult,maxMult);
778 fHistPiKPTrackMatchedDepositedVsNch = new TH2F("fHistPiKPTrackMatchedDepositedVsNch","PiKP track matched",nbinsEt,minEtRange,maxEtRangeHigh,nbinsMult,minMult,maxMult);
779 fHistCentVsNchVsNclReco = new TH3F("fHistCentVsNchVsNclReco","Cent bin vs Nch Vs NCl",20,-0.5,19.5,nbinsMult,minMult,maxMult,nbinsCl,minCl,maxCl);
781 Double_t AliAnalysisEtReconstructed::ApplyModifiedCorrections(const AliESDCaloCluster& cluster,Int_t nonLinCorr, Int_t effCorr, Int_t cent)
784 cluster.GetPosition(pos);
786 Double_t corrEnergy = fReCorrections->CorrectedEnergy(cluster.E(),cent);
788 Double_t factorNonLin = GetCorrectionModification(cluster, nonLinCorr,effCorr,cent);
790 cout<<"Warning: This function should not get called!"<<endl;
791 //std::cout << "Original energy: " << cluster.E() << ", corrected energy: " << corrEnergy << std::endl;
792 return TMath::Sin(cp.Theta())*corrEnergy*factorNonLin;
795 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
797 cout<<"Warning: This function should not get called!"<<endl;//this statement is basically here to avoid a compilation warning
800 cout<<"Warning: This function should not get called!"<<endl;//this statement is basically here to avoid a compilation warning
802 return cluster.E()*cent;