RooHistPdf Objet can't live outside a class member function

Dear expert

I am using pyROOT to create RooHistPdf and use it.

The problem lies with the RooHistPdf object. It seems that even when I define it as self.pdf = RooHistPdf(), the content of RooHistPdf gets deleted once the member function completes, although the type of the instance is retained.

For example, when I define sigpdf in one function (HZZAnalysis/SignalModel/ at cbf0b63514ad533371ce5ae470d9df8672f9d11f · jialin-guo1/HZZAnalysis · GitHub), I am unable to use it in another function (HZZAnalysis/SignalModel/ at cbf0b63514ad533371ce5ae470d9df8672f9d11f · jialin-guo1/HZZAnalysis · GitHub). when I check the type of sigpdf outside the function. it is still a RooHistPdf but no content in it.


Dear Jialin,

as far as I can tell from the RooHistPdf documentation, it does not take ownership of the passed RooDataHist. Could you try storing it in self as well and see if that works?


Indeed that should work!

There was recently another post with the same problem:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.