'ORGANIZATION AND SIMULTANEOUS FITS' RooFit tutorial macro #508
RooArgSet and RooArgList tools and tricks
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) 0x6fe8a30 RooRealVar:: a = 1 C L(-10 - 10) "a"
2) 0x60ad040 RooRealVar:: b = 2 C L(-10 - 10) "b"
3) 0x6f85db0 RooRealVar:: c = 3 +/- 0.5 L(-10 - 10) "c"
4) 0x6f0ba80 RooRealVar:: d = 4 L(-10 - 10) "d"
5) 0x725ed30 RooCategory:: e = sig(idx = 0)
"e"
6) 0x72840d0 RooGaussian:: g[ x=x mean=a sigma=b ] = 0.882497 "g"
sclone = { @0x7304490, @0x7304498, @0x73044a0, @0x73044a8, @0x73044b0, @0x73044b8 }
- Date
- February 2018
- Authors
- Clemens Lange, Wouter Verkerke (C version)
Definition in file rf508_listsetmanip.py.