Hey everybody,
I encountered a problem with the TKDE class. Apparently the TDKE->GetFunction() returns inf/nan values if the TKDE is filled with more than 9999 data points.
Hence, the plotting of the TF1 returned by TDKE->GetFunction() crashes with the typical warning:
Warning in TCanvas::ResizePad: Inf/NaN propagated to the pad. Check drawn objects.
Warning in TCanvas::ResizePad: TheCanvas height changed from 0 to 10.
Here is what I’m trying to do:
int entries = inputTree->GetEntries();
std::vector<double> data(entries);
for(int entryIT=0; entryIT<entries; entryIT+=1){
inputTree->GetEntry(entryIT);
double keVEnergy = eVenergy/1000;
data[entryIT] = keVEnergy;
}
double rho = 1.0;
TKDE *currentKDE = new TKDE(entries, &data[0], 0, IncidentEnergy, "",rho);
TCanvas* TheCanvas = new TCanvas("TheCanvas","TheCanvas",1700,1000);
TF1 * hk = currentKDE->GetFunction(100);
hk->Draw();
I have a TTree “inputTree” containing a Branch “eVenergy” with signed double data type.
All the enties in the TTree are valid (meaning no nan/inf).
If the TTree contains 9999 or less entries everything works fine, but if the TTree contains 10000 or more entries the hk->Draw() command fails lieke described above.
However, there are certain “rho” values (e.g. 3.0) for which the plot succeeds, but for my application the smooting is way to strong in these cases.
Do you have any clue where this kind of limit might come from?
This is what I found out so far:
The TKDE.cxx in root/hist/hist/src/ has a values of 10000 in its constructor and in TKDE::Instantiate
TKDE::TKDE(UInt_t events, const Double_t* data, Double_t xMin, Double_t xMax, const Option_t* option, Double_t rho) :
...
fNBins(events < 10000 ? 100: events / 10),
fNEvents(events),
fUseBinsNEvents(10000),
...
{...}
void TKDE::Instantiate(KernelFunction_Ptr kernfunc, UInt_t events, const Double_t* data, Double_t xMin, Double_t xMax, const Option_t* option, Double_t rho) {
...
fNBins = events < 10000 ? 100 : events / 10;
fNEvents = events;
fUseBinsNEvents = 10000;
...
}
Nevertheless, if I increase these values, recompile root and try my little script it fails under the same conditions. Well, binning is deactivaded anyway.
Regards
Martin