11 #include "AliVTrack.h"
31 fClusterContainerIndexMap(),
32 fParticleContainerIndexMap(),
33 fHistMatchEtaPhiAll(0),
34 fHistMatchEtaPhiAllCl(0),
36 fHistNclusMatchvsCent(0),
41 fHistNClusMatchCent(0)
43 for(
Int_t i=0; i<10; i++) {
60 for(
Int_t j=0; j<4; j++)
64 for(
Int_t j=0; j<9; j++) {
65 for(
Int_t k=0; k<2; k++)
94 AliWarning(
"================================================================================");
95 AliWarning(
"== Added multiple particle containers when running with AOD!");
96 AliWarning(
"== Particle selection of the first particle container will be applied");
97 AliWarning(
"== to _ALL_ particles! If you need a different selection, then change");
98 AliWarning(
"== the order of adding the containers so that the desired container is first!");
99 AliWarning(
"================================================================================");
125 for(
Int_t icent=0; icent<nCentChBins; ++icent) {
126 for(
Int_t ipt=0; ipt<9; ++ipt) {
127 for(
Int_t ieta=0; ieta<2; ++ieta) {
128 name = Form(
"fHistMatchEtaPhi_%i_%i_%i",icent,ipt,ieta);
136 name = Form(
"fHistEsubPch_%i",icent);
137 temp = Form(
"%s (Nmatches==1)",name.Data());
139 fHistEsubPch[icent]->SetXTitle(
"#sum p (GeV) weighted with E_{sub}");
140 fOutput->Add(fHistEsubPch[icent]);
142 name = Form(
"fHistEsubPchRat_%i",icent);
143 temp = Form(
"%s (Nmatches==1)",name.Data());
145 fHistEsubPchRat[icent]->SetXTitle(
"#Sigma p (GeV)");
146 fHistEsubPchRat[icent]->SetYTitle(
"E_{sub} / #sum p");
147 fOutput->Add(fHistEsubPchRat[icent]);
150 for(
Int_t itrk=0; itrk<4; ++itrk) {
151 name = Form(
"fHistNCellsEnergy_%i_%i",icent,itrk);
152 temp = Form(
"%s (Nmatches==%d);N_{cells};E_{clus} (GeV)",name.Data(),itrk);
154 fOutput->Add(fHistNCellsEnergy[icent][itrk]);
157 name = Form(
"fHistEsubPchRatAll_%i",icent);
158 temp = Form(
"%s (all Nmatches)",name.Data());
160 fHistEsubPchRatAll[icent]->SetXTitle(
"#Sigma p (GeV)");
161 fHistEsubPchRatAll[icent]->SetYTitle(
"E_{sub} / #sum p");
162 fOutput->Add(fHistEsubPchRatAll[icent]);
164 name = Form(
"fHistMatchEvsP_%i",icent);
165 temp = Form(
"%s (all Nmatches)",name.Data());
167 fHistMatchEvsP[icent]->SetXTitle(
"E_{clus} (GeV)");
168 fHistMatchEvsP[icent]->SetYTitle(
"E_{clus} / #sum p");
169 fOutput->Add(fHistMatchEvsP[icent]);
171 name = Form(
"fHistMatchdRvsEP_%i",icent);
172 temp = Form(
"%s (all Nmatches)",name.Data());
174 fHistMatchdRvsEP[icent]->SetXTitle(
"#Delta R between track and cluster");
175 fHistMatchdRvsEP[icent]->SetYTitle(
"E_{clus} / p");
176 fOutput->Add(fHistMatchdRvsEP[icent]);
178 name = Form(
"fHistNMatchEnergy_%i",icent);
186 fHistNclusvsCent =
new TH1F(
"Nclusvscent",
"NclusVsCent; Cent (%)", 100, 0, 100);
187 fHistNclusMatchvsCent =
new TH1F(
"NclusMatchvscent",
"NclusMatchVsCent (all Nmatches); Cent (%)", 100, 0, 100);
188 fHistEbefore =
new TH1F(
"Ebefore",
"Ebefore; Cent (%); E_{clus} (GeV)", 100, 0, 100);
189 fHistEafter =
new TH1F(
"Eafter",
"Eafter; Cent (%); E_{clus} (GeV)", 100, 0, 100);
191 fHistNMatchCent =
new TH2F(
"NMatchesCent",
"NMatchesCent; Cent (%); Nmatches", 100, 0, 100, 11, -0.5, 10.5);
192 fHistNClusMatchCent =
new TH2F(
"NClusMatchesCent",
"NClusMatchesCent; Cent (%); Nmatches", 100, 0, 100, 11, -0.5, 10.5);
204 name = Form(
"fHistEmbTrackMatchesOversub_%d",icent);
210 name = Form(
"fHistNonEmbTrackMatchesOversub_%d",icent);
216 name = Form(
"fHistOversubMCClusters_%d",icent);
222 name = Form(
"fHistOversubNonMCClusters_%d",icent);
228 name = Form(
"fHistOversub_%d",icent);
230 fHistOversub[icent]->GetXaxis()->SetTitle(
"E_{clus}^{raw} (GeV)");
231 fHistOversub[icent]->GetYaxis()->SetTitle(
"E_{oversub} / E_{clus}^{raw}");
256 AliVCluster *cluster = 0;
259 while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
262 cluster =
static_cast<AliVCluster *
>(clusIterator->second);
280 energyclus = cluster->GetNonLinCorrEnergy();
283 if (energyclus < 0) energyclus = 0;
285 cluster->SetHadCorrEnergy(energyclus);
303 else if (p>=0.5 && p<1.0)
305 else if (p>=1.0 && p<1.5)
307 else if (p>=1.5 && p<2.)
309 else if (p>=2. && p<3.)
311 else if (p>=3. && p<4.)
313 else if (p>=4. && p<5.)
315 else if (p>=5. && p<8.)
328 Double_t EtaSigma[9]={0.0097,0.0075,0.0059,0.0055,0.0053,0.005,0.005,0.0045,0.0042};
329 return 2.0*EtaSigma[pbin];
347 return PhiMean[pbin];
348 }
else if (centbin==1) {
358 return PhiMean[pbin];
359 }
else if (centbin==2) {
369 return PhiMean[pbin];
370 }
else if (centbin==3) {
380 return PhiMean[pbin];
381 }
else if (centbin==4) {
391 return PhiMean[pbin]*(-1.);
392 }
else if (centbin==5) {
402 return PhiMean[pbin]*(-1.);
403 }
else if (centbin==6) {
413 return PhiMean[pbin]*(-1.);
414 }
else if (centbin==7) {
424 return PhiMean[pbin]*(-1.);
445 return 2.*PhiSigma[pbin];
446 }
else if (centbin==1) {
456 return 2.*PhiSigma[pbin];
457 }
else if (centbin==2) {
467 return 2.*PhiSigma[pbin];
468 }
else if (centbin==3) {
478 return 2.*PhiSigma[pbin];
479 }
else if (centbin==4) {
489 return 2.*PhiSigma[pbin];
490 }
else if (centbin==5) {
500 return 2.*PhiSigma[pbin];
501 }
else if (centbin==6) {
511 return 2.*PhiSigma[pbin];
512 }
else if (centbin==7) {
522 return 2.*PhiSigma[pbin];
536 if (!cluster)
return;
539 Int_t Ntrks = cluster->GetNTracksMatched();
540 for (
Int_t i = 0; i < Ntrks; ++i) {
541 AliVTrack* track = 0;
544 Int_t itrack = cluster->GetTrackMatchedIndex(i);
547 track =
static_cast<AliVTrack*
>(res.second->GetAcceptParticle(res.first));
551 track =
static_cast<AliVTrack*
>(cluster->GetTrackMatched(i));
552 UInt_t rejectionReason = 0;
554 if (!partCont) { AliError(
"No particle container available!"); }
558 if (!track)
continue;
566 if (
fDoTrackClus && (track->GetEMCALcluster() != icluster))
continue;
572 if (track->Charge() < 0) centbinch +=
fNcentBins;
576 if (track->Eta() > 0) etabin=1;
601 if ((phidiff < phiCuthi && phidiff > phiCutlo) && TMath::Abs(etadiff) < etaCut) {
614 Double_t dR = TMath::Sqrt(dphi*dphi + deta*deta);
615 Double_t energyclus = cluster->GetNonLinCorrEnergy();
622 if (totalTrkP > 0) trkPMCfrac /= totalTrkP;
632 Double_t energyclus = cluster->GetNonLinCorrEnergy();
634 AliVTrack* track = 0;
636 if (cluster->GetNTracksMatched() > 0) {
638 Int_t itrack = cluster->GetTrackMatchedIndex(0);
641 track =
static_cast<AliVTrack*
>(res.second->GetAcceptParticle(res.first));
645 track =
static_cast<AliVTrack*
>(cluster->GetTrackMatched(0));
646 UInt_t rejectionReason = 0;
648 if (!partCont) { AliError(
"No particle container available!"); }
653 if (!track || track->P() < 1e-6)
return energyclus;
664 Int_t cid = track->GetEMCALcluster();
665 if (
fDoTrackClus && (cid != icluster))
return energyclus;
669 if (track->Charge() < 0) centbinch +=
fNcentBins;
674 if(track->Eta() > 0) etabin = 1;
683 Double_t dRmin = TMath::Sqrt(etadiff*etadiff + phidiff*phidiff);
710 if ((dPhiMin < phiCuthi && dPhiMin > phiCutlo) && TMath::Abs(dEtaMin) < etaCut) {
711 energyclus -= hadCorr * mom;
724 Double_t energyclus = cluster->GetNonLinCorrEnergy();
725 Double_t cNcells = cluster->GetNCells();
731 Int_t NMCmatches = 0;
736 Double_t Esub = hadCorr * totalTrkP;
738 if (Esub > energyclus) Esub = energyclus;
743 if (energyclus < clusEexcl) clusEexcl = energyclus;
744 if ((energyclus - Esub) < clusEexcl) Esub = (energyclus - clusEexcl);
756 EsubMC = hadCorr * totalTrkP * trkPMCfrac;
757 EsubBkg = hadCorr * totalTrkP - EsubMC;
758 EclusMC = energyclus * cluster->GetMCEnergyFraction();
759 EclusBkg = energyclus - EclusMC;
761 if (energyclus > Esub)
762 EclusCorr = energyclus - Esub;
764 if (EclusMC > EsubMC)
765 EclusMCcorr = EclusMC - EsubMC;
767 if (EclusBkg > EsubBkg)
768 EclusBkgcorr = EclusBkg - EsubBkg;
770 overSub = EclusMCcorr + EclusBkgcorr - EclusCorr;
788 Double_t EoP = energyclus / totalTrkP;
795 AliVTrack* track = 0;
797 Int_t itrack = cluster->GetTrackMatchedIndex(0);
800 track =
static_cast<AliVTrack*
>(res.second->GetAcceptParticle(res.first));
804 track =
static_cast<AliVTrack*
>(cluster->GetTrackMatched(0));
805 UInt_t rejectionReason = 0;
807 if (!partCont) { AliError(
"No particle container available!"); }
812 if (track->Charge() < 0) centbinchm +=
fNcentBins;
821 if (cluster->GetMCEnergyFraction() > 0.95)
823 else if (cluster->GetMCEnergyFraction() < 0.05)
826 if (trkPMCfrac < 0.05)
828 else if (trkPMCfrac > 0.95)
836 if (EclusBkgcorr + EclusMCcorr > 0) {
837 Double_t newfrac = EclusMCcorr / (EclusBkgcorr + EclusMCcorr);
838 cluster->SetMCEnergyFraction(newfrac);
Int_t fNcentBins
How many centrality bins (this member copied from AliAnalysisTaskEmcal)
Bool_t fEsdMode
flag for ESD
Double_t fHadCorr
hadronic correction (fraction)
AliParticleContainer * GetParticleContainer(Int_t i=0) const
TH2 * fHistMatchEtaPhiAll
!deta vs. dphi of matched cluster-track pairs
TH2 * fHistMatchEtaPhi[10][9][2]
!deta vs. dphi of matched cluster-track pairs
const AliClusterIterableMomentumContainer accepted_momentum() const
TH2 * fHistNonEmbTrackMatchesOversub[5]
!Over-subtracted energy / cluster energy with non-embedded track matches (embedded matches < 5%) ...
bidirectional stl iterator over the EMCAL iterable container
TH2 * fHistNMatchEnergy[5]
!n matches vs. cluster energy
std::pair< int, U * > LocalIndexFromGlobalIndex(const int globalIndex) const
TH2 * fHistOversubMCClusters[5]
!Over-subtracted energy / cluster energy (cluster MC energy fraction > 95%)
static RegisterCorrectionComponent< AliEmcalCorrectionClusterHadronicCorrection > reg
TH2 * fHistOversubNonMCClusters[5]
!Over-subtracted energy / cluster energy (cluster MC energy fraction < 5%)
virtual void UserCreateOutputObjects()
AliEmcalContainerIndexMap< AliClusterContainer, AliVCluster > fClusterContainerIndexMap
! Mapping between index and cluster containers
TH2 * fHistMatchEvsP[5]
!cluster energy vs. track momentum of matched pairs
Int_t fCentBin
! Event centrality bin
int GlobalIndexFromLocalIndex(const U *inputObject, const int localIndex) const
TH1 * fHistEsubPch[10]
!Esub vs. total momentum of matched tracks (only 1 match)
Container for particles within the EMCAL framework.
Double_t fEtaMatch
eta match value (pp=0.025)
TObjArray fParticleCollArray
Particle/track collection array.
Double_t ApplyHadCorrOneTrack(Int_t icluster, Double_t hadCorr)
TObjArray fClusterCollArray
Cluster collection array.
TH1 * fHistEafter
!average energy of clusters after correction vs. centrality
TH2 * fHistEsubPchRatAll[5]
!Esub/momentum of matched tracks vs. total momentum of matched tracks (all number of matches) ...
Double_t ApplyHadCorrAllTracks(Int_t icluster, Double_t hadCorr)
TH2 * fHistNCellsEnergy[5][4]
!n cells vs. cluster energy
Bool_t fDoExact
do exact correction (embedding only)
Base class for correction components in the EMCal correction framework.
TH2 * fHistEsubPchRat[10]
!Esub/momentum of matched tracks vs. total momentum of matched tracks (only 1 match) ...
Double_t fEexclCell
energy/cell that we cannot subtract from the clusters
TH2 * fHistNMatchCent
!n matches vs. centraity
static const AliEmcalContainerIndexMap< TClonesArray, AliVCluster > & GetEmcalContainerIndexMap()
Get the EMCal container utils associated with particle containers.
Int_t fMinMCLabel
Minimum MC label value for the tracks/clusters being considered MC particles.
TH2 * fHistEoPCent
!E/P vs. centrality
V * GetObjectFromGlobalIndex(const int globalIndex) const
Double_t fPhiMatch
phi match value (pp=0.050)
virtual Bool_t AcceptParticle(const AliVParticle *vp, UInt_t &rejectionReason) const
AliEmcalCorrectionClusterHadronicCorrection()
Double_t GetPhiSigma(Int_t pbin, Int_t centbin) const
Double_t fMaxBinPt
Max pt in histograms.
TList * fOutput
! List of output histograms
Bool_t fCreateHisto
Flag to make some basic histograms.
Hadronic correction component in the EMCal correction framework.
TH1 * fHistEbefore
!average energy of clusters before correction vs. centrality
Double_t GetEtaSigma(Int_t pbin) const
Double_t fCent
! Event centrality
virtual Bool_t Initialize()
void DoMatchedTracksLoop(Int_t icluster, Double_t &totalTrkP, Int_t &Nmatches, Double_t &trkPMCfrac, Int_t &NMCmatches)
Double_t fMinBinPt
Min pt in histograms.
void CopyMappingFrom(const AliEmcalContainerIndexMap< U2, V > &map, U *cont)
TH1 * fHistNclusMatchvsCent
!n clusters matched to some track vs. centrality
TH2 * fHistMatchdRvsEP[5]
!matching distance vs. E/P
void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
Bool_t fDoTrackClus
loop over tracks first
Int_t fNbins
No. of pt bins.
AliEmcalContainerIndexMap< AliParticleContainer, AliVParticle > fParticleContainerIndexMap
! Mapping between index and particle containers
Container structure for EMCAL clusters.
TH2 * fHistOversub[5]
!Over-subtracted energy / cluster energy
TH2 * fHistEmbTrackMatchesOversub[5]
!Over-subtracted energy / cluster energy with embedded track matches (non-embedded matches < 5%) ...
void UserCreateOutputObjects()
UInt_t GetMomBin(Double_t pt) const
TH1 * fHistNclusvsCent
!n clusters vs. centrality
static const AliEmcalContainerIndexMap< TClonesArray, AliVParticle > & GetEmcalContainerIndexMap()
Get the EMCal container utils associated with particle containers.
TH2 * fHistMatchEtaPhiAllCl
!deta vs. dphi of all cluster-track pairs (cl loop)
virtual ~AliEmcalCorrectionClusterHadronicCorrection()
Double_t GetPhiMean(Int_t pbin, Int_t centbin) const
TH2 * fHistNClusMatchCent
!n clusters macthed to some track (tracks allowed to match more than one cluster) ...
bool GetProperty(std::string propertyName, T &property, bool requiredProperty=true, std::string correctionName="")
Retrieve property.
Bool_t fIsEmbedded
Trigger, embedded signal.