1 #ifndef NPSTAT_HISTOAXIS_HH_ 2 #define NPSTAT_HISTOAXIS_HH_ 16 #include "Alignment/Geners/interface/ClassId.hh" 22 template <
typename Numeric,
class Axis>
class HistoND;
55 {
return min_ + (binNum + 0.5)*
bw_;}
63 {
return min_ + (binNum + 1)*
bw_;}
71 {
label_ = newlabel ? newlabel :
"";}
100 const bool mapLeftEdgeTo0=
true)
const 101 {
return (x -
min_)/
bw_ - (mapLeftEdgeTo0 ? 0.0 : 0.5);}
122 inline gs::ClassId
classId()
const {
return gs::ClassId(*
this);}
123 bool write(std::ostream& of)
const;
126 static inline const char*
classname() {
return "npstat::HistoAxis";}
137 template <
typename Numeric,
class Axis>
friend class HistoND;
141 const double x,
unsigned* binNumber)
const 149 const unsigned bin =
static_cast<unsigned>((x -
min_)/bw_);
150 *binNumber = bin >= nBins_ ? nBins_ - 1
U :
bin;
157 inline HistoAxis() : min_(0.0), max_(0.0), bw_(0.0), nBins_(0) {}
161 #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)
T x() const
Cartesian x coordinate.
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
bin
set the eta bin as selection string.
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