Belle II Software  release-05-01-25
Belle2::TrackFindingCDC::ESignUtil Namespace Reference

Namespace to hide the constants of the ESign enumeration. More...

Enumerations

enum  ESign : signed short {
  c_Plus = 1,
  c_Minus = -1,
  c_Zero = 0,
  c_Invalid = SHRT_MIN
}
 Enumeration for the distinct sign values of floating point variables. More...
 

Functions

ESign opposite (ESign s)
 Return the opposite sign. Leaves ESign::c_Invalid the same.
 
bool isValid (ESign s)
 Returns true if sign is ESign::c_Plus, ESign::c_Minus or ESign::c_Zero.
 
static ESign common (ESign n1, ESign n2)
 Check if two values have a common sign. More...
 
static ESign common (float n1, float n2)
 Check if two values have a common sign. More...
 
static ESign common (float n1, float n2, float n3, float n4)
 Check if four values have a common sign. More...
 
template<class FloatRange >
static ESign common (const FloatRange &as)
 Check if four values have a common sign. More...
 

Detailed Description

Namespace to hide the constants of the ESign enumeration.

Enumeration Type Documentation

◆ ESign

enum ESign : signed short

Enumeration for the distinct sign values of floating point variables.

Enumerator
c_Plus 

Constant for plus sign.

c_Minus 

Constant for minus sign.

c_Zero 

Constant for undefined sign.

c_Invalid 

Constant for invalid sign, e.g. the sign of NAN.

Definition at line 37 of file ESign.h.

45  { return static_cast<ESign>(-s); }
46 
48  inline bool isValid(ESign s)
49  { return std::abs(s) <= 1; }

Function Documentation

◆ common() [1/4]

static ESign Belle2::TrackFindingCDC::ESignUtil::common ( const FloatRange &  as)
inlinestatic

Check if four values have a common sign.

Ignores nan values. Returns ESign::c_Plus if all signs are positive. Returns ESign::c_Minus if all signs are negative. Returns ESign::c_Zero for mixed signs. Returns ESign::c_Invalid if all input are NaN.

Definition at line 114 of file ESign.h.

◆ common() [2/4]

static ESign Belle2::TrackFindingCDC::ESignUtil::common ( ESign  n1,
ESign  n2 
)
inlinestatic

Check if two values have a common sign.

Ignores ESign::c_Invalid values. Returns ESign::c_Plus if all signs are positive. Returns ESign::c_Minus if all signs are negative. Returns ESign::c_Zero for mixed signs. Returns ESign::c_Invalid if all input are c_Invalid

Definition at line 67 of file ESign.h.

◆ common() [3/4]

static ESign Belle2::TrackFindingCDC::ESignUtil::common ( float  n1,
float  n2 
)
inlinestatic

Check if two values have a common sign.

Ignores nan values. Returns ESign::c_Plus if all signs are positive. Returns ESign::c_Minus if all signs are negative. Returns ESign::c_Zero for mixed signs. Returns ESign::c_Invalid if all input are NaN.

Definition at line 82 of file ESign.h.

◆ common() [4/4]

static ESign Belle2::TrackFindingCDC::ESignUtil::common ( float  n1,
float  n2,
float  n3,
float  n4 
)
inlinestatic

Check if four values have a common sign.

Ignores nan values. Returns ESign::c_Plus if all signs are positive. Returns ESign::c_Minus if all signs are negative. Returns ESign::c_Zero for mixed signs. Returns ESign::c_Invalid if all input are NaN.

Definition at line 97 of file ESign.h.

Belle2::TrackFindingCDC::NForwardBackward::isValid
bool isValid(EForwardBackward eForwardBackward)
Check whether the given enum instance is one of the valid values.
Definition: EForwardBackward.h:55
Belle2::TrackFindingCDC::ESignUtil::ESign
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:37