| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

StatEntity Class Reference

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

#include <GaudiKernel/StatEntity.h>

List of all members.


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,
StatEntityoperator+= (const double f)
 General increment operator for the flag Could be used for easy manipulation with StatEntity object:.
StatEntityoperator++ ()
 Pre-increment operator for the flag Could be used for easy manipulation with StatEntity object:.
StatEntityoperator++ (int)
 Post-increment operator for the flag.
StatEntityoperator-= (const double f)
 General decrement operator fro the flag Could be used for easy manipulation with StatEntity object:.
StatEntityoperator-- ()
 Pre-decrement operator for the flag Could be used for easy manipulation with StatEntity object:.
StatEntityoperator-- (int)
 Post-decrement operator for the flag Could be used for easy manipulation with StatEntity object:.
StatEntityoperator= (const double f)
 Assignement from the flag The action: reset and the general inrement Such case could be useful for statistical monitoring.
StatEntityoperator+= (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

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

Author:
Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.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 69 of file StatEntity.h.

00069 { reset() ; }

StatEntity::StatEntity ( const unsigned long  entries,
const double  flag,
const double  flag2,
const double  minFlag,
const double  maxFlag 
)

StatEntity::~StatEntity (  )  [inline]

destructor

Definition at line 87 of file StatEntity.h.

00087 {}


Member Function Documentation

static 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

static 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

unsigned long StatEntity::nEntries (  )  const [inline]

getters

Definition at line 106 of file StatEntity.h.

00106 { return m_se_nEntries         ; }

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]

minimal flag

Definition at line 119 of file StatEntity.h.

00119 { return m_se_minimalFlag      ; }

double StatEntity::flagMax (  )  const [inline]

maximal flag

Definition at line 121 of file StatEntity.h.

00121 { return m_se_maximalFlag      ; }

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 ;
See also:
StatEntity::flagMean

StatEntity::eff

StatEntity::efficiencyErr

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.

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

double StatEntity::eff (  )  const [inline]

shortcut,

See also:
StatEntity::efficiency

Definition at line 193 of file StatEntity.h.

00193 { return efficiency    () ; }

double StatEntity::effErr (  )  const [inline]

shortcut,

See also:
StatEntity::efficiencyErr

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 ;      
    } 

Parameters:
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.

00237 { 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 256 of file StatEntity.h.

00256 { return ++(*this)      ; }

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 ;      
    } 

Parameters:
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.

00298 { 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 316 of file StatEntity.h.

00316 { return --(*this) ; }

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 ;

Parameters:
f new value of the counter
Returns:
self-reference

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

Parameters:
other counter to be added
Returns:
self-reference

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

comparison

unsigned long StatEntity::addFlag ( const double  Flag  ) 

add a flag

Parameters:
Flag value to be added
Returns:
number of entries

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

Parameters:
s the reference to the output stream

std::ostream& StatEntity::fillStream ( std::ostream &  o  )  const [inline]

printout to std::ostream

Parameters:
s the reference to the output stream

Definition at line 378 of file StatEntity.h.

00378 { return print ( o ) ; }


Member Data Documentation

unsigned long StatEntity::m_se_nEntries [private]

number of calls

Definition at line 381 of file StatEntity.h.

double StatEntity::m_se_accumulatedFlag [private]

accumulated flag

Definition at line 383 of file StatEntity.h.

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.


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

Generated on Mon Apr 11 19:57:15 2011 for GaudiKernel by doxygen 1.4.7