Hi all,
I know this must be a very basic question, but I’m thoroughly stuck and I haven’t been able to find anything on the web or on the forums to address my issue. I’m having a lot of trouble making use of RooGenericPdf objects. So, for example, I set up a simple RooGenericPdf:
RooRealVar roo_rtilde("rtilde_val","rtilde",0.01, 10.9875, "unitless");
RooRealVar roo_L("distance", "distance", 0.102, 0.09, 0.114, "meters");
RooGenericPdf new_genericpdf("namething", "titlething", "roo_rtilde*(1-roo_L)", RooArgList(roo_rtilde, roo_L));
…and everything seems to be going fine right up until I try to generate some data with it:
RooDataSet* roodata_generic = new_genericpdf.generate(roo_rtilde, 1000);
At this point, I get a ton of error messages similar to this:
[#0] ERROR:Eval -- RooFormula::eval(namething): Formula doesn't compile: roo_rtilde*(1-roo_L)
[#0] ERROR:Eval -- RooAbsReal::logEvalError(namething) evaluation error,
origin : RooGenericPdf::namething[ actualVars=(rtilde_val,distance) formula="roo_rtilde*(1-roo_L)" ]
message : p.d.f normalization integral is zero or negative
server values: actualVars=(rtilde_val = 2.80199,distance = 0.102)
I can’t figure out what I’m doing wrong. The syntax of the formula I’ve provided seems to be just fine, so I don’t know why it wouldn’t compile. I still get those “formula doesn’t compile” messages whether the terms in the RooArgList within the definition of new_genericpdf are instances of a RooRealVar, a RooHistPdf, a RooDataHist, or a RooAbsPdf–so it doesn’t seem to be that, at least.
Also, with the allowed ranges of the RooRealVars shown above, the probability value at any position on new_genericpdf must be positive, so it’s very weird that it thinks the normalization integral is zero/negative. Why would it do that??
If I try to generate data from new_genericpdf over some unrelated variable, I don’t end up with all those pesky error messages. Like this:
RooRealVar roo_tof("tof", "tof", 0.1, 1.0, "seconds");
RooDataSet* roodata_generic2 = new_genericpdf.generate(roo_tof, 1000);
…but of course that’s pretty useless. When I plot roodata_generic2 over roo_tof, the result is just a boring flat distribution.
What I’d really like is for my RooGenericPdf to behave as a probability distribution over an entirely new variable, where the PDF is a function of a bunch of different parameters, functions, and RooHistPdfs that I plug into the RooGenericPdf. But then, how do I access the amplitude of the RooGenericPdf’s output? And how do I tell it which variable it’s a distribution over?
Anyway, I’d really appreciate any help. I’m sure my mistake must be something fairly simple.
Thanks in advance!