ATLAS Offline Software
Loading...
Searching...
No Matches
AtlasDetectorIDHelper Class Reference

#include <AtlasDetectorIDHelper.h>

Inheritance diagram for AtlasDetectorIDHelper:
Collaboration diagram for AtlasDetectorIDHelper:

Public Types

enum  ERRORS { UNDEFINED = 999 }
using size_type = Identifier::size_type

Public Member Functions

 AtlasDetectorIDHelper ()
int initialize_from_dictionary (const IdDictMgr &dict_mgr)
 Initialization from the identifier dictionary.
 ~AtlasDetectorIDHelper ()=default
size_type pixel_region_index () const
size_type sct_region_index () const
size_type trt_region_index () const
size_type lar_em_region_index () const
size_type lar_hec_region_index () const
size_type lar_fcal_region_index () const
size_type lvl1_region_index () const
size_type dm_region_index () const
size_type tile_region_index () const
size_type mdt_region_index () const
size_type csc_region_index () const
size_type rpc_region_index () const
size_type tgc_region_index () const
size_type stgc_region_index () const
size_type mm_region_index () const
size_type muon_station_index () const
size_type alfa_region_index () const
size_type bcm_region_index () const
size_type lucid_region_index () const
size_type zdc_region_index () const
const IdDictFieldstation_field () const
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

bool m_isHighLuminosityLHC {false}
size_type m_pixel_region_index {UNDEFINED}
size_type m_sct_region_index {UNDEFINED}
size_type m_trt_region_index {UNDEFINED}
size_type m_lar_em_region_index {UNDEFINED}
size_type m_lar_hec_region_index {UNDEFINED}
size_type m_lar_fcal_region_index {UNDEFINED}
size_type m_lvl1_region_index {UNDEFINED}
size_type m_dm_region_index {UNDEFINED}
size_type m_tile_region_index {UNDEFINED}
size_type m_mdt_region_index {UNDEFINED}
size_type m_csc_region_index {UNDEFINED}
size_type m_rpc_region_index {UNDEFINED}
size_type m_tgc_region_index {UNDEFINED}
size_type m_mm_region_index {UNDEFINED}
size_type m_stgc_region_index {UNDEFINED}
size_type m_muon_station_index {UNDEFINED}
size_type m_alfa_region_index {UNDEFINED}
size_type m_bcm_region_index {UNDEFINED}
size_type m_lucid_region_index {UNDEFINED}
size_type m_zdc_region_index {UNDEFINED}
bool m_initialized {false}
const IdDictFieldm_station_field {}
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Definition at line 17 of file AtlasDetectorIDHelper.h.

Member Typedef Documentation

◆ size_type

using AtlasDetectorIDHelper::size_type = Identifier::size_type

Definition at line 25 of file AtlasDetectorIDHelper.h.

Member Enumeration Documentation

◆ ERRORS

Enumerator
UNDEFINED 

Definition at line 20 of file AtlasDetectorIDHelper.h.

Constructor & Destructor Documentation

◆ AtlasDetectorIDHelper()

AtlasDetectorIDHelper::AtlasDetectorIDHelper ( )

Definition at line 14 of file AtlasDetectorIDHelper.cxx.

14 :
15 AthMessaging("AtlasDetectorIDHelper") {
16}
AthMessaging()
Default constructor:

◆ ~AtlasDetectorIDHelper()

AtlasDetectorIDHelper::~AtlasDetectorIDHelper ( )
default

Member Function Documentation

◆ alfa_region_index()

size_type AtlasDetectorIDHelper::alfa_region_index ( ) const
inline

Definition at line 81 of file AtlasDetectorIDHelper.h.

81 {
83 }

◆ bcm_region_index()

size_type AtlasDetectorIDHelper::bcm_region_index ( ) const
inline

Definition at line 84 of file AtlasDetectorIDHelper.h.

84 {
85 return m_bcm_region_index;
86 }

◆ csc_region_index()

size_type AtlasDetectorIDHelper::csc_region_index ( ) const
inline

Definition at line 62 of file AtlasDetectorIDHelper.h.

62 {
63 return m_csc_region_index;
64 }

◆ dm_region_index()

size_type AtlasDetectorIDHelper::dm_region_index ( ) const
inline

