Copy a subset of a TTree after event selection


I have a large TTree with a lot’s of events and I’d like to copy on an other TTree with same branches and variables a subset of these events I have selected with some cuts.
I’m sure there is an easy way to do this in a macro with an event list, no ?
or do I have to loop on the entries and create a new TTree ?

Thanks !


Hi Sabine,

see examples in ROOT tutorials
copytree.C and copytree3.C