1 #ifndef WIRECELLUTIL_BINNING_H 2 #define WIRECELLUTIL_BINNING_H 27 : m_nbins(0), m_minval(0), m_maxval(0), m_binsize(0)
30 : m_nbins(0), m_minval(0), m_maxval(0), m_binsize(0)
38 m_binsize = ((
maxval-minval)/nbins);
62 std::pair<double, double>
range()
const {
63 return std::make_pair(m_minval, m_maxval);
69 return std::make_pair(0, m_nbins);
81 return int((val-m_minval)/m_binsize);
94 return int(round((val-m_minval)/m_binsize));
99 double edge(
int ind)
const {
106 return m_minval <= val && val <
m_maxval;
111 return 0 <= bin && bin <
m_nbins;
126 os << bins.
nbins() <<
"@[" << bins.
min() <<
"," << bins.
max() <<
"]";
int edge_index(double val) const
double center(int ind) const
Binning(int nbins, double minval, double maxval)
double span() const
Return the max-min.
std::pair< int, int > irange() const
int bin(double val) const
static int max(int a, int b)
bool inside(double val) const
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
std::ostream & operator<<(std::ostream &os, const WireCell::WirePlaneId &wpid)
bool inbounds(int bin) const
Return true if bin is in bounds.
double edge(int ind) const
std::pair< int, int > sample_bin_range(double minval, double maxval) const
std::pair< double, double > range() const