28 template<
class _DataPo
int>
30 fBucketSize(iBucketSize),
55 template<
class _DataPo
int>
67 template<
class _DataPo
int>
80 template<
class _DataPo
int>
98 template<
class _DataPo
int>
112 template<
class _DataPo
int>
126 template<
class _DataPo
int>
137 assert(dynamic_cast<BinNode*>(pNode));
142 template<
class _DataPo
int>
153 assert(dynamic_cast<BinNode*>(pNode));
158 template<
class _DataPo
int>
176 std::vector<TerminalNode*> vBins;
179 vBins.push_back(it.TN());
182 for(
typename std::vector<TerminalNode*>::iterator bit = vBins.begin(); bit != vBins.end(); ++bit)
184 pBin = (*bit)->ConvertToBinNode();
195 template<
class _DataPo
int>
197 std::vector<std::pair<const _DataPoint*,Double_t> >& vFoundPoints)
const 219 template<
class _DataPo
int>
230 fSumw += it->GetBinContent();
231 fSumw2 += it->GetSumw2();
234 return ((fSumw2) ? fSumw * fSumw / fSumw2 : 0);
238 template<
class _DataPo
int>
245 iPoints += it->GetEntries();
251 template<
class _DataPo
int>
268 template<
class _DataPo
int>
281 template<
class _DataPo
int>
283 std::vector<const _DataPoint*>& vFoundPoints)
const 303 template<
class _DataPo
int>
310 fSumw += it->GetSumw();
316 template<
class _DataPo
int>
323 fSumw2 += it->GetSumw2();
329 template<
class _DataPo
int>
340 assert(dynamic_cast<TerminalNode*>(pNode));
345 template<
class _DataPo
int>
356 assert(dynamic_cast<BinNode*>(pNode));
361 template<
class _DataPo
int>
386 template<
class _DataPo
int>
400 it.TN()->SetOwner(bIsOwner);
405 template<
class _DataPo
int>
423 it.TN()->SetSplitOption(opt);
428 template<
class _DataPo
int>
447 return (pFirst->GetCoordinate(fAxis) < pSecond->GetCoordinate(fAxis));
451 template<
class _DataPo
int>
467 return (fCutValue < rPoint.GetCoordinate(fAxis));
471 template<
class _DataPo
int>
487 return (fCutValue > rPoint.GetCoordinate(fAxis));
491 template<
class _DataPo
int>
501 template<
class _DataPo
int>
515 template<
class _DataPo
int>
537 template<
class _DataPo
int>
551 template<
class _DataPo
int>
561 pParent->
Parent() = pHead;
567 template<
class _DataPo
int>
569 std::vector<std::pair<const _DataPoint*,Double_t> >& vFoundPoints)
const 575 template<
class _DataPo
int>
577 std::vector<const _DataPoint*>& vFoundPoints)
const 583 template<
class _DataPo
int>
587 fCut(new
Cut(iAxis,fCutValue))
605 template<
class _DataPo
int>
614 template<
class _DataPo
int>
627 pRight->
Parent() = pSplit;
633 template<
class _DataPo
int>
647 template<
class _DataPo
int>
649 std::vector<std::pair<const _DataPoint*,Double_t> >& vFoundPoints)
const 684 template<
class _DataPo
int>
686 std::vector<const _DataPoint*>& vFoundPoints)
const 716 template<
class _DataPo
int>
730 template<
class _DataPo
int>
735 std::cout <<
"SplitNode at " <<
this <<
" in row " << iRow << std::endl;
743 template<
class _DataPo
int>
755 template<
class _DataPo
int>
774 template<
class _DataPo
int>
783 template<
class _DataPo
int>
793 template<
class _DataPo
int>
809 template<
class _DataPo
int>
821 template<
class _DataPo
int>
838 template<
class _DataPo
int>
847 for(
typename std::vector<tBoundary>::const_iterator it =
fBoundaries.begin(); it !=
fBoundaries.end(); ++it)
848 dVol *= (it->second - it->first);
855 template<
class _DataPo
int>
863 fSumw += rPoint.GetWeight();
873 template<
class _DataPo
int>
879 if((rPoint.GetCoordinate(k) <
fBoundaries.at(k).first) || (
fBoundaries.at(k).second < rPoint.GetCoordinate(k)))
886 template<
class _DataPo
int>
891 std::cout <<
"BinNode at " <<
this << std::endl;
892 std::cout <<
"containing " <<
GetEntries() <<
" entries" << std::endl;
894 std::cout <<
"volume = " <<
GetVolume() <<
" and bin center at (";
898 std::cout << rBinCenter.GetCoordinate(dim);
902 std::cout <<
")" << std::endl;
903 std::cout <<
"boundaries are ";
904 for(
typename std::vector<tBoundary>::const_iterator it =
fBoundaries.begin(); it !=
fBoundaries.end(); ++it)
905 std::cout <<
"(" << it->first <<
" ... " << it->second <<
") ";
906 std::cout << std::endl;
910 template<
class _DataPo
int>
931 template<
class _DataPo
int>
950 this->
fSumw += (*it)->GetWeight();
951 this->
fSumw2 +=
pow((*it)->GetWeight(),2);
958 template<
class _DataPo
int>
967 for(
typename std::vector<const _DataPoint*>::iterator it =
fDataPoints.begin();
974 template<
class _DataPo
int>
991 template<
class _DataPo
int>
1001 for(
typename std::vector<const _DataPoint*>::iterator it =
fDataPoints.begin();
1010 template<
class _DataPo
int>
1035 template<
class _DataPo
int>
1037 std::vector<std::pair<const _DataPoint*,Double_t> >& vFoundPoints)
const 1048 value_type fMaxDist = (vFoundPoints.size() < nPoints) ? std::numeric_limits<value_type>::max() : vFoundPoints.back().second;
1050 typedef typename std::vector<std::pair<const _DataPoint*,Double_t> >
::iterator t_pit;
1053 for(
typename std::vector<const _DataPoint*>::const_iterator it =
fDataPoints.begin(); it !=
fDataPoints.end(); ++it)
1055 fDist = (*it)->Distance(rRef);
1057 if(fDist < fMaxDist)
1060 t_pit pit = vFoundPoints.begin();
1061 while(pit != vFoundPoints.end())
1063 if(pit->second > fDist)
1069 vFoundPoints.insert(pit,std::make_pair(*it,fDist));
1071 if(vFoundPoints.size() > nPoints)
1072 vFoundPoints.resize(nPoints);
1074 fMaxDist = (vFoundPoints.size() < nPoints) ? vFoundPoints.back().second : std::numeric_limits<value_type>::max();
1080 template<
class _DataPo
int>
1082 std::vector<const _DataPoint*>& vFoundPoints)
const 1093 for(
typename std::vector<const _DataPoint*>::const_iterator it =
fDataPoints.begin(); it !=
fDataPoints.end(); ++it)
1095 if((*it)->Distance(rRef) <= fDist)
1096 vFoundPoints.push_back(*it);
1101 template<
class _DataPo
int>
1113 this->
fSumw += rPoint.GetWeight();
1114 this->
fSumw2 +=
pow(rPoint.GetWeight(),2);
1128 default: assert(
false);
1135 template<
class _DataPo
int>
1140 std::cout <<
"TerminalNode at " <<
this <<
" in row " << iRow << std::endl;
1143 std::cout <<
"next split axis: " <<
fSplitAxis << std::endl << std::endl;
1149 std::cout << (*it)->GetCoordinate(i);
1153 std::cout <<
"), w = " << (*it)->GetWeight() << std::endl;
1156 std::cout << std::endl;
1160 template<
class _DataPo
int>
1189 default: assert(
false);
1206 this->
fSumw += (*it)->GetWeight();
1207 this->
fSumw2 +=
pow((*it)->GetWeight(),2);
1231 template<
class _DataPo
int>
1255 while(((fSumwTemp * fSumwTemp)/fSumw2Temp < fEffective/2) && (step > 1))
1257 middle = first + (++step /= 2);
1258 std::partial_sort(first,middle,
fDataPoints.end(),cComp);
1260 while(((fSumwTemp * fSumwTemp)/fSumw2Temp < fEffective/2) && (cut != middle-1))
1262 fSumwTemp += (*cut)->GetWeight();
1263 fSumw2Temp +=
pow((*cut)->GetWeight(),2);
1273 template<
class _DataPo
int>
1296 while((fSumwTemp < fBinContent/2) && (step > 1))
1298 middle = first + (++step /= 2);
1299 std::partial_sort(first,middle,
fDataPoints.end(),cComp);
1301 while((fSumwTemp < fBinContent/2) && (cut != middle-1))
1303 fSumwTemp += (*cut)->GetWeight();
1313 template<
class _DataPo
int>
1329 const value_type fMAX = 0.4 * std::numeric_limits<value_type>::max();
1337 const Cut* pCut = 0;
1339 while(!pNode->IsHeadNode())
1341 pSplit =
dynamic_cast<const SplitNode*
>(pNode);
1351 bLeft = pNode->IsLeftChild();
1352 pNode = pNode->Parent();
1366 for(
typename std::vector<const _DataPoint*>::const_iterator it =
fDataPoints.begin();
1369 if((*it)->GetCoordinate(dim) < this->
fBoundaries.at(dim).first)
1370 this->
fBoundaries.at(dim).first = (*it)->GetCoordinate(dim);
1378 for(
typename std::vector<const _DataPoint*>::const_iterator it =
fDataPoints.begin();
1381 if((*it)->GetCoordinate(dim) > this->
fBoundaries.at(dim).second)
1382 this->
fBoundaries.at(dim).second = (*it)->GetCoordinate(dim);
1390 template<
class _DataPo
int>
1400 template<
class _DataPo
int>
1410 template<
class _DataPo
int>
1421 template<
class _DataPo
int>
1432 template<
class _DataPo
int>
1442 template<
class _DataPo
int>
1452 template<
class _DataPo
int>
1463 template<
class _DataPo
int>
1474 template<
class _DataPo
int>
1484 template<
class _DataPo
int>
1499 while(pNode->LeftChild())
1502 assert(dynamic_cast<BinNode*>(pNode));
1513 template<
class _DataPo
int>
1528 while(pNode->RightChild())
1531 assert(dynamic_cast<BinNode*>(pNode));
1544 #endif //KD_TREE_ICC
std::vector< tBoundary > fBoundaries
iterator & operator=(const iterator &rhs)
virtual SplitNode * Clone()
BaseNode(BaseNode *pParent=0)
virtual HeadNode * Clone()
std::vector< const point_type *>::iterator data_it
virtual void Print(Int_t iRow=0) const
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Double_t GetBinContent() const
virtual BinNode * Clone()
virtual const BinNode * FindNode(const point_type &rPoint) const
const Cut * GetCut() const
BinNode(BaseNode *pParent=0)
UInt_t GetEntries() const
static UInt_t Dimension()
virtual void Print(int iRow=0) const
Bool_t operator>(const point_type &rPoint) const
virtual Bool_t Insert(const point_type &rPoint)
virtual const BinNode * FindNode(const point_type &rPoint) const
virtual const std::vector< tBoundary > & GetBoundaries() const
std::pair< value_type, value_type > tBoundary
Double_t GetEffectiveEntries() const
virtual void GetClosestPoints(const point_type &rRef, UInt_t nPoints, std::vector< std::pair< const _DataPoint *, Double_t > > &vFoundPoints) const
virtual void GetClosestPoints(const point_type &rRef, UInt_t nPoints, std::vector< std::pair< const _DataPoint *, Double_t > > &vFoundPoints) const
Double_t GetEffectiveEntries() const
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
void SetOwner(Bool_t bIsOwner=true)
Bool_t IsLeftChild() const
TerminalNode(Double_t iBucketSize, BaseNode *pParent=0)
UInt_t GetEntries() const
virtual Bool_t IsHeadNode() const
virtual void GetPointsWithinDist(const point_type &rRef, value_type fDist, std::vector< const point_type *> &vFoundPoints) const =0
Double_t GetTotalSumw() const
void GetPointsWithinDist(const point_type &rRef, value_type fDist, std::vector< const point_type *> &vFoundPoints) const
data_it SplitEffectiveEntries()
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
eSplitOption fSplitOption
BinNode * ConvertToBinNode()
std::vector< const _DataPoint * > fDataPoints
Double_t GetSumw2() const
void SetOwner(Bool_t bIsOwner=true)
virtual void Print(int iRow=0) const =0
virtual const BinNode * FindNode(const point_type &rPoint) const =0
virtual void GetPointsWithinDist(const point_type &rRef, value_type fDist, std::vector< const _DataPoint *> &vFoundPoints) const
BinNode & operator=(const BinNode &rhs)
SplitNode(UInt_t iAxis, Double_t fCutValue, BaseNode &rLeft, BaseNode &rRight, BaseNode *pParent=0)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual BaseNode * Clone()=0
Namespace for new Math classes and functions.
Double_t GetTotalSumw2() const
KDTree< _DataPoint > * GetFrozenCopy()
value_type GetCutValue() const
Bool_t operator<(const point_type &rPoint) const
Double_t GetVolume() const
virtual Bool_t Insert(const point_type &rPoint)
Bool_t operator()(const point_type *pFirst, const point_type *pSecond) const
point_type GetBinCenter() const
std::vector< const point_type *>::const_iterator const_data_it
virtual const std::vector< tBoundary > & GetBoundaries() const
virtual void GetClosestPoints(const point_type &rRef, UInt_t nPoints, std::vector< std::pair< const _DataPoint *, Double_t > > &vFoundPoints) const
_DataPoint::value_type value_type
virtual void GetPointsWithinDist(const point_type &rRef, value_type fDist, std::vector< const _DataPoint *> &vFoundPoints) const
virtual Bool_t Insert(const point_type &rPoint)
void SetSplitOption(eSplitOption opt)
data_it SplitBinContent()
virtual void GetPointsWithinDist(const point_type &rRef, value_type fDist, std::vector< const _DataPoint *> &vFoundPoints) const
Bool_t IsInBin(const point_type &rPoint) const
BaseNode *& GetParentPointer()
virtual void GetClosestPoints(const point_type &rRef, UInt_t nPoints, std::vector< std::pair< const _DataPoint *, Double_t > > &vFoundPoints) const =0
void SetAxis(UInt_t iAxis)
virtual void Print(int iRow=0) const