{ // observables RooRealVar x("x", "random var x", 0.0, 1.0); RooRealVar y("y", "random var y", 0.0, 1.0); // Gaussian model of x RooRealVar mu("mu", "mean parameter", 0.5, 0.0, 1.0); RooRealVar sigma("sigma", "width parameter", 0.1, 0.0, 0.3); RooGaussian gaus("gaus", "Gaussian PDF", x, mu, sigma); // Polynomial of y: 1 + p1*y + p2*y^2 RooRealVar p1("p1", "coeff. of y^1", +0.3, -10., 10.); RooRealVar p2("p2", "coeff. of y^2", -0.8, -10., 10.); RooPolynomial poly("poly", "2nd order poly.", y, RooArgSet(p1,p2)); // product: Gaussian(x) * Polynomial(y) RooProdPdf model("model","PDF model", gaus,poly); // generate random data, plot RooDataSet *data = model.generate(RooArgSet(x,y), 10000); RooPlot* frame_x = x.frame(); RooPlot* frame_y = y.frame(); TCanvas *c1 = new TCanvas("c1","Canvas", 800, 400); c1->Divide(2); c1->cd(1); data->plotOn(frame_x); model.plotOn(frame_x); frame_x->Draw(); c1->cd(2); data->plotOn(frame_y); model.plotOn(frame_y); frame_y->Draw(); }