RooPDF generate overload problem

Hi, I’m trying to generate toy samples using pdf.generate with pyroot and I cannot make it work.

The code looks like this: please find the html file of my jupyter nb
pureToy_Belle_Test_2.zip (113.3 KB)

I get the following error regarding overload

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[33], line 53
     51 print(f"Fixed conditional {cond} = {reso_ws[cond].getVal()}")
     52 print("*"*100)
---> 53 ds_bin = pdf.generate(genObs,nevt_bin)
     54 # Convert and store
     55 df_bin = ds_bin.to_pandas()

File ~/miniconda3/envs/veronesi/lib/python3.11/site-packages/ROOT/_pythonization/_roofit/_rooabspdf.py:93, in RooAbsPdf.generate(self, *args, **kwargs)
     91 # Redefinition of `RooAbsPdf.generate` for keyword arguments.
     92 args, kwargs = _kwargs_to_roocmdargs(*args, **kwargs)
---> 93 return self._generate(*args, **kwargs)

TypeError: none of the 5 overloaded methods succeeded. Full details:
  RooDataSet* RooAbsPdf::generate(const RooArgSet& whatVars, int nEvents, const RooCmdArg& arg1, const RooCmdArg& arg2 = {}, const RooCmdArg& arg3 = {}, const RooCmdArg& arg4 = {}, const RooCmdArg& arg5 = {}) =>
    TypeError: takes at least 3 arguments (2 given)
  RooDataSet* RooAbsPdf::generate(const RooArgSet& whatVars, const RooCmdArg& arg1 = {}, const RooCmdArg& arg2 = {}, const RooCmdArg& arg3 = {}, const RooCmdArg& arg4 = {}, const RooCmdArg& arg5 = {}, const RooCmdArg& arg6 = {}) =>
    TypeError: could not convert argument 2
  RooDataSet* RooAbsPdf::generate(const RooArgSet& whatVars, const RooDataSet& prototype, int nEvents = 0, bool verbose = false, bool randProtoOrder = false, bool resampleProto = false) =>
    TypeError: could not convert argument 2
  RooDataSet* RooAbsPdf::generate(RooAbsPdf::GenSpec&) =>
    TypeError: takes at most 1 arguments (2 given)
  RooDataSet* RooAbsPdf::generate(const RooArgSet& whatVars, double nEvents = 0, bool verbose = false, bool autoBinned = true, const char* binnedTag = "", bool expectedData = false, bool extended = false) =>
    SegmentationViolation: segfault in C++; program state was reset

I don’t see what could be wrong. Any ideas?

Hello @Vikas_Raj,

I invite @jonas to have a look here.

I seem to have noticed that RooAddPDF works pretty well, but one of the pdfs has a conditional applied on it RooProdPdf::sig_pdf_td_q0[ sig_pdf_q0 * sig_cond_pdf0|tagflav ] and none of them work!
So it seems like it could be an issue with RooProdPdf or conditional or both !
Thanks.

Maybe related: https://its.cern.ch/jira/browse/ROOT-4900

Hi
Sorry, I am not able to view this page through my institute email ID and, I do not have a CERN account.

Okay, I was able to open the link and study it. But it seems that maybe RooProdPDF is not the issue. As it worked for Extended 3D PDF, so perhaps it has to do with the conditional?