/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Private Attributes
DayaBay::SimStatistic Class Reference

Simple class that describes a single statistical parameter. More...

#include <SimStatistic.h>

List of all members.

Public Member Functions

 SimStatistic ()
 Default Constructor.
virtual ~SimStatistic ()
 Default Destructor.
double mean () const
 Get the average.
double rms () const
 Get the root-mean-square of the distribution.
void increment (double x)
 Add an entry.
SimStatisticoperator+= (const DayaBay::SimStatistic &rhs)
 Addition operator.
SimStatistic operator+ (const DayaBay::SimStatistic &rhs) const
 Addition operator.
std::ostream & fillStream (std::ostream &s) const
 Print the collection.
double count () const
 Retrieve const Number of times this stat has been incremented.
void setCount (double value)
 Update Number of times this stat has been incremented.
double sum () const
 Retrieve const Total of x over all counts.
void setSum (double value)
 Update Total of x over all counts.
double squaredsum () const
 Retrieve const Total of x^2 over all counts.
void setSquaredsum (double value)
 Update Total of x^2 over all counts.

Static Public Member Functions

static void * operator new (size_t size)
 operator new
static void * operator new (size_t size, void *pObj)
 placement operator new it is needed by libstdc++ 3.2.3 (e.g.
static void operator delete (void *p)
 operator delete
static void operator delete (void *p, void *pObj)
 placement operator delete not sure if really needed, but it does not harm

Private Attributes

double m_count
 Number of times this stat has been incremented.
double m_sum
 Total of x over all counts.
double m_squaredsum
 Total of x^2 over all counts.

Detailed Description

Simple class that describes a single statistical parameter.

Author:
tagg@minos.phy.tufts.edu created Thu Dec 5 18:05:52 2013

Definition at line 42 of file SimStatistic.h.


Constructor & Destructor Documentation

DayaBay::SimStatistic::SimStatistic ( ) [inline]

Default Constructor.

Definition at line 47 of file SimStatistic.h.

                   : m_count(0),
                     m_sum(0),
                     m_squaredsum(0) {}
virtual DayaBay::SimStatistic::~SimStatistic ( ) [inline, virtual]

Default Destructor.

Definition at line 52 of file SimStatistic.h.

{}

Member Function Documentation

double DayaBay::SimStatistic::mean ( ) const [inline]

Get the average.

Definition at line 182 of file SimStatistic.h.

{

        return m_sum/m_count;
      
}
double DayaBay::SimStatistic::rms ( ) const [inline]

Get the root-mean-square of the distribution.

Definition at line 189 of file SimStatistic.h.

{

        return sqrt((m_squaredsum - m_sum*m_sum/m_count)/(m_count));
      
}
void DayaBay::SimStatistic::increment ( double  x) [inline]

Add an entry.

Definition at line 196 of file SimStatistic.h.

{

        m_count+=1.0;
        m_sum += x;
        m_squaredsum += x*x;
      
}
DayaBay::SimStatistic & DayaBay::SimStatistic::operator+= ( const DayaBay::SimStatistic rhs) [inline]

Addition operator.

Definition at line 205 of file SimStatistic.h.

{

        m_count+=rhs.m_count;
        m_sum += rhs.m_sum;
        m_squaredsum += rhs.m_squaredsum;
        return *this;
      
}
DayaBay::SimStatistic DayaBay::SimStatistic::operator+ ( const DayaBay::SimStatistic rhs) const [inline]

Addition operator.

Definition at line 215 of file SimStatistic.h.

{

        SimStatistic res;
        res.m_count = m_count + rhs.m_count;
        res.m_sum =   m_sum +   rhs.m_sum;
        res.m_squaredsum = m_squaredsum + rhs.m_squaredsum;
        return res;
      
}
std::ostream & DayaBay::SimStatistic::fillStream ( std::ostream &  s) const

Print the collection.

Definition at line 3 of file SimStatistic.cc.

{
  s << "{ " << std::endl << "    count :        " << count() 
            << std::endl << "    mean  :        " << mean() 
            << std::endl << "    rms   :        " << rms() 
            << std::endl << " }" << std::endl;
  return s;
}
double DayaBay::SimStatistic::count ( ) const [inline]

Retrieve const Number of times this stat has been incremented.

Definition at line 152 of file SimStatistic.h.

{
  return m_count;
}
void DayaBay::SimStatistic::setCount ( double  value) [inline]

Update Number of times this stat has been incremented.

Definition at line 157 of file SimStatistic.h.

{
  m_count = value;
}
double DayaBay::SimStatistic::sum ( ) const [inline]

Retrieve const Total of x over all counts.

Definition at line 162 of file SimStatistic.h.

{
  return m_sum;
}
void DayaBay::SimStatistic::setSum ( double  value) [inline]

Update Total of x over all counts.

Definition at line 167 of file SimStatistic.h.

{
  m_sum = value;
}
double DayaBay::SimStatistic::squaredsum ( ) const [inline]

Retrieve const Total of x^2 over all counts.

Definition at line 172 of file SimStatistic.h.

{
  return m_squaredsum;
}
void DayaBay::SimStatistic::setSquaredsum ( double  value) [inline]

Update Total of x^2 over all counts.

Definition at line 177 of file SimStatistic.h.

{
  m_squaredsum = value;
}
static void* DayaBay::SimStatistic::operator new ( size_t  size) [inline, static]

operator new

Definition at line 99 of file SimStatistic.h.

    {
      return ( sizeof(SimStatistic) == size ? 
               boost::singleton_pool<SimStatistic, sizeof(SimStatistic)>::malloc() :
               ::operator new(size) );
    }
static void* DayaBay::SimStatistic::operator new ( size_t  size,
void *  pObj 
) [inline, static]

placement operator new it is needed by libstdc++ 3.2.3 (e.g.

in std::vector) it is not needed in libstdc++ >= 3.4

Definition at line 109 of file SimStatistic.h.

    {
      return ::operator new (size,pObj);
    }
static void DayaBay::SimStatistic::operator delete ( void *  p) [inline, static]

operator delete

Definition at line 115 of file SimStatistic.h.

    {
      boost::singleton_pool<SimStatistic, sizeof(SimStatistic)>::is_from(p) ?
      boost::singleton_pool<SimStatistic, sizeof(SimStatistic)>::free(p) :
      ::operator delete(p);
    }
static void DayaBay::SimStatistic::operator delete ( void *  p,
void *  pObj 
) [inline, static]

placement operator delete not sure if really needed, but it does not harm

Definition at line 124 of file SimStatistic.h.

    {
      ::operator delete (p, pObj);
    }

Member Data Documentation

Number of times this stat has been incremented.

Definition at line 133 of file SimStatistic.h.

double DayaBay::SimStatistic::m_sum [private]

Total of x over all counts.

Definition at line 134 of file SimStatistic.h.

Total of x^2 over all counts.

Definition at line 135 of file SimStatistic.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:05:28 for SimEvent by doxygen 1.7.4