26void rf501_simultaneouspdf()
53 RooRealVar mean_ctl(
"mean_ctl",
"mean_ctl", -3, -8, 8);
57 RooRealVar a0_ctl(
"a0_ctl",
"a0_ctl", -0.1, -1, 1);
58 RooRealVar a1_ctl(
"a1_ctl",
"a1_ctl", 0.5, -0.1, 1);
62 RooRealVar f_ctl(
"f_ctl",
"f_ctl", 0.5, 0., 1.);
69 std::unique_ptr<RooDataSet> data{model.generate({
x}, 1000)};
70 std::unique_ptr<RooDataSet> data_ctl{model_ctl.generate({
x}, 2000)};
77 sample.defineType(
"physics");
78 sample.defineType(
"control");
81 RooDataSet combData(
"combData",
"combined data",
x, Index(sample),
82 Import({{
"physics", data.get()}, {
"control", data_ctl.get()}}));
89 RooSimultaneous simPdf(
"simPdf",
"simultaneous pdf", {{
"physics", &model}, {
"control", &model_ctl}}, sample);
95 std::unique_ptr<RooFitResult> fitResult{simPdf.fitTo(combData,
Save(),
PrintLevel(-1))};
105 std::unique_ptr<RooAbsData> slicedData1{combData.reduce(
Cut(
"sample==sample::physics"))};
106 slicedData1->plotOn(frame1);
109 simPdf.getPdf(
"physics")->plotOn(frame1);
123 std::unique_ptr<RooAbsData> slicedData2{combData.reduce(
Cut(
"sample==sample::control"))};
124 slicedData2->plotOn(frame2);
125 simPdf.plotOn(frame2,
ProjWData(sample, *slicedData2));
131 combData.plotOn(frame3);
132 simPdf.plotOn(frame3,
ProjWData(sample, combData));
136 TCanvas *
c =
new TCanvas(
"rf501_simultaneouspdf",
"rf403_simultaneouspdf", 1200, 400);
138 auto draw = [&](
int i,
RooPlot & frame) {
140 gPad->SetLeftMargin(0.15);
141 frame.GetYaxis()->SetTitleOffset(1.4);
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
Efficient implementation of a sum of PDFs of the form.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
Chebychev polynomial p.d.f.
Container class to hold unbinned data.
Plot frame and a container for graphics objects within that frame.
Variable that can be changed from the outside.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
RooCmdArg Title(const char *name)
RooCmdArg Bins(Int_t nbin)
RooCmdArg Import(const char *state, TH1 &histo)
RooCmdArg Save(bool flag=true)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg Components(Args_t &&... argsOrArgSet)
RooCmdArg ProjWData(const RooAbsData &projData, bool binData=false)
RooCmdArg Cut(const char *cutSpec)
RooCmdArg LineStyle(Style_t style)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...