RooNDKeysPdf shape from MC not fixed when using it in a data fit

Dear experts,

(using version v6.20.06 in x86_64-centos7-gcc9-opt with python)

I am trying to use a 2D kernel PDF made with RooNDKeysPdf in a two-dimensional fit, but when I use it for the fit with RooFit, its shape changes. The kernel PDF is built as:

bkg_QED_2D = R.RooNDKeysPdf("bkg_QED_2D","bkg_QED_2D",R.RooArgList(psi_mass_QED_MC,psi_ptsq_QED_MC),dataset_QED_MC,"am")

In MC.pdf you can see how it looks as extracted from simulation , and in fit.pdf you can see how after I use it in the fit, there are features that were not there before.


I went to the documentation and saw that there is a fixShape() option, but I am unsure on how to use it.

I tried doing:

  1. bkg_QED_2D.fixShape(1), with the outcome
 *** Break *** segmentation violation



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

Thread 2 (Thread 0x7fe56f4c1700 (LWP 114133)):
#0  0x00007fe589004de2 in pthread_cond_timedwait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fe5895ae60b in PyCOND_TIMEDWAIT (cond=<optimized out>, mut=<optimized out>, us=5000) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/condvar.h:90
#2  take_gil (tstate=tstate
entry=0x57223b0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval_gil.h:208
#3  0x00007fe5895ae8ff in PyEval_RestoreThread (tstate=tstate
entry=0x57223b0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:271
#4  0x00007fe589638fa2 in pysleep (secs=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Modules/timemodule.c:1844
#5  time_sleep (self=<optimized out>, obj=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Modules/timemodule.c:371
#6  0x00007fe5894e2a64 in _PyMethodDef_RawFastCallKeywords (method=0x7fe589959c20 <time_methods+288>, self=<optimized out>, args=<optimized out>, nargs=1, kwnames=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:648
#7  0x00007fe5894e2b78 in _PyCFunction_FastCallKeywords (func=0x7fe587ca8d70, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:734
#8  0x00007fe5894b81a0 in call_function (pp_stack=pp_stack
entry=0x7fe56f4c06b8, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:4568
#9  0x00007fe5894beac1 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:3093
#10 0x00007fe5894b6ccb in function_code_fastcall (co=co
entry=0x7fe587a94780, args=<optimized out>, args
entry=0x7fe587febce8, nargs=nargs
entry=1, globals=globals
entry=0x7fe589a0a230) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:283
#11 0x00007fe5894e2528 in _PyFunction_FastCallDict (func=0x7fe587d453b0, args=0x7fe587febce8, nargs=1, kwargs=0x7fe587d571e0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:322
#12 0x00007fe5894bd14c in do_call_core (kwdict=0x7fe587d571e0, callargs=0x7fe587febcd0, func=0x7fe587d453b0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:4645
#13 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:3191
#14 0x00007fe5894b6ccb in function_code_fastcall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:283
#15 0x00007fe5894e26d2 in _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:415
#16 0x00007fe5894b7f65 in call_function (pp_stack=pp_stack
entry=0x7fe56f4c0aa8, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:4616
#17 0x00007fe5894b9fa1 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:3110
#18 0x00007fe5894b6ccb in function_code_fastcall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:283
#19 0x00007fe5894e26d2 in _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:415
#20 0x00007fe5894b7f65 in call_function (pp_stack=pp_stack
entry=0x7fe56f4c0c88, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:4616
#21 0x00007fe5894b9fa1 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:3110
#22 0x00007fe5894b6ccb in function_code_fastcall (co=co
entry=0x7fe587ca5c00, args=<optimized out>, args
entry=0x7fe56f4c0e10, nargs=nargs
entry=1, globals=globals
entry=0x7fe587d57230) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:283
#23 0x00007fe5894e2528 in _PyFunction_FastCallDict (func=0x7fe587cc2560, args=0x7fe56f4c0e10, nargs=1, kwargs=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:322
#24 0x00007fe5894e360d in _PyObject_Call_Prepend (callable=0x7fe587cc2560, obj=<optimized out>, args=0x7fe589b48050, kwargs=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:908
#25 0x00007fe5894e4805 in PyObject_Call (callable=0x7fe589a3bb40, args=0x7fe589b48050, kwargs=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:245
#26 0x00007fe58963a706 in t_bootstrap (boot_raw=boot_raw
entry=0x7fe588030cf0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Modules/_threadmodule.c:994
#27 0x00007fe5895ecee7 in pythread_wrapper (arg=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/thread_pthread.h:174
#28 0x00007fe589000ea5 in start_thread () from /lib64/libpthread.so.0
#29 0x00007fe588620b0d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fe589b88740 (LWP 114115)):
#0  0x00007fe5885e7659 in waitpid () from /lib64/libc.so.6
#1  0x00007fe588564f62 in do_system () from /lib64/libc.so.6
#2  0x00007fe588565311 in system () from /lib64/libc.so.6
#3  0x00007fe585bc3f25 in TUnixSystem::StackTrace() () from /cvmfs/sft.cern.ch/lcg/views/LCG_97apython3/x86_64-centos7-gcc9-opt/lib/libCore.so
#4  0x00007fe585bc0f8c in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/sft.cern.ch/lcg/views/LCG_97apython3/x86_64-centos7-gcc9-opt/lib/libCore.so
#5  <signal handler called>
#6  0x00007fe5675d19d6 in RooNDKeysPdf::loadDataSet(bool) const () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.06-9e6ed/x86_64-centos7-gcc9-opt/lib/libRooFit.so
#7  0x00007fe5675d808b in RooNDKeysPdf::createPdf(bool) () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.06-9e6ed/x86_64-centos7-gcc9-opt/lib/libRooFit.so
#8  0x00007fe587cde031 in ?? ()
#9  0x0000000085febfc0 in ?? ()
#10 0x00000000079eda90 in ?? ()
#11 0x0100000007973d80 in ?? ()
#12 0x00000000079eda90 in ?? ()
#13 0x00007fffdd711340 in ?? ()
#14 0x00007fe587cde088 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6  0x00007fe5675d19d6 in RooNDKeysPdf::loadDataSet(bool) const () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.06-9e6ed/x86_64-centos7-gcc9-opt/lib/libRooFit.so
#7  0x00007fe5675d808b in RooNDKeysPdf::createPdf(bool) () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.06-9e6ed/x86_64-centos7-gcc9-opt/lib/libRooFit.so
#8  0x00007fe587cde031 in ?? ()
#9  0x0000000085febfc0 in ?? ()
#10 0x00000000079eda90 in ?? ()
#11 0x0100000007973d80 in ?? ()
#12 0x00000000079eda90 in ?? ()
#13 0x00007fffdd711340 in ?? ()
#14 0x00007fe587cde088 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================


