13 #ifndef ROOT_Fit_DataVector 14 #define ROOT_Fit_DataVector 29 #ifndef ROOT_Fit_DataOptions 34 #ifndef ROOT_Fit_DataRange 112 return (
unsigned int) (-1) /
sizeof (
double);
145 fData(
std::vector<double>(n))
163 const FData &
Data()
const {
return fData; }
168 FData &
Data() {
return fData; }
177 const_iterator
begin()
const {
return fData.begin(); }
178 const_iterator
end()
const {
return fData.begin()+fData.size(); }
183 iterator
begin() {
return fData.begin(); }
184 iterator
end() {
return fData.end(); }
190 const double & operator[] (
unsigned int i)
const {
return fData[i]; }
191 double & operator[] (
unsigned int i) {
return fData[i]; }
197 size_t Size()
const {
return fData.size(); }
233 fCoords(
std::vector<const double * >(1) ),
234 fX(
std::vector<double>(1) )
243 DataWrapper(
const double * dataX,
const double * val,
const double * eval ,
const double *
ex ) :
247 fCoords(
std::vector<const double * >(1) ),
248 fErrCoords(
std::vector<const double * >(1) ),
249 fX(
std::vector<double>(1) ),
250 fErr(
std::vector<double>(1) )
259 DataWrapper(
const double * dataX,
const double * dataY,
const double * val,
const double * eval,
const double *
ex ,
const double *
ey ) :
263 fCoords(
std::vector<const double * >(2) ),
264 fErrCoords(
std::vector<const double * >(2) ),
265 fX(
std::vector<double>(2) ),
266 fErr(
std::vector<double>(2) )
277 DataWrapper(
const double * dataX,
const double * dataY,
const double * dataZ,
const double * val,
const double * eval,
const double *
ex ,
const double *
ey,
const double * ez ) :
281 fCoords(
std::vector<const double * >(3) ),
282 fErrCoords(
std::vector<const double * >(3) ),
283 fX(
std::vector<double>(3) ),
284 fErr(
std::vector<double>(3) )
297 template<
class Iterator>
302 fCoords(
std::vector<const double * >(coordItr, coordItr+dim) ),
303 fX(
std::vector<double>(dim) )
310 template<
class Iterator>
311 DataWrapper(
size_t dim, Iterator coordItr,
const double * val,
const double * eval, Iterator errItr ) :
316 fCoords(
std::vector<const double * >(coordItr, coordItr+dim) ),
317 fErrCoords(
std::vector<const double * >(errItr, errItr+dim) ),
318 fX(
std::vector<double>(dim) ),
319 fErr(
std::vector<double>(dim) )
332 const double *
Coords(
unsigned int ipoint)
const {
333 for (
unsigned int i = 0; i < fDim; ++i) {
334 const double *
x = fCoords[i];
341 double Coord(
unsigned int ipoint,
unsigned int icoord)
const {
342 const double *
x = fCoords[icoord];
349 for (
unsigned int i = 0; i < fDim; ++i) {
350 const double * err = fErrCoords[i];
351 if (err == 0)
return 0;
352 fErr[i] = err[ipoint];
354 return &fErr.front();
357 double CoordError(
unsigned int ipoint,
unsigned int icoord)
const {
358 const double * err = fErrCoords[icoord];
359 return (err != 0) ? err[ipoint] : 0;
363 double Value(
unsigned int ipoint)
const {
364 return fValues[ipoint];
367 double Error(
unsigned int ipoint)
const {
368 return (fErrors) ? fErrors[ipoint] : 0. ;
382 mutable std::vector<double>
fX;
383 mutable std::vector<double>
fErr;
DataWrapper(unsigned int dim, Iterator coordItr)
constructor for multi-dim data without errors
const double * Coords(unsigned int ipoint) const
double CoordError(unsigned int ipoint, unsigned int icoord) const
size_t Size() const
full size of data vector (npoints * point size)
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
FData & Data()
non-const access to underlying vector (in case of insertion/deletion) and iterator ...
FData::const_iterator const_iterator
const iterator access
double Value(unsigned int ipoint) const
const double * CoordErrors(unsigned int ipoint) const
std::vector< double > FData
Base class for all the fit data types.
FitData(const DataOptions &opt)
construct passing options and default data range
FitData()
construct with default option and data range
double Coord(unsigned int ipoint, unsigned int icoord) const
DataWrapper(const double *dataX, const double *dataY, const double *dataZ, const double *val, const double *eval, const double *ex, const double *ey, const double *ez)
constructor for 3D data (if errors are not present a null pointer should be passed) ...
class holding the fit data points.
const FData & Data() const
const access to underlying vector
DataVector(size_t n)
default constructor for a vector of N -data
~DataVector()
Destructor (no operations)
DataWrapper(const double *dataX, const double *val, const double *eval, const double *ex)
constructor for 1D data (if errors are not present a null pointer should be passed) ...
iterator begin()
non-const iterator access
class maintaining a pointer to external data Using this class avoids copying the data when performing...
FitData(const DataRange &range)
construct passing range and default options
DataWrapper(const double *dataX)
specialized constructor for 1D data without errors and values
DataWrapper(const double *dataX, const double *dataY, const double *val, const double *eval, const double *ex, const double *ey)
constructor for 2D data (if errors are not present a null pointer should be passed) ...
DataOptions : simple structure holding the options on how the data are filled.
const DataOptions & Opt() const
access to options
std::vector< const double * > fErrCoords
FitData(const DataOptions &opt, const DataRange &range)
construct passing options and data range
class describing the range in the coordinates it supports multiple range in a coordinate.
const_iterator end() const
virtual ~FitData()
dummy virtual destructor
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
static unsigned int MaxSize()
define a max size to avoid allocating too large arrays
std::vector< double > fErr
const_iterator begin() const
std::vector< const double * > fCoords
const DataRange & Range() const
access to range
DataWrapper(size_t dim, Iterator coordItr, const double *val, const double *eval, Iterator errItr)
constructor for multi-dim data with errors and values (if errors are not present a null pointer shoul...
double Error(unsigned int ipoint) const