Definition at line 53 of file AtlasDetectorIDHelper.h.

53 {
54 return m_dm_region_index;
55 }

◆ initialize_from_dictionary()

int AtlasDetectorIDHelper::initialize_from_dictionary ( const IdDictMgr & dict_mgr)

Initialization from the identifier dictionary.

Definition at line 19 of file AtlasDetectorIDHelper.cxx.

19 {
20 if (m_initialized) return(0);
21
22 m_initialized = true;
23
24 AtlasDetectorID atlas_id ("", "");
25
26 const IdDictDictionary* dict = dict_mgr.find_dictionary("InnerDetector");
27
28 auto assignRegionFromAtlasID = [this, &dict](const ExpandedIdentifier& id,
29 size_type& regionIdx,
30 const std::string& techType) {
31 if (dict->find_region(id, regionIdx)) {
32 ATH_MSG_WARNING("initialize_from_dictionary - unable to find "<<techType<<" region index: id, reg "
33 << id << " " << regionIdx);
34 }
35 };
36
37 auto assignRegionIdxFromGrp = [this, &dict](const std::string& grp, size_type& regionIdx) {
38 const IdDictGroup* group = dict->find_group(grp);
39 if (!group || !group->n_regions()) {
40 ATH_MSG_VERBOSE("The group "<<grp<<" is not present.");
41 regionIdx = UNDEFINED;
42 return;
43 }
44 regionIdx = group->region(0).index();
45 ATH_MSG_VERBOSE("Region index for "<<grp<<" will be assigned to "<<regionIdx);
46
47 };
48
49 auto assignRegionIdxFromRegion = [this, &dict](const std::string& grp, size_type& regionIdx) {
50 const IdDictRegion* region = dict->find_region(grp);
51 if (!region) {
52 ATH_MSG_VERBOSE("The group "<<grp<<" is not present.");
53 regionIdx = UNDEFINED;
54 return;
55 }
56 regionIdx = region->index();
57 ATH_MSG_VERBOSE("Region index for "<<grp<<" will be assigned to "<<regionIdx);
58 };
59
60
61 if (!dict) {
62 ATH_MSG_ERROR("initialize_from_dictionary - cannot access InnerDetector dictionary");
63 return 1;
64 }
65
66 // Check if this is High Luminosity LHC layout
67 if (dict->version() == "ITkHGTD" || dict->version() == "ITkHGTDPLR" || dict->version() == "P2-RUN4") {
69 }
70 assignRegionFromAtlasID(atlas_id.pixel_exp(), m_pixel_region_index, "pixel");
71 // for High Luminosity LHC layout one cannot get the sct region as below, nor
72 // is there any trt regions
74 assignRegionFromAtlasID(atlas_id.sct_exp(), m_sct_region_index, "sct");
75 assignRegionFromAtlasID(atlas_id.trt_exp(), m_trt_region_index, "trt");
76 }
77
78 dict = dict_mgr.find_dictionary("LArCalorimeter");
79 if (!dict) {
80 ATH_MSG_WARNING("initialize_from_dictionary - cannot access LArCalorimeter dictionary");
81 return 1;
82 }
83 assignRegionFromAtlasID(atlas_id.lar_em_exp(), m_lar_em_region_index, "lar_em");
84 assignRegionFromAtlasID(atlas_id.lar_hec_exp(), m_lar_hec_region_index, "lar_hec");
85 assignRegionFromAtlasID(atlas_id.lar_fcal_exp(), m_lar_fcal_region_index, "lar_fcal");
86 // Get Calorimetry dictionary for both LVL1 and Dead material
87 dict = dict_mgr.find_dictionary("Calorimeter");
88 if (!dict) {
89 ATH_MSG_WARNING("initialize_from_dictionary - cannot access Calorimeter dictionary");
90 return 1;
91 }
92 // Save index to a LVL1 region for unpacking
93 assignRegionIdxFromRegion("Lvl1_0", m_lvl1_region_index);
94 // Save index to a Dead Material region for unpacking
95 assignRegionIdxFromRegion("DM_4_1_0_0", m_dm_region_index);
96
97 dict = dict_mgr.find_dictionary("TileCalorimeter");
98 if (!dict) {
99 ATH_MSG_WARNING("initialize_from_dictionary - cannot access TileCalorimeter dictionary");
100 return 1;
101 }
102
103 assignRegionFromAtlasID(atlas_id.tile_exp(), m_tile_region_index, "tile");
104
105 dict = dict_mgr.find_dictionary("MuonSpectrometer");
106 if (!dict) {
107 ATH_MSG_WARNING("initialize_from_dictionary - cannot access MuonSpectrometer dictionary");
108 return 1;
109 }
110 m_station_field = dict->find_field("stationName");
111 if (!m_station_field) {
112 ATH_MSG_WARNING("initialize_from_dictionary - cannot access stationName field");
113 return 1;
114 } else {
116 }
117 assignRegionIdxFromGrp("mdt", m_mdt_region_index);
118 assignRegionIdxFromGrp("csc", m_csc_region_index);
119 assignRegionIdxFromGrp("rpc", m_rpc_region_index);
120 assignRegionIdxFromGrp("tgc", m_tgc_region_index);
121 assignRegionIdxFromGrp("mm", m_mm_region_index);
122 assignRegionIdxFromGrp("stgc", m_stgc_region_index);
123
124 dict = dict_mgr.find_dictionary("ForwardDetectors");
125 if (!dict) {
126 ATH_MSG_WARNING("initialize_from_dictionary - cannot access ForwardDetectors dictionary");
127 return 1;
128 }
129
130 assignRegionFromAtlasID(atlas_id.alfa_exp(), m_alfa_region_index, "alfa");
131 assignRegionFromAtlasID(atlas_id.bcm_exp(), m_bcm_region_index, "bcm");
132 assignRegionFromAtlasID(atlas_id.lucid_exp(), m_lucid_region_index, "lucid");
133 assignRegionFromAtlasID(atlas_id.zdc_exp(), m_zdc_region_index, "zdc");
134
135 ATH_MSG_VERBOSE( "AtlasDetectorIDHelper::initialize_from_dictionary ");
136 ATH_MSG_VERBOSE( " pixel_region_index " << m_pixel_region_index);
137 ATH_MSG_VERBOSE( " sct_region_index " << m_sct_region_index);
138 ATH_MSG_VERBOSE( " trt_region_index " << m_trt_region_index);
139 ATH_MSG_VERBOSE( " lar_em_region_index " << m_lar_em_region_index);
140 ATH_MSG_VERBOSE( " lar_hec_region_index " << m_lar_hec_region_index);
141 ATH_MSG_VERBOSE( " lar_fcal_region_index " << m_lar_fcal_region_index);
142 ATH_MSG_VERBOSE( " lvl1_region_index " << m_lvl1_region_index);
143 ATH_MSG_VERBOSE( " tile_region_index " << m_tile_region_index);
144 ATH_MSG_VERBOSE( " mdt_region_index " << m_mdt_region_index);
145 ATH_MSG_VERBOSE( " csc_region_index " << m_csc_region_index);
146 ATH_MSG_VERBOSE( " rpc_region_index " << m_rpc_region_index);
147 ATH_MSG_VERBOSE( " tgc_region_index " << m_tgc_region_index);
148 ATH_MSG_VERBOSE( " muon_station_index " << m_muon_station_index);
149 return 0;
150}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
const IdDictField * m_station_field
Identifier::size_type size_type
const std::string & version() const
Dictionary version.
IdDictGroup * find_group(const std::string &group_name)
const IdDictField * find_field(const std::string &name) const
const IdDictRegion * find_region(const std::string &region_name) const
const IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
size_t index() const

