Does anyone know if it is possible to create a multidimensional PDF using RooClassFactory? I need a PDF which fits 3 variables (x,y,z), and has 4 floated parameters (A0, A1, A2, A3). The form of the PDF is quite complicated and it does not factorize.
If I execute
my understanding is that it will treat “x” as the variable to be fitted, while treating “y,z,A0,A1,A2,A3” as the parameters which are floated in the fit. Is this correct? If so, does anyone have any ideas on how to work around this?
RooFit p.d.f. have no static concept of the distinction between observables and parameters,
thus a p.d.f. created as follows
can (and will) be used as a p.d.f. in observables x,y,z, if it is used in conjuction with a dataset with observables (x,y,z). Section 2 page 13 of the RooFit users manual
’Parameters and Observables’ explains the details.
Thank you for your quick reply. I have used RooClassFactory to create RooMyPdf.h and RooMyPdf.cxx. I edited the evaluate() function in the .cxx file to define the PDF; I made no other changes to the .h or .cxx files.
I compile the class using
and I obtain RooMyPdf_cxx.so.
I then #include “RooMyPdf.h” in the program that I invoke the PDF. However, when I compile my module using g++, I get the following error at the point where I use RooMyPdf for the first (and only) time:
undefined reference to
RooMyPdf::RooMyPdf(char const*, char const*, RooAbsReal&, RooAbsReal&, RooAbsReal&, RooAbsReal&, RooAbsReal&, RooAbsReal&, RooAbsReal&)' /bdata/tmp/ccLuahaD.o(.gnu.linkonce.t._ZN9RooMyPdfD1Ev+0xb): In functionRooMyPdf::~RooMyPdf()’:
/usr/include/c++/3.2.3/bits/basic_string.tcc:623: undefined reference to
vtable for RooMyPdf' /bdata/tmp/ccLuahaD.o(.gnu.linkonce.t._ZN9RooMyPdfD1Ev+0x17): In functionRooMyPdf::~RooMyPdf()’:
/usr/include/c++/3.2.3/bits/char_traits.h:135: undefined reference to `vtable for RooMyPdf’
collect2: ld returned 1 exit status
I noticed another thread regarding a question about “undefined reference to a `vtable…”
root.cern.ch/phpBB2/viewtopic.ph … 6b01f46ffa
but I do not understand what needs to be done to fix the error. Any help would be greatly appreciated.
It works fine for me:
stbc-16:pts/18 ~/roofit/workdir>root -l
root  RooClassFactory::makePdf(“RooMyPdf”,“x,y,z,A0,A1,A2,A3”);
root  .L RooMyPdf.cxx+
Info in TUnixSystem::ACLiC: creating shared library /user/verkerke/roofit/workdir/./RooMyPdf_cxx.so
Did you make any modifications to your cxx or .h file?
Compiling my RooMyPdf.cxx module works fine for me as well. The problem I’m having occurs after, when I try to invoke the RooMyPdf in another program. In other words, I wrote a new program called analysis.C, which uses RooMyPdf.
In analysis.C I
then in the main() part of the program, I try to use RooMyPdf as follows:
and fit the RooDataSet* sigmc
RooFitResult *fitres1 = ang_PDF.fitTo(*sigmc,“mr”);
The error I reported in the previous message comes from the line above where I use the RooAngPdf for the first time.
I was wondering if you had a chance to look into my question again.
Maybe you could have a look at
I just follow it to use my own Pdf (just throw away the “make” part), it works for me.
I am not sure if this question ever got answered, but it looks like the problem comes from trying to compile CINT codes. If you run the script in CINT mode it seems to work fine (without the ++ or + at the end of the load command). I guess the RooClassFactory is only mean to be ran through CINT mode.