ATLAS Offline Software
Loading...
Searching...
No Matches
CP::JfexThresholdTable Class Referencefinal

the Phase-I L1 jFEX threshold bit-to-name table, taken from the L1 menu, shared by the algorithms decoding jFEX thresholdPatterns More...

#include <JfexThresholdTable.h>

Collaboration diagram for CP::JfexThresholdTable:

Public Member Functions

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
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 pattern is not available)

Private Attributes

std::vector< std::string > m_names
bool m_loaded {false}
std::string m_menuName

Detailed Description

the Phase-I L1 jFEX threshold bit-to-name table, taken from the L1 menu, shared by the algorithms decoding jFEX thresholdPatterns

The table has to be (re)built lazily from execute(), as beginInputFile() fires before xAODConfigSvc publishes the menu (map::at). It is rebuilt whenever the L1 menu name changes.

Definition at line 25 of file JfexThresholdTable.h.

Member Function Documentation

◆ decode()

std::vector< std::string > CP::JfexThresholdTable::decode ( const xAOD::jFexSRJetRoI & roi) const

the names of the menu thresholds whose bits are set in the RoI's thresholdPatterns (empty if the pattern is not available)

Definition at line 63 of file JfexThresholdTable.cxx.

64 {
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 }
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
static const Attributes_t empty
std::vector< std::string > m_names
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570

◆ update()

StatusCode CP::JfexThresholdTable::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 at line 17 of file JfexThresholdTable.cxx.

20 {
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 }
#define endmsg
constexpr unsigned int bit(int n)
MsgStream & msg
Definition testRead.cxx:32

Member Data Documentation

◆ m_loaded

bool CP::JfexThresholdTable::m_loaded {false}
private

Definition at line 40 of file JfexThresholdTable.h.

40{false};

◆ m_menuName

std::string CP::JfexThresholdTable::m_menuName
private

Definition at line 41 of file JfexThresholdTable.h.

◆ m_names

std::vector<std::string> CP::JfexThresholdTable::m_names
private

Definition at line 39 of file JfexThresholdTable.h.


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