6 #include "Alignment/Geners/interface/binaryIO.hh" 7 #include "Alignment/Geners/interface/IOException.hh" 14 const double min,
const double max,
16 : min_(min), max_(max), label_(label ? label :
""), npt_(nCoords)
20 "number of points is out of range");
26 "In npstat::UniformAxis constructor: " 27 "minimum and maximum must be distinct");
33 return std::pair<unsigned,double>(0
U, 1.0);
35 return std::pair<unsigned,double>(
npt_ - 2
U, 0.0);
38 unsigned binnum =
static_cast<unsigned>(floor((x -
min_)/
bw_));
39 if (binnum >
npt_ - 2U)
41 double w = binnum + 1.0 - (x -
min_)/
bw_;
46 return std::pair<unsigned,double>(binnum,
w);
53 return std::pair<unsigned,double>(0
U, 1.0 - (x -
min_)/
bw_);
55 return std::pair<unsigned,double>(
npt_ - 2
U, (
max_ - x)/
bw_);
58 unsigned binnum =
static_cast<unsigned>(floor((x -
min_)/
bw_));
59 if (binnum >
npt_ - 2U)
61 double w = binnum + 1.0 - (x -
min_)/
bw_;
66 return std::pair<unsigned,double>(binnum,
w);
72 std::vector<double> vec;
74 const unsigned nptm1 =
npt_ - 1
U;
75 for (
unsigned i=0;
i<nptm1; ++
i)
85 "In npstat::UniformAxis::coordinate: index out of range");
110 gs::write_pod(of,
min_);
111 gs::write_pod(of,
max_);
112 gs::write_pod(of,
label_);
113 gs::write_pod(of,
npt_);
119 static const gs::ClassId current(gs::ClassId::makeId<UniformAxis>());
120 current.ensureSameId(
id);
122 double min = 0.0,
max = 0.0;
126 gs::read_pod(in, &min);
127 gs::read_pod(in, &
max);
128 gs::read_pod(in, &label);
129 gs::read_pod(in, &nBins);
134 throw gs::IOReadFailure(
"In npstat::UniformAxis::read: " 135 "input stream failure");
bool closeWithinTolerance(const double &a, const double &b, const double &tol)
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.