Validity interval for a variable. More...
#include <include/CepGen/Utils/Limits.h>
Public Member Functions | |
Limits (double min=INVALID, double max=INVALID) | |
Define lower and upper limits on a quantity. | |
Limits (const Limits &) | |
Copy constructor. | |
bool | operator< (const Limits &) const |
Comparison operator. | |
Limits | operator- () const |
Invert this limit. | |
Limits & | operator= (const Limits &)=default |
Assignment operator Equality operator. | |
bool | operator== (const Limits &oth) const |
bool | operator!= (const Limits &oth) const |
Inequality operator. | |
Limits & | operator+= (double) |
Add a constant to this limit. | |
Limits & | operator-= (double) |
Subtract a constant to this limit. | |
Limits & | operator*= (double) |
Multiply this limit by a constant. | |
Limits & | validate () |
Ensure the limit object is valid by correcting it if necessary. | |
bool | hasMin () const |
Have a lower limit? | |
bool | hasMax () const |
Have an upper limit? | |
double | min () const |
Lower limit to apply on the variable. | |
double & | min () |
Lower limit to apply on the variable. | |
double | max () const |
Upper limit to apply on the variable. | |
double & | max () |
Upper limit to apply on the variable. | |
double | x (double v) const |
Find the [0,1] value scaled between minimum and maximum. | |
void | in (double low, double up) |
Specify the lower and upper limits on the variable. | |
double | range () const |
Full variable range allowed. | |
Limits | truncate (const Limits &) const |
Truncate limits to minimal/maximal values. | |
double | trim (double) const |
Limit a value to boundaries. | |
bool | contains (double val, bool exclude_boundaries=false) const |
Check if value is inside limits' boundaries. | |
Limits & | apply (double(*)(double)) |
Apply an operator on limits boundaries. | |
Limits | compute (double(*)(double)) const |
Compute a copy of limits with an operator applied on boundaries Compute a copy of limits with an operator applied on boundaries. | |
template<typename F > | |
Limits | compute (const F &op) const |
bool | valid () const |
Is there a lower and upper limit? | |
const std::pair< double, double > & | raw () const |
Raw value of limits. | |
std::vector< double > | generate (size_t num_bins, bool log_scale=false) const |
Generate a collection of values from a number of bins. | |
std::vector< Limits > | split (size_t num_bins, bool log_scale=false) const |
Split the limits into sub-limits objects. | |
Static Public Member Functions | |
static Limits | constant (double) |
Build dimension-0 limits (constant) | |
Static Public Attributes | |
static constexpr double | INVALID = -999.999 |
Invalid value placeholder (single-edged or invalid limits) | |
Friends | |
Limits | operator+ (Limits, double) |
Add a constant to a limit. | |
Limits | operator- (Limits, double) |
Subtract a constant to a limit. | |
Limits | operator* (Limits, double) |
Multiply a limit by a constant. | |
double | operator/ (double, const Limits &) |
Find the [0,1] fraction of range. | |
std::ostream & | operator<< (std::ostream &, const Limits &) |
Human-readable expression of the limits. | |
Limits & apply | ( | double(*)(double) | ) |
Limits compute | ( | double(*)(double) | ) | const |
|
static |
bool contains | ( | double | val, |
bool | exclude_boundaries = false ) const |
std::vector< double > generate | ( | size_t | num_bins, |
bool | log_scale = false ) const |
[in] | num_bins | number of values to generate |
[in] | log_scale | generate according to a log10 scale? |
bool hasMax | ( | ) | const |
bool hasMin | ( | ) | const |
void in | ( | double | low, |
double | up ) |
Limits & operator*= | ( | double | ) |
Limits & operator+= | ( | double | ) |
Limits operator- | ( | ) | const |
Limits & operator-= | ( | double | ) |
bool operator< | ( | const Limits & | ) | const |
double range | ( | ) | const |
std::vector< Limits > split | ( | size_t | num_bins, |
bool | log_scale = false ) const |
[in] | num_bins | number of sub-limits to generate |
[in] | log_scale | generate according to a log10 scale? |
double trim | ( | double | ) | const |
bool valid | ( | ) | const |
Limits & validate | ( | ) |
double x | ( | double | v | ) | const |
|
friend |
|
friend |