File indexing completed on 2025-01-18 10:10:22
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef TDataPointN_ICC
0014 #define TDataPointN_ICC
0015
0016 namespace ROOT
0017 {
0018 namespace Math
0019 {
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 template<typename _val_type>
0030 TDataPointN<_val_type>::TDataPointN():
0031 m_vCoordinates(nullptr),
0032 m_fWeight(1)
0033 {
0034 m_vCoordinates = new _val_type[kDimension];
0035 for(UInt_t k = 0; k < kDimension; ++k)
0036 m_vCoordinates[k] = 0;
0037 }
0038
0039
0040 #ifndef __MAKECINT__
0041 template<typename _val_type>
0042 template<typename _coord_type>
0043 TDataPointN<_val_type>::TDataPointN(const _coord_type* pData,_val_type fWeight):
0044 m_vCoordinates(0),
0045 m_fWeight(fWeight)
0046 {
0047
0048 m_vCoordinates = new _val_type[kDimension];
0049 for(unsigned int i = 0; i < kDimension; ++i)
0050 m_vCoordinates[i] = pData[i];
0051 }
0052 #endif
0053
0054
0055 template<typename _val_type>
0056 TDataPointN<_val_type>::~TDataPointN()
0057 {
0058 delete [] m_vCoordinates;
0059 }
0060
0061
0062 #ifndef __MAKECINT__
0063 template<typename _val_type>
0064 template<typename _val>
0065 _val_type TDataPointN<_val_type>::Distance(const TDataPointN<_val>& rPoint) const
0066 {
0067 _val_type fDist2 = 0;
0068 for(unsigned int i = 0; i < kDimension; ++i)
0069 fDist2 += pow(GetCoordinate(i) - rPoint.GetCoordinate(i),2);
0070
0071 return sqrt(fDist2);
0072 }
0073 #endif
0074
0075
0076 template<typename _val_type>
0077 inline _val_type TDataPointN<_val_type>::GetCoordinate(unsigned int iAxis) const
0078 {
0079 assert(iAxis < kDimension);
0080 return m_vCoordinates[iAxis];
0081 }
0082
0083
0084 template<typename _val_type>
0085 inline void TDataPointN<_val_type>::SetCoordinate(unsigned int iAxis,_val_type fValue)
0086 {
0087 assert(iAxis < kDimension);
0088 m_vCoordinates[iAxis] = fValue;
0089 }
0090
0091
0092 template<typename _val_type>
0093 inline bool TDataPointN<_val_type>::Less(TDataPointN<_val_type>& rPoint,unsigned int iAxis) const
0094 {
0095 assert(iAxis < kDimension);
0096 return (m_vCoordinates[iAxis] < rPoint.GetCoordinate(iAxis));
0097 }
0098
0099 }
0100 }
0101
0102 #endif