1 #ifndef NPSTAT_HISTOAXIS_HH_ 2 #define NPSTAT_HISTOAXIS_HH_ 16 #include "Alignment/Geners/interface/ClassId.hh" 22 template <
typename Numeric,
class Axis>
41 inline double min()
const {
return min_; }
42 inline double max()
const {
return max_; }
52 inline double binCenter(
const int binNum)
const {
return min_ + (binNum + 0.5) *
bw_; }
66 inline void setLabel(
const char* newlabel) {
label_ = newlabel ? newlabel :
""; }
94 inline double fltBinNumber(
const double x,
const bool mapLeftEdgeTo0 =
true)
const {
95 return (x -
min_) /
bw_ - (mapLeftEdgeTo0 ? 0.0 : 0.5);
117 inline gs::ClassId
classId()
const {
return gs::ClassId(*
this); }
118 bool write(std::ostream& of)
const;
121 static inline const char*
classname() {
return "npstat::HistoAxis"; }
122 static inline unsigned version() {
return 1; }
132 template <
typename Numeric,
class Axis>
142 const unsigned bin =
static_cast<unsigned>((x -
min_) / bw_);
143 *binNumber = bin >= nBins_ ? nBins_ - 1
U :
bin;
149 inline HistoAxis() : min_(0.0), max_(0.0), bw_(0.0), nBins_(0) {}
153 #endif // NPSTAT_HISTOAXIS_HH_
static unsigned version()
Linear transformation for circular topology.
int binNumber(double x) const
const std::string & label() const
double leftBinEdge(const int binNum) const
bool operator!=(const HistoAxis &) const
void setLabel(const char *newlabel)
bool write(std::ostream &of) const
gs::ClassId classId() const
static HistoAxis * read(const gs::ClassId &id, std::istream &in)
HistoAxis rebin(unsigned newBins) const
bool isClose(const HistoAxis &, double tol) const
CircularMapper1d kernelScanMapper(bool doubleRange) const
Interval< double > interval() const
double binCenter(const int binNum) const
unsigned overflowIndexWeighted(double x, unsigned *binNumber, double *weight) const
double binWidth(const int=0) const
bool operator==(const HistoAxis &) const
static const char * classname()
Interval< double > binInterval(const int binNum) const
LinearMapper1d binNumberMapper(bool mapLeftEdgeTo0=true) const
unsigned overflowIndex(const double x, unsigned *binNumber) const
double rightBinEdge(const int binNum) const
double fltBinNumber(const double x, const bool mapLeftEdgeTo0=true) const
unsigned closestValidBin(double x) const