int testPlotRes() { RooRealVar x("x","x",0.,-5.,5.); RooRealVar m("m","m",0.,-3.,3.); RooRealVar s("s","s",1.,0.5,1.5); RooGaussian g("g","g",x,m,s); RooDataSet *data = g.generate(x,10000); RooPlot *frame = x.frame(); data->plotOn(frame); g.plotOn(frame); frame->GetXaxis()->SetTitle(""); frame->GetXaxis()->SetLabelSize(0); frame->GetYaxis()->SetLabelSize(0.05); RooPlot *residual= x.frame(); RooHist *resHist = (RooHist*)frame->pullHist(); residual->addObject(resHist,"PZ"); residual->SetMinimum(-5.); residual->SetMaximum(+5.); residual->GetXaxis()->SetLabelSize(0.1); residual->GetXaxis()->SetTitleOffset(0.8); residual->GetXaxis()->SetTitleSize(0.15); residual->GetYaxis()->SetLabelSize(0); residual->GetYaxis()->SetNdivisions(110); TCanvas *c = new TCanvas("c","c",400,400); c->Divide(2); c->GetPad(1)->SetPad(0.,0.3,1.,1.); c->GetPad(2)->SetPad(0.,0.,1.,0.3); c->GetPad(1)->SetBottomMargin(0); c->GetPad(2)->SetTopMargin(0); c->GetPad(2)->SetBottomMargin(0.25); c->GetPad(2)->SetFillColor(4000); c->cd(1); frame->Draw(); TArrow* arrow = new TArrow(-6.5,30.,-5.5,10.,0.01,">"); arrow->Draw(); c->cd(2); residual->Draw(); c->Print("test.gif"); return 0; }