'ORGANIZATION AND SIMULTANEOUS FITS' RooFit tutorial macro #508
RooArgSet and RooArgList tools and tricks
from __future__ import print_function
import ROOT
a = ROOT.RooRealVar("a", "a", 1, -10, 10)
b = ROOT.RooRealVar("b", "b", 2, -10, 10)
c = ROOT.RooRealVar("c", "c", 3, -10, 10)
d = ROOT.RooRealVar("d", "d", 4, -10, 10)
x = ROOT.RooRealVar("x", "x", 0, -10, 10)
c.setError(0.5)
a.setConstant()
b.setConstant()
e = ROOT.RooCategory("e", "e")
e.defineType("sig")
e.defineType("bkg")
g = ROOT.RooGaussian("g", "g", x, a, b)
s = ROOT.RooArgSet(a, b)
s.add(e)
s.add(c)
s.add(d)
s.add(g)
s.remove(d)
aptr = s.find("a")
subset1 = s.selectByName("a,b,c")
subset2 = s.selectByAttrib("Constant", ROOT.kTRUE)
s1 = ROOT.RooArgSet(a, b, c)
s2 = ROOT.RooArgSet(c, d, e)
subset3 = s1.selectCommon(s2)
s3 = ROOT.RooArgSet()
for arg in [a, b, c, d, e, g]:
s3.addClone(arg)
sclone = s3.Clone("sclone")
sclone2 = s3.snapshot()
sclone3 = s3.snapshot(True)
print("sclone = ", sclone)
sclone.Print()
sclone.Print("s")
sclone.Print("v")
l = ROOT.RooArgList(a, b, c, d)
l.add(ROOT.RooArgList(a, b, c, d))
arg4 = l.at(4)
[#0] WARNING:InputArguments -- The parameter 'b' with range [-10, 10] of the RooGaussian 'g' exceeds the safe range of (0, inf). Advise to limit its range.
RooArgSet::sclone = (a,b,c,d,e,g)
1) RooRealVar:: a = 1
2) RooRealVar:: b = 2
3) RooRealVar:: c = 3 +/- 0.5
4) RooRealVar:: d = 4
5) RooCategory:: e = sig(idx = 0)
6) RooGaussian:: g = 0.882497
1) 0x8a14390 RooRealVar:: a = 1 C L(-10 - 10) "a"
2) 0x898f1d0 RooRealVar:: b = 2 C L(-10 - 10) "b"
3) 0x89ae4a0 RooRealVar:: c = 3 +/- 0.5 L(-10 - 10) "c"
4) 0x89bd430 RooRealVar:: d = 4 L(-10 - 10) "d"
5) 0x8c80220 RooCategory:: e = sig(idx = 0)
"e"
6) 0x8d49270 RooGaussian:: g[ x=x mean=a sigma=b ] = 0.882497 "g"
sclone = { @0x8d55f10, @0x8d55f18, @0x8d55f20, @0x8d55f28, @0x8d55f30, @0x8d55f38 }
- Date
- February 2018
- Authors
- Clemens Lange, Wouter Verkerke (C version)
Definition in file rf508_listsetmanip.py.