6 #include "Alignment/Geners/interface/binaryIO.hh"
7 #include "Alignment/Geners/interface/IOException.hh"
17 "In npstat::UniformAxis constructor: "
18 "number of points is out of range");
24 "In npstat::UniformAxis constructor: "
25 "minimum and maximum must be distinct");
30 return std::pair<unsigned, double>(0
U, 1.0);
32 return std::pair<unsigned, double>(
npt_ - 2
U, 0.0);
34 unsigned binnum = static_cast<unsigned>(floor((x -
min_) /
bw_));
35 if (binnum >
npt_ - 2
U)
37 double w = binnum + 1.0 - (x -
min_) /
bw_;
42 return std::pair<unsigned, double>(binnum,
w);
48 return std::pair<unsigned, double>(0
U, 1.0 - (x -
min_) /
bw_);
50 return std::pair<unsigned, double>(
npt_ - 2
U, (
max_ - x) /
bw_);
52 unsigned binnum = static_cast<unsigned>(floor((x -
min_) /
bw_));
53 if (binnum >
npt_ - 2
U)
55 double w = binnum + 1.0 - (x -
min_) /
bw_;
60 return std::pair<unsigned, double>(binnum,
w);
65 std::vector<double> vec;
67 const unsigned nptm1 =
npt_ - 1
U;
68 for (
unsigned i = 0;
i < nptm1; ++
i)
93 gs::write_pod(of,
min_);
94 gs::write_pod(of,
max_);
96 gs::write_pod(of,
npt_);
101 static const gs::ClassId current(gs::ClassId::makeId<UniformAxis>());
102 current.ensureSameId(
id);
104 double min = 0.0,
max = 0.0;
108 gs::read_pod(
in, &
min);
109 gs::read_pod(
in, &
max);
116 throw gs::IOReadFailure(
117 "In npstat::UniformAxis::read: "
118 "input stream failure");