◆ 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 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ lar_em_region_index()

size_type AtlasDetectorIDHelper::lar_em_region_index ( ) const
inline

Definition at line 41 of file AtlasDetectorIDHelper.h.

41 {
43 }

◆ lar_fcal_region_index()

size_type AtlasDetectorIDHelper::lar_fcal_region_index ( ) const
inline

Definition at line 47 of file AtlasDetectorIDHelper.h.

47 {
49 }

◆ lar_hec_region_index()

size_type AtlasDetectorIDHelper::lar_hec_region_index ( ) const
inline

Definition at line 44 of file AtlasDetectorIDHelper.h.

44 {
46 }

◆ lucid_region_index()

size_type AtlasDetectorIDHelper::lucid_region_index ( ) const
inline

Definition at line 87 of file AtlasDetectorIDHelper.h.

87 {
89 }

◆ lvl1_region_index()

size_type AtlasDetectorIDHelper::lvl1_region_index ( ) const
inline

Definition at line 50 of file AtlasDetectorIDHelper.h.

50 {
52 }

◆ mdt_region_index()

size_type AtlasDetectorIDHelper::mdt_region_index ( ) const
inline

Definition at line 59 of file AtlasDetectorIDHelper.h.

59 {
60 return m_mdt_region_index;
61 }

