8 #include <TClonesArray.h>
11 #include <AliAODCaloCluster.h>
12 #include <AliESDCaloCluster.h>
14 #include <AliVCluster.h>
15 #include <AliVTrack.h>
16 #include <AliEMCALRecoUtils.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) {
98 if (!trackClass.InheritsFrom(
"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;
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);
248 Bool_t propthistrack = kFALSE;
250 propthistrack = kTRUE;
252 else if (!track->IsExtrapolatedToEMCAL()) {
254 propthistrack = kTRUE;
257 propthistrack = kTRUE;
260 if (propthistrack) AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(track,
fPropDist);
266 AliDebug(2, Form(
"Now adding track (pT = %.3f, eta = %.3f, phi = %.3f)"
267 "Phi, Eta on EMCal = %.3f, %.3f",
268 emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi(),
269 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal()));
284 AliVTrack* track = emcalTrack->
GetTrack();
288 AliVCluster* cluster = emcalCluster->
GetCluster();
293 Double_t d2 = deta * deta + dphi * dphi;
294 if (d2 > maxd2)
continue;
296 Double_t d = TMath::Sqrt(d2);
299 AliDebug(2, Form(
"Now matching cluster E = %.3f, pT = %.3f, eta = %.3f, phi = %.3f "
300 "with track pT = %.3f, eta = %.3f, phi = %.3f"
301 "Track eta, phi on EMCal = %.3f, %.3f, d = %.3f",
302 cluster->GetNonLinCorrEnergy(), emcalCluster->
Pt(), emcalCluster->
Eta(), emcalCluster->
Phi(),
303 emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi(),
304 track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), d));
309 if (track->Charge() < 0) centbinch +=
fNcentBins;
311 if(track->Eta() > 0) etabin = 1;
330 AliVCluster* cluster = emcalCluster->
GetCluster();
331 AliDebug(3, Form(
"Cluster E = %.2f, eta = %.2f, phi = %.2f, Nmatch = %d", cluster->GetNonLinCorrEnergy(), emcalCluster->
Eta(), emcalCluster->
Phi(), N));
333 if (N <= 0)
continue;
338 AliVTrack* trackFirstMatch = emcalTrackFirstMatch->
GetTrack();
342 cluster->SetTrackDistance(dphi, deta);
345 AliAODCaloCluster *ac =
dynamic_cast<AliAODCaloCluster*
>(cluster);
346 AliESDCaloCluster *ec = 0;
347 if (!ac) ec =
dynamic_cast<AliESDCaloCluster*
>(cluster);
351 for (Int_t i=0; i < N; ++i) {
355 AliDebug(3, Form(
"Pt = %.2f, eta = %.2f, phi = %.2f", emcalTrack->
Pt(), emcalTrack->
Eta(), emcalTrack->
Phi()));
357 TObject *obj = emcalTrack->
GetTrack();
358 ac->AddTrackMatched(obj);
363 for (Int_t i = 0; i < N; ++i) {
368 ec->AddTracksMatched(arr);
380 AliVTrack* track = emcalTrack->
GetTrack();
382 track->ResetStatus(AliVTrack::kEMCALmatch);
387 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.
void SetClassName(const char *clname)
void SetMatchedPtr(TObjArray *arr)
static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
TClonesArray * fEmcalClusters
emcal tracks
TH1 * fHistMatchPhi[8][9][2]
deta distribution
Int_t fCentBin
!event centrality bin
AliVTrack * GetTrack() const
TList * fOutput
!output list
void UserCreateOutputObjects()
Container for particles within the EMCAL framework.
const TString & GetClassName() const
TH1 * fHistMatchPhiAll
deta distribution
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
Int_t GetCurrentID() const
Int_t fNcentBins
if MC label > fMCLabelShift, MC label -= fMCLabelShift
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Int_t IdInCollection() const
TH1 * fHistMatchEta[8][9][2]
dphi distribution
const TString & GetArrayName() const
ClassImp(AliEmcalClusTrackMatcherTask) AliEmcalClusTrackMatcherTask
Int_t fNEmcalClusters
number of emcal tracks
void GenerateEmcalParticles()
AliVCluster * GetCluster() const
Double_t fVertex[3]
!event vertex
Bool_t fCreateHisto
whether or not the task has been already initialized
void AddMatchedObj(Int_t id, Double_t d)
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
void UserCreateOutputObjects()
Bool_t fInitialized
whether or not it should fill some general histograms
AliEmcalClusTrackMatcherTask()
Container structure for EMCAL clusters.
AliVCluster * GetNextAcceptCluster()
TH1 * fHistMatchEtaAll
number of emcal clusters
void ResetCurrentID(Int_t i=-1)
Int_t fNEmcalTracks
emcal clusters
Int_t GetMomBin(Double_t p) const