ATLAS Offline Software
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
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. More...
 

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  }

◆ ~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

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

33 { return msg() << lvl; }

◆ 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  }

◆ 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 
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  }

◆ 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");
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  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

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

◆ 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.


The documentation for this class was generated from the following files:
get_generator_info.result
result
Definition: get_generator_info.py:21
HLT::TrigNavStructure::deserialize
virtual bool deserialize(const std::vector< uint32_t > &)=0
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::bgCode
bgCode
Definition: TrigDecision_v1.cxx:39
HLT::NavigationCore::deserialize
bool deserialize(const std::vector< uint32_t > &input)
Definition: NavigationCore.cxx:151
HLT::Chain::inquireChainCounter
static unsigned int inquireChainCounter(uint32_t chainWord)
unpack chain counter from the serialized word
Definition: Chain.cxx:123
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TrigDec::TrigDecision
The TrigDecision is an object which merges trigger informations from various levels.
Definition: Trigger/TrigEvent/TrigDecisionEvent/TrigDecisionEvent/TrigDecision.h:61
HLT::NavigationCore::reset
virtual void reset(bool inFinalize=false)
resets all the navigation, goes to the factory and asks to withdraw all produced objects
Definition: NavigationCore.cxx:281
Trig::Logger::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h:34
HLT::UNKNOWN
@ UNKNOWN
Definition: Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/Enums.h:173
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
HLT::NavigationCore
The NavigationCore class, adds on top of the TrigNavStructure the EDM read-only handling.
Definition: NavigationCore.h:96
HLT::HLTResult::getChainResult
const std::vector< uint32_t > & getChainResult() const
Definition: HLTResult.h:258
HLT::HLTResult::getNavigationResult
const std::vector< uint32_t > & getNavigationResult() const
retrieve the sub-payloads (can be used to retrieve/write data)
Definition: HLTResult.h:256
LVL1CTP::Lvl1Item
Definition: Lvl1Item.h:37
TrigDec::TrigDecision::BGCode
char BGCode() const
Definition: Trigger/TrigEvent/TrigDecisionEvent/TrigDecisionEvent/TrigDecision.h:86
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trig::DecisionUnpackerAthena::unpackItems
StatusCode unpackItems(const LVL1CTP::Lvl1Result &result, std::map< CTPID, LVL1CTP::Lvl1Item > &, std::unordered_map< std::string, const LVL1CTP::Lvl1Item * > &) const
Definition: DecisionUnpackerAthena.cxx:24
Trig::Logger::msg
MsgStream & msg() const
Definition: Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/Logger.h:29
TrigDec::TrigDecision::getL1Result
const LVL1CTP::Lvl1Result & getL1Result() const
Definition: Trigger/TrigEvent/TrigDecisionEvent/TrigDecisionEvent/TrigDecision.h:88
Trig::DecisionUnpackerAthena::m_deckey
const SG::ReadHandleKey< TrigDec::TrigDecision > * m_deckey
Key of the trigger decision object in the event.
Definition: DecisionUnpackerAthena.h:54
merge.output
output
Definition: merge.py:17
Trig::DecisionUnpackerAthena::unpackChains
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
Definition: DecisionUnpackerAthena.cxx:43
item
Definition: ItemListSvc.h:43
TrigDec::TrigDecision::getEFResult
const HLT::HLTResult & getEFResult() const
Definition: TrigDecision.cxx:118
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DEBUG
#define DEBUG
Definition: page_access.h:11
HLT::HLTResult::getHLTLevel
HLTLevel getHLTLevel() const
hlt level (L2 or EF)
Definition: HLTResult.h:179
TrigDec::TrigDecision::getL2Result
const HLT::HLTResult & getL2Result() const
Definition: TrigDecision.cxx:107