ATLAS Offline Software
AthEventCounter.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // AthEventCounter.cxx
8 // Implementation file for class AthEventCounter
9 // Author: S.Binet<binet@cern.ch>
11 
12 #include "AthEventCounter.h"
13 #include <cstdlib>
14 
17 {
18  ATH_MSG_INFO ("initialize ==> Frequency: " << m_frequency);
19  return StatusCode::SUCCESS;
20 }
21 
23 AthEventCounter::execute(const EventContext& ) const
24 {
25  int currTotal=(m_total++);
26  if (m_frequency==0) {
27  return StatusCode::SUCCESS;
28  }
29 
30  int rem=std::div(currTotal,m_frequency).rem;
31 
32  if (rem==0) {
33  ATH_MSG_INFO ("execute ==> seen events: " << currTotal);
34  }
35  return StatusCode::SUCCESS;
36 }
37 
40 {
41  ATH_MSG_INFO ("finalize ==> total events: " << m_total);
42  return StatusCode::SUCCESS;
43 }
AthEventCounter::execute
StatusCode execute(const EventContext &ctx) const
Definition: AthEventCounter.cxx:23
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthEventCounter::m_frequency
Gaudi::Property< int > m_frequency
The frequency with which the number of events should be reported.
Definition: AthEventCounter.h:44
AthEventCounter::finalize
StatusCode finalize()
Definition: AthEventCounter.cxx:39
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthEventCounter.h
AthEventCounter::m_total
std::atomic< int > m_total
The total events seen.
Definition: AthEventCounter.h:51
AthEventCounter::initialize
StatusCode initialize()
Definition: AthEventCounter.cxx:16