Belle II Software  release-06-01-15
Belle2::TOP::func Namespace Reference

commonly used functions More...

Functions

double unfold (double x, int nx, double A)
 unfold a coordinate. More...
 
double unfold (double kx, int nx)
 unfold a direction. More...
 
void fold (double xu, double A, double &x, double &kx, int &nx)
 fold a coordinate (inverse of unfold). More...
 
double clip (double x, int Nx, double A, double xmi, double xma)
 Performs a clip on x w.r.t xmi and xma. More...
 
int getNumOfEven (int j1, int j2)
 Returns number of even numbers in the range given by arguments. More...
 
double within2PI (double angle)
 Returns angle within 0 and 2PI. More...
 

Detailed Description

commonly used functions

Function Documentation

◆ clip()

double Belle2::TOP::func::clip ( double  x,
int  Nx,
double  A,
double  xmi,
double  xma 
)
inline

Performs a clip on x w.r.t xmi and xma.

Parameters
xtrue coordinate
Nxsigned number of reflections
Asize for folding/unfolding
xmilower limit on unfolded coordinate x
xmaupper limit on unfolded coordinate x
Returns
clipped x

Definition at line 76 of file func.h.

77  {
78  x = unfold(x, Nx, A);
79  x = std::max(std::min(x, xma), xmi) - Nx * A;
80  if (Nx % 2 != 0) x = -x;
81  return x;
82  }
double unfold(double x, int nx, double A)
unfold a coordinate.
Definition: func.h:29

◆ fold()

void Belle2::TOP::func::fold ( double  xu,
double  A,
double &  x,
double &  kx,
int &  nx 
)
inline

fold a coordinate (inverse of unfold).

Parameters
xuunfolded coordinate (position of image)
Asize for folding
xtrue position [out]
kxtrue direction component [in/out]
nxsigned number of reflections [out]

Definition at line 57 of file func.h.

◆ getNumOfEven()

int Belle2::TOP::func::getNumOfEven ( int  j1,
int  j2 
)
inline

Returns number of even numbers in the range given by arguments.

Parameters
j1first number
j2last number (exclusive)
Returns
number of even numbers

Definition at line 90 of file func.h.

◆ unfold() [1/2]

double Belle2::TOP::func::unfold ( double  kx,
int  nx 
)
inline

unfold a direction.

Parameters
kxtrue direction component
nxsigned number of reflections
Returns
unfolded direction component

Definition at line 42 of file func.h.

◆ unfold() [2/2]

double Belle2::TOP::func::unfold ( double  x,
int  nx,
double  A 
)
inline

unfold a coordinate.

Parameters
xtrue position
nxsigned number of reflections
Asize for unfolding
Returns
unfolded coordinate (position of image)

Definition at line 29 of file func.h.

◆ within2PI()

double Belle2::TOP::func::within2PI ( double  angle)
inline

Returns angle within 0 and 2PI.

Parameters
angleangle
Returns
angle within 0 and 2PI

Definition at line 100 of file func.h.