Belle II Software  release-08-01-10
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 More...
 
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.

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

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