ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
JetAnalysisAlgorithms
Root
JfexThresholdTable.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/JfexThresholdTable.h
"
6
7
#include <
AthContainers/ConstAccessor.h
>
8
9
#include <cstdint>
10
#include <exception>
11
12
#include "
TrigConfData/L1Menu.h
"
13
#include "
TrigConfData/L1Threshold.h
"
14
15
namespace
CP
16
{
17
StatusCode
JfexThresholdTable::update
(
18
ToolHandle<TrigConf::ITrigConfigTool>& trigConfigTool,
19
const
std::string& thresholdType,
const
EventContext& ctx,
20
MsgStream&
msg
) {
21
const
TrigConf::L1Menu
* l1menu =
nullptr
;
22
try
{
23
l1menu = &trigConfigTool->l1Menu(ctx);
24
}
catch
(
const
std::exception&
e
) {
25
msg
<< MSG::ERROR <<
"Could not read the L1 menu in execute(): "
26
<<
e
.what()
27
<<
". The Phase-I jFEX threshold table "
28
"cannot be built. Ensure TrigConf::xAODConfigSvc has "
29
"loaded the L1 menu for this input file."
<<
endmsg
;
30
return
StatusCode::FAILURE;
31
}
32
33
if
(
m_loaded
&& l1menu->name() ==
m_menuName
) {
34
return
StatusCode::SUCCESS;
35
}
36
if
(
m_loaded
) {
37
msg
<< MSG::INFO <<
"L1 menu changed from '"
38
<<
m_menuName
<<
"' to '"
<< l1menu->name()
39
<<
"' - rebuilding jFEX threshold table"
<<
endmsg
;
40
}
41
const
auto
& thresholds = l1menu->thresholds(thresholdType);
42
if
(thresholds.empty()) {
43
msg
<< MSG::ERROR <<
"L1 menu '"
<< l1menu->name()
44
<<
"' has no thresholds of type '"
<< thresholdType <<
"'"
45
<<
endmsg
;
46
return
StatusCode::FAILURE;
47
}
48
m_names
.clear();
49
for
(
const
auto
& thr : thresholds) {
50
const
unsigned
int
bit = thr->mapping();
51
if
(bit >=
m_names
.size())
52
m_names
.resize(bit + 1);
53
m_names
[bit] = thr->name();
54
}
55
msg
<< MSG::INFO <<
"Loaded "
<<
m_names
.size()
56
<<
" jFEX threshold names from L1 menu '"
57
<< l1menu->name() <<
"'"
<<
endmsg
;
58
m_menuName
= l1menu->name();
59
m_loaded
=
true
;
60
return
StatusCode::SUCCESS;
61
}
62
63
std::vector<std::string>
JfexThresholdTable::decode
(
64
const
xAOD::jFexSRJetRoI
& roi)
const
{
65
std::vector<std::string>
passed
;
66
static
const
SG::ConstAccessor<uint64_t>
thrPatternsAcc(
"thresholdPatterns"
);
67
if
(!thrPatternsAcc.
isAvailable
(roi))
return
passed
;
68
const
uint64_t
pat = thrPatternsAcc(roi);
69
passed
.reserve(
m_names
.size());
70
for
(
size_t
b = 0; b <
m_names
.size(); ++b) {
71
if
(((pat >> b) & 1ULL) && !
m_names
[b].
empty
()) {
72
passed
.push_back(
m_names
[b]);
73
}
74
}
75
return
passed
;
76
}
77
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
JfexThresholdTable.h
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
empty
static const Attributes_t empty
Definition
XmlStreamer.cxx:16
CP::JfexThresholdTable::m_names
std::vector< std::string > m_names
Definition
JfexThresholdTable.h:39
CP::JfexThresholdTable::m_menuName
std::string m_menuName
Definition
JfexThresholdTable.h:41
CP::JfexThresholdTable::decode
std::vector< std::string > decode(const xAOD::jFexSRJetRoI &roi) const
the names of the menu thresholds whose bits are set in the RoI's thresholdPatterns (empty if the patt...
Definition
JfexThresholdTable.cxx:63
CP::JfexThresholdTable::update
StatusCode update(ToolHandle< TrigConf::ITrigConfigTool > &trigConfigTool, const std::string &thresholdType, const EventContext &ctx, MsgStream &msg)
build the table from the current L1 menu, unless it is already built for a menu of the same name
Definition
JfexThresholdTable.cxx:17
CP::JfexThresholdTable::m_loaded
bool m_loaded
Definition
JfexThresholdTable.h:40
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition
ConstAccessor.h:55
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
TrigConf::L1Menu
L1 menu configuration.
Definition
L1Menu.h:29
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
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
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0