cepgen is hosted by Hepforge, IPPP Durham
CepGen 1.2.3
A generic central exclusive processes event generator
Loading...
Searching...
No Matches

Validity interval for a variable. More...

#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.
 
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 
)

Definition at line 26 of file Limits.cpp.

◆ Limits() [2/2]

Limits ( const Limits rhs)

Definition at line 28 of file Limits.cpp.

Member Function Documentation

◆ apply()

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

Definition at line 147 of file Limits.cpp.

◆ compute() [1/2]

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

Definition at line 69 of file Limits.h.

◆ compute() [2/2]

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

Definition at line 152 of file Limits.cpp.

◆ constant()

Limits constant ( double  val)
static

Definition at line 30 of file Limits.cpp.

◆ contains()

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

Definition at line 77 of file Limits.cpp.

◆ 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?

Definition at line 113 of file Limits.cpp.

◆ hasMax()

bool hasMax ( ) const

Definition at line 75 of file Limits.cpp.

◆ hasMin()

bool hasMin ( ) const

Definition at line 73 of file Limits.cpp.

◆ in()

void in ( double  low,
double  up 
)

Definition at line 60 of file Limits.cpp.

◆ max() [1/2]

double & max ( )

Definition at line 55 of file Limits.h.

◆ max() [2/2]

double max ( ) const

Definition at line 54 of file Limits.h.

◆ min() [1/2]

double & min ( )

Definition at line 53 of file Limits.h.

◆ min() [2/2]

double min ( ) const

Definition at line 52 of file Limits.h.

◆ operator!=()

bool operator!= ( const Limits oth) const

Definition at line 40 of file Limits.h.

◆ operator*=()

Limits & operator*= ( double  c)

Definition at line 52 of file Limits.cpp.

◆ operator+=()

Limits & operator+= ( double  c)

Definition at line 40 of file Limits.cpp.

◆ operator-()

Limits operator- ( ) const

Definition at line 38 of file Limits.cpp.

◆ operator-=()

Limits & operator-= ( double  c)

Definition at line 46 of file Limits.cpp.

◆ operator<()

bool operator< ( const Limits oth) const

Definition at line 32 of file Limits.cpp.

◆ 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

Definition at line 65 of file Limits.cpp.

◆ raw()

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

Definition at line 73 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?

Definition at line 122 of file Limits.cpp.

◆ trim()

double trim ( double  val) const

Definition at line 139 of file Limits.cpp.

◆ truncate()

Limits truncate ( const Limits ext) const

Definition at line 130 of file Limits.cpp.

◆ valid()

bool valid ( ) const

Definition at line 85 of file Limits.cpp.

◆ validate()

Limits & validate ( )

Definition at line 91 of file Limits.cpp.

◆ x()

double x ( double  v) const

Definition at line 97 of file Limits.cpp.

Friends And Related Symbol Documentation

◆ operator*

Limits operator* ( Limits  lim,
double  c 
)
friend

Definition at line 176 of file Limits.cpp.

◆ operator+

Limits operator+ ( Limits  lim,
double  c 
)
friend

Definition at line 166 of file Limits.cpp.

◆ operator-

Limits operator- ( Limits  lim,
double  c 
)
friend

Definition at line 171 of file Limits.cpp.

◆ operator<<

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

Definition at line 156 of file Limits.cpp.

Member Data Documentation

◆ INVALID

constexpr double INVALID = -999.999
staticconstexpr

Definition at line 86 of file Limits.h.