Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TDataPointN.icc
Go to the documentation of this file.
1// @(#)root/mathcore:$Id: IFunction.h 24537 2008-06-25 11:01:23Z moneta $
2// Authors: C. Gumpert 09/2011
3/**********************************************************************
4 * *
5 * Copyright (c) 2011 , LCG ROOT MathLib Team *
6 * *
7 * *
8 **********************************************************************/
9//
10// impelmentation of template functions for TDataPointN class
11//
12
13#ifndef TDataPointN_ICC
14#define TDataPointN_ICC
15
16namespace ROOT
17{
18namespace Math
19{
20
21
22//////////////////////////////////////////////////////////////////////
23//
24// template<unsigned int _k,typename val_type> class TDataPointN
25//
26//////////////////////////////////////////////////////////////////////
27
28//______________________________________________________________________________
29template<typename _val_type>
31 m_vCoordinates(0),
32 m_fWeight(1)
33{
34 m_vCoordinates = new _val_type[kDimension];
35 for(UInt_t k = 0; k < kDimension; ++k)
36 m_vCoordinates[k] = 0;
37}
38
39//______________________________________________________________________________
40#ifndef __MAKECINT__
41template<typename _val_type>
42template<typename _coord_type>
43TDataPointN<_val_type>::TDataPointN(const _coord_type* pData,_val_type fWeight):
44 m_vCoordinates(0),
45 m_fWeight(fWeight)
46{
47 // fill coordinates
48 m_vCoordinates = new _val_type[kDimension];
49 for(unsigned int i = 0; i < kDimension; ++i)
50 m_vCoordinates[i] = pData[i];
51}
52#endif
53
54//______________________________________________________________________________
55template<typename _val_type>
57{
58 delete [] m_vCoordinates;
59}
60
61//______________________________________________________________________________
62#ifndef __MAKECINT__
63template<typename _val_type>
64template<typename _val>
66{
67 _val_type fDist2 = 0;
68 for(unsigned int i = 0; i < kDimension; ++i)
69 fDist2 += pow(GetCoordinate(i) - rPoint.GetCoordinate(i),2);
70
71 return sqrt(fDist2);
72}
73#endif
74
75//______________________________________________________________________________
76template<typename _val_type>
77inline _val_type TDataPointN<_val_type>::GetCoordinate(unsigned int iAxis) const
78{
79 assert(iAxis < kDimension);
80 return m_vCoordinates[iAxis];
81}
82
83//______________________________________________________________________________
84template<typename _val_type>
85inline void TDataPointN<_val_type>::SetCoordinate(unsigned int iAxis,_val_type fValue)
86{
87 assert(iAxis < kDimension);
88 m_vCoordinates[iAxis] = fValue;
89}
90
91//______________________________________________________________________________
92template<typename _val_type>
93inline bool TDataPointN<_val_type>::Less(TDataPointN<_val_type>& rPoint,unsigned int iAxis) const
94{
95 assert(iAxis < kDimension);
96 return (m_vCoordinates[iAxis] < rPoint.GetCoordinate(iAxis));
97}
98
99}//namespace Math
100}//namespace ROOT
101
102#endif //TDataPointN_ICC
constexpr Int_t kDimension
_val_type Distance(const TDataPointN< _val > &rPoint) const
void SetCoordinate(unsigned int iAxis, value_type fValue)
bool Less(TDataPointN &rPoint, unsigned int iAxis) const
static UInt_t kDimension
Definition TDataPointN.h:33
value_type * m_vCoordinates
Definition TDataPointN.h:61
_val_type GetCoordinate(unsigned int iAxis) const
Namespace for new Math classes and functions.
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...