Pls skip read in TBranch::GetEntry in case fReadEntry==entry

Hi,

I have a feature request on TBranch::GetEntry(entry). I think that it would be wise to skip the read in case of fReadEntry==entry.

BTW, I have a question on when branch decompression happens. Does it happen during Baskets reading in TTreeCache? Or wait until TBranch::GetEntry? Or somewhere else?

–Shuwei

Hi,

[quote]I have a feature request on TBranch::GetEntry(entry). I think that it would be wise to skip the read in case of fReadEntry==entry.[/quote]This was have some counter-intuitive side effect. In the case where the user does:tree->SetBranchAddress("event",&evenptr); tree->GetEntry(17); ... do something that requires to modify the object point to by eventptr ... for example to stage some result ... tree->GetEntry(17); // At this point the object should be back to the way it was on the file!
You can trivially implement the behavior you want by usingif (tree->GetReadEntry() != entry) tree->GetEntry(entry);

[quote]BTW, I have a question on when branch decompression happens. Does it happen during Baskets reading in TTreeCache? Or wait until TBranch::GetEntry? Or somewhere else?[/quote]The basket decompression happens when the branch is first reading an entry from this basket. The decompression does not happen in the TTreeCache. If the branch needs to read an entry from a different basket, the previous basket buffer may or may not be discarded depending on the value of tree->GetMaxVirtualSize())

Cheers,
Philippe.

Hi Philippe,

I request for this feature because of the following case:

b_RunNumber->GetEntry(entry); b_el->GetEntry(entry); b_mu->GetEntry(entry); .. read more individual branches ... do some cuts here tree->GetEntry(entry); // read in all active branches then
So tree->GetEntry(entry) will waste cpu time (and I/O) on reading b_RunNumber, b_el, b_mu again. Currently I save a list of **TBranch associated with TChain, and read branches only if entry !=branch->GetReadEntry().

Back to branch decompression question, so TTreeCache just reads in baskets but does not decompress them. Decompression happens when a new basket is needed by TBranch::GetEntry, right?

–Shuwei

[quote]Back to branch decompression question, so TTreeCache just reads in baskets but does not decompress them. Decompression happens when a new basket is needed by TBranch::GetEntry, right?[/quote]Yes.

[quote]So tree->GetEntry(entry) will waste cpu time (and I/O) on reading b_RunNumber, b_el, b_mu again. Currently I save a list of **TBranch associated with TChain, and read branches only if entry !=branch->GetReadEntry().[/quote]I see, it make sense. You solution is fine for now.

Cheers,
Philippe.