Hello,
I want to know how the TProfile errors are calculated in the case when the projection is done from a scaled bidimensionla histogram.
Here is a simple example:
{
TCanvas MyC = new TCanvas(“MyC”, “histos”);
TH2F h2 = new TH2F(“h2”,“h2”, 8, 0., 4., 8, 0., 4. );
Float_t x[3] = {1.0, 1.2, 3.};
Float_t y[3] = {0.5, 1.5, 3.};
for (Int_t i = 0; i<3; i++){
h2->Fill(x[i], y[i]);
}
h2->Draw();
h2->SetMarkerStyle(3);
h2->Sumw2();
// h2->Scale(1./50);
TProfile *p = h2->ProfileX();
p->Draw();
for (Int_t i = 1; i <= p->GetNbinsX(); i++) {
printf(“bin=%d, entries=%d, content=%f, error=%f\n”,i,
p->GetBinEntries(i),p->GetBinContent(i),p->GetBinError(i));
}
}
The ouput before scaling of the TH2:
bin=1, entries=0, content=0.000000, error=0.000000
bin=2, entries=0, content=0.000000, error=0.000000
bin=3, entries=2, content=1.250000, error=0.353553
bin=4, entries=0, content=0.000000, error=0.000000
bin=5, entries=0, content=0.000000, error=0.000000
bin=6, entries=0, content=0.000000, error=0.000000
bin=7, entries=1, content=3.250000, error=-0.000000
bin=8, entries=0, content=0.000000, error=0.000000
After scaling (h2->Scale(1./50)):
bin=1, entries=0, content=0.000000, error=0.000000
bin=2, entries=0, content=0.000000, error=0.000000
bin=3, entries=0, content=1.250000, error=2.500000 //the error is large
bin=4, entries=0, content=0.000000, error=0.000000
bin=5, entries=0, content=0.000000, error=0.000000
bin=6, entries=0, content=0.000000, error=0.000000
bin=7, entries=0, content=3.250000, error=-0.000000
bin=8, entries=0, content=0.000000, error=0.000000
My questions are:
- are the TProfile errors correctly calculated in this case? (I know that scaling of an histograms implies also the scaling of the errors, but I cannot see how this is done…)
- why do I get zero error for the bin with 1 entry (bin 7)?
- why do I get no entries at all for the TProfile obained after the scaling of the histogram, atlthough there are some bin contents?
I suppose these are elementary questions, but please bear with me
I’m using root Version 3.10/03 11 November 2004.
Thank you in advance,
Angela.