Dear Rooters,
I've tried to investigate binomial error calculations
described in the message
http://root.cern.ch/root/roottalk/roottalk00/2894.html
So, I modified code a little bit checking the relative errors
after I divided out correlated histograms with TH1::Divide(const TH1
*h1, const TH1 *h2, Double_t c1, Double_t c2, Option_t *option) )
I was expecting that if I increase factors c1 and c2 by the same value,
the
relative errors are going to be the same. But I see that they are
decreasing.
Did I do anything wrong?
Thanks,
Rustam
Here is my code
{
gROOT->Reset();
c1 = new TCanvas("c1","The FillRandom example",200,10,700,900);
c1->Divide(1,2);
gaus1 = new TFormula("gaus1","gaus");
gaus1->SetParameters(1000,10,1);
h1f = new TH1F("h1f","h1f",200,0,20);
h1f->FillRandom("gaus1",10000);
h1f->Sumw2();
TH1F *bindistr = new TH1F("binomial","Test binomial",200,0,20);
TH1F *bindistr1 = new TH1F("binomial1","Test binomial1",200,0,20);
bindistr->Divide(h1f,h1f,1.0,2.0,"B");
bindistr1->Divide(h1f,h1f,10.0,20.0,"B");
Int_t nbinsx = h1f->GetNbinsX();
Double_t value,error;
Double_t value1,error1;
for (Int_t binx=0; binx<=nbinsx+1; binx++){
value=bindistr->GetBinContent(binx);
error=bindistr->GetBinError(binx);
value1=bindistr1->GetBinContent(binx);
error1=bindistr1->GetBinError(binx);
if(binx==100){
cout<<"x="<<bindistr->GetBinCenter(binx)<<" y="<<value<<"
er="<<error<<" relative error "<<error/value<<endl;
cout<<"x="<<bindistr1->GetBinCenter(binx)<<" y="<<value1<<"
er="<<error1<<" relative error "<<error1/value1<<endl;
}
}
gStyle->SetOptStat(0);
c1->cd(1);bindistr->Draw("E");
c1->cd(2);bindistr1->Draw("E");
c1->Update();
}
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET