7 #include "Alignment/Geners/interface/binaryIO.hh" 8 #include "Alignment/Geners/interface/IOException.hh" 17 : binEdges_(binEdges), nBins_(binEdges.
size() - 1
U), uniform_(
false)
21 "number of bin edges is out of range");
30 const double min,
const double max,
36 "number of bins is out of range");
89 const int binnum = delta - 1;
95 double bval = (x - left)/(right - left);
102 else if (static_cast<unsigned>(binnum) >=
nBins_)
106 double bval =
nBins_ - 1
U + (x - left)/(right - left);
109 if (bval > static_cast<double>(
nBins_))
118 return binnum + (x - left)/(right - left);
126 return binnum + (x - left)/(right - left) - 0.5;
154 int binnum = delta - 1;
157 else if (static_cast<unsigned>(binnum) >=
nBins_)
165 gs::write_pod(of,
label_);
167 gs::write_pod(of, c);
173 static const gs::ClassId current(gs::ClassId::makeId<NUHistoAxis>());
174 current.ensureSameId(
id);
176 std::vector<double> binEdges;
179 gs::read_pod_vector(in, &binEdges);
180 gs::read_pod(in, &label);
181 gs::read_pod(in, &unif);
183 throw gs::IOReadFailure(
"In npstat::UHistoAxis::read: " 184 "input stream failure");
unsigned closestValidBin(double x) const
std::vector< double > binEdges_
int binNumber(double x) const
bool write(std::ostream &of) const
bool closeWithinTolerance(const double &a, const double &b, const double &tol)
Histogram axis with non-uniform bin spacing.
bool operator!=(const NUHistoAxis &) const
Equidistant sequences of points in either linear or log space.
Exceptions for the npstat namespace.
NUHistoAxis rebin(unsigned newBins) const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Determine if two doubles are within requested relative tolerance of each other.
static NUHistoAxis * read(const gs::ClassId &id, std::istream &in)
bool isClose(const NUHistoAxis &, double tol) const
double fltBinNumber(double x, bool mapLeftEdgeTo0=true) const
bool operator==(const NUHistoAxis &) const
const std::string & label() const