Dear experts,
I get the error when running the following code, which is obtained by modifying the tutorial macro rf102_dataimport.C
Please tell me what’s wrong with the code.
THANKS
[#0] ERROR:InputArguments -- RooBinning::binEdges ERROR: bin number must be in range (0,0)
[#0] ERROR:InputArguments -- RooBinning::binEdges ERROR: bin number must be in range (0,0)
[#0] ERROR:InputArguments -- RooAbsRealLValue::frame(x) ERROR: empty fit range, must specify plot range
[#0] ERROR:InputArguments -- RooDataHist::dh:plotOn: frame is null
TH1* makeTH1() ;
void gaus()
{
TH1* hh = makeTH1() ;
RooRealVar x("x","x",-1,-8.,8.) ;
x.getBinning(nullptr).Print("");
RooDataHist dh("dh","dh",x,Import(*hh)) ;
RooPlot* frame = x.frame() ;
dh.plotOn(frame) ;
RooRealVar mean("mean","mean",0,-5,5) ;
RooRealVar sigma("sigma","sigma",1,0.1,4) ;
RooGaussian gauss("gauss","gauss",x,mean,sigma) ;
gauss.fitTo(dh);
gauss.plotOn(frame) ;
frame->Draw() ;
}
TH1* makeTH1()
{
TFile f1("dedx_p.root");
TH1F *hh=f1.Get("dedx_chi_p_mc_2009_0.20");;
return hh ;
}