Hi,
I have interpolated an experimental distribution
with a non parametric function using RooNDKeysPdf :
RooNDKeysPdf *kest4 ;
kest4 = new RooNDKeysPdf(“kest4”,“kest4”,RooArgSet(Mnu2),data,“am”) ;
I wish to save this function for later use, possibly in the form of C++ code. The following lines :
ofstream outfile ;
outfile.open(“T.cxx”,ios::out) ;
kest4->SavePrimitive( outfile,"" ) ;
outfile.close() ;
kest4->SaveAs(“test.C”) ;
kest4->SaveAs(“test.root”) ;
don’t work :
[pbsimo:~/PDF-Analyzer/RootNewFiles/MakeNonParametricPdf] simo% more T.cxx
//Primitive: kest4/kest4. You must implement RooNDKeysPdf::SavePrimitive
[pbsimo:~/PDF-Analyzer/RootNewFiles/MakeNonParametricPdf] simo%
while the file test.root contains in fact the Object key4 but I cannot then use it:
root [0] TFile f(“test.root”)
root [1] f.ls()
TFile** test.root
TFile* test.root
KEY: RooNDKeysPdf kest4;1 kest4
root [2] RooNDKeysPdf *k = (RooNDKeysPdf) f.Get(kest4)->Clone(“k”)
Error in TClass::New: cannot create object of class RooNDKeysPdf
Error in TKey::ReadObj: Cannot create new object of class RooNDKeysPdf
Error: Symbol kest4 is not defined in current scope (tmpfile):1:
Error: non class,struct,union object Get(kest4) used with . or -> (tmpfile):1:
Error: illegal type cast (2) (tmpfile):1:
*** Interpreter error recovered ***
(other attemps similarly failed). Any suggestion ? Cheers
Franco