Belle II Software  release-08-01-10
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 27 of file ESign.h.

27  : signed short {
29  c_Plus = 1,
30 
32  c_Minus = -1,
33 
35  c_Zero = 0,
36 
38  c_Invalid = SHRT_MIN,
39  };
@ c_Zero
Constant for undefined sign.
Definition: ESign.h:35
@ c_Minus
Constant for minus sign.
Definition: ESign.h:32
@ c_Plus
Constant for plus sign.
Definition: ESign.h:29
@ c_Invalid
Constant for an invalid information.

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 104 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 57 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 72 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 87 of file ESign.h.