| The Gaudi Framework v27r1

- 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 declareProperty( "Frequency", m_frequency=1 );
11 m_frequency.verifier().setBounds( 0, 1000 );
12 }
13
14 StatusCode
15 EventCounter::initialize()
16 {
17 info() << name( ) << ":EventCounter::initialize - Frequency: " << m_frequency << endmsg;
18 return StatusCode::SUCCESS;
19 }
20
21 StatusCode
22 EventCounter::execute()
23 {
24 m_total++;
25 int freq = m_frequency;
26 if ( freq > 0 ) {
27 ++m_skip;
28 if ( m_skip >= freq ) {
29 info() << name( ) << ":EventCounter::execute - seen events: " << m_total << endmsg;
30 m_skip = 0;
31 }
32 }
33 return StatusCode::SUCCESS;
34 }
35
36 StatusCode
37 EventCounter::finalize()
38 {
39 info() << name( ) << ":EventCounter::finalize - total events: " << m_total << endmsg;
40 return StatusCode::SUCCESS;
41 }
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
MsgStream.h
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:124
EventCounter::initialize
StatusCode initialize() override
Definition: EventCounter.cpp:15
BoundedVerifier::setBounds
void setBounds(const T &lower, const T &upper)
Set both bounds (lower and upper) at the same time.
Definition: PropertyVerifier.h:107
EventCounter::m_frequency
IntegerProperty m_frequency
The frequency with which the number of events should be reported.
Definition: EventCounter.h:36
Algorithm::declareProperty
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:426
EventCounter::m_total
int m_total
The total events seen.
Definition: EventCounter.h:47
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:42
std::string
STL class.
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
EventCounter::finalize
StatusCode finalize() override
Definition: EventCounter.cpp:37
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
PropertyWithVerifier::verifier
VERIFIER & verifier()
Definition: Property.h:401
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
EventCounter.h
EventCounter::execute
StatusCode execute() override
Definition: EventCounter.cpp:22
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244