Roofit, making a new PDF

I tried to create a new PDF by using:

RooClassFactory::makePdf(“RooMyPdf”, “t,p0,p1”);

and changed the evaluate function to:

Double_t RooMyPdf::evaluate() const
{
// ENTER EXPRESSION IN TERMS OF VARIABLE ARGUMENTS HERE
if(t<=0)
return p0+p1*(t+16000);
else
return p0-p1*(t-16000);
}

but the code crashes… is there something obvious that I am doing wrong?

thanks,
Aram

Hi,

I see nothing wrong with the code. I also don’t get a crash
if I make your p.d.f. and evaluate it with getVal().

Can you be more specific about the crash?

Wouter

this little macro should help you to reproduce the problem that i am having. I have also attached my RooMyPdf.cxx and .h along with the error message that I get when I execute this macro (crash_dump.txt).
void bkgd_model()
{
RooRealVar t(“t”, “time (ns)”, -16000.0, 16000.0, “ns”);

RooRealVar p0(“p0”, “p0”, 657);
RooRealVar p1(“p1”, “p1”, 80);

p0.setConstant(kTRUE);
p1.setConstant(kTRUE);

RooMyPdf bkgd(“bkgd”, “compiled class bkgd”, t, p0, p1);

}
crash_dump.txt (4.36 KB)
RooMyPdf.h (1.4 KB)
RooMyPdf.cxx (1.6 KB)