StatEntity Class Referencefinal

The basic counter used for Monitoring purposes. More...

#include <GaudiKernel/StatEntity.h>

Collaboration diagram for StatEntity:

Public Member Functions

 StatEntity ()
 the default constructor More...
 
 StatEntity (const unsigned long entries, const double flag, const double flag2, const double minFlag, const double maxFlag)
 
 StatEntity (const StatEntity &)
 copy constructor More...
 
StatEntityoperator= (const StatEntity &)
 assignment operator More...
 
 ~StatEntity ()=default
 destructor More...
 
const unsigned long & nEntries () const
 getters More...
 
const double & sum () const
 accumulated value More...
 
const double & sum2 () const
 accumulated value**2 More...
 
double mean () const
 mean value of counter More...
 
double rms () const
 r.m.s of value More...
 
double meanErr () const
 error in mean value of counter More...
 
const double & min () const
 minimal value More...
 
const double & max () const
 maximal value More...
 
double efficiency () const
 Interpret the counter as some measure of efficiency The efficiency is calculated as the ratio of the weight over the number of entries One gets the correct interpretation in the case of filling the counters only with 0 and 1. More...
 
double efficiencyErr () const
 Interpret the counter as some measure of efficiency and evaluate the uncertainty of this efficiency using binomial estimate. More...
 
double eff () const
 shortcut, More...
 
double effErr () const
 shortcut, More...
 
StatEntityoperator+= (const double f)
 General increment operator for the flag Could be used for easy manipulation with StatEntity object: More...
 
StatEntityoperator++ ()
 Pre-increment operator for the flag Could be used for easy manipulation with StatEntity object: More...
 
StatEntityoperator++ (int)
 Post-increment operator for the flag. More...
 
StatEntityoperator-= (const double f)
 General decrement operator for the flag Could be used for easy manipulation with StatEntity object: More...
 
StatEntityoperator-- ()
 Pre-decrement operator for the flag Could be used for easy manipulation with StatEntity object: More...
 
StatEntityoperator-- (int)
 Post-decrement operator for the flag Could be used for easy manipulation with StatEntity object: More...
 
StatEntityoperator= (const double f)
 Assignment from the flag The action: reset and the general increment Such case could be useful for statistical monitoring. More...
 
StatEntityoperator+= (const StatEntity &other)
 increment with other counter (useful for Monitoring/Adder ) More...
 
bool operator< (const StatEntity &se) const
 comparison More...
 
unsigned long add (const double Flag)
 add a value More...
 
void reset ()
 reset the counters More...
 
void setnEntriesBeforeReset (unsigned long nEntriesBeforeReset)
 DR specify number of entry before reset. More...
 
std::string toString () const
 representation as string More...
 
std::ostreamprint (std::ostream &o=std::cout) const
 printout to std::ostream More...
 
std::ostreamfillStream (std::ostream &o) const
 printout to std::ostream More...
 
double Sum () const
 get sum More...
 
double Mean () const
 get mean More...
 
double MeanErr () const
 get error in mean More...
 
double Rms () const
 get rms More...
 
double RMS () const
 get rms More...
 
double Eff () const
 get efficiency More...
 
double Min () const
 get minimal value More...
 
double Max () const
 get maximal value More...
 
double flag () const
 accumulated "flag" More...
 
double flag2 () const
 accumulated "flag squared" More...
 
double flagMean () const
 mean value of flag More...
 
double flagRMS () const
 r.m.s of flag More...
 
double flagMeanErr () const
 error in mean value of flag More...
 
double flagMin () const
 minimal flag More...
 
double flagMax () const
 maximal flag More...
 
unsigned long addFlag (const double Flag)
 add a flag More...
 

Static Public Member Functions

static const std::stringformat ()
 the internal format description More...
 
static int size ()
 the actual size of published data More...
 

Private Attributes

unsigned long m_se_nEntries
 number of calls More...
 
double m_se_accumulatedFlag
 accumulated flag More...
 
double m_se_accumulatedFlag2
 
