CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MultiGaussianState.h
Go to the documentation of this file.
1 #ifndef MultiGaussianState_H
2 #define MultiGaussianState_H
3 
5 #include <memory>
6 
7 #include <vector>
8 
9 // #include <iostream>
10 // #include <signal.h>
12 
17 template <unsigned int N>
19 public:
23  typedef std::shared_ptr<SingleState> SingleStatePtr;
24  // typedef std::vector< std::shared_ptr<const SingleState> > SingleStateContainer;
25  typedef std::vector<SingleStatePtr> SingleStateContainer;
26 
27 public:
29  // ++instances_;++maxInstances_;
30  // std::cout << "MultiGaussianState() " << N << " " << instances_ << std::endl;
31  }
32 
34  // theComponents[0]->rescaleWeight(1.);
35  // ++instances_;++maxInstances_;
36  // std::cout << "MultiGaussianState(const SingleStateContainer&) " << N << " "
37  // << instances_ << std::endl;
38  }
39 
40  // MultiGaussianState(const MultiGaussianState<N>& rhs) :
41  // theComponents(rhs.theComponents), theCombinedState(rhs.theCombinedState),
42  // theCombinedStateUp2Date(rhs.theCombinedStateUp2Date) {
43  // ++instances_;++maxInstances_;
44  // std::cout << "MultiGaussianState(const MultiGaussianState<N>&) " << N << " "
45  // << instances_ << std::endl;
46  // }
47 
49  // --instances_;
50  // std::cout << "~MultiGaussianState " << N << " " << instances_ << std::endl;
51  }
52 
53  // /**
54  // * Creates a new multi-state with the given components.
55  // * For this base class, no information is passed from the initial
56  // * instance.
57  // */
58  // virtual MultiGaussianState createState(
59  // const std::vector<SingleGaussianState> & stateV) const {
60  // return MultiGaussianState(stateV);
61  // }
62 
63  // /**
64  // * Creates a new single-state with the given information.
65  // * For this base class, no information is passed from the initial
66  // * instance.
67  // */
68  // virtual SingleGaussianState createSingleState (
69  // const AlgebraicVector & aMean, const AlgebraicSymMatrix & aCovariance,
70  // double aWeight = 1.) const {
71  // return SingleGaussianState(aMean, aCovariance, aWeight);
72  // }
73 
75  double weight() const;
77  const Vector& mean() const;
79  const Matrix& covariance() const;
81  const Matrix& weightMatrix() const;
83  inline const SingleStateContainer& components() const { return theComponents; }
85  int dimension() const { return N; }
87  void setWeight(double newWeight);
89  void rescaleWeight(double scale);
90 
91  // protected:
92 private:
94  void checkCombinedState() const;
95 
96  // std::vector<SingleState> theComponents;
97  // should become a vector of pointers to const SingleState ...
101 
102  // public:
103  // static int instances_;
104  // static int maxInstances_;
105  // static int constructsCombinedState_;
106 };
107 
114 //NOTE: Circular dependency between MultiGaussianState and
115 // MultiGaussianStateCombiner requires they be in the same
116 // headerfile
117 
118 template <unsigned int N>
120 private:
125 
126 public:
127  // typedef std::vector<SingleState> VSC;
128 
129  SingleStatePtr combine(const MultiState& theState) const;
130  SingleStatePtr combine(const VSC& theComponents) const;
131 };
132 
133 #include "TrackingTools/GsfTools/interface/MultiGaussianStateCombiner.icc"
134 #include "TrackingTools/GsfTools/interface/MultiGaussianState.icc"
135 
136 // template <unsigned int N> int MultiGaussianState<N>::instances_ = 0;
137 // template <unsigned int N> int MultiGaussianState<N>::maxInstances_ = 0;
138 // template <unsigned int N> int MultiGaussianState<N>::constructsCombinedState_ = 0;
139 
140 #endif
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
const SingleStateContainer & components() const
access to components (single Gaussian states)
const Matrix & covariance() const
combined covariance matrix
const SingleStateContainer theComponents
Mixture of multi-variate gaussian states.
MultiGaussianState(const SingleStateContainer &stateV)
ROOT::Math::SVector< double, N > Vector
std::vector< SingleStatePtr > SingleStateContainer
void checkCombinedState() const
calculation of the combined state (on demand)
SingleStatePtr combine(const MultiState &theState) const
SingleStatePtr theCombinedState
const Vector & mean() const
combined mean
SingleGaussianState< N > SingleState
MultiGaussianState< N > MultiState
ROOT::Math::SMatrix< double, N, N, ROOT::Math::MatRepSym< double, N >> Matrix
std::shared_ptr< SingleState > SingleStatePtr
MultiGaussianState< N >::SingleStatePtr SingleStatePtr
const Matrix & weightMatrix() const
combined weight matrix
#define N
Definition: blowfish.cc:9
void rescaleWeight(double scale)
rescale weight
SingleGaussianState< N > SingleState
MultiGaussianState< N >::SingleStateContainer VSC
double weight() const
combined weight
SingleGaussianState< N >::Vector Vector
SingleGaussianState< N >::Matrix Matrix
void setWeight(double newWeight)
renormalize weight
int dimension() const
dimension of parameter vector