Arguments of RooDataSet : could not convert argument

Dear all,

First I wish you to all a very Happy New Year 2012!

I am migrating some ROOT macro to pyRoot and is quite easy except for RooDataSet where it failed to convert some of the argument !!

For example :

but

[code] .py : tZZ = RootFile_tZZ.Get(“tree”)
weight = ROOT.RooRealVar(“weight”,“weight”,0,100000)
mass = ROOT.RooRealVar(“mass”,“mass”,MassMin,MassMax)
var = ROOT.RooArgSet(mass,weight);

d = ROOT.RooDataSet(“d”," zz mass spectrum ",var,ROOT.RooFit.Import(tZZ),0,“weight”) [/code]
doesn’t work :

[quote] d = ROOT.RooDataSet(“d”," zz mass spectrum ",var,ROOT.RooFit.Import(tZZ),0,“weight”)
TypeError: none of the 8 overloaded methods succeeded. Full details:
RooDataSet::RooDataSet() =>
takes at most 0 arguments (6 given)
RooDataSet::RooDataSet(const char* name, const char* title, const RooArgSet& vars, const char* wgtVarName = 0) =>
takes at most 4 arguments (6 given)
RooDataSet::RooDataSet(const char* name, const char* title, const RooArgSet& vars, const RooCmdArg& arg1, const RooCmdArg& arg2 = RooCmdArg(), const RooCmdArg& arg3 = RooCmdArg(), const RooCmdArg& arg4 = RooCmdArg(), const RooCmdArg& arg5 = RooCmdArg(), const RooCmdArg& arg6 = RooCmdArg(), const RooCmdArg& arg7 = RooCmdArg(), const RooCmdArg& arg8 = RooCmdArg()) =>
could not convert argument 5
RooDataSet::RooDataSet(const char* name, const char* title, RooDataSet* data, const RooArgSet& vars, const char* cuts = 0, const char* wgtVarName = 0) =>
could not convert argument 3
RooDataSet::RooDataSet(const char* name, const char* title, RooDataSet* data, const RooArgSet& vars, const RooFormulaVar& cutVar, const char* wgtVarName = 0) =>
could not convert argument 3
RooDataSet::RooDataSet(const char* name, const char* title, TTree* ntuple, const RooArgSet& vars, const char* cuts = 0, const char* wgtVarName = 0) =>
could not convert argument 3
RooDataSet::RooDataSet(const char* name, const char* title, TTree* t, const RooArgSet& vars, const RooFormulaVar& cutVar, const char* wgtVarName = 0) =>
could not convert argument 3
could not resolve RooDataSet::RooDataSet(RooDataSet const&,const char*)[/quote]

while :

works fine!

this is a naive question but how can I add the missing agruments in the function “RooDataSet” ? How can I easily see the expected argument for the python "fonction " ? For example for RooDataSet it seems that the argument var and TTree are in the opposite order than the C function !

Thanks a lot
Cheers
Fabien

Fabien,

which argument failed to convert is in the listing of possible overloads, and the one that is expected is the exact C++ argument: typically the problem is that in C++ RooFit, implicit conversions take place. PyROOT does not support implicit conversions and the proper constructor for the temporary thus needs to be called explicitly.

Cheers,
Wim

Hi Win,

Thanks. He took me some time to decode you message and I got it:

Cheers
Fabien