| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Member Functions | Private Attributes

# 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)
virtual | ~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.

                                                                              :
      Algorithm(name, pSvcLocator),
      m_skip ( 0 ),
      m_total( 0 )
    {
        declareProperty( "Frequency", m_frequency=1 );
        m_frequency.verifier().setBounds( 0, 1000 );
    }

EventCounter::~EventCounter | ( | ) | `[virtual]`

Destructor.

Definition at line 21 of file EventCounter.cpp.

    {
    }

## Member Function Documentation

StatusCode EventCounter::execute | ( | ) |

Definition at line 34 of file EventCounter.cpp.

    {
         MsgStream log(msgSvc(), name());
         m_total++;
         int freq = m_frequency;
         if ( freq > 0 ) {
             m_skip++;
             if ( m_skip >= freq ) {
                 log << MSG::INFO << name( ) << ":EventCounter::execute - seen events: " << m_total << endmsg;
                 m_skip = 0;
             }
         }
        return StatusCode::SUCCESS;
    }

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

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

Reimplemented from Algorithm.

Definition at line 50 of file EventCounter.cpp.

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

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

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

Reimplemented from Algorithm.

Definition at line 26 of file EventCounter.cpp.

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

## 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_v23r0/GaudiAlg/GaudiAlg/EventCounter.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiAlg/src/lib/EventCounter.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines