7 #include "Alignment/Geners/interface/binaryIO.hh" 8 #include "Alignment/Geners/interface/IOException.hh" 16 : binEdges_(binEdges), nBins_(binEdges.
size() - 1
U), uniform_(
false) {
19 "In npstat::NUHistoAxis constructor: " 20 "number of bin edges is out of range");
32 "In npstat::NUHistoAxis constructor: " 33 "number of bins is out of range");
69 const int binnum =
delta - 1;
74 double bval = (
x - left) / (right - left);
80 }
else if (static_cast<unsigned>(binnum) >=
nBins_) {
83 double bval =
nBins_ - 1
U + (
x - left) / (right - left);
86 if (bval > static_cast<double>(
nBins_))
93 return binnum + (
x - left) / (right - left);
100 return binnum + (
x - left) / (right - left) - 0.5;
126 int binnum =
delta - 1;
129 else if (static_cast<unsigned>(binnum) >=
nBins_)
138 gs::write_pod(
of,
c);
143 static const gs::ClassId current(gs::ClassId::makeId<NUHistoAxis>());
144 current.ensureSameId(
id);
146 std::vector<double> binEdges;
149 gs::read_pod_vector(
in, &binEdges);
151 gs::read_pod(
in, &unif);
153 throw gs::IOReadFailure(
154 "In npstat::UHistoAxis::read: " 155 "input stream failure");
std::vector< double > binEdges_
NUHistoAxis rebin(unsigned newBins) const
unsigned closestValidBin(double x) const
bool closeWithinTolerance(const double &a, const double &b, const double &tol)
double fltBinNumber(double x, bool mapLeftEdgeTo0=true) const
Histogram axis with non-uniform bin spacing.
bool write(std::ostream &of) const
bool operator==(const NUHistoAxis &) const
Equidistant sequences of points in either linear or log space.
Exceptions for the npstat namespace.
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Determine if two doubles are within requested relative tolerance of each other.
int binNumber(double x) const
static NUHistoAxis * read(const gs::ClassId &id, std::istream &in)
bool operator!=(const NUHistoAxis &) const
const std::string & label() const
bool isClose(const NUHistoAxis &, double tol) const