6 #include "Alignment/Geners/interface/binaryIO.hh" 7 #include "Alignment/Geners/interface/IOException.hh" 15 : min_(min), max_(max), label_(label ? label :
""), nBins_(nbins)
19 "number of bins is out of range");
55 int binnum =
static_cast<int>(floor((x -
min_)/
bw_));
58 if (binnum < static_cast<int>(
nBins_))
63 if (binnum >= static_cast<int>(
nBins_))
83 const unsigned binnum =
static_cast<unsigned>(floor((x-
min_)/
bw_));
93 "In npstat::HistoAxis::binNumberMapper: " 94 "bin width is zero. Mapper can not be constructed.");
102 "In npstat::HistoAxis::kernelScanMapper: " 103 "bin width is zero. Mapper can not be constructed.");
120 "In npstat::HistoAxis::overflowIndexWeighted: " 121 "must have more than one bin");
122 const double dbin = (x -
min_)/
bw_;
128 else if (dbin >=
nBins_ - 0.5)
135 const unsigned bin =
static_cast<unsigned>(dbin - 0.5);
137 *weight = 1.0 - (dbin - 0.5 - *
binNumber);
145 gs::write_pod(of,
min_);
146 gs::write_pod(of,
max_);
147 gs::write_pod(of,
label_);
148 gs::write_pod(of,
nBins_);
154 static const gs::ClassId current(gs::ClassId::makeId<HistoAxis>());
155 current.ensureSameId(
id);
157 double min = 0.0,
max = 0.0;
161 gs::read_pod(in, &min);
162 gs::read_pod(in, &
max);
163 gs::read_pod(in, &label);
164 gs::read_pod(in, &nBins);
169 throw gs::IOReadFailure(
"In npstat::HistoAxis::read: " 170 "input stream failure");
bool closeWithinTolerance(const double &a, const double &b, const double &tol)
int binNumber(double x) const
const std::string & label() const
bool operator!=(const HistoAxis &) const
bool write(std::ostream &of) const
Exceptions for the npstat namespace.
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
static HistoAxis * read(const gs::ClassId &id, std::istream &in)
HistoAxis rebin(unsigned newBins) const
Determine if two doubles are within requested relative tolerance of each other.
bool isClose(const HistoAxis &, double tol) const
CircularMapper1d kernelScanMapper(bool doubleRange) const
base
Make Sure CMSSW is Setup ##.
bin
set the eta bin as selection string.
unsigned overflowIndexWeighted(double x, unsigned *binNumber, double *weight) const
bool operator==(const HistoAxis &) const
LinearMapper1d binNumberMapper(bool mapLeftEdgeTo0=true) const
unsigned closestValidBin(double x) const
Histogram axis with equidistant bins.