41 Box(
const vector<double>& min,
const vector<double>& max,
42 const double value = 0.0,
const double error = 1.0):
93 vector<double>::const_iterator boxit = b2.
fMin.begin();
94 vector<double>::const_iterator bigit = b1.
fMax.begin();
95 while ( isIn && boxit != b2.
fMin.end() )
97 if ( (*boxit) >= (*bigit) ) isIn =
false;
102 boxit = b2.
fMax.begin();
103 bigit = b1.
fMin.begin();
104 while ( isIn && boxit != b2.
fMax.end() )
106 if ( (*boxit) <= (*bigit) ) isIn =
false;
151 void DivideBox(
const vector<double>& min,
const vector<double>& max,
152 const vector<double>& bmin,
const vector<double>& bmax,
153 const unsigned int size,
const unsigned int n,
154 list<Box>&
l,
const double val,
const double error)
156 vector<double> boxmin(min);
157 vector<double> boxmax(max);
161 if ( for_each(boxmin.begin(), boxmin.end(),
AreaComparer(boxmax.begin())).IsThereArea() )
162 l.push_back(
Box(boxmin, boxmax));
168 if ( for_each(boxmin.begin(), boxmin.end(),
AreaComparer(boxmax.begin())).IsThereArea() )
169 l.push_back(
Box(boxmin, boxmax, val, error));
176 if ( for_each(boxmin.begin(), boxmin.end(),
AreaComparer(boxmax.begin())).IsThereArea() )
177 l.push_back(
Box(boxmin, boxmax));
198 Box originalBox(min, max);
199 fList = std::make_unique<ProxyListBox>();
200 fList->PushBack(originalBox);
208 vector<double> minv(min,min+dim);
209 vector<double> maxv(max,max+dim);
210 Box originalBox(minv, maxv);
211 fList = std::make_unique<ProxyListBox>();
212 fList->PushBack(originalBox);
218 fList = std::make_unique<ProxyListBox>(*rhs.
fList);
223 fList = std::make_unique<ProxyListBox>(*rhs.
fList);
232 return fList->GetList().size();
238 return fList->Begin()->GetMin().size();
242 const double content,
const double error)
249 Box littleBox(min, max);
250 list<Box>::iterator it;
254 if ( it !=
fList->End() )
258 cout <<
"SparseData::Add -> FAILED! box not found! " << endl;
259 cout << littleBox << endl;
271 it->GetMin().size(), it->GetMin().size() - 1,
272 fList->GetList(), content, error );
279 std::vector<double>& min, std::vector<double>&max,
280 double& content,
double& error)
285 unsigned int counter = 0;
286 list<Box>::iterator it =
fList->Begin();
287 while ( it !=
fList->End() && counter != i ) {
292 if ( (it ==
fList->End()) || (counter != i) )
293 throw std::out_of_range(
"SparseData::GetPoint");
297 content = it->GetVal();
298 error = it->GetError();
304 copy(
fList->Begin(),
fList->End(), ostream_iterator<Box>(cout,
"\n------\n"));
312 list<Box>::iterator it =
fList->Begin();
313 const unsigned int dim = it->GetMin().size();
317 for ( ; it !=
fList->End(); ++it )
319 vector<double> mid(dim);
321 for (
unsigned int i = 0; i < dim; ++i)
323 mid[i] = ((it->GetMax()[i] - it->GetMin()[i]) /2) + it->GetMin()[i];
326 bd.
Add(&mid[0], it->GetVal(), it->GetError());
335 list<Box>::iterator it =
fList->Begin();
339 for ( ; it !=
fList->End(); ++it )
342 bd.
Add(&(it->GetMin()[0]), it->GetVal(), it->GetError());
353 list<Box>::iterator it =
fList->Begin();
354 const unsigned int dim = it->GetMin().size();
358 for ( ; it !=
fList->End(); ++it )
361 if ( it->GetVal() == 0 )
continue;
362 vector<double> mid(dim);
364 for (
unsigned int i = 0; i < dim; ++i)
366 mid[i] = ((it->GetMax()[i] - it->GetMin()[i]) /2) + it->GetMin()[i];
369 bd.
Add(&mid[0], it->GetVal(), it->GetError());
377 copy(
b.GetMin().begin(),
b.GetMin().end(), ostream_iterator<double>(os,
" "));
379 copy(
b.GetMax().begin(),
b.GetMax().end(), ostream_iterator<double>(os,
" "));
380 os <<
"val: " <<
b.GetVal();
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
void operator()(double value)
AreaComparer(vector< double >::iterator iter)
vector< double >::iterator fIter
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
void AddBinUpEdge(const double *xup)
add the bin width data, a pointer to an array with the bin upper edge information.
void Add(double x, double y)
add one dim data with only coordinate and values
void Initialize(unsigned int newPoints, unsigned int dim=1, ErrorType err=kValueError)
Preallocate a data set with given size, dimension and error type.
bool operator()(const Box &b1)
BoxContainer(const Box &b)
const vector< double > & GetMax() const
void AddVal(const double value)
friend ostream & operator<<(ostream &os, const Box &b)
bool operator==(const Box &b)
Box(const vector< double > &min, const vector< double > &max, const double value=0.0, const double error=1.0)
const vector< double > & GetMin() const
Base class for all the fit data types: Stores the coordinates and the DataOptions.
FitData & operator=(const FitData &rhs)
list< Box >::iterator Begin()
void Remove(list< Box >::iterator it)
list< Box >::iterator End()
SparseData class representing the data of a THNSparse histogram The data needs to be converted to a B...
std::unique_ptr< ProxyListBox > fList
void Add(std::vector< double > &min, std::vector< double > &max, const double content, const double error=1.0)
Adds a new bin specified by the vectors.
unsigned int NDim() const
Returns the dimension of the object (bins)
void GetPoint(const unsigned int i, std::vector< double > &min, std::vector< double > &max, double &content, double &error)
unsigned int NPoints() const
Returns the number of points stored.
void GetBinDataNoZeros(BinData &) const
Same as before, but including zero content bins.
SparseData & operator=(const SparseData &rhs)
Assignment operator.
void PrintList() const
Debug method to print the list of bins stored.
void GetBinData(BinData &) const
Transforms the data into a ROOT::Fit::BinData structure.
SparseData(std::vector< double > &min, std::vector< double > &max)
Constructor with a vector.
~SparseData() override
Destructor.
void GetBinDataIntegral(BinData &) const
Same as before, but returning a BinData with integral format (containing bin edges)
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
void DivideBox(const vector< double > &min, const vector< double > &max, const vector< double > &bmin, const vector< double > &bmax, const unsigned int size, const unsigned int n, list< Box > &l, const double val, const double error)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.