ATLAS Offline Software
Loading...
Searching...
No Matches
GeoModelSvc.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#include "GeoModelSvc.h"
6
7#include <fstream>
8
10#include "GaudiKernel/ConcurrencyFlags.h"
11#include "GaudiKernel/IConversionSvc.h"
12#include "GaudiKernel/ISvcLocator.h"
13#include "GaudiKernel/SystemOfUnits.h"
14#include "GeoDbTagSvc.h"
15#include "GeoModelHelpers/ThreadPool.h"
16#include "GeoModelHelpers/defineWorld.h"
17#include "GeoModelKernel/GeoBox.h"
18#include "GeoModelKernel/GeoLogVol.h"
19#include "GeoModelKernel/GeoMaterial.h"
20#include "GeoModelKernel/GeoPerfUtils.h"
21#include "GeoModelKernel/GeoPhysVol.h"
22#include "GeoModelKernel/GeoVolumeCursor.h"
28#include "RDBMaterialManager.h"
29#include "SGTools/DataProxy.h"
30
31GeoModelSvc::GeoModelSvc(const std::string &name, ISvcLocator *svc)
32 : base_class(name, svc), m_pSvcLocator(svc) {}
33
35{
36 if (!m_sqliteDb && m_supportedGeometry == 0) {
38 "The Supported Geometry flag was not set in Job Options! Exiting ...");
39 return StatusCode::FAILURE;
40 }
41
42 ATH_CHECK(m_detStore.retrieve());
43
44 // --- Sebastien
45 // clients (detector tools) are assuming the DetDescrCnvSvc has been
46 // correctly initialized.
47 // We ensure this is indeed correct by manually initialize it so there is
48 // no more service-ordering problem triggered by jobO mix-up
49 ServiceHandle<IConversionSvc> conversionSvc("DetDescrCnvSvc", this->name());
50 ATH_CHECK(conversionSvc.retrieve());
51 // --- Sebastien
52
53 // Working around Gaudi Issue https://gitlab.cern.ch/gaudi/Gaudi/issues/82
54 Service *convSvc = dynamic_cast<Service *>(conversionSvc.get());
55 if (not convSvc) {
56 ATH_MSG_ERROR("Dynamic cast to service failed");
57 return StatusCode::FAILURE;
58 }
59 if (convSvc->FSMState() < Gaudi::StateMachine::INITIALIZED) {
60 ATH_MSG_INFO("Explicitly initializing DetDescrCnvSvc");
61 ATH_CHECK(convSvc->sysInitialize());
62 }
63
64 ATH_CHECK(m_detectorTools.retrieve());
65
66 // build regular geometry
68
69 if (!m_checkTagInfo) {
70 // We are in a Simulation job: apply possible alignments to detectors.
71 for(ToolHandle<IGeoModelTool>& theTool : m_detectorTools) {
72 ATH_CHECK(theTool->align());
73 }
74 }
75
76 if (m_useTagInfo) {
77 ATH_CHECK(m_tagInfoMgr.retrieve());
78 if (m_checkTagInfo) {
79 m_tagInfoMgr->addListener(this);
80 }
82 }
83
84 return StatusCode::SUCCESS;
85}
86
88 m_tagInfoMgr->removeListener(this);
89 return StatusCode::SUCCESS;
90}
91
93 PVLink worldPhys{nullptr};
94 ServiceHandle<IRDBAccessSvc> rdbAccess("RDBAccessSvc", name());
95
96 // Setup the GeoDbTagSvc
97 ATH_CHECK(m_geoDbTagSvc.retrieve());
98
99 GeoDbTagSvc *dbTagSvc = dynamic_cast<GeoDbTagSvc *>(m_geoDbTagSvc.get());
100 if (dbTagSvc == nullptr) {
101 ATH_MSG_FATAL("Unable to dyn-cast the IGeoDbTagSvc pointer to GeoDbTagSvc");
102 return StatusCode::FAILURE;
103 }
104
105 // Build geometry from the SQLiteDB file
106 if (m_sqliteDb) {
107 std::string sqliteDbName = "Geometry/" + m_atlasVersion + ".db";
108 std::string sqliteDbPath =
109 m_sqliteDbFullPath.empty()
110 ? PathResolver::find_file(sqliteDbName, "CALIBPATH")
111 : m_sqliteDbFullPath.value();
112 if (sqliteDbPath.empty() && m_sqliteDbFullPath.empty()) {
113 ATH_MSG_FATAL("Failed to find SQLite database file "
114 << sqliteDbName
115 << " for reading in persistent GeoModel tree");
116 return StatusCode::FAILURE;
117 }
118 ATH_MSG_INFO("Successfully located SQLite database file "
119 << sqliteDbPath << " for reading in persistent GeoModel tree");
120 // Read raw geometry description from the file
121 m_sqliteDbManager = std::make_unique<GMDBManager>(sqliteDbPath);
122 if (!m_sqliteDbManager->checkIsDBOpen()) {
123 ATH_MSG_FATAL("Failed to open SQLite database "
124 << sqliteDbPath
125 << " for reading in persistent GeoModel tree");
126 return StatusCode::FAILURE;
127 }
128 GeoThreading::ThreadPool::getPool(m_nTheads);
130 "Successfully opened SQLite DB file "
131 << sqliteDbPath << " for reading in persistent GeoModel tree using "
132 << GeoThreading::ThreadPool::getPool().nThreads() << " threads.");
134 std::make_unique<GeoModelIO::ReadGeoModel>(m_sqliteDbManager);
135 PVConstLink vWorldPhys{m_sqliteReader->buildGeoModel()};
136 worldPhys = const_pointer_cast(vWorldPhys);
137 if (!worldPhys) {
139 "Having Full Physical Volumes as World Volumes not supported!");
140 return StatusCode::FAILURE;
141 }
143 "Successfully read persistent GeoModel description from the file");
144
145 // Initialize SqliteReadSvc and open the file for reading plain SQLite
146 // tables with DetDescr parameters
147 ServiceHandle<IRDBAccessSvc> sqliteReadSvc("SqliteReadSvc", name());
148 ATH_CHECK(sqliteReadSvc.retrieve());
149 if (!sqliteReadSvc->connect(sqliteDbPath)) {
150 ATH_MSG_FATAL("Failed to open SQLite database file "
151 << sqliteDbPath << " for reading geometry parameters");
152 return StatusCode::FAILURE;
153 } else {
154 ATH_MSG_INFO("Successfully opened SQLite DB file: "
155 << sqliteDbPath << " for reading Det Descr parameters");
156 }
157 dbTagSvc->setParamSvcName("SqliteReadSvc");
158 dbTagSvc->setSqliteReader(m_sqliteReader.get());
159 if (dbTagSvc->setupConfig().isFailure()) {
160 ATH_MSG_FATAL("Failed to setup Geoconfig");
161 return StatusCode::FAILURE;
162 }
163 } else {
164 // Build geometry from the GeometryDB
165 ATH_MSG_DEBUG("** Building geometry configuration: ");
166 ATH_MSG_DEBUG("* ATLAS tag: " << m_atlasVersion);
167 ATH_MSG_DEBUG("* InDet tag: " << m_inDetVersionOverride);
168 ATH_MSG_DEBUG("* Pixel tag: " << m_pixelVersionOverride);
169 ATH_MSG_DEBUG("* SCT tag: " << m_sctVersionOverride);
170 ATH_MSG_DEBUG("* TRT tag: " << m_trtVersionOverride);
171 ATH_MSG_DEBUG("* LAr tag: " << m_larVersionOverride);
172 ATH_MSG_DEBUG("* Tile tag: " << m_tileVersionOverride);
173 ATH_MSG_DEBUG("* Muon tag: " << m_muonVersionOverride);
174 ATH_MSG_DEBUG("* Calo tag: " << m_caloVersionOverride);
175 ATH_MSG_DEBUG("* MagField tag: " << m_bFieldVersionOverride);
176 ATH_MSG_DEBUG("* CavernInfra tag: " << m_cavInfraVersionOverride);
177 ATH_MSG_DEBUG("* ForwardDetectors tag: " << m_forDetVersionOverride);
178
179 // Get RDBAccessSvc and open connection to DB
180 ATH_CHECK(rdbAccess.retrieve());
181
182 if (!rdbAccess->connect()) {
183 ATH_MSG_FATAL("Unable to connect to the Geometry DB");
184 return StatusCode::FAILURE;
185 }
186
187 // Check the existence of ATLAS tag in the database
188 if (rdbAccess->getChildTag("ATLAS", m_atlasVersion, "ATLAS") == "") {
189 ATH_MSG_FATAL(" *** *** Wrong ATLAS layout: " << m_atlasVersion
190 << " *** ***");
192 " Either ATLAS geometry tag has been misspelled, or the DB Release "
193 "does not contain the geometry specified.");
194 ATH_MSG_FATAL(" In latter case please update DB Release version");
195 return StatusCode::FAILURE;
196 }
197
198 dbTagSvc->setParamSvcName("RDBAccessSvc");
199
200 if (!m_ignoreTagSupport) {
201 RDBTagDetails atlasTagDetails;
202 rdbAccess->getTagDetails(atlasTagDetails, m_atlasVersion);
203 const coral::AttributeSpecification &supportedSpec =
204 atlasTagDetails["SUPPORTED"].specification();
205 if (supportedSpec.type() == typeid(bool)) {
206 if (!atlasTagDetails["SUPPORTED"].data<bool>()) {
208 " *** *** ATLAS layout "
210 << " is OBSOLETE and can NOT be supported any more! *** ***");
211 return StatusCode::FAILURE;
212 }
213 } else if (supportedSpec.type() == typeid(int)) {
214 if (atlasTagDetails["SUPPORTED"].data<int>() < m_supportedGeometry) {
215 ATH_MSG_FATAL(" *** *** ATLAS layout "
216 << m_atlasVersion << " is OBSOLETE in rel "
218 << " and can NOT be supported any more! *** ***");
219 return StatusCode::FAILURE;
220 }
221 }
222 }
223
236
237 if (dbTagSvc->setupTags().isFailure()) {
238 ATH_MSG_FATAL("Failed to setup subsystem tags");
239 return StatusCode::FAILURE;
240 }
241 if (dbTagSvc->setupConfig().isFailure()) {
242 ATH_MSG_FATAL("Failed to setup Geoconfig");
243 return StatusCode::FAILURE;
244 }
245
246 // Create a material manager
247 std::unique_ptr<StoredMaterialManager> theMaterialManager{};
248 try {
249 theMaterialManager = std::make_unique<RDBMaterialManager>(m_pSvcLocator);
250 } catch (std::runtime_error &e) {
251 ATH_MSG_FATAL(e.what());
252 return StatusCode::FAILURE;
253 }
254 ATH_CHECK(m_detStore->record(std::move(theMaterialManager), "MATERIALS"));
255
256 worldPhys = createGeoWorld();
257 } // End of the GeometryDB-specific part
258
259 // Create AtlasExperiment and register it within the transient detector store
260 auto theExperiment =
261 std::make_unique<GeoModelExperiment>(std::move(worldPhys));
262 ATH_CHECK(m_detStore->record(std::move(theExperiment), "ATLAS"));
263
264 int mem{}, cpu{};
265 std::ofstream geoModelStats(m_statisticsToFile ? "GeoModelStatistics" : "");
266 if (geoModelStats) {
267 geoModelStats << "Detector Configuration flag = " << m_atlasVersion
268 << std::endl;
269 }
270
271 // Loop over all tools
272 for(ToolHandle<IGeoModelTool>& theTool : m_detectorTools) {
273 mem = GeoPerfUtils::getMem();
274 cpu = GeoPerfUtils::getCpu();
275
276 ATH_CHECK(theTool->create());
277
278 if (geoModelStats) {
279 geoModelStats << theTool->name()
280 << "\t SZ= " << GeoPerfUtils::getMem() - mem
281 << "Kb \t Time = " << (GeoPerfUtils::getCpu() - cpu) * 0.01
282 << "S" << std::endl;
283 } else {
284 ATH_MSG_INFO(theTool->name()
285 << "\t SZ= " << GeoPerfUtils::getMem() - mem
286 << "Kb \t Time = " << (GeoPerfUtils::getCpu() - cpu) * 0.01
287 << "S");
288 }
289 }
290
291 if (!m_sqliteDb) {
292 // Close connection to the GeometryDB
293 rdbAccess->shutdown();
294 }
295
296 return StatusCode::SUCCESS;
297}
298
300 compareTags().ignore();
301}
302
304 bool tagsMatch = true;
305
306 ATH_MSG_DEBUG("in compareTags()");
307
308 // Get tags from TagInfoMgr
309 const ITagInfoMgr::NameTagPairVec pairs = m_tagInfoMgr->getInputTags();
310 for (const auto &pair : pairs) {
311 std::string tagPairName = pair.first;
312 if (tagPairName == "GeoAtlas") {
313 // ** Two possible cases need to be taken into account
314 // **
315 // ** 1. The retrieved ATLAS tag is following naming schema
316 // ATLAS-...-XX-YY-ZZ
317 // ** where '...' can be anything, it may also containg one or more '-'.
318 // ** If this is the case, then we need to check whether the job option
319 // tag
320 // ** is also following the same schema and they have the same
321 // 'ATLAS-...-XX' part
322 // **
323 // ** 2. The retrieved ATLAS tag is not following the schema mentioned
324 // above
325 // ** If this is the case, we just need to check the exact match
326 std::vector<std::string> tokensTagInfo, tokensJobOpt;
327
328 // Parse Tag Info tag
329 std::string::size_type startpos = 0;
330 std::string currStr = pair.second;
331 for (std::string::size_type endpos = currStr.find('-');
332 endpos != std::string::npos; endpos = currStr.find('-', startpos)) {
333 tokensTagInfo.push_back(currStr.substr(startpos, endpos - startpos));
334 startpos = endpos + 1;
335 }
336 tokensTagInfo.push_back(currStr.substr(startpos));
337
338 size_t tokensTagInfoSize = tokensTagInfo.size();
339 bool tagInfoFollowsTheScheme =
340 (tokensTagInfoSize >= 5 &&
341 tokensTagInfo[tokensTagInfoSize - 1].size() == 2 &&
342 tokensTagInfo[tokensTagInfoSize - 2].size() == 2 &&
343 tokensTagInfo[tokensTagInfoSize - 3].size() == 2);
344
345 if (tagInfoFollowsTheScheme) {
346 // Parse Job Options tag
347 startpos = 0;
348 currStr = m_atlasVersion;
349 for (std::string::size_type endpos = currStr.find('-');
350 endpos != std::string::npos;
351 endpos = currStr.find('-', startpos)) {
352 tokensJobOpt.push_back(currStr.substr(startpos, endpos - startpos));
353 startpos = endpos + 1;
354 }
355 tokensJobOpt.push_back(currStr.substr(startpos));
356
357 size_t tokensJobOptSize = tokensJobOpt.size();
358 bool jobOptFollowsTheScheme =
359 (tokensJobOptSize >= 5 &&
360 tokensJobOpt[tokensJobOptSize - 1].size() == 2 &&
361 tokensJobOpt[tokensJobOptSize - 2].size() == 2 &&
362 tokensJobOpt[tokensJobOptSize - 3].size() == 2);
363 if (jobOptFollowsTheScheme) {
364 const std::string &atlasVersion = m_atlasVersion;
365 tagsMatch = (pair.second.substr(0, currStr.size() - 6) ==
366 atlasVersion.substr(0, atlasVersion.size() - 6));
367 } else {
368 tagsMatch = false;
369 }
370 } else { // Check for the exact match
371 tagsMatch = m_atlasVersion == pair.second;
372 }
373 } else if (tagPairName == "GeoInDet")
374 tagsMatch = m_inDetVersionOverride == pair.second;
375 else if (tagPairName == "GeoPixel")
376 tagsMatch = m_pixelVersionOverride == pair.second;
377 else if (tagPairName == "GeoSCT")
378 tagsMatch = m_sctVersionOverride == pair.second;
379 else if (tagPairName == "GeoTRT")
380 tagsMatch = m_trtVersionOverride == pair.second;
381 else if (tagPairName == "GeoLAr")
382 tagsMatch = m_larVersionOverride == pair.second;
383 else if (tagPairName == "GeoTile")
384 tagsMatch = m_tileVersionOverride == pair.second;
385 else if (tagPairName == "GeoMuon")
386 tagsMatch = m_muonVersionOverride == pair.second;
387
388 if (!tagsMatch)
389 break;
390 }
391
392 if (!tagsMatch) {
393 msg((m_ignoreTagDifference ? MSG::WARNING : MSG::ERROR))
394 << "*** *** Geometry configured through jobOptions does not match "
395 "TagInfo tags! *** ***"
396 << endmsg;
397 ATH_MSG_INFO("** Job Option configuration: ");
398 ATH_MSG_INFO("* ATLAS tag: " << m_atlasVersion);
399 ATH_MSG_INFO("* InDet tag: " << m_inDetVersionOverride);
400 ATH_MSG_INFO("* Pixel tag: " << m_pixelVersionOverride);
401 ATH_MSG_INFO("* SCT tag: " << m_sctVersionOverride);
402 ATH_MSG_INFO("* TRT tag: " << m_trtVersionOverride);
403 ATH_MSG_INFO("* LAr tag: " << m_larVersionOverride);
404 ATH_MSG_INFO("* Tile tag: " << m_tileVersionOverride);
405 ATH_MSG_INFO("* Muon tag: " << m_muonVersionOverride);
406 ATH_MSG_INFO("* Calo tag: " << m_caloVersionOverride);
407 ATH_MSG_INFO("* MagField tag: " << m_bFieldVersionOverride);
408 ATH_MSG_INFO("* CavernInfra tag: " << m_cavInfraVersionOverride);
409 ATH_MSG_INFO("* ForwardDetectors tag: " << m_forDetVersionOverride);
410 ATH_MSG_INFO("** TAG INFO configuration: ");
411 for (const auto &pair : pairs) {
412 const std::string &tagPairName = pair.first;
413 if (tagPairName == "GeoAtlas") {
414 ATH_MSG_INFO("* ATLAS tag: " << pair.second);
415 } else if (tagPairName == "GeoInDet") {
416 ATH_MSG_INFO("*InDet tag: " << pair.second);
417 } else if (tagPairName == "GeoPixel") {
418 ATH_MSG_INFO("*Pixel tag: " << pair.second);
419 } else if (tagPairName == "GeoSCT") {
420 ATH_MSG_INFO("*SCT tag: " << pair.second);
421 } else if (tagPairName == "GeoTRT") {
422 ATH_MSG_INFO("*TRT tag: " << pair.second);
423 } else if (tagPairName == "GeoLAr") {
424 ATH_MSG_INFO("*LAr tag: " << pair.second);
425 } else if (tagPairName == "GeoTile") {
426 ATH_MSG_INFO("*Tile tag: " << pair.second);
427 } else if (tagPairName == "GeoMuon") {
428 ATH_MSG_INFO("*Muon tag: " << pair.second);
429 } else if (tagPairName == "GeoCalo") {
430 ATH_MSG_INFO("*Calo tag: " << pair.second);
431 } else if (tagPairName == "GeoMagField") {
432 ATH_MSG_INFO("*MagField tag: " << pair.second);
433 } else if (tagPairName == "GeoCavernInfra") {
434 ATH_MSG_INFO("*CavernInfra tag: " << pair.second);
435 } else if (tagPairName == "GeoForwardDetectors") {
436 ATH_MSG_INFO("*ForwardDetectors tag: " << pair.second);
437 }
438 }
439
441 ATH_MSG_INFO("*** *** Please fix geometry tag settings *** ***");
442 return StatusCode::FAILURE;
443 }
444 } else
446 "Geometry configurations in jobOptions and TagInfo are consistent");
447
448 return StatusCode::SUCCESS;
449}
450
451/**********************************************************************************
452 ** Private Member Functions
453 **********************************************************************************/
454StatusCode GeoModelSvc::fillTagInfo() const {
455 if (m_atlasVersion == "") {
456 ATH_MSG_ERROR("ATLAS version is empty");
457 return StatusCode::FAILURE;
458 }
459
460 if (m_tagInfoMgr->addTag("GeoAtlas", m_atlasVersion).isFailure()) {
461 ATH_MSG_ERROR("GeoModelSvc Atlas tag: " << m_atlasVersion
462 << " not added to TagInfo ");
463 return StatusCode::FAILURE;
464 }
465
466 if (m_inDetVersionOverride != "") {
467 if (m_tagInfoMgr->addTag("GeoInDet", m_inDetVersionOverride).isFailure()) {
468 ATH_MSG_ERROR("GeoModelSvc InDet tag: " << m_inDetVersionOverride
469 << " not added to TagInfo ");
470 return StatusCode::FAILURE;
471 }
472 }
473
474 if (m_pixelVersionOverride != "") {
475 if (m_tagInfoMgr->addTag("GeoPixel", m_pixelVersionOverride).isFailure()) {
476 ATH_MSG_ERROR("GeoModelSvc Pixel tag: " << m_pixelVersionOverride
477 << " not added to TagInfo ");
478 return StatusCode::FAILURE;
479 }
480 }
481
482 if (m_sctVersionOverride != "") {
483 if (m_tagInfoMgr->addTag("GeoSCT", m_sctVersionOverride).isFailure()) {
484 ATH_MSG_ERROR("GeoModelSvc SCT tag: " << m_sctVersionOverride
485 << " not added to TagInfo ");
486 return StatusCode::FAILURE;
487 }
488 }
489
490 if (m_trtVersionOverride != "") {
491 if (m_tagInfoMgr->addTag("GeoTRT", m_trtVersionOverride).isFailure()) {
492 ATH_MSG_ERROR("GeoModelSvc TRT tag: " << m_trtVersionOverride
493 << " not added to TagInfo ");
494 return StatusCode::FAILURE;
495 }
496 }
497
498 if (m_larVersionOverride != "") {
499 if (m_tagInfoMgr->addTag("GeoLAr", m_larVersionOverride).isFailure()) {
500 ATH_MSG_ERROR("GeoModelSvc LAr tag: " << m_larVersionOverride
501 << " not added to TagInfo ");
502 return StatusCode::FAILURE;
503 }
504 }
505
506 if (m_tileVersionOverride != "") {
507 if (m_tagInfoMgr->addTag("GeoTile", m_tileVersionOverride).isFailure()) {
508 ATH_MSG_ERROR("GeoModelSvc Tile tag: " << m_tileVersionOverride
509 << " not added to TagInfo ");
510 return StatusCode::FAILURE;
511 }
512 }
513
514 if (m_muonVersionOverride != "") {
515 if (m_tagInfoMgr->addTag("GeoMuon", m_muonVersionOverride).isFailure()) {
516 ATH_MSG_ERROR("GeoModelSvc Muon tag: " << m_muonVersionOverride
517 << " not added to TagInfo ");
518 return StatusCode::FAILURE;
519 }
520 }
521
522 if (m_caloVersionOverride != "") {
523 if (m_tagInfoMgr->addTag("GeoCalo", m_caloVersionOverride).isFailure()) {
524 ATH_MSG_ERROR("GeoModelSvc Calo tag: " << m_caloVersionOverride
525 << " not added to TagInfo ");
526 return StatusCode::FAILURE;
527 }
528 }
529
530 if (m_bFieldVersionOverride != "") {
531 if (m_tagInfoMgr->addTag("GeoMagField", m_bFieldVersionOverride)
532 .isFailure()) {
533 ATH_MSG_ERROR("GeoModelSvc MagField tag: " << m_bFieldVersionOverride
534 << " not added to TagInfo ");
535 return StatusCode::FAILURE;
536 }
537 }
538
539 if (m_cavInfraVersionOverride != "") {
540 if (m_tagInfoMgr->addTag("GeoCavernInfra", m_cavInfraVersionOverride)
541 .isFailure()) {
542 ATH_MSG_ERROR("GeoModelSvc CavernInfra tag: "
543 << m_cavInfraVersionOverride << " not added to TagInfo ");
544 return StatusCode::FAILURE;
545 }
546 }
547
548 if (m_forDetVersionOverride != "") {
549 if (m_tagInfoMgr->addTag("GeoForwardDetectors", m_forDetVersionOverride)
550 .isFailure()) {
551 ATH_MSG_ERROR("GeoModelSvc ForwardDetectors tag: "
552 << m_forDetVersionOverride << " not added to TagInfo ");
553 return StatusCode::FAILURE;
554 }
555 }
556
557 return StatusCode::SUCCESS;
558}
559
560const IGeoModelTool *GeoModelSvc::getTool(std::string toolName) const {
561 for (const ToolHandle<IGeoModelTool> &tool : m_detectorTools) {
562 if (tool->name().find(toolName) != std::string::npos)
563 return tool.get();
564 }
565
566 return 0;
567}
568
569StatusCode GeoModelSvc::clear() {
570 ATH_MSG_DEBUG("In clear()");
571
572 // Call clear() for all tools
573 for (ToolHandle<IGeoModelTool> &tool : m_detectorTools) {
574 if (tool->clear().isFailure()) {
575 ATH_MSG_ERROR("clear() failed for the tool: " << tool->name());
576 return StatusCode::FAILURE;
577 } else {
578 ATH_MSG_DEBUG(tool->name() << " tool released");
579 }
580 }
581
582 // Delete GeoModelExperiment - cascade delete of the entire GeoModel tree
583 std::vector<std::string> sgkeysExp;
584 m_detStore->keys<GeoModelExperiment>(sgkeysExp);
585 for (const std::string &key : sgkeysExp) {
586 SG::DataProxy *proxy =
588 if (proxy) {
589 proxy->reset();
590 ATH_MSG_DEBUG(key << " GeoModel experiment released");
591 }
592 }
593
594 // Release stored material manager
595 std::vector<std::string> sgkeysMat;
596 m_detStore->keys<StoredMaterialManager>(sgkeysMat);
597 for (const std::string &key : sgkeysMat) {
598 SG::DataProxy *proxy =
600 if (proxy) {
601 proxy->reset();
602 ATH_MSG_DEBUG(key << " material manager released");
603 }
604 }
605 m_sqliteReader.reset();
606 m_sqliteDbManager.reset();
607
608 return StatusCode::SUCCESS;
609}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Definition of the abstract IRDBAccessSvc interface.
coral::AttributeList RDBTagDetails
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
void setTileVersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:33
void setPixelVersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:29
void setCavernInfraVersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:37
void setCaloVersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:35
StatusCode setupConfig()
void setTRT_VersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:31
void setAtlasVersion(const std::string &tag)
Definition GeoDbTagSvc.h:27
void setParamSvcName(const std::string &name)
Definition GeoDbTagSvc.h:40
void setMuonVersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:34
StatusCode setupTags()
void setInDetVersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:28
void setMagFieldVersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:36
void setLAr_VersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:32
void setSCT_VersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:30
void setSqliteReader(GeoModelIO::ReadGeoModel *reader)
Definition GeoDbTagSvc.h:41
void setForwardDetectorsVersionOverride(const std::string &tag)
Definition GeoDbTagSvc.h:38
ServiceHandle< ITagInfoMgr > m_tagInfoMgr
Definition GeoModelSvc.h:51
Gaudi::Property< bool > m_ignoreTagSupport
Definition GeoModelSvc.h:75
virtual void tagInfoUpdated() override final
Callback from TagInfoMgr on TagInfo change.
virtual StatusCode initialize() override
Gaudi::Property< std::string > m_muonVersionOverride
Definition GeoModelSvc.h:62
Gaudi::Property< std::string > m_atlasVersion
Definition GeoModelSvc.h:54
virtual const IGeoModelTool * getTool(std::string toolName) const override
Gaudi::Property< unsigned > m_nTheads
Definition GeoModelSvc.h:81
Gaudi::Property< int > m_supportedGeometry
Definition GeoModelSvc.h:74
std::unique_ptr< GeoModelIO::ReadGeoModel > m_sqliteReader
Definition GeoModelSvc.h:83
Gaudi::Property< std::string > m_larVersionOverride
Definition GeoModelSvc.h:60
StatusCode geoInit()
Gaudi::Property< std::string > m_bFieldVersionOverride
Definition GeoModelSvc.h:64
ServiceHandle< StoreGateSvc > m_detStore
Definition GeoModelSvc.h:50
Gaudi::Property< std::string > m_sqliteDbFullPath
Definition GeoModelSvc.h:80
Gaudi::Property< std::string > m_tileVersionOverride
Definition GeoModelSvc.h:61
Gaudi::Property< std::string > m_trtVersionOverride
Definition GeoModelSvc.h:59
StatusCode fillTagInfo() const
virtual const std::string & atlasVersion() const override
Definition GeoModelSvc.h:86
Gaudi::Property< bool > m_ignoreTagDifference
Definition GeoModelSvc.h:70
Gaudi::Property< bool > m_sqliteDb
Definition GeoModelSvc.h:79
virtual StatusCode finalize() override
Gaudi::Property< std::string > m_forDetVersionOverride
Definition GeoModelSvc.h:66
ISvcLocator * m_pSvcLocator
Definition GeoModelSvc.h:48
Gaudi::Property< bool > m_checkTagInfo
Definition GeoModelSvc.h:69
Gaudi::Property< std::string > m_inDetVersionOverride
Definition GeoModelSvc.h:56
GeoModelSvc(const std::string &name, ISvcLocator *svc)
Gaudi::Property< std::string > m_caloVersionOverride
Definition GeoModelSvc.h:63
Gaudi::Property< std::string > m_pixelVersionOverride
Definition GeoModelSvc.h:57
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
Definition GeoModelSvc.h:52
std::shared_ptr< GMDBManager > m_sqliteDbManager
Definition GeoModelSvc.h:84
ToolHandleArray< IGeoModelTool > m_detectorTools
Definition GeoModelSvc.h:46
Gaudi::Property< std::string > m_sctVersionOverride
Definition GeoModelSvc.h:58
Gaudi::Property< std::string > m_cavInfraVersionOverride
Definition GeoModelSvc.h:65
StatusCode compareTags()
Gaudi::Property< bool > m_statisticsToFile
Definition GeoModelSvc.h:72
virtual StatusCode clear() override
Gaudi::Property< bool > m_useTagInfo
Definition GeoModelSvc.h:68
std::vector< NameTagPair > NameTagPairVec
Definition ITagInfoMgr.h:66
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
This class holds one or more material managers and makes them storeable, under StoreGate.
STL class.
MsgStream & msg
Definition testRead.cxx:32