Hadd multiple files with weights

Hello everyone!

I am searching for a way to use the simple hadd command to merge multiple *.root files with histograms, but applying a weight to each input *.root file.

I could write a small macro by myself, reading each files histograms and performing:

But it would be more easy and hopfeully quicker to have an adapted hadd command like

Which would automatically apply the weight for each file before adding them together

By searching the root forum I only found a very old thread (2008), which does not have any solution in the end
[url]Adding all hists for many files with weights?

Will I have to edit the hadd macro by myself or is there anything likely available by now?


I found a script online, which does exactly this job.
It is no official root script, but it works, so for anyone who is searching the same thing:
heplife.blogspot.de/2012/12/bett … trees.html

1 Like