CepGen 1.2.5
Central exclusive processes event generator
|
1D histogram container More...
#include <CepGen/Utils/Histogram.h>
Public Types | |
enum | BinMode { low = 0 , high , both } |
typedef std::map< coord_t, Value > | axis_t |
Metadata for an axis (coordinates and bins value) | |
typedef std::map< coord_t, axis_t > | dualaxis_t |
Metadata for a two-dimensional axis definition (coordinates and bins values) | |
Public Member Functions | |
Hist1D (const ParametersList &) | |
Build a histogram from user-steeed parameters. | |
Hist1D (size_t num_bins_x, const Limits &, const std::string &name="", const std::string &title="") | |
Build a histogram from uniform-width bins. | |
Hist1D (const std::vector< double > &bins, const std::string &name="", const std::string &title="") | |
Build a histogram from variable-width bins. | |
Hist1D (const Hist1D &) | |
Copy constructor. | |
void | clear () override |
Reset the histogram. | |
void | fill (double x, double weight=1.) |
Increment the histogram with one value. | |
void | add (Hist1D, double scaling=1.) |
Bin-to-bin addition of another histogram to this one. | |
void | scale (double) override |
Rescale all histogram bins by a constant factor. | |
double | sample (RandomGenerator &) const |
Sample individual "events" from a distribution. | |
double | chi2test (const Hist1D &, size_t &ndf) const |
Perform a chi^2 test between two histograms. | |
std::vector< Value > | values () const |
Retrieve the value + uncertainty for all bins. | |
Value | value (size_t bin) const |
Retrieve the value + uncertainty for one bin. | |
void | setValue (size_t bin, Value value) |
Set the value + uncertainty for one bin. | |
axis_t | axis () const |
Axis content. | |
size_t | nbins () const |
Number of histogram bins. | |
Limits | range () const |
Axis range. | |
Limits | binRange (size_t bin) const |
Range for a single bin. | |
std::vector< double > | bins (BinMode) const |
List of bins limits (nbins + 1 values if min-max, nbins values otherwise) | |
size_t | bin (double x) const |
Retrieve the bin index for a x value. | |
double | mean () const |
Compute the mean histogram value over full range. | |
double | rms () const |
Compute the root-mean-square value over full range. | |
double | minimum () const override |
Retrieve the maximum bin value. | |
double | maximum () const override |
Retrieve the minimum bin value. | |
double | integral (bool=false) const override |
Compute the histogram integral. | |
size_t | underflow () const |
size_t | overflow () const |
bool | isHist1D () const override final |
Is this drawable a one-dimensional histogram? | |
void | normalise (double integ=1.) |
Normalise the histogram to a given constant. | |
const std::string & | name () const |
Drawable name. | |
void | setName (const std::string &name) |
Set the drawable name. | |
const std::string & | title () const |
Drawable name. | |
void | setTitle (const std::string &title) |
Set the drawable title. | |
AxisInfo & | xAxis () |
const AxisInfo & | xAxis () const |
AxisInfo & | yAxis () |
const AxisInfo & | yAxis () const |
AxisInfo & | zAxis () |
const AxisInfo & | zAxis () const |
virtual bool | isHist2D () const |
Is this drawable a two-dimensional histogram? | |
virtual bool | isGraph1D () const |
Is this drawable a one-dimensional graph? | |
virtual bool | isGraph2D () const |
Is this drawable a two-dimensional graph? | |
Protected Member Functions | |
std::set< double > | extractBins (BinMode mode, size_t num_bins, const std::function< Limits(size_t)> &bins_extractor) const |
Extract the list of bin limits. | |
Protected Attributes | |
std::string | name_ |
Computer-readable name. | |
std::string | title_ |
Human-readable title. | |
AxisInfo | xaxis_ |
x-axis metadata | |
AxisInfo | yaxis_ |
y-axis metadata | |
AxisInfo | zaxis_ |
z-axis metadata | |
Definition at line 72 of file Histogram.h.
Definition at line 95 of file Drawable.h.
|
inherited |
Definition at line 103 of file Drawable.h.
|
inherited |
Enumerator | |
---|---|
low | |
high | |
both |
Definition at line 46 of file Histogram.h.
|
explicit |
Definition at line 31 of file Hist1D.cpp.
|
explicit |
Definition at line 41 of file Hist1D.cpp.
|
explicit |
Definition at line 48 of file Hist1D.cpp.
Definition at line 55 of file Hist1D.cpp.
void add | ( | Hist1D | oth, |
double | scaling = 1. |
||
) |
Definition at line 117 of file Hist1D.cpp.
Drawable::axis_t axis | ( | ) | const |
Definition at line 145 of file Hist1D.cpp.
size_t bin | ( | double | x | ) | const |
Definition at line 178 of file Hist1D.cpp.
Limits binRange | ( | size_t | bin | ) | const |
Definition at line 165 of file Hist1D.cpp.
std::vector< double > bins | ( | BinMode | mode | ) | const |
Definition at line 173 of file Hist1D.cpp.
double chi2test | ( | const Hist1D & | oth, |
size_t & | ndf | ||
) | const |
[out] | ndf | number of degrees of freedom (non-empty bins) |
Definition at line 244 of file Hist1D.cpp.
|
overridevirtual |
Implements Histogram.
Definition at line 91 of file Hist1D.cpp.
|
protectedinherited |
[in] | mode | type of extraction (low/high/low-high) |
[in] | num_bins | total number of bins |
[in] | bins_extractor | method used to extract range of one single bin |
Definition at line 26 of file Histogram.cpp.
void fill | ( | double | x, |
double | weight = 1. |
||
) |
Definition at line 98 of file Hist1D.cpp.
|
overridevirtual |
Implements Histogram.
Definition at line 227 of file Hist1D.cpp.
|
virtualinherited |
Reimplemented in Graph1D.
Definition at line 107 of file Drawable.h.
|
virtualinherited |
Reimplemented in Graph2D.
Definition at line 108 of file Drawable.h.
|
finaloverridevirtual |
Reimplemented from Drawable.
Definition at line 126 of file Histogram.h.
|
virtualinherited |
Reimplemented in Hist2D.
Definition at line 106 of file Drawable.h.
|
overridevirtual |
Implements Histogram.
Definition at line 222 of file Hist1D.cpp.
double mean | ( | ) | const |
Definition at line 207 of file Hist1D.cpp.
|
overridevirtual |
Implements Histogram.
Definition at line 217 of file Hist1D.cpp.
|
inherited |
Definition at line 37 of file Drawable.h.
size_t nbins | ( | ) | const |
Definition at line 155 of file Hist1D.cpp.
|
inherited |
Definition at line 24 of file Histogram.cpp.
size_t overflow | ( | ) | const |
Definition at line 124 of file Histogram.h.
Limits range | ( | ) | const |
Definition at line 160 of file Hist1D.cpp.
double rms | ( | ) | const |
Definition at line 212 of file Hist1D.cpp.
double sample | ( | RandomGenerator & | rng | ) | const |
Definition at line 235 of file Hist1D.cpp.
|
overridevirtual |
Implements Histogram.
Definition at line 136 of file Hist1D.cpp.
|
inherited |
Definition at line 39 of file Drawable.h.
|
inherited |
Definition at line 44 of file Drawable.h.
void setValue | ( | size_t | bin, |
Value | value | ||
) |
Definition at line 198 of file Hist1D.cpp.
|
inherited |
Definition at line 42 of file Drawable.h.
size_t underflow | ( | ) | const |
Definition at line 123 of file Histogram.h.
Value value | ( | size_t | bin | ) | const |
Definition at line 192 of file Hist1D.cpp.
std::vector< Value > values | ( | ) | const |
Definition at line 185 of file Hist1D.cpp.
|
inherited |
Definition at line 79 of file Drawable.h.
|
inherited |
Definition at line 80 of file Drawable.h.
|
inherited |
Definition at line 81 of file Drawable.h.
|
inherited |
Definition at line 82 of file Drawable.h.
|
inherited |
Definition at line 83 of file Drawable.h.
|
inherited |
Definition at line 84 of file Drawable.h.
|
protectedinherited |
Definition at line 111 of file Drawable.h.
|
protectedinherited |
Definition at line 112 of file Drawable.h.
|
protectedinherited |
Definition at line 113 of file Drawable.h.
|
protectedinherited |
Definition at line 114 of file Drawable.h.
|
protectedinherited |
Definition at line 115 of file Drawable.h.