CMS 3D CMS Logo

Functions
simple_stat.h File Reference
#include <algorithm>
#include <numeric>
#include <cmath>

Go to the source code of this file.

Functions

template<class CONT >
double stat_mean (const CONT &cont)
 
template<class CONT >
double stat_RMS (const CONT &cont)
 

Function Documentation

◆ stat_mean()

template<class CONT >
double stat_mean ( const CONT &  cont)

A trivial class computing the mean value of objects in any STL container.

Definition at line 13 of file simple_stat.h.

13  {
14  double sum = accumulate(cont.begin(), cont.end(), 0.);
15  return sum / cont.size();
16 }

References generateEDF::cont.

Referenced by TIBRing::checkPeriodicity().

◆ stat_RMS()

template<class CONT >
double stat_RMS ( const CONT &  cont)

A simple class computing the R.M.S. of objects in any STL container.

Definition at line 23 of file simple_stat.h.

23  {
24  typename CONT::const_iterator i;
25 
26  int N = cont.size();
27  if (N > 1) {
28  double sum = 0., sum2 = 0.;
29  for (i = cont.begin(); i != cont.end(); i++) {
30  sum += *i;
31  sum2 += (*i) * (*i);
32  }
33  return sqrt(std::max(0., (sum2 - sum * sum / N) / (N - 1)));
34  } else
35  return 0.;
36 }

References generateEDF::cont, mps_fire::i, SiStripPI::max, N, mathSSE::sqrt(), and combinedConstraintHelpers::sum2().

Referenced by PhiBorderFinder::PhiBorderFinder(), and RBorderFinder::RBorderFinder().

mps_fire.i
i
Definition: mps_fire.py:428
generateEDF.cont
cont
load Luminosity info ##
Definition: generateEDF.py:628
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
N
#define N
Definition: blowfish.cc:9
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
combinedConstraintHelpers::sum2
void sum2(T &x, T y)
Definition: CombinedKinematicConstraintT.h:74