RooNDKeysPdf and formulas


I’m trying to make a 2D adaptive kernel estimate for two variables I have in a tree. One is an energy (“e”), and it happens that any sensible parametrization will be in the log of the energy. So I want to use RooNDKeysPdf with the variables “s” and “log(e)”. But as far as I can tell, RooDataSet’s constructor does not accept formulas (and neither does its createHistogram method, obscuring the display), and when (following the tutorial) I try to use a formula (RooNDKeysPdf kest4("kest4","kest4",RooArgSet(var_s,lne),*data2,"amv"))
instead of a plain variable (RooNDKeysPdf kest4("kest4","kest4",RooArgSet(var_s,var_e),*data2,"am") ,

RooRealVar var_s( "s", "s", 0, 3 ); RooRealVar var_e( "e", "e", 20, 320 ); RooDataSet* data2 = new RooDataSet( "data2", "data2", RooArgList( var_s, var_e, var_eta ), Import( tr ),Cut( cut ) ) ; RooFormulaVar lne( "lne", "ln(e)", "log(e)", RooArgList( var_e ) ); )
I get an immediate (that is before the verbose printing) segmentation violation.

Is this doable?
Any ideas what I’m doing wrong?


Maybe you need to add the ‘lne’ branch to the tree and then read it as a RooRealVar…

Yes. That is the workaround I had to use. But I expected better from the RooFit environment.