CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GSUtilities.h
Go to the documentation of this file.
1 #ifndef GSUtilities_h
2 #define GSUtilities_h
3 
8 class GSUtilities {
9 public:
11  GSUtilities (const unsigned nComp, const float* weights,
12  const float* parameters, const float* errors) :
13  theNComp(nComp),
14  theWeights(0),
15  theParameters(0),
16  theErrors(0)
17  {
18  if ( theNComp ) {
19  theWeights = new float[theNComp];
20  theParameters = new float[theNComp];
21  theErrors = new float[theNComp];
22  }
23  const float* wPtr1(weights);
24  const float* pPtr1(parameters);
25  const float* ePtr1(errors);
26  float* wPtr2(theWeights);
27  float* pPtr2(theParameters);
28  float* ePtr2(theErrors);
29  for ( unsigned i=0; i<theNComp; i++ ) {
30  *(wPtr2++) = weights ? *(wPtr1++) : 1.;
31  *(pPtr2++) = *(pPtr1++);
32  *(ePtr2++) = *(ePtr1++);
33  }
34  }
36  {
37  delete [] theWeights;
38  delete [] theParameters;
39  delete [] theErrors;
40  }
44  float quantile (const float) const;
46  float mode () const;
48  double pdf (const double&) const;
50  double cdf (const double&) const;
52  double dpdf1 (const double&) const;
54  double dpdf2 (const double&) const;
55 
57  double combinedMean() const;
58  // mean value of errors
59  double errorCombinedMean() const;
60  // error for the highest weight
61  float errorHighestWeight() const;
62  // max weight component - chiara
63  float maxWeight() const;
64  // mode error + some utilities functions
65  float errorMode();
66  float getMax(float);
67  float getMin(float);
68 
69 private:
71  double gauss (const double&, const double&, const double&) const;
73  double gaussInt (const double&, const double&, const double&) const;
77  double findMode (const double) const;
78 
79 private:
80  unsigned theNComp;
81  float* theWeights;
82  float* theParameters;
83  float* theErrors;
84 };
85 #endif
float mode() const
mode
Definition: GSUtilities.cc:88
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
float getMax(float)
Definition: GSUtilities.cc:291
float quantile(const float) const
Definition: GSUtilities.cc:12
double errorCombinedMean() const
Definition: GSUtilities.cc:222
double cdf(const double &) const
value of integral(pdf)
Definition: GSUtilities.cc:157
double findMode(const double) const
Definition: GSUtilities.cc:122
unsigned theNComp
Definition: GSUtilities.h:80
double gaussInt(const double &, const double &, const double &) const
integrated value of gaussian distribution
Definition: GSUtilities.cc:203
GSUtilities(const unsigned nComp, const float *weights, const float *parameters, const float *errors)
constructor from arrays of weights, parameters and standard deviations
Definition: GSUtilities.h:11
float * theErrors
Definition: GSUtilities.h:83
float errorMode()
Definition: GSUtilities.cc:249
float * theWeights
Definition: GSUtilities.h:81
double pdf(const double &) const
value of the pdf
Definition: GSUtilities.cc:148
double dpdf2(const double &) const
second derivative of pdf
Definition: GSUtilities.cc:178
float errorHighestWeight() const
Definition: GSUtilities.cc:73
float getMin(float)
Definition: GSUtilities.cc:278
float * theParameters
Definition: GSUtilities.h:82
double combinedMean() const
mean value of combined state
Definition: GSUtilities.cc:210
float maxWeight() const
Definition: GSUtilities.cc:232
double dpdf1(const double &) const
first derivative of pdf
Definition: GSUtilities.cc:166
double gauss(const double &, const double &, const double &) const
value of gaussian distribution
Definition: GSUtilities.cc:190