ATLAS Offline Software
FilterReporterParams.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 
9 //
10 // includes
11 //
12 
15 #include <cassert>
16 
18 
19 //
20 // method implementations
21 //
22 
24 initialize (bool enabled)
25 {
26  if (m_isInitialized)
27  {
28  return StatusCode::SUCCESS;
29  }
30 
31  m_isEnabled = enabled;
32 
34 
35 #ifndef XAOD_STANDALONE
36  if (m_isEnabled && !m_cutFlowSvc.empty())
37  {
38  ANA_CHECK (m_cutFlowSvc.retrieve());
39 
40  m_cutID = m_cutFlowSvc->registerFilter (m_filterKey, m_filterDescription, false);
41  if (m_cutID == 0)
42  {
43  ANA_MSG_ERROR ("problem registering myself with the CutFlowSvc");
44  return StatusCode::FAILURE;
45  }
46  }
47 #endif
48 
49  // currently not doing anything here, but presumably if we want to
50  // add instrumentation, we may/will need to do some initialization
51  // work here.
52 
53  m_isInitialized = true;
54  return StatusCode::SUCCESS;
55 }
56 
57 
58 
60 summary ()
61 {
62  if (!m_isInitialized)
63  {
64  return std::string();
65  }
66 
67  std::stringstream stream;
68  stream << "accepted " << m_passed << " out of " << m_total << " events for filter "
69  << m_filterKey << " (" << m_filterDescription << ")";
70 
71  return stream.str();
72 }
FilterReporterParams::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
event info read handle key
Definition: FilterReporterParams.h:149
FilterReporterParams::m_cutID
CutIdentifier m_cutID
the CutIdentifier for this filter algorithm
Definition: FilterReporterParams.h:155
FilterReporterParams::m_isInitialized
bool m_isInitialized
whether the handle was initialized
Definition: FilterReporterParams.h:126
FilterReporterParams::m_filterDescription
std::string m_filterDescription
description what this filter does
Definition: FilterReporterParams.h:145
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
FilterReporterParams::m_isEnabled
bool m_isEnabled
whether the handle was initialized
Definition: FilterReporterParams.h:130
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MessageCheck.h
macros for messaging and checking status codes
FilterReporterParams::initialize
StatusCode initialize(bool enabled=true)
do anything we need to do in initialize
Definition: FilterReporterParams.cxx:24
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
FilterReporterParams::m_filterKey
std::string m_filterKey
output key of the filter
Definition: FilterReporterParams.h:141
StatusCode.h
FilterReporterParams::m_cutFlowSvc
ServiceHandle< ICutFlowSvc > m_cutFlowSvc
the handle to the service holding tables of cut-flows for filtering algs.
Definition: FilterReporterParams.h:160
FilterReporterParams::m_total
std::atomic< unsigned > m_total
Definition: FilterReporterParams.h:137
FilterReporterParams::m_passed
std::atomic< unsigned > m_passed
the count of passed and total events
Definition: FilterReporterParams.h:137
FilterReporterParams::summary
std::string summary()
report the status of filtering
Definition: FilterReporterParams.cxx:60
FilterReporterParams.h