Setting the minimum y for a RooPlot

I’m trying to display a RooPlot of an invariant mass distribution but I can’t get the Plot to display events from y=0. I have tried the following:

#Make my shapes (gaussian, exponential, etc)

#Make a list of them

#Then make my model
    model = ROOT.RooAddPdf("model" , "model", argList, normArgList)
    rHist = ROOT.RooDataHist("rHist", "rHist", ROOT.RooArgList(var), h)
    rHist.SetNameTitle("rHist" , T)

    model.fitTo(rHist)
#Make the frame
    frame = var.frame()

    rHist.plotOn(frame)

    for i in range(len(components)):
        model.plotOn(frame, ROOT.RooFit.Components(components[i]), ROOT.RooFit.LineColor(colours[i]), ROOT.RooFit.LineStyle(2))
    
    model.plotOn(frame)
    frame.SetMinimum(0)

This however does not display the y axis until 0. I have tried placing the #SetMinimum(0) before plotting the models onto the frame as well. Still does not work

Any help is appreciated

Regards,
Diyon

Hello Diyon335,

I am inviting @StephanH to this post, as he may know the answer to this question.

Cheers,
J.

Hi @Diyon335, according to RooPlot doxygen you can GetYaxis(). SetRangeUser(0,MaxValue).hopefully this will work

@RENATO_QUAGLIANI , thanks for your response. I just tried it but it still does not work

Hello @Diyon335,

I am also inviting @moneta to this post. He might help to shed some light on this.

Cheers,
J.

Use RooPlot::SetAxisRange, see https://root.cern.ch/doc/master/classRooPlot.html#ae91b317630b54eba518945adb64b6558

frame.SetAxisRange(ymin, max, "Y");

Lorenzo

axis

I have tried all the suggestions but as you can see, it does not go all the way to y = 0. is there some sort of override I must do in order to force it? because it seems to me that no matter what I do, ROOT just does not listen

Hi,
Strange that the above line does not work. Can you please save the RooPlot object in a ROOT file and post it, so I can have a look ?
Thank you

Lorenzo

@moneta , unfortunately my permission to do this is restricted. is there any other way you could help me out?

Hi,
If you don’t want to share the plot with everybody, (although you have already added the figure), you can always send it to me by private email

Lorenzo

@moneta, sorry I should have explained better. I believe the way my Nikhef account has been set does not allow me to scp files via the remote server and my local machine. Therefore I am not able to get the file and upload it. These plots were screenshots I took

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