My aim is to add two trees (root files) with some ratio into a chain.
More detailed:
For example I have tree_1 with 10000 events and tree_2 with 7000 events.
The structure of two trees is identical, that is they contain the same branches.
I would like to merge these two trees into one chain using some ratio (for example 70:30 ratio).
So I need to have a chain with
10000 + 7000*3/7 = 13000 events.
And it doesn’t matter what exactly events from tree_2 will be stored in a chain,
these may be 3000 first or 3000 last events from tree_2.
The question is: how can I implement the corresponding code quickly and
without using such methods as SetBranchStatus, SetBranchAddress and without method Fill within loop?
I mean is there something like chain.Add(tree_1); chain.Add(tree_2*3/7); ?
Not quite. rooteventselector which select a sub-set of the entries but will not apply any weight per se.
So in
rooteventselector -s "rand()/2147483647 <= .43"
43% of the entries (selected at randon because of the call to rand) will be selected (if the original files at 10000 entries, the result files has roughly 4300 entries).
I mean “applying a weight”. I have a root file. I want to get a new root file after applying a weight to each branch. Is there any quick way to do this?