ATLAS Offline Software
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
HLT::TrigHolderStructure Class Reference

#include <TrigHolderStructure.h>

Inheritance diagram for HLT::TrigHolderStructure:
Collaboration diagram for HLT::TrigHolderStructure:

Public Member Functions

 TrigHolderStructure ()
 
void reset ()
 
bool registerHolder (const std::shared_ptr< BaseHolder > &holder)
 
template<typename HolderType = BaseHolder>
HolderType * getHolder (class_id_type clid, const std::variant< sub_index_type, std::string > &stiOrLabel) const
 
template<typename HolderType = BaseHolder>
HolderType * getHolderForFeature (const TriggerElement::FeatureAccessHelper &fea) const
 
template<typename HolderType = BaseHolder>
std::vector< HolderType * > getAllHolders () const
 
template<typename HolderType = BaseHolder>
std::vector< HolderType * > getHoldersOfClid (class_id_type clid) const
 
sub_index_type getSubTypeIndex (class_id_type clid, const index_or_label_type &stiOrLabel) const
 
std::string getLabel (class_id_type clid, const index_or_label_type &stiOrLabel) const
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Types

typedef std::map< sub_index_type, std::shared_ptr< BaseHolder > > IndexToHolderMap
 
typedef std::map< std::string, sub_index_typeLabelToSubIndexMap
 
typedef std::map< sub_index_type, std::string > SubIndexToLabelMap
 

Private Member Functions

BaseHoldergetBaseHolder (class_id_type clid, sub_index_type sti) const
 
template<typename T >
T * getCastHolder (BaseHolder *holder) const
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::map< class_id_type, IndexToHolderMapm_holderByClidAndIndex
 
std::map< class_id_type, SubIndexToLabelMapm_lookupLabels
 
std::map< class_id_type, LabelToSubIndexMapm_lookupSubIndex
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 21 of file TrigHolderStructure.h.

Member Typedef Documentation

◆ IndexToHolderMap

typedef std::map<sub_index_type, std::shared_ptr<BaseHolder> > HLT::TrigHolderStructure::IndexToHolderMap
private

Definition at line 112 of file TrigHolderStructure.h.

◆ LabelToSubIndexMap

typedef std::map<std::string,sub_index_type> HLT::TrigHolderStructure::LabelToSubIndexMap
private

Definition at line 113 of file TrigHolderStructure.h.

◆ SubIndexToLabelMap

typedef std::map<sub_index_type,std::string> HLT::TrigHolderStructure::SubIndexToLabelMap
private

Definition at line 114 of file TrigHolderStructure.h.

Constructor & Destructor Documentation

◆ TrigHolderStructure()

HLT::TrigHolderStructure::TrigHolderStructure ( )

Definition at line 7 of file TrigHolderStructure.cxx.

7  : asg::AsgMessaging("TrigHolderStructure"){
8 }

Member Function Documentation

◆ getAllHolders()

template<typename HolderType = BaseHolder>
std::vector<HolderType*> HLT::TrigHolderStructure::getAllHolders ( ) const
inline

Definition at line 40 of file TrigHolderStructure.h.

40  {
41  std::vector<HolderType*> result;
42  for(auto& clid_indexmap : m_holderByClidAndIndex){
43  for(auto& index_holder : clid_indexmap.second){
44  result.push_back(getCastHolder<HolderType>(index_holder.second.get()));
45  }
46  }
47  return result;
48  }

◆ getBaseHolder()

HLT::BaseHolder * HLT::TrigHolderStructure::getBaseHolder ( class_id_type  clid,
sub_index_type  sti 
) const
private

Definition at line 16 of file TrigHolderStructure.cxx.

16  {
17  if( sti == HLT::invalid_sub_index){
18  ATH_MSG_DEBUG("requested holder with invalid sub_type_index");
19  return 0;
20  }
21  auto allsti_it = m_holderByClidAndIndex.find(clid);
22  if(allsti_it == m_holderByClidAndIndex.end()){
23  return 0;
24  }
25  auto sti_holder_map = allsti_it->second;
26  auto holder_it = sti_holder_map.find(sti);
27  if(holder_it == sti_holder_map.end()){
28  return 0;
29  }
30  return holder_it->second.get();
31 }

◆ getCastHolder()

template<typename T >
T* HLT::TrigHolderStructure::getCastHolder ( BaseHolder holder) const
inlineprivate

Definition at line 101 of file TrigHolderStructure.h.

101  {
102  if(!holder){
103  return 0;
104  }
105  auto cast_holder = dynamic_cast<T*>(holder);
106  if(!cast_holder){
107  ATH_MSG_ERROR("cast failed");
108  }
109  return cast_holder;
110  }

◆ getHolder()

template<typename HolderType = BaseHolder>
HolderType* HLT::TrigHolderStructure::getHolder ( class_id_type  clid,
const std::variant< sub_index_type, std::string > &  stiOrLabel 
) const
inline

Definition at line 30 of file TrigHolderStructure.h.

30  {
31  return getCastHolder<HolderType>(getBaseHolder(clid,getSubTypeIndex(clid,stiOrLabel)));
32  }

◆ getHolderForFeature()

template<typename HolderType = BaseHolder>
HolderType* HLT::TrigHolderStructure::getHolderForFeature ( const TriggerElement::FeatureAccessHelper fea) const
inline

Definition at line 35 of file TrigHolderStructure.h.

35  {
36  return getCastHolder<HolderType>(getBaseHolder(fea.getCLID(),fea.getIndex().subTypeIndex()));
37  }

◆ getHoldersOfClid()

template<typename HolderType = BaseHolder>
std::vector<HolderType*> HLT::TrigHolderStructure::getHoldersOfClid ( class_id_type  clid) const
inline

