Adding histograms including error of the factor

Hello,

I wonder if there is a way to consider also the errors of the factors
when adding two histograms, let’s say:

c1hist1 + c2hist2

i.e. how can I include the errors on c1 and c2 when calculating the bin errors?

Cheers,
Angela.

Hi Angela,

in the TH1::Add method this is not foreseen at the moment.
You will have to calculate the bin histogram error yourself including the factors using the error propagation (assuming that the factor have a normal distribution).
If you have :

h3 = c1 * h1 + c2 * h2

with c1 +/- s1
c2 +/- s2

and for each bin i :

b1 = h1.GetBinContent(i)
e1 = h1.GetBinError(i)

and same for h2

then the error on the bin of the added histogram will be:

e3 = sqrt( c1c1e1e1 + c2c2e2e2 + b1b1s1s1 + b2b2s2s2)

Cheers,

Lorenzo