ATLAS Offline Software
Loading...
Searching...
No Matches
PU1SuppAlgTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4#include "PU1SuppAlgTool.h"
5
6#include "GaudiKernel/EventContext.h"
7#include "PU1Suppression.h" // Includes runPU1suppression()
10
11namespace GlobalSim {
12
14PU1SuppAlgTool::PU1SuppAlgTool(const std::string& type, const std::string& name,
15 const IInterface* parent)
16 : extends(type, name, parent) {}
17
19 ATH_MSG_INFO("Initializing PU1SuppAlgTool");
20
21 // Initialize read/write handles
22 ATH_CHECK(m_HypoFIFOReadKey.initialize());
23 ATH_CHECK(m_portsOutWriteKey.initialize());
24
25 return StatusCode::SUCCESS;
26}
27
28StatusCode PU1SuppAlgTool::run(const EventContext& ctx) const {
29 ATH_MSG_DEBUG("Running PU1SuppAlgTool");
30
31 // Read input FIFO of TOBs
33 if (!fifoHandle.isValid()) {
35 "Failed to retrieve PU1 TOBs with key: " << m_HypoFIFOReadKey.key());
36 return StatusCode::FAILURE;
37 }
38
39 ATH_MSG_DEBUG("Read " << fifoHandle->size() << " TOBs from event store");
40
41 // Create container for output TOBs
42 auto ports_out = std::make_unique<GepAlgoPU1SuppPortsOutFIFO>();
43
44 // Apply suppression to each input TOB
45 for (const auto& tob_in : *fifoHandle) {
46 PU1SuppPortsOut tob_out;
47 const StatusCode ok = runPU1Suppression(tob_in, tob_out, msg());
48 if (ok.isFailure()) {
49 ATH_MSG_WARNING("Suppression failed for one TOB - skipping");
50 continue;
51 }
52 ports_out->push_back(std::move(tob_out));
53 }
54
55 // Optionally print output TOB hex strings
56 for (const auto& tob_out : *ports_out) {
57 for (const auto& hexstr : tob_out.m_outputTobs) {
58 ATH_MSG_DEBUG("PU1SuppPortsOut TOB hex string: " << hexstr);
59 }
60 }
61
62 // Write output FIFO to event store
64 ctx);
65 ATH_CHECK(outputHandle.record(std::move(ports_out)));
66
67 ATH_MSG_DEBUG("PU1 suppression outputs recorded to event store under key: "
68 << m_portsOutWriteKey.key());
69
70 return StatusCode::SUCCESS;
71}
72
73std::string PU1SuppAlgTool::toString() const {
74 return "PU1SuppAlgTool: Tool for PU1 suppression";
75}
76
77} // namespace GlobalSim
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Athena AlgTool for running the PU1 suppression logic on input TOBs.
Interface for the PU1 suppression algorithm logic.
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
virtual StatusCode initialize() override
Initialization of keys and setup.
SG::WriteHandleKey< GepAlgoPU1SuppPortsOutFIFO > m_portsOutWriteKey
Key to write suppressed TOBs to the event store.
virtual std::string toString() const override
Returns a string representation for diagnostics.
virtual StatusCode run(const EventContext &ctx) const override
Run suppression on input TOBs and write output TOBs.
PU1SuppAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
SG::ReadHandleKey< GepAlgoPU1SuppFIFO > m_HypoFIFOReadKey
Key to read TOB FIFO from the event store.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
Output data structure for PU1 suppression.
MsgStream & msg
Definition testRead.cxx:32