double m_se_minimalFlag
 
double m_se_maximalFlag
 
long m_se_nEntriesBeforeReset
 
std::mutex m_mutex
 

Detailed Description

The basic counter used for Monitoring purposes.

It is used as a small helper class for implementation of class ChronoStatSvc but it also could be used in stand-alone mode to perform trivial statistical evaluations. e.g.

Essentially the generic counter could be considered as the trivial 1-bin

// get all tracks
const Tracks* tracks = ... ;
// create the counter
StatEntity chi2 ;
// make a loop over all tracks:
for ( Tracks::const_iterator itrack = tracks->begin() ;
tracks->end() != itrack ; ++itrack )
{
const Track* track = *itrack ;
// use the counters to accumulate information:
chi2 += track -> chi2 () ;
} ;
// Extract the information from the counter:
// get number of entries (== number of tracks)
int nEntries = chi2.nEntries() ;
// get the minimal value of chi2
double chi2Min = chi2.flagMin() ;
// get the average value of chi2:
double meanChi2 = chi2.flagMean() ;
// get R.M.S. for chi2-distribution:
double rmsChi2 = chi2.flagRMS() ;
.. etc...
Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@l.nosp@m.app..nosp@m.in2p3.nosp@m..fr
Date
26/11/1999
2005-08-02

Definition at line 65 of file StatEntity.h.

Constructor & Destructor Documentation

StatEntity::StatEntity ( )
inline

the default constructor

Definition at line 70 of file StatEntity.h.

70 { reset() ; }
void reset()
reset the counters
Definition: StatEntity.cpp:232
StatEntity::StatEntity ( const unsigned long  entries,
const double  flag,
const double  flag2,
const double  minFlag,
const double  maxFlag 
)

Definition at line 45 of file StatEntity.cpp.

50  : m_se_nEntries ( entries )
53  , m_se_minimalFlag ( minFlag )
54  , m_se_maximalFlag ( maxFlag )
56 {}
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
double m_se_minimalFlag
Definition: StatEntity.h:443
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
double m_se_maximalFlag
Definition: StatEntity.h:444
double flag2() const
accumulated "flag squared"
Definition: StatEntity.h:402
double flag() const
accumulated "flag"
Definition: StatEntity.h:400
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
StatEntity::StatEntity ( const StatEntity other)

copy constructor

Definition at line 61 of file StatEntity.cpp.

62  : m_se_nEntries ( other.m_se_nEntries )
68 {}
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
double m_se_minimalFlag
Definition: StatEntity.h:443
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
double m_se_maximalFlag
Definition: StatEntity.h:444
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
StatEntity::~StatEntity ( )
default

destructor

Member Function Documentation

unsigned long StatEntity::add ( const double  Flag)

add a value

Parameters
Flagvalue to be added
Returns
number of entries

accumulate the flag

evaluate min/max

Definition at line 211 of file StatEntity.cpp.

212 {
214  //
216  else if ( 0 == m_se_nEntriesBeforeReset ) { reset(); }
217  m_se_accumulatedFlag += Flag ; // accumulate the flag
220  m_se_minimalFlag = std::min ( m_se_minimalFlag , Flag ) ; // evaluate min/max
221  m_se_maximalFlag = std::max ( m_se_maximalFlag , Flag ) ; // evaluate min/max
222  // accumulate statistics, but avoid FPE for small flags...
223  static const double s_min1 = 2 * ::sqrt ( std::numeric_limits<double>::min() ) ;
224  if ( s_min1 < Flag || -s_min1 > Flag )
225  { m_se_accumulatedFlag2 += Flag * Flag ; }// accumulate statistics:
226  //
227  return ++m_se_nEntries ;
228 }
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
std::mutex m_mutex
Definition: StatEntity.h:448
double m_se_minimalFlag
Definition: StatEntity.h:443
void reset()
reset the counters
Definition: StatEntity.cpp:232
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
T min(T...args)
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
T max(T...args)
double m_se_maximalFlag
Definition: StatEntity.h:444
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
unsigned long StatEntity::addFlag ( const double  Flag)
inline

