29 rx[0] = std::make_pair(xmin, xmax);
41 rx[0] = std::make_pair(xmin, xmax);
47 ry[0] = std::make_pair(ymin, ymax);
58 rx[0] = std::make_pair(xmin, xmax);
63 ry[0] = std::make_pair(ymin, ymax);
68 rz[0] = std::make_pair(zmin, zmax);
73 bool 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) {
85 return std::make_pair(xmin,xmax);
89 MATH_ERROR_MSG(
"DataRange::operator()",
"invalid range number - return (0,0)");
90 return std::pair<double,double>(0,0);
97 if (xmin >= xmax)
return;
100 if (icoord >=
fRanges.size() ) {
102 rx[0] = std::make_pair(xmin, xmax);
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);
127 if (xmin >= xmax)
return;
130 if (icoord >=
fRanges.size() ) {
133 rs[0] = std::make_pair(xmin, xmax);
140 if (rs.size() > 1)
MATH_WARN_MSG(
"DataRange::SetRange",
"remove existing range and keep only the set one");
142 rs[0] = std::make_pair(xmin, xmax);
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();
void Clear(unsigned int icoord=0)
clear all ranges in one coordinate (is now -inf, +inf)
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
#define MATH_WARN_MSG(loc, str)
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 lessRange(const std::pair< double, double > &r1, const std::pair< double, double > &r2)
bool IsInside(double x, unsigned int icoord=0) const
check if a point is inside the range for the given coordinate
DataRange(unsigned int dim=1)
Default constructor (infinite range)
#define MATH_ERROR_MSG(loc, str)
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...
unsigned int r1[N_CITIES]
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::vector< std::pair< double, double > > RangeSet
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...
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
std::pair< double, double > operator()(unsigned int icoord=0, unsigned int irange=0) const
return the i-th range for the coordinate icoord.
static void GetInfRange(double &x1, double &x2)
unsigned int r2[N_CITIES]