CMS 3D CMS Logo

GaussianSumUtilities1D.h

Go to the documentation of this file.
00001 #ifndef GaussianSumUtilities1D_h_
00002 #define GaussianSumUtilities1D_h_
00003 
00004 // #include "TROOT.h"
00005 
00006 #include "TrackingTools/GsfTools/interface/SingleGaussianState1D.h"
00007 #include "TrackingTools/GsfTools/interface/MultiGaussianState1D.h"
00008 
00009 #include <vector>
00010 
00016 class GaussianSumUtilities1D {
00017 private:
00018   enum ModeStatus { Valid, NotValid, NotComputed };
00019 
00020 public:
00021   GaussianSumUtilities1D (const MultiGaussianState1D& state) :
00022     theState(state),
00023 //     theStates(state.components()),
00024     theModeStatus(NotComputed) {} 
00025   ~GaussianSumUtilities1D () {}
00026 
00028   inline unsigned int size () const {return components().size();}
00030   inline const std::vector<SingleGaussianState1D>& components () const {
00031     return theState.components();
00032   }
00034   inline double weight (unsigned int i) const {return components()[i].weight();}
00036   inline double mean (unsigned int i) const {return components()[i].mean();}
00038   inline double standardDeviation (unsigned int i) const {
00039     return sqrt(components()[i].variance());
00040   }
00042   inline double variance (unsigned int i) const {return components()[i].variance();}
00044   double quantile (const double) const;
00046   bool modeIsValid () const;
00049   const SingleGaussianState1D& mode () const;
00051   double pdf (const double&) const;
00053   double cdf (const double&) const;
00055   double d1Pdf (const double&) const;
00057   double d2Pdf (const double&) const;
00059   double d3Pdf (const double&) const;
00061   double lnPdf (const double&) const;
00063   double d1LnPdf (const double&) const;
00065   double d2LnPdf (const double&) const;
00066 
00068   double weight () const {
00069     return theState.weight();
00070   }
00072   double mean () const {
00073     return theState.mean();
00074   }
00076   double variance () const {
00077     return theState.variance();
00078   }
00079 
00080 private:
00084   bool findMode (double& mode, double& pdfAtMode, 
00085                  const double& xStart, const double& scale) const;
00087   double gauss (const double&, const double&, const double&) const;
00089   double gaussInt (const double&, const double&, const double&) const;
00091   double combinedMean() const;
00093   void computeMode () const;
00096   double localVariance (const double& x) const;
00097 
00099   std::vector<double> pdfComponents (const double&) const;
00101   double pdf (const double&, const std::vector<double>&) const;
00103   double d1Pdf (const double&, const std::vector<double>&) const;
00105   double d2Pdf (const double&, const std::vector<double>&) const;
00107   double d3Pdf (const double&, const std::vector<double>&) const;
00109   double lnPdf (const double&, const std::vector<double>&) const;
00111   double d1LnPdf (const double&, const std::vector<double>&) const;
00113   double d2LnPdf (const double&, const std::vector<double>&) const;
00114 
00115 private:
00116   const MultiGaussianState1D& theState;
00117 //   std::vector<SingleGaussianState1D> theStates;
00118 
00119   mutable ModeStatus theModeStatus;
00120   mutable SingleGaussianState1D theMode;
00121 //   mutable double theMode;
00122 };
00123 #endif

Generated on Tue Jun 9 17:48:18 2009 for CMSSW by  doxygen 1.5.4