The Gaudi Framework
v26r1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
m_skip ( 0 ),
10
m_total( 0 )
11
{
12
declareProperty
(
"Frequency"
,
m_frequency
=1 );
13
m_frequency
.
verifier
().setBounds( 0, 1000 );
14
}
15
19
EventCounter::~EventCounter
( )
20
{
21
}
22
23
StatusCode
24
EventCounter::initialize
()
25
{
26
MsgStream
log
(
msgSvc
(),
name
());
27
log <<
MSG::INFO
<<
name
( ) <<
":EventCounter::initialize - Frequency: "
<<
m_frequency
<<
endmsg
;
28
return
StatusCode::SUCCESS
;
29
}
30
31
StatusCode
32
EventCounter::execute
()
33
{
34
MsgStream
log
(
msgSvc
(),
name
());
35
m_total
++;
36
int
freq =
m_frequency
;
37
if
( freq > 0 ) {
38
m_skip
++;
39
if
(
m_skip
>= freq ) {
40
log <<
MSG::INFO
<<
name
( ) <<
":EventCounter::execute - seen events: "
<<
m_total
<<
endmsg
;
41
m_skip
= 0;
42
}
43
}
44
return
StatusCode::SUCCESS
;
45
}
46
47
StatusCode
48
EventCounter::finalize
()
49
{
50
MsgStream
log
(
msgSvc
(),
name
());
51
log <<
MSG::INFO
<<
name
( ) <<
":EventCounter::finalize - total events: "
<<
m_total
<<
endmsg
;
52
return
StatusCode::SUCCESS
;
53
}
GaudiAlg
src
lib
EventCounter.cpp
Generated on Mon Feb 16 2015 11:56:52 for The Gaudi Framework by
1.8.2