%%cpp -d #include "RooRealVar.h" #include "RooDataSet.h" #include "RooGaussian.h" #include "TCanvas.h" #include "TAxis.h" #include "RooPlot.h" #include "TText.h" #include "TArrow.h" #include "TFile.h" using namespace RooFit; RooRealVar x("x", "x", -10, 10); RooRealVar sigma("sigma", "sigma", 1, 0.1, 10); RooRealVar mean("mean", "mean", -3, -10, 10); RooGaussian gauss("gauss", "gauss", x, mean, sigma); std::unique_ptr data{gauss.generate(x, 1000)}; gauss.fitTo(*data, PrintLevel(-1)); RooPlot *frame = x.frame(Name("xframe"), Title("RooPlot with decorations"), Bins(40)); data->plotOn(frame); gauss.plotOn(frame); gauss.paramOn(frame, Layout(0.55)); data->statOn(frame, Layout(0.55, 0.99, 0.8)); TText *txt = new TText(2, 100, "Signal"); txt->SetTextSize(0.04); txt->SetTextColor(kRed); frame->addObject(txt); TArrow *arrow = new TArrow(2, 100, -1, 50, 0.01, "|>"); arrow->SetLineColor(kRed); arrow->SetFillColor(kRed); arrow->SetLineWidth(3); frame->addObject(arrow); TFile f("rf106_plotdecoration.root", "RECREATE"); frame->Write(); f.Close(); new TCanvas("rf106_plotdecoration", "rf106_plotdecoration", 600, 600); gPad->SetLeftMargin(0.15); frame->GetYaxis()->SetTitleOffset(1.6); frame->Draw(); %jsroot on gROOT->GetListOfCanvases()->Draw()