1 void ReadAOD(const char *fileName = "AliAOD.root") {
3 // open input file and get the TTree
4 TFile inFile(fileName, "READ");
5 TTree *aodTree = (TTree*)inFile.Get("AOD");
7 AliAODEvent *aod = aodTree->GetUserInfo()->FindObject("AliAODEvent");
8 TIter next(aod->GetList());
10 while(el=(TNamed*)next())
11 aodTree->SetBranchAddress(el->GetName(),aod->GetList()->GetObjectRef(el));
14 Int_t nEvents = aodTree->GetEntries();
15 for (Int_t nEv = 0; nEv < nEvents; nEv++) {
16 cout << "Event: " << nEv+1 << "/" << nEvents << endl;
19 aodTree->GetEvent(nEv);
25 aod->GetHeader()->Print();
28 Int_t nTracks = aod->GetNTracks();
29 for (Int_t nTr = 0; nTr < nTracks; nTr++) {
32 cout << nTr+1 << "/" << nTracks << ": track pt: " << aod->GetTrack(nTr)->Pt() << ", vertex x of this track: " << aod->GetTrack(nTr)->GetProdVertex()->GetX() << endl;
36 Int_t nVtxs = aod->GetNVertices();
37 for (Int_t nVtx = 0; nVtx < nVtxs; nVtx++) {
40 cout << nVtx+1 << "/" << nVtxs << ": vertex z position: " << aod->GetVertex(nVtx)->GetZ() << endl;