X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FReadESDfriend.C;h=03addf62abd3caa68561bf685ee472e4010f7c1e;hb=500d54ab9cff3a6d06e05435e3d3b87256553e14;hp=780bfe2aa349b64b968fad95c34554f6e4975135;hpb=a1a21b3977bf3642177379d22c1b272cded56a1a;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/ReadESDfriend.C b/STEER/ReadESDfriend.C index 780bfe2aa34..03addf62abd 100644 --- a/STEER/ReadESDfriend.C +++ b/STEER/ReadESDfriend.C @@ -6,38 +6,61 @@ #if !defined( __CINT__) || defined(__MAKECINT__) #include #include - #include + #include #include "AliESD.h" #include "AliESDfriend.h" + #include "AliTrackPointArray.h" #endif void ReadESDfriend(Bool_t readFriend=kTRUE) { - TFile f("AliESDs.root"); - TTree *esdTree=(TTree*)f.Get("esdTree"); + Char_t *name[]={ + //Put here the names of the ESD files to be chained + "AliESDs.root" + }; + Int_t n=sizeof(name)/sizeof(Char_t *); + TChain *esdTree=new TChain("esdTree"); + for (Int_t i=0; iAddFile(name[i]); + AliESD *ev=0; esdTree->SetBranchAddress("ESD",&ev); - // Attach the tree with ESD friends + // Attach the branch with ESD friends AliESDfriend *evf=0; if (readFriend) { - esdTree->AddFriend("esdFriendTree","AliESDfriends.root"); - esdTree->SetBranchAddress("ESDfriend",&evf); + esdTree->SetBranchStatus("ESDfriend*",1); + esdTree->SetBranchAddress("ESDfriend.",&evf); } Int_t nev=esdTree->GetEntries(); for (Int_t i=0; iGetEntry(i); + cout<GetNumberOfTracks(); + cout<<"Number of tracks: "<SetESDfriend(evf); //Attach the friend to the ESD // Now the attached information can be accessed via pointer to ESD. // Example: indices of the TPC clusters associated with the track number 0. const AliESDtrack *t=ev->GetTrack(0); - Int_t idx[AliESDfriendTrack::kMaxTPCcluster], n=t->GetTPCclusters(idx); - cout<<"Number of TPC clusters: "<GetTPCclusters(idx); + cout<<"Track number 0"<GetTrackPointArray(); + if (pa==0) continue; + n=pa->GetNPoints(); + const Float_t *x=pa->GetX(); + cout<<" Number of track points: "<7) + cout<<" X coordinate of the 7th track point: "<