3 #ifndef MYGSL_HISTOGRAM_2D_H 4 #define MYGSL_HISTOGRAM_2D_H 1 12 #include <gsl/gsl_histogram2d.h> 13 #include <gsl/gsl_vector.h> 15 #include <boost/cstdint.hpp> 65 void initialize (
size_t nx_,
double xmin_,
double xmax_,
66 size_t ny_,
double ymin_,
double ymax_,
70 void initialize (
const std::vector<double> & xranges_,
71 const std::vector<double> & yranges_);
74 const std::vector<std::string> & imported_aux_prefixes_);
77 const std::vector<std::string> & imported_aux_prefixes_);
79 void init (
size_t nx_,
double xmin_,
double xmax_,
80 size_t ny_,
double ymin_,
double ymax_,
84 void init (
const std::vector<double> & xranges_,
85 const std::vector<double> & yranges_);
121 size_t ny_,
double ymin_,
double ymax_,
126 const std::vector<double> & yranges_);
134 bool is_inside (
double x_,
double y_)
const;
136 void accumulate (
double x_,
double y_,
double weight_ = 1.0);
138 void fill (
double x_,
double y_,
double weight_ = 1.0);
140 void fill (
int i_ ,
double y_,
double safe_x_delta_ = 1e-7,
double weight_ = 1.0);
142 void fill (
double x_,
int j_,
double safe_y_delta_ = 1e-7,
double weight_ = 1.0);
144 void fill (
int i_,
int j_,
145 double safe_x_delta_ = 1e-7,
double safe_y_delta_ = 1e-7,
146 double weight_ = 1.0);
156 double xmin ()
const;
158 double xmax ()
const;
160 double ymin ()
const;
162 double ymax ()
const;
164 size_t xbins ()
const;
166 size_t ybins ()
const;
168 void set (
size_t ix_,
size_t iy_,
double value_);
170 double get (
size_t ix_,
size_t iy_)
const;
172 double at (
size_t ix_,
size_t iy_)
const;
174 bool find (
double x_,
double y_,
size_t & i_,
size_t & j_)
const;
183 void min_bin (
size_t & i_,
size_t & j_)
const;
185 void max_bin (
size_t & i_,
size_t & j_)
const;
187 double xmean ()
const;
191 double ymean ()
const;
203 void print (std::ostream & ,
205 bool x_skip_line_ =
true)
const;
207 void dump (std::ostream & ,
int precision_ = 9)
const;
209 bool has_size (
size_t xbins_,
size_t ybins_)
const;
215 std::pair<double,double>
get_xrange (
size_t i_)
const;
217 std::pair<double,double>
get_yrange (
size_t j_)
const;
219 void shift (
double s_);
221 void scale (
double s_);
280 virtual void tree_dump (std::ostream & out = std::clog,
281 const std::string & title =
"",
282 const std::string & indent =
"",
283 bool inherit =
false)
const;
287 double _x_binning_info_;
288 double _y_binning_info_;
290 double _x_underflow_;
292 double _y_underflow_;
294 gsl_histogram2d * _h_;
320 void sample (
double r1_,
double r2_,
double & x_,
double & y_);
322 template<
class _ran_functor_t>
323 void sample (_ran_functor_t & ran_,
double & x_,
double & y_)
325 return gsl_histogram_pdf_sample (_pdf_, ran_(), ran_(), &x_, &y_);
330 gsl_histogram2d_pdf * _pdf_;
338 #endif // MYGSL_HISTOGRAM_2D_H
void increment_x_overflow(double weight_)
void add(const histogram_2d &)
void sub(const histogram_2d &)
bool same(const histogram_2d &) const
double get_y_binning_info() const
bool are_underflow_overflow_available() const
double overflow_y() const
void print(std::ostream &, int precision_=9, bool x_skip_line_=true) const
friend histogram_2d operator+(const histogram_2d &, const histogram_2d &)
bool is_logarithmic_y_binning() const
void invalidate_underflow_overflow()
void max_bin(size_t &i_, size_t &j_) const
datatools::properties & grab_auxiliaries()
double get_x_binning_info() const
void initialize(size_t nx_, double xmin_, double xmax_, size_t ny_, double ymin_, double ymax_, unsigned int xmode_=BIN_MODE_LINEAR, unsigned int ymode_=BIN_MODE_LINEAR)
bool is_inside(double x_, double y_) const
const datatools::properties & get_auxiliaries() const
void div(const histogram_2d &)
void init(size_t nx_, double xmin_, double xmax_, size_t ny_, double ymin_, double ymax_, unsigned int xmode_=BIN_MODE_LINEAR, unsigned int ymode_=BIN_MODE_LINEAR)
histogram_2d & operator+=(const histogram_2d &)
#define DATATOOLS_SERIALIZATION_DECLARATION()
Definition: i_serializable.h:266
double get_uniform_y_binning() const
double get_uniform_x_binning() const
void reset()
Reset the bin contents to zero.
std::pair< double, double > get_yrange(size_t j_) const
histogram_2d & operator-=(const histogram_2d &)
void min_bin(size_t &i_, size_t &j_) const
histogram_2d & operator *=(const histogram_2d &)
bool is_uniform_y_binning() const
double overflow_x() const
bool is_any_y_binning() const
friend histogram_2d operator *(const histogram_2d &, const histogram_2d &)
void reset_underflow_overflow()
bool has_xsize(size_t xbins_) const
std::pair< double, double > get_xrange(size_t i_) const
void dump(std::ostream &, int precision_=9) const
void increment_y_underflow(double weight_)
double get_logarithmic_y_binning() const
histogram_2d & operator=(const histogram_2d &)
void set(size_t ix_, size_t iy_, double value_)
bool is_any_x_binning() const
void destroy()
Destroy the histogram structure, making the histogram invalid.
void invalidate_counters()
void increment_x_underflow(double weight_)
bool is_logarithmic_x_binning() const
One dimensional histogram.
Definition: histogram.h:30
double at(size_t ix_, size_t iy_) const
void to_stream(std::ostream &) const
void increment_y_overflow(double weight_)
void accumulate(double x_, double y_, double weight_=1.0)
void fill(double x_, double y_, double weight_=1.0)
histogram_2d & operator/=(const histogram_2d &)
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
bool has_size(size_t xbins_, size_t ybins_) const
bool find(double x_, double y_, size_t &i_, size_t &j_) const
bool is_counts_available() const
double get(size_t ix_, size_t iy_) const
Linear.
Definition: histogram_utils.h:11
double underflow_x() const
bool has_ysize(size_t ybins_) 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.
Definition: histogram_2d.h:301
double get_logarithmic_x_binning() const
void mul(const histogram_2d &)
histogram_2d & operator-()
friend histogram_2d operator/(const histogram_2d &, const histogram_2d &)
double underflow_y() const
void sample(_ran_functor_t &ran_, double &x_, double &y_)
Definition: histogram_2d.h:323
void from_stream(std::istream &)
bool is_initialized() const
bool is_uniform_x_binning() const
Two dimensional histogram.
Definition: histogram_2d.h:29