{ using namespace RooFit; using namespace RooStats; // Model built reading theHLF card HLFactory hlf("HLFactoryExample","example_3c_card.rs"); RooWorkspace* w = hlf.GetWs(); // Generate a toy sample according to the expected number of events RooRealVar* imass= w->var("imass"); RooAbsPdf* model = w->pdf("model"); RooDataSet *data = model->generate(*imass,Extended()); // ML fit of the model to the data model->fitTo(*data); // Plot everything on a frame RooPlot* imassframe = imass->frame(); data->plotOn(imassframe); model->plotOn(imassframe); model->plotOn(imassframe,Components(*w->pdf("background")),LineStyle(kDashed)); imassframe->Draw(); }