ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
TKDTreeBinning Class Reference

<- 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 documentation.

Definition at line 31 of file TKDTreeBinning.h.

Public Types

enum  { kAdjustBinEdges = BIT(14) }
 
- Public Types inherited from TObject
enum  EStatusBits {
  kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4),
  kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13)
}
 
enum  { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff }
 
enum  { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) }
 

Public Member Functions

 TKDTreeBinning (UInt_t dataSize, UInt_t dataDim, Double_t *data, UInt_t nBins=100, bool adjustBinEdges=false)
 
 ~TKDTreeBinning ()
 
void SetNBins (UInt_t bins)
 
void SortBinsByDensity (Bool_t sortAsc=kTRUE)
 
const Double_tGetBinsMinEdges () const
 
const Double_tGetBinsMaxEdges () const
 
std::pair< const Double_t
*, const Double_t * > 
GetBinsEdges () const
 
std::pair< const Double_t
*, const Double_t * > 
GetBinEdges (UInt_t bin) const
 
const Double_tGetBinMinEdges (UInt_t bin) const
 
const Double_tGetBinMaxEdges (UInt_t bin) const
 
UInt_t GetNBins () const
 
UInt_t GetDim () const
 
UInt_t GetBinContent (UInt_t bin) const
 
TKDTreeIDGetTree () const
 
const Double_tGetDimData (UInt_t dim) const
 
Double_t GetDataMin (UInt_t dim) const
 
Double_t GetDataMax (UInt_t dim) const
 
Double_t GetBinDensity (UInt_t bin) const
 
Double_t GetBinVolume (UInt_t bin) const
 
const Double_tGetBinCenter (UInt_t bin) const
 
const Double_tGetBinWidth (UInt_t bin) const
 
UInt_t GetBinMaxDensity () const
 
UInt_t GetBinMinDensity () const
 
const Double_tGetOneDimBinEdges () const
 
const Double_tSortOneDimBinEdges (Bool_t sortAsc=kTRUE)
 
void FillBinData (ROOT::Fit::BinData &data) const
 
UInt_t FindBin (const Double_t *point) const
 
- Public Member Functions inherited from TObject
 TObject ()
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method. More...
 
virtual void Copy (TObject &object) const
 Copy this to obj. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current pad. More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual Option_tGetOption () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
virtual Bool_t IsSortable () const
 
Bool_t IsOnHeap () const
 
Bool_t IsZombie () const
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
virtual void ls (Option_t *option="") const
 The ls function lists the contents of a class on stdout. More...
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual void Print (Option_t *option="") const
 This method must be overridden when a class wants to print itself. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 
voidoperator new (size_t sz)
 
voidoperator new[] (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz, void *vp)
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
void SetBit (UInt_t f)
 
void ResetBit (UInt_t f)
 
Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
void InvertBit (UInt_t f)
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 

Private Member Functions

 TKDTreeBinning (TKDTreeBinning &bins)
 
TKDTreeBinning operator= (TKDTreeBinning &bins)
 
void SetData (Double_t *data)
 
void SetTreeData ()
 
void SetBinsEdges ()
 
void SetBinMinMaxEdges (Double_t *binEdges)
 
void SetCommonBinEdges (Double_t *binEdges)
 
void SetBinsContent ()
 
void ReadjustMinBinEdges (Double_t *binEdges)
 
void ReadjustMaxBinEdges (Double_t *binEdges)
 

Private Attributes

Double_t ** fData
 
std::vector< Double_tfBinMinEdges
 
std::vector< Double_tfBinMaxEdges
 
std::vector< UInt_tfIndices
 
TKDTreeIDfDataBins
 
UInt_t fNBins
 
UInt_t fDim
 
UInt_t fDataSize
 
std::vector< std::pair
< Double_t, Double_t > > 
fDataThresholds
 
std::vector< std::vector
< std::pair< Bool_t, Bool_t > > > 
fCheckedBinEdges
 
std::vector< std::map
< Double_t, std::vector
< UInt_t > > > 
fCommonBinEdges
 
Bool_t fIsSorted
 
Bool_t fIsSortedAsc
 
std::vector< UInt_tfBinsContent
 

Friends

struct CompareAsc
 
struct CompareDesc
 

Additional Inherited Members

- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 
- Protected Member Functions inherited from TObject
void MakeZombie ()
 
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 

#include <TKDTreeBinning.h>

Inheritance diagram for TKDTreeBinning:
[legend]

Member Enumeration Documentation

anonymous enum
Enumerator
kAdjustBinEdges 

Definition at line 65 of file TKDTreeBinning.h.

Constructor & Destructor Documentation

