CMS 3D CMS Logo

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:
28  MultiGaussianState() : theCombinedStateUp2Date(false) {
29  // ++instances_;++maxInstances_;
30  // std::cout << "MultiGaussianState() " << N << " " << instances_ << std::endl;
31  }
32 
33  MultiGaussianState(const SingleStateContainer& stateV) : theComponents(stateV), theCombinedStateUp2Date(false) {
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 ...
98  const SingleStateContainer theComponents;
99  mutable SingleStatePtr theCombinedState;
100  mutable bool theCombinedStateUp2Date;
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
pat::helper::ParametrizationHelper::dimension
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
Definition: ParametrizationHelper.h:12
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
funct::false
false
Definition: Factorize.h:34
MultiGaussianState::~MultiGaussianState
~MultiGaussianState()
Definition: MultiGaussianState.h:48
MultiGaussianStateCombiner::MultiState
MultiGaussianState< N > MultiState
Definition: MultiGaussianState.h:122
mps_merge.weight
weight
Definition: mps_merge.py:88
MultiGaussianStateCombiner::SingleState
SingleGaussianState< N > SingleState
Definition: MultiGaussianState.h:121
MultiGaussianState
Mixture of multi-variate gaussian states.
Definition: MultiGaussianState.h:18
Vector
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
MultiGaussianState::MultiGaussianState
MultiGaussianState(const SingleStateContainer &stateV)
Definition: MultiGaussianState.h:33
N
#define N
Definition: blowfish.cc:9
SingleGaussianState::Matrix
ROOT::Math::SMatrix< double, N, N, ROOT::Math::MatRepSym< double, N > > Matrix
Definition: SingleGaussianState.h:17
SingleGaussianState
Definition: SingleGaussianState.h:14
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
MultiGaussianState::SingleStatePtr
std::shared_ptr< SingleState > SingleStatePtr
Definition: MultiGaussianState.h:23
MultiGaussianState::Vector
SingleGaussianState< N >::Vector Vector
Definition: MultiGaussianState.h:20
SingleGaussianState::Vector
ROOT::Math::SVector< double, N > Vector
Definition: SingleGaussianState.h:16
MultiGaussianStateCombiner::VSC
MultiGaussianState< N >::SingleStateContainer VSC
Definition: MultiGaussianState.h:124
MultiGaussianState::Matrix
SingleGaussianState< N >::Matrix Matrix
Definition: MultiGaussianState.h:21
makeMuonMisalignmentScenario.components
string components
Definition: makeMuonMisalignmentScenario.py:58
MultiGaussianStateCombiner::combine
SingleStatePtr combine(const MultiState &theState) const
MultiGaussianState::SingleState
SingleGaussianState< N > SingleState
Definition: MultiGaussianState.h:22
MultiGaussianState::SingleStateContainer
std::vector< SingleStatePtr > SingleStateContainer
Definition: MultiGaussianState.h:25
MultiGaussianStateCombiner::SingleStatePtr
MultiGaussianState< N >::SingleStatePtr SingleStatePtr
Definition: MultiGaussianState.h:123
MultiGaussianState::MultiGaussianState
MultiGaussianState()
Definition: MultiGaussianState.h:28
SingleGaussianState.h
MultiGaussianStateCombiner
Definition: MultiGaussianState.h:119