add a flag

Parameters
Flagvalue to be added
Returns
number of entries

Definition at line 417 of file StatEntity.h.

417 { return add ( Flag ) ; }
unsigned long add(const double Flag)
add a value
Definition: StatEntity.cpp:211
double StatEntity::eff ( ) const
inline

shortcut,

See also
StatEntity::efficiency

Definition at line 186 of file StatEntity.h.

186 { return efficiency () ; }
double efficiency() const
Interpret the counter as some measure of efficiency The efficiency is calculated as the ratio of the ...
Definition: StatEntity.cpp:144
double StatEntity::Eff ( ) const
inline

get efficiency

Definition at line 391 of file StatEntity.h.

391 { return eff () ; } // get efficiency
double eff() const
shortcut,
Definition: StatEntity.h:186
double StatEntity::effErr ( ) const
inline

shortcut,

See also
StatEntity::efficiencyErr

Definition at line 188 of file StatEntity.h.

188 { return efficiencyErr () ; }
double efficiencyErr() const
Interpret the counter as some measure of efficiency and evaluate the uncertainty of this efficiency u...
Definition: StatEntity.cpp:156
double StatEntity::efficiency ( ) const

Interpret the counter as some measure of efficiency The efficiency is calculated as the ratio of the weight over the number of entries One gets the correct interpretation in the case of filling the counters only with 0 and 1.

Some checks are performed:

  • number of counts must be positive
  • "flag" must be non-negative
  • "flag" does not exceed the overall number of counts

If these conditions are not satisfied the method returns -1, otherwise it returns the value of "flagMean"

StatEntity& stat = ... ;
for ( TRACKS::iterator itrack = tracks.begin() ;
tracks.end() != itrack ; itrack )
{
const bool good = PT( *itrack ) > 1 * Gaudi::Units::GeV ;
stat += good ;
}
std::cout << " Efficiency of PT-cut is "
<< stat.efficiency() << std::endl ;
See also
StatEntity::flagMean
StatEntity::eff
StatEntity::efficiencyErr

Definition at line 144 of file StatEntity.cpp.

145 {
146  if ( 1 > nEntries () || 0 > sum() || sum() > nEntries() ) { return -1 ; }
147  const long double fMin = min () ;
148  if ( 0 != fMin && 1 != fMin ) { return -1 ; }
149  const long double fMax = max () ;
150  if ( 0 != fMax && 1 != fMax ) { return -1 ; }
151  return mean() ;
152 }
const double & max() const
maximal value
Definition: StatEntity.h:111
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
const double & sum() const
accumulated value
Definition: StatEntity.h:99
double mean() const
mean value of counter
Definition: StatEntity.cpp:106
const double & min() const
minimal value
Definition: StatEntity.h:109
double StatEntity::efficiencyErr ( ) const

Interpret the counter as some measure of efficiency and evaluate the uncertainty of this efficiency using binomial estimate.

The efficiency is calculated as the ratio of the weight over the number of entries One gets the correct interpretation in the case of filling the counters only with 0 and 1. Some checks are performed:

  • number of counts must be positive
  • "flag" must be non-negative
  • "flag" does not exceed the overall number of counts

If these conditions are not satisfied the method returns -1.

Attention
The action of this method is DIFFERENT from the action of the method StatEntity::flagMeanErr
StatEntity& stat = ... ;
for ( TRACKS::iterator itrack = tracks.begin() ;
tracks.end() != itrack ; itrack )
{
const bool good = PT( *itrack ) > 1 * Gaudi::Units::GeV ;
stat += good ;
}
std::cout << " Efficiency of PT-cut is "
<< stat.efficiency () << "+-"
<< stat.efficiencyErr () << std::endl ;
See also
StatEntity::efficiency
StatEntity::effErr
StatEntity::flagMeanErr

Definition at line 156 of file StatEntity.cpp.

