Dear ROOT experts,
I am a newbie to RooFit
.
I tried to plot a distribution with dominant background. But the RooPlot
is always starting from 0. I can barely see the detailed structure since the signal was overwhelmed without zooming in.
A mini code snippet to reproduce is
void test()
{
RooRealVar x("x", "", -6, 6);
RooRealVar x0("x0", "", 0);
RooRealVar sigma("sigma", "", 1, 0.00001, 5);
RooGaussian gaus("gaus", "", x, x0, sigma);
RooRealVar a1("a1", "", 0.1);
RooChebychev cb("cb", "", x, RooArgList(a1));
RooRealVar nsig("nsig", "", 100);
RooRealVar nbkg("nbkg", "", 50000);
RooAddPdf sum("sum", "s+b", RooArgList(gaus, cb), RooArgList(nsig, nbkg));
auto ds = sum.generate(x, 2000000);
ds->SetName("ds");
TCanvas* c = new TCanvas();
auto frame = x.frame();
ds->plotOn(frame);
//frame->SetMinimum(1000);
frame->Draw();
}
The platform is 1fedora 34 and ROOT version is 6.24.
Is this behavior expected? Does ROOT
provide a way to automatically determine the range, like TH1::Draw
? When I draw a histogram, it will automatically adjust the maximum and minimum of y axis.
Many thanks in advance!