Logo ROOT  
Reference Guide
BinData.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Author: L. Moneta Wed Aug 30 11:15:23 2006
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 
11 // Header file for class BinData
12 
13 #ifndef ROOT_Fit_BinData
14 #define ROOT_Fit_BinData
15 
16 #include "Fit/FitData.h"
17 #include "Math/Error.h"
18 #include <cmath>
19 #include <vector>
20 
21 namespace ROOT {
22 
23  namespace Fit {
24 
25 
26 
27 //___________________________________________________________________________________
28 /**
29  Class describing the binned data sets :
30  vectors of x coordinates, y values and optionally error on y values and error on coordinates
31  The dimension of the coordinate is free
32  There are 4 different options:
33  - only coordinates and values (for binned likelihood fits) : kNoError
34  - coordinate, values and error on values (for normal least square fits) : kValueError
35  - coordinate, values, error on values and coordinates (for effective least square fits) : kCoordError
36  - corrdinate, values, error on coordinates and asymmettric error on valyes : kAsymError
37 
38  In addition there is the option to construct Bindata copying the data in (using the DataVector class)
39  or using pointer to external data (DataWrapper) class.
40  In general is found to be more efficient to copy the data.
41  In case of really large data sets for limiting memory consumption then the other option can be used
42  Specialized constructor exists for data up to 3 dimensions.
43 
44  When the data are copying in the number of points can be set later (or re-set) using Initialize and
45  the data are inserted one by one using the Add method.
46  It is mandatory to set the size before using the Add method.
47 
48  @ingroup FitData
49 */
50 
51 
52 class BinData : public FitData {
53 
54 public :
55 
57 
58  /**
59  constructor from dimension of point and max number of points (to pre-allocate vector)
60  Give a zero value and then use Initialize later one if the size is not known
61  */
62 
63  explicit BinData(unsigned int maxpoints = 0, unsigned int dim = 1,
64  ErrorType err = kValueError);
65 
66 
67  /**
68  constructor from option and default range
69  */
70  explicit BinData (const DataOptions & opt, unsigned int maxpoints = 0,
71  unsigned int dim = 1, ErrorType err = kValueError);
72 
73  /**
74  constructor from options and range
75  efault is 1D and value errors
76  */
77  BinData (const DataOptions & opt, const DataRange & range,
78  unsigned int maxpoints = 0, unsigned int dim = 1, ErrorType err = kValueError );
79 
80  /** constructurs using external data */
81 
82  /**
83  constructor from external data for 1D with errors on coordinate and value
84  */
85  BinData(unsigned int n, const double * dataX, const double * val,
86  const double * ex , const double * eval );
87 
88  /**
89  constructor from external data for 2D with errors on coordinate and value
90  */
91  BinData(unsigned int n, const double * dataX, const double * dataY,
92  const double * val, const double * ex , const double * ey,
93  const double * eval );
94 
95  /**
96  constructor from external data for 3D with errors on coordinate and value
97  */
98  BinData(unsigned int n, const double * dataX, const double * dataY,
99  const double * dataZ, const double * val, const double * ex ,
100  const double * ey , const double * ez , const double * eval );
101 
102  /**
103  destructor
104  */
105  virtual ~BinData();
106 
107  /**
108  copy constructors
109  */
110  BinData(const BinData & rhs);
111 
112  BinData & operator= ( const BinData & rhs );
113 
114 
115  /**
116  preallocate a data set with given size , dimension and error type (to get the full point size)
117  If the data set already exists and it is having the compatible point size space for the new points
118  is created in the data sets, while if not compatible the old data are erased and new space of
119  new size is allocated.
120  (i.e if exists initialize is equivalent to a resize( NPoints() + maxpoints)
121  */
122 
123  void Append( unsigned int newPoints, unsigned int dim = 1, ErrorType err = kValueError );
124 
125  void Initialize( unsigned int newPoints, unsigned int dim = 1, ErrorType err = kValueError );
126 
127  /**
128  flag to control if data provides error on the coordinates
129  */
130  bool HaveCoordErrors() const {
131  assert ( fErrorType == kNoError ||
132  fErrorType == kValueError ||
133  fErrorType == kCoordError ||
134  fErrorType == kAsymError );
135 
136  return fErrorType == kCoordError;
137  }
138 
139  /**
140  flag to control if data provides asymmetric errors on the value
141  */
142  bool HaveAsymErrors() const {
143  assert ( fErrorType == kNoError ||
144  fErrorType == kValueError ||
145  fErrorType == kCoordError ||
146  fErrorType == kAsymError );
147 
148  return fErrorType == kAsymError;
149  }
150 
151 
152  /**
153  apply a Log transformation of the data values
154  can be used for example when fitting an exponential or gaussian
155  Transform the data in place need to copy if want to preserve original data
156  The data sets must not contain negative values. IN case it does,
157  an empty data set is returned
158  */
159  BinData & LogTransform();
160 
161 
162  /**
163  add one dim data with only coordinate and values
164  */
165  void Add( double x, double y );
166 
167  /**
168  add one dim data with no error in the coordinate (x)
169  in this case store the inverse of the error in the value (y)
170  */
171  void Add( double x, double y, double ey );
172 
173  /**
174  add one dim data with error in the coordinate (x)
175  in this case store the value (y) error and not the inverse
176  */
177  void Add( double x, double y, double ex, double ey );
178 
179  /**
180  add one dim data with error in the coordinate (x) and asymmetric errors in the value (y)
181  in this case store the y errors and not the inverse
182  */
183  void Add( double x, double y, double ex, double eyl, double eyh );
184 
185  /**
186  add multi-dim coordinate data with only value
187  */
188  void Add( const double* x, double val );
189 
190  /**
191  add multi-dim coordinate data with only error in value
192  */
193  void Add( const double* x, double val, double eval );
194 
195  /**
196  add multi-dim coordinate data with both error in coordinates and value
197  */
198  void Add( const double* x, double val, const double* ex, double eval );
199 
200  /**
201  add multi-dim coordinate data with both error in coordinates and value
202  */
203  void Add( const double* x, double val, const double* ex, double elval, double ehval );
204 
205  /**
206  add the bin width data, a pointer to an array with the bin upper edge information.
207  This is needed when fitting with integral options
208  The information is added for the previously inserted point.
209  BinData::Add must be called before
210  */
211  void AddBinUpEdge( const double* xup );
212 
213  /**
214  return the value for the given fit point
215  */
216  double Value( unsigned int ipoint ) const
217  {
218  assert( ipoint < fMaxPoints );
219  assert( fDataPtr );
220  assert( fData.empty() || &fData.front() == fDataPtr );
221 
222  return fDataPtr[ipoint];
223  }
224 
225  /**
226  return a pointer to the value for the given fit point
227  */
228  const double *ValuePtr( unsigned int ipoint ) const
229  {
230  return &fDataPtr[ipoint];
231  }
232 
233  /**
234  return error on the value for the given fit point
235  Safe (but slower) method returning correctly the error on the value
236  in case of asymm errors return the average 0.5(eu + el)
237  */
238 
239  const double * ErrorPtr(unsigned int ipoint) const{
240  assert( ipoint < fMaxPoints );
241  assert( kValueError == fErrorType || kCoordError == fErrorType ||
243 
244  if ( fErrorType == kNoError )
245  return nullptr;
246  // assert( fErrorType == kCoordError );
247  return &fDataErrorPtr[ ipoint ];
248  }
249 
250  double Error( unsigned int ipoint ) const
251  {
252  assert( ipoint < fMaxPoints );
253  assert( kValueError == fErrorType || kCoordError == fErrorType ||
255 
256  if ( fErrorType == kNoError )
257  {
259  assert( fDataError.empty() && fDataErrorHigh.empty() && fDataErrorLow.empty() );
260  return 1.0;
261  }
262 
263  if ( fErrorType == kValueError ) // need to invert (inverror is stored)
264  {
266  assert( fDataErrorHigh.empty() && fDataErrorLow.empty() );
267  assert( fDataError.empty() || &fDataError.front() == fDataErrorPtr );
268 
269  double eval = fDataErrorPtr[ ipoint ];
270 
271  if (fWrapped)
272  return eval;
273  else
274  return (eval != 0.0) ? 1.0/eval : 0.0;
275  }
276 
277  if ( fErrorType == kAsymError )
278  { // return 1/2(el + eh)
280  assert( fDataError.empty() );
281  assert( fDataErrorHigh.empty() || &fDataErrorHigh.front() == fDataErrorHighPtr );
282  assert( fDataErrorLow.empty() || &fDataErrorLow.front() == fDataErrorLowPtr );
283  assert( fDataErrorLow.empty() == fDataErrorHigh.empty() );
284 
285  double eh = fDataErrorHighPtr[ ipoint ];
286  double el = fDataErrorLowPtr[ ipoint ];
287 
288  return (el+eh) / 2.0;
289  }
290 
291  assert( fErrorType == kCoordError );
292  return fDataErrorPtr[ ipoint ];
293  }
294 
295  void GetAsymError( unsigned int ipoint, double& lowError, double& highError ) const
296  {
297  assert( fErrorType == kAsymError );
299  assert( fDataError.empty() );
300  assert( fDataErrorHigh.empty() || &fDataErrorHigh.front() == fDataErrorHighPtr );
301  assert( fDataErrorLow.empty() || &fDataErrorLow.front() == fDataErrorLowPtr );
302  assert( fDataErrorLow.empty() == fDataErrorHigh.empty() );
303 
304  lowError = fDataErrorLowPtr[ ipoint ];
305  highError = fDataErrorHighPtr[ ipoint ];
306  }
307 
308  /**
309  Return the inverse of error on the value for the given fit point
310  useful when error in the coordinates are not stored and then this is used directly this as the weight in
311  the least square function
312  */
313  double InvError( unsigned int ipoint ) const
314  {
315  assert( ipoint < fMaxPoints );
316  assert( kValueError == fErrorType || kCoordError == fErrorType ||
318 
319  if ( fErrorType == kNoError )
320  {
322  assert( fDataError.empty() && fDataErrorHigh.empty() && fDataErrorLow.empty() );
323  return 1.0;
324  }
325 
326  if ( fErrorType == kValueError ) // need to invert (inverror is stored)
327  {
329  assert( fDataErrorHigh.empty() && fDataErrorLow.empty() );
330  assert( fDataError.empty() || &fDataError.front() == fDataErrorPtr );
331 
332  double eval = fDataErrorPtr[ ipoint ];
333 
334  // in case of wrapped data the pointer stores the error and
335  // not the inverse
336  if (fWrapped)
337  return 1.0 / eval;
338  else
339  return (eval != 0.0) ? eval : 0.0;
340  }
341 
342  if ( fErrorType == kAsymError ) {
343  // return inverse of 1/2(el + eh)
345  assert( fDataError.empty() );
346  assert( fDataErrorHigh.empty() || &fDataErrorHigh.front() == fDataErrorHighPtr );
347  assert( fDataErrorLow.empty() || &fDataErrorLow.front() == fDataErrorLowPtr );
348  assert( fDataErrorLow.empty() == fDataErrorHigh.empty() );
349 
350  double eh = fDataErrorHighPtr[ ipoint ];
351  double el = fDataErrorLowPtr[ ipoint ];
352 
353  return 2.0 / (el+eh);
354  }
355 
356  assert( fErrorType == kCoordError );
357  // for coordinate error we store the error and not the inverse
358  return 1.0 / fDataErrorPtr[ ipoint ];
359  }
360 
361 
362  /**
363  retrieve at the same time a pointer to the coordinate data and the fit value
364  More efficient than calling Coords(i) and Value(i)
365  */
366  // not threadsafe, to be replaced with never constructs!
367  // for example: just return std::array or std::vector, there's
368  // is going to be only minor overhead in c++11.
369  const double * GetPoint( unsigned int ipoint, double & value ) const
370  {
371  assert( ipoint < fMaxPoints );
372  value = Value( ipoint );
373 
374  return Coords( ipoint );
375  }
376 
377  /**
378  returns a single coordinate error component of a point.
379  This function is threadsafe in contrast to Coords(...)
380  and can easily get vectorized by the compiler in loops
381  running over the ipoint-index.
382  */
383  double GetCoordErrorComponent( unsigned int ipoint, unsigned int icoord ) const
384  {
385  assert( ipoint < fMaxPoints );
386  assert( icoord < fDim );
387  assert( fCoordErrorsPtr.size() == fDim );
388  assert( fCoordErrorsPtr[icoord] );
389  assert( fCoordErrors.empty() || &fCoordErrors[icoord].front() == fCoordErrorsPtr[icoord] );
390 
391  return fCoordErrorsPtr[icoord][ipoint];
392  }
393 
394  /**
395  Return a pointer to the errors in the coordinates for the given fit point
396  */
397  // not threadsafe, to be replaced with never constructs!
398  // for example: just return std::array or std::vector, there's
399  // is going to be only minor overhead in c++11.
400  const double* CoordErrors( unsigned int ipoint ) const
401  {
402  assert( ipoint < fMaxPoints );
403  assert( fpTmpCoordErrorVector );
404  assert( fErrorType == kCoordError || fErrorType == kAsymError );
405 
406  for ( unsigned int i=0; i < fDim; i++ )
407  {
408  assert( fCoordErrorsPtr[i] );
409  assert( fCoordErrors.empty() || &fCoordErrors[i].front() == fCoordErrorsPtr[i] );
410 
411  fpTmpCoordErrorVector[i] = fCoordErrorsPtr[i][ipoint];
412  }
413 
414  return fpTmpCoordErrorVector;
415  }
416 
417 
418  /**
419  retrieve in a single call a pointer to the coordinate data, value and inverse error for
420  the given fit point.
421  To be used only when type is kValueError or kNoError. In the last case the value 1 is returned
422  for the error.
423  */
424  // not threadsafe, to be replaced with never constructs!
425  // for example: just return std::array or std::vector, there's
426  // is going to be only minor overhead in c++11.
427  const double* GetPoint( unsigned int ipoint, double & value, double & invError ) const
428  {
429  assert( ipoint < fMaxPoints );
430  assert( fErrorType == kNoError || fErrorType == kValueError );
431 
432  double e = Error( ipoint );
433 
434  if (fWrapped)
435  invError = e;
436  else
437  invError = ( e != 0.0 ) ? 1.0/e : 1.0;
438 
439  return GetPoint( ipoint, value );
440  }
441 
442  /**
443  Retrieve the errors on the point (coordinate and value) for the given fit point
444  It must be called only when the coordinate errors are stored otherwise it will produce an
445  assert.
446  */
447  // not threadsafe, to be replaced with never constructs!
448  // for example: just return std::array or std::vector, there's
449  // is going to be only minor overhead in c++11.
450  const double* GetPointError(unsigned int ipoint, double & errvalue) const
451  {
452  assert( ipoint < fMaxPoints );
453  assert( fErrorType == kCoordError || fErrorType == kAsymError );
454 
455  errvalue = Error( ipoint );
456  return CoordErrors( ipoint );
457  }
458 
459  /**
460  Get errors on the point (coordinate errors and asymmetric value errors) for the
461  given fit point.
462  It must be called only when the coordinate errors and asymmetric errors are stored
463  otherwise it will produce an assert.
464  */
465  // not threadsafe, to be replaced with never constructs!
466  // for example: just return std::array or std::vector, there's
467  // is going to be only minor overhead in c++11.
468  const double* GetPointError(unsigned int ipoint, double & errlow, double & errhigh) const
469  {
470  assert( ipoint < fMaxPoints );
471  assert( fErrorType == kAsymError );
473  assert( fDataError.empty() );
474  assert( fDataErrorHigh.empty() || &fDataErrorHigh.front() == fDataErrorHighPtr );
475  assert( fDataErrorLow.empty() || &fDataErrorLow.front() == fDataErrorLowPtr );
476  assert( fDataErrorLow.empty() == fDataErrorHigh.empty() );
477 
478  errhigh = fDataErrorHighPtr[ ipoint ];
479  errlow = fDataErrorLowPtr[ ipoint ];
480 
481  return CoordErrors( ipoint );
482  }
483 
484  /**
485  returns a single coordinate error component of a point.
486  This function is threadsafe in contrast to Coords(...)
487  and can easily get vectorized by the compiler in loops
488  running over the ipoint-index.
489  */
490  double GetBinUpEdgeComponent( unsigned int ipoint, unsigned int icoord ) const
491  {
492  assert( icoord < fDim );
493  assert( !fBinEdge.empty() );
494  assert( ipoint < fBinEdge.front().size() );
495 
496  return fBinEdge[icoord][ipoint];
497  }
498 
499  /**
500  return an array containing the upper edge of the bin for coordinate i
501  In case of empty bin they could be merged in a single larger bin
502  Return a NULL pointer if the bin width is not stored
503  */
504  // not threadsafe, to be replaced with never constructs!
505  // for example: just return std::array or std::vector, there's
506  // is going to be only minor overhead in c++11.
507  const double* BinUpEdge( unsigned int ipoint ) const
508  {
509  if ( fBinEdge.empty() || ipoint > fBinEdge.front().size() )
510  return nullptr;
511 
513 
514  return fpTmpBinEdgeVector;
515  }
516 
517  /**
518  * Thread save version of function retrieving the bin up-edge in case of multidimensions
519  */
520  void GetBinUpEdgeCoordinates(unsigned int ipoint, double * x) const
521  {
522  if (fBinEdge.empty() || ipoint > fBinEdge.front().size()) return;
523  assert(!fBinEdge.empty());
524  assert(ipoint < fMaxPoints);
525  for (unsigned int i = 0; i < fDim; i++) {
526  x[i] = fBinEdge[i][ipoint];
527  }
528  }
529 
530  /**
531  query if the data store the bin edges instead of the center
532  */
533  bool HasBinEdges() const {
534  return fBinEdge.size() == fDim && fBinEdge[0].size() > 0;
535  }
536 
537  /**
538  retrieve the reference volume used to normalize the data when the option bin volume is set
539  */
540  double RefVolume() const { return fRefVolume; }
541 
542  /**
543  set the reference volume used to normalize the data when the option bin volume is set
544  */
545  void SetRefVolume(double value) { fRefVolume = value; }
546 
547  /**
548  retrieve the errortype
549  */
551  {
552  return fErrorType;
553  }
554 
555  /**
556  compute the total sum of the data content
557  (sum of weights in case of weighted data set)
558  */
559  double SumOfContent() const { return fSumContent; }
560 
561  /**
562  compute the total sum of the error square
563  (sum of weight square in case of a weighted data set)
564  */
565  double SumOfError2() const { return fSumError2;}
566 
567  /**
568  return true if the data set is weighted
569  We cannot compute ourselfs because sometimes errors are filled with 1
570  instead of zero (as in ROOT::Fit::FillData )
571  */
572  bool IsWeighted() const {
573  return fIsWeighted;
574  }
575 
576 protected:
577  void InitDataVector ();
578 
579  void InitializeErrors();
580 
581  void InitBinEdge();
582 
583  void UnWrap( );
584 
585  // compute sum of content and error squares
586  void ComputeSums();
587 
588 private:
589 
591  bool fIsWeighted = false; // flag to indicate weighted data
592  double fRefVolume; // reference bin volume - used to normalize the bins in case of variable bins data
593  double fSumContent = 0; // total sum of the bin data content
594  double fSumError2 = 0; // total sum square of the errors
595 
596  /**
597  * Stores the data values the same way as the coordinates.
598  *
599  */
600  std::vector< double > fData;
601  const double* fDataPtr;
602 
603  std::vector< std::vector< double > > fCoordErrors;
604  std::vector< const double* > fCoordErrorsPtr;
605  // This vector contains the coordinate errors
606  // in the same way as fCoords.
607 
608  std::vector< double > fDataError;
609  std::vector< double > fDataErrorHigh;
610  std::vector< double > fDataErrorLow;
611  const double* fDataErrorPtr;
612  const double* fDataErrorHighPtr;
613  const double* fDataErrorLowPtr;
614  // This vector contains the data error.
615  // Either only fDataError or fDataErrorHigh and fDataErrorLow are used.
616 
617  double* fpTmpCoordErrorVector; // not threadsafe stuff!
618 
619  std::vector< std::vector< double > > fBinEdge;
620  // vector containing the bin upper edge (coordinate will contain low edge)
621 
622  double* fpTmpBinEdgeVector; // not threadsafe stuff!
623 };
624 
625 
626  } // end namespace Fit
627 
628 } // end namespace ROOT
629 
630 
631 
632 #endif /* ROOT_Fit_BinData */
ROOT::Fit::FitData
Base class for all the fit data types: Stores the coordinates and the DataOptions.
Definition: FitData.h:66
ex
Double_t ex[n]
Definition: legend1.C:17
n
const Int_t n
Definition: legend1.C:16
ROOT::Fit::BinData::kCoordError
@ kCoordError
Definition: BinData.h:56
ROOT::Fit::BinData::CoordErrors
const double * CoordErrors(unsigned int ipoint) const
Return a pointer to the errors in the coordinates for the given fit point.
Definition: BinData.h:400
e
#define e(i)
Definition: RSha256.hxx:103
ROOT::Fit::FitData::fWrapped
bool fWrapped
Definition: FitData.h:386
HFit::Fit
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Definition: HFitImpl.cxx:133
ROOT::Fit::DataOptions
DataOptions : simple structure holding the options on how the data are filled.
Definition: DataOptions.h:28
ROOT::Fit::BinData::HaveCoordErrors
bool HaveCoordErrors() const
flag to control if data provides error on the coordinates
Definition: BinData.h:130
ROOT::Fit::BinData::Append
void Append(unsigned int newPoints, unsigned int dim=1, ErrorType err=kValueError)
preallocate a data set with given size , dimension and error type (to get the full point size) If the...
Definition: BinData.cxx:328
ROOT::Fit::BinData::GetAsymError
void GetAsymError(unsigned int ipoint, double &lowError, double &highError) const
Definition: BinData.h:295
ROOT::Fit::BinData
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
Definition: BinData.h:52
ROOT::Fit::BinData::GetPointError
const double * GetPointError(unsigned int ipoint, double &errvalue) const
Retrieve the errors on the point (coordinate and value) for the given fit point It must be called onl...
Definition: BinData.h:450
ROOT::Fit::BinData::fBinEdge
std::vector< std::vector< double > > fBinEdge
Definition: BinData.h:619
ROOT::Fit::BinData::fpTmpBinEdgeVector
double * fpTmpBinEdgeVector
Definition: BinData.h:622
ROOT::Fit::BinData::GetPoint
const double * GetPoint(unsigned int ipoint, double &value) const
retrieve at the same time a pointer to the coordinate data and the fit value More efficient than call...
Definition: BinData.h:369
ROOT::Fit::BinData::fSumError2
double fSumError2
Definition: BinData.h:594
ROOT::Fit::BinData::UnWrap
void UnWrap()
Definition: BinData.cxx:757
ROOT::Fit::BinData::kValueError
@ kValueError
Definition: BinData.h:56
x
Double_t x[n]
Definition: legend1.C:17
ROOT::Fit::BinData::GetPointError
const double * GetPointError(unsigned int ipoint, double &errlow, double &errhigh) const
Get errors on the point (coordinate errors and asymmetric value errors) for the given fit point.
Definition: BinData.h:468
ROOT::Fit::BinData::fDataErrorPtr
const double * fDataErrorPtr
Definition: BinData.h:611
ROOT::Fit::BinData::InitDataVector
void InitDataVector()
Definition: BinData.cxx:659
ROOT::Fit::BinData::Error
double Error(unsigned int ipoint) const
Definition: BinData.h:250
ROOT::Fit::BinData::Initialize
void Initialize(unsigned int newPoints, unsigned int dim=1, ErrorType err=kValueError)
Definition: BinData.cxx:349
ROOT::Fit::BinData::fDataPtr
const double * fDataPtr
Definition: BinData.h:601
ROOT::Fit::BinData::fpTmpCoordErrorVector
double * fpTmpCoordErrorVector
Definition: BinData.h:617
ROOT::Fit::BinData::SumOfError2
double SumOfError2() const
compute the total sum of the error square (sum of weight square in case of a weighted data set)
Definition: BinData.h:565
ROOT::Fit::FitData::Coords
const double * Coords(unsigned int ipoint) const
return a pointer to the coordinates data for the given fit point
Definition: FitData.h:246
ROOT::Fit::BinData::fCoordErrorsPtr
std::vector< const double * > fCoordErrorsPtr
Definition: BinData.h:604
ROOT::Fit::BinData::fDataErrorHighPtr
const double * fDataErrorHighPtr
Definition: BinData.h:612
ROOT::Fit::BinData::kNoError
@ kNoError
Definition: BinData.h:56
ROOT::Fit::BinData::ValuePtr
const double * ValuePtr(unsigned int ipoint) const
return a pointer to the value for the given fit point
Definition: BinData.h:228
ROOT::Fit::BinData::ErrorPtr
const double * ErrorPtr(unsigned int ipoint) const
return error on the value for the given fit point Safe (but slower) method returning correctly the er...
Definition: BinData.h:239
ROOT::Fit::BinData::fErrorType
ErrorType fErrorType
Definition: BinData.h:590
ROOT::Fit::BinData::Value
double Value(unsigned int ipoint) const
return the value for the given fit point
Definition: BinData.h:216
ROOT::Fit::BinData::InitializeErrors
void InitializeErrors()
Definition: BinData.cxx:665
ROOT::Fit::BinData::SumOfContent
double SumOfContent() const
compute the total sum of the data content (sum of weights in case of weighted data set)
Definition: BinData.h:559
Error.h
ROOT::Fit::BinData::fData
std::vector< double > fData
Stores the data values the same way as the coordinates.
Definition: BinData.h:600
ROOT::Fit::BinData::InvError
double InvError(unsigned int ipoint) const
Return the inverse of error on the value for the given fit point useful when error in the coordinates...
Definition: BinData.h:313
ROOT::Fit::BinData::fDataError
std::vector< double > fDataError
Definition: BinData.h:608
ROOT::Fit::BinData::BinData
BinData(unsigned int maxpoints=0, unsigned int dim=1, ErrorType err=kValueError)
constructor from dimension of point and max number of points (to pre-allocate vector) Give a zero val...
Definition: BinData.cxx:26
ROOT::Fit::BinData::fIsWeighted
bool fIsWeighted
Definition: BinData.h:591
ROOT::Fit::BinData::fDataErrorHigh
std::vector< double > fDataErrorHigh
Definition: BinData.h:609
ROOT::Fit::DataRange
class describing the range in the coordinates it supports multiple range in a coordinate.
Definition: DataRange.h:35
ROOT::Fit::BinData::GetPoint
const double * GetPoint(unsigned int ipoint, double &value, double &invError) const
retrieve in a single call a pointer to the coordinate data, value and inverse error for the given fit...
Definition: BinData.h:427
ROOT::Fit::BinData::HaveAsymErrors
bool HaveAsymErrors() const
flag to control if data provides asymmetric errors on the value
Definition: BinData.h:142
ROOT::Fit::BinData::fRefVolume
double fRefVolume
Definition: BinData.h:592
ROOT::Fit::BinData::AddBinUpEdge
void AddBinUpEdge(const double *xup)
add the bin width data, a pointer to an array with the bin upper edge information.
Definition: BinData.cxx:627
y
Double_t y[n]
Definition: legend1.C:17
ROOT::Fit::BinData::RefVolume
double RefVolume() const
retrieve the reference volume used to normalize the data when the option bin volume is set
Definition: BinData.h:540
ey
Double_t ey[n]
Definition: legend1.C:17
ROOT::Fit::BinData::fSumContent
double fSumContent
Definition: BinData.h:593
ROOT::Fit::FitData::fMaxPoints
unsigned int fMaxPoints
Definition: FitData.h:394
ROOT::Fit::BinData::ComputeSums
void ComputeSums()
Definition: BinData.cxx:828
ROOT::Fit::BinData::GetCoordErrorComponent
double GetCoordErrorComponent(unsigned int ipoint, unsigned int icoord) const
returns a single coordinate error component of a point.
Definition: BinData.h:383
ROOT::Fit::BinData::~BinData
virtual ~BinData()
destructor
Definition: BinData.cxx:190
ROOT::Fit::BinData::InitBinEdge
void InitBinEdge()
Definition: BinData.cxx:739
ROOT::Fit::BinData::GetBinUpEdgeCoordinates
void GetBinUpEdgeCoordinates(unsigned int ipoint, double *x) const
Thread save version of function retrieving the bin up-edge in case of multidimensions.
Definition: BinData.h:520
ROOT::Fit::BinData::GetErrorType
ErrorType GetErrorType() const
retrieve the errortype
Definition: BinData.h:550
ROOT::Fit::BinData::fDataErrorLow
std::vector< double > fDataErrorLow
Definition: BinData.h:610
ROOT::Fit::BinData::fCoordErrors
std::vector< std::vector< double > > fCoordErrors
Definition: BinData.h:603
ROOT::Fit::BinData::GetBinUpEdgeComponent
double GetBinUpEdgeComponent(unsigned int ipoint, unsigned int icoord) const
returns a single coordinate error component of a point.
Definition: BinData.h:490
FitData.h
ROOT::Fit::BinData::operator=
BinData & operator=(const BinData &rhs)
Definition: BinData.cxx:229
ROOT::Fit::BinData::fDataErrorLowPtr
const double * fDataErrorLowPtr
Definition: BinData.h:613
ROOT::Fit::BinData::IsWeighted
bool IsWeighted() const
return true if the data set is weighted We cannot compute ourselfs because sometimes errors are fille...
Definition: BinData.h:572
ROOT::Fit::BinData::Add
void Add(double x, double y)
add one dim data with only coordinate and values
Definition: BinData.cxx:422
ROOT::Fit::BinData::BinUpEdge
const double * BinUpEdge(unsigned int ipoint) const
return an array containing the upper edge of the bin for coordinate i In case of empty bin they could...
Definition: BinData.h:507
ROOT::Fit::BinData::LogTransform
BinData & LogTransform()
apply a Log transformation of the data values can be used for example when fitting an exponential or ...
Definition: BinData.cxx:363
ROOT::Fit::BinData::HasBinEdges
bool HasBinEdges() const
query if the data store the bin edges instead of the center
Definition: BinData.h:533
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::Fit::FitData::fDim
unsigned int fDim
Definition: FitData.h:396
ROOT::Fit::BinData::kAsymError
@ kAsymError
Definition: BinData.h:56
ROOT::Fit::BinData::SetRefVolume
void SetRefVolume(double value)
set the reference volume used to normalize the data when the option bin volume is set
Definition: BinData.h:545
ROOT::Fit::BinData::ErrorType
ErrorType
Definition: BinData.h:56