ROOT » MATH » MATHCORE » TKDTreeBinning

class TKDTreeBinning: public TObject


TKDTreeBinning - A class providing multidimensional binning

The class implements multidimensional binning by constructing a TKDTree inner structure from the data which is used as the bins. The bins are retrieved as two double*, one for the minimum bin edges, the other as the maximum bin edges. For one dimension one of these is enough to correctly define the bins. For the multidimensional case both minimum and maximum ones are necessary for the bins to be well defined. The bin edges of d-dimensional data is a d-tet of the bin's thresholds. For example if d=3 the minimum bin edges of bin b is of the form of the following array: {xbmin, ybmin, zbmin}. You also have the possibility to sort the bins by their density.
Details of usage can be found in $ROOTSYS/tutorials/math/kdTreeBinning.C and more information on the embedded TKDTree can be found in http://root.cern.ch/lxr/source/math/mathcore/src/TKDTree.cxx or http://root.cern.ch/lxr/source/math/mathcore/inc/TKDTree.h.

Function Members (Methods)

public:
virtual~TKDTreeBinning()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
voidFillBinData(ROOT::Fit::BinData& data) const
UInt_tFindBin(const Double_t* point) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
const Double_t*GetBinCenter(UInt_t bin) const
UInt_tGetBinContent(UInt_t bin) const
Double_tGetBinDensity(UInt_t bin) const
pair<const Double_t*,const Double_t*>GetBinEdges(UInt_t bin) const
UInt_tGetBinMaxDensity() const
const Double_t*GetBinMaxEdges(UInt_t bin) const
UInt_tGetBinMinDensity() const
const Double_t*GetBinMinEdges(UInt_t bin) const
pair<const Double_t*,const Double_t*>GetBinsEdges() const
const Double_t*GetBinsMaxEdges() const
const Double_t*GetBinsMinEdges() const
Double_tGetBinVolume(UInt_t bin) const
const Double_t*GetBinWidth(UInt_t bin) const
Double_tGetDataMax(UInt_t dim) const
Double_tGetDataMin(UInt_t dim) const
UInt_tGetDim() const
const Double_t*GetDimData(UInt_t dim) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
UInt_tGetNBins() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
const Double_t*GetOneDimBinEdges() const
virtual Option_t*TObject::GetOption() const
virtual const char*TObject::GetTitle() const
TKDTreeID*GetTree() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetNBins(UInt_t bins)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
voidSortBinsByDensity(Bool_t sortAsc = kTRUE)
const Double_t*SortOneDimBinEdges(Bool_t sortAsc = kTRUE)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TKDTreeBinning(UInt_t dataSize, UInt_t dataDim, Double_t* data, UInt_t nBins = 100, bool adjustBinEdges = false)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

public:
static TKDTreeBinning::(anonymous)kAdjustBinEdges
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
private:
vector<Double_t>fBinMaxEdgesThe maximum values for the bins' edges for each dimension
vector<Double_t>fBinMinEdgesThe minimum values for the bins' edges for each dimension
vector<UInt_t>fBinsContentHolds the contents of the bins
vector<vector<pair<Bool_t,Bool_t> > >fCheckedBinEdgesAuxiliary structure for readjusting the bin edges. Flags if the bin edge was processed in the algorithm
vector<map<Double_t,vector<UInt_t> > >fCommonBinEdgesAuxiliary structure for readjusting the bin edges. Keeps the common bin boundaries
Double_t**fDataThe data from which a KDTree partition is computed for binning
TKDTreeID*fDataBinsThe binning inner structure.
UInt_tfDataSizeThe data size
vector<pair<Double_t,Double_t> >fDataThresholdsMinimum and maximum data values.
UInt_tfDimThe data dimension
vector<UInt_t>fIndicesIndex of the bins in the kd-tree (needed when bins are sorted)
Bool_tfIsSortedFlags if the bin edges are sorted densitywise (or by bin endges in case of 1-dim )
Bool_tfIsSortedAscFlags if the bin edges are sorted densitywise (or by bin-edge for 1D) in ascending order
UInt_tfNBinsThe number of bins

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TKDTreeBinning(UInt_t dataSize, UInt_t dataDim, Double_t* data, UInt_t nBins = 100, bool adjustBinEdges = false)
 Class's constructor taking the size of the data points, dimension, a data array and the number
 of bins (default = 100). It is reccomended to have the number of bins as an exact divider of
 the data size.
 The data array must be organized with a stride=1 for the points and = N (the dataSize) for the dimension.

 Thus data[] = x1,x2,x3,......xN, y1,y2,y3......yN, z1,z2,...........zN,....

 Note that the passed dataSize is not the size of the array but is the number of points (N)
 The size of the array must be at least  dataDim*dataSize

