CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TSinglePedEntry.cc
Go to the documentation of this file.
1 
3 #include <cmath>
4 #include <iostream>
5 
6 TSinglePedEntry::TSinglePedEntry() : m_pedestalSqSum(0), m_pedestalSum(0), m_entries(0) {
7  // std::cout << "[TSinglePedEntry][ctor]" << std::endl ;
8 }
9 
11 
15  m_entries = orig.m_entries;
16 }
17 
21  ++m_entries;
22 }
23 
24 double TSinglePedEntry::average() const {
25  if (!m_entries)
26  return -1;
27  return static_cast<double>(m_pedestalSum) / m_entries;
28 }
29 
30 double TSinglePedEntry::RMS() const {
31  if (!m_entries)
32  return -1;
33  return sqrt(RMSSq());
34 }
35 
36 double TSinglePedEntry::RMSSq() const {
37  /*
38  std::cout << "[TSinglePedEntry][minchia] " << m_pedestalSum
39  << "\t" << m_pedestalSum
40  << "\t" << m_entries << std::endl ; // FIXME
41  */
42  if (!m_entries)
43  return -1;
44  double num = 1. / static_cast<double>(m_entries);
46  return output;
47 }
double RMS() const
get the RMS of the inserted values
double RMSSq() const
get the squared RMS of the inserted values
int m_pedestalSqSum
squared sum of entries
T sqrt(T t)
Definition: SSEVec.h:19
Transient container for a single entry in pedestal offset studies.
int m_entries
number of entries
double average() const
get the average of the inserted values
Definition: output.py:1
int m_pedestalSum
sum of entries
void insert(const int &pedestal)
add a single value