Traceback (most recent call last):
  File "2Dfit.py", line 457, in <module>
    bkg_QED_2D.fixShape(1)
SystemError: void RooNDKeysPdf::fixShape(bool fix) =>
    problem in C++; program state has been reset
  1. bkg_QED_2D.fixShape(R.kTRUE), with the outcome
 *** Break *** segmentation violation



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

Thread 2 (Thread 0x7f59c8355700 (LWP 117364)):
#0  0x00007f59e1e51de2 in pthread_cond_timedwait

GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f59e23fb60b in PyCOND_TIMEDWAIT (cond=<optimized out>, mut=<optimized out>, us=5000) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/condvar.h:90
#2  take_gil (tstate=tstate
entry=0x5340e20) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval_gil.h:208
#3  0x00007f59e23fb8ff in PyEval_RestoreThread (tstate=tstate
entry=0x5340e20) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:271
#4  0x00007f59e2485fa2 in pysleep (secs=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Modules/timemodule.c:1844
#5  time_sleep (self=<optimized out>, obj=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Modules/timemodule.c:371
#6  0x00007f59e232fa64 in _PyMethodDef_RawFastCallKeywords (method=0x7f59e27a6c20 <time_methods+288>, self=<optimized out>, args=<optimized out>, nargs=1, kwnames=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:648
#7  0x00007f59e232fb78 in _PyCFunction_FastCallKeywords (func=0x7f59e09b6cd0, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:734
#8  0x00007f59e23051a0 in call_function (pp_stack=pp_stack
entry=0x7f59c83546b8, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:4568
#9  0x00007f59e230bac1 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:3093
#10 0x00007f59e2303ccb in function_code_fastcall (co=co
entry=0x7f59e08e1780, args=<optimized out>, args
entry=0x7f59e0e38ca8, nargs=nargs
entry=1, globals=globals
entry=0x7f59e2857230) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:283
#11 0x00007f59e232f528 in _PyFunction_FastCallDict (func=0x7f59e0b123b0, args=0x7f59e0e38ca8, nargs=1, kwargs=0x7f59e0b24140) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:322
#12 0x00007f59e230a14c in do_call_core (kwdict=0x7f59e0b24140, callargs=0x7f59e0e38c90, func=0x7f59e0b123b0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:4645
#13 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:3191
#14 0x00007f59e2303ccb in function_code_fastcall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:283
#15 0x00007f59e232f6d2 in _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:415
#16 0x00007f59e2304f65 in call_function (pp_stack=pp_stack
entry=0x7f59c8354aa8, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:4616
#17 0x00007f59e2306fa1 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:3110
#18 0x00007f59e2303ccb in function_code_fastcall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:283
#19 0x00007f59e232f6d2 in _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:415
#20 0x00007f59e2304f65 in call_function (pp_stack=pp_stack
entry=0x7f59c8354c88, oparg=<optimized out>, kwnames=kwnames
entry=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:4616
#21 0x00007f59e2306fa1 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/ceval.c:3110
#22 0x00007f59e2303ccb in function_code_fastcall (co=co
entry=0x7f59e09b2c00, args=<optimized out>, args
entry=0x7f59c8354e10, nargs=nargs
entry=1, globals=globals
entry=0x7f59e0b24190) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:283
#23 0x00007f59e232f528 in _PyFunction_FastCallDict (func=0x7f59e09d0560, args=0x7f59c8354e10, nargs=1, kwargs=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:322
#24 0x00007f59e233060d in _PyObject_Call_Prepend (callable=0x7f59e09d0560, obj=<optimized out>, args=0x7f59e2995050, kwargs=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:908
#25 0x00007f59e2331805 in PyObject_Call (callable=0x7f59e2888b40, args=0x7f59e2995050, kwargs=0x0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Objects/call.c:245
#26 0x00007f59e2487706 in t_bootstrap (boot_raw=boot_raw
entry=0x7f59e0e7dcf0) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Modules/_threadmodule.c:994
#27 0x00007f59e2439ee7 in pythread_wrapper (arg=<optimized out>) at /workspace/build/externals/Python-3.7.6/src/Python/3.7.6/Python/thread_pthread.h:174
#28 0x00007f59e1e4dea5 in start_thread () from /lib64/libpthread.so.0
#29 0x00007f59e146db0d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f59e29d5740 (LWP 117344)):
#0  0x00007f59e1434659 in waitpid () from /lib64/libc.so.6
#1  0x00007f59e13b1f62 in do_system () from /lib64/libc.so.6
#2  0x00007f59e13b2311 in system () from /lib64/libc.so.6
#3  0x00007f59dead7f25 in TUnixSystem::StackTrace() () from /cvmfs/sft.cern.ch/lcg/views/LCG_97apython3/x86_64-centos7-gcc9-opt/lib/libCore.so
#4  0x00007f59dead4f8c in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/sft.cern.ch/lcg/views/LCG_97apython3/x86_64-centos7-gcc9-opt/lib/libCore.so
#5  <signal handler called>
#6  0x00007f59c45b19d6 in RooNDKeysPdf::loadDataSet(bool) const () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.06-9e6ed/x86_64-centos7-gcc9-opt/lib/libRooFit.so
#7  0x00007f59c45b808b in RooNDKeysPdf::createPdf(bool) () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.06-9e6ed/x86_64-centos7-gcc9-opt/lib/libRooFit.so
#8  0x00007f59d623f031 in ?? ()
#9  0x00000000deefffc0 in ?? ()
#10 0x0000000007618e70 in ?? ()
#11 0x01000000074e50d0 in ?? ()
#12 0x0000000007618e70 in ?? ()
#13 0x00007fff81e4b140 in ?? ()
#14 0x00007f59d623f088 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================


