Efficiency calculation with weighted histogram

Hi Root support members,

I tried to calculate the efficiency from weighted merged histograms.
But the result seems wrong.
I did like

TH1D *pass1;
TH1D *pass2;
TH1D *total1;
TH1D *total2;
//read all histograms from root file
pass2->Scale(scale2); //scale pass2 histo.
total2->Scale(scale2); //scale total2 histo.
pass1->Add(pass2); 
total1->Add(total2);
TGraphAsymmErrros *eff = new TGraphAsymmErrors;
eff->Divide(pass1, total1);

In this case, does divide function return correct efficiency and errors ?

Thanks you,
Kenji

HI,

It should return correct efficiency and errors, but you need to use a quite recent version, I think >= 5.32
You need also to call TH1::Sumw2() before scaling the histograms

Best Regards

Lorenzo