| The Gaudi Framework v29r0 (ff2e7097)

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

- File List
- File Members

EventCounter.cpp
Go to the documentation of this file.
1 #include "GaudiAlg/EventCounter.h"
2 #include "GaudiKernel/MsgStream.h"
3
7 EventCounter::EventCounter( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator )
8 {
9 m_frequency.verifier().setBounds( 0, 1000 );
10 }
11
12 StatusCode EventCounter::initialize()
13 {
14 info() << name() << ":EventCounter::initialize - Frequency: " << m_frequency << endmsg;
15 return StatusCode::SUCCESS;
16 }
17
18 StatusCode EventCounter::execute()
19 {
20 m_total++;
21 int freq = m_frequency;
22 if ( freq > 0 ) {
23 ++m_skip;
24 if ( m_skip >= freq ) {
25 info() << name() << ":EventCounter::execute - seen events: " << m_total << endmsg;
26 m_skip = 0;
27 }
28 }
29 return StatusCode::SUCCESS;
30 }
31
32 StatusCode EventCounter::finalize()
33 {
34 info() << name() << ":EventCounter::finalize - total events: " << m_total << endmsg;
35 return StatusCode::SUCCESS;
36 }
StatusCode::SUCCESS
Definition: StatusCode.h:31
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:731
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
MsgStream.h
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:117
EventCounter::initialize
StatusCode initialize() override
Definition: EventCounter.cpp:12
EventCounter::m_total
int m_total
The total events seen.
Definition: EventCounter.h:46
EventCounter::EventCounter
EventCounter(const std::string &name, ISvcLocator *pSvcLocator)
Constructor(s)
Definition: EventCounter.cpp:7
EventCounter::m_skip
int m_skip
The number of events skipped since the last time the count was reported.
Definition: EventCounter.h:41
std::string
STL class.
EventCounter::finalize
StatusCode finalize() override
Definition: EventCounter.cpp:32
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
EventCounter.h
EventCounter::m_frequency
Gaudi::CheckedProperty< int > m_frequency
The frequency with which the number of events should be reported.
Definition: EventCounter.h:35
EventCounter::execute
StatusCode execute() override
Definition: EventCounter.cpp:18
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209