I’m writing a class that inherit from RooAbsPdf. Since I have many parameters to pass to the constructor, more than 40, I would like to aggregate my inputs. Since they are mainly RooRealVar I thought to use a RooArgList.
I don’t have any error on compile time, on the other hand something wrong is going on since when I allocate an object of this pdf and I try to access it, the program crashes, since the members are NULL.
I reproduced the problem in a simplified case that you can find in attachment.
In this simplified example I have a class with 2 RooRealVar a and b that need to be initialized through the RooRealVar that are passed to the constructur through a RooArgList:
RooTest::RooTest(const char *name, const char *title,
q2(“q2”,“q2”, this, _q2),
a(“a”, “a”, this, corrFactors.at(0)),
b(“b”, “b”, this, corrFactors.at(1))
This approach must be wrong since they are always NULL, but I don’t see what is the problem. Can you help me?
Thanks a lot in advance,
p.s.: I’m compiling and making the library with the command: .L RooTest.cp++
In the attachment you can find:
RooTest.[h,cp]: code of the class with the implementation with the RooArgList that crashes
testClassWorkspace.py: code to build the RooTest pdf. Here the crash.
RooTest1.[h,cp]: code of the class where the RooRealVar are passed, perfectly working
testClassWorkspace1.py: code to build the RooTest1 pdf. Perfectly working.
test.tar (35 KB)