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 std::unique_ptr< IDataCollector > &, 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 31 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 std::unique_ptr< IDataCollector > & dc,
const EventContext & ctx ) const
overridevirtual

Run suppression on input TOBs and write output TOBs.

Definition at line 28 of file PU1SuppAlgTool.cxx.

29 {
30 ATH_MSG_DEBUG("Running PU1SuppAlgTool");
31 if (dc){dc->collect(*this, "start");}
32
33 // Read input FIFO of TOBs
34 SG::ReadHandle<GepAlgoPU1SuppFIFO> fifoHandle(m_HypoFIFOReadKey, ctx);
35 if (!fifoHandle.isValid()) {
37 "Failed to retrieve PU1 TOBs with key: " << m_HypoFIFOReadKey.key());
38 return StatusCode::FAILURE;
39 }
40
41 ATH_MSG_DEBUG("Read " << fifoHandle->size() << " TOBs from event store");
42
43 // Create container for output TOBs
44 auto ports_out = std::make_unique<GepAlgoPU1SuppPortsOutFIFO>();
45
46 // Apply suppression to each input TOB
47 for (const auto& tob_in : *fifoHandle) {
48 PU1SuppPortsOut tob_out;
49 const StatusCode ok = runPU1Suppression(tob_in, tob_out, msg());
50 if (ok.isFailure()) {
51 ATH_MSG_WARNING("Suppression failed for one TOB - skipping");
52 continue;
53 }
54 ports_out->push_back(std::move(tob_out));
55 }
56
57 // Optionally print output TOB hex strings
58 for (const auto& tob_out : *ports_out) {
59 for (const auto& hexstr : tob_out.m_outputTobs) {
60 ATH_MSG_DEBUG("PU1SuppPortsOut TOB hex string: " << hexstr);
61 }
62 }
63
64 // Write output FIFO to event store
65 SG::WriteHandle<GepAlgoPU1SuppPortsOutFIFO> outputHandle(m_portsOutWriteKey,
66 ctx);
67 ATH_CHECK(outputHandle.record(std::move(ports_out)));
68
69 ATH_MSG_DEBUG("PU1 suppression outputs recorded to event store under key: "
70 << m_portsOutWriteKey.key());
71
72
73 if (dc){dc->collect(*this, "end");}
74 return StatusCode::SUCCESS;
75}
#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 77 of file PU1SuppAlgTool.cxx.

77 {
78 return "PU1SuppAlgTool: Tool for PU1 suppression";
79}

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 53 of file PU1SuppAlgTool.h.

53 {
54 this, "HypoFIFOReadKey", "SuppFIFO", "Input key for PU1 TOBs"
55 };

◆ 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 58 of file PU1SuppAlgTool.h.

58 {
59 this, "PortsOutWriteKey", "PU1SuppOut", "Output key for suppressed TOBs"
60 };

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