ATLAS Offline Software
Loading...
Searching...
No Matches
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
23StatusCode FilterReporterParams ::
24initialize (bool enabled)
25{
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
59std::string FilterReporterParams ::
60summary ()
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}
macros for messaging and checking status codes
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
bool m_isInitialized
whether the handle was initialized
std::atomic< unsigned > m_passed
the count of passed and total events
bool m_isEnabled
whether the handle was initialized
std::atomic< unsigned > m_total
std::string m_filterDescription
description what this filter does
CutIdentifier m_cutID
the CutIdentifier for this filter algorithm
ServiceHandle< ICutFlowSvc > m_cutFlowSvc
the handle to the service holding tables of cut-flows for filtering algs.
std::string m_filterKey
output key of the filter
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
event info read handle key