EventCounter.cpp
Go to the documentation of this file.
3 
8  Algorithm( name, pSvcLocator)
9 {
10  declareProperty( "Frequency", m_frequency=1 );
11  m_frequency.verifier().setBounds( 0, 1000 );
12 }
13 
16 {
17  info() << name( ) << ":EventCounter::initialize - Frequency: " << m_frequency << endmsg;
18  return StatusCode::SUCCESS;
19 }
20 
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 
38 {
39  info() << name( ) << ":EventCounter::finalize - total events: " << m_total << endmsg;
40  return StatusCode::SUCCESS;
41 }
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)
StatusCode initialize() override
void setBounds(const T &lower, const T &upper)
Set both bounds (lower and upper) at the same time.
IntegerProperty m_frequency
The frequency with which the number of events should be reported.
Definition: EventCounter.h:36
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Algorithm.h:426
int m_total
The total events seen.
Definition: EventCounter.h:47
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:42
STL class.
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
StatusCode finalize() override
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
VERIFIER & verifier()
Definition: Property.h:401
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
StatusCode execute() override
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244