kdTreeBinning tutorial: bin the data in cells of equal content using a kd-tree
Using TKDTree wrapper class as a data binning structure Plot the 2D data using the TH2Poly class
Bin with minimum density: 13
Bin with maximum density: 29
Bin with minimum density: 0
Bin with maximum density: 49
#include <cmath>
#include <iostream>
double mu[2] = {0,2};
double sig[2] = {2,3};
for (
UInt_t i = 0; i < nbins; ++i) {
}
std::cout <<
"Bin with minimum density: " <<
kdBins->GetBinMinDensity() << std::endl;
std::cout <<
"Bin with maximum density: " <<
kdBins->GetBinMaxDensity() << std::endl;
std::vector<Double_t> z = std::vector<Double_t>(
DATASZ, 0.);
}
std::cout <<
"Bin with minimum density: " <<
kdBins->GetBinMinDensity() << std::endl;
std::cout <<
"Bin with maximum density: " <<
kdBins->GetBinMaxDensity() << std::endl;
TCanvas*
c4 =
new TCanvas(
"glc4",
"TH2Poly from a kdTree (Ordered)",50,50,800,800);
kdX->SortOneDimBinEdges();
kdY->SortOneDimBinEdges();
TH1*
hX=
new TH1F(
"hX",
"X projection",
kdX->GetNBins(),
kdX->GetOneDimBinEdges());
for(
int i=0; i<
kdX->GetNBins(); ++i){
hX->SetBinContent(i+1,
kdX->GetBinDensity(i));
}
TH1*
hY=
new TH1F(
"hY",
"Y Projection",
kdY->GetNBins(),
kdY->GetOneDimBinEdges());
for(
int i=0; i<
kdY->GetNBins(); ++i){
hY->SetBinContent(i+1,
kdY->GetBinDensity(i));
}
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Graphics object made of three arrays X, Y and Z with the same number of points each.
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void Draw(Option_t *option="") override
Draw this histogram with options.
2-D histogram with a double per channel (see TH1 documentation)
2D Histogram with Polygonal Bins
<- TKDTreeBinning - A class providing multidimensional binning ->
Random number generator class based on M.
- Author
- Bartolomeu Rabacal
Definition in file kdTreeBinning.C.