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]);
65 for (
UInt_t i = 0; i < nbins; ++i) {
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)
94 g->SetMarkerStyle(20);
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){
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)