38 const UInt_t DATASZ = 10000;
45 double sig[2] = {2,3};
48 for (
UInt_t i = 0; i < DATADIM; ++i)
49 for (
UInt_t j = 0; j < DATASZ; ++j)
50 smp[DATASZ * i + j] = r.
Gaus(mu[i], sig[i]);
54 TH2D*
h1 =
new TH2D(
"h1BinTest",
"Regular binning", h1bins, -5., 5., h1bins, -5., 5.);
55 for (
UInt_t j = 0; j < DATASZ; ++j)
56 h1->
Fill(smp[j], smp[DATASZ + j]);
75 h2pol->
AddBin(binsMinEdges[edgeDim], binsMinEdges[edgeDim + 1], binsMaxEdges[edgeDim], binsMaxEdges[edgeDim + 1]);
84 std::cout <<
"Bin with minimum density: " << ibinMin <<
" density = " << kdBins->
GetBinDensity(ibinMin) <<
" content = " << kdBins->
GetBinContent(ibinMin) << std::endl;
85 std::cout <<
"Bin with maximum density: " << ibinMax <<
" density = " << kdBins->
GetBinDensity(ibinMax) <<
" content = " << kdBins->
GetBinContent(ibinMin) << std::endl;
88 Error(
"testkdTreeBinning",
"Wrong bin content");
94 if (kdBins->
GetBinMaxDensity() != nbins-1)
Error(
"testkdTreeBinning",
"Wrong maximum bin after sorting");
98 h2pol->
Draw(
"COLZ L");
104 int ntimes = (
verbose) ? 2 : 200;
105 double point[2] = {0,0};
109 for (
int itimes = 0; itimes < ntimes; itimes++) {
117 int ibin = kdBins->
FindBin(point);
125 std::cout <<
"**** point *** " << itimes <<
"\n";
126 std::cout <<
" point x " << point[0] <<
" BIN CENTER is " << binCenter[0] <<
" min " << binMin[0] <<
" max " << binMax[0] << std::endl;
127 std::cout <<
" point y " << point[1] <<
" BIN CENTER is " << binCenter[1] <<
" min " << binMin[1] <<
" max " << binMax[1] << std::endl;
130 ok &= point[0] > binMin[0] && point[0] < binMax[0];
131 ok &= point[1] > binMin[1] && point[1] < binMax[1];
133 Error (
"testkdTreeBinning::FindBin",
" Point is not in the right bin " );
134 std::cout <<
" point x " << point[0] <<
" BIN CENTER is " << binCenter[0] <<
" min " << binMin[0] <<
" max " << binMax[0] << std::endl;
135 std::cout <<
" point y " << point[1] <<
" BIN CENTER is " << binCenter[1] <<
" min " << binMin[1] <<
" max " << binMax[1] << std::endl;
147 Error(
"testkdTreeBinning::FindBin",
" Bin %d is not existing ",ibin);
156 int main(
int argc,
char **argv)
159 for (
Int_t i=1 ; i<argc ; i++) {
160 std::string arg = argv[i] ;
169 cerr <<
"Usage: " << argv[0] <<
" [-g] [-v]\n";
171 cerr <<
" -g : graphics mode\n";
172 cerr <<
" -v : verbose mode";
const Double_t * GetBinMaxEdges(UInt_t bin) const
Random number generator class based on M.
int main(int argc, char **argv)
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...
virtual void Draw(Option_t *option="")
Draw this marker with its current attributes.
Double_t GetBinDensity(UInt_t bin) const
UInt_t FindBin(const Double_t *point) const
UInt_t GetBinMaxDensity() const
UInt_t GetBinContent(UInt_t bin) const
virtual void SetSeed(UInt_t seed=0)
Set the random generator seed.
const Double_t * GetBinsMaxEdges() const
virtual void Run(Bool_t retrn=kFALSE)
Main application eventloop. Calls system dependent eventloop via gSystem.
Int_t AddBin(TObject *poly)
Adds a new bin to the histogram.
<- TKDTreeBinning - A class providing multidimensional binning ->
void Error(const char *location, const char *msgfmt,...)
Double_t GetDataMin(UInt_t dim) const
virtual void SetSeed(UInt_t seed=0)
Set the random generator sequence if seed is 0 (default value) a TUUID is generated and used to fill ...
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...
R__EXTERN TRandom * gRandom
void SortBinsByDensity(Bool_t sortAsc=kTRUE)
const Double_t * GetBinCenter(UInt_t bin) const
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
const Double_t * GetBinMinEdges(UInt_t bin) const
const Double_t * GetBinsMinEdges() const
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
Int_t Fill(Double_t)
Invalid Fill method.
UInt_t GetBinMinDensity() const
Double_t GetDataMax(UInt_t dim) const
2D Histogram with Polygonal Bins
2-D histogram with a double per channel (see TH1 documentation)}