Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:06

0001 #ifndef _CommonDet_RandomMultiGauss_H_
0002 #define _CommonDet_RandomMultiGauss_H_
0003 
0004 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h"
0005 
0006 /** \class RandomMultiGauss
0007  * Vector of random numbers according to covariance matrix.
0008  * Generates vectors of random numbers given a vector of
0009  * mean values (optional) and a covariance matrix.
0010  * Will accept empty rows/columns in the input matrix.
0011  * Uses CLHEP::RandGauss with default engine for generation.
0012  */
0013 
0014 class RandomMultiGauss {
0015 public:
0016   /** constructor with explicit vector of mean values
0017    */
0018   RandomMultiGauss(const AlgebraicVector& aVector, const AlgebraicSymMatrix& aMatrix);
0019   /** constructor with covariance matrix only (all means = 0)
0020    */
0021   RandomMultiGauss(const AlgebraicSymMatrix& aMatrix);
0022   // destructor
0023   ~RandomMultiGauss() {}
0024   /** Generation of a vector of random numbers.
0025    */
0026   AlgebraicVector fire();
0027 
0028 private:
0029   /** generation of the cholesky decomposition
0030    */
0031   void initialise(const AlgebraicSymMatrix&);
0032 
0033 private:
0034   int theSize;
0035   AlgebraicVector theMeans;
0036   AlgebraicMatrix theTriangle;
0037 };
0038 
0039 #endif