14 #ifndef ROOT_Math_KDTree 15 #define ROOT_Math_KDTree 33 template<
class _DataPo
int>
40 static UInt_t
Dimension() {
return _DataPoint::Dimension();}
51 Bool_t
operator()(
const point_type* pFirst,
const point_type* pSecond)
const;
64 Cut(UInt_t iAxis,Double_t fNewCutValue):
fAxis(iAxis),fCutValue(fNewCutValue) {}
70 void SetCutValue(Double_t fNewCutValue) {fCutValue = fNewCutValue;}
72 Bool_t
operator<(
const point_type& rPoint)
const;
73 Bool_t
operator>(
const point_type& rPoint)
const;
96 virtual const BinNode* FindNode(
const point_type& rPoint)
const = 0;
97 virtual void GetClosestPoints(
const point_type& rRef,UInt_t nPoints,std::vector<std::pair<const _DataPoint*,Double_t> >& vFoundPoints)
const = 0;
98 virtual void GetPointsWithinDist(
const point_type& rRef,value_type fDist,std::vector<const point_type*>& vFoundPoints)
const = 0;
99 virtual Bool_t
Insert(
const point_type& rPoint) = 0;
100 virtual void Print(
int iRow = 0)
const = 0;
113 Bool_t IsLeftChild()
const;
135 virtual void GetClosestPoints(
const point_type& rRef,UInt_t nPoints,std::vector<std::pair<const _DataPoint*,Double_t> >& vFoundPoints)
const;
136 virtual void GetPointsWithinDist(
const point_type& rRef,value_type fDist,std::vector<const _DataPoint*>& vFoundPoints)
const;
137 virtual Bool_t
Insert(
const point_type& rPoint) {
return Parent()->Insert(rPoint);}
138 virtual void Print(Int_t)
const {Parent()->Print();}
166 virtual void Print(Int_t iRow = 0)
const;
174 virtual const BinNode* FindNode(
const point_type& rPoint)
const;
175 virtual void GetClosestPoints(
const point_type& rRef,UInt_t nPoints,std::vector<std::pair<const _DataPoint*,Double_t> >& vFoundPoints)
const;
176 virtual void GetPointsWithinDist(
const point_type& rRef,value_type fDist,std::vector<const _DataPoint*>& vFoundPoints)
const;
177 virtual Bool_t
Insert(
const point_type& rPoint);
194 virtual void EmptyBin();
195 virtual const BinNode* FindNode(
const point_type& rPoint)
const;
196 point_type GetBinCenter()
const;
199 virtual const std::vector<tBoundary>&
GetBoundaries()
const {
return fBoundaries;}
201 virtual void GetBoundaries()
const { }
203 Double_t
GetDensity()
const {
return GetBinContent()/GetVolume();}
206 Double_t GetVolume()
const;
209 virtual Bool_t
Insert(
const point_type& rPoint);
210 Bool_t IsInBin(
const point_type& rPoint)
const;
211 virtual void Print(
int iRow = 0)
const;
226 virtual void GetClosestPoints(
const point_type&,UInt_t,std::vector<std::pair<const _DataPoint*,Double_t> >&)
const {}
245 virtual void EmptyBin();
247 virtual const std::vector<tBoundary>& GetBoundaries()
const;
249 virtual void GetBoundaries()
const;
251 virtual void GetClosestPoints(
const point_type& rRef,UInt_t nPoints,std::vector<std::pair<const _DataPoint*,Double_t> >& vFoundPoints)
const;
252 const std::vector<const point_type*>&
GetPoints()
const {
return fDataPoints;}
253 virtual void GetPointsWithinDist(
const point_type& rRef,value_type fDist,std::vector<const _DataPoint*>& vFoundPoints)
const;
254 virtual void Print(
int iRow = 0)
const;
262 typedef typename std::vector<const point_type* >::iterator
data_it;
263 typedef typename std::vector<const point_type* >::const_iterator
const_data_it;
266 TerminalNode(Double_t iBucketSize,UInt_t iSplitAxis,data_it first,data_it end);
272 virtual Bool_t
Insert(
const point_type& rPoint);
274 void SetOwner(Bool_t bIsOwner =
true) {fOwnData = bIsOwner;}
276 data_it SplitEffectiveEntries();
277 data_it SplitBinContent();
278 void UpdateBoundaries();
305 const iterator operator++(
int)
const;
309 const iterator operator--(
int)
const;
324 Bin* Previous()
const;
330 KDTree(UInt_t iBucketSize);
342 void GetClosestPoints(
const point_type& rRef,UInt_t nPoints,std::vector<std::pair<const _DataPoint*,Double_t> >& vFoundPoints)
const;
347 void GetPointsWithinDist(
const point_type& rRef,value_type fDist,std::vector<const point_type*>& vFoundPoints)
const;
356 void SetOwner(Bool_t bIsOwner =
true);
375 #endif // ROOT_Math_KDTree
KDTree(const KDTree< point_type > &)
HeadNode & operator=(const HeadNode &)
#define Split(a, ahi, alo)
std::vector< tBoundary > fBoundaries
Double_t GetDensity() const
const std::vector< const point_type * > & GetPoints() const
std::vector< const point_type *>::iterator data_it
void SetAxis(UInt_t iAxis)
HeadNode(BaseNode &rNode)
virtual const BinNode * FindNode(const point_type &) const
Namespace for new ROOT classes and functions.
Double_t GetBinContent() const
virtual void Print(Int_t) const
Bool_t Insert(const point_type &rData)
const Bin * FindBin(const point_type &rPoint) const
const Cut * GetCut() const
BaseNode * fLeftChild
pointer to parent node
UInt_t GetEntries() const
virtual const BinNode * FindNode(const point_type &rPoint) const
virtual BinNode * Clone()
static UInt_t Dimension()
const BaseNode * LeftChild() const
virtual void GetPointsWithinDist(const point_type &, value_type, std::vector< const point_type *> &) const
void SetCutValue(Double_t fNewCutValue)
virtual const BinNode * FindNode(const point_type &rPoint) const
virtual const std::vector< tBoundary > & GetBoundaries() const
const Bin * operator->() const
std::pair< value_type, value_type > tBoundary
Double_t GetEffectiveEntries() const
TMatrixT< Element > operator<(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 < source2
const BaseNode * RightChild() const
HeadNode(const HeadNode &)
BaseNode * fRightChild
pointer to left child
KDTree< point_type > & operator=(const KDTree< point_type > &)
Double_t GetEffectiveEntries() const
Cut(UInt_t iAxis, Double_t fNewCutValue)
void SetSplitOption(eSplitOption opt)
void GetClosestPoints(const point_type &rRef, UInt_t nPoints, std::vector< std::pair< const _DataPoint *, Double_t > > &vFoundPoints) const
double pow(double, double)
virtual Bool_t Insert(const point_type &rPoint)=0
virtual void GetClosestPoints(const point_type &, UInt_t, std::vector< std::pair< const _DataPoint *, Double_t > > &) const
void SetOwner(Bool_t bIsOwner=true)
Bool_t IsLeftChild() const
UInt_t GetEntries() const
virtual Bool_t IsHeadNode() const
TerminalNode(const TerminalNode &)
Double_t GetTotalSumw() const
void GetPointsWithinDist(const point_type &rRef, value_type fDist, std::vector< const point_type *> &vFoundPoints) const
eSplitOption fSplitOption
std::vector< const _DataPoint * > fDataPoints
Double_t GetSumw2() const
void SetOwner(Bool_t bIsOwner=true)
Double_t GetBucketSize() const
virtual void Print(int iRow=0) const =0
SplitNode(const SplitNode &)
virtual const BinNode * FindNode(const point_type &rPoint) const =0
bool operator==(const iterator &rIterator) const
std::pair< value_type, value_type > tBoundary
BaseNode & operator=(const BaseNode &)
BaseNode(const BaseNode &)
TMatrixT< Element > operator>(const TMatrixT< Element > &source1, const TMatrixT< Element > &source2)
logical operation source1 > source2
iterator(const iterator ©)
virtual Bool_t Insert(const point_type &rPoint)
const BaseNode * Parent() const
Namespace for new Math classes and functions.
TerminalNode & operator=(const TerminalNode &)
Double_t GetTotalSumw2() const
const Bin & operator*() const
KDTree< _DataPoint > * GetFrozenCopy()
value_type GetCutValue() const
bool operator!=(const iterator &rIterator) const
Bool_t operator()(const point_type *pFirst, const point_type *pSecond) const
std::vector< const point_type *>::const_iterator const_data_it
_DataPoint::value_type value_type
void SetSplitOption(eSplitOption opt)
SplitNode & operator=(const SplitNode &)
BaseNode *& GetParentPointer()
void SetAxis(UInt_t iAxis)
virtual bool IsHeadNode() const