ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
JetAnalysisAlgorithms
Root
L1jFexJetThresholdsDecoratorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
JetAnalysisAlgorithms/L1jFexJetThresholdsDecoratorAlg.h
"
6
7
#include <
AthContainers/ConstAccessor.h
>
8
#include <
AsgDataHandles/ReadHandle.h
>
9
#include <
AsgDataHandles/WriteDecorHandle.h
>
10
11
#include <cstdint>
12
#include <exception>
13
#include <string>
14
#include <vector>
15
16
#include "
TrigConfData/L1Menu.h
"
17
#include "
TrigConfData/L1Threshold.h
"
18
19
namespace
CP
20
{
21
22
L1jFexJetThresholdsDecoratorAlg::L1jFexJetThresholdsDecoratorAlg
(
23
const
std::string&
name
, ISvcLocator* svcLoc)
24
:
EL
::
AnaAlgorithm
(
name
, svcLoc) {}
25
26
27
StatusCode
L1jFexJetThresholdsDecoratorAlg::initialize
()
28
{
29
ANA_CHECK
(
m_l1JetsKey
.initialize());
30
ANA_CHECK
(
m_trigConfigTool
.retrieve());
31
32
m_thresholdsDecorKey
=
m_l1JetsKey
.key() +
"."
+
m_decorationName
.value();
33
ANA_CHECK
(
m_thresholdsDecorKey
.initialize());
34
return
StatusCode::SUCCESS;
35
}
36
37
StatusCode
L1jFexJetThresholdsDecoratorAlg::rebuildJfexThresholdTable
(
38
const
EventContext& ctx) {
39
const
TrigConf::L1Menu
* l1menu =
nullptr
;
40
try
{
41
l1menu = &
m_trigConfigTool
->l1Menu(ctx);
42
}
catch
(
const
std::exception&
e
) {
43
ANA_MSG_ERROR
(
"Could not read the L1 menu in execute(): "
44
<<
e
.what()
45
<<
". The Phase-I jFEX threshold table "
46
"cannot be built. Ensure TrigConf::xAODConfigSvc has "
47
"loaded the L1 menu for this input file."
);
48
return
StatusCode::FAILURE;
49
}
50
51
if
(
m_thresholdNamesLoaded
&& l1menu->name() ==
m_cachedL1MenuName
) {
52
return
StatusCode::SUCCESS;
53
}
54
if
(
m_thresholdNamesLoaded
) {
55
ANA_MSG_INFO
(
"L1 menu changed from '"
56
<<
m_cachedL1MenuName
<<
"' to '"
<< l1menu->name()
57
<<
"' - rebuilding jFEX threshold table"
);
58
}
59
const
auto
& thresholds = l1menu->thresholds(
m_l1ThresholdType
.value());
60
if
(thresholds.empty()) {
61
ANA_MSG_ERROR
(
"L1 menu '"
<< l1menu->name()
62
<<
"' has no thresholds of type '"
63
<<
m_l1ThresholdType
.value() <<
"'"
);
64
return
StatusCode::FAILURE;
65
}
66
m_jfexThresholdNames
.clear();
67
for
(
const
auto
& thr : thresholds) {
68
const
unsigned
int
bit = thr->mapping();
69
if
(bit >=
m_jfexThresholdNames
.size())
70
m_jfexThresholdNames
.resize(bit + 1);
71
m_jfexThresholdNames
[bit] = thr->name();
72
}
73
ANA_MSG_INFO
(
"Loaded "
<<
m_jfexThresholdNames
.size()
74
<<
" jFEX threshold names from L1 menu '"
75
<< l1menu->name() <<
"'"
);
76
m_cachedL1MenuName
= l1menu->name();
77
m_thresholdNamesLoaded
=
true
;
78
return
StatusCode::SUCCESS;
79
}
80
81
StatusCode
L1jFexJetThresholdsDecoratorAlg::execute
(
const
EventContext& ctx) {
82
ANA_CHECK
(
rebuildJfexThresholdTable
(ctx));
83
84
SG::ReadHandle<xAOD::jFexSRJetRoIContainer>
l1Jets(
m_l1JetsKey
, ctx);
85
if
(!l1Jets.
isValid
()) {
86
ANA_MSG_ERROR
(
"Failed to retrieve "
<<
m_l1JetsKey
.key());
87
return
StatusCode::FAILURE;
88
}
89
90
static
const
SG::AuxElement::ConstAccessor<uint64_t>
91
thrPatternsAcc(
"thresholdPatterns"
);
92
SG::WriteDecorHandle<xAOD::jFexSRJetRoIContainer, std::vector<std::string>
>
93
thresholdsDec(
m_thresholdsDecorKey
, ctx);
94
95
for
(
const
xAOD::jFexSRJetRoI
* roi : *l1Jets) {
96
std::vector<std::string>
passed
;
97
if
(thrPatternsAcc.isAvailable(*roi)) {
98
const
uint64_t
pat = thrPatternsAcc(*roi);
99
passed
.reserve(
m_jfexThresholdNames
.size());
100
for
(
size_t
b = 0; b <
m_jfexThresholdNames
.size(); ++b) {
101
if
(((pat >> b) & 1ULL) && !
m_jfexThresholdNames
[b].
empty
()) {
102
passed
.push_back(
m_jfexThresholdNames
[b]);
103
}
104
}
105
}
106
thresholdsDec(*roi) = std::move(
passed
);
107
}
108
109
return
StatusCode::SUCCESS;
110
}
111
}
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
L1Menu.h
L1Threshold.h
passed
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
Definition
TrigCompositeUtilsRoot.cxx:118
L1jFexJetThresholdsDecoratorAlg.h
empty
static const Attributes_t empty
Definition
XmlStreamer.cxx:16
CP::L1jFexJetThresholdsDecoratorAlg::rebuildJfexThresholdTable
StatusCode rebuildJfexThresholdTable(const EventContext &ctx)
Definition
L1jFexJetThresholdsDecoratorAlg.cxx:37
CP::L1jFexJetThresholdsDecoratorAlg::m_l1ThresholdType
Gaudi::Property< std::string > m_l1ThresholdType
Definition
L1jFexJetThresholdsDecoratorAlg.h:36
CP::L1jFexJetThresholdsDecoratorAlg::m_thresholdsDecorKey
SG::WriteDecorHandleKey< xAOD::jFexSRJetRoIContainer > m_thresholdsDecorKey
Definition
L1jFexJetThresholdsDecoratorAlg.h:47
CP::L1jFexJetThresholdsDecoratorAlg::m_cachedL1MenuName
std::string m_cachedL1MenuName
Definition
L1jFexJetThresholdsDecoratorAlg.h:58
CP::L1jFexJetThresholdsDecoratorAlg::m_l1JetsKey
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_l1JetsKey
Definition
L1jFexJetThresholdsDecoratorAlg.h:31
CP::L1jFexJetThresholdsDecoratorAlg::L1jFexJetThresholdsDecoratorAlg
L1jFexJetThresholdsDecoratorAlg(const std::string &name, ISvcLocator *svcLoc=nullptr)
Definition
L1jFexJetThresholdsDecoratorAlg.cxx:22
CP::L1jFexJetThresholdsDecoratorAlg::m_decorationName
Gaudi::Property< std::string > m_decorationName
Definition
L1jFexJetThresholdsDecoratorAlg.h:41
CP::L1jFexJetThresholdsDecoratorAlg::m_trigConfigTool
ToolHandle< TrigConf::ITrigConfigTool > m_trigConfigTool
Definition
L1jFexJetThresholdsDecoratorAlg.h:51
CP::L1jFexJetThresholdsDecoratorAlg::m_thresholdNamesLoaded
bool m_thresholdNamesLoaded
Definition
L1jFexJetThresholdsDecoratorAlg.h:57
CP::L1jFexJetThresholdsDecoratorAlg::initialize
StatusCode initialize() override
Definition
L1jFexJetThresholdsDecoratorAlg.cxx:27
CP::L1jFexJetThresholdsDecoratorAlg::m_jfexThresholdNames
std::vector< std::string > m_jfexThresholdNames
Definition
L1jFexJetThresholdsDecoratorAlg.h:56
EL::AnaAlgorithm::AnaAlgorithm
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
Definition
AnaAlgorithm.cxx:40
EL::AnaAlgorithm::execute
virtual::StatusCode execute()
execute this algorithm
Definition
AnaAlgorithm.cxx:315
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition
AsgComponentFactories.h:16
xAOD::name
name
Definition
TriggerMenuJson_v1.cxx:29
xAOD::uint64_t
uint64_t
Definition
EventInfo_v1.cxx:123
xAOD::e
setPy e
Definition
CompositeParticle_v1.cxx:166
xAOD::jFexSRJetRoI
jFexSRJetRoI_v1 jFexSRJetRoI
Define the latest version of the jFexSRJetRoI class.
Definition
jFexSRJetRoI.h:14
Generated on
for ATLAS Offline Software by
1.17.0