TKDTreeBinning::TKDTreeBinning ( TKDTreeBinning bins)
private
TKDTreeBinning::TKDTreeBinning ( UInt_t  dataSize,
UInt_t  dataDim,
Double_t data,
UInt_t  nBins = 100,
bool  adjustBinEdges = false 
)

Definition at line 63 of file TKDTreeBinning.cxx.

TKDTreeBinning::~TKDTreeBinning ( )

Definition at line 87 of file TKDTreeBinning.cxx.

Member Function Documentation

void TKDTreeBinning::FillBinData ( ROOT::Fit::BinData data) const

Definition at line 557 of file TKDTreeBinning.cxx.

UInt_t TKDTreeBinning::FindBin ( const Double_t point) const

Definition at line 567 of file TKDTreeBinning.cxx.

Referenced by testkdTreeBinning().

const Double_t * TKDTreeBinning::GetBinCenter ( UInt_t  bin) const

Definition at line 497 of file TKDTreeBinning.cxx.

Referenced by testkdTreeBinning().

UInt_t TKDTreeBinning::GetBinContent ( UInt_t  bin) const

Definition at line 373 of file TKDTreeBinning.cxx.

Referenced by FillBinData(), GetBinDensity(), and testkdTreeBinning().

Double_t TKDTreeBinning::GetBinDensity ( UInt_t  bin) const

Definition at line 418 of file TKDTreeBinning.cxx.

Referenced by FillBinData(), operator()(), and testkdTreeBinning().

std::pair< const Double_t *, const Double_t * > TKDTreeBinning::GetBinEdges ( UInt_t  bin) const

Definition at line 350 of file TKDTreeBinning.cxx.

Referenced by GetBinCenter(), GetBinVolume(), and GetBinWidth().

UInt_t TKDTreeBinning::GetBinMaxDensity ( ) const

Definition at line 527 of file TKDTreeBinning.cxx.

Referenced by testkdTreeBinning().

const Double_t * TKDTreeBinning::GetBinMaxEdges ( UInt_t  bin) const

Definition at line 337 of file TKDTreeBinning.cxx.

Referenced by FillBinData(), GetBinEdges(), and testkdTreeBinning().

UInt_t TKDTreeBinning::GetBinMinDensity ( ) const

Definition at line 542 of file TKDTreeBinning.cxx.

Referenced by testkdTreeBinning().

const Double_t * TKDTreeBinning::GetBinMinEdges ( UInt_t  bin) const

Definition at line 324 of file TKDTreeBinning.cxx.

Referenced by FillBinData(), GetBinEdges(), and testkdTreeBinning().

std::pair< const Double_t *, const Double_t * > TKDTreeBinning::GetBinsEdges ( ) const

Definition at line 315 of file TKDTreeBinning.cxx.

const Double_t * TKDTreeBinning::GetBinsMaxEdges ( ) const

Definition at line 306 of file TKDTreeBinning.cxx.

Referenced by GetBinsEdges(), and testkdTreeBinning().

const Double_t * TKDTreeBinning::GetBinsMinEdges ( ) const

Definition at line 297 of file TKDTreeBinning.cxx.

Referenced by GetBinsEdges(), and testkdTreeBinning().

Double_t TKDTreeBinning::GetBinVolume ( UInt_t  bin) const

Definition at line 431 of file TKDTreeBinning.cxx.

Referenced by FillBinData(), and GetBinDensity().

const Double_t * TKDTreeBinning::GetBinWidth ( UInt_t  bin) const

Definition at line 512 of file TKDTreeBinning.cxx.

Double_t TKDTreeBinning::GetDataMax ( UInt_t  dim) const

Definition at line 409 of file TKDTreeBinning.cxx.

Referenced by testkdTreeBinning().

Double_t TKDTreeBinning::GetDataMin ( UInt_t  dim) const

Definition at line 400 of file TKDTreeBinning.cxx.

Referenced by testkdTreeBinning().

UInt_t TKDTreeBinning::GetDim ( ) const

Definition at line 368 of file TKDTreeBinning.cxx.

Referenced by testkdTreeBinning().

const Double_t * TKDTreeBinning::GetDimData ( UInt_t  dim) const

Definition at line 391 of file TKDTreeBinning.cxx.

UInt_t TKDTreeBinning::GetNBins ( ) const

Definition at line 363 of file TKDTreeBinning.cxx.

Referenced by testkdTreeBinning().

const double * TKDTreeBinning::GetOneDimBinEdges ( ) const

Definition at line 446 of file TKDTreeBinning.cxx.

TKDTreeID * TKDTreeBinning::GetTree ( ) const

