Combine fraction of file in a TChain

With a TChain I can chain some ROOT files. But now I want to mix these files with a particular proportion. For example suppose I have file1.root and file2.root, I want to mix 100 events from the first and 300 events from the second. This doesn’t work:

chain.Add("file1.root", 100);
chain.Add("file2.root", 300);

Solutions? I will use this chain with proof.

No, this functionality is not provided, because most of the time you want to take a per cent of events only and not only teh first events.
See the $ROOTSYS/tutorials/tree/copyxxx scripts for example.

Rene

[quote=“brun”]No, this functionality is not provided, because most of the time you want to take a per cent of events only and not only teh first events.
See the $ROOTSYS/tutorials/tree/copyxxx scripts for example.

Rene[/quote]

I think it should be a very userfull feature, suppose you don’t know the proportion between signal and background and you want to study systematic effects vary this proportion.

[quote=“wiso”][quote=“brun”]No, this functionality is not provided, because most of the time you want to take a per cent of events only and not only teh first events.
See the $ROOTSYS/tutorials/tree/copyxxx scripts for example.

Rene[/quote]

I think it should be a very userfull feature, suppose you don’t know the proportion between signal and background and you want to study systematic effects vary this proportion.[/quote]

In general, one keeps the signal and background samples separate. If this is what you are doing, setup multiple chains (e.g., two for just signal and background) and setup your code this way.

Note that when you are testing for sensitivity to different background, you want to run pseudo-experiments with different amounts of signal and background and not just the first N events of each.

Good luck,
Charles