class ROOT::Fit::BinData: public ROOT::Fit::FitData


   Class describing the binned data sets :
              vectors of  x coordinates, y values and optionally error on y values and error on coordinates
              The dimension of the coordinate is free
              There are 4 different options:
              - only coordinates and values  (for binned likelihood fits)  : kNoError
              - coordinate, values and error on  values (for normal least square fits)  : kValueError
              - coordinate, values, error on values and coordinates (for effective least square fits) : kCoordError
              - corrdinate, values, error on coordinates and asymmettric error on valyes : kAsymError

              In addition there is the option to construct Bindata copying the data in (using the DataVector class)
              or using pointer to external data (DataWrapper) class.
              In general is found to be more efficient to copy the data.
              In case of really large data sets for limiting memory consumption then the other option can be used
              Specialized constructor exists for data up to 3 dimensions.

              When the data are copying in the number of points can be set later (or re-set) using Initialize and
              the data are pushed in (one by one) using the Add method.

             @ingroup  FitData

Function Members (Methods)

public:
virtual~BinData()
voidAdd(double x, double y)
voidAdd(const double* x, double val)
voidAdd(double x, double y, double ey)
voidAdd(const double* x, double val, double eval)
voidAdd(double x, double y, double ex, double ey)
voidAdd(const double* x, double val, const double* ex, double eval)
voidAdd(double x, double y, double ex, double eyl, double eyh)
ROOT::Fit::BinDataBinData(const ROOT::Fit::BinData&)
ROOT::Fit::BinDataBinData(unsigned int maxpoints = 0, unsigned int dim = 1, ROOT::Fit::BinData::ErrorType err = kValueError)
ROOT::Fit::BinDataBinData(const ROOT::Fit::DataOptions& opt, unsigned int maxpoints = 0, unsigned int dim = 1, ROOT::Fit::BinData::ErrorType err = kValueError)
ROOT::Fit::BinDataBinData(const ROOT::Fit::DataOptions& opt, const ROOT::Fit::DataRange& range, unsigned int maxpoints = 0, unsigned int dim = 1, ROOT::Fit::BinData::ErrorType err = kValueError)
ROOT::Fit::BinDataBinData(unsigned int n, const double* dataX, const double* val, const double* ex, const double* eval)
ROOT::Fit::BinDataBinData(unsigned int n, const double* dataX, const double* dataY, const double* val, const double* ex, const double* ey, const double* eval)
ROOT::Fit::BinDataBinData(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)
const double*CoordErrors(unsigned int ipoint) const
const double*Coords(unsigned int ipoint) const
unsigned intDataSize() const
doubleError(unsigned int ipoint) const
ROOT::Fit::BinData::ErrorTypeGetErrorType() const
const double*GetPoint(unsigned int ipoint, double& value) const
const double*GetPoint(unsigned int ipoint, double& value, double& invError) const
const double*GetPointError(unsigned int ipoint, double& errvalue) const
const double*GetPointError(unsigned int ipoint, double& errlow, double& errhigh) const
static unsigned intGetPointSize(ROOT::Fit::BinData::ErrorType err, unsigned int dim)
boolHaveAsymErrors() const
boolHaveCoordErrors() const
voidInitialize(unsigned int maxpoints, unsigned int dim = 1, ROOT::Fit::BinData::ErrorType err = kValueError)
doubleInvError(unsigned int ipoint) const
ROOT::Fit::BinData&LogTransform()
unsigned intNDim() const
unsigned intNPoints() const
ROOT::Fit::BinData&operator=(const ROOT::Fit::BinData&)
unsigned intPointSize() const
voidResize(unsigned int npoints)
unsigned intSize() const
doubleValue(unsigned int ipoint) const
protected:
voidSetNPoints(unsigned int n)

Data Members

public:
enum ErrorType { kNoError
kValueError
kCoordError
kAsymError
};
private:
ROOT::Fit::DataVector*fDataVectorpointer to the copied in data vector
ROOT::Fit::DataWrapper*fDataWrapperpointer to the external data wrapper structure
unsigned intfDimcoordinate dimension
unsigned intfNPointsnumber of contained points in the data set (can be different than size of vector)
unsigned intfPointSizetotal point size including value and errors (= fDim + 2 for error in only Y )

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

