85 {
87
88 ATH_MSG_INFO(
"===================================================");
90 ATH_MSG_INFO(
"===================================================");
91
93 const GeoModelExperiment* theExpt = nullptr;
95
96
98
101
102 ServiceHandle<IGeoDbTagSvc> geoDbTag(
"GeoDbTagSvc",
name());
105 "This is the Geometry TAG we are dumping: " << geoDbTag->atlasVersion());
106
108
109
110
111
112
114 std::set<std::string> managersList{};
115 {
117 managersList.insert(blub.begin(), blub.end());
118 }
120 ATH_MSG_INFO(
"List of the GeoModel Detector Managers that are being dumped: ");
121 for (auto const& man : managersList) {
122
124 unsigned int nTreetops =
manager->getNumTreeTops();
125 std::cout << "\t" << man << " [contains " << nTreetops << " treetops]"
126 << std::endl;
127 for (
unsigned int i = 0;
i < nTreetops; ++
i) {
128 PVConstLink treetop(
manager->getTreeTop(i));
129
130 const GeoVPhysVol* vol = treetop;
131
132 std::string volName = vol->getLogVol()->getName();
133 std::cout << "\t\t treetop: " << volName << std::endl;
134 }
135 }
136 }
137
139
140 std::set<std::string> user_managersList{};
141 {
144 }
145
146
147
148 for (auto& userDet : user_managersList) {
149 if (!managersList.count(userDet)) {
151 "This Detector Manager you requested to dump is not in the list of "
152 "DetectorManagers for the geometry tag you are using: "
153 << userDet);
154 throw GaudiException(
155 "The Detector Manager you requested to dump is not in the list of "
156 "DetectorManagers.",
157 "DumpGeo", StatusCode::FAILURE);
158 }
159 }
160
161 if (!(managersList.empty())) {
162 for (auto const& mm : managersList) {
163
165
166
167 std::string detManName =
manager->getName();
169
170
171 unsigned int nTreetops =
manager->getNumTreeTops();
172 ATH_MSG_INFO(
"\t" << mm <<
" - # TreeTops: " << nTreetops);
173
174 if ((nTreetops > 0) && user_managersList.count(detManName)) {
175
176 for (
unsigned int i = 0;
i < nTreetops; ++
i) {
177
178 PVConstLink treetop(
manager->getTreeTop(i));
179
180
181 const GeoVPhysVol* vol = treetop;
182
183
184
185 GeoTransform* volXf = new GeoTransform(vol->getDefX());
186
187
188 std::string volName = vol->getLogVol()->getName();
190
191
192
193 volTop->add(new GeoNameTag(detManName));
194
195 volTop->add(volXf);
196 volTop->add(const_cast<GeoVPhysVol*>(vol));
197
199 ATH_MSG_INFO(
"You enabled the option 'showTreetopContent', so we now print the content of the first layers of child volumes of the Treetops...");
200 unsigned v1{0};
201 GeoVolumeCursor av(treetop);
202 while (!av.atEnd()) {
203 ++v1;
204 if(1==v1)
ATH_MSG_INFO(
"first level of child volumes:");
206 ATH_MSG_INFO(
"\t\t- child's n. sub-nodes: " << av.getVolume()->getNChildNodes());
207 ATH_MSG_INFO(
"\t\t- child's n. sub-volumes: " << av.getVolume()->getNChildVols());
208
209
211 GeoVolumeCursor av2(av.getVolume());
212 while (!av2.atEnd()) {
214 if(1==v2)
ATH_MSG_INFO(
"second level of child volumes:");
215 ATH_MSG_INFO(
"\t\t\t- child's logvol's name: " << av2.getVolume()->getLogVol()->getName());
216
217 unsigned v3{0};
218 GeoVolumeCursor av3(av2.getVolume());
219 while (!av3.atEnd()) {
220 ++v3;
221 if(1==v3)
ATH_MSG_INFO(
"third level of child volumes:");
222 ATH_MSG_INFO(
"\t\t\t\t- child's logvol's name: " << av3.getVolume()->getLogVol()->getName());
223 av3.next();
224 }
225
226 av2.next();
227 }
228
229 av.next();
230 }
231 }
232 }
233 }
234 }
235 }
236 }
237
238
241 "Looping over top volumes in the GeoModel tree (children of the "
242 "'World' volume)...");
243 GeoVolumeCursor av(world);
244 while (!av.atEnd()) {
245 std::string volname = av.getName();
247 av.next();
248 }
249 }
250
253 ATH_MSG_FATAL(
"The name of the output SQLite file is not set!");
254 throw GaudiException("The name of the output SQLite file is not set!",
255 "DumpGeo", StatusCode::FAILURE);
256 }
258
259
260
261
262
264 std::error_code
error;
265 const bool removed = std::filesystem::remove(
m_outFileName.value(), error);
266 if (error) {
269 return StatusCode::FAILURE;
270 }
271 if (removed) {
273 }
274 }
275
276
278
279
280 if (
db.checkIsDBOpen())
282 else {
284 throw GaudiException(
285 "The GeoModel SQLite .db file could not be opened successfully.",
286 "DumpGeo", StatusCode::FAILURE);
287 }
288
290
291
292 GeoModelIO::WriteGeoModel dumpGeoModelGraph(db);
293
295 volTop->exec(&dumpGeoModelGraph);
296 } else {
297 world->exec(&dumpGeoModelGraph);
298 }
300
301 dumpGeoModelGraph.saveToDB();
303
304
307 "Test - list of all the GeoMaterial nodes in the persistified "
308 "geometry:");
309 db.printAllMaterials();
311 "Test - list of all the GeoElement nodes in the persistified "
312 "geometry:");
313 db.printAllElements();
314 }
315
317 return StatusCode::SUCCESS;
318}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_ALWAYS(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
GeoPhysVol * createTheWorld()
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
Gaudi::Property< bool > m_showTreetopContent
Gaudi::Property< std::vector< std::string > > m_user_filterDetManagersList
Gaudi::Property< std::string > m_outFileName
Gaudi::Property< bool > m_forceOverwrite
const GeoVDetectorManager * getManager(const std::string &name) const
GeoPhysVol * getPhysVol()
Destructor.
std::vector< std::string > getListOfManagers() const