cepgen is hosted by Hepforge, IPPP Durham
CepGen N/A
Central exclusive processes event generator

Validity interval for a variable. More...

#include <include/CepGen/Utils/Limits.h>

+ Inheritance diagram for Limits:
+ Collaboration diagram for Limits:

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.
 
Limitsoperator= (const Limits &)=default
 Assignment operator Equality operator.
 
bool operator== (const Limits &oth) const
 
bool operator!= (const Limits &oth) const
 Inequality operator.
 
Limitsoperator+= (double)
 Add a constant to this limit.
 
Limitsoperator-= (double)
 Subtract a constant to this limit.
 
Limitsoperator*= (double)
 Multiply this limit by a constant.
 
Limitsvalidate ()
 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.
 
Limitsapply (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< Limitssplit (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.
 

Detailed Description

Definition at line 28 of file Limits.h.

Constructor & Destructor Documentation

◆ Limits() [1/2]

Limits ( double min = INVALID,
double max = INVALID )

◆ Limits() [2/2]

Limits ( const Limits & )

Member Function Documentation

◆ apply()

Limits & apply ( double(*)(double) )

◆ compute() [1/2]

template<typename F >
Limits compute ( const F & op) const

Definition at line 70 of file Limits.h.

◆ compute() [2/2]

Limits compute ( double(*)(double) ) const

◆ constant()

static Limits constant ( double )
static

◆ contains()

bool contains ( double val,
bool exclude_boundaries = false ) const

◆ generate()

std::vector< double > generate ( size_t num_bins,
bool log_scale = false ) const
Parameters
[in]num_binsnumber of values to generate
[in]log_scalegenerate according to a log10 scale?

◆ hasMax()

bool hasMax ( ) const

◆ hasMin()

bool hasMin ( ) const

◆ in()

void in ( double low,
double up )

◆ max() [1/2]

double & max ( )

Definition at line 56 of file Limits.h.

◆ max() [2/2]

double max ( ) const

Definition at line 55 of file Limits.h.

◆ min() [1/2]

double & min ( )

Definition at line 54 of file Limits.h.

◆ min() [2/2]

double min ( ) const

Definition at line 53 of file Limits.h.

◆ operator!=()

bool operator!= ( const Limits & oth) const

Definition at line 40 of file Limits.h.

◆ operator*=()

Limits & operator*= ( double )

◆ operator+=()

Limits & operator+= ( double )

◆ operator-()

Limits operator- ( ) const

◆ operator-=()

Limits & operator-= ( double )

◆ operator<()

bool operator< ( const Limits & ) const

◆ operator=()

Limits & operator= ( const Limits & )
default

◆ operator==()

bool operator== ( const Limits & oth) const

Definition at line 39 of file Limits.h.

◆ range()

double range ( ) const

◆ raw()

const std::pair< double, double > & raw ( ) const

Definition at line 74 of file Limits.h.

◆ split()

std::vector< Limits > split ( size_t num_bins,
bool log_scale = false ) const
Parameters
[in]num_binsnumber of sub-limits to generate
[in]log_scalegenerate according to a log10 scale?

◆ trim()

double trim ( double ) const

◆ truncate()

Limits truncate ( const Limits & ) const

◆ valid()

bool valid ( ) const

◆ validate()

Limits & validate ( )

◆ x()

double x ( double v) const

Friends And Related Symbol Documentation

◆ operator*

Limits operator* ( Limits ,
double  )
friend

◆ operator+

Limits operator+ ( Limits ,
double  )
friend

◆ operator-

Limits operator- ( Limits ,
double  )
friend

◆ operator/

double operator/ ( double ,
const Limits &  )
friend

◆ operator<<

std::ostream & operator<< ( std::ostream & ,
const Limits &  )
friend

Member Data Documentation

◆ INVALID

constexpr double INVALID = -999.999
staticconstexpr

Definition at line 87 of file Limits.h.