Copy Tree with weights (bootstrap)

Hello,

I would like to make several copies of an ntuple, where I give each event a weight according to a Poissonian distribution (with mean = 1), basically these are samples for a bootstrap analysis.
I was thinking of using CloneTree (ROOT: tutorials/tree/copytree3.C File Reference) but it looks like I have to loop over all entries (the key statement here is Fill()).
Is there any other more efficient way?

Many thanks in advance!

D.


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.20/04
Platform: Ubuntu 20.04.3 LTS, Release: 20.04
Compiler: Not Provided


Maybe @pcanal knows better, but AFAIK you effectively have to loop over the entries

If you need just need ‘integer’ weight, then calling Fill multiple time is the simplest. If you need fractional weight, then you might be better off adding a new column (for example in a friend TTree) with the value of the weight.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.