Difference between" DrawNormalized" and Scaled by 1 then "Draw"

Hi, I don’t know I can ask here my question.
I have tried to normalization with two method.

  1. with DrawNormalized
    h->DrawNormalize(“histo”);
  2. with Scale 1 and Draw.
    Double_t Norm=h->GenEntries();
    h->Scale(1/Norm);
    h->Draw(“histo”);

My friend said that "DrawNormalized " also gives the plot which entries are normalized by 1. However I have obtained quite difference results for two cases.
I have attached my histograms to help your understanding

  1. original histogram
  2. Draw Normalized
  3. Scaled by 1 then Draw
    4.second and third histogram draw “same”

I have uploaded again histograms

See the documentation of this method. You can also look at the code to see what is done exactly.

Hi,

I read the “documentation” of DrawNormalized() before the posting. I saw the code also but It is not clear the meaning.

I also asked this problem to experts(than me) but they also don’t know why two drawing methods give me a different result.

That’s why I asking here.

I have tried to change like below, but I have the same results.

Double_t norm1=1;

h->DrawNormalized("histo",norm1);

h->DrawNormalized("histo",norm=1);

Can you tell me more detail why the two draw method give the different results?

Thanks

Mi Ran

2020년 4월 1일 (수) 오전 2:33, Olivier Couet via ROOT Forum root.discourse@cern.ch님이 작성:

Looking at the code we can tell that DrawNormalized do:

     Double_t norm1=1;
     Double_t sum = h->GetSumOfWeights();
     h->Scale(norm1/sum);
     h->Draw();
2 Likes

I think that the “Scale” method doesn’t handle the weights properly. I have just found a difference when trying to normalise weighted histograms. If you plot the integral after scaling you will figure out that the weighted one gives a result equal to the average weight value while the non-weighted one gives you integral=1 .

I guess @moneta might help.