Logo ROOT   6.10/09
Reference Guide
BinData.cxx
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Author: M. Borinsky
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 
11 // Implementation file for class BinData
12 
13 #include "Fit/BinData.h"
14 #include "Math/Error.h"
15 
16 #include <cassert>
17 #include <cmath>
18 
19 using namespace std;
20 
21 namespace ROOT {
22 
23  namespace Fit
24  {
25 
26  BinData::BinData(unsigned int maxpoints, unsigned int dim,
27  ErrorType err ) :
28  FitData( maxpoints, dim ),
29  fErrorType( err ),
30  fDataPtr( NULL ),
31  fDataErrorPtr( NULL ), fDataErrorHighPtr( NULL ), fDataErrorLowPtr( NULL ),
32  fpTmpCoordErrorVector( NULL ), fpTmpBinEdgeVector( NULL )
33  {
35  InitDataVector( );
36  }
37 
38 
39  /**
40  constructor from option and default range
41  */
42  BinData::BinData (const DataOptions & opt, unsigned int maxpoints,
43  unsigned int dim, ErrorType err ) :
44  FitData( opt, maxpoints, dim ),
45  fErrorType( err ),
46  fDataPtr( NULL ),
49  {
51  InitDataVector( );
52  }
53 
54  /**
55  constructor from options and range
56  efault is 1D and value errors
57  */
58  BinData::BinData (const DataOptions & opt, const DataRange & range,
59  unsigned int maxpoints, unsigned int dim, ErrorType err ) :
60  FitData( opt, range, maxpoints, dim ),
61  fErrorType( err ),
62  fDataPtr( NULL ),
65  {
67  InitDataVector( );
68  }
69 
70  /** constructurs using external data */
71 
72  /**
73  constructor from external data for 1D with errors on coordinate and value
74  */
75  BinData::BinData (unsigned int n, const double * dataX, const double * val,
76  const double * ex , const double * eval ) :
77  FitData( n, dataX ),
78  fDataPtr( NULL ),
81  {
82  assert( val );
83  fDataPtr = val;
84 
85  if ( NULL != eval )
86  {
87  fDataErrorPtr = eval;
88 
90 
91  if ( NULL != ex )
92  {
93  fCoordErrorsPtr.resize( 1 );
94 
95  fCoordErrorsPtr[0] = ex;
96 
98  }
99  }
100  else
101  {
103  }
104 
105  fpTmpCoordErrorVector = new double [ fDim ];
106  }
107 
108  /**
109  constructor from external data for 2D with errors on coordinate and value
110  */
111  BinData::BinData(unsigned int n, const double * dataX, const double * dataY,
112  const double * val, const double * ex , const double * ey,
113  const double * eval ) :
114  FitData( n, dataX, dataY ),
117  {
118  assert( val );
119  fDataPtr = val;
120 
121  if ( NULL != eval )
122  {
123  fDataErrorPtr = eval;
124 
126 
127  if ( NULL != ex || NULL != ey )
128  {
129  fCoordErrorsPtr.resize( 2 );
130 
131  fCoordErrorsPtr[0] = ex;
132  fCoordErrorsPtr[1] = ey;
133 
135  }
136  }
137  else
138  {
140  }
141 
142  fpTmpCoordErrorVector = new double [ fDim ];
143  }
144 
145  /**
146  constructor from external data for 3D with errors on coordinate and value
147  */
148  BinData::BinData(unsigned int n, const double * dataX, const double * dataY,
149  const double * dataZ, const double * val, const double * ex ,
150  const double * ey , const double * ez , const double * eval ) :
151  FitData( n, dataX, dataY, dataZ ),
154  {
155  assert( val );
156  fDataPtr = val;
157 
158  if ( NULL != eval )
159  {
160  fDataErrorPtr = eval;
161 
163 
164  if ( NULL != ex || NULL != ey || NULL != ez )
165  {
166  fCoordErrorsPtr.resize( 3 );
167 
168  fCoordErrorsPtr[0] = ex;
169  fCoordErrorsPtr[1] = ey;
170  fCoordErrorsPtr[2] = ez;
171 
173  }
174  }
175  else
176  {
178  }
179 
180  fpTmpCoordErrorVector = new double [ fDim ];
181  }
182 
183  /**
184  destructor
185  */
187  {
188  assert( fMaxPoints == 0 || fWrapped == fData.empty() );
189 
190  assert( kValueError == fErrorType || kCoordError == fErrorType ||
192  assert( fMaxPoints == 0 || fDataError.empty() || &fDataError.front() == fDataErrorPtr );
193  assert( fMaxPoints == 0 || fDataErrorHigh.empty() || &fDataErrorHigh.front() == fDataErrorHighPtr );
194  assert( fMaxPoints == 0 || fDataErrorLow.empty() || &fDataErrorLow.front() == fDataErrorLowPtr );
195  assert( fMaxPoints == 0 || fDataErrorLow.empty() == fDataErrorHigh.empty() );
196  assert( fMaxPoints == 0 || fData.empty() || &fData.front() == fDataPtr );
197 
198  for ( unsigned int i=0; i < fDim; i++ )
199  {
200  assert( fCoordErrors.empty() || &fCoordErrors[i].front() == fCoordErrorsPtr[i] );
201  }
202 
203  if ( fpTmpBinEdgeVector )
204  {
205  delete[] fpTmpBinEdgeVector;
207  }
208 
209  if ( fpTmpCoordErrorVector )
210  {
211  delete[] fpTmpCoordErrorVector;
213  }
214  }
215 
216  /**
217  copy constructors
218  */
219  BinData::BinData (const BinData & rhs) :
220  FitData()
221  {
222  *this = rhs;
223  }
224 
226  {
227  FitData::operator=( rhs );
228 
229  if ( fpTmpBinEdgeVector )
230  {
231  assert( Opt().fIntegral );
232 
233  delete[] fpTmpBinEdgeVector;
235  }
236 
237  if ( fpTmpCoordErrorVector )
238  {
239  delete[] fpTmpCoordErrorVector;
241  }
242 
243  fDataPtr = NULL;
245 
246  fErrorType = rhs.fErrorType;
247  fRefVolume = rhs.fRefVolume;
248  fBinEdge = rhs.fBinEdge;
249 
250  if ( fWrapped )
251  {
252  fData.clear();
253  fCoordErrors.clear();
254  fDataError.clear();
255  fDataErrorHigh.clear();
256  fDataErrorLow.clear();
257 
258  fDataPtr = rhs.fDataPtr;
263  }
264  else
265  {
266  fData = rhs.fData;
267 
268  if ( !fData.empty() )
269  fDataPtr = &fData.front();
270 
272  fDataError = rhs.fDataError;
275 
276  if( ! fCoordErrors.empty() )
277  {
278  assert( kCoordError == fErrorType || kAsymError == fErrorType );
279  fCoordErrorsPtr.resize( fDim );
280 
281  for ( unsigned int i=0; i<fDim; i++ )
282  {
283  fCoordErrorsPtr[i] = &fCoordErrors[i].front();
284  }
285  }
286 
287  fDataError = rhs.fDataError;
290 
291  assert( fDataErrorLow.empty() == fDataErrorHigh.empty() );
292  assert( fDataErrorLow.empty() != fDataError.empty() || kNoError == fErrorType );
293 
294  if ( !fDataError.empty() )
295  {
296  assert( kValueError == fErrorType || kCoordError == fErrorType );
297  fDataErrorPtr = &fDataError.front();
298  }
299  else if ( !fDataErrorHigh.empty() && !fDataErrorLow.empty() )
300  {
301  assert( kAsymError == fErrorType );
303  fDataErrorLowPtr = &fDataErrorLow.front();
304  }
305  }
306 
307  fpTmpCoordErrorVector= new double[ fDim ];
308 
309  if ( Opt().fIntegral )
310  fpTmpBinEdgeVector = new double[ fDim ];
311 
312  return *this;
313  }
314 
315 
316  /**
317  preallocate a data set with given size , dimension and error type (to get the full point size)
318  If the data set already exists and it is having the compatible point size space for the new points
319  is created in the data sets, while if not compatible the old data are erased and new space of
320  new size is allocated.
321  (i.e if exists initialize is equivalent to a resize( NPoints() + maxpoints)
322  */
323 
324  void BinData::Append( unsigned int newPoints, unsigned int dim , ErrorType err )
325  {
326  assert( !fWrapped );
327  assert( fMaxPoints == 0 || fWrapped == fData.empty() );
328 
329  assert( kValueError == fErrorType || kCoordError == fErrorType ||
331  assert( fMaxPoints == 0 || fDataError.empty() || &fDataError.front() == fDataErrorPtr );
332  assert( fMaxPoints == 0 || fDataErrorHigh.empty() || &fDataErrorHigh.front() == fDataErrorHighPtr );
333  assert( fMaxPoints == 0 || fDataErrorLow.empty() || &fDataErrorLow.front() == fDataErrorLowPtr );
334  assert( fMaxPoints == 0 || fDataErrorLow.empty() == fDataErrorHigh.empty() );
335  assert( fMaxPoints == 0 || fData.empty() || &fData.front() == fDataPtr );
336 
337  FitData::Append( newPoints, dim );
338 
339  fErrorType = err;
340 
341  InitDataVector( );
342  InitializeErrors( );
343  }
344 
345  void BinData::Initialize( unsigned int newPoints, unsigned int dim, ErrorType err )
346  {
347  Append( newPoints, dim, err );
348  }
349 
350 
351 
352  /**
353  apply a Log transformation of the data values
354  can be used for example when fitting an exponential or gaussian
355  Transform the data in place need to copy if want to preserve original data
356  The data sets must not contain negative values. IN case it does,
357  an empty data set is returned
358  */
360  { // apply log transform on the bin data values
361 
362  if ( fWrapped )
363  {
364  UnWrap();
365  }
366 
367  if ( kNoError == fErrorType )
368  {
369  fDataError.resize( fNPoints );
370  fDataErrorPtr = &fDataError.front();
371  }
372 
373  for ( unsigned int i=0; i < fNPoints; i++ )
374  {
375  double val = fData[i];
376 
377  if ( val <= 0 )
378  {
379  MATH_ERROR_MSG("BinData::TransformLog","Some points have negative values - cannot apply a log transformation");
380  return *this;
381  }
382 
383  fData[i] = std::log( val );
384 
385  if( kNoError == fErrorType )
386  {
387  fDataError[i] = val;
388  }
389  else if ( kValueError == fErrorType )
390  {
391  fDataError[i]*= val;
392  }
393  else if ( kCoordError == fErrorType )
394  {
395  fDataError[i]/= val;
396  }
397  else if ( kAsymError == fErrorType )
398  {
399  fDataErrorHigh[i]/= val;
400  fDataErrorLow[i]/= val;
401  }
402  else
403  assert(false);
404  }
405 
406  if ( kNoError == fErrorType )
407  {
409  }
410 
411  return *this;
412  }
413 
414 
415  /**
416  add one dim data with only coordinate and values
417  */
418  void BinData::Add( double x, double y )
419  {
420  assert( kNoError == fErrorType );
421 
422  assert( !fData.empty() && fDataPtr );
423  assert( fDataErrorHigh.empty() && !fDataErrorHighPtr );
424  assert( fDataErrorLow.empty() && !fDataErrorLowPtr );
425  assert( fDataError.empty() && !fDataErrorPtr );
426  assert( fCoordErrors.empty() && fCoordErrorsPtr.empty() );
427 
428  fData[ fNPoints ] = y;
429 
430  FitData::Add( x );
431  }
432 
433  /**
434  add one dim data with no error in the coordinate (x)
435  in this case store the inverse of the error in the value (y)
436  */
437  void BinData::Add( double x, double y, double ey )
438  {
439  assert( kValueError == fErrorType );
440  assert( !fData.empty() && fDataPtr );
441  assert( fDataErrorHigh.empty() && !fDataErrorHighPtr );
442  assert( fDataErrorLow.empty() && !fDataErrorLowPtr );
443  assert( !fDataError.empty() && fDataErrorPtr );
444  assert( fCoordErrors.empty() && fCoordErrorsPtr.empty() );
445 
446  fData[ fNPoints ] = y;
447  fDataError[ fNPoints ] = (ey != 0.0) ? 1.0/ey : 0.0;
448 
449  FitData::Add( x );
450  }
451 
452  /**
453  add one dim data with error in the coordinate (x)
454  in this case store the value (y) error and not the inverse
455  */
456  void BinData::Add( double x, double y, double ex, double ey )
457  {
458  assert( kCoordError == fErrorType );
459  assert( !fData.empty() && fDataPtr );
460  assert( !fDataError.empty() && fDataErrorPtr );
461  assert( fDataErrorHigh.empty() && !fDataErrorHighPtr );
462  assert( fDataErrorLow.empty() && !fDataErrorLowPtr );
463  assert( !fCoordErrors.empty() && fCoordErrors.size() == 1 );
464  assert( !fCoordErrorsPtr.empty() && fCoordErrorsPtr.size() == 1 && fCoordErrorsPtr[0] );
465  assert( &fCoordErrors[0].front() == fCoordErrorsPtr[0] );
466 
467  fData[ fNPoints ] = y;
468  fCoordErrors[0][ fNPoints ] = ex;
469  fDataError[ fNPoints ] = ey;
470 
471  FitData::Add( x );
472  }
473 
474  /**
475  add one dim data with error in the coordinate (x) and asymmetric errors in the value (y)
476  in this case store the y errors and not the inverse
477  */
478  void BinData::Add( double x, double y, double ex, double eyl, double eyh )
479  {
480  assert( kAsymError == fErrorType );
481  assert( !fData.empty() && fDataPtr );
482  assert( !fDataErrorHigh.empty() && fDataErrorHighPtr );
483  assert( !fDataErrorLow.empty() && fDataErrorLowPtr );
484  assert( fDataError.empty() && !fDataErrorPtr );
485  assert( !fCoordErrors.empty() && fCoordErrors.size() == 1 );
486  assert( !fCoordErrorsPtr.empty() && fCoordErrorsPtr.size() == 1 && fCoordErrorsPtr[0] );
487  assert( &fCoordErrors[0].front() == fCoordErrorsPtr[0] );
488 
489  fData[ fNPoints ] = y;
490  fCoordErrors[0][ fNPoints ] = ex;
491  fDataErrorHigh[ fNPoints ] = eyh;
492  fDataErrorLow[ fNPoints ] = eyl;
493 
494  FitData::Add( x );
495  }
496 
497  /**
498  add multi-dim coordinate data with only value
499  */
500  void BinData::Add( const double* x, double val )
501  {
502  assert( kNoError == fErrorType );
503 
504  assert( !fData.empty() && fDataPtr );
505  assert( fDataErrorHigh.empty() && !fDataErrorHighPtr );
506  assert( fDataErrorLow.empty() && !fDataErrorLowPtr );
507  assert( fDataError.empty() && !fDataErrorPtr );
508  assert( fCoordErrors.empty() && fCoordErrorsPtr.empty() );
509 
510  fData[ fNPoints ] = val;
511 
512  FitData::Add( x );
513  }
514 
515  /**
516  add multi-dim coordinate data with only error in value
517  */
518  void BinData::Add( const double* x, double val, double eval )
519  {
520  assert( kValueError == fErrorType );
521  assert( !fData.empty() && fDataPtr );
522  assert( fDataErrorHigh.empty() && !fDataErrorHighPtr );
523  assert( fDataErrorLow.empty() && !fDataErrorLowPtr );
524  assert( !fDataError.empty() && fDataErrorPtr );
525  assert( fCoordErrors.empty() && fCoordErrorsPtr.empty() );
526 
527  fData[ fNPoints ] = val;
528  fDataError[ fNPoints ] = (eval != 0.0) ? 1.0/eval : 0.0;
529 
530  FitData::Add( x );
531  }
532 
533  /**
534  add multi-dim coordinate data with both error in coordinates and value
535  */
536  void BinData::Add( const double* x, double val, const double* ex, double eval )
537  {
538  assert( kCoordError == fErrorType );
539  assert( !fData.empty() && fDataPtr );
540  assert( !fDataError.empty() && fDataErrorPtr );
541  assert( fDataErrorHigh.empty() && !fDataErrorHighPtr );
542  assert( fDataErrorLow.empty() && !fDataErrorLowPtr );
543  assert( fCoordErrors.size() == fDim );
544  assert( fCoordErrorsPtr.size() == fDim );
545 
546  fData[ fNPoints ] = val;
547 
548  for( unsigned int i=0; i<fDim; i++ )
549  {
550  assert( &fCoordErrors[i].front() == fCoordErrorsPtr[i] );
551 
552  fCoordErrors[i][ fNPoints ] = ex[i];
553  }
554 
555  fDataError[ fNPoints ] = eval;
556 
557  FitData::Add( x );
558  }
559 
560  /**
561  add multi-dim coordinate data with both error in coordinates and value
562  */
563  void BinData::Add( const double* x, double val, const double* ex, double elval, double ehval )
564  {
565  assert( kAsymError == fErrorType );
566 
567  assert( !fData.empty() && fDataPtr );
568  assert( !fDataErrorHigh.empty() && fDataErrorHighPtr );
569  assert( !fDataErrorLow.empty() && fDataErrorLowPtr );
570  assert( fDataError.empty() && !fDataErrorPtr );
571  assert( fCoordErrors.size() == fDim );
572  assert( fCoordErrorsPtr.size() == fDim );
573 
574  fData[ fNPoints ] = val;
575 
576  for( unsigned int i=0; i<fDim; i++ )
577  {
578  assert( &fCoordErrors[i].front() == fCoordErrorsPtr[i] );
579 
580  fCoordErrors[i][ fNPoints ] = ex[i];
581  }
582 
583  fDataErrorLow[ fNPoints ] = elval;
584  fDataErrorHigh[ fNPoints ] = ehval;
585 
586  FitData::Add( x );
587  }
588 
589 
590  /**
591  add the bin width data, a pointer to an array with the bin upper edge information.
592  This is needed when fitting with integral options
593  The information is added for the previously inserted point.
594  BinData::Add must be called before
595  */
596  void BinData::AddBinUpEdge( const double* xup )
597  {
598  if ( fBinEdge.empty() )
599  InitBinEdge();
600 
601  assert( fBinEdge.size() == fDim );
602 
603  for ( unsigned int i=0; i<fDim; i++ )
604  {
605  fBinEdge[i].push_back( xup[i] );
606 
607  // check that is consistent with number of points added in the data
608  assert( fNPoints == fBinEdge[i].size() );
609  }
610 
611  // compute the bin volume
612  const double* xlow = Coords( fNPoints-1 );
613 
614  double binVolume = 1.0;
615  for ( unsigned int j = 0; j < fDim; j++ )
616  {
617  binVolume *= ( xup[j] - xlow[j] );
618  }
619 
620  // store the minimum bin volume found as reference for future normalizations
621  if ( fNPoints == 1 )
622  fRefVolume = binVolume;
623  else if ( binVolume < fRefVolume )
624  fRefVolume = binVolume;
625  }
626 
627 
629  {
630  fData.resize( fMaxPoints );
631  fDataPtr = &fData.front();
632  }
633 
635  {
636  assert( kValueError == fErrorType || kCoordError == fErrorType ||
638 
639  if ( fpTmpCoordErrorVector )
640  {
641  delete[] fpTmpCoordErrorVector;
643  }
644 
645  if ( kNoError == fErrorType )
646  {
647  fCoordErrors.clear();
648  fCoordErrorsPtr.clear();
649 
650  fDataErrorHigh.clear();
652 
653  fDataErrorLow.clear();
655 
656  fDataError.clear();
658 
659  return;
660  }
661 
663  {
664  fCoordErrorsPtr.resize( fDim );
665  fCoordErrors.resize( fDim );
666  for( unsigned int i=0; i < fDim; i++ )
667  {
668  fCoordErrors[i].resize( fMaxPoints );
669 
670  fCoordErrorsPtr[i] = &fCoordErrors[i].front();
671  }
672 
673  fpTmpCoordErrorVector = new double[fDim];
674  }
675  else
676  {
677  fCoordErrors.clear();
678  fCoordErrorsPtr.clear();
679  }
680 
682  {
683  fDataError.resize( fMaxPoints );
684  fDataErrorPtr = &fDataError.front();
685 
686  fDataErrorHigh.clear();
688  fDataErrorLow.clear();
690  }
691  else if ( fErrorType == kAsymError )
692  {
693  fDataErrorHigh.resize( fMaxPoints );
695 
696  fDataErrorLow.resize( fMaxPoints );
697  fDataErrorLowPtr = &fDataErrorLow.front();
698 
699  fDataError.clear();
701  }
702  else
703  {
704  assert(false);
705  }
706  }
707 
709  {
710  fBinEdge.resize( fDim );
711 
712  for( unsigned int i=0; i<fDim; i++ )
713  {
714  fBinEdge[i].reserve( fMaxPoints );
715  }
716 
717  if ( fpTmpBinEdgeVector )
718  {
719  delete[] fpTmpBinEdgeVector;
721  }
722 
723  fpTmpBinEdgeVector = new double[ fDim ];
724  }
725 
727  {
728  assert( fWrapped );
729  assert( kValueError == fErrorType || kCoordError == fErrorType ||
731  assert( fDataError.empty() || &fDataError.front() == fDataErrorPtr );
732  assert( fDataErrorHigh.empty() || &fDataErrorHigh.front() == fDataErrorHighPtr );
733  assert( fDataErrorLow.empty() || &fDataErrorLow.front() == fDataErrorLowPtr );
734  assert( fDataErrorLow.empty() == fDataErrorHigh.empty() );
735 
736  assert( fData.empty() );
737  assert( fDataPtr );
738 
739  fData.resize( fNPoints );
740  std::copy( fDataPtr, fDataPtr + fNPoints, fData.begin() );
741  fDataPtr = &fData.front();
742 
743  for ( unsigned int i=0; i < fDim; i++ )
744  {
745  assert( fCoordErrorsPtr[i] );
746  assert( fCoordErrors.empty() || &fCoordErrors[i].front() == fCoordErrorsPtr[i] );
747  }
748 
750  {
751  assert( fDataError.empty() );
752  assert( fDataErrorPtr );
753 
754  fDataError.resize( fNPoints );
755  std::copy( fDataErrorPtr, fDataErrorPtr + fNPoints, fDataError.begin() );
756  fDataErrorPtr = &fDataError.front();
757  }
758 
759  if ( kValueError == fErrorType )
760  {
761  for ( unsigned int i=0; i < fNPoints; i++ )
762  {
763  fDataError[i] = 1.0 / fDataError[i];
764  }
765  }
766 
768  {
769  fCoordErrors.resize( fDim );
770  for( unsigned int i=0; i < fDim; i++ )
771  {
772  assert( fCoordErrorsPtr[i] );
773  fCoordErrors[i].resize( fNPoints );
774  std::copy( fCoordErrorsPtr[i], fCoordErrorsPtr[i] + fNPoints, fCoordErrors[i].begin() );
775  fCoordErrorsPtr[i] = &fCoordErrors[i].front();
776  }
777 
778  if( kAsymError == fErrorType )
779  {
780  assert( fDataErrorHigh.empty() );
781  assert( fDataErrorLow.empty() );
782  assert( fDataErrorHighPtr && fDataErrorLowPtr );
783 
784  fDataErrorHigh.resize( fNPoints );
785  fDataErrorLow.resize( fNPoints );
787  std::copy( fDataErrorLowPtr, fDataErrorLowPtr + fNPoints, fDataErrorLow.begin() );
789  fDataErrorLowPtr = &fDataErrorLow.front();
790  }
791  }
792 
793  FitData::UnWrap();
794  }
795 
796 
797  } // end namespace Fit
798 
799 } // end namespace ROOT
800 
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
double * fpTmpBinEdgeVector
Definition: BinData.h:567
Base class for all the fit data types: Stores the coordinates and the DataOptions.
Definition: FitData.h:65
void InitDataVector()
Definition: BinData.cxx:628
const double * fDataPtr
Definition: BinData.h:546
STL namespace.
#define NULL
Definition: RtypesCore.h:88
const double * fDataErrorPtr
Definition: BinData.h:556
void AddBinUpEdge(const double *xup)
add the bin width data, a pointer to an array with the bin upper edge information.
Definition: BinData.cxx:596
std::vector< const double *> fCoordErrorsPtr
Definition: BinData.h:549
const double * Coords(unsigned int ipoint) const
return a pointer to the coordinates data for the given fit point
Definition: FitData.h:245
double * fpTmpCoordErrorVector
Definition: BinData.h:562
ErrorType fErrorType
Definition: BinData.h:538
std::vector< double > fData
Stores the data values the same way as the coordinates.
Definition: BinData.h:545
std::vector< std::vector< double > > fBinEdge
Definition: BinData.h:564
Double_t x[n]
Definition: legend1.C:17
void Append(unsigned int newPoints, unsigned int dim=1)
Definition: FitData.cxx:247
void Initialize(unsigned int newPoints, unsigned int dim=1, ErrorType err=kValueError)
Definition: BinData.cxx:345
#define MATH_ERROR_MSG(loc, str)
Definition: Error.h:50
DataOptions : simple structure holding the options on how the data are filled.
Definition: DataOptions.h:28
void InitializeErrors()
Definition: BinData.cxx:634
double fRefVolume
Definition: BinData.h:539
void Add(double x)
add one dim data with only coordinate and values
Definition: FitData.h:263
std::vector< double > fDataError
Definition: BinData.h:553
const DataOptions & Opt() const
access to options
Definition: FitData.h:318
std::vector< double > fDataErrorHigh
Definition: BinData.h:554
virtual ~BinData()
destructor
Definition: BinData.cxx:186
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
Definition: BinData.h:53
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
class describing the range in the coordinates it supports multiple range in a coordinate.
Definition: DataRange.h:34
const double * fDataErrorLowPtr
Definition: BinData.h:558
void Add(double x, double y)
add one dim data with only coordinate and values
Definition: BinData.cxx:418
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
std::vector< double > fDataErrorLow
Definition: BinData.h:555
unsigned int fNPoints
Definition: FitData.h:371
std::vector< std::vector< double > > fCoordErrors
Definition: BinData.h:548
Double_t y[n]
Definition: legend1.C:17
Double_t ey[n]
Definition: legend1.C:17
BinData & operator=(const BinData &rhs)
Definition: BinData.cxx:225
BinData & LogTransform()
apply a Log transformation of the data values can be used for example when fitting an exponential or ...
Definition: BinData.cxx:359
FitData & operator=(const FitData &rhs)
Definition: FitData.cxx:215
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:324
unsigned int fDim
Definition: FitData.h:372
unsigned int fMaxPoints
Definition: FitData.h:370
const double * fDataErrorHighPtr
Definition: BinData.h:557
Double_t ex[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
double log(double)