157 {
158  if ( 0 > efficiency() ) { return -1 ; }
159  //
160  long double n1 = sum () ;
161  // treat properly the bins with eff=0
162  if ( 0 == n1 ) { n1 = 1 ; }
163  const long double n3 = nEntries () ;
164  long double n2 = n3 - flag () ;
165  // treat properly the bins with eff=100%
166  if ( 1 > fabsl( n2 ) ) { n2 = 1 ; }
167  //
168  return ::sqrtl( n1 * n2 / n3 ) / n3 ;
169 }
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
double efficiency() const
Interpret the counter as some measure of efficiency The efficiency is calculated as the ratio of the ...
Definition: StatEntity.cpp:144
const double & sum() const
accumulated value
Definition: StatEntity.h:99
double flag() const
accumulated "flag"
Definition: StatEntity.h:400
std::ostream& StatEntity::fillStream ( std::ostream o) const
inline

printout to std::ostream

Parameters
sthe reference to the output stream

Definition at line 376 of file StatEntity.h.

376 { return print ( o ) ; }
std::ostream & print(std::ostream &o=std::cout) const
printout to std::ostream
Definition: StatEntity.cpp:260
double StatEntity::flag ( ) const
inline

accumulated "flag"

Definition at line 400 of file StatEntity.h.

400 { return sum () ; }
const double & sum() const
accumulated value
Definition: StatEntity.h:99
double StatEntity::flag2 ( ) const
inline

accumulated "flag squared"

Definition at line 402 of file StatEntity.h.

402 { return sum2 () ; }
const double & sum2() const
accumulated value**2
Definition: StatEntity.h:101
double StatEntity::flagMax ( ) const
inline

maximal flag

Definition at line 412 of file StatEntity.h.

412 { return max () ; }
const double & max() const
maximal value
Definition: StatEntity.h:111
double StatEntity::flagMean ( ) const
inline

mean value of flag

Definition at line 404 of file StatEntity.h.

404 { return mean () ; }
double mean() const
mean value of counter
Definition: StatEntity.cpp:106
double StatEntity::flagMeanErr ( ) const
inline

error in mean value of flag

Definition at line 408 of file StatEntity.h.

408 { return meanErr () ; }
double meanErr() const
error in mean value of counter
Definition: StatEntity.cpp:129
double StatEntity::flagMin ( ) const
inline

minimal flag

Definition at line 410 of file StatEntity.h.

410 { return min () ; }
const double & min() const
minimal value
Definition: StatEntity.h:109
double StatEntity::flagRMS ( ) const
inline

r.m.s of flag

Definition at line 406 of file StatEntity.h.

406 { return rms () ; }
double rms() const
r.m.s of value
Definition: StatEntity.cpp:116
const std::string & StatEntity::format ( )
static

the internal format description

Attention
: it needs to be coherent with the actual class structure! It is useful for DIM publishing
See also
StatEntity::size

< check for "D"

Definition at line 84 of file StatEntity.cpp.

85 {
86  // check for "X" or "L"
87  BOOST_STATIC_ASSERT(((sizeof(unsigned long)==4)||(sizeof(unsigned long)==8)));
88  // check for "D"
89  BOOST_STATIC_ASSERT((sizeof(double)==8)) ;
90  //
91  static const std::string s_fmt =
92  ( ( 8 == sizeof(unsigned long) ) ?"X:1;" : "L:1;" ) + std::string("D:4") ;
93  return s_fmt ;
94 }
STL class.
const double& StatEntity::max ( ) const
inline

maximal value

Definition at line 111 of file StatEntity.h.

111 { return m_se_maximalFlag ; }
double m_se_maximalFlag
Definition: StatEntity.h:444
double StatEntity::Max ( ) const
inline

get maximal value

Definition at line 395 of file StatEntity.h.

395 { return max () ; } // get maximal value
const double & max() const
maximal value
Definition: StatEntity.h:111
double StatEntity::mean ( ) const

mean value of counter

Definition at line 106 of file StatEntity.cpp.

