Normalizing Histogram

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

I am drawing data from two different root files overlayed. So I have 2 histograms drawn in the same canvas.
Everytime I try to normalise the histograms, for instance making:

h1->Scale(1/h1->Integral ())
h2->Scale(1/h2->Integtal ())

only the last histogram is drawn.

What can be the problem?

You need to show how you draw them, e.g. use something like this:

h1->SetLineColor(kBlack); h1->Draw("HIST L *");
h2->SetLineColor(kRed); h2->Draw("HIST SAME");

Yes, I’m making:

h1-> Draw (“H”);
h2-> Draw (“H same”);

But everytime I scale the histograms as I showed before, it only draws the last histogram.

h1->Scale(1.0/h1->Integral ());
h2->Scale(1.0/h2->Integtal ());
h1-> Draw (“HIST”);
h2-> Draw (“HIST sames”);
TPaveStats stats = (TPaveStats*)h2->FindObject(“stats”);

Note: inside the scale it’s 1.0 not 1, it’s probably the reason, for example 1/2 gives to 0 not 0.5

Try to draw these two histograms in two separate pads and see how much they differ (maybe they are “equal” after scaling but, using my code you should still see them both).

Yes, you are right. They look the same after scaling ( what shouldn’t happen).
I need to see what’s the problem.
Thank you!

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