Definition at line 383 of file TKDTreeBinning.cxx.

TKDTreeBinning TKDTreeBinning::operator= ( TKDTreeBinning bins)
private
void TKDTreeBinning::ReadjustMaxBinEdges ( Double_t binEdges)
private

Definition at line 278 of file TKDTreeBinning.cxx.

Referenced by SetBinsEdges().

void TKDTreeBinning::ReadjustMinBinEdges ( Double_t binEdges)
private

Definition at line 249 of file TKDTreeBinning.cxx.

Referenced by SetBinsEdges().

void TKDTreeBinning::SetBinMinMaxEdges ( Double_t binEdges)
private

Definition at line 216 of file TKDTreeBinning.cxx.

Referenced by SetBinsEdges().

void TKDTreeBinning::SetBinsContent ( )
private

Definition at line 191 of file TKDTreeBinning.cxx.

Referenced by SetNBins().

void TKDTreeBinning::SetBinsEdges ( )
private

Definition at line 200 of file TKDTreeBinning.cxx.

Referenced by SetNBins().

void TKDTreeBinning::SetCommonBinEdges ( Double_t binEdges)
private

Definition at line 228 of file TKDTreeBinning.cxx.

Referenced by SetBinsEdges().

void TKDTreeBinning::SetData ( Double_t data)
private

Definition at line 176 of file TKDTreeBinning.cxx.

Referenced by TKDTreeBinning().

void TKDTreeBinning::SetNBins ( UInt_t  bins)

Definition at line 93 of file TKDTreeBinning.cxx.

Referenced by TKDTreeBinning().

void TKDTreeBinning::SetTreeData ( )
private

Definition at line 185 of file TKDTreeBinning.cxx.

Referenced by SetNBins().

void TKDTreeBinning::SortBinsByDensity ( Bool_t  sortAsc = kTRUE)

Definition at line 123 of file TKDTreeBinning.cxx.

Referenced by testkdTreeBinning().

const Double_t * TKDTreeBinning::SortOneDimBinEdges ( Bool_t  sortAsc = kTRUE)

Definition at line 459 of file TKDTreeBinning.cxx.

Friends And Related Function Documentation

friend struct CompareAsc
friend

Definition at line 47 of file TKDTreeBinning.h.

Referenced by GetBinMaxDensity(), GetBinMinDensity(), and SortBinsByDensity().

friend struct CompareDesc
friend

Definition at line 49 of file TKDTreeBinning.h.

Referenced by SortBinsByDensity().

Member Data Documentation

std::vector<Double_t> TKDTreeBinning::fBinMaxEdges
private
std::vector<Double_t> TKDTreeBinning::fBinMinEdges
private
std::vector<UInt_t> TKDTreeBinning::fBinsContent
private
std::vector<std::vector<std::pair<Bool_t, Bool_t> > > TKDTreeBinning::fCheckedBinEdges
private

Definition at line 42 of file TKDTreeBinning.h.

Referenced by ReadjustMaxBinEdges(), ReadjustMinBinEdges(), and SetBinsEdges().

std::vector<std::map<Double_t, std::vector<UInt_t> > > TKDTreeBinning::fCommonBinEdges
private

Definition at line 43 of file TKDTreeBinning.h.

Referenced by ReadjustMinBinEdges(), SetBinsEdges(), and SetCommonBinEdges().

Double_t** TKDTreeBinning::fData
private

Definition at line 33 of file TKDTreeBinning.h.

Referenced by GetDimData(), SetData(), SetTreeData(), TKDTreeBinning(), and ~TKDTreeBinning().

TKDTreeID* TKDTreeBinning::fDataBins
private
UInt_t TKDTreeBinning::fDataSize
private

Definition at line 40 of file TKDTreeBinning.h.

Referenced by SetBinsContent(), SetData(), and SetNBins().

std::vector<std::pair<Double_t, Double_t> > TKDTreeBinning::fDataThresholds
private

Definition at line 41 of file TKDTreeBinning.h.

Referenced by GetDataMax(), GetDataMin(), and SetData().

UInt_t TKDTreeBinning::fDim
private
std::vector<UInt_t> TKDTreeBinning::fIndices
private

Definition at line 36 of file TKDTreeBinning.h.

Referenced by FindBin(), SortBinsByDensity(), and SortOneDimBinEdges().

Bool_t TKDTreeBinning::fIsSorted
private
Bool_t TKDTreeBinning::fIsSortedAsc
private
UInt_t TKDTreeBinning::fNBins
private
Collaboration diagram for TKDTreeBinning:
[legend]

The documentation for this class was generated from the following files: