27using std::ofstream, std::cout;
29void rs603_HLFactoryElaborateExample()
34 TString card_name(
"rs603_card_WsMaker.rs");
35 ofstream ofile(card_name);
36 ofile <<
"// The simplest card for combination\n\n";
37 ofile <<
"gauss1 = Gaussian(x[0,100],mean1[50,0,100],4);\n";
38 ofile <<
"flat1 = Polynomial(x,0);\n";
39 ofile <<
"sb_model1 = SUM(nsig1[120,0,300]*gauss1 , nbkg1[100,0,1000]*flat1);\n\n";
40 ofile <<
"echo In the middle!;\n\n";
41 ofile <<
"gauss2 = Gaussian(x,mean2[80,0,100],5);\n";
42 ofile <<
"flat2 = Polynomial(x,0);\n";
43 ofile <<
"sb_model2 = SUM(nsig2[90,0,400]*gauss2 , nbkg2[80,0,1000]*flat2);\n\n";
44 ofile <<
"echo At the end!;\n";
47 TString card_name2(
"rs603_card.rs");
48 ofstream ofile2(card_name2);
49 ofile2 <<
"// The simplest card for combination\n\n";
50 ofile2 <<
"gauss1 = Gaussian(x[0,100],mean1[50,0,100],4);\n";
51 ofile2 <<
"flat1 = Polynomial(x,0);\n";
52 ofile2 <<
"sb_model1 = SUM(nsig1[120,0,300]*gauss1 , nbkg1[100,0,1000]*flat1);\n\n";
53 ofile2 <<
"echo In the middle!;\n\n";
54 ofile2 <<
"gauss2 = Gaussian(x,mean2[80,0,100],5);\n";
55 ofile2 <<
"flat2 = Polynomial(x,0);\n";
56 ofile2 <<
"sb_model2 = SUM(nsig2[90,0,400]*gauss2 , nbkg2[80,0,1000]*flat2);\n\n";
57 ofile2 <<
"#include rs603_included_card.rs;\n\n";
58 ofile2 <<
"echo At the end!;\n";
61 TString card_name3(
"rs603_included_card.rs");
62 ofstream ofile3(card_name3);
63 ofile3 <<
"echo Now reading the included file!;\n\n";
64 ofile3 <<
"echo Including datasets in a Workspace in a Root file...;\n";
65 ofile3 <<
"data1 = import(rs603_infile.root,\n";
66 ofile3 <<
" rs603_ws,\n";
67 ofile3 <<
" data1);\n\n";
68 ofile3 <<
"data2 = import(rs603_infile.root,\n";
69 ofile3 <<
" rs603_ws,\n";
70 ofile3 <<
" data2);\n";
75 HLFactory hlf(
"HLFactoryComplexExample",
"rs603_card_WsMaker.rs",
false);
77 auto x =
static_cast<RooRealVar *
>(hlf.GetWs()->arg(
"x"));
78 auto pdf1 = hlf.GetWs()->pdf(
"sb_model1");
79 auto pdf2 = hlf.GetWs()->pdf(
"sb_model2");
84 data1->SetName(
"data1");
88 data2->SetName(
"data2");
93 TFile outfile(
"rs603_infile.root",
"RECREATE");
97 cout <<
"-------------------------------------------------------------------\n"
98 <<
" Rootfile and Workspace prepared \n"
99 <<
"-------------------------------------------------------------------\n";
101 HLFactory hlf_2(
"HLFactoryElaborateExample",
"rs603_card.rs",
false);
103 x = hlf_2.GetWs()->var(
"x");
104 pdf1 = hlf_2.GetWs()->pdf(
"sb_model1");
105 pdf2 = hlf_2.GetWs()->pdf(
"sb_model2");
107 hlf_2.AddChannel(
"model1",
"sb_model1",
"flat1",
"data1");
108 hlf_2.AddChannel(
"model2",
"sb_model2",
"flat2",
"data2");
110 auto data = hlf_2.GetTotDataSet();
111 auto pdf = hlf_2.GetTotSigBkgPdf();
112 auto thecat = hlf_2.GetTotCategory();
118 auto xframe =
x->frame();
120 data->plotOn(xframe);
127 gROOT->SetStyle(
"Plain");
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Variable that can be changed from the outside.
HLFactory is an High Level model Factory allows you to describe your models in a configuration file (...
Persistable container for RooFit projects.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
RooCmdArg Extended(bool flag=true)
RooCmdArg ProjWData(const RooAbsData &projData, bool binData=false)
RooCmdArg Slice(const RooArgSet &sliceSet)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Namespace for the RooStats classes.