Logo ROOT   6.08/07
Reference Guide
BinPoint.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Author: L. Moneta Wed Aug 30 11:10:03 2006
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 
11 // Header file for class BinPoint
12 
13 #ifndef ROOT_Fit_BinPoint
14 #define ROOT_Fit_BinPoint
15 
16 
17 
18 
19 namespace ROOT {
20 
21  namespace Fit {
22 
23 
24  class DataRange;
25 
26 /**
27  Obsolete class, no more in use.
28  class describing the point with bins ( x coordinates, y and error on y )
29  but not error in X . For the Error in x one should use onother class
30 
31 
32 */
33 class BinPoint {
34 
35 public:
36 
37 
38  //typedef std::vector<double> CoordData;
39 
40 
41  /**
42  Constructor
43  */
44  explicit BinPoint (unsigned int n = 1) :
45  fDim(n),
46  fCoords(0 ),
47  fCoordErr( 0),
48  fValue(0),
49  fError(1),
50  fInvError(1)
51  {}
52 
53 // /**
54 // constructor from a vector of coordinates, y value and y error
55 // */
56 // BinPoint (const std::vector<double> & x, double y, double ey = 1) :
57 // fCoords(x),
58 // fValue(y),
59 // fInvError( ey!= 0 ? 1.0/ey : 0 )
60 // { }
61 
62 // template <class Iterator>
63 // BinPoint (const Iterator begin, const Iterator end, double y, double ey = 1) :
64 // fCoords(begin,end),
65 // fValue(y),
66 // fInvError( ey!= 0. ? 1.0/ey : 1. )
67 // { }
68 
69  void Set(const double * x, double value, double invErr) {
70  fCoords = x;
71  fValue = value;
72  fInvError = invErr;
73  }
74 
75  void Set(const double * x, double value, const double * ex, double err) {
76  fCoords = x;
77  fValue = value;
78  fCoordErr = ex;
79  fError = err;
80  }
81 
82 
83  /**
84  Destructor (no operations)
85  */
86  ~BinPoint () {}
87 
88  // use default copy constructor and assignment
89 
90 
91  // accessors
92 
93  /**
94  return pointer to coordinates
95  */
96  //const double * Coords() const { return &fCoords.front(); }
97 
98  /**
99  return vector of coordinates
100  */
101  const double * Coords() const { return fCoords; }
102 
103  /**
104  return the value (bin height in case of an histogram)
105  */
106  double Value() const { return fValue; }
107 
108  /**
109  return the error on the value
110  */
111  double Error() const {
112  //return fInvError != 0 ? 1.0/fInvError : 0;
113  return fError;
114  }
115 
116  /**
117  return the inverse of error on the value
118  */
119  double InvError() const { return fInvError; }
120 
121  /**
122  get the dimension (dimension of the cooordinates)
123  */
124  unsigned int NDim() const { return fDim; }
125 
126  /**
127  check if a Point is inside the given range
128  */
129  bool IsInRange( const DataRange & range) const;
130 
131 private:
132 
133  unsigned int fDim;
134  //double fCoords[N];
135  const double * fCoords;
136  const double * fCoordErr;
137 
138  double fValue;
139  // better to store the inverse of the error (is more efficient)
140  double fError;
141  double fInvError;
142 
143 
144 };
145 
146  } // end namespace Fit
147 
148 } // end namespace ROOT
149 
150 // #ifndef ROOT_Fit_DataRange
151 // #include "Fit/DataRange.h"
152 // #endif
153 // #include <cassert>
154 
155 // namespace ROOT {
156 
157 // namespace Fit {
158 
159 // template<unsigned int N>
160 // bool BinPoint<N>::IsInRange(const DataRange & range) const
161 // {
162 // // check if given point is inside the given range
163 
164 // // need to check that datarange size is same as point size
165 // if (range.NDim() == 0) return true; // (range is empty is equivalent to (-inf, + inf)
166 // // in case not zero dimension must be equal to the coordinates
167 // assert( kSize == range.NDim() );
168 // for (unsigned int i = 0; i < kSize; ++i) {
169 // if ( ! range.IsInside( fCoords[i] ) ) return false;
170 // }
171 // return true;
172 // }
173 
174 // } // end namespace Fit
175 
176 // } // end namespace ROOT
177 
178 
179 
180 #endif /* ROOT_Fit_BinPoint */
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
BinPoint(unsigned int n=1)
Constructor.
Definition: BinPoint.h:44
double Error() const
return the error on the value
Definition: BinPoint.h:111
double Value() const
return the value (bin height in case of an histogram)
Definition: BinPoint.h:106
Double_t x[n]
Definition: legend1.C:17
Obsolete class, no more in use.
Definition: BinPoint.h:33
~BinPoint()
Destructor (no operations)
Definition: BinPoint.h:86
const double * Coords() const
return pointer to coordinates
Definition: BinPoint.h:101
void Set(const double *x, double value, double invErr)
constructor from a vector of coordinates, y value and y error
Definition: BinPoint.h:69
const double * fCoordErr
Definition: BinPoint.h:136
double InvError() const
return the inverse of error on the value
Definition: BinPoint.h:119
void Set(const double *x, double value, const double *ex, double err)
Definition: BinPoint.h:75
unsigned int fDim
Definition: BinPoint.h:133
class describing the range in the coordinates it supports multiple range in a coordinate.
Definition: DataRange.h:34
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Definition: HFitImpl.cxx:134
const double * fCoords
Definition: BinPoint.h:135
Double_t ex[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
unsigned int NDim() const
get the dimension (dimension of the cooordinates)
Definition: BinPoint.h:124
bool IsInRange(const DataRange &range) const
check if a Point is inside the given range
Definition: BinPoint.cxx:23