Limit drawing of histogram to certain bins

Hi,

I am sure this question has been answered before but I am unable to find a solution for the following problem:

I want to draw a signal on top of a THStack, but I want to limit the growing range to the region around the bump of my invariant mass spectrum.

If I do not limit the drawing range, the plot looks like shown in the attachment. I want the signal (green line) to e only visible in the 125GeV region.

Of course I could write a custom histogram filling function to actually set the signal to 0 outside the peak but I am hopeful that there is some built-in way to do it.

Thanks for any hints.
invMass125.pdf (20.3 KB)

Is the histogram shown as a green line part of the THStack ?

No - I draw it using the “same” option.

Then you should be able to say: GreenHisto->SetAxisRange(xmin, xmax, "X"); GreenHisto->Draw("][ SAME");

Thats exactly what I wanted. Thank you! :smiley: