ROOT logo
// @(#)root/mathcore:$Id$
// Author: L. Moneta Wed Aug 30 11:10:03 2006

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
 *                                                                    *
 *                                                                    *
 **********************************************************************/

// Header file for class BinPoint

#ifndef ROOT_Fit_BinPoint
#define ROOT_Fit_BinPoint




namespace ROOT { 

   namespace Fit { 


      class DataRange; 

/** 
    Obsolete class, no more in use.
    class describing the point with bins ( x coordinates, y and error on y ) 
     but not error in X . For the Error in x one should use onother class

              
*/ 
class BinPoint {

public: 

   
   //typedef  std::vector<double> CoordData; 


   /** 
      Constructor
   */ 
   explicit BinPoint (unsigned int n = 1) : 
      fDim(n),
      fCoords(0 ), 
      fCoordErr( 0),
      fValue(0), 
      fError(1),
      fInvError(1)
   {}

//    /**
//       constructor from a vector of coordinates, y value and y error
//     */
//    BinPoint (const std::vector<double> & x, double y, double ey = 1) : 
//       fCoords(x), 
//       fValue(y), 
//       fInvError( ey!= 0 ? 1.0/ey : 0 )
//    { }
   
//    template <class Iterator> 
//    BinPoint (const Iterator begin, const Iterator end, double y, double ey = 1) : 
//       fCoords(begin,end), 
//       fValue(y), 
//       fInvError( ey!= 0. ? 1.0/ey : 1. )
//    { }

   void Set(const double * x, double value, double invErr) { 
      fCoords = x; 
      fValue = value; 
      fInvError = invErr;
   }

   void Set(const double * x, double value, const double * ex, double err) { 
      fCoords = x; 
      fValue = value;
      fCoordErr = ex; 
      fError = err;
   }


   /** 
      Destructor (no operations)
   */ 
   ~BinPoint ()  {}  

   // use default copy constructor and assignment


   // accessors 

   /**
      return pointer to coordinates 
    */
   //const double *  Coords() const { return &fCoords.front(); }

    /**
      return vector of coordinates 
    */
   const double * Coords() const { return fCoords; }

   /**
      return the value (bin height in case of an histogram)
    */
   double Value() const { return fValue; }

   /**
      return the error on the value 
    */
   double Error() const { 
      //return fInvError != 0 ? 1.0/fInvError : 0; 
      return fError;
   } 

   /**
      return the inverse of error on the value 
    */
   double InvError() const { return fInvError; }

   /** 
     get the dimension (dimension of the cooordinates)
    */
   unsigned int NDim() const { return  fDim; }

   /**
      check if a Point is inside the given range 
    */ 
   bool IsInRange( const DataRange & range) const; 

private: 

   unsigned int fDim;
   //double fCoords[N];
   const double * fCoords; 
   const double * fCoordErr; 
   
   double fValue; 
   // better to store the inverse of the error (is more efficient)
   double fError; 
   double fInvError; 


}; 

   } // end namespace Fit

} // end namespace ROOT

// #ifndef ROOT_Fit_DataRange
// #include "Fit/DataRange.h"
// #endif
// #include <cassert> 

// namespace ROOT { 

//    namespace Fit { 

// template<unsigned int N> 
// bool BinPoint<N>::IsInRange(const DataRange & range) const 
// {
//    // check if given point is inside the given range
  
//    // need to check that datarange size is same as point size 
//    if (range.NDim() == 0) return true; // (range is empty is equivalent to (-inf, + inf) 
//    // in case not zero dimension must be equal to the coordinates
//    assert( kSize == range.NDim() );  
//    for (unsigned int i = 0; i < kSize; ++i) { 
//       if ( ! range.IsInside( fCoords[i] ) ) return false; 
//    }
//    return true; 
// }

//    } // end namespace Fit

// } // end namespace ROOT



#endif /* ROOT_Fit_BinPoint */
 BinPoint.h:1
 BinPoint.h:2
 BinPoint.h:3
 BinPoint.h:4
 BinPoint.h:5
 BinPoint.h:6
 BinPoint.h:7
 BinPoint.h:8
 BinPoint.h:9
 BinPoint.h:10
 BinPoint.h:11
 BinPoint.h:12
 BinPoint.h:13
 BinPoint.h:14
 BinPoint.h:15
 BinPoint.h:16
 BinPoint.h:17
 BinPoint.h:18
 BinPoint.h:19
 BinPoint.h:20
 BinPoint.h:21
 BinPoint.h:22
 BinPoint.h:23
 BinPoint.h:24
 BinPoint.h:25
 BinPoint.h:26
 BinPoint.h:27
 BinPoint.h:28
 BinPoint.h:29
 BinPoint.h:30
 BinPoint.h:31
 BinPoint.h:32
 BinPoint.h:33
 BinPoint.h:34
 BinPoint.h:35
 BinPoint.h:36
 BinPoint.h:37
 BinPoint.h:38
 BinPoint.h:39
 BinPoint.h:40
 BinPoint.h:41
 BinPoint.h:42
 BinPoint.h:43
 BinPoint.h:44
 BinPoint.h:45
 BinPoint.h:46
 BinPoint.h:47
 BinPoint.h:48
 BinPoint.h:49
 BinPoint.h:50
 BinPoint.h:51
 BinPoint.h:52
 BinPoint.h:53
 BinPoint.h:54
 BinPoint.h:55
 BinPoint.h:56
 BinPoint.h:57
 BinPoint.h:58
 BinPoint.h:59
 BinPoint.h:60
 BinPoint.h:61
 BinPoint.h:62
 BinPoint.h:63
 BinPoint.h:64
 BinPoint.h:65
 BinPoint.h:66
 BinPoint.h:67
 BinPoint.h:68
 BinPoint.h:69
 BinPoint.h:70
 BinPoint.h:71
 BinPoint.h:72
 BinPoint.h:73
 BinPoint.h:74
 BinPoint.h:75
 BinPoint.h:76
 BinPoint.h:77
 BinPoint.h:78
 BinPoint.h:79
 BinPoint.h:80
 BinPoint.h:81
 BinPoint.h:82
 BinPoint.h:83
 BinPoint.h:84
 BinPoint.h:85
 BinPoint.h:86
 BinPoint.h:87
 BinPoint.h:88
 BinPoint.h:89
 BinPoint.h:90
 BinPoint.h:91
 BinPoint.h:92
 BinPoint.h:93
 BinPoint.h:94
 BinPoint.h:95
 BinPoint.h:96
 BinPoint.h:97
 BinPoint.h:98
 BinPoint.h:99
 BinPoint.h:100
 BinPoint.h:101
 BinPoint.h:102
 BinPoint.h:103
 BinPoint.h:104
 BinPoint.h:105
 BinPoint.h:106
 BinPoint.h:107
 BinPoint.h:108
 BinPoint.h:109
 BinPoint.h:110
 BinPoint.h:111
 BinPoint.h:112
 BinPoint.h:113
 BinPoint.h:114
 BinPoint.h:115
 BinPoint.h:116
 BinPoint.h:117
 BinPoint.h:118
 BinPoint.h:119
 BinPoint.h:120
 BinPoint.h:121
 BinPoint.h:122
 BinPoint.h:123
 BinPoint.h:124
 BinPoint.h:125
 BinPoint.h:126
 BinPoint.h:127
 BinPoint.h:128
 BinPoint.h:129
 BinPoint.h:130
 BinPoint.h:131
 BinPoint.h:132
 BinPoint.h:133
 BinPoint.h:134
 BinPoint.h:135
 BinPoint.h:136
 BinPoint.h:137
 BinPoint.h:138
 BinPoint.h:139
 BinPoint.h:140
 BinPoint.h:141
 BinPoint.h:142
 BinPoint.h:143
 BinPoint.h:144
 BinPoint.h:145
 BinPoint.h:146
 BinPoint.h:147
 BinPoint.h:148
 BinPoint.h:149
 BinPoint.h:150
 BinPoint.h:151
 BinPoint.h:152
 BinPoint.h:153
 BinPoint.h:154
 BinPoint.h:155
 BinPoint.h:156
 BinPoint.h:157
 BinPoint.h:158
 BinPoint.h:159
 BinPoint.h:160
 BinPoint.h:161
 BinPoint.h:162
 BinPoint.h:163
 BinPoint.h:164
 BinPoint.h:165
 BinPoint.h:166
 BinPoint.h:167
 BinPoint.h:168
 BinPoint.h:169
 BinPoint.h:170
 BinPoint.h:171
 BinPoint.h:172
 BinPoint.h:173
 BinPoint.h:174
 BinPoint.h:175
 BinPoint.h:176
 BinPoint.h:177
 BinPoint.h:178
 BinPoint.h:179
 BinPoint.h:180