ATLAS Offline Software
Loading...
Searching...
No Matches
GlobalSim::PU1SuppAlgTool Class Reference

Implements the IGlobalSimAlgTool interface to run PU1 suppression. More...

#include <PU1SuppAlgTool.h>

Inheritance diagram for GlobalSim::PU1SuppAlgTool:
Collaboration diagram for GlobalSim::PU1SuppAlgTool:

Public Member Functions

 PU1SuppAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor.
virtual ~PU1SuppAlgTool ()=default
 Destructor.
virtual StatusCode initialize () override
 Initialization of keys and setup.
virtual StatusCode run (const EventContext &ctx) const override
 Run suppression on input TOBs and write output TOBs.
virtual std::string toString () const override
 Returns a string representation for diagnostics.

Private Attributes

SG::ReadHandleKey< GepAlgoPU1SuppFIFOm_HypoFIFOReadKey
 Key to read TOB FIFO from the event store.
SG::WriteHandleKey< GepAlgoPU1SuppPortsOutFIFOm_portsOutWriteKey
 Key to write suppressed TOBs to the event store.

Detailed Description

Implements the IGlobalSimAlgTool interface to run PU1 suppression.

Definition at line 30 of file PU1SuppAlgTool.h.

Constructor & Destructor Documentation

◆ PU1SuppAlgTool()

GlobalSim::PU1SuppAlgTool::PU1SuppAlgTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor.

Definition at line 14 of file PU1SuppAlgTool.cxx.

16 : extends(type, name, parent) {}

◆ ~PU1SuppAlgTool()

virtual GlobalSim::PU1SuppAlgTool::~PU1SuppAlgTool ( )
virtualdefault

Destructor.

Member Function Documentation

◆ initialize()

StatusCode GlobalSim::PU1SuppAlgTool::initialize ( )
overridevirtual

Initialization of keys and setup.

Definition at line 18 of file PU1SuppAlgTool.cxx.

18 {
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
SG::WriteHandleKey< GepAlgoPU1SuppPortsOutFIFO > m_portsOutWriteKey
Key to write suppressed TOBs to the event store.
SG::ReadHandleKey< GepAlgoPU1SuppFIFO > m_HypoFIFOReadKey
Key to read TOB FIFO from the event store.

◆ run()

StatusCode GlobalSim::PU1SuppAlgTool::run ( const EventContext & ctx) const
overridevirtual

Run suppression on input TOBs and write output TOBs.

Definition at line 28 of file PU1SuppAlgTool.cxx.

28 {
29 ATH_MSG_DEBUG("Running PU1SuppAlgTool");
30
31 // Read input FIFO of TOBs
32 SG::ReadHandle<GepAlgoPU1SuppFIFO> fifoHandle(m_HypoFIFOReadKey, ctx);
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
63 SG::WriteHandle<GepAlgoPU1SuppPortsOutFIFO> outputHandle(m_portsOutWriteKey,
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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
::StatusCode StatusCode
StatusCode definition for legacy code.
StatusCode runPU1Suppression(const PU1SuppPortsIn &input, PU1SuppPortsOut &output, MsgStream &msg)
Runs PU1 suppression algorithm on a single event.
MsgStream & msg
Definition testRead.cxx:32

◆ toString()

std::string GlobalSim::PU1SuppAlgTool::toString ( ) const
overridevirtual

Returns a string representation for diagnostics.

Definition at line 73 of file PU1SuppAlgTool.cxx.

73 {
74 return "PU1SuppAlgTool: Tool for PU1 suppression";
75}

Member Data Documentation

◆ m_HypoFIFOReadKey

SG::ReadHandleKey<GepAlgoPU1SuppFIFO> GlobalSim::PU1SuppAlgTool::m_HypoFIFOReadKey
private
Initial value:
{
this, "HypoFIFOReadKey", "SuppFIFO", "Input key for PU1 TOBs"
}

Key to read TOB FIFO from the event store.

Definition at line 51 of file PU1SuppAlgTool.h.

51 {
52 this, "HypoFIFOReadKey", "SuppFIFO", "Input key for PU1 TOBs"
53 };

◆ m_portsOutWriteKey

SG::WriteHandleKey<GepAlgoPU1SuppPortsOutFIFO> GlobalSim::PU1SuppAlgTool::m_portsOutWriteKey
private
Initial value:
{
this, "PortsOutWriteKey", "PU1SuppOut", "Output key for suppressed TOBs"
}

Key to write suppressed TOBs to the event store.

Definition at line 56 of file PU1SuppAlgTool.h.

56 {
57 this, "PortsOutWriteKey", "PU1SuppOut", "Output key for suppressed TOBs"
58 };

The documentation for this class was generated from the following files: