RooFit: Passing argument list to generic pdf

Hi,
I’m trying to write a custom pdf class which unfortunately depends from a large number of parameters. I generated the template code with RooClassFactory::makePdf and I would like to group all these parameters in a RooArgList or something similar. I tried to do it as in the code attached, but when I call fitTo to some RooDataHist then the code crashed with the following stack trace

[code]RooFit v3.56 – Developed by Wouter Verkerke and David Kirkby
Copyright © 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt

[#0] WARNING:InputArguments – RooAbsPdf::fitTo(pdf) WARNING: a likelihood fit is request of what appears to be weighted data.
While the estimated values of the parameters will always be calculated taking the weights into account,
there are multiple ways to estimate the errors on these parameter values. You are advised to make an
explicit choice on the error calculation:
- Either provide SumW2Error(kTRUE), to calculate a sum-of-weights corrected HESSE error matrix
(error will be proportional to the number of events)
- Or provide SumW2Error(kFALSE), to return errors from original HESSE error matrix
(which will be proportional to the sum of the weights)
If you want the errors to reflect the information contained in the provided dataset, choose kTRUE.
If you want the errors to reflect the precision you would be able to obtain with an unweighted dataset
with ‘sum-of-weights’ events, choose kFALSE.

*** Break *** segmentation violation

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

#0 0x00000037a04ac68e in waitpid () from /lib64/libc.so.6
#1 0x00000037a043e609 in do_system () from /lib64/libc.so.6
#2 0x00007f191d9dccd8 in TUnixSystem::StackTrace() () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libCore.so
#3 0x00007f191d9dbb53 in TUnixSystem::DispatchSignals(ESignals) () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libCore.so
#4
#5 0x000000000040bd87 in FwdFoldPdf::evaluate() const ()
#6 0x00007f1918bb188b in RooAbsPdf::getValV(RooArgSet const*) const () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#7 0x00007f1918cc9423 in RooRealIntegral::RooRealIntegral(char const*, char const*, RooAbsReal const&, RooArgSet const&, RooArgSet const*, RooNumIntConfig const*, char const*) () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#8 0x00007f1918bbcb92 in RooAbsReal::createIntObj(RooArgSet const&, RooArgSet const*, RooNumIntConfig const*, char const*) const () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#9 0x00007f1918bbd754 in RooAbsReal::createIntegral(RooArgSet const&, RooArgSet const*, RooNumIntConfig const*, char const*) const () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#10 0x00007f1918ba9098 in RooAbsPdf::syncNormalization(RooArgSet const*, bool) const () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#11 0x00007f1918bb16f0 in RooAbsPdf::getValV(RooArgSet const*) const () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#12 0x00007f1918ba3a70 in RooAbsOptTestStatistic::initSlave(RooAbsReal&, RooAbsData&, RooArgSet const&, char const*, char const*) () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#13 0x00007f1918ba4551 in RooAbsOptTestStatistic::RooAbsOptTestStatistic(char const*, char const*, RooAbsReal&, RooAbsData&, RooArgSet const&, char const*, char const*, int, RooFit::MPSplit, bool, bool, bool) () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#14 0x00007f1918c9766c in RooNLLVar::RooNLLVar(char const*, char const*, RooAbsPdf&, RooAbsData&, RooArgSet const&, bool, char const*, char const*, int, RooFit::MPSplit, bool, bool, bool) () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#15 0x00007f1918bb0d6b in RooAbsPdf::createNLL(RooAbsData&, RooLinkedList const&) () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#16 0x00007f1918bac169 in RooAbsPdf::fitTo(RooAbsData&, RooLinkedList const&) () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#17 0x00007f1918ba75d1 in RooAbsPdf::fitTo(RooAbsData&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&, RooCmdArg const&) () from /opt/exp_software/ams//AMSsoft_modified/linux_slc6_gcc64/root_v5.34ams//lib/libRooFitCore.so
#18 0x000000000040b3c0 in main ()

[/code]

I think that the problem is in the NLL creation as maybe RooFit can’t figure out which and how many parameters there are in the pdf. Any suggestion?
FwdFoldPdf.cpp (1.57 KB)
FwdFoldPdf.h (1.2 KB)

Hi,
Can you post in addition to your pdf also a small example, or a workspace (including a data set) which can be used to reproduce the error you are getting ?
Thank you

Lorenzo