PyROOT and RooBinningCategory

Hi!

I am trying to create a RooBinningCategory for my RooDataSet in pyROOT. I follow this example: rf405
But I am getting the following error:

bash-5.1$ python test_fit.py 
[#1] INFO:DataHandling -- RooAbsCategory::attachToTree(year) TTree branch year will be interpreted as category index
[#1] INFO:DataHandling -- RooAbsCategory::attachToTree(hlt1b) TTree branch hlt1b will be interpreted as category index
<cppyy.gbl.RooAbsArg object at 0x(nil)> <class cppyy.gbl.RooAbsArg at 0x562311042af0>
 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================

Thread 2 (Thread 0x7ff5bd4ad700 (LWP 118682)):
#0  0x00007ff5e2829de2 in pthread_cond_timedwait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x000056230a119a7d in PyCOND_TIMEDWAIT (us=<optimized out>, mut=<optimized out>, cond=0x56230a399d60 <_PyRuntime+384>) at /usr/local/src/conda/python-3.9.13/Python/condvar.h:73
#2  take_gil () at /usr/local/src/conda/python-3.9.13/Python/ceval_gil.h:247
#3  0x000056230a161cb2 in PyEval_RestoreThread () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:467
#4  0x000056230a255d84 in pysleep (secs=<optimized out>) at /usr/local/src/conda/python-3.9.13/Modules/timemodule.c:2037
#5  time_sleep () at /usr/local/src/conda/python-3.9.13/Modules/timemodule.c:365
#6  0x000056230a141722 in cfunction_vectorcall_O () at /usr/local/src/conda/python-3.9.13/Objects/methodobject.c:516
#7  0x000056230a135636 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7ff5c85971c0, callable=0x7ff5e2bb3630, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:118
#8  PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x7ff5c85971c0, callable=0x7ff5e2bb3630) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127
#9  call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077
#10 _PyEval_EvalFrameDefault () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:3489
#11 0x000056230a12fa17 in _PyEval_EvalFrame (throwflag=0, f=0x7ff5c8597040, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Include/internal/pycore_ceval.h:40
#12 _PyEval_EvalCode () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:4329
#13 0x000056230a141ff9 in _PyFunction_Vectorcall (func=<optimized out>, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at /usr/local/src/conda/python-3.9.13/Objects/call.c:396
#14 0x000056230a134396 in do_call_core (kwdict=0x7ff5c857d140, callargs=0x7ff5e2bce4f0, func=0x7ff5e2bad550, tstate=<optimized out>) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:5125
#15 _PyEval_EvalFrameDefault () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:3582
#16 0x000056230a142303 in _PyEval_EvalFrame (throwflag=0, f=0x7ff5db577040, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Include/internal/pycore_ceval.h:40
#17 function_code_fastcall () at /usr/local/src/conda/python-3.9.13/Objects/call.c:330
#18 0x000056230a131063 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7ff5c85f09b8, callable=0x7ff5cee9b790, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:118
#19 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x7ff5c85f09b8, callable=0x7ff5cee9b790) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127
#20 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077
#21 _PyEval_EvalFrameDefault () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:3506
#22 0x000056230a142303 in _PyEval_EvalFrame (throwflag=0, f=0x7ff5c85f0840, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Include/internal/pycore_ceval.h:40
#23 function_code_fastcall () at /usr/local/src/conda/python-3.9.13/Objects/call.c:330
#24 0x000056230a131063 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x7ff5db4d21b8, callable=0x7ff5cee9ba60, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:118
#25 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x7ff5db4d21b8, callable=0x7ff5cee9ba60) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127
#26 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077
#27 _PyEval_EvalFrameDefault () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:3506
#28 0x000056230a142303 in _PyEval_EvalFrame (throwflag=0, f=0x7ff5db4d2040, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Include/internal/pycore_ceval.h:40
#29 function_code_fastcall () at /usr/local/src/conda/python-3.9.13/Objects/call.c:330
#30 0x000056230a1514a5 in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=1, args=0x7ff5bd4ace68, callable=0x7ff5cee9b820, tstate=0x56231073d460) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:103
#31 method_vectorcall () at /usr/local/src/conda/python-3.9.13/Objects/classobject.c:61
#32 0x000056230a2354e5 in t_bootstrap () at /usr/local/src/conda/python-3.9.13/Modules/_threadmodule.c:1040
#33 0x000056230a235494 in pythread_wrapper (arg=<optimized out>) at /usr/local/src/conda/python-3.9.13/Python/thread_pthread.h:245
#34 0x00007ff5e2825ea5 in start_thread () from /lib64/libpthread.so.0
#35 0x00007ff5e1c3db0d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7ff5e2c38740 (LWP 118539)):
#0  0x00007ff5e1c04659 in waitpid () from /lib64/libc.so.6
#1  0x00007ff5e1b81f62 in do_system () from /lib64/libc.so.6
#2  0x00007ff5e1b82311 in system () from /lib64/libc.so.6
#3  0x00007ff5db25f545 in TUnixSystem::StackTrace() () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/bin/../lib/libCore.so.6.26
#4  0x00007ff5e2a7785f in (anonymous namespace)::TExceptionHandlerImp::HandleException(int) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/bin/../lib/libcppyy_backend3_9.so.6.26
#5  0x00007ff5db25c721 in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/bin/../lib/libCore.so.6.26
#6  <signal handler called>
#7  0x00007ff5bc804601 in RooAbsCollection::find(RooAbsArg const&) const () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#8  0x00007ff5bc89a022 in RooArgSet::checkForDup(RooAbsArg const&, bool) const () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#9  0x00007ff5bc89a1ad in RooArgSet::canBeAdded(RooAbsArg const&, bool) const () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#10 0x00007ff5bc8072cc in RooAbsCollection::add(RooAbsArg const&, bool) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#11 0x00007ff5bc18c05b in ?? ()
#12 0x00000000ffffffff in ?? ()
#13 0x00007ffdf5e85fa7 in ?? ()
#14 0x0000000100000000 in ?? ()
#15 0x000056231211c970 in ?? ()
#16 0x00007ffdf5e85f10 in ?? ()
#17 0x0000562311fdbbb0 in ?? ()
#18 0x00007ff5bcc51dc0 in vtable for RooArgSet () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#19 0x00007ff5e2a7f8de in WrapperCall(long, unsigned long, void*, void*, void*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/bin/../lib/libcppyy_backend3_9.so.6.26
#20 0x00007ff5e2a7fcdf in Cppyy::CallB(long, void*, unsigned long, void*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/bin/../lib/libcppyy_backend3_9.so.6.26
#21 0x00007ff5db467860 in CPyCppyy::(anonymous namespace)::BoolExecutor::Execute(long, void*, CPyCppyy::CallContext*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#22 0x00007ff5db4530c9 in CPyCppyy::CPPMethod::ExecuteFast(void*, long, CPyCppyy::CallContext*) [clone .isra.0] () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#23 0x00007ff5db453e98 in CPyCppyy::CPPMethod::ExecuteProtected(void*, long, CPyCppyy::CallContext*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#24 0x00007ff5db45451a in CPyCppyy::CPPMethod::Execute(void*, long, CPyCppyy::CallContext*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#25 0x00007ff5db45569f in CPyCppyy::CPPMethod::Call(CPyCppyy::CPPInstance*&, _object*, _object*, CPyCppyy::CallContext*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#26 0x00007ff5db45a898 in CPyCppyy::(anonymous namespace)::mp_call(CPyCppyy::CPPOverload*, _object*, _object*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#27 0x00007ff5db48212e in CPyCppyy::tpp_call(CPyCppyy::TemplateProxy*, _object*, _object*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#28 0x000056230a139fa7 in _PyObject_MakeTpCall () at /usr/local/src/conda/python-3.9.13/Objects/call.c:200
#29 0x000056230a135d5f in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=<optimized out>, callable=0x7ff5c8668310, tstate=<optimized out>) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:116
#30 _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x56230b9af2a0, callable=0x7ff5c8668310, tstate=<optimized out>) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:103
#31 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x56230b9af2a0, callable=0x7ff5c8668310) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127
#32 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x56230b957650) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077
#33 _PyEval_EvalFrameDefault () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:3489
#34 0x000056230a12fa17 in _PyEval_EvalFrame (throwflag=0, f=0x56230b9af120, tstate=0x56230b957650) at /usr/local/src/conda/python-3.9.13/Include/internal/pycore_ceval.h:40
#35 _PyEval_EvalCode () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:4329
#36 0x000056230a12f6d7 in _PyEval_EvalCodeWithName (_co=<optimized out>, globals=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=argcount
entry=0, kwnames=<optimized out>, kwargs=0x0, kwcount=0, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:4361
#37 0x000056230a12f689 in PyEval_EvalCodeEx () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:4377
#38 0x000056230a1eae3b in PyEval_EvalCode (co=co
entry=0x7ff5e2b74df0, globals=globals
entry=0x7ff5e2b6ac00, locals=locals
entry=0x7ff5e2b6ac00) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:828
#39 0x000056230a2194a9 in run_eval_code_obj () at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1221
#40 0x000056230a215694 in run_mod () at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1242
#41 0x000056230a09a6d2 in pyrun_file (fp=0x56230b9ce950, filename=0x7ff5e2ac7ab0, start=257, globals=0x7ff5e2b6ac00, locals=0x7ff5e2b6ac00, closeit=1, flags=0x7ffdf5e86918) at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1140
#42 0x000056230a20f1f2 in pyrun_simple_file (flags=0x7ffdf5e86918, closeit=1, filename=0x7ff5e2ac7ab0, fp=0x56230b9ce950) at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:450
#43 PyRun_SimpleFileExFlags () at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:483
#44 0x000056230a20ef5b in PyRun_AnyFileExFlags () at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:92
#45 0x000056230a20c533 in pymain_run_file (cf=0x7ffdf5e86918, config=0x56230b955720) at /usr/local/src/conda/python-3.9.13/Modules/main.c:377
#46 pymain_run_python (exitcode=0x7ffdf5e86910) at /usr/local/src/conda/python-3.9.13/Modules/main.c:602
#47 Py_RunMain () at /usr/local/src/conda/python-3.9.13/Modules/main.c:681
#48 0x000056230a1debf0 in pymain_main () at /usr/local/src/conda/python-3.9.13/Modules/main.c:1077
#49 0x000056230a1deb79 in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at /usr/local/src/conda/python-3.9.13/Modules/main.c:1101
#50 0x00007ff5e1b61555 in __libc_start_main () from /lib64/libc.so.6
#51 0x000056230a1dea81 in _start () at /usr/local/src/conda/python-3.9.13/Python/pymath.c:88
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum https://root.cern/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#7  0x00007ff5bc804601 in RooAbsCollection::find(RooAbsArg const&) const () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#8  0x00007ff5bc89a022 in RooArgSet::checkForDup(RooAbsArg const&, bool) const () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#9  0x00007ff5bc89a1ad in RooArgSet::canBeAdded(RooAbsArg const&, bool) const () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#10 0x00007ff5bc8072cc in RooAbsCollection::add(RooAbsArg const&, bool) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#11 0x00007ff5bc18c05b in ?? ()
#12 0x00000000ffffffff in ?? ()
#13 0x00007ffdf5e85fa7 in ?? ()
#14 0x0000000100000000 in ?? ()
#15 0x000056231211c970 in ?? ()
#16 0x00007ffdf5e85f10 in ?? ()
#17 0x0000562311fdbbb0 in ?? ()
#18 0x00007ff5bcc51dc0 in vtable for RooArgSet () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/libRooFitCore.so.6.26.04
#19 0x00007ff5e2a7f8de in WrapperCall(long, unsigned long, void*, void*, void*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/bin/../lib/libcppyy_backend3_9.so.6.26
#20 0x00007ff5e2a7fcdf in Cppyy::CallB(long, void*, unsigned long, void*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/bin/../lib/libcppyy_backend3_9.so.6.26
#21 0x00007ff5db467860 in CPyCppyy::(anonymous namespace)::BoolExecutor::Execute(long, void*, CPyCppyy::CallContext*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#22 0x00007ff5db4530c9 in CPyCppyy::CPPMethod::ExecuteFast(void*, long, CPyCppyy::CallContext*) [clone .isra.0] () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#23 0x00007ff5db453e98 in CPyCppyy::CPPMethod::ExecuteProtected(void*, long, CPyCppyy::CallContext*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#24 0x00007ff5db45451a in CPyCppyy::CPPMethod::Execute(void*, long, CPyCppyy::CallContext*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#25 0x00007ff5db45569f in CPyCppyy::CPPMethod::Call(CPyCppyy::CPPInstance*&, _object*, _object*, CPyCppyy::CallContext*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#26 0x00007ff5db45a898 in CPyCppyy::(anonymous namespace)::mp_call(CPyCppyy::CPPOverload*, _object*, _object*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#27 0x00007ff5db48212e in CPyCppyy::tpp_call(CPyCppyy::TemplateProxy*, _object*, _object*) () from /cvmfs/lhcbdev.cern.ch/conda/envs/default/2022-06-15_17-18/linux-64/lib/python3.9/site-packages/libcppyy3_9.so
#28 0x000056230a139fa7 in _PyObject_MakeTpCall () at /usr/local/src/conda/python-3.9.13/Objects/call.c:200
#29 0x000056230a135d5f in _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=<optimized out>, callable=0x7ff5c8668310, tstate=<optimized out>) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:116
#30 _PyObject_VectorcallTstate (kwnames=0x0, nargsf=<optimized out>, args=0x56230b9af2a0, callable=0x7ff5c8668310, tstate=<optimized out>) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:103
#31 PyObject_Vectorcall (kwnames=0x0, nargsf=<optimized out>, args=0x56230b9af2a0, callable=0x7ff5c8668310) at /usr/local/src/conda/python-3.9.13/Include/cpython/abstract.h:127
#32 call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>, tstate=0x56230b957650) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:5077
#33 _PyEval_EvalFrameDefault () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:3489
#34 0x000056230a12fa17 in _PyEval_EvalFrame (throwflag=0, f=0x56230b9af120, tstate=0x56230b957650) at /usr/local/src/conda/python-3.9.13/Include/internal/pycore_ceval.h:40
#35 _PyEval_EvalCode () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:4329
#36 0x000056230a12f6d7 in _PyEval_EvalCodeWithName (_co=<optimized out>, globals=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=argcount
entry=0, kwnames=<optimized out>, kwargs=0x0, kwcount=0, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:4361
#37 0x000056230a12f689 in PyEval_EvalCodeEx () at /usr/local/src/conda/python-3.9.13/Python/ceval.c:4377
#38 0x000056230a1eae3b in PyEval_EvalCode (co=co
entry=0x7ff5e2b74df0, globals=globals
entry=0x7ff5e2b6ac00, locals=locals
entry=0x7ff5e2b6ac00) at /usr/local/src/conda/python-3.9.13/Python/ceval.c:828
#39 0x000056230a2194a9 in run_eval_code_obj () at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1221
#40 0x000056230a215694 in run_mod () at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1242
#41 0x000056230a09a6d2 in pyrun_file (fp=0x56230b9ce950, filename=0x7ff5e2ac7ab0, start=257, globals=0x7ff5e2b6ac00, locals=0x7ff5e2b6ac00, closeit=1, flags=0x7ffdf5e86918) at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:1140
#42 0x000056230a20f1f2 in pyrun_simple_file (flags=0x7ffdf5e86918, closeit=1, filename=0x7ff5e2ac7ab0, fp=0x56230b9ce950) at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:450
#43 PyRun_SimpleFileExFlags () at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:483
#44 0x000056230a20ef5b in PyRun_AnyFileExFlags () at /usr/local/src/conda/python-3.9.13/Python/pythonrun.c:92
#45 0x000056230a20c533 in pymain_run_file (cf=0x7ffdf5e86918, config=0x56230b955720) at /usr/local/src/conda/python-3.9.13/Modules/main.c:377
#46 pymain_run_python (exitcode=0x7ffdf5e86910) at /usr/local/src/conda/python-3.9.13/Modules/main.c:602
#47 Py_RunMain () at /usr/local/src/conda/python-3.9.13/Modules/main.c:681
#48 0x000056230a1debf0 in pymain_main () at /usr/local/src/conda/python-3.9.13/Modules/main.c:1077
#49 0x000056230a1deb79 in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at /usr/local/src/conda/python-3.9.13/Modules/main.c:1101
#50 0x00007ff5e1b61555 in __libc_start_main () from /lib64/libc.so.6
#51 0x000056230a1dea81 in _start () at /usr/local/src/conda/python-3.9.13/Python/pymath.c:88
===========================================================


