Histogram superposition

Dear colleagues,
I have a problem with superposion of 2 histograms (using Draw(“same”)) for the signal and background with the difference in values about 10^7 orders of magnitude. I manage to see only one of these histograms in the picture even
in logarithmic scale. Is there any trick how to see them both together for comparison? Coul you give a code example?
Thank you for suggetion of using 2 different scales, but I need to put them on the same scale.That is the question.
Thank you in advance

So you draw the histograms as scatter plots it seems ? can you provide a small script showing the problem ?

${ROOTSYS}/tutorials/hist/transpad.C
${ROOTSYS}/tutorials/hist/twoscales.C
${ROOTSYS}/tutorials/hist/twoscales.py


TH1F *h311 = new TH1F(“h311”,“E^{mu+}distribution”,120,0,12);
TH1F *h1012 = new TH1F(“h1012”,“E^{\l+}_{bkg} distribution”,100,0,10);

// h311->DrawCopy("");
// h1012->SetFillColor(kRed-7);
h1012->DrawCopy();
// h311->SetLineColor(kMagenta+3);
h311->Draw(“same”);

These are not 2D histograms. They are 1D histograms.

If you do:

TH1F *h311 = new TH1F(“h311”,“E^{mu+}distribution”,120,0,12);
TH1F *h1012 = new TH1F(“h1012”,“E^{\l+}_{bkg} distribution”,100,0,10);
[…]
h1012->Draw();
h311->Draw(“same”);

and it the range of h311 is inside the range of h1012 in X and Y then you should see both histograms. To compute a global range including both histogram you can also use THStack

Yes, thank you, I also noted that the X ranges a different. A changed them,
but the result is the same. I mean that the second histogram is existing in the picture, but so negligible, that is not seen.
Ok, thanks I’ll try to use Stack

That will not help. You also need to go to log scale on Y . Be careful with 0 …

1 Like

Thank you ! Stack together with Log scale works!