RooKeysPdf and/or RooNDKeysPdf with weighted events


Can someone show an example how to construct a RooKeysPdf or RooNDKeysPdf with weighted events. The snippet below doesn’t work – I thought all the pdf should be able to handle unweighted and weighted events automagically.

RooRealVar weight(“weight”,“weight”,0.,1.0);
RooRealVar mass(“mass”,“mass”,0.0,1000.0);

    std::string ifile("data.txt");
RooDataSet data("data","data",RooDataSet::read(ifile.c_str(),RooArgList(weight,mass)),RooArgSet(weight,mass),"","weight");

RooKeysPdf wpdf("wpdf","wpdf",mass,data,RooKeysPdf::MirrorBoth);


I checked that if I do not specify the weight in the constructor, the data and the generated pdf matched.

NB: I’ve read looked at rf707_kernelestimation.C, I’ve read the class description, I’ve read the class header, and the source code. In the constructor initializer is saw something like _weights0, but there is no argument in the constructor with that name.