Organization and simultaneous fits: basic use of the 'object factory' associated with a workspace to rapidly build pdfs functions and their parameter components 
 
import ROOT
 
 
compact = False
 
 
 
if not compact:
    
    w.factory(
"Gaussian::sig1(x[-10,10],mean[5,0,10],0.5)")
 
    w.factory(
"Chebychev::bkg(x,{a0[0.5,0.,1],a1[-0.2,0.,1.]})")
 
    w.factory(
"SUM::sig(sig1frac[0.8,0.,1.]*sig1,sig2)")
 
    w.factory(
"SUM::model(bkgfrac[0.5,0.,1.]*bkg,sig)")
 
 
else:
 
    
    
    
 
        "SUM::model(bkgfrac[0.5,0.,1.]*Chebychev::bkg(x[-10,10],{a0[0.5,0.,1],a1[-0.2,0.,1.]}), "
        "SUM(sig1frac[0.8,0.,1.]*Gaussian(x,mean[5,0,10],0.5), Gaussian(x,mean,1)))"
    )
 
 
data = w["model"].generate({w["x"]}, 1000)
 
x = w["x"]
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
  [#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing dataset modelData
[#1] INFO:ObjectHandling -- RooWorkSpace::import(w) changing name of dataset from  modelData to data
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) Resolving name conflict in workspace by changing name of imported node  k to k_workspace
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooKeysPdf::k_workspace
 
RooWorkspace(w) w contents
 
variables
---------
(a0,a1,bkgfrac,mean,sig1frac,x)
 
p.d.f.s
-------
RooChebychev::bkg[ x=x coefList=(a0,a1) ] = 1
RooKeysPdf::k_workspace[ x=x ] = 0.0139016
RooAddPdf::model[ bkgfrac * bkg + [%] * sig ] = 0.5/1
RooAddPdf::sig[ sig1frac * sig1 + [%] * sig2 ] = 7.45331e-07/1
RooGaussian::sig1[ x=x mean=mean sigma=0.5 ] = 1.92875e-22
RooGaussian::sig2[ x=x mean=mean sigma=1 ] = 3.72665e-06
 
datasets
--------
RooDataSet::data(x)
 
- Date
 - February 2018 
 
- Authors
 - Clemens Lange, Wouter Verkerke (C++ version) 
 
Definition in file rf511_wsfactory_basic.py.