83 this->
Warning(
"TKDTreeBinning",
"Data is nil. Nothing is built.");
101 this->
Info(
"SetNBins",
"Number of bins is not enough to hold the data. Extra bin added.");
110 this->
Warning(
"SetNBins",
"Number of bins is bigger than data size. Nothing is built.");
115 this->
Warning(
"SetNBins",
"Data dimension is nil. Nothing is built.");
117 this->
Warning(
"SetNBins",
"Number of bins is nil. Nothing is built.");
119 this->
Warning(
"SetNBins",
"Data size is nil. Nothing is built.");
129 std::vector<UInt_t> indices(
fNBins);
133 std::sort(indices.begin(), indices.end(),
CompareAsc(
this));
136 std::sort(indices.begin(), indices.end(),
CompareDesc(
this));
139 std::vector<Double_t> binMinEdges(fNBins *
fDim);
140 std::vector<Double_t> binMaxEdges(fNBins * fDim);
141 std::vector<UInt_t> binContent(fNBins );
145 binMinEdges[i * fDim + j] =
fBinMinEdges[indices[i] * fDim + j];
146 binMaxEdges[i * fDim + j] =
fBinMaxEdges[indices[i] * fDim + j];
205 fCommonBinEdges = std::vector<std::map<Double_t, std::vector<UInt_t> > >(
fDim, std::map<Double_t, std::vector<UInt_t> >());
223 fBinMaxEdges.push_back(binEdges[(i * fDim + j) * 2 + 1]);
232 Double_t binEdge = binEdges[(j * fDim + i) * 2];
234 std::vector<UInt_t> commonBinEdges;
236 UInt_t minBinEdgePos = (k * fDim + i) * 2;
238 commonBinEdges.push_back(minBinEdgePos);
239 UInt_t maxBinEdgePos = ++minBinEdgePos;
241 commonBinEdges.push_back(maxBinEdgePos);
255 Double_t binEdge = binEdges[(j * fDim + i) * 2];
258 if (adjustedBinEdge != 0)
259 adjustedBinEdge *= (1. + eps);
261 adjustedBinEdge += eps;
265 Bool_t isMinBinEdge = binEdgePos % 2 == 0;
266 UInt_t bin = isMinBinEdge ? (binEdgePos / 2 - i) / fDim : ((binEdgePos - 1) / 2 - i) / fDim;
267 binEdges[binEdgePos] = adjustedBinEdge;
284 Double_t& binEdge = binEdges[(j * fDim + i) * 2 + 1];
287 binEdge *= (1. + eps);
301 this->
Warning(
"GetBinsMinEdges",
"Binning kd-tree is nil. No bin edges retrieved.");
302 this->
Info(
"GetBinsMinEdges",
"Returning null pointer.");
310 this->
Warning(
"GetBinsMaxEdges",
"Binning kd-tree is nil. No bin edges retrieved.");
311 this->
Info(
"GetBinsMaxEdges",
"Returning null pointer.");
319 this->
Warning(
"GetBinsEdges",
"Binning kd-tree is nil. No bin edges retrieved.");
320 this->
Info(
"GetBinsEdges",
"Returning null pointer pair.");
330 this->
Warning(
"GetBinMinEdges",
"No such bin. 'bin' is between 0 and %d",
fNBins - 1);
332 this->
Warning(
"GetBinMinEdges",
"Binning kd-tree is nil. No bin edges retrieved.");
333 this->
Info(
"GetBinMinEdges",
"Returning null pointer.");
343 this->
Warning(
"GetBinMaxEdges",
"No such bin. 'bin' is between 0 and %d",
fNBins - 1);
345 this->
Warning(
"GetBinMaxEdges",
"Binning kd-tree is nil. No bin edges retrieved.");
346 this->
Info(
"GetBinMaxEdges",
"Returning null pointer.");
356 this->
Warning(
"GetBinEdges",
"No such bin. 'bin' is between 0 and %d",
fNBins - 1);
358 this->
Warning(
"GetBinEdges",
"Binning kd-tree is nil. No bin edges retrieved.");
359 this->
Info(
"GetBinEdges",
"Returning null pointer pair.");
377 this->
Warning(
"GetBinContent",
"No such bin. Returning 0.");
378 this->
Info(
"GetBinContent",
"'bin' is between 0 and %d.",
fNBins - 1);
387 this->
Warning(
"GetTree",
"Binning kd-tree is nil. No embedded kd-tree retrieved. Returning null pointer.");
395 this->
Warning(
"GetDimData",
"No such dimensional coordinate. No coordinate data retrieved. Returning null pointer.");
396 this->
Info(
"GetDimData",
"'dim' is between 0 and %d.",
fDim - 1);
404 this->
Warning(
"GetDataMin",
"No such dimensional coordinate. No coordinate data minimum retrieved. Returning +inf.");
405 this->
Info(
"GetDataMin",
"'dim' is between 0 and %d.",
fDim - 1);
413 this->
Warning(
"GetDataMax",
"No such dimensional coordinate. No coordinate data maximum retrieved. Returning -inf.");
414 this->
Info(
"GetDataMax",
"'dim' is between 0 and %d.",
fDim - 1);
423 this->
Warning(
"GetBinDensity",
"Volume is null. Returning -1.");
426 this->
Warning(
"GetBinDensity",
"No such bin. Returning -1.");
427 this->
Info(
"GetBinDensity",
"'bin' is between 0 and %d.",
fNBins - 1);
434 std::pair<const Double_t*, const Double_t*> binEdges =
GetBinEdges(bin);
437 volume *= (binEdges.second[i] - binEdges.first[i]);
441 this->
Warning(
"GetBinVolume",
"No such bin. Returning 0.");
442 this->
Info(
"GetBinVolume",
"'bin' is between 0 and %d.",
fNBins - 1);
454 this->
Warning(
"GetOneDimBinEdges",
"Data is multidimensional. No sorted bin edges retrieved. Returning null pointer.");
455 this->
Info(
"GetOneDimBinEdges",
"This method can only be invoked if the data is a one dimensional set");
461 this->
Warning(
"SortOneDimBinEdges",
"Data is multidimensional. Cannot sorted bin edges. Returning null pointer.");
462 this->
Info(
"SortOneDimBinEdges",
"This method can only be invoked if the data is a one dimensional set");
466 std::vector<UInt_t> indices(
fNBins);
469 std::vector<Double_t> binMinEdges(
fNBins );
470 std::vector<Double_t> binMaxEdges(
fNBins );
471 std::vector<UInt_t> binContent(
fNBins );
501 std::pair<const Double_t*, const Double_t*> binEdges =
GetBinEdges(bin);
503 result[i] = (binEdges.second[i] + binEdges.first[i]) / 2.;
507 this->
Warning(
"GetBinCenter",
"No such bin. Returning null pointer.");
508 this->
Info(
"GetBinCenter",
"'bin' is between 0 and %d.",
fNBins - 1);
516 std::pair<const Double_t*, const Double_t*> binEdges =
GetBinEdges(bin);
518 result[i] = (binEdges.second[i] - binEdges.first[i]);
522 this->
Warning(
"GetBinWidth",
"No such bin. Returning null pointer.");
523 this->
Info(
"GetBinWidth",
"'bin' is between 0 and %d.",
fNBins - 1);
561 for (
unsigned int i = 0; i <
fNBins; ++i) {
std::vector< std::vector< std::pair< Bool_t, Bool_t > > > fCheckedBinEdges
const Double_t * GetBinMaxEdges(UInt_t bin) const
void Initialize(unsigned int maxpoints, unsigned int dim=1, ErrorType err=kValueError)
preallocate a data set with given size , dimension and error type (to get the full point size) If the...
std::vector< Double_t > fBinMaxEdges
Double_t GetBinVolume(UInt_t bin) const
void SetData(Index npoints, Index ndim, UInt_t bsize, Value **data)
Set the data array. See the constructor function comments for details.
const Double_t * GetDimData(UInt_t dim) const
void SetBinMinMaxEdges(Double_t *binEdges)
const Double_t * GetBinWidth(UInt_t bin) const
friend struct CompareDesc
std::vector< UInt_t > fBinsContent
void SetData(Double_t *data)
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
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
void SetNBins(UInt_t bins)
const TKDTreeBinning * bins
const Double_t * GetOneDimBinEdges() const
void AddBinUpEdge(const double *xup)
add the bin width data, a pointer to an array with the bin upper edge information.
const Double_t * GetBinsMaxEdges() const
void Build()
Build the kd-tree.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Bool_t operator()(UInt_t bin1, UInt_t bin2)
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)
const Double_t * SortOneDimBinEdges(Bool_t sortAsc=kTRUE)
<- TKDTreeBinning - A class providing multidimensional binning ->
void ReadjustMaxBinEdges(Double_t *binEdges)
std::vector< Double_t > fBinMinEdges
Double_t GetDataMin(UInt_t dim) const
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
std::vector< UInt_t > fIndices
Bool_t TestBit(UInt_t f) const
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
std::vector< std::pair< Double_t, Double_t > > fDataThresholds
TKDTree< Int_t, Double_t > TKDTreeID
void SortBinsByDensity(Bool_t sortAsc=kTRUE)
void Add(double x, double y)
add one dim data with only coordinate and values
TKDTreeBinning(TKDTreeBinning &bins)
const Double_t * GetBinCenter(UInt_t bin) const
void FillBinData(ROOT::Fit::BinData &data) const
const Double_t * GetBinMinEdges(UInt_t bin) const
void SetCommonBinEdges(Double_t *binEdges)
void ReadjustMinBinEdges(Double_t *binEdges)
const Double_t * GetBinsMinEdges() const
std::vector< std::map< Double_t, std::vector< UInt_t > > > fCommonBinEdges
std::pair< const Double_t *, const Double_t * > GetBinEdges(UInt_t bin) const
std::pair< const Double_t *, const Double_t * > GetBinsEdges() const
TKDTreeID * GetTree() const
UInt_t GetBinMinDensity() const
Value * GetBoundary(const Int_t node)
Get a boundary.
Double_t GetDataMax(UInt_t dim) const
Index FindNode(const Value *point) const
returns the index of the terminal node to which point belongs (index in the fAxis, fValue, etc arrays) returns -1 in case of failure
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.