8 #include <TClonesArray.h> 11 #include <AliAODCaloCluster.h> 12 #include <AliESDCaloCluster.h> 14 #include <AliVCluster.h> 15 #include <AliVTrack.h> 28 fDoPropagation(kFALSE),
30 fAttemptPropMatch(kFALSE),
32 fAttachEmcalParticles(kFALSE),
34 fUpdateClusters(kTRUE),
44 for(
Int_t icent=0; icent<8; ++icent) {
45 for(
Int_t ipt=0; ipt<9; ++ipt) {
46 for(
Int_t ieta=0; ieta<2; ++ieta) {
47 fHistMatchEta[icent][ipt][ieta] = 0;
48 fHistMatchPhi[icent][ipt][ieta] = 0;
58 fDoPropagation(kFALSE),
60 fAttemptPropMatch(kFALSE),
62 fAttachEmcalParticles(kFALSE),
64 fUpdateClusters(kTRUE),
74 for(
Int_t icent=0; icent<8; ++icent) {
75 for(
Int_t ipt=0; ipt<9; ++ipt) {
76 for(
Int_t ieta=0; ieta<2; ++ieta) {
97 TClass trackClass(tracks->GetClassName());
98 if (!trackClass.InheritsFrom(
"AliVTrack")) {
99 tracks->SetClassName(
"AliVTrack");
108 TString emcalTracksName(Form(
"EmcalTracks_%s", tracks->GetArrayName().Data()));
109 TString emcalClustersName(Form(
"EmcalClusters_%s", clusters->GetArrayName().Data()));
133 fHistMatchEtaAll =
new TH1F(
"fHistMatchEtaAll",
"fHistMatchEtaAll", 400, -0.2, 0.2);
134 fHistMatchPhiAll =
new TH1F(
"fHistMatchPhiAll",
"fHistMatchPhiAll", 400, -0.2, 0.2);
138 for(
Int_t icent=0; icent<nCentChBins; ++icent) {
139 for(
Int_t ipt=0; ipt<9; ++ipt) {
140 for(
Int_t ieta=0; ieta<2; ++ieta) {
141 TString nameEta(Form(
"fHistMatchEta_%i_%i_%i",icent,ipt,ieta));
142 fHistMatchEta[icent][ipt][ieta] =
new TH1F(nameEta, nameEta, 400, -0.2, 0.2);
144 TString namePhi(Form(
"fHistMatchPhi_%i_%i_%i",icent,ipt,ieta));
145 fHistMatchPhi[icent][ipt][ieta] =
new TH1F(namePhi, namePhi, 400, -0.2, 0.2);
164 else if (p>=0.5 && p<1.0)
166 else if (p>=1.0 && p<1.5)
168 else if (p>=1.5 && p<2.)
170 else if (p>=2. && p<3.)
172 else if (p>=3. && p<4.)
174 else if (p>=4. && p<5.)
176 else if (p>=5. && p<8.)
212 AliVCluster* cluster = 0;
213 AliVTrack* track = 0;
215 clusters->ResetCurrentID();
219 cluster->SetEmcCpvDistance(-1);
220 cluster->SetTrackDistance(1024, 1024);
221 AliAODCaloCluster *ac =
dynamic_cast<AliAODCaloCluster*
>(cluster);
222 AliESDCaloCluster *ec = 0;
224 const Int_t N = ac->GetNTracksMatched();
225 for (
Int_t i = N - 1; i >= 0; i--) {
226 TObject *ptr = ac->GetTrackMatched(i);
227 ac->RemoveTrackMatched(ptr);
231 ec =
dynamic_cast<AliESDCaloCluster*
>(cluster);
232 TArrayI *arr = ec->GetTracksMatched();
233 if (arr) arr->Set(0);
244 tracks->ResetCurrentID();
248 track->ResetStatus(AliVTrack::kEMCALmatch);
249 track->SetEMCALcluster(-1);
252 Bool_t propthistrack = kFALSE;
254 propthistrack = kTRUE;
256 else if (!track->IsExtrapolatedToEMCAL()) {
258 propthistrack = kTRUE;
261 propthistrack = kTRUE;
264 if (propthistrack) AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(track,
fPropDist);
270 AliDebug(2, Form(
"Now adding track (pT = %.3f, eta = %.3f, phi = %.3f)" 271 "Phi, Eta on EMCal = %.3f, %.3f",
272 emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi(),
273 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal()));
288 AliVTrack* track = emcalTrack->
GetTrack();
292 AliVCluster* cluster = emcalCluster->
GetCluster();
297 Double_t d2 = deta * deta + dphi * dphi;
298 if (d2 > maxd2)
continue;
303 AliDebug(2, Form(
"Now matching cluster E = %.3f, pT = %.3f, eta = %.3f, phi = %.3f " 304 "with track pT = %.3f, eta = %.3f, phi = %.3f" 305 "Track eta, phi on EMCal = %.3f, %.3f, d = %.3f",
306 cluster->GetNonLinCorrEnergy(), emcalCluster->
Pt(), emcalCluster->
Eta(), emcalCluster->
Phi(),
307 emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi(),
308 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), d));
313 if (track->Charge() < 0) centbinch +=
fNcentBins;
315 if(track->Eta() > 0) etabin = 1;
334 AliVCluster* cluster = emcalCluster->
GetCluster();
335 AliDebug(3, Form(
"Cluster E = %.2f, eta = %.2f, phi = %.2f, Nmatch = %d", cluster->GetNonLinCorrEnergy(), emcalCluster->
Eta(), emcalCluster->
Phi(), N));
337 if (N <= 0)
continue;
342 AliVTrack* trackFirstMatch = emcalTrackFirstMatch->
GetTrack();
346 cluster->SetTrackDistance(dphi, deta);
349 AliAODCaloCluster *ac =
dynamic_cast<AliAODCaloCluster*
>(cluster);
350 AliESDCaloCluster *ec = 0;
351 if (!ac) ec =
dynamic_cast<AliESDCaloCluster*
>(cluster);
355 for (
Int_t i=0; i < N; ++i) {
359 AliDebug(3, Form(
"Pt = %.2f, eta = %.2f, phi = %.2f", emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi()));
362 ac->AddTrackMatched(obj);
367 for (
Int_t i = 0; i < N; ++i) {
372 ec->AddTracksMatched(arr);
387 AliVTrack* track = emcalTrack->
GetTrack();
389 track->SetStatus(AliVTrack::kEMCALmatch);
TClonesArray * fEmcalTracks
Bool_t fAttachEmcalParticles
virtual AliVParticle * GetNextAcceptParticle()
virtual ~AliEmcalClusTrackMatcherTask()
Int_t GetMatchedObjId(UShort_t i=0) const
UShort_t GetNumberOfMatchedObj() const
Base task in the EMCAL framework.
Bool_t fLocalInitialized
whether or not the task has been already initialized
void SetMatchedPtr(TObjArray *arr)
static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
Calculate and difference between a track (t) and a cluster (c).
TClonesArray * fEmcalClusters
emcal tracks
Int_t fCentBin
!event centrality bin
AliVTrack * GetTrack() const
void UserCreateOutputObjects()
Container for particles within the EMCAL framework.
TH1 * fHistMatchPhiAll
deta distribution
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Get particle container attached to this task.
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
Determines if a track is inside the EMCal acceptance.
Int_t fNcentBins
how many centrality bins
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
Int_t IdInCollection() const
void ExecOnce()
Perform steps needed to initialize the analysis.
TH1 * fHistMatchPhi[10][9][2]
deta distribution
Bool_t Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
Int_t fNEmcalClusters
number of emcal tracks
void GenerateEmcalParticles()
TH1 * fHistMatchEta[10][9][2]
dphi distribution
AliEmcalList * fOutput
!output list
AliVCluster * GetCluster() const
Double_t fVertex[3]
!event vertex
Bool_t fCreateHisto
whether or not create histograms
void AddMatchedObj(Int_t id, Double_t d)
virtual void ExecOnce()
Perform steps needed to initialize the analysis.
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
Add object to event.
void UserCreateOutputObjects()
Main initialization function on the worker.
AliEmcalClusTrackMatcherTask()
Container structure for EMCAL clusters.
AliVCluster * GetNextAcceptCluster()
TH1 * fHistMatchEtaAll
number of emcal clusters
Int_t fNEmcalTracks
emcal clusters
Int_t GetMomBin(Double_t p) const