ATLAS Offline Software
Loading...
Searching...
No Matches
Trig::DecisionUnpackerAthena Class Reference

#include <DecisionUnpackerAthena.h>

Inheritance diagram for Trig::DecisionUnpackerAthena:
Collaboration diagram for Trig::DecisionUnpackerAthena:

Public Types

typedef unsigned CTPID
typedef unsigned CHAIN_COUNTER

Public Member Functions

 DecisionUnpackerAthena (const SG::ReadHandleKey< TrigDec::TrigDecision > *olddeckey)
virtual ~DecisionUnpackerAthena ()
 DecisionUnpackerAthena (const DecisionUnpackerAthena &)=delete
DecisionUnpackerAthenaoperator= (const DecisionUnpackerAthena &)=delete
virtual StatusCode unpackDecision (const EventContext &, std::unordered_map< std::string, const LVL1CTP::Lvl1Item * > &, std::map< CTPID, LVL1CTP::Lvl1Item > &, std::unordered_map< std::string, const HLT::Chain * > &, std::map< CHAIN_COUNTER, HLT::Chain > &, std::unordered_map< std::string, const HLT::Chain * > &, std::map< CHAIN_COUNTER, HLT::Chain > &, char &, bool) const override
virtual StatusCode unpackNavigation (const EventContext &, HLT::TrigNavStructure *) const override
MsgStream & msg () const
MsgStream & msg (const MSG::Level lvl) const
bool msgLvl (const MSG::Level lvl) const

Private Member Functions

StatusCode unpackItems (const LVL1CTP::Lvl1Result &result, std::map< CTPID, LVL1CTP::Lvl1Item > &, std::unordered_map< std::string, const LVL1CTP::Lvl1Item * > &) const
StatusCode unpackChains (const std::vector< uint32_t > &serialized_chains, std::map< unsigned, HLT::Chain > &cache, std::unordered_map< std::string, const HLT::Chain * > &output) const

Private Attributes

const SG::ReadHandleKey< TrigDec::TrigDecision > * m_deckey {nullptr}
 Key of the trigger decision object in the event.

Static Private Attributes

static asg::AsgTool *s_logger ATLAS_THREAD_SAFE {nullptr}

Detailed Description

Definition at line 32 of file DecisionUnpackerAthena.h.

Member Typedef Documentation

◆ CHAIN_COUNTER

typedef unsigned Trig::IDecisionUnpacker::CHAIN_COUNTER
inherited

Definition at line 33 of file IDecisionUnpacker.h.

◆ CTPID

typedef unsigned Trig::IDecisionUnpacker::CTPID
inherited

Definition at line 32 of file IDecisionUnpacker.h.

Constructor & Destructor Documentation

◆ DecisionUnpackerAthena() [1/2]

Trig::DecisionUnpackerAthena::DecisionUnpackerAthena ( const SG::ReadHandleKey< TrigDec::TrigDecision > * olddeckey)

Definition at line 16 of file DecisionUnpackerAthena.cxx.

16 :
17 m_deckey(olddeckey) {
18 }
const SG::ReadHandleKey< TrigDec::TrigDecision > * m_deckey
Key of the trigger decision object in the event.

◆ ~DecisionUnpackerAthena()

Trig::DecisionUnpackerAthena::~DecisionUnpackerAthena ( )
virtual

Definition at line 20 of file DecisionUnpackerAthena.cxx.

20 {
21 }

◆ DecisionUnpackerAthena() [2/2]

Trig::DecisionUnpackerAthena::DecisionUnpackerAthena ( const DecisionUnpackerAthena & )
delete

Member Function Documentation

◆ msg() [1/2]

MsgStream & Trig::Logger::msg ( ) const
inlineinherited

Definition at line 29 of file Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h.

29 {
30 if (s_logger) return s_logger->msg();
31 else throw std::runtime_error("TrigDecisionTool Logger not initialized.");
32 }

◆ msg() [2/2]

MsgStream & Trig::Logger::msg ( const MSG::Level lvl) const
inlineinherited

◆ msgLvl()

bool Trig::Logger::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 34 of file Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h.

34{ return s_logger && s_logger->msgLvl(lvl); }

◆ operator=()

DecisionUnpackerAthena & Trig::DecisionUnpackerAthena::operator= ( const DecisionUnpackerAthena & )
delete

◆ unpackChains()

StatusCode Trig::DecisionUnpackerAthena::unpackChains ( const std::vector< uint32_t > & serialized_chains,
std::map< unsigned, HLT::Chain > & cache,
std::unordered_map< std::string, const HLT::Chain * > & output ) const
private

Definition at line 43 of file DecisionUnpackerAthena.cxx.

