import ROOT
x = ROOT.RooRealVar("x", "x", -10, 10)
m = ROOT.RooRealVar("m", "m", 0, -10, 10)
s = ROOT.RooRealVar("s", "s", 1, -10, 10)
gauss = ROOT.RooGaussian("g", "g", x, m, s)
p0 = ROOT.RooRealVar("p0", "p0", 0.01, 0.0, 1.0)
poly = ROOT.RooPolynomial("p", "p", x, [p0])
f = ROOT.RooRealVar("f", "f", 0.5, 0.0, 1.0)
model = ROOT.RooAddPdf("model", "model", [gauss, poly], [f])
c = ROOT.RooCategory("c", "c")
c.defineType("run1")
c.defineType("run2")
d = ROOT.RooCategory("d", "d")
d.defineType("foo")
d.defineType("bar")
w = ROOT.RooWorkspace("w", "w")
w.Import({model, c, d})
sct = ROOT.RooSimWSTool(w)
model_sim = sct.build("model_sim", "model", SplitParam=("m", "c"))
model_sim.Print("t")
w.var("m_run1").setVal(-3)
w.var("m_run2").setVal(+3)
w.Print("v")
model_sim2 = sct.build("model_sim2", "model", SplitParam=("p0", "c,d"))
model_sim2.Print("t")
[#0] WARNING:InputArguments -- The parameter 's' with range [-10, 10] of the RooGaussian 'g' exceeds the safe range of (0, inf). Advise to limit its range.
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooGaussian::g
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::x
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::m
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::s
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::f
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooCategory::d
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooCategory::c
Splitrule for p.d.f model with state list
parameter m is split with constraint in categories (c)
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: list of prototype pdfs (model)
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: list of splitting categories (c)
[#1] INFO:ObjectHandling -- RooSimPdfBuilder::executeBuild: processing prototype pdf model
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: configured customizers for all prototype pdfs
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode run1
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode run2
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooSimultaneous::model_sim
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_run1
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooGaussian::g_run1
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::m_run1
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_run2
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooGaussian::g_run2
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::m_run2
0x8e93f30 RooSimultaneous::model_sim = 1 [Auto,Dirty]
0x86d0db0/V- RooCategory::c = run2(idx = 1)
0x8f11170/V- RooAddPdf::model_run1 = 1/1 [Auto,Clean]
0x919bc80/V- RooGaussian::g_run1 = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x8ea7eb0/V- RooRealVar::m_run1 = 0
0x8d44000/V- RooRealVar::s = 1
0x8d37ea0/V- RooRealVar::f = 0.5
0x8e4f1e0/V- RooPolynomial::p = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x8dea110/V- RooRealVar::p0 = 0.01
0x914b7e0/V- RooAddPdf::model_run2 = 1/1 [Auto,Clean]
0x9133620/V- RooGaussian::g_run2 = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x9135920/V- RooRealVar::m_run2 = 0
0x8d44000/V- RooRealVar::s = 1
0x8d37ea0/V- RooRealVar::f = 0.5
0x8e4f1e0/V- RooPolynomial::p = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x8dea110/V- RooRealVar::p0 = 0.01
RooWorkspace(w) w contents
variables
---------
(c,d,f,m,m_run1,m_run2,p0,s,x)
p.d.f.s
-------
RooGaussian::g[ x=x mean=m sigma=s ] = 1
RooGaussian::g_run1[ x=x mean=m_run1 sigma=s ] = 0.011109
RooGaussian::g_run2[ x=x mean=m_run2 sigma=s ] = 0.011109
RooAddPdf::model[ f * g + [%] * p ] = 1/1
RooAddPdf::model_run1[ f * g_run1 + [%] * p ] = 0.505554/1
RooAddPdf::model_run2[ f * g_run2 + [%] * p ] = 0.505554/1
RooSimultaneous::model_sim[ indexCat=c run1=model_run1 run2=model_run2 ] = 0.505554
RooPolynomial::p[ x=x coefList=(p0) ] = 1
Splitrule for p.d.f model with state list
parameter p0 is split with constraint in categories (c,d)
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: list of prototype pdfs (model)
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: list of splitting categories (c,d)
[#1] INFO:ObjectHandling -- RooSimPdfBuilder::executeBuild: processing prototype pdf model
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooMultiCategory::c,d
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: configured customizers for all prototype pdfs
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode {run1;bar}
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode {run1;foo}
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode {run2;bar}
[#1] INFO:ObjectHandling -- RooSimWSTool::executeBuild: Customizing prototype pdf model for mode {run2;foo}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooSimultaneous::model_sim2
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooSuperCategory::model_sim2_index
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooMultiCategory::model_sim2_index_internalMultiCat
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_{run1;bar}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p_{run1;bar}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0_{run1;bar}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_{run1;foo}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p_{run1;foo}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0_{run1;foo}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_{run2;bar}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p_{run2;bar}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0_{run2;bar}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooAddPdf::model_{run2;foo}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooPolynomial::p_{run2;foo}
[#1] INFO:ObjectHandling -- RooWorkspace::import(w) importing RooRealVar::p0_{run2;foo}
0x90dea30 RooSimultaneous::model_sim2 = 1 [Auto,Dirty]
0x211dd30/V- RooSuperCategory::model_sim2_index = {run2;foo}(idx = 1)
[Auto,Clean]
0x8ef5400/VS RooMultiCategory::model_sim2_index_internalMultiCat = {run2;foo}(idx = 1)
[Auto,Clean]
0x86d0db0/VS RooCategory::c = run2(idx = 1)
0x8c3d590/VS RooCategory::d = foo(idx = 0)
0x90d3320/V- RooAddPdf::model_{run1;bar} = 1/1 [Auto,Clean]
0x9069ba0/V- RooGaussian::g = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x212a4c0/V- RooRealVar::m = 0
0x8d44000/V- RooRealVar::s = 1
0x8d37ea0/V- RooRealVar::f = 0.5
0x913b350/V- RooPolynomial::p_{run1;bar} = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x91e9790/V- RooRealVar::p0_{run1;bar} = 0.01
0x91e9e10/V- RooAddPdf::model_{run1;foo} = 1/1 [Auto,Clean]
0x9069ba0/V- RooGaussian::g = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x212a4c0/V- RooRealVar::m = 0
0x8d44000/V- RooRealVar::s = 1
0x8d37ea0/V- RooRealVar::f = 0.5
0x91eea00/V- RooPolynomial::p_{run1;foo} = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x91f0f30/V- RooRealVar::p0_{run1;foo} = 0.01
0x91f15b0/V- RooAddPdf::model_{run2;bar} = 1/1 [Auto,Clean]
0x9069ba0/V- RooGaussian::g = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x212a4c0/V- RooRealVar::m = 0
0x8d44000/V- RooRealVar::s = 1
0x8d37ea0/V- RooRealVar::f = 0.5
0x918f3a0/V- RooPolynomial::p_{run2;bar} = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x9191930/V- RooRealVar::p0_{run2;bar} = 0.01
0x9191f40/V- RooAddPdf::model_{run2;foo} = 1/1 [Auto,Clean]
0x9069ba0/V- RooGaussian::g = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x212a4c0/V- RooRealVar::m = 0
0x8d44000/V- RooRealVar::s = 1
0x8d37ea0/V- RooRealVar::f = 0.5
0x370b420/V- RooPolynomial::p_{run2;foo} = 1 [Auto,Dirty]
0x2186670/V- RooRealVar::x = 0
0x370d9b0/V- RooRealVar::p0_{run2;foo} = 0.01