The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6  0x00007f59c45b19d6 in RooNDKeysPdf::loadDataSet(bool) const () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.06-9e6ed/x86_64-centos7-gcc9-opt/lib/libRooFit.so
#7  0x00007f59c45b808b in RooNDKeysPdf::createPdf(bool) () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.06-9e6ed/x86_64-centos7-gcc9-opt/lib/libRooFit.so
#8  0x00007f59d623f031 in ?? ()
#9  0x00000000deefffc0 in ?? ()
#10 0x0000000007618e70 in ?? ()
#11 0x01000000074e50d0 in ?? ()
#12 0x0000000007618e70 in ?? ()
#13 0x00007fff81e4b140 in ?? ()
#14 0x00007f59d623f088 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================


Traceback (most recent call last):
  File "2Dfit.py", line 457, in <module>
    bkg_QED_2D.fixShape(R.kTRUE)
SystemError: void RooNDKeysPdf::fixShape(bool fix) =>
    problem in C++; program state has been reset

It did not work. It was pointed out to me (thanks @RENATO_QUAGLIANI !) that the issue may be inside fixShape with the createPdf(kFALSE) call it makes internally:

inline void fixShape(Bool_t fix) {
    createPdf(kFALSE);
    _fixedShape=fix;
  }

So I tried doing bkg_QED_2D.createPdf() before fixShape(R.kTRUE), but it did not work either:

