Hello All,
I am trying to extract information for an event from a root tree with GetEntryWithIndex function.
My code looks like this:
[code]void printeventID (Int_t eventID) {
…
…
TTree Hits = (TTree)gDirectory->Get(“Hits”);
Hits->SetBranchAddress("posX",&HitposX);
Hits->SetBranchAddress("posY",&HitposY);
Hits->SetBranchAddress("posZ",&HitposZ);
Hits->SetBranchAddress("eventID",&HitEventID);
Hits->SetBranchAddress("edep",&edep);
Hits->BuildIndex("eventID");
Hits->GetEntryWithIndex(eventID);
printf("Requested event ID = %i\n",eventID);
printf("Extracted event ID = %i\n",HitEventID);
}[/code]
I run it with
and the output is :
Requested event ID = 10
Extracted event ID = 650638
What did I do that gives me this inconsistency? I tried for other event ID and still get the same error.
Thanks.