#ifndef ROOT_Fit_DataRange
#define ROOT_Fit_DataRange
#include <vector>
namespace ROOT {
namespace Fit {
class DataRange {
public:
typedef std::vector<std::pair<double,double> > RangeSet;
typedef std::vector< RangeSet > RangeIntervals;
explicit DataRange (unsigned int dim = 1) :
fRanges ( std::vector<RangeSet> (dim) )
{}
DataRange(double xmin, double xmax);
DataRange(double xmin, double xmax, double ymin, double ymax);
DataRange(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax);
unsigned int NDim() const { return fRanges.size(); }
unsigned int Size(unsigned int icoord) const {
return icoord < fRanges.size() ? fRanges[icoord].size() : 0;
}
const RangeSet & Ranges(unsigned int icoord) const {
return fRanges.at(icoord);
}
std::pair<double, double> operator() (unsigned int icoord) const {
return Size(icoord) > 0 ? fRanges[icoord].front() : std::make_pair<double,double>(0,0);
}
void GetRange(unsigned int icoord, double & xmin, double & xmax) const {
if (Size(icoord) == 0) {
xmin = 0;
xmax = 0;
return;
}
xmin = fRanges[icoord].front().first;
xmax = fRanges[icoord].front().second;
}
void GetRange(double & xmin, double & xmax) const { GetRange(0,xmin,xmax); }
void GetRange(double & xmin, double & xmax, double & ymin, double & ymax) const {
GetRange(0,xmin,xmax); GetRange(1,ymin,ymax);
}
void GetRange(double & xmin, double & xmax, double & ymin, double & ymax, double & zmin, double & zmax) const {
GetRange(0,xmin,xmax); GetRange(1,ymin,ymax); GetRange(2,zmin,zmax);
}
~DataRange () {}
void AddRange(unsigned int icoord , double xmin, double xmax );
void AddRange(double xmin, double xmax ) { AddRange(0,xmin,xmax); }
void AddRange(double xmin, double xmax, double ymin, double ymax ) { AddRange(0,xmin,xmax); AddRange(1,ymin,ymax); }
void AddRange(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax ) {
AddRange(0,xmin,xmax); AddRange(1,ymin,ymax); AddRange(2,zmin,zmax); }
void SetRange(unsigned int icoord , double xmin, double xmax );
void SetRange(double xmin, double xmax ) { SetRange(0,xmin,xmax); }
void SetRange(double xmin, double xmax, double ymin, double ymax ) { SetRange(0,xmin,xmax); SetRange(1,ymin,ymax); }
void SetRange(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax ) {
SetRange(0,xmin,xmax); SetRange(1,ymin,ymax); SetRange(2,zmin,zmax); }
void Clear (unsigned int icoord = 0 );
bool IsInside(double x, unsigned int icoord = 0) const;
protected:
void CleanRangeSet(unsigned int icoord, double xmin, double xmax);
private:
RangeIntervals fRanges;
};
}
}
#endif /* ROOT_Fit_DataRange */
Last change: Mon Sep 22 15:41:09 2008
Last generated: 2008-09-22 15:41
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.