TH1::Print to show bin errors

Consider this script:

void printerrors()
  TH1F * h = new TH1F("h1", "h1", 5, 0.0, 5.0);
  h -> FillRandom("gaus", 500);
  h -> Print("all");

The output is:

TH1.Print Name  = h1, Entries= 500, Total sum= 500
 fSumw[0]=0, x=-0.5
 fSumw[1]=351, x=0.5
 fSumw[2]=123, x=1.5
 fSumw[3]=23, x=2.5
 fSumw[4]=2, x=3.5
 fSumw[5]=1, x=4.5
 fSumw[6]=0, x=5.5

Why the bin errors are not shown?

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Add h->Sumw2(kTRUE); before filling.

1 Like

It also works by setting the bin error manually at least for one bin

h -> SetBinError(2, 300.0);

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.