| The Gaudi Framework v28r2p1 (f1a77ff4)

- 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) :
8 Algorithm( name, pSvcLocator)
9 {
10 m_frequency.verifier().setBounds( 0, 1000 );
11 }
12
13 StatusCode
14 EventCounter::initialize()
15 {
16 info() << name( ) << ":EventCounter::initialize - Frequency: " << m_frequency << endmsg;
17 return StatusCode::SUCCESS;
18 }
19
20 StatusCode
21 EventCounter::execute()
22 {
23 m_total++;
24 int freq = m_frequency;
25 if ( freq > 0 ) {
26 ++m_skip;
27 if ( m_skip >= freq ) {
28 info() << name( ) << ":EventCounter::execute - seen events: " << m_total << endmsg;
29 m_skip = 0;
30 }
31 }
32 return StatusCode::SUCCESS;
33 }
34
35 StatusCode
36 EventCounter::finalize()
37 {
38 info() << name( ) << ":EventCounter::finalize - total events: " << m_total << endmsg;
39 return StatusCode::SUCCESS;
40 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
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:715
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
MsgStream.h
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
EventCounter::initialize
StatusCode initialize() override
Definition: EventCounter.cpp:14
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:36
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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:21
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244