RandomMultiGauss

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#ifndef _CommonDet_RandomMultiGauss_H_
#define _CommonDet_RandomMultiGauss_H_

#include "DataFormats/CLHEP/interface/AlgebraicObjects.h"

/** \class RandomMultiGauss
 * Vector of random numbers according to covariance matrix.
 * Generates vectors of random numbers given a vector of
 * mean values (optional) and a covariance matrix.
 * Will accept empty rows/columns in the input matrix.
 * Uses CLHEP::RandGauss with default engine for generation.
 */

class RandomMultiGauss {
public:
  /** constructor with explicit vector of mean values
   */
  RandomMultiGauss(const AlgebraicVector& aVector, const AlgebraicSymMatrix& aMatrix);
  /** constructor with covariance matrix only (all means = 0)
   */
  RandomMultiGauss(const AlgebraicSymMatrix& aMatrix);
  // destructor
  ~RandomMultiGauss() {}
  /** Generation of a vector of random numbers.
   */
  AlgebraicVector fire();

private:
  /** generation of the cholesky decomposition
   */
  void initialise(const AlgebraicSymMatrix&);

private:
  int theSize;
  AlgebraicVector theMeans;
  AlgebraicMatrix theTriangle;
};

#endif