107 {
108  if ( 0 >= nEntries() ) { return 0 ;}
109  const long double f1 = m_se_accumulatedFlag ;
110  const long double f2 = m_se_nEntries ;
111  return f1 / f2 ;
112 }
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
double StatEntity::Mean ( ) const
inline

get mean

Definition at line 383 of file StatEntity.h.

383 { return mean () ; } // get mean
double mean() const
mean value of counter
Definition: StatEntity.cpp:106
double StatEntity::meanErr ( ) const

error in mean value of counter

Definition at line 129 of file StatEntity.cpp.

130 {
131  if ( 0 >= nEntries () ) { return 0 ; }
132  const long double f1 = m_se_accumulatedFlag ;
133  const long double f2 = f1 / nEntries () ;
134  const long double f3 = m_se_accumulatedFlag2 ;
135  const long double f4 = f3 / nEntries () ;
136  const long double result = f4 - f2 * f2 ;
137  if ( 0 > result ) { return 0 ; }
138  //
139  return ::sqrtl ( result / nEntries () ) ;
140 }
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
double StatEntity::MeanErr ( ) const
inline

get error in mean

Definition at line 385 of file StatEntity.h.

385 { return meanErr () ; } // get error in mean
double meanErr() const
error in mean value of counter
Definition: StatEntity.cpp:129
const double& StatEntity::min ( ) const
inline

minimal value

Definition at line 109 of file StatEntity.h.

109 { return m_se_minimalFlag ; }
double m_se_minimalFlag
Definition: StatEntity.h:443
double StatEntity::Min ( ) const
inline

get minimal value

Definition at line 393 of file StatEntity.h.

393 { return min () ; } // get minimal value
const double & min() const
minimal value
Definition: StatEntity.h:109
const unsigned long& StatEntity::nEntries ( ) const
inline

getters

Definition at line 97 of file StatEntity.h.

97 { return m_se_nEntries ; }
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
StatEntity& StatEntity::operator++ ( )
inline

Pre-increment operator for the flag Could be used for easy manipulation with StatEntity object:

StatEntity stat ;
for ( int i = ... )
{
double eTotal = .... ;
// increment the counter
if ( eTotal > 1 * TeV ) { ++stat ; } ;
}

Definition at line 233 of file StatEntity.h.

233 { return (*this)+= 1 ; }
StatEntity& StatEntity::operator++ ( int  )
inline

Post-increment operator for the flag.

Actually it is the same as pre-increment. Could be used for easy manipulation with StatEntity object:

StatEntity stat ;
for ( int i = ... )
{
double eTotal = .... ;
// increment the counter
if ( eTotal > 1 * TeV ) { stat++ ; } ;
}

Definition at line 252 of file StatEntity.h.

252 { return ++(*this) ; }
StatEntity& StatEntity::operator+= ( const double  f)
inline

General increment operator for the flag Could be used for easy manipulation with StatEntity object:

StatEntity stat ;
for ( int i = ... )
{
double eTotal = .... ;
// increment the counter
stat += eTotal ;
}
Parameters
fcounter increment

Definition at line 211 of file StatEntity.h.

212  {
213  addFlag ( f ) ;
214  return *this ;
215  }
unsigned long addFlag(const double Flag)
add a flag
Definition: StatEntity.h:417
StatEntity & StatEntity::operator+= ( const StatEntity other)

increment with other counter (useful for Monitoring/Adder )

const StatEntity second = ... ;
StatEntity first = ... ;
first += second ;
Parameters
othercounter to be added
Returns
self-reference

Definition at line 173 of file StatEntity.cpp.

174 {
176  m_se_nEntries += other.m_se_nEntries ;
181  //
182  return *this ;
183 }
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
std::mutex m_mutex
Definition: StatEntity.h:448
double m_se_minimalFlag
Definition: StatEntity.h:443
T min(T...args)
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
T max(T...args)
double m_se_maximalFlag
Definition: StatEntity.h:444
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
StatEntity& StatEntity::operator-- ( )
inline

Pre-decrement operator for the flag Could be used for easy manipulation with StatEntity object:

