RooNDKeysPdf from TH2 or RooDataHist

Hello

Beginner with Roofit. I have a 2d histogram ‘histo’ in my pyROOT script. I think I have been able to create a RooDataHist with,

p_t=RooRealVar("p_t","trans mom",0,3)
p_z=RooRealVar("p_z","z mom",0,400)
data = RooDataHist('dh','dh',RooArgList(RooArgSet(p_t,p_z)),histo)

now I wish to create a kde with RooNDKeysPdf() but am struggling. I see (https://root.cern.ch/doc/master/classRooNDKeysPdf.html#a49a8c291c02ad7843541236ed5c35c61) that it is possible to feed RooNDKeysPdf() a histogram but I can’t work out what all the arguments of RooNDKeysPdf() should be. I have tried things like

kde_out = RooNDKeysPdf('kde','kde',RooArgList(RooArgSet(p_t,p_z)),data)

but I just get errors like

Traceback (most recent call last):
  File "test.py", line 33, in <module>
    histogram = RooNDKeysPdf('kde','kde',RooArgList(RooArgSet(p_t,p_z)),data)
TypeError: none of the 5 overloaded methods succeeded. Full details:
  RooNDKeysPdf::RooNDKeysPdf(const RooNDKeysPdf& other, const char* name = 0) =>
    takes at most 2 arguments (4 given)
  RooNDKeysPdf::RooNDKeysPdf(const char* name, const char* title, const RooArgList& varList, RooDataSet& data, const TVectorT<double>& rho, TString options = "a", double nSigma = 3, bool rotate = kTRUE) =>
    takes at least 5 arguments (4 given)
  RooNDKeysPdf::RooNDKeysPdf(const char* name, const char* title, const RooArgList& varList, RooDataSet& data, TString options = "a", double rho = 1, double nSigma = 3, bool rotate = kTRUE) =>
    could not convert argument 4
  RooNDKeysPdf::RooNDKeysPdf(const char* name, const char* title, RooAbsReal& x, RooDataSet& data, RooNDKeysPdf::Mirror mirror = NoMirror, double rho = 1, double nSigma = 3, bool rotate = kTRUE) =>
    could not convert argument 3
  RooNDKeysPdf::RooNDKeysPdf(const char* name, const char* title, RooAbsReal& x, RooAbsReal& y, RooDataSet& data, TString options = "a", double rho = 1., double nSigma = 3, bool rotate = kTRUE) =>
    takes at least 5 arguments (4 given)

I originally made the RooDataHist because I thought RooNDKeysPdf() needed it, but I may be wrong and raw root histogram is fine.

Any ideas? I am sure I am doing something simple wrong.

Thanks a lot

Alex

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.