Definition at line 51 of file TrigHolderStructure.h.

51  {
52  std::vector<HolderType*> result;
53  auto lookup_it = m_holderByClidAndIndex.find(clid);
54  if(lookup_it == m_holderByClidAndIndex.end()) return result;
55 
56  for(auto& index_holder : lookup_it->second){
57  result.push_back(getCastHolder<HolderType>(index_holder.second.get()));
58  }
59  return result;
60  }

◆ getLabel()

std::string HLT::TrigHolderStructure::getLabel ( class_id_type  clid,
const index_or_label_type stiOrLabel 
) const
inline

Definition at line 78 of file TrigHolderStructure.h.

78  {
79  //short circuit for sub_index_type because that case is valid whether we have a map or not. (visitor only works with map)
80  if (stiOrLabel.index() == 1){
81  return std::get<std::string>(stiOrLabel);
82  }
83 
84  std::string invalid_label = "inavalid_label";
85 
86  auto lookup_it = m_lookupLabels.find(clid);
87  if(lookup_it == m_lookupLabels.end()) return invalid_label;
88 
89  auto it = lookup_it->second.find(std::get<sub_index_type>(stiOrLabel));
90  if(it==lookup_it->second.end()) return invalid_label;
91 
92  return it->second;
93  }

◆ getSubTypeIndex()

sub_index_type HLT::TrigHolderStructure::getSubTypeIndex ( class_id_type  clid,
const index_or_label_type stiOrLabel 
) const
inline

Definition at line 63 of file TrigHolderStructure.h.

63  {
64  //short circuit for sub_index_type because that case is valid whether we have a map or not. (visitor only works with map)
65  if (stiOrLabel.index() == 0){
66  return std::get<sub_index_type>(stiOrLabel);
67  }
68 
69  auto lookup_it = m_lookupSubIndex.find(clid);
70  if(lookup_it == m_lookupSubIndex.end()) return invalid_sub_index;
71 
72  auto it = lookup_it->second.find(std::get<std::string>(stiOrLabel));
73  if(it==lookup_it->second.end()) return invalid_sub_index;
74 
75  return it->second;
76  }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49  {
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
53  return m_msg;
54 #endif // not XAOD_STANDALONE
55  }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level  lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57  {
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
61  m_msg << lvl;
62  return m_msg;
63 #endif // not XAOD_STANDALONE
64  }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level  lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41  {
42 #ifndef XAOD_STANDALONE
43  return ::AthMessaging::msgLvl( lvl );
44 #else // not XAOD_STANDALONE
45  return m_msg.msgLevel( lvl );
46 #endif // not XAOD_STANDALONE
47  }

◆ registerHolder()

bool HLT::TrigHolderStructure::registerHolder ( const std::shared_ptr< BaseHolder > &  holder)

Definition at line 34 of file TrigHolderStructure.cxx.

34  {
35  auto clid = holder->typeClid();
36  auto subtypeindex = holder->subTypeIndex();
37  auto label = holder->label();
38 
39  if(getHolder(clid,subtypeindex)){
40  ATH_MSG_WARNING("we already have a holder like this! clid:" << clid << " subtypeIndex: " << subtypeindex << " label: " << label);
41  return false;
42  }
43 
44 
45 
46  m_holderByClidAndIndex[clid][subtypeindex] = holder;
47  m_lookupLabels[clid][subtypeindex] = label;
48  m_lookupSubIndex[clid][label] = subtypeindex;
49 
50  return true;
51 }

◆ reset()

void HLT::TrigHolderStructure::reset ( )

Definition at line 10 of file TrigHolderStructure.cxx.

10  {
11  m_holderByClidAndIndex.clear();
12  m_lookupLabels.clear();
13  m_lookupSubIndex.clear();
14 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_holderByClidAndIndex

std::map<class_id_type, IndexToHolderMap> HLT::TrigHolderStructure::m_holderByClidAndIndex
private

Definition at line 116 of file TrigHolderStructure.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lookupLabels

std::map<class_id_type, SubIndexToLabelMap > HLT::TrigHolderStructure::m_lookupLabels
private

Definition at line 118 of file TrigHolderStructure.h.

◆ m_lookupSubIndex

std::map<class_id_type, LabelToSubIndexMap > HLT::TrigHolderStructure::m_lookupSubIndex
private

Definition at line 119 of file TrigHolderStructure.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
get_generator_info.result
result
Definition: get_generator_info.py:21
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
skel.it
it
Definition: skel.GENtoEVGEN.py:396
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HLT::TrigHolderStructure::m_lookupSubIndex
std::map< class_id_type, LabelToSubIndexMap > m_lookupSubIndex
Definition: TrigHolderStructure.h:119
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
HLT::TrigHolderStructure::getSubTypeIndex
sub_index_type getSubTypeIndex(class_id_type clid, const index_or_label_type &stiOrLabel) const
Definition: TrigHolderStructure.h:63
HLT::TrigHolderStructure::m_lookupLabels
std::map< class_id_type, SubIndexToLabelMap > m_lookupLabels
Definition: TrigHolderStructure.h:118
HLT::TrigHolderStructure::getHolder
HolderType * getHolder(class_id_type clid, const std::variant< sub_index_type, std::string > &stiOrLabel) const
Definition: TrigHolderStructure.h:30
HLT::TrigHolderStructure::m_holderByClidAndIndex
std::map< class_id_type, IndexToHolderMap > m_holderByClidAndIndex
Definition: TrigHolderStructure.h:116
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
HLT::TrigHolderStructure::getBaseHolder
BaseHolder * getBaseHolder(class_id_type clid, sub_index_type sti) const
Definition: TrigHolderStructure.cxx:16