11 #include "AliEMCALRecoUtils.h"
12 #include "AliESDCaloCluster.h"
13 #include "AliAODCaloCluster.h"
14 #include "AliVParticle.h"
16 #include "AliEMCALGeometry.h"
29 fDoPropagation(kFALSE),
31 fAttemptPropMatch(kFALSE),
34 fUpdateClusters(kTRUE),
43 AliDebug(3, Form(
"%s", __PRETTY_FUNCTION__));
45 for(
Int_t icent=0; icent<8; ++icent) {
46 for(
Int_t ipt=0; ipt<9; ++ipt) {
47 for(
Int_t ieta=0; ieta<2; ++ieta) {
66 AliDebug(3, Form(
"%s", __PRETTY_FUNCTION__));
85 AliDebug(3, Form(
"%s", __PRETTY_FUNCTION__));
95 fHistMatchEtaAll =
new TH1F(
"fHistMatchEtaAll",
"fHistMatchEtaAll", 400, -0.2, 0.2);
96 fHistMatchPhiAll =
new TH1F(
"fHistMatchPhiAll",
"fHistMatchPhiAll", 400, -0.2, 0.2);
101 for(
Int_t icent=0; icent<nCentChBins; ++icent) {
102 for(
Int_t ipt=0; ipt<9; ++ipt) {
103 for(
Int_t ieta=0; ieta<2; ++ieta) {
104 TString nameEta(Form(
"fHistMatchEta_%i_%i_%i",icent,ipt,ieta));
105 fHistMatchEta[icent][ipt][ieta] =
new TH1F(nameEta, nameEta, 400, -0.2, 0.2);
107 TString namePhi(Form(
"fHistMatchPhi_%i_%i_%i",icent,ipt,ieta));
108 fHistMatchPhi[icent][ipt][ieta] =
new TH1F(namePhi, namePhi, 400, -0.2, 0.2);
123 AliDebug(3, Form(
"%s", __PRETTY_FUNCTION__));
143 else if (p>=0.5 && p<1.0)
145 else if (p>=1.0 && p<1.5)
147 else if (p>=1.5 && p<2.)
149 else if (p>=2. && p<3.)
151 else if (p>=3. && p<4.)
153 else if (p>=4. && p<5.)
155 else if (p>=5. && p<8.)
175 AliVCluster* cluster = 0;
176 AliVTrack* track = 0;
182 cluster->SetEmcCpvDistance(-1);
183 cluster->SetTrackDistance(1024, 1024);
184 AliAODCaloCluster *ac =
dynamic_cast<AliAODCaloCluster*
>(cluster);
185 AliESDCaloCluster *ec = 0;
187 const Int_t N = ac->GetNTracksMatched();
188 AliDebug(2, TString::Format(
"Number of matched tracks: %d", N));
189 for (
Int_t i = N - 1; i >= 0; i--) {
190 TObject *ptr = ac->GetTrackMatched(i);
191 ac->RemoveTrackMatched(ptr);
192 AliDebug(2, TString::Format(
"N tracks matched: %i of %i", ac->GetNTracksMatched(), N));
196 ec =
dynamic_cast<AliESDCaloCluster*
>(cluster);
197 TArrayI *arr = ec->GetTracksMatched();
198 if (arr) arr->Set(0);
213 track->ResetStatus(AliVTrack::kEMCALmatch);
214 track->SetEMCALcluster(-1);
217 Bool_t propthistrack = kFALSE;
219 propthistrack = kTRUE;
221 else if (!track->IsExtrapolatedToEMCAL()) {
223 propthistrack = kTRUE;
226 propthistrack = kTRUE;
229 if (propthistrack) AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(track,
fPropDist);
235 AliDebug(2, Form(
"Now adding track (pT = %.3f, eta = %.3f, phi = %.3f)"
236 "Phi, Eta on EMCal = %.3f, %.3f",
237 emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi(),
238 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal()));
252 AliVTrack* track = emcalTrack->
GetTrack();
256 AliVCluster* cluster = emcalCluster->
GetCluster();
261 Double_t d2 = deta * deta + dphi * dphi;
263 if (d2 > maxd2)
continue;
268 AliDebug(2, Form(
"Now matching cluster E = %.3f, pT = %.3f, eta = %.3f, phi = %.3f "
269 "with track pT = %.3f, eta = %.3f, phi = %.3f"
270 "Track eta, phi on EMCal = %.3f, %.3f, d = %.3f",
271 cluster->GetNonLinCorrEnergy(), emcalCluster->
Pt(), emcalCluster->
Eta(), emcalCluster->
Phi(),
272 emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi(),
273 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), d));
278 if (track->Charge() < 0) centbinch +=
fNcentBins;
280 if(track->Eta() > 0) etabin = 1;
299 AliVCluster* cluster = emcalCluster->
GetCluster();
300 AliDebug(3, Form(
"Cluster E = %.2f, eta = %.2f, phi = %.2f, Nmatch = %d", cluster->GetNonLinCorrEnergy(), emcalCluster->
Eta(), emcalCluster->
Phi(), N));
302 if (N <= 0)
continue;
307 AliVTrack* trackFirstMatch = emcalTrackFirstMatch->
GetTrack();
311 cluster->SetTrackDistance(dphi, deta);
314 AliAODCaloCluster *ac =
dynamic_cast<AliAODCaloCluster*
>(cluster);
315 AliESDCaloCluster *ec = 0;
316 if (!ac) ec =
dynamic_cast<AliESDCaloCluster*
>(cluster);
324 for (
Int_t i=0; i < N; ++i) {
328 AliDebug(3, Form(
"Pt = %.2f, eta = %.2f, phi = %.2f", emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi()));
337 ac->AddTrackMatched(obj);
342 for (
Int_t i = 0; i < N; ++i) {
347 ec->AddTracksMatched(arr);
364 AliVTrack* track = emcalTrack->
GetTrack();
366 track->SetStatus(AliVTrack::kEMCALmatch);
381 AliWarning(Form(
"%s - AliAnalysisTaskEmcal::IsTrackInEmcalAcceptance - Geometry is not available!", GetName()));
388 if (part->Phi() > minPhi && part->Phi() < maxPhi) {
Bool_t fUpdateClusters
update clusters with matching info
Int_t fNcentBins
How many centrality bins (this member copied from AliAnalysisTaskEmcal)
Bool_t fEsdMode
flag for ESD
virtual ~AliEmcalCorrectionClusterTrackMatcher()
Double_t fPropDist
distance to surface (440cm default)
AliEMCALGeometry * fGeom
! Geometry object
virtual AliVParticle * GetNextAcceptParticle()
Bool_t fAttemptProp
if true then attempt to propagate if not done yet
Bool_t fUpdateTracks
update tracks with matching info
Int_t GetMatchedObjId(UShort_t i=0) const
Int_t fNEmcalClusters
!number of emcal clusters
UShort_t GetNumberOfMatchedObj() const
Bool_t fAttemptPropMatch
if true then attempt to propagate if not done yet but IsEMCAL is true
void SetMatchedPtr(TObjArray *arr)
virtual void UserCreateOutputObjects()
TH1 * fHistMatchEta[8][9][2]
!deta distribution
AliVTrack * GetTrack() const
Int_t fCentBin
! Event centrality bin
TH1 * fHistMatchPhi[8][9][2]
!dphi distribution
AliClusterContainer * fClusCont
Pointer to the cluster container.
Cluster-track matcher component in the EMCal correction framework.
TH1 * fHistMatchPhiAll
!dphi distribution
Base class for correction components in the EMCal correction framework.
Int_t IdInCollection() const
Bool_t fDoPropagation
if true then propagate all hybrid tracks to EMCal surface
Double_t fVertex[3]
! Event vertex
void GenerateEmcalParticles()
TList * fOutput
! List of output histograms
Bool_t fCreateHisto
Flag to make some basic histograms.
Int_t fNEmcalTracks
!number of emcal tracks
AliVCluster * GetCluster() const
virtual Bool_t Initialize()
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
void UserCreateOutputObjects()
void AddMatchedObj(Int_t id, Double_t d)
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
TH1 * fHistMatchEtaAll
!deta distribution
void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
Int_t GetMomBin(Double_t p) const
AliEmcalCorrectionClusterTrackMatcher()
AliParticleContainer * fPartCont
Pointer to the track/particle container.
TClonesArray * fEmcalTracks
!emcal tracks
Double_t fMaxDistance
maximum distance to match clusters and tracks
AliVCluster * GetNextAcceptCluster()
static RegisterCorrectionComponent< AliEmcalCorrectionClusterTrackMatcher > reg
TClonesArray * fEmcalClusters
!emcal clusters
bool GetProperty(std::string propertyName, T &property, bool requiredProperty=true, std::string correctionName="")
Retrieve property.