Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Math::TDataPoint< K, _val_type > Class Template Reference

template<unsigned int K, typename _val_type = float>
class ROOT::Math::TDataPoint< K, _val_type >

class representing a data point

This class can be used for describing data points in a high-dimensional space. The (positive) dimension is specified by the first template parameter. The second template parameter can be used to tweak the precision of the stored coordinates. By default all coordinates are stored with 4 byte float precision. In addition to the coordinates a weight can be assigned to each data point allowing the representation of fields in high dimensions. Basic functionality for accessing/modifying the coordinates/weight are provided as well as a comparison method and the basic euclidean metric.

Definition at line 36 of file TDataPoint.h.

Public Types

enum  { kDimension = K }
 
typedef _val_type value_type
 

Public Member Functions

 TDataPoint ()
 standard constructor sets the weight to 1 and initialises all coordinates with 0
 
template<typename _coord_typ >
 TDataPoint (const _coord_typ *pData, _val_type fWeight=1)
 constructor initialising the data point from an array
 
template<typename _val >
value_type Distance (const TDataPoint< K, _val > &rPoint) const
 euclidean distance
 
value_type GetCoordinate (unsigned int iAxis) const
 returns the coordinate at the given axis
 
value_type GetWeight () const
 
Bool_t Less (TDataPoint &rPoint, unsigned int iAxis) const
 compares two points at a given axis
 
void SetCoordinate (unsigned int iAxis, _val_type fValue)
 sets the coordinate along one axis
 
void SetWeight (float fWeight)
 

Static Public Member Functions

static UInt_t Dimension ()
 

Private Attributes

value_type m_fWeight = 1
 weight at this point
 
value_type m_vCoordinates [K]
 coordinates
 

#include <Math/TDataPoint.h>

Member Typedef Documentation

◆ value_type

template<unsigned int K, typename _val_type = float>
typedef _val_type ROOT::Math::TDataPoint< K, _val_type >::value_type

Definition at line 38 of file TDataPoint.h.

Member Enumeration Documentation

◆ anonymous enum

template<unsigned int K, typename _val_type = float>
anonymous enum
Enumerator
kDimension 

Definition at line 39 of file TDataPoint.h.

Constructor & Destructor Documentation

◆ TDataPoint() [1/2]

template<unsigned int K, typename _val_type = float>
ROOT::Math::TDataPoint< K, _val_type >::TDataPoint ( )
inline

standard constructor sets the weight to 1 and initialises all coordinates with 0

Definition at line 45 of file TDataPoint.h.

◆ TDataPoint() [2/2]

template<unsigned int K, typename _val_type = float>
template<typename _coord_typ >
ROOT::Math::TDataPoint< K, _val_type >::TDataPoint ( const _coord_typ * pData,
_val_type fWeight = 1 )
inline

constructor initialising the data point from an array

Input: pData - array with kDimension coordinates fWeight - weight (default = 1)

Definition at line 59 of file TDataPoint.h.

Member Function Documentation

◆ Dimension()

template<unsigned int K, typename _val_type = float>
static UInt_t ROOT::Math::TDataPoint< K, _val_type >::Dimension ( )
inlinestatic

Definition at line 42 of file TDataPoint.h.

◆ Distance()

template<unsigned int K, typename _val_type = float>
template<typename _val >
value_type ROOT::Math::TDataPoint< K, _val_type >::Distance ( const TDataPoint< K, _val > & rPoint) const
inline

euclidean distance

returns the euclidean distance to the given data point

Input: rPoint - data point of same dimensionality

Definition at line 74 of file TDataPoint.h.

◆ GetCoordinate()

template<unsigned int K, typename _val_type = float>
value_type ROOT::Math::TDataPoint< K, _val_type >::GetCoordinate ( unsigned int iAxis) const
inline

returns the coordinate at the given axis

Input: iAxis - axis in the range of [0...kDimension-1]

Definition at line 86 of file TDataPoint.h.

◆ GetWeight()

template<unsigned int K, typename _val_type = float>
value_type ROOT::Math::TDataPoint< K, _val_type >::GetWeight ( ) const
inline

Definition at line 91 of file TDataPoint.h.

◆ Less()

template<unsigned int K, typename _val_type = float>
Bool_t ROOT::Math::TDataPoint< K, _val_type >::Less ( TDataPoint< K, _val_type > & rPoint,
unsigned int iAxis ) const
inline

compares two points at a given axis

returns: this_point.at(iAxis) < rPoint.at(iAxis)

Input: rPoint - second point to compare to (of same dimensionality) iAxis - axis in the range of [0...kDimension-1]

Definition at line 98 of file TDataPoint.h.

◆ SetCoordinate()

template<unsigned int K, typename _val_type = float>
void ROOT::Math::TDataPoint< K, _val_type >::SetCoordinate ( unsigned int iAxis,
_val_type fValue )
inline

sets the coordinate along one axis

Input: iAxis - axis in the range of [0...kDimension-1] fValue - new coordinate

Definition at line 107 of file TDataPoint.h.

◆ SetWeight()

template<unsigned int K, typename _val_type = float>
void ROOT::Math::TDataPoint< K, _val_type >::SetWeight ( float fWeight)
inline

Definition at line 112 of file TDataPoint.h.

Member Data Documentation

◆ m_fWeight

template<unsigned int K, typename _val_type = float>
value_type ROOT::Math::TDataPoint< K, _val_type >::m_fWeight = 1
private

weight at this point

Definition at line 116 of file TDataPoint.h.

◆ m_vCoordinates

template<unsigned int K, typename _val_type = float>
value_type ROOT::Math::TDataPoint< K, _val_type >::m_vCoordinates[K]
private

coordinates

Definition at line 115 of file TDataPoint.h.

  • math/mathcore/inc/Math/TDataPoint.h