Sum Ttree

Good morning,
I need an help. I have two root files, containing some trees, that have the same names for each root file. I want to some them. But I can not use the hadd command, because I have to sum the 20% of the entries of one file, with the 50% of the entries of the other. How is it possible to do this?
Then I want to do the same thing with two root files, containing histos.

Thank you so much


What is the output of the sum that you need? An histogram or a TTree? Either way since you need to select a subset of the entry you will need to use either TTree::Draw (to get an histogram) or explicitly loop through the TTrees (see for example $ROOTSYS/tutorials/tree/copytree*) or use MakeClass/MakeSelector/MakeProxy.