~TKDTreeBinning()
 Class's destructor
void SetNBins(UInt_t bins)
 Sets binning inner structure
void SortBinsByDensity(Bool_t sortAsc = kTRUE)
 Sorts bins by their density
void SetData(Double_t* data)
 Sets the data and finds minimum and maximum by dimensional coordinate
void SetTreeData()
 Sets the data for constructing the kD-tree
void SetBinsContent()
 Sets the bins' content
void SetBinsEdges()
 Sets the bins' edges
Double_t* rawBinEdges = fDataBins->GetBoundaryExact(fDataBins->GetNNodes());
void SetBinMinMaxEdges(Double_t* binEdges)
 Sets the bins' minimum and maximum edges
void SetCommonBinEdges(Double_t* binEdges)
 Sets indexing on the bin edges which have common boundaries
void ReadjustMinBinEdges(Double_t* binEdges)
 Readjusts the bins' minimum edge by shifting it slightly lower
 to avoid overlapping with the data
void ReadjustMaxBinEdges(Double_t* binEdges)
 Readjusts the bins' maximum edge
 and shift it sligtly higher
const Double_t* GetBinsMinEdges() const
 Returns the bins' minimum edges
const Double_t* GetBinsMaxEdges() const
 Returns the bins' maximum edges
std::pair<const Double_t*, const Double_t*> GetBinsEdges() const
 Returns the bins' edges
const Double_t* GetBinMinEdges(UInt_t bin) const
 Returns the bin's minimum edges. 'bin' is between 0 and fNBins - 1
const Double_t* GetBinMaxEdges(UInt_t bin) const
 Returns the bin's maximum edges. 'bin' is between 0 and fNBins - 1
std::pair<const Double_t*, const Double_t*> GetBinEdges(UInt_t bin) const
 Returns the bin's edges. 'bin' is between 0 and fNBins - 1
UInt_t GetNBins() const
 Returns the number of bins
UInt_t GetDim() const
 Returns the number of dimensions
UInt_t GetBinContent(UInt_t bin) const
 Returns the number of points in bin. 'bin' is between 0 and fNBins - 1
TKDTreeID* GetTree() const
 Returns the kD-Tree structure of the binning
const Double_t* GetDimData(UInt_t dim) const
 Returns the data in the dim coordinate. 'dim' is between 0 and fDim - 1
Double_t GetDataMin(UInt_t dim) const
 Returns the data minimum in the dim coordinate. 'dim' is between 0 and fDim - 1
Double_t GetDataMax(UInt_t dim) const
 Returns the data maximum in the dim coordinate. 'dim' is between 0 and fDim - 1
Double_t GetBinDensity(UInt_t bin) const
 Returns the density in bin. 'bin' is between 0 and fNBins - 1
Double_t GetBinVolume(UInt_t bin) const
 Returns the (hyper)volume of bin. 'bin' is between 0 and fNBins - 1
const double * GetOneDimBinEdges() const
 Returns the minimum edges for one dimensional binning only.
 size of the vector is fNBins + 1 is the vector has been sorted in increasing bin edges
 N.B : if one does not call SortOneDimBinEdges the bins are not ordered
const Double_t * SortOneDimBinEdges(Bool_t sortAsc = kTRUE)
const Double_t* GetBinCenter(UInt_t bin) const
 Returns the geometric center of of the bin. 'bin' is between 0 and fNBins - 1
const Double_t* GetBinWidth(UInt_t bin) const
 Returns the geometric center of of the bin. 'bin' is between 0 and fNBins - 1
UInt_t GetBinMaxDensity() const
 Return the bin with maximum density
UInt_t GetBinMinDensity() const
 Return the bin with minimum density
void FillBinData(ROOT::Fit::BinData& data) const
 Fill the bin data set with the result of the TKDTree binning
UInt_t FindBin(const Double_t* point) const
 find the corresponding bin index given a point
TKDTreeBinning(TKDTreeBinning& bins)
TKDTreeBinning operator=(TKDTreeBinning& bins)