CMS 3D CMS Logo

Public Member Functions | Private Attributes

TSinglePedEntry Class Reference

#include <TSinglePedEntry.h>

List of all members.

Public Member Functions

double average () const
 get the average of the inserted values
void insert (const int &pedestal)
 add a single value
double RMS () const
 get the RMS of the inserted values
double RMSSq () const
 get the squared RMS of the inserted values
 TSinglePedEntry (const TSinglePedEntry &orig)
 copy ctor
 TSinglePedEntry ()
 ctor
 ~TSinglePedEntry ()
 dtor

Private Attributes

int m_entries
 number of entries
int m_pedestalSqSum
 squared sum of entries
int m_pedestalSum
 sum of entries

Detailed Description

Definition at line 13 of file TSinglePedEntry.h.


Constructor & Destructor Documentation

TSinglePedEntry::TSinglePedEntry ( )

ctor

Definition at line 6 of file TSinglePedEntry.cc.

                                  : 
  m_pedestalSqSum (0),
  m_pedestalSum (0),
  m_entries (0)
{
//  std::cout << "[TSinglePedEntry][ctor]" << std::endl ;
}
TSinglePedEntry::TSinglePedEntry ( const TSinglePedEntry orig)

copy ctor

Definition at line 19 of file TSinglePedEntry.cc.

References m_entries, m_pedestalSqSum, and m_pedestalSum.

TSinglePedEntry::~TSinglePedEntry ( )

dtor

Definition at line 15 of file TSinglePedEntry.cc.

{}

Member Function Documentation

double TSinglePedEntry::average ( ) const

get the average of the inserted values

Definition at line 35 of file TSinglePedEntry.cc.

References m_entries, and m_pedestalSum.

Referenced by TPedValues::checkEntries(), TPedValues::makePlots(), and TPedValues::terminate().

{
  if (!m_entries) return -1;
  return static_cast<double>(m_pedestalSum) / m_entries ;
}
void TSinglePedEntry::insert ( const int &  pedestal)

add a single value

Definition at line 27 of file TSinglePedEntry.cc.

References m_entries, m_pedestalSqSum, and m_pedestalSum.

Referenced by TPedValues::insert().

{
  m_pedestalSqSum += pedestal * pedestal ;
  m_pedestalSum += pedestal ;
  ++m_entries ;
}
double TSinglePedEntry::RMS ( ) const

get the RMS of the inserted values

Definition at line 42 of file TSinglePedEntry.cc.

References m_entries, RMSSq(), and mathSSE::sqrt().

Referenced by TPedValues::makePlots().

{
  if (!m_entries) return -1;
  return sqrt (RMSSq ())  ;
}
double TSinglePedEntry::RMSSq ( ) const

get the squared RMS of the inserted values

Definition at line 48 of file TSinglePedEntry.cc.

References m_entries, m_pedestalSqSum, m_pedestalSum, and convertSQLitetoXML_cfg::output.

Referenced by RMS().

{
/*
  std::cout << "[TSinglePedEntry][minchia] " << m_pedestalSum
            << "\t" << m_pedestalSum
            << "\t" << m_entries << std::endl ;   // FIXME
*/            
  if (!m_entries) return -1;
  double num = 1./static_cast<double>(m_entries) ;
  double output = m_pedestalSqSum * num - m_pedestalSum * num * m_pedestalSum * num ;
  return output ;
}

Member Data Documentation

number of entries

Definition at line 40 of file TSinglePedEntry.h.

Referenced by average(), insert(), RMS(), RMSSq(), and TSinglePedEntry().

squared sum of entries

Definition at line 36 of file TSinglePedEntry.h.

Referenced by insert(), RMSSq(), and TSinglePedEntry().

sum of entries

Definition at line 38 of file TSinglePedEntry.h.

Referenced by average(), insert(), RMSSq(), and TSinglePedEntry().