TChain::GetEntryWithIndex issues

Hi all,

I have a question about the implementation of TChain::GetEntryWithIndex. It seems to me, based on the online documentation, that the behavior of the function is completely changed from the TTree function, even though TChain of course inherits from TTree.

I.e. if I have a TTree indexed by run and event, to read a certain event in the tree I would call

tree->GetEntryWithIndex(run, event);

whereas if I had a chain of those same trees, I would have to call

int entry = chain->GetEntryWithIndex(run, event);
chain->GetEntry(entry);

I’m hardly an expert, but this seems to break the polymorphism, which is a definite no-no. It seems to me that what is currently TChain::GetEntryWithIndex should in fact be TChain::GetEntryNumberWithIndex.

On a related matter, the documentation says that this function will not work on a chain that has friends. Does this also mean that, if I have two chains which contain indexes and are friends, that I cannot use Draw, Scan, etc. functions? This seems to be the behavior I’m seeing right now, and would like to check.

[quote] It seems to me, based on the online documentation, that the behavior of the function is completely changed from the TTree function, even though TChain of course inherits from TTree. [/quote]The documentation was inaccurate and obsolete (I have update it in the trunk); the behavior is actually the same as for the TTree version.

[quote]On a related matter, the documentation says that this function will not work on a chain that has friends.[/quote]This part of the documentation was obsolete.

[quote]Does this also mean that, if I have two chains which contain indexes and are friends, that I cannot use Draw, Scan, etc. functions? This seems to be the behavior I’m seeing right now, and would like to check.[/quote]No. Your case should be handled properly by TTree::Draw, etc. [However note that there was a bug fixed yesterday that broke the use of fixed length array in the case of TTree or TChain with friends].

Cheers,
Philippe