@@ -909,6 +909,7 @@ def getPdf(self, channel, process, _cache=None):
909909 stderr .write ("Warning: the shapeN implementation in RooStats and L&S are different\n " )
910910 pdfs = ROOT .RooArgList (nominalPdf ) if self .options .useHistPdf == "always" else ROOT .TList ()
911911 if self .options .useHistPdf != "always" :
912+ ROOT .SetOwnership (nominalPdf , False )
912913 pdfs .Add (nominalPdf )
913914 coeffs = ROOT .RooArgList ()
914915 minscale = 1
@@ -917,6 +918,8 @@ def getPdf(self, channel, process, _cache=None):
917918 pdfs .add (pdfUp )
918919 pdfs .add (pdfDown )
919920 else :
921+ ROOT .SetOwnership (pdfUp , False )
922+ ROOT .SetOwnership (pdfDown , False )
920923 pdfs .Add (pdfUp )
921924 pdfs .Add (pdfDown )
922925 if scale == 1 :
@@ -949,6 +952,7 @@ def getPdf(self, channel, process, _cache=None):
949952 maxbins = 0
950953 for i in range (pdfs .GetSize ()):
951954 rebinned = self .rebinH1 (pdfs .At (i ))
955+ ROOT .SetOwnership (rebinned , False )
952956 rebins .Add (rebinned )
953957 maxbins = max (maxbins , rebinned ._original_bins )
954958 if channelBinParFlag :
@@ -1264,6 +1268,7 @@ def shape2Pdf(self, shape, channel, process, _cache=None):
12641268 if self .options .useHistPdf == "never" :
12651269 shape = self .rebinH1 (shape )
12661270 tlist = ROOT .TList ()
1271+ ROOT .SetOwnership (shape , False )
12671272 tlist .Add (shape )
12681273 if channelBinParFlag :
12691274 rhp = ROOT .CMSHistFunc (
0 commit comments