9 #include "Math/ProbFuncMathCore.h"
10 #include "Math/PdfFuncMathCore.h"
11 #include "Math/QuantFuncMathCore.h"
30 return ROOT::Math::gaussian_quantile(q,1.);
120 typedef std::multimap<double, int, std::greater<double> > StartMap;
122 for (
unsigned int i=0;
i<
size();
i++ ) {
123 xStart.insert(std::make_pair(
pdf(
mean(
i)),
i));
132 for ( StartMap::const_iterator
i=xStart.begin();
i!=xStart.end();
i++ ) {
145 (*i).first/(*xStart.begin()).
first<0.75 )
break;
159 if ( yRes<0. || (y-yRes)/(y+yRes)>1.
e-10 ) {
201 for (
int ic=0; ic<
s; ++ic ) {
216 const double& xStart,
217 const double&
scale)
const
227 double xmin(xStart-1.*scale);
228 double xmax(xStart+1.*scale);
239 while ( nLoop++<20 ) {
240 if ( nLoop>1 && state.
yd2<0. &&
241 ( fabs(state.
yd*scale)<1.e-10 || fabs(state.
y-y1)/(state.
y+y1)<1.e-14 ) ) {
247 double dx = -state.
yd/state.
yd2;
251 if ( state.
yd2>0. && (x2<xmin||x2>xmax) )
return false;
272 state.
yd2 = -state.
yd*state.
yd;
282 for (
unsigned int i=0;
i<
s;
i++ )
292 for (
unsigned int i=0;
i<
s;
i++ )
336 std::vector<double>
result;
337 result.reserve(
size());
338 for (
unsigned int i=0;
i<
size();
i++ )
345 PDF(
double ix) :
x(ix){}
354 if (s!=result.size()) result.resize(s);
372 return std::accumulate(pdfs.begin(),pdfs.end(),0.);
380 for (
unsigned int i=0;
i<
s;
i++ ) {
392 for (
unsigned int i=0;
i<
s;
i++ ) {
404 for (
unsigned int i=0;
i<
s;
i++ ) {
415 double f(
pdf(x,pdfs));
425 double f =
pdf(x,pdfs);
436 double f =
pdf(x,pdfs);
453 return ROOT::Math::gaussian_pdf(x,sigma,mean);
459 return ROOT::Math::normal_cdf(x,sigma,mean);
469 for (
int i=0;
i<
s;
i++ )
471 for (
int i=0;
i<
s;
i++ )
472 s1 += sgv[
i].
weight()*sgv[
i].mean();
479 std::vector<double> pdfs;
std::vector< double > pdfComponents(const double &) const
pdf components
static std::vector< std::string > checklist log
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.
double standardDeviation() const
standardDeviation
void computeMode() const
calculation of mode
U second(std::pair< T, U > const &p)
static double gaussInt(double, double, double)
Integrated value of gaussian distribution.
double mean() const
parameter vector
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
std::vector< double > pdfs
double variance() const
combined variance
double mean() const
combined mean
double weight() const
weight
double combinedMean() const
Mean value of combined state.
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
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