X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FReadESDfriend.C;h=62e3d30784f775c460593035f0bcb6c8834542ab;hb=7d5d0cc5e751bdf612fb78ed7cfe55397a79f855;hp=a06a1e494e97d6243c2d46a0a463c5bf6acf9424;hpb=62665e7f9df7c9a1d3a2fb7d0faae2ebf4b58067;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/ReadESDfriend.C b/STEER/ReadESDfriend.C index a06a1e494e9..62e3d30784f 100644 --- a/STEER/ReadESDfriend.C +++ b/STEER/ReadESDfriend.C @@ -8,7 +8,7 @@ #include #include - #include "AliESD.h" + #include "AliESDEvent.h" #include "AliESDfriend.h" #include "AliTrackPointArray.h" #endif @@ -22,55 +22,57 @@ void ReadESDfriend(Bool_t readFriend=kTRUE) { TChain *esdTree=new TChain("esdTree"); for (Int_t i=0; iAddFile(name[i]); - AliESD *ev=0; - esdTree->SetBranchAddress("ESD",&ev); + AliESDEvent *ev= new AliESDEvent(); + if(readFriend)esdTree->SetBranchStatus("ESDfriend*",1); + ev->ReadFromTree(esdTree); // Attach the branch with ESD friends AliESDfriend *evf=0; if (readFriend) { - esdTree->SetBranchStatus("ESDfriend*",1); - esdTree->SetBranchAddress("ESDfriend.",&evf); + evf = (AliESDfriend*)ev->FindListObject("AliESDfriend"); + if(!evf){ + // works for both, we just want to avoid setting the branch adress twice + // in case of the new ESD + esdTree->SetBranchAddress("ESDfriend.",&evf); + } } Int_t nev=esdTree->GetEntries(); for (Int_t i=0; iGetEntry(i); - + if(ev->GetAliESDOld())ev->CopyFromOldESD(); + 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. - if (n > 0) { - const AliESDtrack *t=ev->GetTrack(0); - Int_t idx[AliESDfriendTrack::kMaxTPCcluster]; - n=t->GetTPCclusters(idx); - cout<<"Track number 0"<GetITSClusterMap(); - cout<<" ITS cluster map (from SPDs to SSDs): "; - for (Int_t i=0; i<6; i++) cout<GetTrackPointArray(); - if (pa != 0) { - n=pa->GetNPoints(); - const Float_t *x=pa->GetX(); - cout<<" Number of track points: "<7) + Int_t ntr=ev->GetNumberOfTracks(); + cout<<"Number of tracks: "< 0) { + ev->SetESDfriend(evf); //Attach the friend to the ESD + const AliESDtrack *t=ev->GetTrack(0); + Int_t idx[AliESDfriendTrack::kMaxTPCcluster]; + n=t->GetTPCclusters(idx); + cout<<"Number of friend tracks: "<GetNumberOfTracks() <GetITSClusterMap(); + cout<<" ITS cluster map (from SPDs to SSDs):\n"; + for (Int_t k=0; k<6; k++) printf(" Bit %d: %d\n",k,(map&(1<GetTrackPointArray(); + if (pa != 0) { + n=pa->GetNPoints(); + const Float_t *x=pa->GetX(); + cout<<" Number of track points: "<7) cout<<" X coordinate of the 7th track point: "<