26 void kdTreeBinning() {
31 const UInt_t DATASZ = 10000;
38 double sig[2] = {2,3};
41 for (
UInt_t i = 0; i < DATADIM; ++i)
42 for (
UInt_t j = 0; j < DATASZ; ++j)
43 smp[DATASZ * i + j] = r.
Gaus(mu[i], sig[i]);
47 TH2D*
h1 =
new TH2D(
"h1BinTest",
"Regular binning", h1bins, -5., 5., h1bins, -5., 5.);
48 for (
UInt_t j = 0; j < DATASZ; ++j)
49 h1->
Fill(smp[j], smp[DATASZ + j]);
67 h2pol->
AddBin(binsMinEdges[edgeDim], binsMinEdges[edgeDim + 1], binsMaxEdges[edgeDim], binsMaxEdges[edgeDim + 1]);
73 std::cout <<
"Bin with minimum density: " << kdBins->
GetBinMinDensity() << std::endl;
74 std::cout <<
"Bin with maximum density: " << kdBins->
GetBinMaxDensity() << std::endl;
82 h2pol->
Draw(
"COLZ L");
89 std::vector<Double_t>
z = std::vector<Double_t>(DATASZ, 0.);
90 for (
UInt_t i = 0; i < DATASZ; ++i)
114 h2polrebin->
AddBin(binMinEdges[0], binMinEdges[1], binMaxEdges[0], binMaxEdges[1]);
120 std::cout <<
"Bin with minimum density: " << kdBins->
GetBinMinDensity() << std::endl;
121 std::cout <<
"Bin with maximum density: " << kdBins->
GetBinMaxDensity() << std::endl;
124 for (
UInt_t i = 0; i < DATASZ; ++i)
135 TCanvas* c4 =
new TCanvas(
"glc4",
"TH2Poly from a kdTree (Ordered)",50,50,800,800);
139 h2polrebin->
Draw(
"COLZ L");
156 for(
int i=0; i<kdX->
GetNBins(); ++i){
161 for(
int i=0; i<kdY->
GetNBins(); ++i){
Random number generator class based on M.
Int_t FindBin(Double_t x, Double_t y, Double_t z=0)
Returns the bin number of the bin at the given coordinate.
const Double_t * GetBinsMinEdges() const
Returns an array with all bins' minimum edges The edges are arranges as xmin_1,ymin_1, xmin_2,ymin_2,....xmin_{nbin},ymin_{nbin}.
virtual void Draw(Option_t *option="")
Specific drawing options can be used to paint a TGraph2D:
Double_t GetDataMax(UInt_t dim) const
Returns the maximum of the data in the dim coordinate. 'dim' is between 0 and fDim - 1...
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
UInt_t GetBinMinDensity() const
Return the bin with minimum density.
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
const Double_t * GetBinsMaxEdges() const
Returns an array with all bins' maximum edges The edges are arranges as xmax_1,ymax_1, xmax_2,ymax_2,....xmax_{nbin},ymax_{nbin}.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual void SetSeed(ULong_t seed=0)
Set the random generator sequence if seed is 0 (default value) a TUUID is generated and used to fill ...
UInt_t GetNBins() const
Returns the number of bins.
Int_t AddBin(TObject *poly)
Adds a new bin to the histogram.
const Double_t * SortOneDimBinEdges(Bool_t sortAsc=kTRUE)
Sort the one-dimensional bin edges and retuns a pointer to them.
<- TKDTreeBinning - A class providing multidimensional binning ->
Double_t GetDataMin(UInt_t dim) const
Returns the minimum of the data in the dim coordinate. 'dim' is between 0 and fDim - 1...
Double_t GetBinContent(Int_t bin) const
Returns the content of the input bin For the overflow/underflow/sea bins: -1 | -2 | -3 ---+----+---- ...
Double_t GetBinDensity(UInt_t bin) const
Returns the density in bin.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
void SetBinContent(Int_t bin, Double_t content)
Sets the contents of the input bin to the input content Negative values between -1 and -9 are for the...
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...
const Double_t * GetBinMinEdges(UInt_t bin) const
Returns the bin's minimum edges. 'bin' is between 0 and fNBins - 1.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
void SetFloat(Bool_t flag=true)
When set to kTRUE, allows the histogram to expand if a bin outside the limits is added.
void SortBinsByDensity(Bool_t sortAsc=kTRUE)
Sorts bins by their density.
UInt_t GetBinMaxDensity() const
Return the bin with maximum density.
THist< 2, double, THistStatContent, THistStatUncertainty > TH2D
you should not use this method at all Int_t Int_t z
const Double_t * GetBinMaxEdges(UInt_t bin) const
Returns the bin's maximum edges. 'bin' is between 0 and fNBins - 1.
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
virtual void Update()
Update canvas pad buffers.
UInt_t GetDim() const
Returns the number of dimensions.
Graphics object made of three arrays X, Y and Z with the same number of points each.
Int_t Fill(Double_t)
Invalid Fill method.
2D Histogram with Polygonal Bins
tomato 2-D histogram with a double per channel (see TH1 documentation)}
const Double_t * GetOneDimBinEdges() const
Returns a pointer to the vector of the bin edges for one dimensional binning only.