33 fPointSize(GetPointSize(err,dim) ),
53 fPointSize(GetPointSize(err,dim) ),
77 fPointSize(GetPointSize(err,dim) ),
96 BinData::BinData(
unsigned int n,
const double * dataX,
const double * val,
const double *
ex ,
const double * eval ) :
117 BinData::BinData(
unsigned int n,
const double * dataX,
const double * dataY,
const double * val,
const double *
ex ,
const double *
ey,
const double * eval ) :
136 BinData::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 ) :
148 if (ex != 0 && ey != 0 && ez != 0)
fPointSize += 3;
158 fPointSize(rhs.fPointSize),
159 fNPoints(rhs.fNPoints),
160 fSumContent(rhs.fSumContent),
161 fSumError2(rhs.fSumError2),
162 fRefVolume(rhs.fRefVolume),
165 fBinEdge(rhs.fBinEdge)
185 if (&rhs ==
this)
return *
this;
254 if (nextraPoints == 0)
return;
255 else if (nextraPoints < 0) {
295 *itr++ = (ey!= 0) ? 1.0/ey : 0;
363 for (
unsigned int i = 0; i <
fDim; ++i)
386 for (
unsigned int i = 0; i <
fDim; ++i)
389 *itr++ = (eval!= 0) ? 1.0/eval : 0;
412 for (
unsigned int i = 0; i <
fDim; ++i)
415 for (
unsigned int i = 0; i <
fDim; ++i)
426 void BinData::Add(
const double *
x,
double val,
const double *
ex,
double elval,
double ehval) {
439 for (
unsigned int i = 0; i <
fDim; ++i)
442 for (
unsigned int i = 0; i <
fDim; ++i)
463 double binVolume = 1;
464 for (
unsigned int j = 0; j <
fDim; ++j) {
465 binVolume *= (xup[j]-xlow[j]);
491 typedef std::vector<double>::iterator DataItr;
493 DataItr itr = data.begin();
502 assert( itr != data.end() );
503 DataItr valitr = itr +
fDim;
504 double val = *(valitr);
506 MATH_ERROR_MSG(
"BinData::TransformLog",
"Some points have negative values - cannot apply a log transformation");
516 DataItr errpos = data.insert(valitr+1,val);
518 itr = errpos - fDim -1;
524 double invErr = *(valitr+1);
529 for (
unsigned int j = 2*fDim + 1; j <
fPointSize; ++j) {
534 err = *(itr+2*fDim+1);
536 err = 0.5 * ( *(itr+2*fDim+1) + *(itr+2*fDim+2) );
550 std::vector<double> errx;
557 for (
unsigned int i = 0; i <
fNPoints; ++i ) {
560 MATH_ERROR_MSG(
"BinData::TransformLog",
"Some points have negative values - cannot apply a log transformation");
566 if (err <= 0) err = 1;
572 for (
unsigned int j = 0; j <
fDim; ++j) {
573 std::cout <<
" j " << j <<
" val " << val <<
" " << errx.size() << std::endl;
574 errx[j] = exold[j]/val;
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...
double Value(unsigned int ipoint) const
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
#define MATH_ERROR_MSGVAL(loc, str, x)
const FData & Data() const
const access to underlying vector
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...
unsigned int DataSize() const
return the size of internal data (number of fit points) if data are not copied in but used externally...
#define MATH_ERROR_MSG(loc, str)
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 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...
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)
BinData & LogTransform()
apply a Log transformation of the data values can be used for example when fitting an exponential or ...
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 DataOptions & Opt() const
access to options
static unsigned int GetPointSize(ErrorType err, unsigned int dim)
std::vector< double > fBinEdge