ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Global
GlobalSimulation
src
PU1
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()
8
#include "
StoreGate/ReadHandle.h
"
9
#include "
StoreGate/WriteHandle.h
"
10
11
namespace
GlobalSim
{
12
14
PU1SuppAlgTool::PU1SuppAlgTool
(
const
std::string&
type
,
const
std::string& name,
15
const
IInterface* parent)
16
: extends(
type
, name, parent) {}
17
18
StatusCode
PU1SuppAlgTool::initialize
() {
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
28
StatusCode
PU1SuppAlgTool::run
(
const
std::unique_ptr<IDataCollector>& dc,
29
const
EventContext& ctx)
const
{
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
()) {
36
ATH_MSG_ERROR
(
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
}
76
77
std::string
PU1SuppAlgTool::toString
()
const
{
78
return
"PU1SuppAlgTool: Tool for PU1 suppression"
;
79
}
80
81
}
// namespace GlobalSim
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
PU1SuppAlgTool.h
Athena AlgTool for running the PU1 suppression logic on input TOBs.
PU1Suppression.h
Interface for the PU1 suppression algorithm logic.
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
GlobalSim::PU1SuppAlgTool::initialize
virtual StatusCode initialize() override
Initialization of keys and setup.
Definition
PU1SuppAlgTool.cxx:18
GlobalSim::PU1SuppAlgTool::run
virtual StatusCode run(const std::unique_ptr< IDataCollector > &, const EventContext &ctx) const override
Run suppression on input TOBs and write output TOBs.
Definition
PU1SuppAlgTool.cxx:28
GlobalSim::PU1SuppAlgTool::m_portsOutWriteKey
SG::WriteHandleKey< GepAlgoPU1SuppPortsOutFIFO > m_portsOutWriteKey
Key to write suppressed TOBs to the event store.
Definition
PU1SuppAlgTool.h:58
GlobalSim::PU1SuppAlgTool::toString
virtual std::string toString() const override
Returns a string representation for diagnostics.
Definition
PU1SuppAlgTool.cxx:77
GlobalSim::PU1SuppAlgTool::PU1SuppAlgTool
PU1SuppAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition
PU1SuppAlgTool.cxx:14
GlobalSim::PU1SuppAlgTool::m_HypoFIFOReadKey
SG::ReadHandleKey< GepAlgoPU1SuppFIFO > m_HypoFIFOReadKey
Key to read TOB FIFO from the event store.
Definition
PU1SuppAlgTool.h:53
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
GlobalSim
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition
Trigger/TrigT1/Global/GlobalSimulation/src/Egamma1BDT/Egamma1BDT/BDT.h:11
GlobalSim::runPU1Suppression
StatusCode runPU1Suppression(const PU1SuppPortsIn &input, PU1SuppPortsOut &output, MsgStream &msg)
Runs PU1 suppression algorithm on a single event.
Definition
PU1Suppression.cxx:22
type
GlobalSim::PU1SuppPortsOut
Output data structure for PU1 suppression.
Definition
PU1SuppPortsOut.h:28
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0