CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GaussianSumUtilities1D.h
Go to the documentation of this file.
1 #ifndef GaussianSumUtilities1D_h_
2 #define GaussianSumUtilities1D_h_
3 
4 // #include "TROOT.h"
5 
8 
9 #include <vector>
10 
17 private:
19 
20 public:
22  theState(state),
23 // theStates(state.components()),
26 
28  inline unsigned int size () const {return components().size();}
30  inline const std::vector<SingleGaussianState1D>& components () const {
31  return theState.components();
32  }
34  inline double weight (unsigned int i) const {return components()[i].weight();}
36  inline double mean (unsigned int i) const {return components()[i].mean();}
38  inline double standardDeviation (unsigned int i) const {
39 // return sqrt(components()[i].variance());
40  return components()[i].standardDeviation();
41  }
43  inline double variance (unsigned int i) const {return components()[i].variance();}
45  double pdf(unsigned int i, double x) const;
47  double quantile (const double) const;
49  bool modeIsValid () const;
52  const SingleGaussianState1D& mode () const;
54  double pdf (double) const;
56  double cdf (const double&) const;
58  double d1Pdf (const double&) const;
60  double d2Pdf (const double&) const;
62  double d3Pdf (const double&) const;
64  double lnPdf (const double&) const;
66  double d1LnPdf (const double&) const;
68  double d2LnPdf (const double&) const;
69 
71  double weight () const {
72  return theState.weight();
73  }
75  double mean () const {
76  return theState.mean();
77  }
79  double variance () const {
80  return theState.variance();
81  }
82 
83 private:
87  bool findMode (double& mode, double& pdfAtMode,
88  const double& xStart, const double& scale) const;
90  static double gauss (double, double, double);
92  static double gaussInt (double, double, double);
94  double combinedMean() const;
96  void computeMode () const;
99  double localVariance (double x) const;
100 
101  // the state of the mode finder
102  struct FinderState {
104  FinderState(size_t n): pdfs(n){}
105  double x;
106  double y;
107  double yd; // d1LnPdf
108  double yd2; // d2LnPdf
109  std::vector<double> pdfs;
110  };
111 
112  // update tre state at x
113  void update(FinderState & state, double x) const;
114 
116  std::vector<double> pdfComponents (const double&) const;
118  void pdfComponents (double, std::vector<double> & ) const;
120  static double pdf (double, const std::vector<double>&);
122  double d1Pdf (double, const std::vector<double>&) const;
124  double d2Pdf (double, const std::vector<double>&) const;
126  double d3Pdf (double, const std::vector<double>&) const;
128  static double lnPdf (double, const std::vector<double>&);
130  double d1LnPdf (double, const std::vector<double>&) const;
132  double d2LnPdf (double, const std::vector<double>&) const;
133 
134 private:
136 // std::vector<SingleGaussianState1D> theStates;
137 
140 // mutable double theMode;
141 };
142 #endif
std::vector< double > pdfComponents(const double &) const
pdf components
int i
Definition: DBlmapReader.cc:9
double weight() const
combined weight
const MultiGaussianState1D & theState
double d2Pdf(const double &) const
second derivative of the p.d.f.
double d3Pdf(const double &) const
third derivative of the p.d.f.
double mean() const
combined mean
double weight() const
combined weight
static double gauss(double, double, double)
Value of gaussian distribution.
SingleGaussianState1D theMode
bool findMode(double &mode, double &pdfAtMode, const double &xStart, const double &scale) const
unsigned int size() const
number of components
double d1Pdf(const double &) const
first derivative of the p.d.f.
void computeMode() const
calculation of mode
static double gaussInt(double, double, double)
Integrated value of gaussian distribution.
double weight(unsigned int i) const
weight of a component
GaussianSumUtilities1D(const MultiGaussianState1D &state)
double variance() const
combined covariance
const SingleGaussianState1D & mode() const
double quantile(const double) const
Quantile (i.e. x for a given value of the c.d.f.)
double pdf(unsigned int i, double x) const
pdf of a single component at x
double variance() const
combined variance
double mean() const
combined mean
double mean(unsigned int i) const
mean value of a component
double variance(unsigned int i) const
variance of a component
char state
Definition: procUtils.cc:75
double combinedMean() const
Mean value of combined state.
const SingleState1dContainer & components() const
access to components
double d2LnPdf(const double &) const
second derivative of ln(pdf)
double localVariance(double x) const
double standardDeviation(unsigned int i) const
standard deviation of a component
Definition: DDAxes.h:10
double lnPdf(const double &) const
ln(pdf)
void update(FinderState &state, double x) const
double cdf(const double &) const
value of the c.d.f.
double d1LnPdf(const double &) const
first derivative of ln(pdf)
const std::vector< SingleGaussianState1D > & components() const
components
bool modeIsValid() const
mode status