#include #include using namespace std; using namespace RooFit; void Create(){ RooRealVar x("x","x",0,10); RooRealVar mean("mean","mean",5); RooRealVar sigma("sigma","sigma",2); RooGaussian gss("gss","gss",x,mean,sigma); TFile *f = new TFile("Post.root","RECREATE"); RooWorkspace *w = new RooWorkspace("w","workspace"); w->import(gss); w->Write(); f->Close(); } void Plot(){ RooRealVar *x; RooAbsPdf *model; TFile *in = new TFile("Post.root"); RooWorkspace *w = (RooWorkspace*)in->Get("w"); x = w->var("x"); model = w->pdf("gss"); RooPlot *P = x->frame(); model->plotOn(P); P->GetYaxis()->SetTitle(""); P->GetXaxis()->SetTitle(""); P->SetTitle(""); P->Print("v"); P->Draw(); }