#include <cmath>
#include <iostream>
void kdTreeBinning() {
double mu[2] = {0,2};
double sig[2] = {2,3};
for (
UInt_t i = 0; i < DATADIM; ++i)
for (
UInt_t j = 0; j < DATASZ; ++j)
smp[DATASZ * i + j] =
r.Gaus(mu[i], sig[i]);
TH2D*
h1 =
new TH2D(
"h1BinTest",
"Regular binning", h1bins, -5., 5., h1bins, -5., 5.);
for (
UInt_t j = 0; j < DATASZ; ++j)
h1->
Fill(smp[j], smp[DATASZ + j]);
for (
UInt_t i = 0; i < nbins; ++i) {
h2pol->
AddBin(binsMinEdges[edgeDim], binsMinEdges[edgeDim + 1], binsMaxEdges[edgeDim], binsMaxEdges[edgeDim + 1]);
}
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.);
for (
UInt_t i = 0; i < DATASZ; ++i)
h2polrebin->
AddBin(binMinEdges[0], binMinEdges[1], binMaxEdges[0], binMaxEdges[1]);
}
std::cout <<
"Bin with minimum density: " << kdBins->
GetBinMinDensity() << std::endl;
std::cout <<
"Bin with maximum density: " << kdBins->
GetBinMaxDensity() << std::endl;
for (
UInt_t i = 0; i < DATASZ; ++i)
TCanvas* c4 =
new TCanvas(
"glc4",
"TH2Poly from a kdTree (Ordered)",50,50,800,800);
h2polrebin->
Draw(
"COLZ L");
}
}
}
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
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
void Update() override
Update canvas pad buffers.
Graphics object made of three arrays X, Y and Z with the same number of points each.
void Draw(Option_t *option="P0") override
Specific drawing options can be used to paint a TGraph2D:
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.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
2-D histogram with a double per channel (see TH1 documentation)}
2D Histogram with Polygonal Bins
void SetFloat(Bool_t flag=true)
When set to kTRUE, allows the histogram to expand if a bin outside the limits is added.
Double_t GetBinContent(Int_t bin) const override
Returns the content of the input bin Bin numbers are from [1,nbins] and for the overflow/underflow/se...
Int_t FindBin(Double_t x, Double_t y, Double_t z=0) override
Returns the bin number of the bin at the given coordinate.
virtual Int_t AddBin(TObject *poly)
Adds a new bin to the histogram.
void SetBinContent(Int_t bin, Double_t content) override
Sets the contents of the input bin to the input content Negative values between -1 and -9 are for the...
<- TKDTreeBinning - A class providing multidimensional binning ->
const Double_t * GetBinMaxEdges(UInt_t bin) const
Returns the bin's maximum edges. 'bin' is between 0 and fNBins - 1.
const Double_t * GetBinsMaxEdges() const
Returns an array with all bins' maximum edges The edges are arranges as xmax_1,ymax_1,...
UInt_t GetBinMaxDensity() const
Return the bin with maximum density.
UInt_t GetNBins() const
Returns the number of bins.
Double_t GetDataMax(UInt_t dim) const
Returns the maximum of the data in the dim coordinate. 'dim' is between 0 and fDim - 1.
const Double_t * GetBinMinEdges(UInt_t bin) const
Returns the bin's minimum edges. 'bin' is between 0 and fNBins - 1.
Double_t GetDataMin(UInt_t dim) const
Returns the minimum of the data in the dim coordinate. 'dim' is between 0 and fDim - 1.
void SortBinsByDensity(Bool_t sortAsc=kTRUE)
Sorts bins by their density.
Double_t GetBinDensity(UInt_t bin) const
Returns the density in bin.
const Double_t * GetBinsMinEdges() const
Returns an array with all bins' minimum edges The edges are arranges as xmin_1,ymin_1,...
UInt_t GetBinMinDensity() const
Return the bin with minimum density.
const Double_t * GetOneDimBinEdges() const
Returns a pointer to the vector of the bin edges for one dimensional binning only.
UInt_t GetDim() const
Returns the number of dimensions.
const Double_t * SortOneDimBinEdges(Bool_t sortAsc=kTRUE)
Sort the one-dimensional bin edges and returns a pointer to them.
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
Random number generator class based on M.
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)