| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# EventCounter Class Reference

`#include <EventCounter.h>`

Inheritance diagram for EventCounter:

[legend]
Collaboration diagram for EventCounter:

[legend]
List of all members.

## Detailed Description

Definition at line 4 of file EventCounter.h.

## 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 ()
| The action to be performed by the algorithm on an event.
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.

## Constructor & Destructor Documentation

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

Constructor(s).

Definition at line 9 of file EventCounter.cpp.

References Algorithm::declareProperty(), m_frequency, and PropertyWithVerifier< TYPE, VERIFIER >::verifier().

    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.

References endreq(), MSG::INFO, m_frequency, Algorithm::msgSvc(), Algorithm::name(), and StatusCode::SUCCESS.

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

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

The action to be performed by the algorithm on an event.

This method is invoked once per event for top level algorithms by the application manager.

Implements IAlgorithm.

Definition at line 34 of file EventCounter.cpp.

References endreq(), MSG::INFO, m_frequency, m_skip, m_total, Algorithm::msgSvc(), Algorithm::name(), and StatusCode::SUCCESS.

    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 << endreq;
    00043              m_skip = 0;
    00044          }
    00045      }
    00046     return StatusCode::SUCCESS;
    00047 }

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

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

Reimplemented from Algorithm.

Definition at line 50 of file EventCounter.cpp.

References endreq(), MSG::INFO, m_total, Algorithm::msgSvc(), Algorithm::name(), and StatusCode::SUCCESS.

    00051 {
    00052     MsgStream log(msgSvc(), name());
    00053     log << MSG::INFO << name( ) << ":EventCounter::finalize - total events: " << m_total << endreq;
    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.

Referenced by EventCounter(), execute(), and initialize().

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.

Referenced by execute().

int EventCounter::m_total`[private]`

The total events seen.

Definition at line 47 of file EventCounter.h.

Referenced by execute(), and finalize().

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

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