| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# EventCounter Class Reference

`#include <EventCounter.h>`

Inheritance diagram for EventCounter:

[legend]
Collaboration diagram for EventCounter:

[legend]

List of all members.

## Public Member Functions
| EventCounter (const std::string &name, ISvcLocator *pSvcLocator)
| Constructor(s).
| ~EventCounter ()
| Destructor.
StatusCode | initialize ()
| the default (empty) implementation of IStateful::initialize() method
StatusCode | execute ()
StatusCode | finalize ()
| the default (empty) implementation of IStateful::finalize() method
## Private Attributes
IntegerProperty | m_frequency
| The frequency with which the number of events should be reported.
int | m_skip
| The number of events skipped since the last time the count was reported.
int | m_total
| The total events seen.

## Detailed Description

Definition at line 4 of file EventCounter.h.

## Constructor & Destructor Documentation

EventCounter::EventCounter | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator |
| ) |  |  |

Constructor(s).

Definition at line 9 of file EventCounter.cpp.

    00009                                                                           :
    00010   Algorithm(name, pSvcLocator),
    00011   m_skip ( 0 ),
    00012   m_total( 0 )
    00013 {
    00014     declareProperty( "Frequency", m_frequency=1 );
    00015     m_frequency.verifier().setBounds( 0, 1000 );
    00016 }

EventCounter::~EventCounter | ( |  | ) |

Destructor.

Definition at line 21 of file EventCounter.cpp.

    00022 {
    00023 }

## Member Function Documentation

StatusCode EventCounter::initialize | ( |  | ) | `[virtual]`

the default (empty) implementation of IStateful::initialize() method

Reimplemented from Algorithm.

Definition at line 26 of file EventCounter.cpp.

    00027 {
    00028     MsgStream log(msgSvc(), name());
    00029     log << MSG::INFO << name( ) << ":EventCounter::initialize - Frequency: " << m_frequency << endmsg;
    00030     return StatusCode::SUCCESS;
    00031 }

StatusCode EventCounter::execute | ( |  | ) |

Definition at line 34 of file EventCounter.cpp.

    00035 {
    00036      MsgStream log(msgSvc(), name());
    00037      m_total++;
    00038      int freq = m_frequency;
    00039      if ( freq > 0 ) {
    00040          m_skip++;
    00041          if ( m_skip >= freq ) {
    00042              log << MSG::INFO << name( ) << ":EventCounter::execute - seen events: " << m_total << endmsg;
    00043              m_skip = 0;
    00044          }
    00045      }
    00046     return StatusCode::SUCCESS;
    00047 }

StatusCode EventCounter::finalize | ( |  | ) | `[virtual]`

the default (empty) implementation of IStateful::finalize() method

Reimplemented from Algorithm.

Definition at line 50 of file EventCounter.cpp.

    00051 {
    00052     MsgStream log(msgSvc(), name());
    00053     log << MSG::INFO << name( ) << ":EventCounter::finalize - total events: " << m_total << endmsg;
    00054     return StatusCode::SUCCESS;
    00055 }

## Member Data Documentation

IntegerProperty EventCounter::m_frequency`[private]`

The frequency with which the number of events should be reported.

The default is 1, corresponding to every event.

Definition at line 36 of file EventCounter.h.

int EventCounter::m_skip`[private]`

The number of events skipped since the last time the count was reported.

Definition at line 42 of file EventCounter.h.

int EventCounter::m_total`[private]`

The total events seen.

Definition at line 47 of file EventCounter.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiAlg/GaudiAlg/EventCounter.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiAlg/src/lib/EventCounter.cpp