◆ mm_region_index()

size_type AtlasDetectorIDHelper::mm_region_index ( ) const
inline

Definition at line 74 of file AtlasDetectorIDHelper.h.

74 {
75 return m_mm_region_index;
76 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 163 of file AthMessaging.h.

164{
165 MsgStream* ms = m_msg_tls.get();
166 if (!ms) {
167 if (!m_initialized.test_and_set()) initMessaging();
168 ms = new MsgStream(m_imsg,m_nm);
169 m_msg_tls.reset( ms );
170 }
171
172 ms->setLevel (m_lvl);
173 return *ms;
174}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 178 of file AthMessaging.h.

179{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 if (m_lvl <= lvl) {
154 msg() << lvl;
155 return true;
156 } else {
157 return false;
158 }
159}

◆ muon_station_index()

size_type AtlasDetectorIDHelper::muon_station_index ( ) const
inline

Definition at line 77 of file AtlasDetectorIDHelper.h.

77 {
79 }

◆ pixel_region_index()

size_type AtlasDetectorIDHelper::pixel_region_index ( ) const
inline

Definition at line 32 of file AtlasDetectorIDHelper.h.

32 {
34 }

◆ rpc_region_index()

size_type AtlasDetectorIDHelper::rpc_region_index ( ) const
inline

Definition at line 65 of file AtlasDetectorIDHelper.h.

65 {
66 return m_rpc_region_index;
67 }

◆ sct_region_index()

size_type AtlasDetectorIDHelper::sct_region_index ( ) const
inline

Definition at line 35 of file AtlasDetectorIDHelper.h.

35 {
36 return m_sct_region_index;
37 }

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

◆ station_field()

const IdDictField * AtlasDetectorIDHelper::station_field ( ) const
inline

Definition at line 93 of file AtlasDetectorIDHelper.h.

93 {
94 return m_station_field;
95 }

◆ stgc_region_index()

size_type AtlasDetectorIDHelper::stgc_region_index ( ) const
inline

Definition at line 71 of file AtlasDetectorIDHelper.h.

71 {
72 return m_sct_region_index;
73 }

◆ tgc_region_index()

size_type AtlasDetectorIDHelper::tgc_region_index ( ) const
inline

Definition at line 68 of file AtlasDetectorIDHelper.h.

68 {
69 return m_tgc_region_index;
70 }

◆ tile_region_index()

size_type AtlasDetectorIDHelper::tile_region_index ( ) const
inline

Definition at line 56 of file AtlasDetectorIDHelper.h.

56 {
58 }

◆ trt_region_index()

size_type AtlasDetectorIDHelper::trt_region_index ( ) const
inline

Definition at line 38 of file AtlasDetectorIDHelper.h.

38 {
39 return m_trt_region_index;
40 }

◆ zdc_region_index()

size_type AtlasDetectorIDHelper::zdc_region_index ( ) const
inline

Definition at line 90 of file AtlasDetectorIDHelper.h.

90 {
91 return m_zdc_region_index;
92 }

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_alfa_region_index

size_type AtlasDetectorIDHelper::m_alfa_region_index {UNDEFINED}
private

Definition at line 114 of file AtlasDetectorIDHelper.h.

114{UNDEFINED};

◆ m_bcm_region_index

size_type AtlasDetectorIDHelper::m_bcm_region_index {UNDEFINED}
private

Definition at line 115 of file AtlasDetectorIDHelper.h.

115{UNDEFINED};

◆ m_csc_region_index

size_type AtlasDetectorIDHelper::m_csc_region_index {UNDEFINED}
private

Definition at line 108 of file AtlasDetectorIDHelper.h.

108{UNDEFINED};

◆ m_dm_region_index

size_type AtlasDetectorIDHelper::m_dm_region_index {UNDEFINED}
private

Definition at line 105 of file AtlasDetectorIDHelper.h.

105{UNDEFINED};

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_initialized

bool AtlasDetectorIDHelper::m_initialized {false}
private

Definition at line 118 of file AtlasDetectorIDHelper.h.

118{false};

◆ m_isHighLuminosityLHC

bool AtlasDetectorIDHelper::m_isHighLuminosityLHC {false}
private

Definition at line 97 of file AtlasDetectorIDHelper.h.

97{false};

◆ m_lar_em_region_index

size_type AtlasDetectorIDHelper::m_lar_em_region_index {UNDEFINED}
private

Definition at line 101 of file AtlasDetectorIDHelper.h.

101{UNDEFINED};

◆ m_lar_fcal_region_index

size_type AtlasDetectorIDHelper::m_lar_fcal_region_index {UNDEFINED}
private

Definition at line 103 of file AtlasDetectorIDHelper.h.

103{UNDEFINED};

◆ m_lar_hec_region_index

size_type AtlasDetectorIDHelper::m_lar_hec_region_index {UNDEFINED}
private

Definition at line 102 of file AtlasDetectorIDHelper.h.

102{UNDEFINED};

◆ m_lucid_region_index

size_type AtlasDetectorIDHelper::m_lucid_region_index {UNDEFINED}
private

Definition at line 116 of file AtlasDetectorIDHelper.h.

116{UNDEFINED};

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_lvl1_region_index

size_type AtlasDetectorIDHelper::m_lvl1_region_index {UNDEFINED}
private

Definition at line 104 of file AtlasDetectorIDHelper.h.

104{UNDEFINED};

◆ m_mdt_region_index

size_type AtlasDetectorIDHelper::m_mdt_region_index {UNDEFINED}
private

Definition at line 107 of file AtlasDetectorIDHelper.h.

107{UNDEFINED};

◆ m_mm_region_index

size_type AtlasDetectorIDHelper::m_mm_region_index {UNDEFINED}
private

Definition at line 111 of file AtlasDetectorIDHelper.h.

111{UNDEFINED};

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

size_type AtlasDetectorIDHelper::m_muon_station_index {UNDEFINED}
private

Definition at line 113 of file AtlasDetectorIDHelper.h.

113{UNDEFINED};

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_pixel_region_index

size_type AtlasDetectorIDHelper::m_pixel_region_index {UNDEFINED}
private

Definition at line 98 of file AtlasDetectorIDHelper.h.

98{UNDEFINED};

◆ m_rpc_region_index

size_type AtlasDetectorIDHelper::m_rpc_region_index {UNDEFINED}
private

Definition at line 109 of file AtlasDetectorIDHelper.h.

109{UNDEFINED};

◆ m_sct_region_index

size_type AtlasDetectorIDHelper::m_sct_region_index {UNDEFINED}
private

Definition at line 99 of file AtlasDetectorIDHelper.h.

99{UNDEFINED};

◆ m_station_field

const IdDictField* AtlasDetectorIDHelper::m_station_field {}
private

Definition at line 119 of file AtlasDetectorIDHelper.h.

119{};

◆ m_stgc_region_index

size_type AtlasDetectorIDHelper::m_stgc_region_index {UNDEFINED}
private

Definition at line 112 of file AtlasDetectorIDHelper.h.

112{UNDEFINED};

◆ m_tgc_region_index

size_type AtlasDetectorIDHelper::m_tgc_region_index {UNDEFINED}
private

Definition at line 110 of file AtlasDetectorIDHelper.h.

110{UNDEFINED};

◆ m_tile_region_index

size_type AtlasDetectorIDHelper::m_tile_region_index {UNDEFINED}
private

Definition at line 106 of file AtlasDetectorIDHelper.h.

106{UNDEFINED};

◆ m_trt_region_index

size_type AtlasDetectorIDHelper::m_trt_region_index {UNDEFINED}
private

Definition at line 100 of file AtlasDetectorIDHelper.h.

100{UNDEFINED};

◆ m_zdc_region_index

size_type AtlasDetectorIDHelper::m_zdc_region_index {UNDEFINED}
private

Definition at line 117 of file AtlasDetectorIDHelper.h.

117{UNDEFINED};

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