| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
StatEntity Class Referencefinal

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

`#include <GaudiKernel/StatEntity.h>`

## 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 ()=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...
StatEntity & | operator+= (const double f)
| General increment operator for the flag Could be used for easy manipulation with StatEntity object: More...
StatEntity & | operator++ ()
| Pre-increment operator for the flag Could be used for easy manipulation with StatEntity object: More...
StatEntity & | operator++ (int)
| Post-increment operator for the flag. More...
StatEntity & | operator-= (const double f)
| General decrement operator for the flag Could be used for easy manipulation with StatEntity object: More...
StatEntity & | operator-- ()
| Pre-decrement operator for the flag Could be used for easy manipulation with StatEntity object: More...
StatEntity & | operator-- (int)
| Post-decrement operator for the flag Could be used for easy manipulation with StatEntity object: More...
StatEntity & | operator= (const double f)
| Assignment from the flag The action: reset and the general increment Such case could be useful for statistical monitoring. More...
StatEntity & | operator+= (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::ostream & | print (std::ostream &o=std::cout) const
| printout to std::ostream More...
std::ostream & | fillStream (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::string & | format ()
| 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

## 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 64 of file StatEntity.h.

## Constructor & Destructor Documentation

StatEntity::StatEntity | ( |  | ) |
| inline

the default constructor

Definition at line 69 of file StatEntity.h.

69 { reset() ; }
StatEntity::reset
void reset()
reset the counters
Definition: StatEntity.cpp:206

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 )
51 , m_se_accumulatedFlag ( flag )
52 , m_se_accumulatedFlag2 ( flag2 )
53 , m_se_minimalFlag ( minFlag )
54 , m_se_maximalFlag ( maxFlag )
55 , m_se_nEntriesBeforeReset ( -1 )
56 {}
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:434
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:438
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:441
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:436
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:439
StatEntity::flag2
double flag2() const
accumulated "flag squared"
Definition: StatEntity.h:397
StatEntity::flag
double flag() const
accumulated "flag"
Definition: StatEntity.h:395
StatEntity::m_se_accumulatedFlag2
double m_se_accumulatedFlag2
Definition: StatEntity.h:437

StatEntity::~StatEntity | ( |  | ) |
| default

destructor

## Member Function Documentation

unsigned long StatEntity::add | ( | const double | Flag | ) |

add a value

Parameters

  Flag | value to be added

Returns
  number of entries

accumulate the flag

evaluate min/max

Definition at line 186 of file StatEntity.cpp.

187 {
188 //
189 if ( 0 < m_se_nEntriesBeforeReset ) { --m_se_nEntriesBeforeReset; }
190 else if ( 0 == m_se_nEntriesBeforeReset ) { reset(); }
191 m_se_accumulatedFlag += Flag ; // accumulate the flag
194 m_se_minimalFlag = std::min ( m_se_minimalFlag , Flag ) ; // evaluate min/max
195 m_se_maximalFlag = std::max ( m_se_maximalFlag , Flag ) ; // evaluate min/max
196 // accumulate statistics, but avoid FPE for small flags...
197 static const double s_min1 = 2 * ::sqrt ( std::numeric_limits<double>::min() ) ;
198 if ( s_min1 < Flag || -s_min1 > Flag )
199 { m_se_accumulatedFlag2 += Flag * Flag ; }// accumulate statistics:
200 //
201 return ++m_se_nEntries ;
202 }
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:434
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:438
StatEntity::reset
void reset()
reset the counters
Definition: StatEntity.cpp:206
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:441
std::min
T min(T...args)
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:436
std::max
T max(T...args)
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:439
StatEntity::m_se_accumulatedFlag2
double m_se_accumulatedFlag2
Definition: StatEntity.h:437
std::numeric_limits

unsigned long StatEntity::addFlag | ( | const double | Flag | ) |
| inline

add a flag

Parameters

  Flag | value to be added

Returns
  number of entries

Definition at line 412 of file StatEntity.h.

412 { return add ( Flag ) ; }
StatEntity::add
unsigned long add(const double Flag)
add a value
Definition: StatEntity.cpp:186

double StatEntity::eff | ( |  | ) | const
| inline

shortcut,

See also
  StatEntity::efficiency

Definition at line 181 of file StatEntity.h.

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

double StatEntity::Eff | ( |  | ) | const
| inline

get efficiency

Definition at line 386 of file StatEntity.h.

386 { return eff () ; } // get efficiency
StatEntity::eff
double eff() const
shortcut,
Definition: StatEntity.h:181

double StatEntity::effErr | ( |  | ) | const
| inline

shortcut,

See also
  StatEntity::efficiencyErr

Definition at line 183 of file StatEntity.h.

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

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 120 of file StatEntity.cpp.

121 {
122 if ( 1 > nEntries () || 0 > sum() || sum() > nEntries() ) { return -1 ; }
123 const long double fMin = min () ;
124 if ( 0 != fMin && 1 != fMin ) { return -1 ; }
125 const long double fMax = max () ;
126 if ( 0 != fMax && 1 != fMax ) { return -1 ; }
127 return mean() ;
128 }
StatEntity::max
const double & max() const
maximal value
Definition: StatEntity.h:106
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:92
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:94
StatEntity::mean
double mean() const
mean value of counter
Definition: StatEntity.cpp:82
StatEntity::min
const double & min() const
minimal value
Definition: StatEntity.h:104

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 132 of file StatEntity.cpp.

133 {
134 if ( 0 > efficiency() ) { return -1 ; }
135 //
136 long double n1 = sum () ;
137 // treat properly the bins with eff=0
138 if ( 0 == n1 ) { n1 = 1 ; }
139 const long double n3 = nEntries () ;
140 long double n2 = n3 - flag () ;
141 // treat properly the bins with eff=100%
142 if ( 1 > fabsl( n2 ) ) { n2 = 1 ; }
143 //
144 return ::sqrtl( n1 * n2 / n3 ) / n3 ;
145 }
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:92
StatEntity::efficiency
double efficiency() const
Interpret the counter as some measure of efficiency The efficiency is calculated as the ratio of the ...
Definition: StatEntity.cpp:120
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:94
StatEntity::flag
double flag() const
accumulated "flag"
Definition: StatEntity.h:395

std::ostream& StatEntity::fillStream | ( | std::ostream & | o | ) | const
| inline

printout to std::ostream

Parameters

  s | the reference to the output stream

Definition at line 371 of file StatEntity.h.

371 { return print ( o ) ; }
StatEntity::print
std::ostream & print(std::ostream &o=std::cout) const
printout to std::ostream
Definition: StatEntity.cpp:233

double StatEntity::flag | ( |  | ) | const
| inline

accumulated "flag"

Definition at line 395 of file StatEntity.h.

395 { return sum () ; }
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:94

double StatEntity::flag2 | ( |  | ) | const
| inline

accumulated "flag squared"

Definition at line 397 of file StatEntity.h.

397 { return sum2 () ; }
StatEntity::sum2
const double & sum2() const
accumulated value**2
Definition: StatEntity.h:96

double StatEntity::flagMax | ( |  | ) | const
| inline

maximal flag

Definition at line 407 of file StatEntity.h.

407 { return max () ; }
StatEntity::max
const double & max() const
maximal value
Definition: StatEntity.h:106

double StatEntity::flagMean | ( |  | ) | const
| inline

mean value of flag

Definition at line 399 of file StatEntity.h.

399 { return mean () ; }
StatEntity::mean
double mean() const
mean value of counter
Definition: StatEntity.cpp:82

double StatEntity::flagMeanErr | ( |  | ) | const
| inline

error in mean value of flag

Definition at line 403 of file StatEntity.h.

403 { return meanErr () ; }
StatEntity::meanErr
double meanErr() const
error in mean value of counter
Definition: StatEntity.cpp:105

double StatEntity::flagMin | ( |  | ) | const
| inline

minimal flag

Definition at line 405 of file StatEntity.h.

405 { return min () ; }
StatEntity::min
const double & min() const
minimal value
Definition: StatEntity.h:104

double StatEntity::flagRMS | ( |  | ) | const
| inline

r.m.s of flag

Definition at line 401 of file StatEntity.h.

401 { return rms () ; }
StatEntity::rms
double rms() const
r.m.s of value
Definition: StatEntity.cpp:92

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 60 of file StatEntity.cpp.

61 {
62 // check for "X" or "L"
63 BOOST_STATIC_ASSERT(((sizeof(unsigned long)==4)||(sizeof(unsigned long)==8)));
64 // check for "D"
65 BOOST_STATIC_ASSERT((sizeof(double)==8)) ;
66 //
67 static const std::string s_fmt =
68 ( ( 8 == sizeof(unsigned long) ) ?"X:1;" : "L:1;" ) + std::string("D:4") ;
69 return s_fmt ;
70 }
std::string
STL class.

const double& StatEntity::max | ( |  | ) | const
| inline

maximal value

Definition at line 106 of file StatEntity.h.

106 { return m_se_maximalFlag ; }
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:439

double StatEntity::Max | ( |  | ) | const
| inline

get maximal value

Definition at line 390 of file StatEntity.h.

390 { return max () ; } // get maximal value
StatEntity::max
const double & max() const
maximal value
Definition: StatEntity.h:106

double StatEntity::mean | ( |  | ) | const

mean value of counter

Definition at line 82 of file StatEntity.cpp.

83 {
84 if ( 0 >= nEntries() ) { return 0 ;}
85 const long double f1 = m_se_accumulatedFlag ;
86 const long double f2 = m_se_nEntries ;
87 return f1 / f2 ;
88 }
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:434
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:92
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:436

double StatEntity::Mean | ( |  | ) | const
| inline

get mean

Definition at line 378 of file StatEntity.h.

378 { return mean () ; } // get mean
StatEntity::mean
double mean() const
mean value of counter
Definition: StatEntity.cpp:82

double StatEntity::meanErr | ( |  | ) | const

error in mean value of counter

Definition at line 105 of file StatEntity.cpp.

106 {
107 if ( 0 >= nEntries () ) { return 0 ; }
108 const long double f1 = m_se_accumulatedFlag ;
109 const long double f2 = f1 / nEntries () ;
110 const long double f3 = m_se_accumulatedFlag2 ;
111 const long double f4 = f3 / nEntries () ;
112 const long double result = f4 - f2 * f2 ;
113 if ( 0 > result ) { return 0 ; }
114 //
115 return ::sqrtl ( result / nEntries () ) ;
116 }
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:92
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:436
StatEntity::m_se_accumulatedFlag2
double m_se_accumulatedFlag2
Definition: StatEntity.h:437

double StatEntity::MeanErr | ( |  | ) | const
| inline

get error in mean

Definition at line 380 of file StatEntity.h.

380 { return meanErr () ; } // get error in mean
StatEntity::meanErr
double meanErr() const
error in mean value of counter
Definition: StatEntity.cpp:105

const double& StatEntity::min | ( |  | ) | const
| inline

minimal value

Definition at line 104 of file StatEntity.h.

104 { return m_se_minimalFlag ; }
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:438

double StatEntity::Min | ( |  | ) | const
| inline

get minimal value

Definition at line 388 of file StatEntity.h.

388 { return min () ; } // get minimal value
StatEntity::min
const double & min() const
minimal value
Definition: StatEntity.h:104

const unsigned long& StatEntity::nEntries | ( |  | ) | const
| inline

getters

Definition at line 92 of file StatEntity.h.

92 { return m_se_nEntries ; }
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:434

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 228 of file StatEntity.h.

228 { 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 247 of file StatEntity.h.

247 { 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

  f | counter increment

Definition at line 206 of file StatEntity.h.

207 {
208 addFlag ( f ) ;
209 return *this ;
210 }
StatEntity::addFlag
unsigned long addFlag(const double Flag)
add a flag
Definition: StatEntity.h:412

StatEntity & StatEntity::operator+= | ( | const StatEntity & | other | ) |

increment with other counter (useful for Monitoring/Adder )

const StatEntity second = ... ;
StatEntity first = ... ;
first += second ;

Parameters

  other | counter to be added

Returns
  self-reference

Definition at line 149 of file StatEntity.cpp.

150 {
151 m_se_nEntries += other.m_se_nEntries ;
152 m_se_accumulatedFlag += other.m_se_accumulatedFlag ;
153 m_se_accumulatedFlag2 += other.m_se_accumulatedFlag2 ;
154 m_se_minimalFlag = std::min ( m_se_minimalFlag , other.m_se_minimalFlag ) ;
155 m_se_maximalFlag = std::max ( m_se_maximalFlag , other.m_se_maximalFlag ) ;
156 //
157 return *this ;
158 }
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:434
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:438
std::min
T min(T...args)
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:436
std::max
T max(T...args)
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:439
StatEntity::m_se_accumulatedFlag2
double m_se_accumulatedFlag2
Definition: StatEntity.h:437

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 289 of file StatEntity.h.

289 { 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 307 of file StatEntity.h.

307 { 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

  f | counter increment

Definition at line 267 of file StatEntity.h.

268 {
269 addFlag ( -f ) ;
270 return *this ;
271 }
StatEntity::addFlag
unsigned long addFlag(const double Flag)
add a flag
Definition: StatEntity.h:412

bool StatEntity::operator< | ( | const StatEntity & | se | ) | const

comparison

Definition at line 162 of file StatEntity.cpp.

163 {
164 if ( &se == this ) { return false ; }
165 else if ( nEntries () < se.nEntries () ) { return true ; }
166 else if ( nEntries () == se.nEntries () &&
167 sum () < se.sum () ) { return true ; }
168 else if ( nEntries () == se.nEntries () &&
169 sum () == se.sum () &&
170 min () < se.min () ) { return true ; }
171 else if ( nEntries () == se.nEntries () &&
172 sum () == se.sum () &&
173 min () == se.min () &&
174 max () < se.max () ) { return true ; }
175 else if ( nEntries () == se.nEntries () &&
176 sum () == se.flag () &&
177 min () == se.min () &&
178 max () == se.max () &&
179 sum2 () < se.sum2 () ) { return true ; }
181 return false;
182 }
StatEntity::max
const double & max() const
maximal value
Definition: StatEntity.h:106
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:92
StatEntity::sum2
const double & sum2() const
accumulated value**2
Definition: StatEntity.h:96
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:94
StatEntity::min
const double & min() const
minimal value
Definition: StatEntity.h:104
StatEntity::flag
double flag() const
accumulated "flag"
Definition: StatEntity.h:395

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

  f | new value of the counter

Returns
  self-reference

< reset the statistics

< use the regular increment

Definition at line 325 of file StatEntity.h.

326 {
327 // reset the statistics
328 reset() ;
329 // use the regular increment
330 return ((*this)+=f);
331 }
StatEntity::reset
void reset()
reset the counters
Definition: StatEntity.cpp:206

std::ostream & StatEntity::print | ( | std::ostream & | o = `std::cout` | ) | const

printout to std::ostream

Parameters

  s | the reference to the output stream

Definition at line 233 of file StatEntity.cpp.

234 {
235 boost::format fmt1 ("#=%|-7lu| Sum=%|-11.5g|" ) ;
236 o << fmt1 % nEntries() % sum() ;
237 boost::format fmt2 ( " Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|" ) ;
238 o << fmt2 % mean() % rms() % min() % max() ;
239 return o ;
240 }
StatEntity::max
const double & max() const
maximal value
Definition: StatEntity.h:106
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:92
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:94
StatEntity::mean
double mean() const
mean value of counter
Definition: StatEntity.cpp:82
StatEntity::min
const double & min() const
minimal value
Definition: StatEntity.h:104
StatEntity::rms
double rms() const
r.m.s of value
Definition: StatEntity.cpp:92

void StatEntity::reset | ( |  | ) |

reset the counters

Definition at line 206 of file StatEntity.cpp.

207 {
208 //
209 m_se_nEntries = 0 ;
210 m_se_accumulatedFlag = 0 ;
211 m_se_minimalFlag = std::numeric_limits<double>::max() ;
212 m_se_maximalFlag = -1 * std::numeric_limits<double>::max() ;
213 m_se_accumulatedFlag2 = 0 ;
214 m_se_nEntriesBeforeReset = -1 ; // ?
215 }
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:434
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:438
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:441
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:436
std::numeric_limits::max
T max(T...args)
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:439
StatEntity::m_se_accumulatedFlag2
double m_se_accumulatedFlag2
Definition: StatEntity.h:437

double StatEntity::rms | ( |  | ) | const

r.m.s of value

Definition at line 92 of file StatEntity.cpp.

93 {
94 if ( 0 >= nEntries() ) { return 0 ; }
95 const long double f1 = m_se_accumulatedFlag ;
96 const long double f2 = f1 / nEntries () ;
97 const long double f3 = m_se_accumulatedFlag2 ;
98 const long double f4 = f3 / nEntries () ;
99 const long double result = f4 - f2 * f2 ;
100 return ( 0 > result ) ? 0 : ::sqrtl ( result ) ;
101 }
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:92
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:436
StatEntity::m_se_accumulatedFlag2
double m_se_accumulatedFlag2
Definition: StatEntity.h:437

double StatEntity::Rms | ( |  | ) | const
| inline

get rms

Definition at line 382 of file StatEntity.h.

382 { return rms () ; } // get rms
StatEntity::rms
double rms() const
r.m.s of value
Definition: StatEntity.cpp:92

double StatEntity::RMS | ( |  | ) | const
| inline

get rms

Definition at line 384 of file StatEntity.h.

384 { return rms () ; } // get rms
StatEntity::rms
double rms() const
r.m.s of value
Definition: StatEntity.cpp:92

void StatEntity::setnEntriesBeforeReset | ( | unsigned long | nEntriesBeforeReset | ) |

DR specify number of entry before reset.

Definition at line 219 of file StatEntity.cpp.

220 { m_se_nEntriesBeforeReset = nEntriesBeforeReset; }
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:441

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 74 of file StatEntity.cpp.

75 {
76 static const int s_size = sizeof(unsigned long) + 4 * sizeof(double) ;
77 return s_size ;
78 }

const double& StatEntity::sum | ( |  | ) | const
| inline

accumulated value

Definition at line 94 of file StatEntity.h.

94 { return m_se_accumulatedFlag ; }
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:436

double StatEntity::Sum | ( |  | ) | const
| inline

get sum

Definition at line 376 of file StatEntity.h.

376 { return sum () ; } // get sum
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:94

const double& StatEntity::sum2 | ( |  | ) | const
| inline

accumulated value**2

Definition at line 96 of file StatEntity.h.

96 { return m_se_accumulatedFlag2 ; }
StatEntity::m_se_accumulatedFlag2
double m_se_accumulatedFlag2
Definition: StatEntity.h:437

std::string StatEntity::toString | ( |  | ) | const

representation as string

Definition at line 224 of file StatEntity.cpp.

225 {
226 std::ostringstream ost ;
227 print ( ost ) ;
228 return ost.str () ;
229 }
StatEntity::print
std::ostream & print(std::ostream &o=std::cout) const
printout to std::ostream
Definition: StatEntity.cpp:233
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)

## Member Data Documentation

double StatEntity::m_se_accumulatedFlag
| private

accumulated flag

Definition at line 436 of file StatEntity.h.

double StatEntity::m_se_accumulatedFlag2
| private

Definition at line 437 of file StatEntity.h.

double StatEntity::m_se_maximalFlag
| private

Definition at line 439 of file StatEntity.h.

double StatEntity::m_se_minimalFlag
| private

Definition at line 438 of file StatEntity.h.

unsigned long StatEntity::m_se_nEntries
| private

number of calls

Definition at line 434 of file StatEntity.h.

long StatEntity::m_se_nEntriesBeforeReset
| private

Definition at line 441 of file StatEntity.h.

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

- GaudiKernel/GaudiKernel/StatEntity.h
- GaudiKernel/src/Lib/StatEntity.cpp