{ using namespace RooFit; TFile f2("PHSP2S.root"); TTree* tree2 = (TTree*) f2.Get("Particle"); TFile f("Zb1062s02S.root"); TTree* tree = (TTree*) f.Get("Particle"); RooRealVar xx("xx","xx",10.4,10.8); xx.setBins(50); RooRealVar yy("yy","yy",0.1,1.8); yy.setBins(100); RooRealVar mean1("mean1","mean1",10.61,10.50,10.68); RooRealVar sigma1("sigma1","sigma1",0.040,0.01,.500); RooDataSet* data = new RooDataSet("data","data",tree,RooArgSet(xx,yy)); RooDataSet* data2 = new RooDataSet("data2","data2",tree2,RooArgSet(xx,yy)); RooDataHist* roohist = new RooDataHist("roohist","roohist",RooArgSet(xx,yy),*data2); RooHistPdf* pdfhist = new RooHistPdf("pdfhist","pdfhist",RooArgSet(xx,yy),*roohist); RooRealVar npdf("npdf","npdf",10.,0.1,500000); RooBreitWigner* rooBW1 = new RooBreitWigner("rooBW1","rooBW1",xx,mean1,sigma1); RooRealVar nBW("nBW","nBW",10.,0.1,100000); RooRealVar One("One","",1.); RooAddPdf* BWOne = new RooAddPdf("BWOne","BWOne",RooArgList(*rooBW1,One),RooArgList(nBW,npdf)); RooProdPdf* eTotal = new RooProdPdf("eTotal","eTotal",RooArgList(*BWOne,*pdfhist)); eTotal->fitTo(*data,NumCPU(2),"e",Strategy(2)); TCanvas rooCan; RooPlot *rooFrame = xx.frame(); RooPlot *rooFrame2 = yy.frame(); data.plotOn(rooFrame); eTotal->plotOn(rooFrame,NumCPU(2)); data.plotOn(rooFrame2); eTotal->plotOn(rooFrame2,NumCPU(2)); rooFrame->DrawClone(); TCanvas rooCan2; rooFrame2->DrawClone(); }