1 #ifndef jb_explicit_cuts_binning_hpp 2 #define jb_explicit_cuts_binning_hpp 32 template <
typename sample_type_t>
48 template <
typename iterator_t>
51 if (
cuts_.size() < 2) {
52 throw std::invalid_argument(
53 "explicit_cuts_binning requires at least 2 cuts");
55 if (not std::is_sorted(
cuts_.begin(),
cuts_.end())) {
56 throw std::invalid_argument(
57 "explicit_cuts_binning requires a sorted set of cuts");
60 throw std::invalid_argument(
61 "explicit_cuts_binning requires unique elements");
79 return std::numeric_limits<sample_type>::min();
82 return std::numeric_limits<sample_type>::max();
85 auto it = std::upper_bound(
cuts_.begin(),
cuts_.end(), t);
86 return std::distance(
cuts_.begin(), it) - 1;
92 sample_type x_a, sample_type x_b,
double y_a,
double s,
double q)
const {
103 #endif // jb_explicit_cuts_binning_hpp sample_type histogram_max() const
sample_type histogram_min() const
explicit_cuts_binning(iterator_t begin, iterator_t end)
Constructor based on an iterator range.
sample_type theoretical_min() const
sample_type interpolate(sample_type x_a, sample_type x_b, double y_a, double s, double q) const
sample_type histogram_binning_linear_interpolation(sample_type x_a, sample_type x_b, double y_a, double s, double q)
Convenience function to implement the binning_strategy_concept.
sample_type bin2sample(std::size_t i) const
std::size_t sample2bin(sample_type t) const
sample_type_t sample_type
type traits as required by binning_strategy_concept
sample_type theoretical_max() const
std::vector< sample_type > cuts_
A histogram binning_strategy for integer numbers with user defined cuts.
explicit_cuts_binning(std::initializer_list< sample_type > const &il)
Constructor based on an initializer list.
The top-level namespace for the JayBeams library.