Loading [MathJax]/jax/input/TeX/config.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EventCounter.cpp
Go to the documentation of this file.
3 
7 EventCounter::EventCounter( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator ) {
8  m_frequency.verifier().setBounds( 0, 1000 );
9 }
10 
12  info() << name() << ":EventCounter::initialize - Frequency: " << m_frequency << endmsg;
13  return StatusCode::SUCCESS;
14 }
15 
17  m_total++;
18  int freq = m_frequency;
19  if ( freq > 0 ) {
20  ++m_skip;
21  if ( m_skip >= freq ) {
22  info() << name() << ":EventCounter::execute - seen events: " << m_total << endmsg;
23  m_skip = 0;
24  }
25  }
26  return StatusCode::SUCCESS;
27 }
28 
30  info() << name() << ":EventCounter::finalize - total events: " << m_total << endmsg;
31  return StatusCode::SUCCESS;
32 }
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:635
StatusCode initialize() override
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
int m_total
The total events seen.
Definition: EventCounter.h:40
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:35
STL class.
StatusCode finalize() override
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Alias for backward compatibility.
Definition: Algorithm.h:56
Gaudi::CheckedProperty< int > m_frequency
The frequency with which the number of events should be reported.
Definition: EventCounter.h:29
StatusCode execute() override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192