14 #include "AliVTrack.h" 33 fPlotOversubtractionHistograms(kFALSE),
34 fDoNotOversubtract(kFALSE),
35 fUseM02SubtractionScheme(kFALSE),
36 fUseConstantSubtraction(kFALSE),
37 fConstantSubtractionValue(0.),
38 fClusterContainerIndexMap(),
39 fParticleContainerIndexMap(),
40 fTrackToContainerMap(),
41 fHistMatchEtaPhiAll(0),
42 fHistMatchEtaPhiAllCl(0),
44 fHistNclusMatchvsCent(0),
49 fHistNClusMatchCent(0)
51 for(
Int_t i=0; i<10; i++) {
68 for(
Int_t j=0; j<4; j++)
72 for(
Int_t j=0; j<9; j++) {
73 for(
Int_t k=0; k<2; k++)
128 for(
Int_t icent=0; icent<nCentChBins; ++icent) {
129 for(
Int_t ipt=0; ipt<9; ++ipt) {
130 for(
Int_t ieta=0; ieta<2; ++ieta) {
131 name = Form(
"fHistMatchEtaPhi_%i_%i_%i",icent,ipt,ieta);
139 name = Form(
"fHistEsubPch_%i",icent);
140 temp = Form(
"%s (Nmatches==1)",name.Data());
142 fHistEsubPch[icent]->SetXTitle(
"#sum p (GeV) weighted with E_{sub}");
143 fOutput->Add(fHistEsubPch[icent]);
145 name = Form(
"fHistEsubPchRat_%i",icent);
146 temp = Form(
"%s (Nmatches==1)",name.Data());
148 fHistEsubPchRat[icent]->SetXTitle(
"#Sigma p (GeV)");
149 fHistEsubPchRat[icent]->SetYTitle(
"E_{sub} / #sum p");
150 fOutput->Add(fHistEsubPchRat[icent]);
153 for(
Int_t itrk=0; itrk<4; ++itrk) {
154 name = Form(
"fHistNCellsEnergy_%i_%i",icent,itrk);
155 temp = Form(
"%s (Nmatches==%d);N_{cells};E_{clus} (GeV)",name.Data(),itrk);
157 fOutput->Add(fHistNCellsEnergy[icent][itrk]);
160 name = Form(
"fHistEsubPchRatAll_%i",icent);
161 temp = Form(
"%s (all Nmatches)",name.Data());
163 fHistEsubPchRatAll[icent]->SetXTitle(
"#Sigma p (GeV)");
164 fHistEsubPchRatAll[icent]->SetYTitle(
"E_{sub} / #sum p");
165 fOutput->Add(fHistEsubPchRatAll[icent]);
167 name = Form(
"fHistMatchEvsP_%i",icent);
168 temp = Form(
"%s (all Nmatches)",name.Data());
170 fHistMatchEvsP[icent]->SetXTitle(
"E_{clus} (GeV)");
171 fHistMatchEvsP[icent]->SetYTitle(
"E_{clus} / #sum p");
172 fOutput->Add(fHistMatchEvsP[icent]);
174 name = Form(
"fHistMatchdRvsEP_%i",icent);
175 temp = Form(
"%s (all Nmatches)",name.Data());
177 fHistMatchdRvsEP[icent]->SetXTitle(
"#Delta R between track and cluster");
178 fHistMatchdRvsEP[icent]->SetYTitle(
"E_{clus} / p");
179 fOutput->Add(fHistMatchdRvsEP[icent]);
181 name = Form(
"fHistNMatchEnergy_%i",icent);
189 fHistNclusvsCent =
new TH1F(
"Nclusvscent",
"NclusVsCent; Cent (%)", 100, 0, 100);
190 fHistNclusMatchvsCent =
new TH1F(
"NclusMatchvscent",
"NclusMatchVsCent (all Nmatches); Cent (%)", 100, 0, 100);
191 fHistEbefore =
new TH1F(
"Ebefore",
"Ebefore; Cent (%); E_{clus} (GeV)", 100, 0, 100);
192 fHistEafter =
new TH1F(
"Eafter",
"Eafter; Cent (%); E_{clus} (GeV)", 100, 0, 100);
194 fHistNMatchCent =
new TH2F(
"NMatchesCent",
"NMatchesCent; Cent (%); Nmatches", 100, 0, 100, 11, -0.5, 10.5);
195 fHistNClusMatchCent =
new TH2F(
"NClusMatchesCent",
"NClusMatchesCent; Cent (%); Nmatches", 100, 0, 100, 11, -0.5, 10.5);
207 name = Form(
"fHistEmbTrackMatchesOversub_%d",icent);
213 name = Form(
"fHistNonEmbTrackMatchesOversub_%d",icent);
219 name = Form(
"fHistOversubMCClusters_%d",icent);
225 name = Form(
"fHistOversubNonMCClusters_%d",icent);
231 name = Form(
"fHistOversub_%d",icent);
233 fHistOversub[icent]->GetXaxis()->SetTitle(
"E_{clus}^{raw} (GeV)");
234 fHistOversub[icent]->GetYaxis()->SetTitle(
"E_{oversub} / E_{clus}^{raw}");
266 AliVCluster *cluster = 0;
269 while ((clusCont = static_cast<AliClusterContainer*>(nextClusCont()))) {
272 cluster =
static_cast<AliVCluster *
>(clusIterator->second);
290 energyclus = cluster->GetNonLinCorrEnergy();
293 if (energyclus < 0) energyclus = 0;
295 cluster->SetHadCorrEnergy(energyclus);
323 if (!partCont) { AliErrorStream() <<
"Failed to retrieve particle container at index " << i <<
"\n"; }
326 AliVTrack * track =
static_cast<AliVTrack *
>(partCont->
GetParticle(j));
340 else if (p>=0.5 && p<1.0)
342 else if (p>=1.0 && p<1.5)
344 else if (p>=1.5 && p<2.)
346 else if (p>=2. && p<3.)
348 else if (p>=3. && p<4.)
350 else if (p>=4. && p<5.)
352 else if (p>=5. && p<8.)
365 Double_t EtaSigma[9]={0.0097,0.0075,0.0059,0.0055,0.0053,0.005,0.005,0.0045,0.0042};
366 return 2.0*EtaSigma[pbin];
384 return PhiMean[pbin];
385 }
else if (centbin==1) {
395 return PhiMean[pbin];
396 }
else if (centbin==2) {
406 return PhiMean[pbin];
407 }
else if (centbin==3) {
417 return PhiMean[pbin];
418 }
else if (centbin==4) {
428 return PhiMean[pbin]*(-1.);
429 }
else if (centbin==5) {
439 return PhiMean[pbin]*(-1.);
440 }
else if (centbin==6) {
450 return PhiMean[pbin]*(-1.);
451 }
else if (centbin==7) {
461 return PhiMean[pbin]*(-1.);
482 return 2.*PhiSigma[pbin];
483 }
else if (centbin==1) {
493 return 2.*PhiSigma[pbin];
494 }
else if (centbin==2) {
504 return 2.*PhiSigma[pbin];
505 }
else if (centbin==3) {
515 return 2.*PhiSigma[pbin];
516 }
else if (centbin==4) {
526 return 2.*PhiSigma[pbin];
527 }
else if (centbin==5) {
537 return 2.*PhiSigma[pbin];
538 }
else if (centbin==6) {
548 return 2.*PhiSigma[pbin];
549 }
else if (centbin==7) {
559 return 2.*PhiSigma[pbin];
573 if (!cluster)
return;
576 Int_t Ntrks = cluster->GetNTracksMatched();
577 for (
Int_t i = 0; i < Ntrks; ++i) {
578 AliVTrack* track = 0;
581 Int_t itrack = cluster->GetTrackMatchedIndex(i);
584 track =
static_cast<AliVTrack*
>(res.second->GetAcceptParticle(res.first));
588 track =
static_cast<AliVTrack*
>(cluster->GetTrackMatched(i));
589 UInt_t rejectionReason = 0;
591 if (!partCont) { AliErrorStream() <<
"Requested particle container not available!\n"; }
595 if (!track)
continue;
603 if (
fDoTrackClus && (track->GetEMCALcluster() != icluster))
continue;
609 if (track->Charge() < 0) centbinch +=
fNcentBins;
613 if (track->Eta() > 0) etabin=1;
638 if ((phidiff < phiCuthi && phidiff > phiCutlo) && TMath::Abs(etadiff) < etaCut) {
651 Double_t dR = TMath::Sqrt(dphi*dphi + deta*deta);
652 Double_t energyclus = cluster->GetNonLinCorrEnergy();
659 if (totalTrkP > 0) trkPMCfrac /= totalTrkP;
669 Double_t energyclus = cluster->GetNonLinCorrEnergy();
671 AliVTrack* track = 0;
673 if (cluster->GetNTracksMatched() > 0) {
675 Int_t itrack = cluster->GetTrackMatchedIndex(0);
678 track =
static_cast<AliVTrack*
>(res.second->GetAcceptParticle(res.first));
682 track =
static_cast<AliVTrack*
>(cluster->GetTrackMatched(0));
683 UInt_t rejectionReason = 0;
685 if (!partCont) { AliErrorStream() <<
"Requested particle container not available!\n"; }
690 if (!track || track->P() < 1e-6)
return energyclus;
701 Int_t cid = track->GetEMCALcluster();
702 if (
fDoTrackClus && (cid != icluster))
return energyclus;
706 if (track->Charge() < 0) centbinch +=
fNcentBins;
711 if(track->Eta() > 0) etabin = 1;
720 Double_t dRmin = TMath::Sqrt(etadiff*etadiff + phidiff*phidiff);
747 if ((dPhiMin < phiCuthi && dPhiMin > phiCutlo) && TMath::Abs(dEtaMin) < etaCut) {
748 energyclus -= hadCorr * mom;
761 Double_t energyclus = cluster->GetNonLinCorrEnergy();
762 Double_t cNcells = cluster->GetNCells();
768 Int_t NMCmatches = 0;
773 Double_t Esub = hadCorr * totalTrkP;
775 if (Esub > energyclus) Esub = energyclus;
780 if (energyclus < clusEexcl) clusEexcl = energyclus;
781 if ((energyclus - Esub) < clusEexcl) Esub = (energyclus - clusEexcl);
798 EsubMC = hadCorr * totalTrkP * trkPMCfrac;
799 EsubBkg = hadCorr * totalTrkP - EsubMC;
800 EclusMC = energyclus * cluster->GetMCEnergyFraction();
801 EclusBkg = energyclus - EclusMC;
803 if (energyclus > Esub)
804 EclusCorr = energyclus - Esub;
806 if (EclusMC > EsubMC)
807 EclusMCcorr = EclusMC - EsubMC;
809 if (EclusBkg > EsubBkg)
810 EclusBkgcorr = EclusBkg - EsubBkg;
812 overSub = EclusMCcorr + EclusBkgcorr - EclusCorr;
830 Double_t EoP = energyclus / totalTrkP;
837 AliVTrack* track = 0;
839 Int_t itrack = cluster->GetTrackMatchedIndex(0);
842 track =
static_cast<AliVTrack*
>(res.second->GetAcceptParticle(res.first));
846 track =
static_cast<AliVTrack*
>(cluster->GetTrackMatched(0));
847 UInt_t rejectionReason = 0;
849 if (!partCont) { AliErrorStream() <<
"Requested particle container not available!\n"; }
854 if (track->Charge() < 0) centbinchm +=
fNcentBins;
863 if (cluster->GetMCEnergyFraction() > 0.95)
865 else if (cluster->GetMCEnergyFraction() < 0.05)
868 if (trkPMCfrac < 0.05)
870 else if (trkPMCfrac > 0.95)
878 if (EclusBkgcorr + EclusMCcorr > 0) {
879 Double_t newfrac = EclusMCcorr / (EclusBkgcorr + EclusMCcorr);
880 cluster->SetMCEnergyFraction(newfrac);
896 Double_t clusM02 = cluster->GetM02();
901 if (clusM02 > 0.1 && clusM02 < 0.4) {
916 else if (Nmatches == 1) {
921 Esub = hadCorr * totalTrkP;
924 else if (Nmatches > 1) {
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%)
Int_t GetNParticles() const
Bool_t fUseConstantSubtraction
Flag to perform constant rather than fractional subtract (only applicable if using M02 scheme) ...
static RegisterCorrectionComponent< AliEmcalCorrectionClusterHadronicCorrection > reg
TH2 * fHistOversubNonMCClusters[5]
!Over-subtracted energy / cluster energy (cluster MC energy fraction < 5%)
virtual void UserCreateOutputObjects()
Bool_t fDoNotOversubtract
do not oversubtract energy from cluster (embedding only)
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
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) ...
virtual AliVParticle * GetParticle(Int_t i=-1) const
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.
std::map< AliVTrack *, AliParticleContainer * > fTrackToContainerMap
! Mapping between AliVTracks and their respective particle containers. Needed for AODs only...
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.
Bool_t fPlotOversubtractionHistograms
compute and plot oversubtracted energy from embedded/signal matches (embedding only) ...
TList * fOutput
! List of output histograms
Double_t ComputeM02Subtraction(const AliVCluster *cluster, Double_t energyclus, Int_t Nmatches, Double_t totalTrkP, Double_t hadCorr)
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)
void GenerateTrackToContainerMap()
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
Bool_t fUseM02SubtractionScheme
Flag to enable hadronic correction scheme using cluster M02 value.
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.
Double_t fConstantSubtractionValue
Value to be used for constant subtraction (only applicable if using constant subtraction in M02 schem...