Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:22

0001 // @(#)root/mathcore:$Id$
0002 // Authors: C. Gumpert    09/2011
0003 /**********************************************************************
0004  *                                                                    *
0005  * Copyright (c) 2011 , LCG ROOT MathLib Team                         *
0006  *                                                                    *
0007  *                                                                    *
0008  **********************************************************************/
0009 //
0010 // Header file for TDataPointclass
0011 //
0012 
0013 #ifndef ROOT_Math_TDataPoint
0014 #define ROOT_Math_TDataPoint
0015 
0016 //ROOT include(s)
0017 #include "RtypesCore.h"
0018 
0019 
0020 namespace ROOT
0021 {
0022 namespace Math
0023 {
0024 
0025 
0026 template<unsigned int K,typename _val_type = float>
0027 class TDataPoint
0028 {
0029 public:
0030    typedef _val_type value_type;
0031    enum {
0032       kDimension = K //the dimensionality of this data point
0033    };
0034    static UInt_t Dimension() {return kDimension;}
0035    TDataPoint();
0036 #ifndef __MAKECINT__
0037    template<typename _coord_typ>
0038    TDataPoint(const _coord_typ* pData,_val_type fWeight = 1);
0039 #endif
0040    //virtual ~TDataPoint() {}
0041 #ifndef __MAKECINT__
0042    template<typename _val>
0043    value_type   Distance(const TDataPoint<K,_val>& rPoint) const;
0044 #endif
0045    value_type   GetCoordinate(unsigned int iAxis) const;
0046    value_type   GetWeight() const {return m_fWeight;}
0047    Bool_t       Less(TDataPoint& rPoint,unsigned int iAxis) const;
0048    void         SetCoordinate(unsigned int iAxis,_val_type fValue);
0049    void         SetWeight(float fWeight) {m_fWeight = fWeight;}
0050 
0051 private:
0052    value_type   m_vCoordinates[K]; ///< coordinates
0053    value_type   m_fWeight;         ///< weight at this point
0054 };
0055 
0056 // some typedef definitions
0057 typedef TDataPoint<1,Float_t>  TDataPoint1F;
0058 typedef TDataPoint<2,Float_t>  TDataPoint2F;
0059 typedef TDataPoint<3,Float_t>  TDataPoint3F;
0060 typedef TDataPoint<1,Double_t> TDataPoint1D;
0061 typedef TDataPoint<2,Double_t> TDataPoint2D;
0062 typedef TDataPoint<3,Double_t> TDataPoint3D;
0063 
0064 }//namespace Math
0065 }//namespace ROOT
0066 
0067 #include "Math/TDataPoint.icc"
0068 
0069 
0070 #endif // ROOT_Math_TDataPoint