ATLAS Offline Software
Loading...
Searching...
No Matches
FilterReporter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8
9//
10// includes
11//
12
16#include <cassert>
17
20
21//
22// method implementations
23//
24
25FilterReporter ::
26FilterReporter (FilterReporterParams& val_params,
27 bool val_passedDefault)
28 : m_params (val_params)
29 , m_passed (val_passedDefault)
30 , m_eventContext (&Gaudi::Hive::currentContext())
31{
32 if (!m_params.m_isInitialized)
33 {
34 throw std::logic_error ("using uninitialized FilterReporterParams");
35 }
36}
37
38
39
40FilterReporter ::
41FilterReporter (const FilterReporterParams& val_params,
42 bool val_passedDefault,
43 const EventContext& val_eventContext)
44 : m_params (val_params)
45 , m_passed (val_passedDefault)
46 , m_eventContext (&val_eventContext)
47{
48 if (!m_params.m_isInitialized)
49 {
50 throw std::logic_error ("using uninitialized FilterReporterParams");
51 }
52}
53
54
55
56FilterReporter ::
57~FilterReporter () noexcept
58{
59 m_params.m_setFilterPassed (m_passed, m_eventContext);
60
61 if (m_passed)
62 m_params.m_passed += 1;
63 m_params.m_total += 1;
64
65#ifndef XAOD_STANDALONE
66 try {
67 if (m_passed && m_params.m_cutID != 0)
68 {
70 // Only try to access the mcEventWeight if we are running on Monte Carlo
71 if (evtInfo.isValid() && evtInfo->eventType(xAOD::EventInfo::IS_SIMULATION)) {
72 m_params.m_cutFlowSvc->addEvent (m_params.m_cutID, evtInfo->mcEventWeights());
73 } else {
74 m_params.m_cutFlowSvc->addEvent (m_params.m_cutID, 1.0);
75 }
76 }
77 }
78 catch (const SG::ExcBadVarName& e) {
79 std::cerr << e.what() << "\n";
80 std::abort();
81 }
82 catch (const SG::ExcBadAuxVar& e) {
83 std::cerr << e.what() << "\n";
84 std::abort();
85 }
86 catch (const GaudiException& e) {
87 std::cerr << e.what() << "\n";
88 std::abort();
89 }
90#endif
91}
92
93
94
95void FilterReporter ::
96setPassed (bool val_passed) noexcept
97{
98 m_passed = val_passed;
99}
Handle class for reading from StoreGate.
macros for messaging and checking status codes
a handle for applying algorithm filter decisions
const FilterReporterParams & m_params
the FilterReporterParams object
const EventContext * m_eventContext
current EventContext reference
bool m_passed
the value of passed we will set
Exception — Attempt to retrieve nonexistent aux data item.
Exception — Bad name for auxiliary variable.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
@ IS_SIMULATION
true: simulation, false: data
=============================================================================