Dividing 2 TH1F histograms - why integer entries and how to get float numbers?

Dear root community! :slight_smile:

I have 2 TH1F histograms (h_data and h_mctot) and want to build a third one (h_ratio) with the ratio of the original ones as entries (i.e. ratio data/MC).

h_ratio = h_data.Clone()
h_ratio.Divide(h_mctot)
h_ratio.Sumw2()

However, when I plot this the entries of h_ratio are integer, but I obviously need float number entires, e.g. 1.3 instead of 1.

So my questions:

  • Why the int entries? Integer division?
  • Where is my mistake?
  • How can I get float number entries?

Thanks a lot! :slight_smile:

Can you post the histogram you are talking about here ? so we can have a look at them โ€ฆ


Hereโ€™s the histograms. I want to do the ratio of histograms data and mctot. The last one is the result with only integer entries.

May be @moneta may have an idea just looking the the plots ?

Looks strange. Can you please upload the macro and possibly also the histograms in a ROOT file ?

Thank you

Lorenzo

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