TTree nbytes in/out mismatch

I am using using a TSelector and PROOF to save selected events from a large chain (files stored on dcache) to an output TTree (using TProofOutputFile to create the output file). The output Tree is created using fChain->CloneTree(0) and events passing a preselection are added to this tree. This file has the correct number of events, but I’ve noticed that some events (in clusters of events) have a mismatch in the number of bytes read from the chain and the number of events written to the tree (always the same 1336 bytes).

ROOT ver. 5.22

Dear stewartt1982,

Is the problem occuring only in PROOF or also if you run locally on a subset of events?

Gerri Ganis

On both PROOF and locally… though I did discover the issue myself after a few days. Should have posted my solution. Due to the nature of my program I must define most tree’s files in the TSelector’s Init function. When init was called a second (third, fourth time…) my cloned tree’s branches was still pointing to the first tree. My solution in init was to set the clone tree’s branche address to fChain’s manually each time Init was called.