33void rs603_HLFactoryElaborateExample() {
37 TString card_name(
"rs603_card_WsMaker.rs");
38 ofstream ofile(card_name);
39 ofile <<
"// The simplest card for combination\n\n";
40 ofile <<
"gauss1 = Gaussian(x[0,100],mean1[50,0,100],4);\n";
41 ofile <<
"flat1 = Polynomial(x,0);\n";
42 ofile <<
"sb_model1 = SUM(nsig1[120,0,300]*gauss1 , nbkg1[100,0,1000]*flat1);\n\n";
43 ofile <<
"echo In the middle!;\n\n";
44 ofile <<
"gauss2 = Gaussian(x,mean2[80,0,100],5);\n";
45 ofile <<
"flat2 = Polynomial(x,0);\n";
46 ofile <<
"sb_model2 = SUM(nsig2[90,0,400]*gauss2 , nbkg2[80,0,1000]*flat2);\n\n";
47 ofile <<
"echo At the end!;\n";
50 TString card_name2(
"rs603_card.rs");
51 ofstream ofile2(card_name2);
52 ofile2 <<
"// The simplest card for combination\n\n";
53 ofile2 <<
"gauss1 = Gaussian(x[0,100],mean1[50,0,100],4);\n";
54 ofile2 <<
"flat1 = Polynomial(x,0);\n";
55 ofile2 <<
"sb_model1 = SUM(nsig1[120,0,300]*gauss1 , nbkg1[100,0,1000]*flat1);\n\n";
56 ofile2 <<
"echo In the middle!;\n\n";
57 ofile2 <<
"gauss2 = Gaussian(x,mean2[80,0,100],5);\n";
58 ofile2 <<
"flat2 = Polynomial(x,0);\n";
59 ofile2 <<
"sb_model2 = SUM(nsig2[90,0,400]*gauss2 , nbkg2[80,0,1000]*flat2);\n\n";
60 ofile2 <<
"#include rs603_included_card.rs;\n\n";
61 ofile2 <<
"echo At the end!;\n";
64 TString card_name3(
"rs603_included_card.rs");
65 ofstream ofile3(card_name3);
66 ofile3 <<
"echo Now reading the included file!;\n\n";
67 ofile3 <<
"echo Including datasets in a Workspace in a Root file...;\n";
68 ofile3 <<
"data1 = import(rs603_infile.root,\n";
69 ofile3 <<
" rs603_ws,\n";
70 ofile3 <<
" data1);\n\n";
71 ofile3 <<
"data2 = import(rs603_infile.root,\n";
72 ofile3 <<
" rs603_ws,\n";
73 ofile3 <<
" data2);\n";
79 "rs603_card_WsMaker.rs",
83 RooAbsPdf* pdf1 = hlf.GetWs()->pdf(
"sb_model1");
84 RooAbsPdf* pdf2 = hlf.GetWs()->pdf(
"sb_model2");
98 TFile outfile(
"rs603_infile.root",
"RECREATE");
102 cout <<
"-------------------------------------------------------------------\n"
103 <<
" Rootfile and Workspace prepared \n"
104 <<
"-------------------------------------------------------------------\n";
107 HLFactory hlf_2(
"HLFactoryElaborateExample",
111 x = hlf_2.GetWs()->var(
"x");
112 pdf1 = hlf_2.GetWs()->pdf(
"sb_model1");
113 pdf2 = hlf_2.GetWs()->pdf(
"sb_model2");
115 hlf_2.AddChannel(
"model1",
"sb_model1",
"flat1",
"data1");
116 hlf_2.AddChannel(
"model2",
"sb_model2",
"flat2",
"data2");
119 RooAbsPdf* pdf = hlf_2.GetTotSigBkgPdf();
128 data->plotOn(xframe);
135 gROOT->SetStyle(
"Plain");
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
RooDataSet * generate(const RooArgSet &whatVars, Int_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
See RooAbsPdf::generate(const RooArgSet&,const RooCmdArg&,const RooCmdArg&,const RooCmdArg&,...
virtual RooFitResult * fitTo(RooAbsData &data, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none())
Fit PDF to given dataset.
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none(), const RooCmdArg &arg9=RooCmdArg::none(), const RooCmdArg &arg10=RooCmdArg::none()) const
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCategory represents a fundamental (non-derived) discrete value object.
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)
Set value by specifying the index code of the desired state.
RooDataSet is a container class to hold unbinned data.
void SetName(const char *name)
Change the name of this dataset into the given name.
A RooPlot is a plot frame and a container for graphics objects within that frame.
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
RooRealVar represents a fundamental (non-derived) real valued object.
HLFactory is an High Level model Factory allows you to describe your models in a configuration file (...
The RooWorkspace is a persistable container for RooFit projects.
RooCmdArg ProjWData(const RooAbsData &projData, Bool_t binData=kFALSE)
RooCmdArg Extended(Bool_t flag=kTRUE)
RooCmdArg Slice(const RooArgSet &sliceSet)
@(#)root/roostats:$Id$ Author: George Lewis, Kyle Cranmer