13 #ifndef ROOT_Fit_BinData
14 #define ROOT_Fit_BinData
16 #ifndef ROOT_Fit_DataVector
21 #ifdef USE_BINPOINT_CLASS
23 #ifndef ROOT_Fit_BinPoint
68 if (dim == 0 || dim >
MaxSize() )
return 0;
108 BinData(
unsigned int n,
const double * dataX,
const double * val,
const double * ex ,
const double * eval );
113 BinData(
unsigned int n,
const double * dataX,
const double * dataY,
const double * val,
const double * ex ,
const double *
ey,
const double * eval );
118 BinData(
unsigned int n,
const double * dataX,
const double * dataY,
const double * dataZ,
const double * val,
const double * ex ,
const double *
ey ,
const double * ez ,
const double * eval );
167 if (fPointSize >
fDim +2)
return true;
175 if (fPointSize > 2 *
fDim +2)
return true;
183 void Add(
double x,
double y );
189 void Add(
double x,
double y,
double ey);
195 void Add(
double x,
double y,
double ex,
double ey);
201 void Add(
double x,
double y,
double ex,
double eyl ,
double eyh);
206 void Add(
const double *x,
double val);
211 void Add(
const double *x,
double val,
double eval);
216 void Add(
const double *x,
double val,
const double * ex,
double eval);
221 void Add(
const double *x,
double val,
const double * ex,
double elval,
double ehval);
226 const double *
Coords(
unsigned int ipoint)
const {
236 double Value(
unsigned int ipoint)
const {
249 double Error(
unsigned int ipoint)
const {
256 return eval != 0 ? 1.0/eval : 0;
259 return 0.5 * (el+eval);
284 return eval != 0 ? 1.0/eval : 0;
304 const double *
GetPoint(
unsigned int ipoint,
double & value)
const {
308 const double * x = &v[j];
322 const double *
GetPoint(
unsigned int ipoint,
double & value,
double & invError)
const {
326 const double * x = &v[j];
329 if (fPointSize ==
fDim +1)
331 else if (fPointSize ==
fDim +2)
340 invError = ( e > 0 ) ? 1.0/e : 1.0;
349 const double *
GetPointError(
unsigned int ipoint,
double & errvalue)
const {
354 const double * ex = &v[j+
fDim+1];
355 errvalue = v[j + 2*
fDim +1];
368 const double *
GetPointError(
unsigned int ipoint,
double & errlow,
double & errhigh)
const {
375 const double * ex = &v[j+
fDim+1];
376 errlow = v[j + 2*
fDim +1];
377 errhigh = v[j + 2*
fDim +2];
382 #ifdef USE_BINPOINT_CLASS
387 const double * x = &v[j];
388 double value = v[j+
fDim];
389 if (fPointSize >
fDim + 2) {
390 const double * ex = &v[j+
fDim+1];
391 double err = v[j + 2*
fDim +1];
392 fPoint.Set(x,value,ex,err);
395 double invError = v[j+
fDim+1];
396 fPoint.Set(x,value,invError);
403 if (fPointSize >
fDim + 2) {
406 double invError = ( e != 0 ) ? 1.0/e : 0;
418 const double * x = &v[j];
419 double value = v[j+
fDim];
420 double invError = v[j+
fDim+1];
421 fPoint.Set(x,value,invError);
426 double invError = ( e != 0 ) ? 1.0/e : 0;
437 void Resize (
unsigned int npoints);
533 #ifdef USE_BINPOINT_CLASS
ErrorType GetErrorType() const
void Initialize(unsigned int maxpoints, 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...
Namespace for new ROOT classes and functions.
double RefVolume() const
retrieve the reference volume used to normalize the data when the option bin volume is set ...
double Value(unsigned int ipoint) const
void SetNPoints(unsigned int n)
Base class for all the fit data types.
const double * Coords(unsigned int ipoint) const
void AddBinUpEdge(const double *xup)
add the bin width data, a pointer to an array with the bin upper edge information.
DataWrapper * fDataWrapper
BinData & operator=(const BinData &)
assignment operator
bool HaveAsymErrors() const
flag to control if data provides asymmetric errors on the value
unsigned int Size() const
return number of fit points
double SumOfError2() const
compute the total sum of the error square (sum of weight square in case of a weighted data set) ...
const FData & Data() const
const access to underlying vector
const double * BinUpEdge(unsigned int icoord) const
return an array containing the upper edge of the bin for coordinate i In case of empty bin they could...
Obsolete class, no more in use.
class holding the fit data points.
const double * CoordErrors(unsigned int ipoint) const
unsigned int PointSize() const
return the size of a fit point (is the coordinate dimension + 1 for the value and eventually the numb...
double SumOfContent() const
compute the total sum of the data content (sum of weights in cse of weighted data set) ...
unsigned int DataSize() const
return the size of internal data (number of fit points) if data are not copied in but used externally...
class maintaining a pointer to external data Using this class avoids copying the data when performing...
DataOptions : simple structure holding the options on how the data are filled.
const double * Coords(unsigned int ipoint) const
return a pointer to the coordinates data for the given fit point
virtual ~BinData()
destructor
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
void SetRefVolume(double value)
set the reference volume used to normalize the data when the option bin volume is set ...
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...
void Resize(unsigned int npoints)
resize the vector to the new given npoints if vector does not exists is created using existing point ...
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...
unsigned int NPoints() const
return number of fit points
class describing the range in the coordinates it supports multiple range in a coordinate.
void Add(double x, double y)
add one dim data with only coordinate and values
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
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...
BinData & LogTransform()
apply a Log transformation of the data values can be used for example when fitting an exponential or ...
double Error(unsigned int ipoint) const
return error on the value for the given fit point Safe (but slower) method returning correctly the er...
double Value(unsigned int ipoint) const
return the value for the given fit point
bool HasBinEdges() const
query if the data store the bin edges instead of the center
size_t Size() const
full size of data vector (npoints * point size)
double Error(unsigned int ipoint) const
static unsigned int MaxSize()
define a max size to avoid allocating too large arrays
const double * CoordErrors(unsigned int ipoint) const
Return a pointer to the errors in the coordinates for the given fit point.
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...
static unsigned int GetPointSize(ErrorType err, unsigned int dim)
bool HaveCoordErrors() const
flag to control if data provides error on the coordinates
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...
unsigned int NDim() const
return coordinate data dimension
std::vector< double > fBinEdge
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...