Traceback (most recent call last):
  File "2Dfit.py", line 457, in <module>
    bkg_QED_2D.createPdf()
AttributeError: 'RooNDKeysPdf' object has no attribute 'createPdf'

Makes sense: since it is a protected class, I cannot use it directly. And actually, I am not even sure that fixShape() will solve my issue, as what it does is not described.

Does anyone have some suggestions or knows what is it that I am missing?

Thanks a lot,

Cristina

Hi,
Can you please share your code showing the problem ? The shape of the Keys pdf should be defined once given a data set as input. If the data is not changing, you should have the same shape.

Cheers

Lorenzo

Dear Lorenzo,
Thanks for your answer! Unfortunately, I cannot share the whole script, but I pasted down here the relevant parts in my code, hope that helps!

import ROOT as R

# Make dataset from data
psi_mass  = R.RooRealVar("mass","mass",2000.,4200.,"MeV/c^{2}")
psi_ptsq  = R.RooRealVar("ptsq","ptsq",0.,2.,"GeV^{2}/c^{4}")
argset_mm = R.RooArgSet(psi_mass,psi_ptsq)
dataset   = R.RooDataSet("dataset","dataset",mmData,argset_mm)

# Make dataset from MC
psi_mass_QED_MC = R.RooRealVar("mass","mass",2000.,4200.)
psi_ptsq_QED_MC = R.RooRealVar("ptsq","ptsq",0.,2.)
argset_QED_MC   = R.RooArgSet(psi_mass_QED_MC,psi_ptsq_QED_MC)
dataset_QED_MC  = R.RooDataSet("dataset_QED_MC","dataset_QED_MC",QED_MC,argset_QED_MC)

# Make kernel PDF from MC
bkg_QED_2D = R.RooNDKeysPdf("bkg_QED_2D","bkg_QED_2D",R.RooArgList(psi_mass_QED_MC,psi_ptsq_QED_MC),dataset_QED_MC,"am")

# Fit kernel PDF from MC to data
fit_result2D = bkg_QED_2D.fitTo(dataset,R.RooFit.Extended(),R.RooFit.Save())

I suspect that to reproduce the plot and the change in the shape you might Need to share a reduced version of the root file from which you create the rookeyndpf as well. I am not sure if the issue you see Is due to the precision used when plotting (or if its really an issue on the way rookeypdfs perform the fit and normalize).

Hi,
Can you please share also the input 2D data set used to build the keys PDF and possibly the data you are fitting too ? This is needed to reproduce the problem
Thanks

Lorenzo

Looking at your posted code, I see some issues, why are you defining different variables for the data and the MC data. They are different instances but with the same name. This could be problematic in RooFit. Then when you are fitting I don’t see what are the parameters of your pdf. Probably the fitter interpret the MC observables as parameters when fitting, varying them and this modifies the shape.

Lorenzo

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