All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EventCounter.cpp
Go to the documentation of this file.
3 
8  Algorithm( name, pSvcLocator)
9 {
10  m_frequency.verifier().setBounds( 0, 1000 );
11 }
12 
15 {
16  info() << name( ) << ":EventCounter::initialize - Frequency: " << m_frequency << endmsg;
17  return StatusCode::SUCCESS;
18 }
19 
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 
37 {
38  info() << name( ) << ":EventCounter::finalize - total events: " << m_total << endmsg;
39  return StatusCode::SUCCESS;
40 }
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:715
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
StatusCode initialize() override
int m_total
The total events seen.
Definition: EventCounter.h:46
EventCounter(const std::string &name, ISvcLocator *pSvcLocator)
Constructor(s)
Definition: EventCounter.cpp:7
int m_skip
The number of events skipped since the last time the count was reported.
Definition: EventCounter.h:41
STL class.
StatusCode finalize() override
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:78
Gaudi::CheckedProperty< int > m_frequency
The frequency with which the number of events should be reported.
Definition: EventCounter.h:35
StatusCode execute() override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244