3 #ifndef MYGSL_HISTOGRAM_H 4 #define MYGSL_HISTOGRAM_H 1 12 #include <gsl/gsl_histogram.h> 13 #include <gsl/gsl_vector.h> 15 #include <boost/cstdint.hpp> 54 void initialize (
size_t n_,
double min_,
double max_,
57 void init (
const std::vector<double> & ranges_);
59 void initialize (
const std::vector<double> & ranges_);
62 const std::vector<std::string> & imported_aux_prefixes_);
65 const std::vector<std::string> & imported_aux_prefixes_);
67 void init (
size_t n_,
double min_,
double max_,
75 histogram (
size_t n_,
double min_,
double max_,
78 histogram (
const std::vector<double> & ranges_);
88 void accumulate (
double x_ ,
double weight_ = 1.0);
90 void fill (
double x_ ,
double weight_ = 1.0);
92 void fill (
int i_ ,
double safe_delta_ = 1e-7,
double weight_ = 1.0);
94 void set (
size_t i_,
double value_);
104 size_t bins ()
const;
106 double get (
size_t i_)
const;
108 double at (
size_t i_)
const;
112 bool find (
double x_ ,
size_t & i_)
const;
119 void rebin (
size_t new_bins_);
153 double mean ()
const;
155 double sigma ()
const;
159 double sum (
size_t begin_,
size_t end_)
const;
165 void print (std::ostream & ,
int precision_ = 9)
const;
167 void print_ascii (std::ostream & ,
int mode_ = 0)
const;
169 void dump (std::ostream & ,
int precision_ = 9)
const;
173 std::pair<double,double>
get_range (
size_t i_)
const;
175 void shift (
double s_);
177 void scale (
double s_);
233 virtual void tree_dump (std::ostream& out = std::clog,
234 const std::string& title =
"",
235 const std::string& indent =
"",
236 bool inherit =
false)
const;
240 double _binning_info_;
271 double sample (
double r_);
273 void sample (
double r_,
double & x_);
275 template<
class _ran_functor_type>
278 return gsl_histogram_pdf_sample (_pdf_, ran_());
283 gsl_histogram_pdf * _pdf_;
293 #endif // MYGSL_HISTOGRAM_H void print_ascii(std::ostream &, int mode_=0) const
histogram & operator *=(const histogram &)
histogram & operator/=(const histogram &)
void reset()
Reset the bin contents to zero.
double at(size_t i_) const
datatools::properties & grab_auxiliaries()
double get_logarithmic_binning() const
friend histogram operator+(const histogram &, const histogram &)
void add(const histogram &)
void div(const histogram &)
histogram & operator=(const histogram &)
void reset_underflow_overflow()
bool is_logarithmic_binning() const
friend histogram operator *(const histogram &, const histogram &)
bool find(double x_, size_t &i_) const
void mul(const histogram &)
bool has_size(size_t bins_) const
void dump(std::ostream &, int precision_=9) const
const datatools::properties & get_auxiliaries() const
#define DATATOOLS_SERIALIZATION_DECLARATION()
Definition: i_serializable.h:266
void set(size_t i_, double value_)
void rebin(size_t new_bins_)
histogram & operator+=(const histogram &)
void to_stream(std::ostream &) const
void invalidate_underflow_overflow()
void sub(const histogram &)
void fill(double x_, double weight_=1.0)
histogram histogram_1d
Definition: histogram.h:289
double get_binning_info() const
bool can_rebin(size_t new_bins_) const
void destroy()
Destroy the histogram structure, making the histogram invalid.
bool is_initialized() const
double sample(_ran_functor_type &ran_)
Definition: histogram.h:276
bool is_uniform_binning() const
histogram & operator-=(const histogram &)
void init(const std::vector< double > &ranges_)
double get(size_t i_) const
double get_uniform_binning() const
virtual void tree_dump(std::ostream &out=std::clog, const std::string &title="", const std::string &indent="", bool inherit=false) const
Main interface method for smart dump.
void increment_underflow(double weight_)
friend histogram operator/(const histogram &, const histogram &)
One dimensional histogram.
Definition: histogram.h:30
double operator[](size_t i_) const
void increment_overflow(double weight_)
bool is_any_binning() const
void invalidate_counters()
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
PDF associated to a one dimensional histogram.
Definition: histogram.h:252
bool is_inside(double x_) const
void init(const histogram &h_)
std::pair< double, double > get_range(size_t i_) const
bool is_counts_available() const
void initialize(size_t n_, double min_, double max_, unsigned int mode_=BIN_MODE_LINEAR)
Linear.
Definition: histogram_utils.h:11
void from_stream(std::istream &)
bool same(const histogram &) const
void initialize(const histogram &h_)
bool are_underflow_overflow_available() const
void accumulate(double x_, double weight_=1.0)
bool is_initialized() const
void print(std::ostream &, int precision_=9) const
Two dimensional histogram.
Definition: histogram_2d.h:29