Why does changing the suffix in TH1::GetCumulative results in a segmentation violation?

I was getting a very lengthy segmentation violation while using the TH1::GetCumulative method on PyROOT, so I decided to do a simple test.

The following works fine. I can create a histogram that looks like the one shown below.

import ROOT
h = ROOT.TH1('h', 'h', 100, -3, 3)
h.FillRandom('gaus', 10000)
hc = h.GetCumulative()
hc.Draw()

But when I try to change the suffix of the cumulative histogram using the following method, I get a segmentation violation.

hc = h.GetCumulative(suffix='_mysuffix')

Coud this be a bug?

ROOT Version: 6.30/04
Platform: Linux
Compiler: GCC 12.3.0
Using Python 3.10.14 (packaged by conda-forge)


Hello,

You are instantiating a TH1. Have you tried with a TH1F or TH1D? I am confused because that line should not work.

Cheers,
D

Also, try with a more recent version of ROOT. With the latest (6.32.04), for instance, we get some information:

>>> import ROOT
>>> h = ROOT.TH1F('h', 'h', 100, -3, 3)
>>> h.FillRandom('gaus', 10000)
>>> hc = h.GetCumulative(suffix='_mysuffix')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cppyy_default_compiler", line 1, in <module>
NameError: name 'kTRUE' is not defined
>>>

If you provide the “forward” parameter as ROOT.kTRUE (or Python’s True) instead of the default kTRUE, it works:

>>> hc = h.GetCumulative(suffix='_mysuffix', forward=ROOT.kTRUE)
>>> 

Sorry, I meant to type TH1F. The problem still persists in 6.30.04.

@dastudillo Yes, it works with the 6.32 versions if I modify the forward parameter. Hopefully, in the future, I won’t need to do that.

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