Failed rescale for a rebin histogram

Dear experts, i am having a trouble re-scaling a histogram that is a Rebin of another histogram. I was working in MeV but decided to re-scale everything to GeV. I used the following command:

xminn = h_wplus.GetXaxis().GetXmin()
xmaxx = h_wplus.GetXaxis().GetXmax()

and re-scaled every other histogram that i was working with. Everything was ok, until i tried to reescale a histogram that is a rebin of another histogram. As you can see below (the below graph is actually in MeV instead of GeV as axis says). The rebinned histogram is the one in blue in the main plot.

mtw.pdf (23.3 KB)

And so, i reescaled the data and every other histogram, with the same code that i used above. But when i tried to reescale the rebinned histogram i get this:

mtw.pdf (22.7 KB)

He does not appear anymore, with the other histograms. But if i turn off his rescale i get this:

mtw.pdf (23.1 KB)

So i dont know if i can reescale a .Rebin() like that, or if i did something wrong.

What do you mean by re-scale here?
If your histo is filled with data in GeV, and the range goes from, say, 1 to 5 GeV, that’s what you’ll get in the x-axis. What exactly do you want to see?

  • If you want the data to be instead 1 to 5 MeV, you would have to create the histo accordingly from the beginning and change the data when you are filling the histogram.
  • If you just want to zoom-in to the bins 1 to 5 MeV, you can use SetLimits as you did, or SetRangeUser, but might get an empty histo, since the lowest bin was 1 GeV.
1 Like

Hi @dastudillo ,

My X axis limits was from 40000 to 150000, so i just divided it by 1000, so it goes from 40 to 150. And so all the histograms that come from the monte carlo and data, behaved as expected, as i showed in the images.

But the histogram that is .Rebin() of other histogram dont “behave” exactly as the other histograms, and it simply does not show in the new window that the x axis goes from 40 to 150.

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