Traceback (most recent call last):
  File "/project/bfys/valukash/BsJpsiphi/p2vv/scripts/run2/test_fit.py", line 40, in <module>
    catSet.add(cat)
TypeError: Template method resolution failed:
  none of the 2 overloaded methods succeeded. Full details:
  bool RooAbsCollection::add(const RooAbsArg& var, bool silent = kFALSE) =>
    SegmentationViolation: segfault in C++; program state was reset
  bool RooAbsCollection::add(const RooAbsCollection& list, bool silent = kFALSE) =>
    TypeError: could not convert argument 1
  Failed to instantiate "add(RooAbsArg&)"
  Failed to instantiate "add(RooAbsArg*)"
  Failed to instantiate "add(RooAbsArg)"

Attached is a simple example code for this behavior: test_fit.py (1.5 KB)
It was run with root 6.26/04.

Any help is appreciated. Thanks!

It looks like a Roostats issue. May be @moneta can help.

Hi @watmann,

sorry for the late reply! There are two problems in your script.

First, you should use addColumn instead of add to use a new column to the dataset:

dataSet.addColumn(KKMassCat)

Second, your RooBinningCategory will not work when adding the column to the dataset, because the binning of KKMass is not consistent. You are first creating a RooDataSet, where the variables are copied, and then you are changing the binning of the original KKMass variable. Now the binning of the variable in the dataset is inconsistent with what you intended, because the internal copy is not updated.

In short, you need to create the RooDataSet after the call KKMass.setBinning.

I hope that helps!

Cheers,
Jonas

Thanks @jonas !