From 98c7d6dc1723a649b8e03ad367c2a82de8281cb6 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Thu, 1 Jun 2023 02:19:04 +0200 Subject: [PATCH] [RF] Avoid using `RooAbsCollection::addOwned()` in PyROOT --- tutorials/roofit/rf508_listsetmanip.py | 28 +++++++------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/tutorials/roofit/rf508_listsetmanip.py b/tutorials/roofit/rf508_listsetmanip.py index c64364c534337..c6ebd00847a98 100644 --- a/tutorials/roofit/rf508_listsetmanip.py +++ b/tutorials/roofit/rf508_listsetmanip.py @@ -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 @@ -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 # ------------------------