1 //********************************************************************
2 // Example of accessing the information stored in ESD friends
3 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
4 //********************************************************************
6 #if !defined( __CINT__) || defined(__MAKECINT__)
12 #include "AliESDfriend.h"
15 void ReadESDfriend(Bool_t readFriend=kTRUE) {
16 TFile f("AliESDs.root");
17 TTree *esdTree=(TTree*)f.Get("esdTree");
19 esdTree->SetBranchAddress("ESD",&ev);
21 // Attach the tree with ESD friends
24 esdTree->AddFriend("esdFriendTree","AliESDfriends.root");
25 esdTree->SetBranchAddress("ESDfriend",&evf);
28 Int_t nev=esdTree->GetEntries();
29 for (Int_t i=0; i<nev; i++) {
30 cout<<"Event number: "<<i<<endl;
33 ev->SetESDfriend(evf); //Attach the friend to the ESD
35 // Now the attached information can be accessed via pointer to ESD.
36 // Example: indices of the TPC clusters associated with the track number 0.
37 const AliESDtrack *t=ev->GetTrack(0);
38 Int_t idx[AliESDfriendTrack::kMaxTPCcluster], n=t->GetTPCclusters(idx);
39 cout<<"Number of TPC clusters: "<<n<<endl;
40 cout<<"Index of the 7th TPC cluster: "<<idx[7]<<endl<<endl;