Belle II Software light-2406-ragdoll
ConditionalGaussGenerator Class Reference

Class implementing n-dimensional random number generator from Gaussian distribution where the first component of the vector is generated first (using some external source) and the remaining components are generated based on the value of the first component. More...

#include <ConditionalGaussGenerator.h>

Collaboration diagram for ConditionalGaussGenerator:

Public Member Functions

 ConditionalGaussGenerator ()
 dummy constructor without arguments

 
 ConditionalGaussGenerator (const Eigen::VectorXd &mu, const Eigen::MatrixXd &covMat)
 constructor which takes vector of central values and covariance matrix as input
 
Eigen::VectorXd generate (double x0) const
 generate random vector based on the provided first component x0
 
double getX0spread () const
 get the spread of first component which can be used by external generator
 
Eigen::VectorXd getMu () const
 get the vector including central values of the distribution
 
Eigen::MatrixXd getCovMat () const
 get the covariance matrix describing n-dimensional Gaussian distribution
 

Private Attributes

Eigen::VectorXd m_mu
 central values of the distribution
 
Eigen::MatrixXd m_covMat
 covariance matrix of the distribution
 
Eigen::MatrixXd m_vBaseMat
 transformation matrix between eigen-system of m_covMat and nominal system
 
std::vector< Eigen::VectorXd > m_cOrt
 array of vectors describing free degrees of freedom of random generator
 
Eigen::VectorXd m_v0norm
 vector which scales with dx0
 

Detailed Description

Class implementing n-dimensional random number generator from Gaussian distribution where the first component of the vector is generated first (using some external source) and the remaining components are generated based on the value of the first component.

The obtained numbers have identical statistical behaviour like when all components are generated simultaneously

Definition at line 25 of file ConditionalGaussGenerator.h.

Constructor & Destructor Documentation

◆ ConditionalGaussGenerator()

dummy constructor without arguments

Definition at line 30 of file ConditionalGaussGenerator.h.

30{}

Member Function Documentation

◆ generate()

VectorXd generate ( double  x0) const

generate random vector based on the provided first component x0

Parameters
x0the first component of the random vector
Returns
the vector of the random numbers, it starts with x0

Definition at line 99 of file ConditionalGaussGenerator.cc.

100{
101 double dx0 = x0 - m_mu[0];
102
103 // in case of zero cov matrix
104 if (m_vBaseMat.cols() == 0)
105 return m_mu;
106
107 VectorXd x = m_v0norm * dx0;
108
109 for (const VectorXd& co : m_cOrt) {
110 double rr = gRandom->Gaus();
111 x += rr * co;
112 }
113
114 VectorXd vec = m_vBaseMat * x;
115
116 return (m_mu + vec);
117}
Eigen::VectorXd m_mu
central values of the distribution
Eigen::MatrixXd m_vBaseMat
transformation matrix between eigen-system of m_covMat and nominal system
std::vector< Eigen::VectorXd > m_cOrt
array of vectors describing free degrees of freedom of random generator
Eigen::VectorXd m_v0norm
vector which scales with dx0

◆ getCovMat()

Eigen::MatrixXd getCovMat ( ) const
inline

get the covariance matrix describing n-dimensional Gaussian distribution

Definition at line 49 of file ConditionalGaussGenerator.h.

49{ return m_covMat; }
Eigen::MatrixXd m_covMat
covariance matrix of the distribution

◆ getMu()

Eigen::VectorXd getMu ( ) const
inline

get the vector including central values of the distribution

Definition at line 46 of file ConditionalGaussGenerator.h.

46{ return m_mu; }

◆ getX0spread()

double getX0spread ( ) const
inline

get the spread of first component which can be used by external generator

Definition at line 43 of file ConditionalGaussGenerator.h.

43{ return std::sqrt(m_covMat(0, 0)); }

Member Data Documentation

◆ m_cOrt

std::vector<Eigen::VectorXd> m_cOrt
private

array of vectors describing free degrees of freedom of random generator

Definition at line 55 of file ConditionalGaussGenerator.h.

◆ m_covMat

Eigen::MatrixXd m_covMat
private

covariance matrix of the distribution

Definition at line 52 of file ConditionalGaussGenerator.h.

◆ m_mu

Eigen::VectorXd m_mu
private

central values of the distribution

Definition at line 51 of file ConditionalGaussGenerator.h.

◆ m_v0norm

Eigen::VectorXd m_v0norm
private

vector which scales with dx0

Definition at line 56 of file ConditionalGaussGenerator.h.

◆ m_vBaseMat

Eigen::MatrixXd m_vBaseMat
private

transformation matrix between eigen-system of m_covMat and nominal system

Definition at line 54 of file ConditionalGaussGenerator.h.


The documentation for this class was generated from the following files: