#include <GaudiKernel/StatEntity.h>
Public Member Functions | |
StatEntity () | |
the default constructor | |
StatEntity (const unsigned long entries, const double flag, const double flag2, const double minFlag, const double maxFlag) | |
~StatEntity () | |
destructor | |
unsigned long | nEntries () const |
getters | |
double | flag () const |
accumulated "flag" | |
double | flag2 () const |
accumulated "flag squared" | |
double | flagMean () const |
mean value of flag | |
double | flagRMS () const |
r.m.s of flag | |
double | flagMeanErr () const |
error in mean value of flag | |
double | flagMin () const |
minimal flag | |
double | flagMax () const |
maximal flag | |
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. | |
double | efficiencyErr () const |
Interpret the counter as some measure of efficiency and evaluate the uncertainty of this efficiency using binomial estimate. | |
double | eff () const |
shortcut, | |
double | effErr () const |
shortcut, | |
StatEntity & | operator+= (const double f) |
General increment operator for the flag Could be used for easy manipulation with StatEntity object:. | |
StatEntity & | operator++ () |
Pre-increment operator for the flag Could be used for easy manipulation with StatEntity object:. | |
StatEntity & | operator++ (int) |
Post-increment operator for the flag. | |
StatEntity & | operator-= (const double f) |
General decrement operator fro the flag Could be used for easy manipulation with StatEntity object:. | |
StatEntity & | operator-- () |
Pre-decrement operator for the flag Could be used for easy manipulation with StatEntity object:. | |
StatEntity & | operator-- (int) |
Post-decrement operator for the flag Could be used for easy manipulation with StatEntity object:. | |
StatEntity & | operator= (const double f) |
Assignement from the flag The action: reset and the general inrement Such case could be useful for statistical monitoring. | |
StatEntity & | operator+= (const StatEntity &other) |
increment with other counter (useful for Monitoring/Adder ) | |
bool | operator< (const StatEntity &se) const |
comparison | |
unsigned long | addFlag (const double Flag) |
add a flag | |
void | reset () |
reset the counters | |
void | setnEntriesBeforeReset (unsigned long nEntriesBeforeReset) |
DR specify number of entry before reset. | |
std::string | toString () const |
representation as string | |
std::ostream & | print (std::ostream &o=std::cout) const |
printout to std::ostream | |
std::ostream & | fillStream (std::ostream &o) const |
printout to std::ostream | |
Static Public Member Functions | |
static const std::string & | format () |
the internal format description | |
static int | size () |
the actual size of published data | |
Private Attributes | |
unsigned long | m_se_nEntries |
number of calls | |
double | m_se_accumulatedFlag |
accumulated flag | |
double | m_se_accumulatedFlag2 |
double | m_se_minimalFlag |
double | m_se_maximalFlag |
long | m_se_nEntriesBeforeReset |
It is used as a small helper class for implementation of class ChronoStatSvc but it also could be used in standalone 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...
2005-08-02
Definition at line 65 of file StatEntity.h.
StatEntity::StatEntity | ( | ) | [inline] |
StatEntity::StatEntity | ( | const unsigned long | entries, | |
const double | flag, | |||
const double | flag2, | |||
const double | minFlag, | |||
const double | maxFlag | |||
) |
StatEntity::~StatEntity | ( | ) | [inline] |
static const std::string& StatEntity::format | ( | ) | [static] |
the internal format description
static int StatEntity::size | ( | ) | [static] |
the actual size of published data
unsigned long StatEntity::nEntries | ( | ) | const [inline] |
double StatEntity::flag | ( | ) | const [inline] |
accumulated "flag"
Definition at line 109 of file StatEntity.h.
00109 { return m_se_accumulatedFlag ; }
double StatEntity::flag2 | ( | ) | const [inline] |
accumulated "flag squared"
Definition at line 111 of file StatEntity.h.
00111 { return m_se_accumulatedFlag2 ; }
double StatEntity::flagMean | ( | ) | const |
mean value of flag
double StatEntity::flagRMS | ( | ) | const |
r.m.s of flag
double StatEntity::flagMeanErr | ( | ) | const |
error in mean value of flag
double StatEntity::flagMin | ( | ) | const [inline] |
double StatEntity::flagMax | ( | ) | const [inline] |
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:
If these conditions are not satisfied the method returns -1, overwise 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 ;
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:
If these conditions are not satistied the method returns -1.
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 ;
double StatEntity::eff | ( | ) | const [inline] |
shortcut,
Definition at line 193 of file StatEntity.h.
00193 { return efficiency () ; }
double StatEntity::effErr | ( | ) | const [inline] |
shortcut,
Definition at line 195 of file StatEntity.h.
00195 { return efficiencyErr () ; }
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 ; }
f | counter increment |
Definition at line 215 of file StatEntity.h.
00216 { 00217 addFlag ( f ) ; 00218 return *this ; 00219 }
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 237 of file StatEntity.h.
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 256 of file StatEntity.h.
StatEntity& StatEntity::operator-= | ( | const double | f | ) | [inline] |
General decrement operator fro the flag Could be used for easy manipulation with StatEntity object:.
StatEntity stat ; for ( int i = ... ) { double eTotal = .... ; // decrement the counter stat -= eTotal ; }
f | counter increment |
Definition at line 276 of file StatEntity.h.
00277 { 00278 addFlag ( -f ) ; 00279 return *this ; 00280 }
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 298 of file StatEntity.h.
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 316 of file StatEntity.h.
StatEntity& StatEntity::operator= | ( | const double | f | ) | [inline] |
Assignement from the flag The action: reset and the general inrement Such case could be useful for statistical monitoring.
const long numberOfHits = ... ; StatEntity& stat = ... ; stat = numberOfHits ;
f | new value of the counter |
< reset the statistics
< use the regular inrement
Definition at line 334 of file StatEntity.h.
00335 { 00336 // reset the statistics 00337 reset() ; 00338 // use the regular inrement 00339 return ((*this)+=f); 00340 }
StatEntity& StatEntity::operator+= | ( | const StatEntity & | other | ) |
increment with other counter (useful for Monitoring/Adder )
const StatEntity second = ... ; StatEntity first = ... ; first += second ;
other | counter to be added |
bool StatEntity::operator< | ( | const StatEntity & | se | ) | const |
comparison
unsigned long StatEntity::addFlag | ( | const double | Flag | ) |
add a flag
Flag | value to be added |
void StatEntity::reset | ( | ) |
reset the counters
void StatEntity::setnEntriesBeforeReset | ( | unsigned long | nEntriesBeforeReset | ) |
DR specify number of entry before reset.
std::string StatEntity::toString | ( | ) | const |
representation as string
std::ostream& StatEntity::print | ( | std::ostream & | o = std::cout |
) | const |
printout to std::ostream
s | the reference to the output stream |
std::ostream& StatEntity::fillStream | ( | std::ostream & | o | ) | const [inline] |
printout to std::ostream
s | the reference to the output stream |
Definition at line 378 of file StatEntity.h.
00378 { return print ( o ) ; }
unsigned long StatEntity::m_se_nEntries [private] |
double StatEntity::m_se_accumulatedFlag [private] |
double StatEntity::m_se_accumulatedFlag2 [private] |
Definition at line 384 of file StatEntity.h.
double StatEntity::m_se_minimalFlag [private] |
Definition at line 385 of file StatEntity.h.
double StatEntity::m_se_maximalFlag [private] |
Definition at line 386 of file StatEntity.h.
long StatEntity::m_se_nEntriesBeforeReset [private] |
Definition at line 388 of file StatEntity.h.