StatEntity stat ;
for ( int i = ... )
{
double eTotal = .... ;
// increment the counter
if ( eTotal > 1 * TeV ) { --stat ; } ;
}

Definition at line 294 of file StatEntity.h.

294 { return (*this)-=1 ; }
StatEntity& StatEntity::operator-- ( int  )
inline

Post-decrement operator for the flag Could be used for easy manipulation with StatEntity object:

StatEntity stat ;
for ( int i = ... )
{
double eTotal = .... ;
// increment the counter
if ( eTotal > 1 * TeV ) { stat-- ; } ;
}

Definition at line 312 of file StatEntity.h.

312 { return --(*this) ; }
StatEntity& StatEntity::operator-= ( const double  f)
inline

General decrement operator for the flag Could be used for easy manipulation with StatEntity object:

StatEntity stat ;
for ( int i = ... )
{
double eTotal = .... ;
// decrement the counter
stat -= eTotal ;
}
Parameters
fcounter increment

Definition at line 272 of file StatEntity.h.

273  {
274  addFlag ( -f ) ;
275  return *this ;
276  }
unsigned long addFlag(const double Flag)
add a flag
Definition: StatEntity.h:417
bool StatEntity::operator< ( const StatEntity se) const

comparison

Definition at line 187 of file StatEntity.cpp.

188 {
189  if ( &se == this ) { return false ; }
190  else if ( nEntries () < se.nEntries () ) { return true ; }
191  else if ( nEntries () == se.nEntries () &&
192  sum () < se.sum () ) { return true ; }
193  else if ( nEntries () == se.nEntries () &&
194  sum () == se.sum () &&
195  min () < se.min () ) { return true ; }
196  else if ( nEntries () == se.nEntries () &&
197  sum () == se.sum () &&
198  min () == se.min () &&
199  max () < se.max () ) { return true ; }
200  else if ( nEntries () == se.nEntries () &&
201  sum () == se.flag () &&
202  min () == se.min () &&
203  max () == se.max () &&
204  sum2 () < se.sum2 () ) { return true ; }
206  return false;
207 }
const double & max() const
maximal value
Definition: StatEntity.h:111
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
const double & sum2() const
accumulated value**2
Definition: StatEntity.h:101
const double & sum() const
accumulated value
Definition: StatEntity.h:99
const double & min() const
minimal value
Definition: StatEntity.h:109
double flag() const
accumulated "flag"
Definition: StatEntity.h:400
StatEntity & StatEntity::operator= ( const StatEntity other)

assignment operator

Definition at line 73 of file StatEntity.cpp.

73  {
80  return *this;
81 }// ============================================================================
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
double m_se_minimalFlag
Definition: StatEntity.h:443
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
double m_se_maximalFlag
Definition: StatEntity.h:444
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
StatEntity& StatEntity::operator= ( const double  f)
inline

Assignment from the flag The action: reset and the general increment Such case could be useful for statistical monitoring.

const long numberOfHits = ... ;
StatEntity& stat = ... ;
stat = numberOfHits ;
Parameters
fnew value of the counter
Returns
self-reference

< reset the statistics

< use the regular increment

Definition at line 330 of file StatEntity.h.

331  {
332  // reset the statistics
333  reset() ;
334  // use the regular increment
335  return ((*this)+=f);
336  }
void reset()
reset the counters
Definition: StatEntity.cpp:232
std::ostream & StatEntity::print ( std::ostream o = std::cout) const

printout to std::ostream

Parameters
sthe reference to the output stream

Definition at line 260 of file StatEntity.cpp.

261 {
262  boost::format fmt1 ("#=%|-7lu| Sum=%|-11.5g|" ) ;
263  o << fmt1 % nEntries() % sum() ;
264  boost::format fmt2 ( " Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|" ) ;
265  o << fmt2 % mean() % rms() % min() % max() ;
266  return o ;
267 }
const double & max() const
maximal value
Definition: StatEntity.h:111
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
const double & sum() const
accumulated value
Definition: StatEntity.h:99
double mean() const
mean value of counter
Definition: StatEntity.cpp:106
const double & min() const
minimal value
Definition: StatEntity.h:109
double rms() const
r.m.s of value
Definition: StatEntity.cpp:116
void StatEntity::reset ( )

