# RooPDF generate overload problem

**URL:** <https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874>\
**Category:** Roofit and RooStats\
**Created:** [July 10, 2025, 3:10pm UTC](https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874 "2025-07-10T15:10:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vikas\_Raj](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vikas_raj/32/34682_2.png) [@Vikas\_Raj](https://root-forum.cern.ch/u/Vikas_Raj)\
**Post date:** [July 10, 2025, 3:10pm UTC](https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874/1 "2025-07-10T15:10:12Z")

</div>

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](https://root-forum.cern.ch/uploads/short-url/v05Ni075UCRnoSX7eT2ZkXydEEl.zip) (113.3 KB)

I get the following error regarding overload

```auto
---------------------------------------------------------------------------
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?

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [July 11, 2025, 9:46am UTC](https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874/2 "2025-07-11T09:46:14Z")

</div>

Hello @Vikas_Raj,

I invite @jonas to have a look here.

---

<div class="post-metadata">

**Author:** ![Vikas\_Raj](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vikas_raj/32/34682_2.png) [@Vikas\_Raj](https://root-forum.cern.ch/u/Vikas_Raj)\
**Post date:** [July 13, 2025, 9:37am UTC](https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874/3 "2025-07-13T09:37:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [July 13, 2025, 5:30pm UTC](https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874/4 "2025-07-13T17:30:23Z")

</div>

Maybe related: [https://its.cern.ch/jira/browse/ROOT-4900](https://its.cern.ch/jira/browse/ROOT-4900)

---

<div class="post-metadata">

**Author:** ![Vikas\_Raj](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vikas_raj/32/34682_2.png) [@Vikas\_Raj](https://root-forum.cern.ch/u/Vikas_Raj)\
**Post date:** [July 14, 2025, 6:30am UTC](https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874/5 "2025-07-14T06:30:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vikas\_Raj](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vikas_raj/32/34682_2.png) [@Vikas\_Raj](https://root-forum.cern.ch/u/Vikas_Raj)\
**Post date:** [July 15, 2025, 2:33pm UTC](https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874/6 "2025-07-15T14:33:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Vikas\_Raj](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vikas_raj/32/34682_2.png) [@Vikas\_Raj](https://root-forum.cern.ch/u/Vikas_Raj)\
**Post date:** [August 11, 2025, 5:59pm UTC](https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874/8 "2025-08-11T17:59:23Z")

</div>

Trying to keep in the logs!

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [August 25, 2025, 6:00pm UTC](https://root-forum.cern.ch/t/roopdf-generate-overload-problem/63874/9 "2025-08-25T18:00:05Z")

</div>

Closed on August 25, 2025, 6:00pm UTC

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