I use TKDE objects to create a lambda function that I need to use at a later time in an another application. My code is something like this:
//fill vectors, find xMin and xMax, define rho
TKDE *kdeRT = new TKDE(vKDERT.size(), &vKDERT, xMin-.1*rho, xMax+.1*rho,"", rho);
TKDE *kdeWT = new TKDE(vKDEWT.size(), &vKDEWT, xMin-.1*rho, xMax+.1*rho,"", rho);
auto fW = new TF1("fW", [&](double *x, double *p)
double yRT = nRT*kdeRT->GetValue(x);
double yWT = nWT*kdeWT->GetValue(x);
How can I store fW or the TKDEs?
You should be able to store the
TKDE to a
TFile. The function OTOH uses a lambda; we currently cannot store that one.
I tried to no success.
TFile *f = new TFile("test.root", "RECREATE");
for(int i=0;i<10;++i) v.push_back((double)i);
TKDE *kde = new TKDE(v.size(), &v, 0., 20., "", 1);
produces this error:
Warning in <TClass::Init>: no dictionary for class TKDE::TKernel is available
Error in <TStreamerInfo::Build>: TKDE: TKDE::TKernel* has no streamer or dictionary, data member fKernel will not be saved
Warning in <TBufferFile::WriteObjectAny>: since ROOT::Math::WrappedMemFunction<TKDE,double(TKDE::*)(double)const> has no public constructor
which can be called without argument, objects of this class
can not be read with the current library. You will need to
add a default constructor before attempting to read it.
Error in <TStreamerInfo::Build>: ROOT::Math::WrappedMemFunction<TKDE,double(TKDE::*)(double)const>, unknown type: double(TKDE::*)(double)const fMemFunc
*** Break *** segmentation violation
Thanks Alberto. @moneta could you have a look when you’re back at work?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.