Skip to content

Commit

Permalink
[RF] Avoid using RooAbsCollection::addOwned() in PyROOT
Browse files Browse the repository at this point in the history
  • Loading branch information
guitargeek committed Jun 1, 2023
1 parent 03a1fc7 commit 98c7d6d
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions tutorials/roofit/rf508_listsetmanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,13 @@
# Owning RooArgSets
# ---------------------------------

# Create a RooArgSet that owns its components
# A set either owns all of its components or none,
# so once addOwned() is used, add() can no longer be
# used and will result in an error message

ac = a.clone("a")
bc = b.clone("b")
cc = c.clone("c")

# You can create a RooArgSet that owns copies of the objects instead of
# referencing the originals. A set either owns all of its components or none,
# so once addClone() is used, add() can no longer be used and will result in an
# error message
s3 = ROOT.RooArgSet()
# s3.addOwned(ROOT.RooArgSet(ac, bc, cc))
s3.addOwned(ac)
s3.addOwned(bc)
s3.addOwned(cc)

# Another possibility is to add an owned clone
# of an object instead of the original
# s3.addClone(ROOT.RooArgSet(d, e, g))
s3.addClone(d)
s3.addClone(e)
s3.addClone(g)
for arg in [a, b, c, d, e, g]:
s3.addClone(arg)

# A clone of a owning set is non-owning and its
# contents is owned by the originating owning set
Expand All @@ -117,7 +103,7 @@
# dependencies, together form a self-consistent
# set that is free of external dependencies

sclone3 = s3.snapshot(ROOT.kTRUE)
sclone3 = s3.snapshot(True)

# Set printing
# ------------------------
Expand Down

0 comments on commit 98c7d6d

Please sign in to comment.