![]() |
CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
|
#include "Headers/Histogram.h"

Public Member Functions | |
| Histogram ()=default | |
| default constructor | |
| ~Histogram ()=default | |
| default destructor | |
Functions to set the private members of the class | |
| virtual void | set (const size_t nbins, const double minVar=par::defaultDouble, const double maxVar=par::defaultDouble, const double shift=0.5, const BinType bin_type=BinType::_linear_, const std::vector< double > vec_edges={}) |
| set the histogram variables More... | |
| virtual int | digitize (const double var) |
| get the histogram index More... | |
| virtual std::vector< int > | digitize (const std::vector< double > var) |
| get the histogram indeces More... | |
| virtual void | put (const double var, const double weight) |
| bin the data More... | |
| virtual void | put (const std::vector< double > var, const std::vector< double > weight) |
| bin the data More... | |
| virtual void | put (const int bin, const double weight, const double var) |
| bin the data More... | |
| virtual void | put (const std::vector< int > bins, const std::vector< double > weight, const std::vector< double > var) |
| bin the data More... | |
| virtual void | set (const size_t nbins1, const size_t nbins2, const double minVar1=par::defaultDouble, const double maxVar1=par::defaultDouble, const double minVar2=par::defaultDouble, const double maxVar2=par::defaultDouble, const double shift1=0.5, const double shift2=0.5, const BinType bin_type1=BinType::_linear_, const BinType bin_type2=BinType::_linear_, const std::vector< double > vec_edges1={}, const std::vector< double > vec_edges2={}) |
| set the histogram variables More... | |
| virtual std::vector< int > | digitize (const double var1, const double var2) |
| get the histogram index More... | |
| virtual std::vector< std::vector< int > > | digitize (const std::vector< double > var1, const std::vector< double > var2) |
| get the histogram indeces More... | |
| virtual void | put (const double var1, const double var2, const double weight) |
| bin the data More... | |
| virtual void | put (const std::vector< double > var1, const std::vector< double > var2, const std::vector< double > weight) |
| bin the data More... | |
| virtual void | put (const int bin1, const int bin2, const double weight, const double var1, const double var2) |
| bin the data More... | |
| virtual void | put (const std::vector< std::vector< int >> bins, const std::vector< double > weight, const std::vector< double > var1, const std::vector< double > var2) |
| bin the data More... | |
Functions to get the private members of the class | |
| virtual size_t | nbins () const |
| return the number of bins More... | |
| virtual double | binSize () const |
| return the bin size More... | |
| virtual double | minVar () const |
| return the lower limit of the histogram More... | |
| virtual double | maxVar () const |
| return the upper limit of the histogram More... | |
| virtual double | shift () const |
| return the bin shift More... | |
| virtual BinType | bin_type () const |
| return the bin type More... | |
| virtual double | bin (const size_t i) const |
| return the i-th bin More... | |
| virtual std::vector< double > | bins () const |
| return the bins More... | |
| virtual std::vector< double > | averaged_bins () const |
| return the averaged bins More... | |
| virtual std::vector< double > | error_bins () const |
| return the bin errors More... | |
| virtual double | edge (const size_t i) const |
| return the i-th edge More... | |
| virtual std::vector< double > | edges () const |
| return the histogram edges More... | |
| virtual size_t | nbins1 () const |
| return the number of bins for the first variable More... | |
| virtual double | binSize1 () const |
| return the first variable bin size More... | |
| virtual double | minVar1 () const |
| return the lower limit of the histogram for the first variable More... | |
| virtual double | maxVar1 () const |
| return the upper limit of the histogram for the first variable More... | |
| virtual double | shift1 () const |
| return the bin shift for the first variable More... | |
| virtual BinType | bin_type1 () const |
| return the bin type for the first variable More... | |
| virtual size_t | nbins2 () const |
| return the number of bins for the second variable More... | |
| virtual double | binSize2 () const |
| return the second variable bin size More... | |
| virtual double | minVar2 () const |
| return the lower limit of the histogram for the second variable More... | |
| virtual double | maxVar2 () const |
| return the upper limit of the histogram for the second variable More... | |
| virtual double | shift2 () const |
| return the bin shift for the second variable More... | |
| virtual BinType | bin_type2 () const |
| return the bin type for the second variable More... | |
| virtual double | bin1 (const size_t i) const |
| return the i-th bin of the first variable More... | |
| virtual std::vector< double > | bins1 () const |
| return the first variable bins More... | |
| virtual std::vector< std::vector< double > > | averaged_bins1 () const |
| return the first variable averaged bins More... | |
| virtual std::vector< std::vector< double > > | error_bins1 () const |
| return the first variable averaged bin errors More... | |
| virtual double | edge1 (const size_t i) const |
| return the i-th edge of the first variable More... | |
| virtual std::vector< double > | edges1 () const |
| return the histogram edges of the first variable More... | |
| virtual double | bin2 (const size_t i) const |
| return the i-th bin of the second variable More... | |
| virtual std::vector< double > | bins2 () const |
| return the second variable bins More... | |
| virtual std::vector< std::vector< double > > | averaged_bins2 () const |
| return the second variable averaged bins More... | |
| virtual std::vector< std::vector< double > > | error_bins2 () const |
| return the second variable averaged bin errors More... | |
| virtual double | edge2 (const size_t i) const |
| return the i-th edge of the second variable More... | |
| virtual std::vector< double > | edges2 () const |
| return the histogram edges of the second variable More... | |
| virtual double | operator() (const int i, const HistogramType hist_type, const double fact=1.) const |
| return the histogram More... | |
| virtual double | operator() (const int i, const int j, const HistogramType hist_type, const double fact=1.) const |
| return the histogram at (i,j) More... | |
| virtual std::vector< double > | operator() (const HistogramType hist_type, const double fact=1.) const |
| return the histogram More... | |
| virtual double | normalization (const int i, const HistogramType hist_type, const double fact=1.) const |
| return the bin normalization More... | |
| virtual double | normalization (const int i, const int j, const HistogramType hist_type, const double fact=1.) const |
| return the bin normalization More... | |
| virtual int | unweighted_counts (const int i) const |
| return the unweighted bin counts More... | |
| virtual std::vector< int > | unweighted_counts () const |
| return the weights More... | |
| virtual int | unweighted_counts (const int i, const int j) const |
| return the unweighted bin counts More... | |
| virtual double | error (const int i, const HistogramType hist_type, const double fact=1.) const |
| return the poisson error of the histogram More... | |
| virtual double | error (const int i, const int j, const HistogramType hist_type, const double fact=1.) const |
| return the error of the histogram at (i,j) More... | |
| virtual std::vector< double > | error (const HistogramType hist_type, const double fact=1.) const |
| return the error of the histogram More... | |
input/output member functions (customized in all the derived classes) | |
| virtual void | write (const std::string dir, const std::string file, const HistogramType hist_type, const double fact=1.) const |
| write the histogram More... | |
The class Histogram.
This class is used to bin 1D variable.
Definition at line 118 of file Histogram.h.
|
inlinevirtual |
return the averaged bins
Definition at line 393 of file Histogram.h.
|
inlinevirtual |
return the first variable averaged bins
Reimplemented in cbl::glob::Histogram2D.
Definition at line 555 of file Histogram.h.
|
inlinevirtual |
return the second variable averaged bins
Reimplemented in cbl::glob::Histogram2D.
Definition at line 607 of file Histogram.h.
|
inlinevirtual |
return the i-th bin
| i | the i-th index |
Definition at line 377 of file Histogram.h.
|
inlinevirtual |
return the i-th bin of the first variable
| i | the i-th index |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 539 of file Histogram.h.
|
inlinevirtual |
return the i-th bin of the second variable
| i | the i-th index |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 591 of file Histogram.h.
|
inlinevirtual |
|
inlinevirtual |
return the bin type for the first variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 474 of file Histogram.h.
|
inlinevirtual |
return the bin type for the second variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 529 of file Histogram.h.
|
inlinevirtual |
|
inlinevirtual |
return the first variable bins
Reimplemented in cbl::glob::Histogram2D.
Definition at line 547 of file Histogram.h.
|
inlinevirtual |
return the second variable bins
Reimplemented in cbl::glob::Histogram2D.
Definition at line 599 of file Histogram.h.
|
inlinevirtual |
|
inlinevirtual |
return the first variable bin size
Reimplemented in cbl::glob::Histogram2D.
Definition at line 436 of file Histogram.h.
|
inlinevirtual |
return the second variable bin size
Reimplemented in cbl::glob::Histogram2D.
Definition at line 491 of file Histogram.h.
|
inlinevirtual |
get the histogram index
| var | value of the var |
Definition at line 158 of file Histogram.h.
|
inlinevirtual |
get the histogram index
| var1 | value of the first var |
| var2 | value of the second var |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 244 of file Histogram.h.
|
inlinevirtual |
get the histogram indeces
| var | values of the var |
Definition at line 168 of file Histogram.h.
|
inlinevirtual |
get the histogram indeces
| var1 | values of the first var |
| var2 | values of the second var |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 255 of file Histogram.h.
|
inlinevirtual |
return the i-th edge
| i | the i-th index |
Definition at line 411 of file Histogram.h.
|
inlinevirtual |
return the i-th edge of the first variable
| i | the i-th index |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 573 of file Histogram.h.
|
inlinevirtual |
return the i-th edge of the second variable
| i | the i-th index |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 625 of file Histogram.h.
|
inlinevirtual |
|
inlinevirtual |
return the histogram edges of the first variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 581 of file Histogram.h.
|
inlinevirtual |
return the histogram edges of the second variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 633 of file Histogram.h.
|
inlinevirtual |
return the error of the histogram
| hist_type | the type of histogram |
| fact | the factor used to normalized the histogram |
Definition at line 790 of file Histogram.h.
|
inlinevirtual |
return the poisson error of the histogram
| i | i-th bin |
| hist_type | the type of histogram |
| fact | the factor used to normalized the histogram |
Definition at line 757 of file Histogram.h.
|
inlinevirtual |
return the error of the histogram at (i,j)
| i | the i-th first variable bin |
| j | the j-th second variable bin |
| hist_type | the type of histogram |
| fact | the factor used to normalized the histogram |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 775 of file Histogram.h.
|
inlinevirtual |
|
inlinevirtual |
return the first variable averaged bin errors
Reimplemented in cbl::glob::Histogram2D.
Definition at line 563 of file Histogram.h.
|
inlinevirtual |
return the second variable averaged bin errors
Reimplemented in cbl::glob::Histogram2D.
Definition at line 615 of file Histogram.h.
|
inlinevirtual |
return the upper limit of the histogram
Definition at line 351 of file Histogram.h.
|
inlinevirtual |
return the upper limit of the histogram for the first variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 456 of file Histogram.h.
|
inlinevirtual |
return the upper limit of the histogram for the second variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 511 of file Histogram.h.
|
inlinevirtual |
return the lower limit of the histogram
Definition at line 342 of file Histogram.h.
|
inlinevirtual |
return the lower limit of the histogram for the first variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 446 of file Histogram.h.
|
inlinevirtual |
return the lower limit of the histogram for the second variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 501 of file Histogram.h.
|
inlinevirtual |
|
inlinevirtual |
return the number of bins for the first variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 428 of file Histogram.h.
|
inlinevirtual |
return the number of bins for the second variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 483 of file Histogram.h.
|
inlinevirtual |
return the bin normalization
| i | i-th bin |
| hist_type | the type of histogram |
| fact | the factor used to normalized the histogram |
Definition at line 694 of file Histogram.h.
|
inlinevirtual |
return the bin normalization
| i | i-th bin |
| j | j-th bin |
| hist_type | the type of histogram |
| fact | the factor used to normalized the histogram |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 711 of file Histogram.h.
|
inlinevirtual |
return the histogram
| hist_type | the type of histogram |
| fact | the factor used to normalized the histogram |
Definition at line 679 of file Histogram.h.
|
inlinevirtual |
return the histogram
| i | i-th bin |
| hist_type | the type of histogram |
| fact | the factor used to normalized the histogram |
Definition at line 648 of file Histogram.h.
|
inlinevirtual |
return the histogram at (i,j)
| i | the i-th first variable bin |
| j | the j-th second variable bin |
| hist_type | the type of histogram |
| fact | the factor used to normalized the histogram |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 665 of file Histogram.h.
|
inlinevirtual |
bin the data
| var | value of the var |
| weight | weight of the var |
Definition at line 178 of file Histogram.h.
|
inlinevirtual |
bin the data
| var1 | value of the first var |
| var2 | value of the second var |
| weight | weight of the var |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 267 of file Histogram.h.
|
inlinevirtual |
bin the data
| bin | value of the bin |
| weight | weight of the var |
| var | value of the var |
Definition at line 200 of file Histogram.h.
|
inlinevirtual |
bin the data
| bin1 | value of the first bin |
| bin2 | value of the second bin |
| weight | weight of the var |
| var1 | value of the first var |
| var2 | value of the second var |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 295 of file Histogram.h.
|
inlinevirtual |
bin the data
| var | values of the var |
| weight | weights of the var |
Definition at line 188 of file Histogram.h.
|
inlinevirtual |
bin the data
| var1 | values of the first var |
| var2 | values of the second var |
| weight | weights of the var |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 279 of file Histogram.h.
|
inlinevirtual |
bin the data
| bins | values of the bin |
| weight | weights of the var |
| var | values of the var |
Definition at line 212 of file Histogram.h.
|
inlinevirtual |
bin the data
| bins | values of the bins |
| weight | weights of the var |
| var1 | values of the first var |
| var2 | values of the second var |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 309 of file Histogram.h.
|
inlinevirtual |
set the histogram variables
| nbins | the number of bins |
| minVar | the variable minimum |
| maxVar | the variable maximum |
| shift | the shift of the bin |
| bin_type | the binning type |
| vec_edges | the bin edges, used only if bin_type is custom |
Definition at line 148 of file Histogram.h.
|
inlinevirtual |
set the histogram variables
| nbins1 | the number of bins for the first variable |
| nbins2 | the number of bins for the second variable |
| minVar1 | minimum range for the first variable |
| maxVar1 | maximmum range for the first variable |
| minVar2 | minimum range for the second variable |
| maxVar2 | maximmum range for the second variable |
| shift1 | bin shift for the first variable |
| shift2 | bin shift for the second variable |
| bin_type1 | the binning type for the first variable |
| bin_type2 | the binning type for the second variable |
| vec_edges1 | the first variable bin edges, used only if bin_type is custom |
| vec_edges2 | the second variable bin edges, used only if bin_type is custom |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 233 of file Histogram.h.
|
inlinevirtual |
|
inlinevirtual |
return the bin shift for the first variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 465 of file Histogram.h.
|
inlinevirtual |
return the bin shift for the second variable
Reimplemented in cbl::glob::Histogram2D.
Definition at line 520 of file Histogram.h.
|
inlinevirtual |
|
inlinevirtual |
return the unweighted bin counts
| i | i-th bin |
Definition at line 721 of file Histogram.h.
|
inlinevirtual |
return the unweighted bin counts
| i | i-th bin |
| j | j-th bin |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 741 of file Histogram.h.
|
inlinevirtual |
write the histogram
| dir | output directory |
| file | output file |
| hist_type | the type of histogram |
| fact | the factor used to normalized the histogram |
Reimplemented in cbl::glob::Histogram2D.
Definition at line 812 of file Histogram.h.