Home | News | Documentation | Download

Using TKDE::Fill

I’d like to build my KDE by iteratively calling TKDE::Fill (I read entries from a TTree), instead of following the standard approach of providing all data at once (see tutorials/math/exampleTKDE.C). The following:

auto kde = new TKDE(0, nullptr, 0, 5, "", 1); // or variations
kde->GetValue(2); // nan
kde->Draw(); // errors

does not work. I tried to construct the object in many different ways (e.g. by providing a non-nullptr vector data), no way. Is it buggy or am I supposed to do something else?

I can reproduce this. It looks to be a bug in the TKDE constructor, I will open a GitHub issue on this.
Which ROOT release are you using it ? I see the problem in the current master, but it works fine in ROOT 6.16.
As a workaround, pass the input data in the TKDE constructor. Here is an example:

std::vector<double> x(100); 
for (unsigned int i = 0; i < x.size(); i++) { x[i] = gRandom->Gaus(2,1); }
auto kde = new TKDE(x.size(), x.data(), 0, 5, "", 1);

Best regards


Thanks, I am using 6.22/08, indeed.

I have opened an issue: Bug in TKDE::Fill · Issue #7808 · root-project/root · GitHub
The bug was introduced in 6.18
Thank you for reporting this issue!


1 Like