Looping twice over a TChain doesn't work

Hi,

I want to loop twice over a TTree/TChain (first finding some min and max values, second time doing things that need min/max). To speed up the loops, I’d like to deactivate the branches that I don’t need. Unfortunately, they don’t reactivate.

Everything is fine if I load two files into the TChain, but it doesn’t work if there is only one.

I attach a minimal example, and two root trees to run over.

This is in C++, both 5.26/00 and Root 5.34/03.

Any hint is appreciated!
Moritz
run2.root (899 KB)
run1.root (899 KB)
TestTTreeBranchActivation.C (1.64 KB)

Hi,

I didn’t look what happens in the implementation, but it looks like changing the branch status AND getting at least one entry between status changes disconnects branches and variables. At least with the 5.30/03 I have running reconnecting the branches by calling open() after computeminmax() made this work for only one file in the chain.

Still very surprising and not symmetric at all.

Hi,

calling open() again does indeed fix the problem in my main code. Thanks! Let’s hope it stays like that until the original cause is fixed.

Cheers
Moritz