| The Gaudi Framework v28r2p1 (f1a77ff4)

- 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>`

Collaboration diagram for StatEntity:
[legend]

## 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...
StatEntity & | operator= (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...
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
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() ; }
StatEntity::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 )
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:439
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:443
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:444
StatEntity::flag2
double flag2() const
accumulated "flag squared"
Definition: StatEntity.h:402
StatEntity::flag
double flag() const
accumulated "flag"
Definition: StatEntity.h:400
StatEntity::m_se_accumulatedFlag2
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 )
63 , m_se_accumulatedFlag ( other.m_se_accumulatedFlag )
64 , m_se_accumulatedFlag2 ( other.m_se_accumulatedFlag2 )
65 , m_se_minimalFlag ( other.m_se_minimalFlag )
66 , m_se_maximalFlag ( other.m_se_maximalFlag )
67 , m_se_nEntriesBeforeReset ( other.m_se_nEntriesBeforeReset )
68 {}
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:443
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:444
StatEntity::m_se_accumulatedFlag2
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

  Flag | value to be added

Returns
  number of entries

accumulate the flag

evaluate min/max

Definition at line 211 of file StatEntity.cpp.

212 {
213 std::lock_guard<std::mutex> guard(m_mutex);
214 //
215 if ( 0 < m_se_nEntriesBeforeReset ) { --m_se_nEntriesBeforeReset; }
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 }
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
StatEntity::m_mutex
std::mutex m_mutex
Definition: StatEntity.h:448
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:443
StatEntity::reset
void reset()
reset the counters
Definition: StatEntity.cpp:232
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
std::min
T min(T...args)
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
std::max
T max(T...args)
std::lock_guard
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:444
StatEntity::m_se_accumulatedFlag2
double m_se_accumulatedFlag2
Definition: StatEntity.h:442
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 417 of file StatEntity.h.

417 { return add ( Flag ) ; }
StatEntity::add
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 () ; }
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:144

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

get efficiency

Definition at line 391 of file StatEntity.h.

391 { return eff () ; } // get efficiency
StatEntity::eff
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 () ; }
StatEntity::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 }
StatEntity::max
const double & max() const
maximal value
Definition: StatEntity.h:111
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:99
StatEntity::mean
double mean() const
mean value of counter
Definition: StatEntity.cpp:106
StatEntity::min
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 }
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
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:144
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:99
StatEntity::flag
double flag() const
accumulated "flag"
Definition: StatEntity.h:400

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

printout to std::ostream

Parameters

  s | the reference to the output stream

Definition at line 376 of file StatEntity.h.

376 { return print ( o ) ; }
StatEntity::print
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 () ; }
StatEntity::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 () ; }
StatEntity::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 () ; }
StatEntity::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 () ; }
StatEntity::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 () ; }
StatEntity::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 () ; }
StatEntity::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 () ; }
StatEntity::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 }
std::string
STL class.

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

maximal value

Definition at line 111 of file StatEntity.h.

111 { return m_se_maximalFlag ; }
StatEntity::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
StatEntity::max
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 }
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
StatEntity::m_se_accumulatedFlag
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
StatEntity::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 }
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
StatEntity::m_se_accumulatedFlag2
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
StatEntity::meanErr
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 ; }
StatEntity::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
StatEntity::min
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 ; }
StatEntity::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

  f | counter increment

Definition at line 211 of file StatEntity.h.

212 {
213 addFlag ( f ) ;
214 return *this ;
215 }
StatEntity::addFlag
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

  other | counter to be added

Returns
  self-reference

Definition at line 173 of file StatEntity.cpp.

174 {
175 std::lock_guard<std::mutex> guard(m_mutex);
176 m_se_nEntries += other.m_se_nEntries ;
177 m_se_accumulatedFlag += other.m_se_accumulatedFlag ;
178 m_se_accumulatedFlag2 += other.m_se_accumulatedFlag2 ;
179 m_se_minimalFlag = std::min ( m_se_minimalFlag , other.m_se_minimalFlag ) ;
180 m_se_maximalFlag = std::max ( m_se_maximalFlag , other.m_se_maximalFlag ) ;
181 //
182 return *this ;
183 }
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
StatEntity::m_mutex
std::mutex m_mutex
Definition: StatEntity.h:448
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:443
std::min
T min(T...args)
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
std::max
T max(T...args)
std::lock_guard
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:444
StatEntity::m_se_accumulatedFlag2
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

  f | counter increment

Definition at line 272 of file StatEntity.h.

273 {
274 addFlag ( -f ) ;
275 return *this ;
276 }
StatEntity::addFlag
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 }
StatEntity::max
const double & max() const
maximal value
Definition: StatEntity.h:111
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
StatEntity::sum2
const double & sum2() const
accumulated value**2
Definition: StatEntity.h:101
StatEntity::sum
const double & sum() const
accumulated value
Definition: StatEntity.h:99
StatEntity::min
const double & min() const
minimal value
Definition: StatEntity.h:109
StatEntity::flag
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 {
74 m_se_nEntries = other.m_se_nEntries;
75 m_se_accumulatedFlag = other.m_se_accumulatedFlag;
76 m_se_accumulatedFlag2 = other.m_se_accumulatedFlag2;
77 m_se_minimalFlag = other.m_se_minimalFlag;
78 m_se_maximalFlag = other.m_se_maximalFlag;
79 m_se_nEntriesBeforeReset = other.m_se_nEntriesBeforeReset;
80 return *this;
81 }// ============================================================================
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:443
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:444
StatEntity::m_se_accumulatedFlag2
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

  f | new 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 }
StatEntity::reset
void reset()
reset the counters
Definition: StatEntity.cpp:232

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 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 }
StatEntity::max
const double & max() const
maximal value
Definition: StatEntity.h:111
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
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:99
StatEntity::mean
double mean() const
mean value of counter
Definition: StatEntity.cpp:106
StatEntity::min
const double & min() const
minimal value
Definition: StatEntity.h:109
StatEntity::rms
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 {
234 std::lock_guard<std::mutex> guard(m_mutex);
235 //
236 m_se_nEntries = 0 ;
237 m_se_accumulatedFlag = 0 ;
238 m_se_minimalFlag = std::numeric_limits<double>::max() ;
239 m_se_maximalFlag = -1 * std::numeric_limits<double>::max() ;
240 m_se_accumulatedFlag2 = 0 ;
241 m_se_nEntriesBeforeReset = -1 ; // ?
242 }
StatEntity::m_se_nEntries
unsigned long m_se_nEntries
number of calls
Definition: StatEntity.h:439
StatEntity::m_mutex
std::mutex m_mutex
Definition: StatEntity.h:448
StatEntity::m_se_minimalFlag
double m_se_minimalFlag
Definition: StatEntity.h:443
StatEntity::m_se_nEntriesBeforeReset
long m_se_nEntriesBeforeReset
Definition: StatEntity.h:446
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
std::numeric_limits::max
T max(T...args)
std::lock_guard
StatEntity::m_se_maximalFlag
double m_se_maximalFlag
Definition: StatEntity.h:444
StatEntity::m_se_accumulatedFlag2
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 }
StatEntity::nEntries
const unsigned long & nEntries() const
getters
Definition: StatEntity.h:97
StatEntity::m_se_accumulatedFlag
double m_se_accumulatedFlag
accumulated flag
Definition: StatEntity.h:441
StatEntity::m_se_accumulatedFlag2
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
StatEntity::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
StatEntity::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; }
StatEntity::m_se_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 ; }
StatEntity::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
StatEntity::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 ; }
StatEntity::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 }
StatEntity::print
std::ostream & print(std::ostream &o=std::cout) const
printout to std::ostream
Definition: StatEntity.cpp:260
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)

## 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:

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