45 {
46
47 if( serialized_chains.empty() ) {
48 ATH_MSG_WARNING("ChainResult is empty");
49 return StatusCode::FAILURE;
50 }
51
52 output.reserve( output.size() + cache.size() );
53
54 std::vector<uint32_t>::const_iterator rawIt = serialized_chains.begin();
55 ++rawIt; // skip first number as it is count
56 for ( ; rawIt != serialized_chains.end(); ++rawIt ) {
57
58 unsigned cntr = HLT::Chain::inquireChainCounter(*rawIt);
59
60 // localte now the chain
61 auto cacheIt = cache.find(cntr);
62 if ( cacheIt == cache.end() ) {
63 ATH_MSG_WARNING("Missing chain of counter in the configuration: " << cntr);
64 return StatusCode::FAILURE;
65 } else {
66 cacheIt->second.reset();
67 cacheIt->second.deserialize(*rawIt);
68 output[cacheIt->second.getChainName()] = &cacheIt->second;
69 ATH_MSG_VERBOSE("Updated chain in this event : " << cacheIt->second);
70 }
71 }
72 return StatusCode::SUCCESS;
73 }
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
static unsigned int inquireChainCounter(uint32_t chainWord)
unpack chain counter from the serialized word
Definition Chain.cxx:123
output
Definition merge.py:16

◆ unpackDecision()

StatusCode Trig::DecisionUnpackerAthena::unpackDecision ( const EventContext & ctx,
std::unordered_map< std::string, const LVL1CTP::Lvl1Item * > & itemsByName,
std::map< CTPID, LVL1CTP::Lvl1Item > & itemsCache,
std::unordered_map< std::string, const HLT::Chain * > & l2chainsByName,
std::map< CHAIN_COUNTER, HLT::Chain > & l2chainsCache,
std::unordered_map< std::string, const HLT::Chain * > & efchainsByName,
std::map< CHAIN_COUNTER, HLT::Chain > & efchainsCache,
char & bgCode,
bool unpackHLT ) const
overridevirtual

Implements Trig::IDecisionUnpacker.

Definition at line 75 of file DecisionUnpackerAthena.cxx.

84 {
85
86 SG::ReadHandle<TrigDec::TrigDecision> trigDec(*m_deckey, ctx);
87 const TrigDec::TrigDecision* dec = trigDec.cptr();
88
89 bgCode = dec->BGCode();
90
91 // L1 items
92 itemsByName.clear();
93 ATH_MSG_DEBUG("Unpacking of L1 items");
94 if( unpackItems(dec->getL1Result(),itemsCache,itemsByName).isFailure() ) {
95 ATH_MSG_WARNING("Unpacking of L1 items failed");
96 }
97
98
99 // protect from unpacking in case HLT was not run (i.e. configuration chains are 0)
100 if (!unpackHLT) return StatusCode::SUCCESS;
101
102
103 // L2 chains
104 l2chainsByName.clear();
105 ATH_MSG_DEBUG("Unpacking of L2 chains");
106 if ( dec->getL2Result().getHLTLevel() != HLT::UNKNOWN ) {
107 const std::vector<uint32_t>& l2_serialized_chains = dec->getL2Result().getChainResult();
108 ATH_MSG_DEBUG(l2_serialized_chains.size() << " L2 chains");
109
110 if ( unpackChains(l2_serialized_chains, l2chainsCache, l2chainsByName).isFailure() ) {
111 ATH_MSG_WARNING("Unpacking of L2 chains failed");
112 }
113 }
114
115 // EF chains
116 ATH_MSG_DEBUG("Unpacking of EF/HLT chains");
117 efchainsByName.clear();
118 const std::vector<uint32_t>& ef_serialized_chains = dec->getEFResult().getChainResult();
119 ATH_MSG_DEBUG(ef_serialized_chains.size() << " EF/HLT chains");
120
121 if ( ! ef_serialized_chains.empty()) {
122 if ( unpackChains(ef_serialized_chains, efchainsCache, efchainsByName).isFailure() ) {
123 ATH_MSG_WARNING("Unpacking of EF/HLT chains failed");
124 }
125 } else {
126 ATH_MSG_DEBUG("Empty EF/HLT chains");
127 }
128
129 return StatusCode::SUCCESS;
130 }
#define ATH_MSG_DEBUG(x)
HLTLevel getHLTLevel() const
hlt level (L2 or EF)
Definition HLTResult.h:173
const std::vector< uint32_t > & getChainResult() const
Definition HLTResult.h:252
const HLT::HLTResult & getEFResult() const
const HLT::HLTResult & getL2Result() const
StatusCode unpackItems(const LVL1CTP::Lvl1Result &result, std::map< CTPID, LVL1CTP::Lvl1Item > &, std::unordered_map< std::string, const LVL1CTP::Lvl1Item * > &) const
StatusCode unpackChains(const std::vector< uint32_t > &serialized_chains, std::map< unsigned, HLT::Chain > &cache, std::unordered_map< std::string, const HLT::Chain * > &output) const

