12#include <Math/Vector3D.h>
16#include <TMatrixTBase.h>
86 Eigen::VectorXd x(
m_mean.rows());
87 for (
int i = 0; i <
m_mean.rows(); ++i) x(i) = gRandom->Gaus();
103 for (
int i = 0; i < x.rows(); ++i) { output[i] = x(i); }
115 TVector3 output(0, 0, 0);
116 for (
unsigned int i = 0; i < std::min(3u, (
unsigned int)
size()); ++i) {
128 TVectorD output(x.rows());
129 output.SetElements(x.data());
142 bool setMeanCov(
int n,
const double* mean,
const double* cov);
149 bool setMeanCov(
const Eigen::VectorXd& mean,
const Eigen::MatrixXd& cov);
157 template<
class value_type>
bool setMeanCov(
const TVectorT<value_type>& mean,
158 const TMatrixTBase<value_type>& cov);
165 template<
class value_type>
bool setMeanCov(
const ROOT::Math::XYZVector& mean,
166 const TMatrixTBase<value_type>& cov);
177 const TVectorT<value_type>& mean,
const TMatrixTBase<value_type>& cov)
179 Eigen::VectorXd emean(mean.GetNrows());
180 Eigen::MatrixXd ecov(cov.GetNrows(), cov.GetNcols());
181 for (
int i = 0; i < mean.GetNrows(); ++i) { emean(i) = mean(i); }
182 for (
int i = 0; i < cov.GetNrows(); ++i) {
183 for (
int j = 0; j < cov.GetNcols(); ++j) {
184 ecov(i, j) = cov(i, j);
191 const ROOT::Math::XYZVector& mean,
const TMatrixTBase<value_type>& cov)
193 TVectorT<value_type> tmean(3);
Class to generate normal distributed, correlated random numbers given the mean values and the covaria...
size_t size() const
Return the number of elements to be generated on generate()
MultivariateNormalGenerator(const Eigen::VectorXd &mean, const Eigen::MatrixXd &cov)
constructor with Eigen matrix interface.
void generate(double *output) const
Generate a set of correlated random numbers with the previouly set mean and covariance and store them...
MultivariateNormalGenerator(int n, const double *mean, const double *cov)
constructor with array interface: mean and covariance are passed as double arrays where the covarianc...
Eigen::VectorXd m_mean
Member to store the mean values of the distribution.
bool setMeanCov(int n, const double *mean, const double *cov)
set the mean and covariance for the distribution with array interface: mean and covariance are passed...
Eigen::VectorXd generate() const
Generate a set of correlated random numbers with the previouly set mean and covariance.
MultivariateNormalGenerator()
default constructor to allow later initialization
void reset()
reset the generator setting the size to 0.
TVectorD generateVecT() const
Generate a set of correlated random numbers with the previouly set mean and covariance and return a T...
Eigen::MatrixXd m_transform
Member to store the transformation matrix for standard normal distributed random values.
TVector3 generateVec3() const
Generate a set of correlated random numbers with the previouly set mean and covariance and return a T...
Abstract base class for different kinds of events.