32 fPointSize(GetPointSize(err,dim) ),
52 fPointSize(GetPointSize(err,dim) ),
76 fPointSize(GetPointSize(err,dim) ),
95 BinData::BinData(
unsigned int n,
const double * dataX,
const double * val,
const double *
ex ,
const double * eval ) :
116 BinData::BinData(
unsigned int n,
const double * dataX,
const double * dataY,
const double * val,
const double *
ex ,
const double *
ey,
const double * eval ) :
135 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 ) :
147 if (ex != 0 && ey != 0 && ez != 0)
fPointSize += 3;
157 fPointSize(rhs.fPointSize),
158 fNPoints(rhs.fNPoints),
159 fSumContent(rhs.fSumContent),
160 fSumError2(rhs.fSumError2),
161 fRefVolume(rhs.fRefVolume),
164 fBinEdge(rhs.fBinEdge)
184 if (&rhs ==
this)
return *
this;
253 if (nextraPoints == 0)
return;
254 else if (nextraPoints < 0) {
294 *itr++ = (ey!= 0) ? 1.0/ey : 0;
362 for (
unsigned int i = 0; i <
fDim; ++i)
385 for (
unsigned int i = 0; i <
fDim; ++i)
388 *itr++ = (eval!= 0) ? 1.0/eval : 0;
411 for (
unsigned int i = 0; i <
fDim; ++i)
414 for (
unsigned int i = 0; i <
fDim; ++i)
425 void BinData::Add(
const double *
x,
double val,
const double *
ex,
double elval,
double ehval) {
438 for (
unsigned int i = 0; i <
fDim; ++i)
441 for (
unsigned int i = 0; i <
fDim; ++i)
462 double binVolume = 1;
463 for (
unsigned int j = 0; j <
fDim; ++j) {
464 binVolume *= (xup[j]-xlow[j]);
490 typedef std::vector<double>::iterator DataItr;
492 DataItr itr = data.begin();
501 assert( itr != data.end() );
502 DataItr valitr = itr +
fDim;
503 double val = *(valitr);
505 MATH_ERROR_MSG(
"BinData::TransformLog",
"Some points have negative values - cannot apply a log transformation");
515 DataItr errpos = data.insert(valitr+1,val);
517 itr = errpos - fDim -1;
523 double invErr = *(valitr+1);
528 for (
unsigned int j = 2*fDim + 1; j <
fPointSize; ++j) {
533 err = *(itr+2*fDim+1);
535 err = 0.5 * ( *(itr+2*fDim+1) + *(itr+2*fDim+2) );
549 std::vector<double> errx;
556 for (
unsigned int i = 0; i <
fNPoints; ++i ) {
559 MATH_ERROR_MSG(
"BinData::TransformLog",
"Some points have negative values - cannot apply a log transformation");
565 if (err <= 0) err = 1;
571 for (
unsigned int j = 0; j <
fDim; ++j) {
572 std::cout <<
" j " << j <<
" val " << val <<
" " << errx.size() << std::endl;
573 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...
Namespace for new ROOT classes and functions.
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