Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:36

0001 #ifndef SingleGaussianState_H
0002 #define SingleGaussianState_H
0003 
0004 #define SMATRIX_USE_CONSTEXPR
0005 
0006 #include "Math/SVector.h"
0007 #include "Math/SMatrix.h"
0008 
0009 /** Multi-dimensional (single) Gaussian state. Used for the description 
0010  * of Gaussian mixtures.
0011  */
0012 
0013 template <unsigned int N>
0014 class SingleGaussianState {
0015 public:
0016   using Vector = ROOT::Math::SVector<double, N>;
0017   using Matrix = ROOT::Math::SMatrix<double, N, N, ROOT::Math::MatRepSym<double, N>>;
0018 
0019 public:
0020   SingleGaussianState() {}
0021 
0022   SingleGaussianState(const Vector& aMean, const Matrix& aCovariance, double aWeight = 1.)
0023       : theCovariance(aCovariance), theMean(aMean), theWeight(aWeight) {}
0024 
0025   /// weight
0026   inline double weight() const { return theWeight; }
0027   /// parameter vector
0028   inline const Vector& mean() const { return theMean; }
0029   /// covariance matrix
0030   inline const Matrix& covariance() const { return theCovariance; }
0031   /// weight matrix
0032   const Matrix& weightMatrix() const;
0033   /// size of parameter vector
0034   inline unsigned int dimension() const { return N; }
0035   /// change weight
0036   void rescaleWeight(double scale) { theWeight *= scale; }
0037 
0038 private:
0039   Matrix theCovariance;
0040   Vector theMean;
0041   double theWeight;
0042 
0043   mutable Matrix theWeightMatrix = ROOT::Math::SMatrixNoInit();
0044   mutable bool theHasWeightMatrix = false;
0045 };
0046 
0047 #include "TrackingTools/GsfTools/interface/SingleGaussianState.icc"
0048 
0049 #endif