unsigned int GetPointSize(ROOT::Fit::BinData::ErrorType err, unsigned int dim)
ErrorType GetErrorType()
explicit BinData(unsigned int maxpoints = 0, unsigned int dim = 1, ROOT::Fit::BinData::ErrorType err = kValueError)
      constructor from dimension of point  and max number of points (to pre-allocate vector)
      Give a zero value and then use Initialize later one if the size is not known

explicit BinData(const ROOT::Fit::DataOptions& opt, unsigned int maxpoints = 0, unsigned int dim = 1, ROOT::Fit::BinData::ErrorType err = kValueError)
      constructor from option and default range

BinData(const DataOptions & opt, const DataRange & range, unsigned int maxpoints = 0, unsigned int dim = 1, ErrorType err = kValueError )
      constructor from options and range
      efault is 1D and value errors

BinData(unsigned int n, const double * dataX, const double * val, const double * ex , const double * eval )
 constructurs using external data 

      constructor from external data for 1D with errors on  coordinate and value

BinData(unsigned int n, const double* dataX, const double* dataY, const double* val, const double* ex, const double* ey, const double* eval)
      constructor from external data for 2D with errors on  coordinate and value

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)
      constructor from external data for 3D with errors on  coordinate and value

BinData(const ROOT::Fit::BinData& )
      copy constructor

BinData & operator=(const ROOT::Fit::BinData& )
       assignment operator

virtual ~BinData()
      destructor

void Initialize(unsigned int maxpoints, unsigned int dim = 1, ROOT::Fit::BinData::ErrorType err = kValueError)
      preallocate a data set given size and dimension
      need to be initialized with the with the right dimension before

unsigned int PointSize()
      return the size of a fit point (is the coordinate dimension + 1 for the value and eventually
      the number of all errors

unsigned int DataSize()
      return the size of internal data  (number of fit points)
      if data are not copied in but used externally the size is 0

bool HaveCoordErrors()
      flag to control if data provides error on the coordinates

bool HaveAsymErrors()
      flag to control if data provides asymmetric errors on the value

void Add(double x, double y )
      add one dim data with only coordinate and values

void Add(double x, double y, double ey)
      add one dim data with no error in the coordinate (x)
      in this case store the inverse of the error in the value (y)

void Add(double x, double y, double ex, double ey)
      add one dim data with  error in the coordinate (x)
      in this case store the value (y)  error and not the inverse

void Add(double x, double y, double ex, double eyl, double eyh)
      add one dim data with  error in the coordinate (x) and asymmetric errors in the value (y)
      in this case store the y errors and not the inverse

void Add(const double *x, double val)
      add multi-dim coordinate data with only value (no errors)

void Add(const double *x, double val, double eval)
      add multi-dim coordinate data with only error in value

void Add(const double *x, double val, const double * ex, double eval)
      add multi-dim coordinate data with both error in coordinates and value

const double * Coords(unsigned int ipoint) const
      return a pointer to the coordinates data for the given fit point

double Value(unsigned int ipoint) const
      return the value for the given fit point

double Error(unsigned int ipoint) const
      return error on the value for the given fit point
      Safe (but slower) method returning correctly the error on the value
      in case of asymm errors return the average 0.5(eu + el)

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 are not stored and then this is used directly this as the weight in
      the least square function

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 calling Coords(i) and Value(i)

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 point.
      To be used only when type is kValueError or kNoError. In the last case the value 1 is returned
      for the error.

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 only when the coordinate errors are stored otherwise it will produce an
      assert.

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.
      It must be called only when the coordinate errors and asymmetric errors are stored
      otherwise it will produce an assert.

void Resize(unsigned int npoints)
      resize the vector to the given npoints

unsigned int NPoints()
      return number of fit points

{ return fNPoints; }
unsigned int Size()
      return number of fit points
      In case of integral option size is npoints -1

unsigned int NDim()
      return coordinate data dimension

{ return fDim; }
BinData & LogTransform()
      apply a Log transformation of the data values
      can be used for example when fitting an exponential or gaussian
      Transform the data in place need to copy if want to preserve original data
      The data sets must not contain negative values. IN case it does,
      an empty data set is returned

void SetNPoints(unsigned int n)
{ fNPoints = n; }

Author: L. Moneta Wed Aug 30 11:15:23 2006
Last change: root/mathcore:$Id: BinData.h 25876 2008-10-18 09:35:00Z moneta $
Last generated: 2008-10-20 13:14
Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.