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