Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TDataPoint.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Authors: C. Gumpert 09/2011
3 /**********************************************************************
4  * *
5  * Copyright (c) 2011 , LCG ROOT MathLib Team *
6  * *
7  * *
8  **********************************************************************/
9 //
10 // Header file for TDataPointclass
11 //
12 
13 #ifndef ROOT_Math_TDataPoint
14 #define ROOT_Math_TDataPoint
15 
16 //ROOT include(s)
17 #include "Rtypes.h"
18 
19 
20 namespace ROOT
21 {
22 namespace Math
23 {
24 
25 
26 template<unsigned int K,typename _val_type = float>
27 class TDataPoint
28 {
29 public:
30  typedef _val_type value_type;
31  enum {
32  kDimension = K //the dimensionality of this data point
33  };
34  static UInt_t Dimension() {return kDimension;}
35  TDataPoint();
36 #ifndef __MAKECINT__
37  template<typename _coord_typ>
38  TDataPoint(const _coord_typ* pData,_val_type fWeight = 1);
39 #endif
40  //virtual ~TDataPoint() {}
41 #ifndef __MAKECINT__
42  template<typename _val>
43  value_type Distance(const TDataPoint<K,_val>& rPoint) const;
44 #endif
45  value_type GetCoordinate(unsigned int iAxis) const;
46  value_type GetWeight() const {return m_fWeight;}
47  Bool_t Less(TDataPoint& rPoint,unsigned int iAxis) const;
48  void SetCoordinate(unsigned int iAxis,_val_type fValue);
49  void SetWeight(float fWeight) {m_fWeight = fWeight;}
50 
51 private:
52  value_type m_vCoordinates[K]; //coordinates
53  value_type m_fWeight; //weight at this point
54 };
55 
56 // some typedef definitions
57 typedef TDataPoint<1,Float_t> TDataPoint1F;
58 typedef TDataPoint<2,Float_t> TDataPoint2F;
59 typedef TDataPoint<3,Float_t> TDataPoint3F;
60 typedef TDataPoint<1,Double_t> TDataPoint1D;
61 typedef TDataPoint<2,Double_t> TDataPoint2D;
62 typedef TDataPoint<3,Double_t> TDataPoint3D;
63 
64 }//namespace Math
65 }//namespace ROOT
66 
67 #include "Math/TDataPoint.icc"
68 
69 
70 #endif // ROOT_Math_TDataPoint