◆ unpackItems()

StatusCode Trig::DecisionUnpackerAthena::unpackItems ( const LVL1CTP::Lvl1Result & result,
std::map< CTPID, LVL1CTP::Lvl1Item > & itemsCache,
std::unordered_map< std::string, const LVL1CTP::Lvl1Item * > & itemsByName ) const
private

Definition at line 24 of file DecisionUnpackerAthena.cxx.

26 {
27 itemsByName.reserve( itemsByName.size() + itemsCache.size() );
28 for ( auto& [ctpid, item] : itemsCache ) {
29 ATH_MSG_VERBOSE("Unpacking bits for item: " << ctpid << " " << item.name());
30 const bool passBP = result.isPassedBeforePrescale(ctpid);
31 const bool passAP = result.isPassedAfterPrescale(ctpid);
32 const bool passAV = result.isPassedAfterVeto(ctpid);
33 LVL1CTP::Lvl1Item itemNew (item.name(), item.hashId(),
34 passBP, passAP, passAV,
35 item.prescaleFactor());
36 item = std::move (itemNew);
37 itemsByName[item.name()] = &item;
38 }
39 return StatusCode::SUCCESS;
40 }

◆ unpackNavigation()

StatusCode Trig::DecisionUnpackerAthena::unpackNavigation ( const EventContext & ctx,
HLT::TrigNavStructure * nav ) const
overridevirtual

Implements Trig::IDecisionUnpacker.

Definition at line 132 of file DecisionUnpackerAthena.cxx.

133 {
134 ATH_MSG_DEBUG("Unpacking Navigation");
135 SG::ReadHandle<TrigDec::TrigDecision> trigDec(*m_deckey, ctx);
136 const TrigDec::TrigDecision* dec = trigDec.cptr();
137 if (nav) {
138 HLT::NavigationCore* fullNav = dynamic_cast<HLT::NavigationCore*>(nav);
139
140 if(!fullNav){
141 ATH_MSG_WARNING("downcast failed");
142 return StatusCode::FAILURE;
143 }
144
145 fullNav->reset();
146
147
148 // try to get navigation from EF/HLT
149 ATH_MSG_DEBUG("Trying to unpack EF/HLT Navigation of size: " << dec->getEFResult().getNavigationResult().size());
150
151 bool unpacking_status = !dec->getEFResult().getNavigationResult().empty() && fullNav->deserialize(dec->getEFResult().getNavigationResult());
152
153 if ( ! unpacking_status ) {
154 if (msgLvl(MSG::DEBUG)) {
155 msg() << MSG::DEBUG << "EF/HLT Navigation unpacking failed";
156 }
157 if (!dec->getL2Result().getNavigationResult().empty()) {
158 msg() << ", falling back to L2 Navigation of size: "
159 << dec->getL2Result().getNavigationResult().size() << endmsg;
160 unpacking_status = nav->deserialize(dec->getL2Result().getNavigationResult());
161 } else {
162 msg() << endmsg;
163 }
164 }
165 if ( ! unpacking_status ) {
166 ATH_MSG_DEBUG("Full (L2 & EF) Navigation unpacking failed");
167 } else {
168 ATH_MSG_DEBUG("Unpacked Navigation ");
169 }
170 }
171
172 return StatusCode::SUCCESS;
173 }
#define endmsg
const std::vector< uint32_t > & getNavigationResult() const
retrieve the sub-payloads (can be used to retrieve/write data)
Definition HLTResult.h:250
virtual void reset(bool inFinalize=false)
resets all the navigation, goes to the factory and asks to withdraw all produced objects
bool deserialize(const std::vector< uint32_t > &input)
virtual bool deserialize(const std::vector< uint32_t > &)=0

Member Data Documentation

◆ ATLAS_THREAD_SAFE

asg::AsgTool* s_logger Trig::Logger::ATLAS_THREAD_SAFE {nullptr}
inlinestaticprivateinherited

Definition at line 38 of file Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h.

38{nullptr};

◆ m_deckey

const SG::ReadHandleKey<TrigDec::TrigDecision>* Trig::DecisionUnpackerAthena::m_deckey {nullptr}
private

Key of the trigger decision object in the event.

Definition at line 54 of file DecisionUnpackerAthena.h.

54{nullptr};

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