Dear experts,
Could you please tell me how to generate toy samples and fit it with simultaneous pdf? The script is as following:
RooRealVar m_pmu("m_pmu","m_pmu",4867, 5867);
gROOT->ProcessLine(".L ../Bs2pmuFit/mass_calibration/RooDoubleCBandGauss.cxx+");
R__LOAD_LIBRARY(../Bs2pmuFit/mass_calibration/RooDoubleCBandGauss_cxx.so);
TFile f("../Bs2pmuFit/gauss_constraint/bpmu_wofirstMLPbin.root");
RooWorkspace *w = (RooWorkspace*)f.Get("w");
RooCategory mybin("mybin","mybin");
RooArgSet* constraints = (RooArgSet*)w->set("constraints");
RooAbsPdf *pdf[8];
RooArgSet* observables = (RooArgSet*)w->set("observables");
RooSimultaneous simNew("simNew","simNew",mybin);
observables->add(mybin);
RooRealVar * BR_Bd = (RooRealVar*)w->var("BR_Bd");
RooRealVar * BR_Bs = (RooRealVar*)w->var("BR_Bs");
BR_Bd->setVal(1e-8);
BR_Bd->setMin(-3e-9);
BR_Bd->setMax(4e-8);
BR_Bs->setConstant();BR_Bs->setVal(0);
//BR_Bs->setVal(1e-8);
//BR_Bs->setMin(-1e-8);
//BR_Bs->setMax(4e-8);
//BR_Bd->setConstant();BR_Bd->setVal(0);
RooDataSet* data = simNew.generate(*observables, Extended());
//simNew.fitTo(*data);
RooPlot *frame = m_pmu.frame();
data->plotOn(frame);
//simNew.plotOn(frame);
TCanvas* c = new TCanvas("rf801_mcstudy","rf801_mcstudy",900,900) ;
frame->Draw() ;
c->SaveAs("toy_fit.pdf");
So simNew
is the simultaneous pdf, and the variable m_pmu
is actually what I would like to generate, and m_pmu
is also in observable
. It seems I should use generate(*observable)
, but I could not use RooPlot *frame = observable->frame();
Could anyone tell me how to generate some samples and plot them?
Many thanks in advance!
Lingzhu