#include "RooRealVar.h" #include "RooDataSet.h" #include "RooGaussian.h" #include "RooConstVar.h" #include "RooChebychev.h" #include "RooAddPdf.h" #include "RooSimultaneous.h" #include "RooCategory.h" #include "TCanvas.h" #include "TAxis.h" #include "RooPlot.h" void MultiDim_Fit() { // Create variables RooRealVar MBC("MBC","Mbc [GeV/c^{2}]",5.23,5.29); RooRealVar DELTAE("DELTAE", "#Delta E [GeV]", -0.3, 0.3); // Construct signal pdf //--- Signal mbc ---// RooRealVar Sig_mean_Mbc("Sig_mean_Mbc","#mu_Mbc", 5.279787, 5.25, 5.29); RooRealVar Sig_sigma_Mbc("Sig_sigma_Mbc","#sigma_Mbc", 0.003, 0.0, 1.0); RooGaussian Sig_Mbc("Sig_Mbc", "Sig_Mbc", MBC, Sig_mean_Mbc, Sig_sigma_Mbc); //--- Signal for DELTAE ---// RooRealVar Sig_mean_deltaE("Sig_mean_deltaE","#mu_DELTAE", 0.0, -0.1, 0.1); RooRealVar Sig_sigma_deltaE("Sig_sigma_deltaE","#sigma_DELTAE", 0.02, 0.0, 1.0); RooGaussian Sig_deltaE("Sig_deltaE", "Sig_deltaE", DELTAE, Sig_mean_deltaE, Sig_sigma_deltaE); //--- Create Multi-dimensiona PDF RooProdPdf Prod("Prod","Prod",RooArgList(Sig_Mbc,Sig_deltaE)) ; // Generate a toy MC dataset RooDataSet* data = Prod.generate(RooArgSet(MBC,DELTAE), 2000); // Perform extended ML fit to toy data: Prod.fitTo(*data); // Create RooPlot object to plot toy data and fit overlaid: RooPlot* xframe = MBC.frame(); data->plotOn(xframe); Prod.plotOn(xframe); RooPlot* yframe = DELTAE.frame(); data->plotOn(yframe); Prod.plotOn(yframe); //Create canvases and plot TCanvas *Cx = new TCanvas("Cx", "Cx"); Cx->cd(); xframe->Draw(); TCanvas *Cy = new TCanvas("Cy", "Cy"); Cy->cd(); yframe->Draw(); }