hi all
i’m trying to use TGraphAsymmErrors::Divide to compute an efficiency of weighted histograms and i get a puzzling behaviour.
i compile and run the following C++ program:
///////////////////////// BEGIN
#include
#include “TGraphAsymmErrors.h”
#include “TFile.h”
#include “TH1D.h”
#include “TCanvas.h”
int main() {
TFile* file = TFile::Open(“prova.root”);
TH1D* h1_denom = (TH1D*)file->Get(“denom”);
TH1D* h1_num = (TH1D*)file->Get(“num”);
for( unsigned ibin=1; ibin<h1_num->GetNbinsX(); ++ibin )
std::cout << ibin << " pass/total: " << h1_num->GetBinContent(ibin) << “/” << h1_denom->GetBinContent(ibin) << std::endl;
TGraphAsymmErrors* gr = new TGraphAsymmErrors();
gr->Divide( h1_num, h1_denom );
TCanvas* c1 = new TCanvas(“c1”, “”, 600, 600);
c1->cd();
gr->Draw(“APE”);
c1->SaveAs(“test.eps”);
return 0;
}
////////////////////////////////////// END
where the file “prova.root” can be found in /afs/cern.ch/user/p/pandolf/public
as you can see by running it yourself, i get the following output:
1 pass/total: 76.564/78.4033
2 pass/total: 157.693/163.85
3 pass/total: 3817.17/4081.08
4 pass/total: 3918.11/4204.31
5 pass/total: 161.009/167.809
Error in ROOT::Math::Cephes::incbi: Wrong domain for parameter a (must be > 0)
Info in TCanvas::Print: eps file test.eps has been created
i don’t understand the printed error (Cephes?) and i dont understand why the resulting plot (prova.eps) has some crazy efficiency values. i was expecting that at least the value of the Y coordinates of the points should correspond to the ratio of the bin contents, but it doesnt seem so.
i must be doing something wrong, can someone help out?
f