TEntryList for TTreeReader

Dear rooters,

I have followed the instructions for making a TEntryList in [1]

tree.Draw(">>pyplus","fTracks.fPy>0", "entrylistarray");
tree->SetEntryList(pyplus);
tree->Draw("fTracks.fPy");

And it works for “TTree::Draw”.

But if I try with TTreeReader

TTreeReader aReader( tree ); TTreeReaderValue... while ( aReader.Next() ) { // do some stuff here }
aReader will loop through all the entries. Can it loop just through the entries in the list? (I have seen that could be done with SetBranchAddress, but I was told to do it with TTreeReader).

Thank you in advance.

Regards,
ATD
[1] root.cern.ch/doc/master/classTTree.html, “Using a TEventList, TEntryList or TEntryListArray as Input”

Hi,

Looks like this is simply missing. I’ll have to implement it, didn’t get to it yet. I still have hopes for getting it done tomorrow. I will keep you posted!

Until then you can use this:

while (true) { /* instead of while aReader.Next() */ 
  Long64_t entryNumber = chain->GetEntryNumber(entry);
  if (entryNumber < 0) break;
  localEntry = chain->LoadTree(entryNumber);
  if (localEntry < 0) break;
  aReader.SetLocalEntry(localEntry);
  ...

Cheers, Axel.

Hello

Ok, thank you for your time :slight_smile:

Greetings!

Okay, done - apologies this took so long.

I decided to claim that this is a new feature and as such should not go into v6.08 (but only into the master i.e. the future 6.10). But 6.08 will now print a warning message if it sees a TTree with a TEntryList - I hope that makes it clear.

Thanks for reporting!

Cheers, Axel.

Hi

Thank you for your time. I’m glad I could help somehow :slight_smile:

Greetings!