CMS 3D CMS Logo

CaloValidationStatistics.cc
Go to the documentation of this file.
3 #include <cmath>
4 #include <iostream>
5 
7  : name_(name),
8  expectedMean_(expectedMean),
9  expectedRMS_(expectedRMS),
10  sum_(0.),
11  sumOfSquares_(0.),
12  weightedSum_(0.),
13  sumOfWeights_(0.),
14  n_(0) {}
15 
16 CaloValidationStatistics::~CaloValidationStatistics() { edm::LogInfo("CaloValidationStatistics") << *this; }
17 
19  sum_ += value;
20  sumOfSquares_ += (value * value);
23  ++n_;
24 }
25 
26 float CaloValidationStatistics::mean() const { return sum_ / n_; }
27 
29  float numerator = n_ * sumOfSquares_ - sum_ * sum_;
30  int denominator = n_ * (n_ - 1);
32 }
33 
35 
36 std::ostream &operator<<(std::ostream &os, const CaloValidationStatistics &stat) {
37  os << "OVAL " << stat.name() << " entries:" << stat.nEntries();
38  if (stat.nEntries() > 0) {
39  os << " Mean: " << stat.mean() << " (expect " << stat.expectedMean() << ")";
40  }
41  if (stat.nEntries() > 1) {
42  os << " RMS: " << stat.RMS() << " (expect " << stat.expectedRMS() << ")";
43  }
44  return os;
45 }
Definition: weight.py:1
std::ostream & operator<<(std::ostream &os, const CaloValidationStatistics &stat)
T sqrt(T t)
Definition: SSEVec.h:19
~CaloValidationStatistics()
prints to LogInfo upon destruction
Definition: value.py:1
Log< level::Info, false > LogInfo
void addEntry(float value, float weight=1.)
CaloValidationStatistics(std::string name, float expectedMean, float expectedRMS)