On Wed, 15 Aug 2001, Rene Brun wrote:
Thanks Rene.
Ilia
> Ilia,
> You should call Sumw2 for the resulting histogram before making
> the operation if you want to have the correct error bars computed.
> See documentation of the TH1::Add functions.
> If your operand histograms already have Sumw2, this is not necessary.
> Example:
> {
> gROOT->Reset();
> TH1F *h1 = new TH1F("h1","h1",100,-3,3);
> Int_t bin = h1->Fill(0,1911);
> TH1F *h2 = new TH1F("h2","h2",100,-3,3);
> h2->Fill(0,1537.57);
> TH1F *h3 = h1->Clone("h3");
> h3->Sumw2();
> h3->Add(h1,h2,1,-1);
> printf("Bin conte= %g\n",h3->GetBinContent(bin));
> printf("Bin error= %g\n",h3->GetBinError(bin));
> }
>
> Rene Brun
>
> On Wed, 15 Aug 2001, Ilia Ravinovich wrote:
>
> > Hi Rene,
> >
> > In my macro I'm doing:
> >
> > inv_reb_signal_n->Add(inv_reb_real_n,inv_reb_mixed_norm_n,1.,-1.);
> > inv_reb_signal_n->Print("all");
> >
> > I checked the output for example bin #10:
> >
> > fSumw[10]=373.426, x=1.145, error=43.7226
> >
> > But the error is wrong because:
> >
> > fSumw[10]=1911, x=1.145 (this is from 'inv_reb_real_n')
> > fSumw[10]=1537.57, x=1.145 (this is from 'inv_reb_mixed_norm')
> >
> > 1911-1537.57=373.43, error=sqrt(1911+1537.57)=58.72
> >
> > Am I doing something wrong?
> >
> > Thanks,
> >
> > Ilia
> >
> > ************************************************************************
> > * *
> > * Ilia Ravinovich *
> > * Department of Particle Physics PPE Division *
> > * Weizmann Institute of Science Bld 892, 1D-015 *
> > * Rehovot 76100 CERN, 1211 Geneva *
> > * ISRAEL Switzerland *
> > * *
> > * PHONE : 972 8 9343187 41 22 7676437 *
> > * FAX : 972 8 9466253 41 22 7677910 *
> > * E-mail: Ilia.Ravinovich@weizmann.ac.il Ilia.Ravinovich@cern.ch *
> > * *
> > ************************************************************************
> >
>
>
************************************************************************
* *
* Ilia Ravinovich *
* Department of Particle Physics PPE Division *
* Weizmann Institute of Science Bld 892, 1D-015 *
* Rehovot 76100 CERN, 1211 Geneva *
* ISRAEL Switzerland *
* *
* PHONE : 972 8 9343187 41 22 7676437 *
* FAX : 972 8 9466253 41 22 7677910 *
* E-mail: Ilia.Ravinovich@weizmann.ac.il Ilia.Ravinovich@cern.ch *
* *
************************************************************************
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:57 MET