21void rf514_RooCustomizer() {
28 RooRealVar meanG(
"meanG",
"meanG", 100., 0., 3000.);
32 RooRealVar pol1(
"pol1",
"Constant of the polynomial", 1, -10, 10);
35 RooRealVar yieldSig(
"yieldSig",
"yieldSig", 1, 0, 1.E4);
36 RooRealVar yieldBkg(
"yieldBkg",
"yieldBkg", 1, 0, 1.E4);
42 std::cout <<
"The proto model before customisation:" << std::endl;
48 sample.defineType(
"Sample1");
49 sample.defineType(
"Sample2");
50 sample.defineType(
"Sample3");
64 RooCustomizer cust(model, sample, newLeafs, &allCustomiserNodes);
65 cust.splitArg(meanG, sample);
75 RooFormulaVar yield1(
"yieldSig_Sample1",
"Signal yield in the first sample",
"M/3.360779", mass);
76 RooFormulaVar yield2(
"yieldSig_Sample2",
"Signal yield in the second sample",
"M/2", mass);
77 allCustomiserNodes.
add(yield1);
78 allCustomiserNodes.
add(yield2);
81 cust.splitArg(yieldSig, sample);
85 auto pdf1 = cust.build(
"Sample1");
86 auto pdf2 = cust.build(
"Sample2");
87 auto pdf3 = cust.build(
"Sample3");
90 std::cout <<
"\nPDF 1 with a yield depending on M:" << std::endl;
92 std::cout <<
"\nPDF 2 with a yield depending on M:" << std::endl;
94 std::cout <<
"\nPDF 3 with a free yield:" << std::endl;
97 std::cout <<
"\nThe following leafs have been created automatically while customising:" << std::endl;
102 auto& meanG1 =
static_cast<RooRealVar&
>(allCustomiserNodes[
"meanG_Sample1"]);
104 auto& meanG2 =
static_cast<RooRealVar&
>(allCustomiserNodes[
"meanG_Sample2"]);
107 std::cout <<
"\nThe following leafs have been used while customising"
108 <<
"\n\t(partial overlap with the set of automatically created leaves."
109 <<
"\n\ta new customiser for a different PDF could reuse them if necessary.):" << std::endl;
110 allCustomiserNodes.
Print(
"V");
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
RooAddPdf is an 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.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
RooCategory represents a fundamental (non-derived) discrete value object.
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
RooPolynomial implements a polynomial p.d.f of the form.
RooRealVar represents a variable that can be changed from the outside.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
static constexpr double gauss
constexpr Double_t E()
Base of natural log: