CMS 3D CMS Logo

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, const float* parameters, const float* errors)
12  : theNComp(nComp), theWeights(nullptr), theParameters(nullptr), theErrors(nullptr) {
13  if (theNComp) {
14  theWeights = new float[theNComp];
15  theParameters = new float[theNComp];
16  theErrors = new float[theNComp];
17  }
18  const float* wPtr1(weights);
19  const float* pPtr1(parameters);
20  const float* ePtr1(errors);
21  float* wPtr2(theWeights);
22  float* pPtr2(theParameters);
23  float* ePtr2(theErrors);
24  for (unsigned i = 0; i < theNComp; i++) {
25  *(wPtr2++) = weights ? *(wPtr1++) : 1.;
26  *(pPtr2++) = *(pPtr1++);
27  *(ePtr2++) = *(ePtr1++);
28  }
29  }
31  delete[] theWeights;
32  delete[] theParameters;
33  delete[] theErrors;
34  }
38  float quantile(const float) const;
40  float mode() const;
42  double pdf(const double&) const;
44  double cdf(const double&) const;
46  double dpdf1(const double&) const;
48  double dpdf2(const double&) const;
49 
51  double combinedMean() const;
52  // mean value of errors
53  double errorCombinedMean() const;
54  // error for the highest weight
55  float errorHighestWeight() const;
56  // max weight component - chiara
57  float maxWeight() const;
58  // mode error + some utilities functions
59  float errorMode();
60  float getMax(float);
61  float getMin(float);
62 
63 private:
65  double gauss(const double&, const double&, const double&) const;
67  double gaussInt(const double&, const double&, const double&) const;
71  double findMode(const double) const;
72 
73 private:
74  unsigned theNComp;
75  float* theWeights;
76  float* theParameters;
77  float* theErrors;
78 };
79 #endif
GSUtilities::getMax
float getMax(float)
Definition: GSUtilities.cc:262
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
mps_fire.i
i
Definition: mps_fire.py:428
GSUtilities::cdf
double cdf(const double &) const
value of integral(pdf)
Definition: GSUtilities.cc:147
GSUtilities::gauss
double gauss(const double &, const double &, const double &) const
value of gaussian distribution
Definition: GSUtilities.cc:172
GSUtilities::errorHighestWeight
float errorHighestWeight() const
Definition: GSUtilities.cc:71
GSUtilities::findMode
double findMode(const double) const
Definition: GSUtilities.cc:113
GSUtilities::GSUtilities
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
GSUtilities::quantile
float quantile(const float) const
Definition: GSUtilities.cc:11
GSUtilities::combinedMean
double combinedMean() const
mean value of combined state
Definition: GSUtilities.cc:187
GSUtilities::theNComp
unsigned theNComp
Definition: GSUtilities.h:74
errors
Definition: errors.py:1
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99178
GSUtilities::theErrors
float * theErrors
Definition: GSUtilities.h:77
GSUtilities::errorMode
float errorMode()
Definition: GSUtilities.cc:219
GSUtilities::theWeights
float * theWeights
Definition: GSUtilities.h:75
GSUtilities::getMin
float getMin(float)
Definition: GSUtilities.cc:248
GSUtilities::maxWeight
float maxWeight() const
Definition: GSUtilities.cc:205
GSUtilities::dpdf1
double dpdf1(const double &) const
first derivative of pdf
Definition: GSUtilities.cc:154
GSUtilities::mode
float mode() const
mode
Definition: GSUtilities.cc:83
GSUtilities::dpdf2
double dpdf2(const double &) const
second derivative of pdf
Definition: GSUtilities.cc:163
GSUtilities
Definition: GSUtilities.h:8
GSUtilities::theParameters
float * theParameters
Definition: GSUtilities.h:76
GSUtilities::pdf
double pdf(const double &) const
value of the pdf
Definition: GSUtilities.cc:140
GSUtilities::~GSUtilities
~GSUtilities()
Definition: GSUtilities.h:30
GSUtilities::gaussInt
double gaussInt(const double &, const double &, const double &) const
integrated value of gaussian distribution
Definition: GSUtilities.cc:183
GSUtilities::errorCombinedMean
double errorCombinedMean() const
Definition: GSUtilities.cc:197