1 #if !defined(__CINT__) || defined(__MAKECINT__)
10 #include <TObjArray.h>
15 #include <TParticle.h>
16 #include <TRefArray.h>
19 //AliRoot include files
20 #include "AliRunLoader.h"
22 #include "AliESDEvent.h"
23 #include "AliESDVertex.h"
24 #include "AliESDCaloCluster.h"
25 #include "AliESDCaloCells.h"
33 TFile* f = new TFile("AliESDs.root");
34 TTree* esdTree = (TTree*)f->Get("esdTree");
36 AliESDEvent* esd = new AliESDEvent();
37 esd->ReadFromTree(esdTree);
39 Int_t nEvt = esdTree->GetEntries();
40 Float_t pos[3] = {0.,0.,0.};
42 for(Int_t iev = 0; iev < nEvt; iev++) {
43 cout << "Event: " << iev+1 << "/" << nEvt << endl;
44 esdTree->GetEvent(iev);
46 TRefArray* caloClusters = new TRefArray();
47 esd->GetEMCALClusters(caloClusters);
49 //get reconstructed vertex position
50 Double_t vertex_position[3];
51 esd->GetVertex()->GetXYZ(vertex_position);
54 Int_t nclus = caloClusters->GetEntries();
55 for (Int_t icl = 0; icl < nclus; icl++) {
57 AliESDCaloCluster* clus = (AliESDCaloCluster*)caloClusters->At(icl);
58 Float_t energy = clus->E();
59 clus->GetPosition(pos);
60 TVector3 vpos(pos[0],pos[1],pos[2]);
62 clus->GetMomentum(p,vertex_position);
63 Double_t cphi = vpos.Phi();
64 Double_t ceta = vpos.Eta();
66 Int_t nMatched = clus->GetNTracksMatched();
67 Int_t trackIndex = clus->GetTrackMatched();
68 Int_t nLabels = clus->GetNLabels();
69 Int_t labelIndex = clus->GetLabel();
71 Int_t nCells = clus->GetNCells();
73 //For later: ADD CHECK THAT CLUSTER IS WITHIN SM FIDUCIAL VOLUME
75 cout << "Cluster: " << icl+1 << "/" << nclus << " Energy: " << energy << " Phi: "
76 << cphi << " Eta: " << ceta << " NCells: " << nCells << " #Matches: " << nMatched
77 << " Index: " << trackIndex << " #Labels: " << nLabels << " Index: "
78 << labelIndex << endl;
81 AliESDtrack* track = esd->GetTrack(trackIndex);
82 Double_t tphi = track->GetOuterParam()->Phi();
83 Double_t teta = track->GetOuterParam()->Eta();
84 Double_t tmom = track->GetOuterParam()->P();
85 cout << "\t Track Momentum: " << tmom << " phi: " << tphi << " eta: " << teta << endl;
87 Double_t deta = teta - ceta;
88 Double_t dphi = tphi - cphi;
89 if(dphi > TMath::Pi()) dphi -= 2*TMath::Pi();
90 if(dphi < -TMath::Pi()) dphi += 2*TMath::Pi();
91 Double_t dR = sqrt(dphi*dphi + deta*deta);
93 Double_t pOverE = tmom/energy;
95 if(dR < 0.02 && pOverE < 1.8 && nCells > 1) {
96 cout << "\n\t Excellent MATCH! dR = " << dR << " p/E = " << pOverE << " nCells = " << nCells << endl;