The Gaudi Framework  v29r0 (ff2e7097)
EventCounter.cpp
Go to the documentation of this file.
3 
7 EventCounter::EventCounter( const std::string& name, ISvcLocator* pSvcLocator ) : Algorithm( name, pSvcLocator )
8 {
9  m_frequency.verifier().setBounds( 0, 1000 );
10 }
11 
13 {
14  info() << name() << ":EventCounter::initialize - Frequency: " << m_frequency << endmsg;
15  return StatusCode::SUCCESS;
16 }
17 
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 
33 {
34  info() << name() << ":EventCounter::finalize - total events: " << m_total << endmsg;
35  return StatusCode::SUCCESS;
36 }
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:731
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:28
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:209