reset the counters

Definition at line 232 of file StatEntity.cpp.

233 {
235  //
236  m_se_nEntries = 0 ;
241  m_se_nEntriesBeforeReset = -1 ; // ?
242 }
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
std::mutex m_mutex
Definition: StatEntity.h:448
double m_se_minimalFlag
Definition: StatEntity.h:443
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
double m_se_maximalFlag
Definition: StatEntity.h:444
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
double StatEntity::rms ( ) const

r.m.s of value

Definition at line 116 of file StatEntity.cpp.

117 {
118  if ( 0 >= nEntries() ) { return 0 ; }
119  const long double f1 = m_se_accumulatedFlag ;
120  const long double f2 = f1 / nEntries () ;
121  const long double f3 = m_se_accumulatedFlag2 ;
122  const long double f4 = f3 / nEntries () ;
123  const long double result = f4 - f2 * f2 ;
124  return ( 0 > result ) ? 0 : ::sqrtl ( result ) ;
125 }
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
double StatEntity::Rms ( ) const
inline

get rms

Definition at line 387 of file StatEntity.h.

387 { return rms () ; } // get rms
double rms() const
r.m.s of value
Definition: StatEntity.cpp:116
double StatEntity::RMS ( ) const
inline

get rms

Definition at line 389 of file StatEntity.h.

389 { return rms () ; } // get rms
double rms() const
r.m.s of value
Definition: StatEntity.cpp:116
void StatEntity::setnEntriesBeforeReset ( unsigned long  nEntriesBeforeReset)

DR specify number of entry before reset.

Definition at line 246 of file StatEntity.cpp.

247 { m_se_nEntriesBeforeReset = nEntriesBeforeReset; }
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
int StatEntity::size ( )
static

the actual size of published data

Attention
: it needs to be coherent with the actual class structure! It is useful for DIM publishing
See also
StatEntity::format

Definition at line 98 of file StatEntity.cpp.

99 {
100  static const int s_size = sizeof(unsigned long) + 4 * sizeof(double) ;
101  return s_size ;
102 }
const double& StatEntity::sum ( ) const
inline

accumulated value

Definition at line 99 of file StatEntity.h.

99 { return m_se_accumulatedFlag ; }
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
double StatEntity::Sum ( ) const
inline

get sum

Definition at line 381 of file StatEntity.h.

381 { return sum () ; } // get sum
const double & sum() const
accumulated value
Definition: StatEntity.h:99
const double& StatEntity::sum2 ( ) const
inline

accumulated value**2

Definition at line 101 of file StatEntity.h.

101 { return m_se_accumulatedFlag2 ; }
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
std::string StatEntity::toString ( ) const

representation as string

Definition at line 251 of file StatEntity.cpp.

252 {
253  std::ostringstream ost ;
254  print ( ost ) ;
255  return ost.str () ;
256 }
std::ostream & print(std::ostream &o=std::cout) const
printout to std::ostream
Definition: StatEntity.cpp:260

Member Data Documentation

std::mutex StatEntity::m_mutex
private

Definition at line 448 of file StatEntity.h.

double StatEntity::m_se_accumulatedFlag
private

accumulated flag

Definition at line 441 of file StatEntity.h.

double StatEntity::m_se_accumulatedFlag2
private

Definition at line 442 of file StatEntity.h.

double StatEntity::m_se_maximalFlag
private

Definition at line 444 of file StatEntity.h.

double StatEntity::m_se_minimalFlag
private

Definition at line 443 of file StatEntity.h.

unsigned long StatEntity::m_se_nEntries
private

number of calls

Definition at line 439 of file StatEntity.h.

long StatEntity::m_se_nEntriesBeforeReset
private

Definition at line 446 of file StatEntity.h.


The documentation for this class was generated from the following files: