13 #ifndef ROOT_Fit_FitData 14 #define ROOT_Fit_FitData 70 explicit FitData(
unsigned int maxpoints = 0,
unsigned int dim = 1);
73 explicit FitData(
const DataOptions &opt,
unsigned int maxpoints = 0,
unsigned int dim = 1);
77 explicit FitData(
const DataRange &range,
unsigned int maxpoints = 0,
unsigned int dim = 1);
81 unsigned int maxpoints = 0,
unsigned int dim = 1);
84 FitData(
unsigned int n,
const double *dataX);
87 FitData(
unsigned int n,
const double *dataX,
const double *dataY);
90 FitData(
unsigned int n,
const double *dataX,
const double *dataY,
98 FitData(
const DataRange &range,
unsigned int maxpoints,
const double *dataX);
105 FitData(
const DataRange &range,
unsigned int maxpoints,
const double *dataX,
const double *dataY);
112 FitData(
const DataRange &range,
unsigned int maxpoints,
const double *dataX,
const double *dataY,
113 const double *dataZ);
122 template<
class Iterator>
123 FitData(
unsigned int n,
unsigned int dim, Iterator dataItr) :
126 fNPoints(fMaxPoints),
129 fpTmpCoordVector(NULL)
132 for (
unsigned int i = 0; i < fDim; i++) {
133 fCoordsPtr[i] = *dataItr++;
136 if (fpTmpCoordVector) {
137 delete[] fpTmpCoordVector;
138 fpTmpCoordVector = NULL;
141 fpTmpCoordVector =
new double [fDim];
149 template<
class Iterator>
150 FitData(
const DataRange &range,
unsigned int maxpoints,
unsigned int dim, Iterator dataItr) :
153 fMaxPoints(maxpoints),
156 fpTmpCoordVector(NULL)
161 InitFromRange(dataItr);
171 void Append(
unsigned int newPoints,
unsigned int dim = 1);
183 fCoords.resize(fDim);
184 fCoordsPtr.resize(fDim);
186 for (
unsigned int i = 0; i < fDim; i++) {
187 fCoords[i].resize(fMaxPoints + VectorPadding(fMaxPoints));
188 fCoordsPtr[i] = &fCoords[i].front();
191 if (fpTmpCoordVector) {
192 delete[] fpTmpCoordVector;
193 fpTmpCoordVector = NULL;
196 fpTmpCoordVector =
new double [fDim];
199 template<
class Iterator>
202 for (
unsigned int i = 0; i < fMaxPoints; i++) {
203 bool isInside =
true;
204 Iterator tmpItr = dataItr;
206 for (
unsigned int j = 0; j < fDim; j++)
207 isInside &= fRange.IsInside((*tmpItr++)[i], j);
212 for (
unsigned int k = 0; k < fDim; k++)
213 fpTmpCoordVector[k] = (*tmpItr++)[i];
215 Add(fpTmpCoordVector);
231 assert(ipoint < fMaxPoints + VectorPadding(fMaxPoints));
232 assert(icoord < fDim);
233 assert(fCoordsPtr.size() == fDim);
234 assert(fCoordsPtr[icoord]);
235 assert(fCoords.empty() || &fCoords[icoord].front() == fCoordsPtr[icoord]);
237 return &fCoordsPtr[icoord][ipoint];
246 const double *
Coords(
unsigned int ipoint)
const 248 assert(fpTmpCoordVector);
249 assert(ipoint < fMaxPoints + VectorPadding(fMaxPoints));
251 for (
unsigned int i = 0; i < fDim; i++) {
252 assert(fCoordsPtr[i]);
253 assert(fCoords.empty() || &fCoords[i].front() == fCoordsPtr[i]);
255 fpTmpCoordVector[i] = fCoordsPtr[i][ipoint];
258 return fpTmpCoordVector;
267 assert(!fCoordsPtr.empty() && fCoordsPtr.size() == 1 && fCoordsPtr[0]);
269 assert(fNPoints < fMaxPoints);
271 fCoords[0][ fNPoints ] =
x;
282 assert(!fCoordsPtr.empty() && fCoordsPtr.size() == fDim);
283 assert(fNPoints < fMaxPoints);
285 for (
unsigned int i = 0; i < fDim; i++) {
286 fCoords[i][ fNPoints ] = x[i];
349 assert(fCoords.empty());
351 fCoords.resize(fDim);
352 for (
unsigned int i = 0; i < fDim; i++) {
353 assert(fCoordsPtr[i]);
354 unsigned padding = VectorPadding(fNPoints);
355 fCoords[i].resize(fNPoints + padding);
356 std::copy(fCoordsPtr[i], fCoordsPtr[i] + fNPoints + padding, fCoords[i].begin());
357 fCoordsPtr[i] = &fCoords[i].front();
363 #ifdef R__HAS_VECCORE 368 static unsigned VectorPadding(
unsigned dataSize)
370 unsigned padding = 0;
371 unsigned modP = (dataSize) % vecCore::VectorSize<ROOT::Double_v>();
373 padding = vecCore::VectorSize<ROOT::Double_v>() - modP;
double * fpTmpCoordVector
Namespace for new ROOT classes and functions.
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
FitData(unsigned int n, unsigned int dim, Iterator dataItr)
constructor for multi-dim external data (data are not copied inside) Uses as argument an iterator of ...
const std::vector< const double *> & GetCoordDataPtrs() const
direct access to coord data ptrs
Base class for all the fit data types: Stores the coordinates and the DataOptions.
std::vector< std::vector< double > > fCoords
This vector stores the vectorizable data: The inner vectors contain the coordinates data fCoords[0] i...
const double * Coords(unsigned int ipoint) const
return a pointer to the coordinates data for the given fit point
void Add(const double *x)
add multi-dim coordinate data with only value
const double * GetCoordComponent(unsigned int ipoint, unsigned int icoord) const
returns a single coordinate component of a point.
unsigned int Size() const
return number of fit points
FitData(const DataRange &range, unsigned int maxpoints, unsigned int dim, Iterator dataItr)
constructor for multi-dim external data and a range (data are copied inside according to the range) U...
void InitCoordsVector()
initializer routines to set the corresponding pointers right The vectors must NOT be resized after th...
DataOptions : simple structure holding the options on how the data are filled.
void Add(double x)
add one dim data with only coordinate and values
const DataOptions & Opt() const
access to options
* x
Deprecated and error prone model selection interface.
static constexpr unsigned VectorPadding(const unsigned)
If VecCore is not defined, there is no vectorization available and the SIMD vector size will always b...
std::vector< const double *> fCoordsPtr
class describing the range in the coordinates it supports multiple range in a coordinate.
void InitFromRange(Iterator dataItr)
unsigned int NPoints() const
return number of fit points
unsigned int NDim() const
return coordinate data dimension
const DataRange & Range() const
access to range