ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DetectorDescription
IdDictDetDescrCnv
src
IdDictCnvTest.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/***************************************************************************
6
IdDict converter package
7
-----------------------------------------
8
***************************************************************************/
9
10
#include "
IdDictCnvTest.h
"
11
12
// Id-related includes
13
#include "
IdDict/IdDictDictionary.h
"
14
#include "
IdDict/IdDictMgr.h
"
15
#include "
Identifier/MultiRange.h
"
16
#include "
Identifier/Range.h
"
17
#include "
Identifier/IdentifierHash.h
"
18
#include "
IdDictDetDescr/IdDictManager.h
"
19
#include "
AtlasDetDescr/AtlasDetectorID.h
"
20
21
// Athena-related includes
22
#include "GaudiKernel/MsgStream.h"
23
#include "Gaudi/Property.h"
24
#include "GaudiKernel/IChronoStatSvc.h"
25
26
28
29
void
30
IdDictCnvTest::tab
(
size_t
level)
const
31
{
32
for
(
size_t
i = 0; i < level; ++i)
msg
() <<
" "
;
33
}
34
36
// CONSTRUCTOR:
38
39
IdDictCnvTest::IdDictCnvTest
(
const
std::string& name, ISvcLocator* pSvcLocator)
40
:
41
AthAlgorithm
(name, pSvcLocator)
42
{}
43
45
// DESTRUCTOR:
47
48
IdDictCnvTest::~IdDictCnvTest
()
49
{ }
50
52
// INITIALIZE:
53
// The initialize method will create all the required algorithm objects
54
// Note that it is NOT NECESSARY to run the initialize of individual
55
// sub-algorithms. The framework takes care of it.
57
58
StatusCode
59
IdDictCnvTest::initialize
()
60
{
61
ATH_MSG_INFO
(
"Start initialization"
);
62
63
const
IdDictManager
* idDictMgr =
nullptr
;
64
ATH_CHECK
(
detStore
()->retrieve(idDictMgr,
"IdDict"
) );
65
ATH_MSG_DEBUG
(
" Found the IdDictManager. "
);
66
ATH_MSG_DEBUG
(
" Tag is "
<< idDictMgr->
manager
()->
tag
() );
67
68
IdDictMgr::dictionary_vec
dv = idDictMgr->
manager
()->
get_dictionaries
();
69
70
int
n = 0;
71
72
if
(dv.empty()) {
73
// No dicts found
74
ATH_MSG_ERROR
(
"No dictionaries found!"
);
75
return
StatusCode::FAILURE;
76
}
77
78
79
for
(
const
IdDictDictionary
* dictionary : dv) {
80
ATH_MSG_INFO
(
"---- "
<< n <<
" ----------------------------"
);
81
std::string version = (
""
!= dictionary->version()) ? dictionary->version() :
"default"
;
82
ATH_MSG_INFO
(
"Dictionary "
<< dictionary->name()
83
<<
" version "
<< version );
84
85
if
(dictionary->verify()) {
86
ATH_MSG_INFO
(
"Dictionary verification is OK"
);
87
}
88
else
{
89
ATH_MSG_FATAL
(
"Dictionary verification has failed: "
90
<< dictionary->name() <<
" multirange: "
91
<< (std::string)dictionary->build_multirange() );
92
return
StatusCode::FAILURE;
93
}
94
95
96
// std::vector<IdDictRegion*>::const_iterator rit;
97
// for (rit = dictionary->m_regions.begin (); rit != dictionary->m_regions.end (); ++rit) {
98
// const IdDictRegion& region = *(*rit);
99
100
// log << MSG::DEBUG
101
// << "region #" << region.m_index
102
// << endmsg;
103
104
// std::vector <IdDictFieldImplementation>::const_iterator fit;
105
106
// size_t width = 0;
107
108
// for (fit = region.m_implementation.begin ();
109
// fit != region.m_implementation.end ();
110
// ++fit) {
111
// const IdDictFieldImplementation& impl = *fit;
112
113
// size_t w = impl.range()->m_field->m_name.size ();
114
115
// if (w > width) width = w;
116
// }
117
118
// int bits = 0;
119
120
// for (fit = region.m_implementation.begin ();
121
// fit != region.m_implementation.end ();
122
// ++fit) {
123
// const IdDictFieldImplementation& impl = *fit;
124
125
// size_t w = impl.range()->m_field->m_name.size ();
126
127
// log << MSG::DEBUG
128
// << " implement field #" << impl.range()->m_field->m_index <<
129
// " " << impl.range()->m_field->m_name;
130
131
// tab (width - w);
132
133
// // int index = impl.field();
134
// // std::string label = impl.range()->m_field->labels[index]->m_name;
135
// // std::cout << " name " << label << " ";
136
137
// log << " -> " << (std::string) impl.field()
138
// << "/" << (std::string) impl.ored_field()
139
// << " (" << impl.bits() << " bits)"
140
// << endmsg;
141
142
// bits += impl.bits();
143
// }
144
145
// Range range = region.build_range ();
146
147
// log << MSG::DEBUG
148
// << " -> " << (std::string) range <<
149
// " (cardinality=" << range.cardinality () << ")" <<
150
// " (" << bits << " bits)"
151
// << endmsg;
152
// }
153
// }
154
}
155
156
157
ATH_MSG_DEBUG
(
" Get AtlasDetectorID. "
);
158
const
AtlasDetectorID
* atlasID =
nullptr
;
159
// Access AtlasID from detector store
160
ATH_CHECK
(
detStore
()->retrieve(atlasID,
"AtlasID"
) );
161
ATH_MSG_DEBUG
(
" Found the AtlasDetectorID. "
);
162
163
ATH_MSG_DEBUG
(
" Begin tests for AtlasDetectorID. "
);
164
Identifier
id
= atlasID->
indet
();
165
ATH_MSG_DEBUG
(
" is indet "
<< atlasID->
show_to_string
(
id
)
166
<<
" "
<< atlasID->
is_indet
(
id
) );
167
ATH_MSG_DEBUG
(
" is sct "
<< atlasID->
show_to_string
(
id
)
168
<<
" "
<< atlasID->
is_sct
(
id
) );
169
ATH_MSG_DEBUG
(
" is lar "
<< atlasID->
show_to_string
(
id
)
170
<<
" "
<< atlasID->
is_lar
(
id
) );
171
ATH_MSG_DEBUG
(
" is muon "
<< atlasID->
show_to_string
(
id
)
172
<<
" "
<< atlasID->
is_muon
(
id
) );
173
id
= atlasID->
trt
();
174
ATH_MSG_DEBUG
(
" is indet "
<< atlasID->
show_to_string
(
id
)
175
<<
" "
<< atlasID->
is_indet
(
id
) );
176
ATH_MSG_DEBUG
(
" is sct "
<< atlasID->
show_to_string
(
id
)
177
<<
" "
<< atlasID->
is_sct
(
id
) );
178
ATH_MSG_DEBUG
(
" is trt "
<< atlasID->
show_to_string
(
id
)
179
<<
" "
<< atlasID->
is_trt
(
id
) );
180
ATH_MSG_DEBUG
(
" is lar "
<< atlasID->
show_to_string
(
id
)
181
<<
" "
<< atlasID->
is_lar
(
id
) );
182
ATH_MSG_DEBUG
(
" is muon "
<< atlasID->
show_to_string
(
id
)
183
<<
" "
<< atlasID->
is_muon
(
id
) );
184
185
ATH_MSG_INFO
(
"Initialization completed successfully"
);
186
187
return
StatusCode::SUCCESS;
188
189
}
190
191
193
StatusCode
194
IdDictCnvTest::execute
(
const
EventContext&
/*ctx*/
)
195
{
196
return
StatusCode::SUCCESS;
197
}
198
199
201
// FINALIZE:
203
204
StatusCode
205
IdDictCnvTest::finalize
()
206
{
207
ATH_MSG_DEBUG
(
"finalize completed successfully"
);
208
return
StatusCode::SUCCESS;
209
}
210
211
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Range.h
IdDictCnvTest.h
IdDictDictionary.h
IdDictManager.h
IdDictMgr.h
IdentifierHash.h
MultiRange.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition
AtlasDetectorID.h:53
AtlasDetectorID::trt
Identifier trt(void) const
Definition
AtlasDetectorID.cxx:90
AtlasDetectorID::is_indet
bool is_indet(Identifier id) const
Definition
AtlasDetectorID.h:526
AtlasDetectorID::is_lar
bool is_lar(Identifier id) const
Definition
AtlasDetectorID.h:532
AtlasDetectorID::is_sct
bool is_sct(Identifier id) const
Definition
AtlasDetectorID.h:613
AtlasDetectorID::is_muon
bool is_muon(Identifier id) const
Definition
AtlasDetectorID.h:544
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition
AtlasDetectorID.cxx:311
AtlasDetectorID::is_trt
bool is_trt(Identifier id) const
Definition
AtlasDetectorID.h:625
AtlasDetectorID::indet
Identifier indet(void) const
Detector systems:
Definition
AtlasDetectorID.cxx:62
IdDictCnvTest::finalize
virtual StatusCode finalize() override
Definition
IdDictCnvTest.cxx:205
IdDictCnvTest::tab
void tab(size_t level) const
Definition
IdDictCnvTest.cxx:30
IdDictCnvTest::IdDictCnvTest
IdDictCnvTest(const std::string &name, ISvcLocator *pSvcLocator)
Definition
IdDictCnvTest.cxx:39
IdDictCnvTest::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
IdDictCnvTest.cxx:194
IdDictCnvTest::initialize
virtual StatusCode initialize() override
Definition
IdDictCnvTest.cxx:59
IdDictCnvTest::~IdDictCnvTest
~IdDictCnvTest()
Definition
IdDictCnvTest.cxx:48
IdDictDictionary
Definition
IdDictDictionary.h:33
IdDictManager
IdDictManager is the interface to identifier dictionaries.
Definition
IdDictManager.h:26
IdDictManager::manager
const IdDictMgr * manager(void) const
Definition
IdDictManager.cxx:30
IdDictMgr::tag
const std::string & tag() const
Version tag.
Definition
IdDictMgr.cxx:54
IdDictMgr::get_dictionaries
dictionary_vec get_dictionaries() const
Access to all dictionaries.
Definition
IdDictMgr.cxx:106
IdDictMgr::dictionary_vec
std::vector< const IdDictDictionary * > dictionary_vec
Definition
IdDictMgr.h:19
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0