qupid 0.2
Quasi-Signal Generation Model for Pixelized Detector
Loading...
Searching...
No Matches
QPMath Namespace Reference

Mathematical functions for signal modelling: Gaussian and Woods-Saxon profiles, ellipse geometry, and thin wrappers around the <cmath> functions. More...

Namespaces

namespace  Gaussian
 Normalized Gaussian profiles.
 
namespace  GeometryCalc
 Ellipse radii and plane angles used by the Woods-Saxon profiles.
 
namespace  WoodSaxon
 Woods-Saxon (Fermi-function) profiles.
 

Functions

double Sqrt (const double &x)
 std::sqrt wrapper.
 
double Power (const double &x, const double &exponent)
 std::pow wrapper.
 
double Sin (const double &x)
 std::sin wrapper.
 
double Cos (const double &x)
 std::cos wrapper.
 
double ATan (const double &x)
 std::atan wrapper.
 
double ATan2 (const double &y, const double &x)
 Quadrant-aware arctangent with swapped argument forwarding.
 
double Exp (const double &x)
 std::exp wrapper.
 
double Gaus (const double &x, const double &mean, const double &sigma, const bool &norm)
 Gaussian kernel $ e^{-(x-\mu)^2/(2\sigma^2)} $, divided by $ \sqrt{2\pi}\,\sigma $ when norm is true.
 
QPMatrix RotationMatrix (double theta)
 Counterclockwise 2D rotation matrix.
 

Variables

const double InvPi = 0.3183098861837906715377675267450287240689192
 $ 1/\pi $
 
const double InvSqrtPi = 0.5641895835477562869480794515607725858440506
 $ 1/\sqrt{\pi} $
 
const double InvSqrt2Pi = 0.3989422804014326779399460599343818684758586
 $ 1/\sqrt{2\pi} $
 
const double Degree = 0.01745329251994329576923690768488612713442871
 one degree in radians, $ \pi/180 $
 
const double Pi = 3.1415926535897932384626433832795028841971693
 $ \pi $
 

Detailed Description

Mathematical functions for signal modelling: Gaussian and Woods-Saxon profiles, ellipse geometry, and thin wrappers around the <cmath> functions.

Angles are in radians throughout.

Function Documentation

◆ Sqrt()

◆ Power()

double QPMath::Power ( const double &  x,
const double &  exponent 
)

◆ Sin()

double QPMath::Sin ( const double &  x)

std::sin wrapper.

Parameters
xangle, radians
Returns
$ \sin x $

Definition at line 200 of file QPMath.cpp.

Referenced by QPMath::Gaussian::Assymetry2D(), QPMath::GeometryCalc::EllipseRotAxis(), RotationMatrix(), and QPMath::Gaussian::RotAxis2D().

◆ Cos()

double QPMath::Cos ( const double &  x)

std::cos wrapper.

Parameters
xangle, radians
Returns
$ \cos x $

Definition at line 204 of file QPMath.cpp.

Referenced by QPMath::Gaussian::Assymetry2D(), QPMath::GeometryCalc::EllipseRotAxis(), RotationMatrix(), and QPMath::Gaussian::RotAxis2D().

◆ ATan()

double QPMath::ATan ( const double &  x)

std::atan wrapper.

Parameters
xoperand
Returns
$ \arctan x \in (-\pi/2, \pi/2) $, radians

Definition at line 208 of file QPMath.cpp.

◆ ATan2()

double QPMath::ATan2 ( const double &  y,
const double &  x 
)

Quadrant-aware arctangent with swapped argument forwarding.

Warning
Forwards its parameters to std::atan2 in reversed order: ATan2(y, x) returns std::atan2(x, y), i.e. the quadrant-aware $ \arctan(x/y) $ — the angle measured from the +y axis — instead of the conventional $ \arctan(y/x) $. GeometryCalc::Angle depends on this behavior.
Parameters
yfirst argument (passed to std::atan2 as its second argument)
xsecond argument (passed to std::atan2 as its first argument)
Returns
angle in radians

Definition at line 212 of file QPMath.cpp.

Referenced by QPMath::GeometryCalc::Angle().

◆ Exp()

double QPMath::Exp ( const double &  x)

std::exp wrapper.

Parameters
xoperand
Returns
$ e^{x} $

Definition at line 216 of file QPMath.cpp.

Referenced by Gaus(), QPMath::Gaussian::MatrixForm2D(), and QPMath::WoodSaxon::Simple1D().

◆ Gaus()

double QPMath::Gaus ( const double &  x,
const double &  mean,
const double &  sigma,
const bool &  norm 
)

Gaussian kernel $ e^{-(x-\mu)^2/(2\sigma^2)} $, divided by $ \sqrt{2\pi}\,\sigma $ when norm is true.

Returns $ 10^{30} $ when $ \sigma = 0 $ and 0 when $ |x-\mu|/\sigma > 39 $ (underflows double precision).

Parameters
xevaluation point
meanmean $ \mu $
sigmawidth $ \sigma $
normnormalize to unit integral
Returns
kernel value

Definition at line 220 of file QPMath.cpp.

References Exp().

Referenced by QPMath::Gaussian::Simple1D().

◆ RotationMatrix()

QPMatrix QPMath::RotationMatrix ( double  theta)

Counterclockwise 2D rotation matrix.

\[ R(\theta) = \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix} \]

Parameters
thetarotation angle, radians
Returns
the 2×2 matrix, by value

Definition at line 232 of file QPMath.cpp.

References Cos(), and Sin().

Referenced by QPSignalGaussian::QPSignalGaussian().

Variable Documentation

◆ InvPi

const double QPMath::InvPi = 0.3183098861837906715377675267450287240689192

$ 1/\pi $

Definition at line 12 of file QPMath.hpp.

Referenced by QPMath::Gaussian::MatrixForm2D().

◆ InvSqrtPi

const double QPMath::InvSqrtPi = 0.5641895835477562869480794515607725858440506

$ 1/\sqrt{\pi} $

Definition at line 13 of file QPMath.hpp.

◆ InvSqrt2Pi

const double QPMath::InvSqrt2Pi = 0.3989422804014326779399460599343818684758586

◆ Degree

const double QPMath::Degree = 0.01745329251994329576923690768488612713442871

one degree in radians, $ \pi/180 $

Definition at line 15 of file QPMath.hpp.

◆ Pi

const double QPMath::Pi = 3.1415926535897932384626433832795028841971693

$ \pi $

Definition at line 16 of file QPMath.hpp.

Referenced by QPVector::GetAngleDegree().