CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/TrackingTools/GsfTools/interface/MultiGaussianState.h

Go to the documentation of this file.
00001 #ifndef MultiGaussianState_H
00002 #define MultiGaussianState_H
00003 
00004 #include "TrackingTools/GsfTools/interface/SingleGaussianState.h"
00005 #include "boost/shared_ptr.hpp"
00006 
00007 #include <vector>
00008 
00009 // #include <iostream>
00010 // #include <signal.h>
00012 
00017 template <unsigned int N>
00018 class MultiGaussianState {
00019 public:
00020   typedef typename SingleGaussianState<N>::Vector Vector;
00021   typedef typename SingleGaussianState<N>::Matrix Matrix;
00022   typedef SingleGaussianState<N> SingleState;
00023   typedef boost::shared_ptr<SingleState> SingleStatePtr;
00024 //   typedef std::vector< boost::shared_ptr<const SingleState> > SingleStateContainer;
00025   typedef std::vector< SingleStatePtr > SingleStateContainer;
00026 
00027 public:
00028 
00029   MultiGaussianState() : theCombinedStateUp2Date(false) {
00030 //     ++instances_;++maxInstances_;
00031 //     std::cout << "MultiGaussianState() " << N << " " << instances_ << std::endl;
00032   }
00033 
00034   MultiGaussianState(const SingleStateContainer& stateV)
00035     : theComponents(stateV), theCombinedStateUp2Date(false) {
00036 //     theComponents[0]->rescaleWeight(1.);
00037 //     ++instances_;++maxInstances_;
00038 //     std::cout << "MultiGaussianState(const SingleStateContainer&) " << N << " " 
00039 //            << instances_ << std::endl;
00040   }
00041 
00042 //   MultiGaussianState(const MultiGaussianState<N>& rhs) :
00043 //     theComponents(rhs.theComponents), theCombinedState(rhs.theCombinedState),
00044 //     theCombinedStateUp2Date(rhs.theCombinedStateUp2Date) {
00045 //     ++instances_;++maxInstances_;
00046 //     std::cout << "MultiGaussianState(const MultiGaussianState<N>&) " << N << " " 
00047 //            << instances_ << std::endl;
00048 //   }
00049 
00050   ~MultiGaussianState() {
00051 //     --instances_;
00052 //     std::cout << "~MultiGaussianState " << N << " " << instances_ << std::endl;
00053   }
00054 
00055 //   /**
00056 //    * Creates a new multi-state with the given components.
00057 //    * For this base class, no information is passed from the initial
00058 //    * instance.
00059 //    */
00060 //   virtual MultiGaussianState createState(
00061 //      const std::vector<SingleGaussianState> & stateV) const {
00062 //     return MultiGaussianState(stateV);
00063 //   }
00064 
00065 //   /**
00066 //    * Creates a new single-state with the given information.
00067 //    * For this base class, no information is passed from the initial
00068 //    * instance.
00069 //    */
00070 //   virtual SingleGaussianState createSingleState (
00071 //      const AlgebraicVector & aMean, const AlgebraicSymMatrix & aCovariance,
00072 //      double aWeight = 1.) const {
00073 //     return SingleGaussianState(aMean, aCovariance, aWeight);
00074 //   }
00075 
00077   double weight() const;
00079   const Vector & mean() const;
00081   const Matrix & covariance() const;
00083   const Matrix & weightMatrix() const;
00085   inline const SingleStateContainer& components() const {return theComponents;}
00087   int dimension () const {
00088     return N;
00089   }
00091   void setWeight (double newWeight);
00093   void rescaleWeight (double scale);
00094 
00095 // protected:
00096 private:
00098   void checkCombinedState() const;
00099 
00100 //   std::vector<SingleState> theComponents;
00101 // should become a vector of pointers to const SingleState ...
00102   const SingleStateContainer theComponents;
00103   mutable SingleStatePtr theCombinedState;
00104   mutable bool theCombinedStateUp2Date;
00105 
00106 // public:
00107 //   static int instances_;
00108 //   static int maxInstances_;
00109 //   static int constructsCombinedState_;
00110 };
00111 
00112 #include "TrackingTools/GsfTools/interface/MultiGaussianState.icc"
00113 
00114 //   template <unsigned int N> int MultiGaussianState<N>::instances_ = 0;
00115 //   template <unsigned int N> int MultiGaussianState<N>::maxInstances_ = 0;
00116 //   template <unsigned int N> int MultiGaussianState<N>::constructsCombinedState_ = 0;
00117 
00118 #endif