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