Fail to get a filled histogram after using scale

Dear,

Before I use scale to normalize the plot, it is a filled histogram. However, after I use it to normalize, those data are shown in lines and points automatically in the figure.
All the change in my code is adding
“tt->Scale(1/norm_tt);”
after
“tt->Fill(params4[0]);”
in the file.
No error or warning show up in the terminal.
How can I get a filled and normalized histogram at the same time?
Thank you.

_ROOT Version: 6.18
_Platform: linux

TH1F *tt_scaled = (TH1F*)(tt->Clone("tt_scaled")); // if "tt" is a "TH1F"
if (tt_scaled->GetSumw2N() == 0) tt_scaled->Sumw2(kTRUE);
tt_scaled->Scale(1. / norm_tt);

I add lines you suggest after the line
signal[i]->Fill(paramx[i]);
in my code, but the plot still with error bar, not the filled histogram.
Do I miss something?

Possibly: tt->Draw("HIST");

It was in my code already.
Nevertheless, I try the example: twoscales() in ROOTUserGuide, and I found that I can not get the same figure. In the example, the figure should be a consecutive red line, but when I compile the same code, the data shows in red dots with error bar.
Is it a problem with Root 6.18? Or just something I should setup beforehand since I install root on my computer on my own.

In the “twoscales” example, use h1->Draw("hist"); and hint1->Draw("hist same");

1 Like

It works! thank you for your help.

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