ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigSteer
HLTSeeding
HLTSeeding
IRoIThresholdsTool.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
#ifndef HLTSEEDING_IROITHRESHOLDSTOOL_H
5
#define HLTSEEDING_IROITHRESHOLDSTOOL_H
6
7
#include "
TrigConfData/L1Menu.h
"
8
#include "
StoreGate/ReadHandle.h
"
9
#include "
StoreGate/ReadHandleKey.h
"
10
#include "
StoreGate/WriteDecorHandle.h
"
11
#include "
StoreGate/WriteDecorHandleKey.h
"
12
#include "
AthenaBaseComps/AthAlgTool.h
"
13
#include "GaudiKernel/IAlgTool.h"
14
15
class
IRoIThresholdsTool
:
virtual
public
IAlgTool {
16
public
:
17
DeclareInterfaceID
(
IRoIThresholdsTool
, 1, 0);
18
virtual
StatusCode
decorateThresholds
(
const
EventContext& eventContext)
const
= 0;
19
};
20
21
template
<
typename
T_RoI,
typename
T_RoIContainer, const
char
* N_RoIContainer, const
char
* N_ThresholdType>
22
class
RoIThresholdsTool
:
public
extends<AthAlgTool, IRoIThresholdsTool> {
23
public
:
24
using
ThrVec
= std::vector<std::shared_ptr<TrigConf::L1Threshold>>;
25
using
ThrVecRef
= std::reference_wrapper<const ThrVec>;
26
using
ExtraInfoRef
= std::reference_wrapper<const TrigConf::L1ThrExtraInfoBase>;
27
28
RoIThresholdsTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent)
29
: base_class(
type
, name, parent) {}
30
31
virtual
StatusCode
initialize
()
override
{
32
ATH_CHECK
(
m_l1MenuKey
.initialize());
33
ATH_CHECK
(
m_thresholdPatternsKey
.initialize());
34
return
StatusCode::SUCCESS;
35
}
36
37
virtual
std::optional<ThrVecRef>
getMenuThresholds
(
const
TrigConf::L1Menu
& l1Menu)
const
{
38
// Retrieve the thresholds vector from L1 menu configuration
39
std::optional<ThrVecRef> menuThresholds;
40
try
{
41
menuThresholds =
ThrVecRef
(l1Menu.
thresholds
(N_ThresholdType));
42
}
43
catch
(
const
std::exception& ex) {
44
ATH_MSG_ERROR
(
"Failed to retrieve "
<< N_ThresholdType <<
" thresholds from L1 menu. Exception:"
<< ex.what());
45
return
{};
46
}
47
return
menuThresholds;
48
}
49
50
virtual
std::optional<ExtraInfoRef>
getMenuThresholdExtraInfo
(
const
TrigConf::L1Menu
& l1Menu)
const
{
51
// Retrieve the thresholds vector from L1 menu configuration
52
std::optional<ExtraInfoRef> menuExtraInfo;
53
try
{
54
menuExtraInfo =
ExtraInfoRef
(l1Menu.
thrExtraInfo
().
thrExtraInfo
(N_ThresholdType));
55
}
56
catch
(
const
std::exception& ex) {
57
ATH_MSG_ERROR
(
"Failed to retrieve "
<< N_ThresholdType <<
" threshold extra info from L1 menu. Exception:"
<< ex.what());
58
return
{};
59
}
60
return
menuExtraInfo;
61
}
62
63
virtual
StatusCode
decorateThresholds
(
const
EventContext& eventContext)
const override
{
64
// Retrieve the L1 menu configuration
65
SG::ReadHandle<TrigConf::L1Menu>
l1Menu =
SG::makeHandle
(
m_l1MenuKey
, eventContext);
66
ATH_CHECK
(l1Menu.
isValid
());
67
std::optional<ThrVecRef> menuThresholds =
getMenuThresholds
(*l1Menu);
68
ATH_CHECK
(menuThresholds.has_value());
69
std::optional<ExtraInfoRef> menuExtraInfo =
getMenuThresholdExtraInfo
(*l1Menu);
70
ATH_CHECK
(menuExtraInfo.has_value());
71
72
// Decorate the RoI objects with threshold patterns
73
SG::WriteDecorHandle<T_RoIContainer, uint64_t>
thresholdPatterns(
m_thresholdPatternsKey
, eventContext);
74
for
(
const
T_RoI* roi: *thresholdPatterns) {
75
try
{
76
thresholdPatterns(*roi) =
getPattern
(eventContext, *roi, menuThresholds.value().get(), menuExtraInfo.value().get());
77
}
78
catch
(
const
std::exception& ex) {
79
ATH_MSG_ERROR
(
"getPattern() for "
<< N_RoIContainer <<
" failed with exception: "
<< ex.what());
80
return
StatusCode::FAILURE;
81
}
82
}
83
84
return
StatusCode::SUCCESS;
85
}
86
88
virtual
uint64_t
getPattern
(
const
EventContext& ctx,
89
const
T_RoI& roi,
90
const
ThrVec
& menuThresholds,
91
const
TrigConf::L1ThrExtraInfoBase
& menuExtraInfo)
const
= 0;
92
93
protected
:
94
SG::ReadHandleKey<TrigConf::L1Menu>
m_l1MenuKey
{
95
this
,
"L1TriggerMenu"
,
"DetectorStore+L1TriggerMenu"
,
96
"Name of the L1Menu object to read configuration from"
};
97
98
SG::WriteDecorHandleKey<T_RoIContainer>
m_thresholdPatternsKey
{
99
this
,
"ThresholdPatternsDecorKey"
, std::string(N_RoIContainer)+
".thresholdPatterns"
,
100
"Decoration for the threshold patterns"
};
101
};
102
103
#endif
// HLTSEEDING_IROITHRESHOLDSTOOL_H
AthAlgTool.h
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
L1Menu.h
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
IRoIThresholdsTool
Definition
IRoIThresholdsTool.h:15
IRoIThresholdsTool::DeclareInterfaceID
DeclareInterfaceID(IRoIThresholdsTool, 1, 0)
IRoIThresholdsTool::decorateThresholds
virtual StatusCode decorateThresholds(const EventContext &eventContext) const =0
RoIThresholdsTool::RoIThresholdsTool
RoIThresholdsTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
IRoIThresholdsTool.h:28
RoIThresholdsTool::ThrVecRef
std::reference_wrapper< const ThrVec > ThrVecRef
Definition
IRoIThresholdsTool.h:25
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType >::m_thresholdPatternsKey
SG::WriteDecorHandleKey< T_RoIContainer > m_thresholdPatternsKey
Definition
IRoIThresholdsTool.h:98
RoIThresholdsTool::getMenuThresholds
virtual std::optional< ThrVecRef > getMenuThresholds(const TrigConf::L1Menu &l1Menu) const
Definition
IRoIThresholdsTool.h:37
RoIThresholdsTool::ThrVec
std::vector< std::shared_ptr< TrigConf::L1Threshold > > ThrVec
Definition
IRoIThresholdsTool.h:24
RoIThresholdsTool::decorateThresholds
virtual StatusCode decorateThresholds(const EventContext &eventContext) const override
Definition
IRoIThresholdsTool.h:63
RoIThresholdsTool::initialize
virtual StatusCode initialize() override
Definition
IRoIThresholdsTool.h:31
RoIThresholdsTool::getMenuThresholdExtraInfo
virtual std::optional< ExtraInfoRef > getMenuThresholdExtraInfo(const TrigConf::L1Menu &l1Menu) const
Definition
IRoIThresholdsTool.h:50
RoIThresholdsTool< T_RoI, T_RoIContainer, ContainerName, ThresholdType >::m_l1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
Definition
IRoIThresholdsTool.h:94
RoIThresholdsTool::ExtraInfoRef
std::reference_wrapper< const TrigConf::L1ThrExtraInfoBase > ExtraInfoRef
Definition
IRoIThresholdsTool.h:26
RoIThresholdsTool::getPattern
virtual uint64_t getPattern(const EventContext &ctx, const T_RoI &roi, const ThrVec &menuThresholds, const TrigConf::L1ThrExtraInfoBase &menuExtraInfo) const =0
To be implemented by each template instance.
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition
StoreGate/StoreGate/ReadHandleKey.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition
StoreGate/StoreGate/WriteDecorHandleKey.h:90
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
TrigConf::L1Menu
L1 menu configuration.
Definition
L1Menu.h:29
TrigConf::L1Menu::thrExtraInfo
const L1ThrExtraInfo & thrExtraInfo() const
Access to extra info for threshold types.
Definition
L1Menu.cxx:313
TrigConf::L1Menu::thresholds
std::vector< std::shared_ptr< TrigConf::L1Threshold > > thresholds() const
Access to list of all L1Thresholds.
Definition
L1Menu.cxx:266
TrigConf::L1ThrExtraInfoBase
L1 extra information for certain threshold types.
Definition
L1ThresholdBase.h:72
TrigConf::L1ThrExtraInfo::thrExtraInfo
const L1ThrExtraInfoBase & thrExtraInfo(const std::string &thrTypeName) const
Definition
L1ThrExtraInfo.cxx:201
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
type
Generated on
for ATLAS Offline Software by
1.17.0