68 rz[0] = std::make_pair(zmin, zmax);
73bool lessRange(
const std::pair<double,double> & r1,
const std::pair<double,double> & r2 ) {
75 return r1.second < r2.second;
79 if (
Size(icoord) > irange )
80 return fRanges[icoord].at(irange);
81 else if (irange == 0) {
89 MATH_ERROR_MSG(
"DataRange::operator()",
"invalid range number - return (0,0)");
90 return std::pair<double,double>(0,0);
100 if (icoord >=
fRanges.size() ) {
109 if ( rs.size() == 0) {
110 rs.push_back(std::make_pair(
xmin,
xmax) );
118 rs.push_back(std::make_pair(
xmin,
xmax) );
120 std::sort( rs.begin(), rs.end() ,
lessRange);
130 if (icoord >=
fRanges.size() ) {
140 if (rs.size() > 1)
MATH_WARN_MSG(
"DataRange::SetRange",
"remove existing range and keep only the set one");
149 if (
Size(icoord) == 0)
return true;
151 for (RangeSet::const_iterator itr = ranges.begin(); itr != ranges.end(); ++itr) {
152 if (
x < (*itr).first )
return false;
153 if (
x <= (*itr).second)
return true;
160 if (
Size(icoord) == 0)
return;
171 for (RangeSet::iterator itr = ranges.begin(); itr != ranges.end(); ++itr) {
173 if ( itr->first >=
xmin && itr->second <=
xmax) {
174 itr = ranges.erase(itr);
184 xmin = -std::numeric_limits<double>::infinity();
185 xmax = std::numeric_limits<double>::infinity();
#define MATH_ERROR_MSG(loc, str)
#define MATH_WARN_MSG(loc, str)
static void GetInfRange(double &x1, double &x2)
std::vector< std::pair< double, double > > RangeSet
void CleanRangeSet(unsigned int icoord, double xmin, double xmax)
internal function to remove all the existing ranges between xmin and xmax called when a new range is ...
bool IsInside(double x, unsigned int icoord=0) const
check if a point is inside the range for the given coordinate
void Clear(unsigned int icoord=0)
clear all ranges in one coordinate (is now -inf, +inf)
void AddRange(unsigned int icoord, double xmin, double xmax)
add a range [xmin,xmax] for the new coordinate icoord Adding a range does not delete existing one,...
DataRange(unsigned int dim=1)
Default constructor (infinite range)
unsigned int Size(unsigned int icoord=0) const
return range size for coordinate icoord (starts from zero) Size == 0 indicates no range is present [-...
std::pair< double, double > operator()(unsigned int icoord=0, unsigned int irange=0) const
return the i-th range for the coordinate icoord.
void SetRange(unsigned int icoord, double xmin, double xmax)
set a range [xmin,xmax] for the new coordinate icoord If more range exists for other coordinates,...
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
bool lessRange(const std::pair< double, double > &r1, const std::pair< double, double > &r2)
Namespace for new ROOT classes and functions.