ATLAS Offline Software
Loading...
Searching...
No Matches
GeoModelSvc Class Reference

#include <GeoModelSvc.h>

Inheritance diagram for GeoModelSvc:
Collaboration diagram for GeoModelSvc:

Public Member Functions

 GeoModelSvc (const std::string &name, ISvcLocator *svc)
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () override
virtual StatusCode finalize () override
virtual void tagInfoUpdated () override final
 Callback from TagInfoMgr on TagInfo change.
StatusCode compareTags ()
virtual const IGeoModelToolgetTool (std::string toolName) const override
virtual StatusCode clear () override

Private Member Functions

virtual const std::string & atlasVersion () const override
virtual const std::string & inDetVersionOverride () const override
virtual const std::string & pixelVersionOverride () const override
virtual const std::string & SCT_VersionOverride () const override
virtual const std::string & TRT_VersionOverride () const override
virtual const std::string & LAr_VersionOverride () const override
virtual const std::string & tileVersionOverride () const override
virtual const std::string & muonVersionOverride () const override
virtual const std::string & caloVersionOverride () const override
virtual const std::string & magFieldVersionOverride () const override
virtual const std::string & cavernInfraVersionOverride () const override
virtual const std::string & forwardDetectorsVersionOverride () const override
virtual const std::string & inDetVersion () const override
virtual const std::string & pixelVersion () const override
virtual const std::string & SCT_Version () const override
virtual const std::string & TRT_Version () const override
virtual const std::string & LAr_Version () const override
virtual const std::string & tileVersion () const override
virtual const std::string & muonVersion () const override
virtual const std::string & caloVersion () const override
virtual const std::string & magFieldVersion () const override
virtual const std::string & cavernInfraVersion () const override
virtual const std::string & forwardDetectorsVersion () const override
virtual GeoModel::GeoConfig geoConfig () const override
virtual const bool & isEmecStandard () const override
StatusCode geoInit ()
StatusCode fillTagInfo () const

Private Attributes

ToolHandleArray< IGeoModelToolm_detectorTools {this,"DetectorTools",{}}
ISvcLocator * m_pSvcLocator {nullptr}
ServiceHandle< StoreGateSvcm_detStore {this,"DetectorStore","DetectorStore",""}
ServiceHandle< ITagInfoMgrm_tagInfoMgr {this,"TagInfoMgr","TagInfoMgr",""}
ServiceHandle< IGeoDbTagSvcm_geoDbTagSvc {this,"GeoDbTagSvc","GeoDbTagSvc",""}
Gaudi::Property< std::string > m_atlasVersion {this,"AtlasVersion","","ATLAS Geometry Tag"}
Gaudi::Property< std::string > m_inDetVersionOverride {this,"InDetVersionOverride","","Overrider for InDet version"}
Gaudi::Property< std::string > m_pixelVersionOverride {this,"PixelVersionOverride","","Overrider for Pixel version"}
Gaudi::Property< std::string > m_sctVersionOverride {this,"SCT_VersionOverride","","Overrider for SCT version"}
Gaudi::Property< std::string > m_trtVersionOverride {this,"TRT_VersionOverride","","Overrider for TRT version"}
Gaudi::Property< std::string > m_larVersionOverride {this,"LAr_VersionOverride","","Overrider for LAr version"}
Gaudi::Property< std::string > m_tileVersionOverride {this,"TileVersionOverride","","Overrider for Tile version"}
Gaudi::Property< std::string > m_muonVersionOverride {this,"MuonVersionOverride","","Overrider for Muon version"}
Gaudi::Property< std::string > m_caloVersionOverride {this,"CaloVersionOverride","","Overrider for Calo version"}
Gaudi::Property< std::string > m_bFieldVersionOverride {this,"MagFieldVersionOverride","","Overrider for MagField version"}
Gaudi::Property< std::string > m_cavInfraVersionOverride {this,"CavernInfraVersionOverride","","Overrider for CavernInfra version"}
Gaudi::Property< std::string > m_forDetVersionOverride {this,"ForwardDetectorsVersionOverride","","Overrider for Forward Detectors version"}
Gaudi::Property< bool > m_useTagInfo {this,"UseTagInfo",true,"Use TagInfo"}
Gaudi::Property< bool > m_checkTagInfo {this,"CheckTagInfo",true,"Compare TagInfo from the job configuration with the one in the input file"}
Gaudi::Property< bool > m_ignoreTagDifference {this,"IgnoreTagDifference",false,"Ignore TagInfo and configuration tag diffs"}
Gaudi::Property< bool > m_statisticsToFile {this,"StatisticsToFile",false,"Generate GeoModelStatistics file in the run directory"}
Gaudi::Property< int > m_supportedGeometry {this,"SupportedGeometry",0,"Supported geometry flag is set in jobOpt and is equal to major release version"}
Gaudi::Property< bool > m_ignoreTagSupport {this,"IgnoreTagSupport",false,"Skip checking if the geometry tag is supported/obsolete"}
Gaudi::Property< bool > m_emecStandard {this,"EMECStandard",false,"Activate the EMEC construction from standard Geant4 Shapes: G4GenericTrap"}
Gaudi::Property< bool > m_sqliteDb {this,"SQLiteDB",false,"Activate GeoModel initialization from SQLite"}
Gaudi::Property< std::string > m_sqliteDbFullPath {this,"SQLiteDBFullPath","","Explicit setting of full path to SQLiteDB. For testing purposes only"}
Gaudi::Property< unsigned > m_nTheads {this, "nThreads", 0, "Number of available threads for the geometry reading"}
std::unique_ptr< GeoModelIO::ReadGeoModel > m_sqliteReader {}
std::shared_ptr< GMDBManager > m_sqliteDbManager {}

Detailed Description

Definition at line 26 of file GeoModelSvc.h.

Constructor & Destructor Documentation

◆ GeoModelSvc()

GeoModelSvc::GeoModelSvc ( const std::string & name,
ISvcLocator * svc )

Definition at line 31 of file GeoModelSvc.cxx.

32 : base_class(name, svc), m_pSvcLocator(svc) {}
ISvcLocator * m_pSvcLocator
Definition GeoModelSvc.h:49

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode initialize GeoModelSvc::ATLAS_NOT_THREAD_SAFE ( )
overridevirtual

◆ atlasVersion()

virtual const std::string & GeoModelSvc::atlasVersion ( ) const
inlineoverrideprivatevirtual

Definition at line 87 of file GeoModelSvc.h.

87{return m_atlasVersion;}
Gaudi::Property< std::string > m_atlasVersion
Definition GeoModelSvc.h:55

◆ caloVersion()

virtual const std::string & GeoModelSvc::caloVersion ( ) const
inlineoverrideprivatevirtual

Definition at line 107 of file GeoModelSvc.h.

107{return m_geoDbTagSvc->caloVersion();}
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
Definition GeoModelSvc.h:53

◆ caloVersionOverride()

virtual const std::string & GeoModelSvc::caloVersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 95 of file GeoModelSvc.h.

Gaudi::Property< std::string > m_caloVersionOverride
Definition GeoModelSvc.h:64

◆ cavernInfraVersion()

virtual const std::string & GeoModelSvc::cavernInfraVersion ( ) const
inlineoverrideprivatevirtual

Definition at line 109 of file GeoModelSvc.h.

109{return m_geoDbTagSvc->cavernInfraVersion();}

◆ cavernInfraVersionOverride()

virtual const std::string & GeoModelSvc::cavernInfraVersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 97 of file GeoModelSvc.h.

Gaudi::Property< std::string > m_cavInfraVersionOverride
Definition GeoModelSvc.h:66

◆ clear()

StatusCode GeoModelSvc::clear ( )
overridevirtual

Definition at line 577 of file GeoModelSvc.cxx.

577 {
578 ATH_MSG_DEBUG("In clear()");
579
580 // Call clear() for all tools
581 for (ToolHandle<IGeoModelTool> &tool : m_detectorTools) {
582 if (tool->clear().isFailure()) {
583 ATH_MSG_ERROR("clear() failed for the tool: " << tool->name());
584 return StatusCode::FAILURE;
585 } else {
586 ATH_MSG_DEBUG(tool->name() << " tool released");
587 }
588 }
589
590 // Delete GeoModelExperiment - cascade delete of the entire GeoModel tree
591 std::vector<std::string> sgkeysExp;
592 m_detStore->keys<GeoModelExperiment>(sgkeysExp);
593 for (const std::string &key : sgkeysExp) {
594 SG::DataProxy *proxy =
596 if (proxy) {
597 proxy->reset();
598 ATH_MSG_DEBUG(key << " GeoModel experiment released");
599 }
600 }
601
602 // Release stored material manager
603 std::vector<std::string> sgkeysMat;
604 m_detStore->keys<StoredMaterialManager>(sgkeysMat);
605 for (const std::string &key : sgkeysMat) {
606 SG::DataProxy *proxy =
608 if (proxy) {
609 proxy->reset();
610 ATH_MSG_DEBUG(key << " material manager released");
611 }
612 }
613 m_sqliteReader.reset();
614 m_sqliteDbManager.reset();
615
616 return StatusCode::SUCCESS;
617}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
std::unique_ptr< GeoModelIO::ReadGeoModel > m_sqliteReader
Definition GeoModelSvc.h:84
ServiceHandle< StoreGateSvc > m_detStore
Definition GeoModelSvc.h:51
std::shared_ptr< GMDBManager > m_sqliteDbManager
Definition GeoModelSvc.h:85
ToolHandleArray< IGeoModelTool > m_detectorTools
Definition GeoModelSvc.h:47

◆ compareTags()

StatusCode GeoModelSvc::compareTags ( )

Definition at line 311 of file GeoModelSvc.cxx.

311 {
312 bool tagsMatch = true;
313
314 ATH_MSG_DEBUG("in compareTags()");
315
316 // Get tags from TagInfoMgr
317 const ITagInfoMgr::NameTagPairVec pairs = m_tagInfoMgr->getInputTags();
318 for (const auto &pair : pairs) {
319 std::string tagPairName = pair.first;
320 if (tagPairName == "GeoAtlas") {
321 // ** Two possible cases need to be taken into account
322 // **
323 // ** 1. The retrieved ATLAS tag is following naming schema
324 // ATLAS-...-XX-YY-ZZ
325 // ** where '...' can be anything, it may also containg one or more '-'.
326 // ** If this is the case, then we need to check whether the job option
327 // tag
328 // ** is also following the same schema and they have the same
329 // 'ATLAS-...-XX' part
330 // **
331 // ** 2. The retrieved ATLAS tag is not following the schema mentioned
332 // above
333 // ** If this is the case, we just need to check the exact match
334 std::vector<std::string> tokensTagInfo, tokensJobOpt;
335
336 // Parse Tag Info tag
337 std::string::size_type startpos = 0;
338 std::string currStr = pair.second;
339 for (std::string::size_type endpos = currStr.find('-');
340 endpos != std::string::npos; endpos = currStr.find('-', startpos)) {
341 tokensTagInfo.push_back(currStr.substr(startpos, endpos - startpos));
342 startpos = endpos + 1;
343 }
344 tokensTagInfo.push_back(currStr.substr(startpos));
345
346 size_t tokensTagInfoSize = tokensTagInfo.size();
347 bool tagInfoFollowsTheScheme =
348 (tokensTagInfoSize >= 5 &&
349 tokensTagInfo[tokensTagInfoSize - 1].size() == 2 &&
350 tokensTagInfo[tokensTagInfoSize - 2].size() == 2 &&
351 tokensTagInfo[tokensTagInfoSize - 3].size() == 2);
352
353 if (tagInfoFollowsTheScheme) {
354 // Parse Job Options tag
355 startpos = 0;
356 currStr = m_atlasVersion;
357 for (std::string::size_type endpos = currStr.find('-');
358 endpos != std::string::npos;
359 endpos = currStr.find('-', startpos)) {
360 tokensJobOpt.push_back(currStr.substr(startpos, endpos - startpos));
361 startpos = endpos + 1;
362 }
363 tokensJobOpt.push_back(currStr.substr(startpos));
364
365 size_t tokensJobOptSize = tokensJobOpt.size();
366 bool jobOptFollowsTheScheme =
367 (tokensJobOptSize >= 5 &&
368 tokensJobOpt[tokensJobOptSize - 1].size() == 2 &&
369 tokensJobOpt[tokensJobOptSize - 2].size() == 2 &&
370 tokensJobOpt[tokensJobOptSize - 3].size() == 2);
371 if (jobOptFollowsTheScheme) {
372 const std::string &atlasVersion = m_atlasVersion;
373 tagsMatch = (pair.second.substr(0, currStr.size() - 6) ==
374 atlasVersion.substr(0, atlasVersion.size() - 6));
375 } else {
376 tagsMatch = false;
377 }
378 } else { // Check for the exact match
379 tagsMatch = m_atlasVersion == pair.second;
380 }
381 } else if (tagPairName == "GeoInDet")
382 tagsMatch = m_inDetVersionOverride == pair.second;
383 else if (tagPairName == "GeoPixel")
384 tagsMatch = m_pixelVersionOverride == pair.second;
385 else if (tagPairName == "GeoSCT")
386 tagsMatch = m_sctVersionOverride == pair.second;
387 else if (tagPairName == "GeoTRT")
388 tagsMatch = m_trtVersionOverride == pair.second;
389 else if (tagPairName == "GeoLAr")
390 tagsMatch = m_larVersionOverride == pair.second;
391 else if (tagPairName == "GeoTile")
392 tagsMatch = m_tileVersionOverride == pair.second;
393 else if (tagPairName == "GeoMuon")
394 tagsMatch = m_muonVersionOverride == pair.second;
395
396 if (!tagsMatch)
397 break;
398 }
399
400 if (!tagsMatch) {
401 msg((m_ignoreTagDifference ? MSG::WARNING : MSG::ERROR))
402 << "*** *** Geometry configured through jobOptions does not match "
403 "TagInfo tags! *** ***"
404 << endmsg;
405 ATH_MSG_INFO("** Job Option configuration: ");
406 ATH_MSG_INFO("* ATLAS tag: " << m_atlasVersion);
407 ATH_MSG_INFO("* InDet tag: " << m_inDetVersionOverride);
408 ATH_MSG_INFO("* Pixel tag: " << m_pixelVersionOverride);
409 ATH_MSG_INFO("* SCT tag: " << m_sctVersionOverride);
410 ATH_MSG_INFO("* TRT tag: " << m_trtVersionOverride);
411 ATH_MSG_INFO("* LAr tag: " << m_larVersionOverride);
412 ATH_MSG_INFO("* Tile tag: " << m_tileVersionOverride);
413 ATH_MSG_INFO("* Muon tag: " << m_muonVersionOverride);
414 ATH_MSG_INFO("* Calo tag: " << m_caloVersionOverride);
415 ATH_MSG_INFO("* MagField tag: " << m_bFieldVersionOverride);
416 ATH_MSG_INFO("* CavernInfra tag: " << m_cavInfraVersionOverride);
417 ATH_MSG_INFO("* ForwardDetectors tag: " << m_forDetVersionOverride);
418 ATH_MSG_INFO("** TAG INFO configuration: ");
419 for (const auto &pair : pairs) {
420 const std::string &tagPairName = pair.first;
421 if (tagPairName == "GeoAtlas") {
422 ATH_MSG_INFO("* ATLAS tag: " << pair.second);
423 } else if (tagPairName == "GeoInDet") {
424 ATH_MSG_INFO("*InDet tag: " << pair.second);
425 } else if (tagPairName == "GeoPixel") {
426 ATH_MSG_INFO("*Pixel tag: " << pair.second);
427 } else if (tagPairName == "GeoSCT") {
428 ATH_MSG_INFO("*SCT tag: " << pair.second);
429 } else if (tagPairName == "GeoTRT") {
430 ATH_MSG_INFO("*TRT tag: " << pair.second);
431 } else if (tagPairName == "GeoLAr") {
432 ATH_MSG_INFO("*LAr tag: " << pair.second);
433 } else if (tagPairName == "GeoTile") {
434 ATH_MSG_INFO("*Tile tag: " << pair.second);
435 } else if (tagPairName == "GeoMuon") {
436 ATH_MSG_INFO("*Muon tag: " << pair.second);
437 } else if (tagPairName == "GeoCalo") {
438 ATH_MSG_INFO("*Calo tag: " << pair.second);
439 } else if (tagPairName == "GeoMagField") {
440 ATH_MSG_INFO("*MagField tag: " << pair.second);
441 } else if (tagPairName == "GeoCavernInfra") {
442 ATH_MSG_INFO("*CavernInfra tag: " << pair.second);
443 } else if (tagPairName == "GeoForwardDetectors") {
444 ATH_MSG_INFO("*ForwardDetectors tag: " << pair.second);
445 }
446 }
447
449 ATH_MSG_INFO("*** *** Please fix geometry tag settings *** ***");
450 return StatusCode::FAILURE;
451 }
452 } else
454 "Geometry configurations in jobOptions and TagInfo are consistent");
455
456 return StatusCode::SUCCESS;
457}
#define endmsg
#define ATH_MSG_INFO(x)
ServiceHandle< ITagInfoMgr > m_tagInfoMgr
Definition GeoModelSvc.h:52
Gaudi::Property< std::string > m_muonVersionOverride
Definition GeoModelSvc.h:63
Gaudi::Property< std::string > m_larVersionOverride
Definition GeoModelSvc.h:61
Gaudi::Property< std::string > m_bFieldVersionOverride
Definition GeoModelSvc.h:65
Gaudi::Property< std::string > m_tileVersionOverride
Definition GeoModelSvc.h:62
Gaudi::Property< std::string > m_trtVersionOverride
Definition GeoModelSvc.h:60
virtual const std::string & atlasVersion() const override
Definition GeoModelSvc.h:87
Gaudi::Property< bool > m_ignoreTagDifference
Definition GeoModelSvc.h:71
Gaudi::Property< std::string > m_forDetVersionOverride
Definition GeoModelSvc.h:67
Gaudi::Property< std::string > m_inDetVersionOverride
Definition GeoModelSvc.h:57
Gaudi::Property< std::string > m_pixelVersionOverride
Definition GeoModelSvc.h:58
Gaudi::Property< std::string > m_sctVersionOverride
Definition GeoModelSvc.h:59
std::vector< NameTagPair > NameTagPairVec
Definition ITagInfoMgr.h:66
MsgStream & msg
Definition testRead.cxx:32

◆ fillTagInfo()

StatusCode GeoModelSvc::fillTagInfo ( ) const
private

Definition at line 462 of file GeoModelSvc.cxx.

462 {
463 if (m_atlasVersion == "") {
464 ATH_MSG_ERROR("ATLAS version is empty");
465 return StatusCode::FAILURE;
466 }
467
468 if (m_tagInfoMgr->addTag("GeoAtlas", m_atlasVersion).isFailure()) {
469 ATH_MSG_ERROR("GeoModelSvc Atlas tag: " << m_atlasVersion
470 << " not added to TagInfo ");
471 return StatusCode::FAILURE;
472 }
473
474 if (m_inDetVersionOverride != "") {
475 if (m_tagInfoMgr->addTag("GeoInDet", m_inDetVersionOverride).isFailure()) {
476 ATH_MSG_ERROR("GeoModelSvc InDet tag: " << m_inDetVersionOverride
477 << " not added to TagInfo ");
478 return StatusCode::FAILURE;
479 }
480 }
481
482 if (m_pixelVersionOverride != "") {
483 if (m_tagInfoMgr->addTag("GeoPixel", m_pixelVersionOverride).isFailure()) {
484 ATH_MSG_ERROR("GeoModelSvc Pixel tag: " << m_pixelVersionOverride
485 << " not added to TagInfo ");
486 return StatusCode::FAILURE;
487 }
488 }
489
490 if (m_sctVersionOverride != "") {
491 if (m_tagInfoMgr->addTag("GeoSCT", m_sctVersionOverride).isFailure()) {
492 ATH_MSG_ERROR("GeoModelSvc SCT tag: " << m_sctVersionOverride
493 << " not added to TagInfo ");
494 return StatusCode::FAILURE;
495 }
496 }
497
498 if (m_trtVersionOverride != "") {
499 if (m_tagInfoMgr->addTag("GeoTRT", m_trtVersionOverride).isFailure()) {
500 ATH_MSG_ERROR("GeoModelSvc TRT tag: " << m_trtVersionOverride
501 << " not added to TagInfo ");
502 return StatusCode::FAILURE;
503 }
504 }
505
506 if (m_larVersionOverride != "") {
507 if (m_tagInfoMgr->addTag("GeoLAr", m_larVersionOverride).isFailure()) {
508 ATH_MSG_ERROR("GeoModelSvc LAr tag: " << m_larVersionOverride
509 << " 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
517 << " not added to TagInfo ");
518 return StatusCode::FAILURE;
519 }
520 }
521
522 if (m_muonVersionOverride != "") {
523 if (m_tagInfoMgr->addTag("GeoMuon", m_muonVersionOverride).isFailure()) {
524 ATH_MSG_ERROR("GeoModelSvc Muon tag: " << m_muonVersionOverride
525 << " not added to TagInfo ");
526 return StatusCode::FAILURE;
527 }
528 }
529
530 if (m_caloVersionOverride != "") {
531 if (m_tagInfoMgr->addTag("GeoCalo", m_caloVersionOverride).isFailure()) {
532 ATH_MSG_ERROR("GeoModelSvc Calo tag: " << m_caloVersionOverride
533 << " not added to TagInfo ");
534 return StatusCode::FAILURE;
535 }
536 }
537
538 if (m_bFieldVersionOverride != "") {
539 if (m_tagInfoMgr->addTag("GeoMagField", m_bFieldVersionOverride)
540 .isFailure()) {
541 ATH_MSG_ERROR("GeoModelSvc MagField tag: " << m_bFieldVersionOverride
542 << " not added to TagInfo ");
543 return StatusCode::FAILURE;
544 }
545 }
546
547 if (m_cavInfraVersionOverride != "") {
548 if (m_tagInfoMgr->addTag("GeoCavernInfra", m_cavInfraVersionOverride)
549 .isFailure()) {
550 ATH_MSG_ERROR("GeoModelSvc CavernInfra tag: "
551 << m_cavInfraVersionOverride << " not added to TagInfo ");
552 return StatusCode::FAILURE;
553 }
554 }
555
556 if (m_forDetVersionOverride != "") {
557 if (m_tagInfoMgr->addTag("GeoForwardDetectors", m_forDetVersionOverride)
558 .isFailure()) {
559 ATH_MSG_ERROR("GeoModelSvc ForwardDetectors tag: "
560 << m_forDetVersionOverride << " not added to TagInfo ");
561 return StatusCode::FAILURE;
562 }
563 }
564
565 return StatusCode::SUCCESS;
566}

◆ finalize()

StatusCode GeoModelSvc::finalize ( )
overridevirtual

Definition at line 95 of file GeoModelSvc.cxx.

95 {
96 m_tagInfoMgr->removeListener(this);
97 return StatusCode::SUCCESS;
98}

◆ forwardDetectorsVersion()

virtual const std::string & GeoModelSvc::forwardDetectorsVersion ( ) const
inlineoverrideprivatevirtual

Definition at line 110 of file GeoModelSvc.h.

110{return m_geoDbTagSvc->forwardDetectorsVersion();}

◆ forwardDetectorsVersionOverride()

virtual const std::string & GeoModelSvc::forwardDetectorsVersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 98 of file GeoModelSvc.h.

◆ geoConfig()

virtual GeoModel::GeoConfig GeoModelSvc::geoConfig ( ) const
inlineoverrideprivatevirtual

Definition at line 112 of file GeoModelSvc.h.

112{return m_geoDbTagSvc->geoConfig();}

◆ geoInit()

StatusCode GeoModelSvc::geoInit ( )
private

Definition at line 100 of file GeoModelSvc.cxx.

100 {
101 PVLink worldPhys{nullptr};
102 ServiceHandle<IRDBAccessSvc> rdbAccess("RDBAccessSvc", name());
103
104 // Setup the GeoDbTagSvc
105 ATH_CHECK(m_geoDbTagSvc.retrieve());
106
107 GeoDbTagSvc *dbTagSvc = dynamic_cast<GeoDbTagSvc *>(m_geoDbTagSvc.get());
108 if (dbTagSvc == nullptr) {
109 ATH_MSG_FATAL("Unable to dyn-cast the IGeoDbTagSvc pointer to GeoDbTagSvc");
110 return StatusCode::FAILURE;
111 }
112
113 // Build geometry from the SQLiteDB file
114 if (m_sqliteDb) {
115 std::string sqliteDbName = "Geometry/" + m_atlasVersion + ".db";
116 std::string sqliteDbPath =
117 m_sqliteDbFullPath.empty()
118 ? PathResolver::find_file(sqliteDbName, "CALIBPATH")
120 if (sqliteDbPath.empty() && m_sqliteDbFullPath.empty()) {
121 ATH_MSG_FATAL("Failed to find SQLite database file "
122 << sqliteDbName
123 << " for reading in persistent GeoModel tree");
124 return StatusCode::FAILURE;
125 }
126 ATH_MSG_INFO("Successfully located SQLite database file "
127 << sqliteDbPath << " for reading in persistent GeoModel tree");
128 // Read raw geometry description from the file
129 m_sqliteDbManager = std::make_unique<GMDBManager>(sqliteDbPath);
130 if (!m_sqliteDbManager->checkIsDBOpen()) {
131 ATH_MSG_FATAL("Failed to open SQLite database "
132 << sqliteDbPath
133 << " for reading in persistent GeoModel tree");
134 return StatusCode::FAILURE;
135 }
136 GeoThreading::ThreadPool::getPool(m_nTheads);
138 "Successfully opened SQLite DB file "
139 << sqliteDbPath << " for reading in persistent GeoModel tree using "
140 << GeoThreading::ThreadPool::getPool().nThreads() << " threads.");
142 std::make_unique<GeoModelIO::ReadGeoModel>(m_sqliteDbManager);
143 PVConstLink vWorldPhys{m_sqliteReader->buildGeoModel()};
144 worldPhys = const_pointer_cast(vWorldPhys);
145 if (!worldPhys) {
147 "Having Full Physical Volumes as World Volumes not supported!");
148 return StatusCode::FAILURE;
149 }
151 "Successfully read persistent GeoModel description from the file");
152
153 // Initialize SqliteReadSvc and open the file for reading plain SQLite
154 // tables with DetDescr parameters
155 ServiceHandle<IRDBAccessSvc> sqliteReadSvc("SqliteReadSvc", name());
156 ATH_CHECK(sqliteReadSvc.retrieve());
157 if (!sqliteReadSvc->connect(sqliteDbPath)) {
158 ATH_MSG_FATAL("Failed to open SQLite database file "
159 << sqliteDbPath << " for reading geometry parameters");
160 return StatusCode::FAILURE;
161 } else {
162 ATH_MSG_INFO("Successfully opened SQLite DB file: "
163 << sqliteDbPath << " for reading Det Descr parameters");
164 }
165 dbTagSvc->setParamSvcName("SqliteReadSvc");
166 dbTagSvc->setSqliteReader(m_sqliteReader.get());
167 if (dbTagSvc->setupConfig().isFailure()) {
168 ATH_MSG_FATAL("Failed to setup Geoconfig");
169 return StatusCode::FAILURE;
170 }
171 } else {
172 // Build geometry from the GeometryDB
173 ATH_MSG_DEBUG("** Building geometry configuration: ");
174 ATH_MSG_DEBUG("* ATLAS tag: " << m_atlasVersion);
175 ATH_MSG_DEBUG("* InDet tag: " << m_inDetVersionOverride);
176 ATH_MSG_DEBUG("* Pixel tag: " << m_pixelVersionOverride);
177 ATH_MSG_DEBUG("* SCT tag: " << m_sctVersionOverride);
178 ATH_MSG_DEBUG("* TRT tag: " << m_trtVersionOverride);
179 ATH_MSG_DEBUG("* LAr tag: " << m_larVersionOverride);
180 ATH_MSG_DEBUG("* Tile tag: " << m_tileVersionOverride);
181 ATH_MSG_DEBUG("* Muon tag: " << m_muonVersionOverride);
182 ATH_MSG_DEBUG("* Calo tag: " << m_caloVersionOverride);
183 ATH_MSG_DEBUG("* MagField tag: " << m_bFieldVersionOverride);
184 ATH_MSG_DEBUG("* CavernInfra tag: " << m_cavInfraVersionOverride);
185 ATH_MSG_DEBUG("* ForwardDetectors tag: " << m_forDetVersionOverride);
186
187 // Get RDBAccessSvc and open connection to DB
188 ATH_CHECK(rdbAccess.retrieve());
189
190 if (!rdbAccess->connect()) {
191 ATH_MSG_FATAL("Unable to connect to the Geometry DB");
192 return StatusCode::FAILURE;
193 }
194
195 // Check the existence of ATLAS tag in the database
196 if (rdbAccess->getChildTag("ATLAS", m_atlasVersion, "ATLAS") == "") {
197 ATH_MSG_FATAL(" *** *** Wrong ATLAS layout: " << m_atlasVersion
198 << " *** ***");
200 " Either ATLAS geometry tag has been misspelled, or the DB Release "
201 "does not contain the geometry specified.");
202 ATH_MSG_FATAL(" In latter case please update DB Release version");
203 return StatusCode::FAILURE;
204 }
205
206 dbTagSvc->setParamSvcName("RDBAccessSvc");
207
208 if (!m_ignoreTagSupport) {
209 RDBTagDetails atlasTagDetails;
210 rdbAccess->getTagDetails(atlasTagDetails, m_atlasVersion);
211 const coral::AttributeSpecification &supportedSpec =
212 atlasTagDetails["SUPPORTED"].specification();
213 if (supportedSpec.type() == typeid(bool)) {
214 if (!atlasTagDetails["SUPPORTED"].data<bool>()) {
216 " *** *** ATLAS layout "
218 << " is OBSOLETE and can NOT be supported any more! *** ***");
219 return StatusCode::FAILURE;
220 }
221 } else if (supportedSpec.type() == typeid(int)) {
222 if (atlasTagDetails["SUPPORTED"].data<int>() < m_supportedGeometry) {
223 ATH_MSG_FATAL(" *** *** ATLAS layout "
224 << m_atlasVersion << " is OBSOLETE in rel "
226 << " and can NOT be supported any more! *** ***");
227 return StatusCode::FAILURE;
228 }
229 }
230 }
231
244
245 if (dbTagSvc->setupTags().isFailure()) {
246 ATH_MSG_FATAL("Failed to setup subsystem tags");
247 return StatusCode::FAILURE;
248 }
249 if (dbTagSvc->setupConfig().isFailure()) {
250 ATH_MSG_FATAL("Failed to setup Geoconfig");
251 return StatusCode::FAILURE;
252 }
253
254 // Create a material manager
255 std::unique_ptr<StoredMaterialManager> theMaterialManager{};
256 try {
257 theMaterialManager = std::make_unique<RDBMaterialManager>(m_pSvcLocator);
258 } catch (std::runtime_error &e) {
259 ATH_MSG_FATAL(e.what());
260 return StatusCode::FAILURE;
261 }
262 ATH_CHECK(m_detStore->record(std::move(theMaterialManager), "MATERIALS"));
263
264 worldPhys = createGeoWorld();
265 } // End of the GeometryDB-specific part
266
267 // Create AtlasExperiment and register it within the transient detector store
268 auto theExperiment =
269 std::make_unique<GeoModelExperiment>(std::move(worldPhys));
270 ATH_CHECK(m_detStore->record(std::move(theExperiment), "ATLAS"));
271
272 int mem{}, cpu{};
273 std::ofstream geoModelStats(m_statisticsToFile ? "GeoModelStatistics" : "");
274 if (geoModelStats) {
275 geoModelStats << "Detector Configuration flag = " << m_atlasVersion
276 << std::endl;
277 }
278
279 // Loop over all tools
280 for(ToolHandle<IGeoModelTool>& theTool : m_detectorTools) {
281 mem = GeoPerfUtils::getMem();
282 cpu = GeoPerfUtils::getCpu();
283
284 ATH_CHECK(theTool->create());
285
286 if (geoModelStats) {
287 geoModelStats << theTool->name()
288 << "\t SZ= " << GeoPerfUtils::getMem() - mem
289 << "Kb \t Time = " << (GeoPerfUtils::getCpu() - cpu) * 0.01
290 << "S" << std::endl;
291 } else {
292 ATH_MSG_INFO(theTool->name()
293 << "\t SZ= " << GeoPerfUtils::getMem() - mem
294 << "Kb \t Time = " << (GeoPerfUtils::getCpu() - cpu) * 0.01
295 << "S");
296 }
297 }
298
299 if (!m_sqliteDb) {
300 // Close connection to the GeometryDB
301 rdbAccess->shutdown();
302 }
303
304 return StatusCode::SUCCESS;
305}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
coral::AttributeList RDBTagDetails
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
Gaudi::Property< bool > m_ignoreTagSupport
Definition GeoModelSvc.h:76
Gaudi::Property< unsigned > m_nTheads
Definition GeoModelSvc.h:82
Gaudi::Property< int > m_supportedGeometry
Definition GeoModelSvc.h:75
Gaudi::Property< std::string > m_sqliteDbFullPath
Definition GeoModelSvc.h:81
Gaudi::Property< bool > m_sqliteDb
Definition GeoModelSvc.h:80
Gaudi::Property< bool > m_statisticsToFile
Definition GeoModelSvc.h:73
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)

◆ getTool()

const IGeoModelTool * GeoModelSvc::getTool ( std::string toolName) const
overridevirtual

Definition at line 568 of file GeoModelSvc.cxx.

568 {
569 for (const ToolHandle<IGeoModelTool> &tool : m_detectorTools) {
570 if (tool->name().find(toolName) != std::string::npos)
571 return tool.get();
572 }
573
574 return 0;
575}

◆ inDetVersion()

virtual const std::string & GeoModelSvc::inDetVersion ( ) const
inlineoverrideprivatevirtual

Definition at line 100 of file GeoModelSvc.h.

100{return m_geoDbTagSvc->inDetVersion();}

◆ inDetVersionOverride()

virtual const std::string & GeoModelSvc::inDetVersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 88 of file GeoModelSvc.h.

◆ isEmecStandard()

virtual const bool & GeoModelSvc::isEmecStandard ( ) const
inlineoverrideprivatevirtual

Definition at line 114 of file GeoModelSvc.h.

114{return m_emecStandard;}
Gaudi::Property< bool > m_emecStandard
Definition GeoModelSvc.h:78

◆ LAr_Version()

virtual const std::string & GeoModelSvc::LAr_Version ( ) const
inlineoverrideprivatevirtual

Definition at line 104 of file GeoModelSvc.h.

104{return m_geoDbTagSvc->LAr_Version();}

◆ LAr_VersionOverride()

virtual const std::string & GeoModelSvc::LAr_VersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 92 of file GeoModelSvc.h.

◆ magFieldVersion()

virtual const std::string & GeoModelSvc::magFieldVersion ( ) const
inlineoverrideprivatevirtual

Definition at line 108 of file GeoModelSvc.h.

108{return m_geoDbTagSvc->magFieldVersion();}

◆ magFieldVersionOverride()

virtual const std::string & GeoModelSvc::magFieldVersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 96 of file GeoModelSvc.h.

◆ muonVersion()

virtual const std::string & GeoModelSvc::muonVersion ( ) const
inlineoverrideprivatevirtual

Definition at line 106 of file GeoModelSvc.h.

106{return m_geoDbTagSvc->muonVersion();}

◆ muonVersionOverride()

virtual const std::string & GeoModelSvc::muonVersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 94 of file GeoModelSvc.h.

◆ pixelVersion()

virtual const std::string & GeoModelSvc::pixelVersion ( ) const
inlineoverrideprivatevirtual

Definition at line 101 of file GeoModelSvc.h.

101{return m_geoDbTagSvc->pixelVersion();}

◆ pixelVersionOverride()

virtual const std::string & GeoModelSvc::pixelVersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 89 of file GeoModelSvc.h.

◆ SCT_Version()

virtual const std::string & GeoModelSvc::SCT_Version ( ) const
inlineoverrideprivatevirtual

Definition at line 102 of file GeoModelSvc.h.

102{return m_geoDbTagSvc->SCT_Version();}

◆ SCT_VersionOverride()

virtual const std::string & GeoModelSvc::SCT_VersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 90 of file GeoModelSvc.h.

◆ tagInfoUpdated()

void GeoModelSvc::tagInfoUpdated ( )
finaloverridevirtual

Callback from TagInfoMgr on TagInfo change.

Implements ITagInfoMgr::Listener.

Definition at line 307 of file GeoModelSvc.cxx.

307 {
308 compareTags().ignore();
309}
StatusCode compareTags()

◆ tileVersion()

virtual const std::string & GeoModelSvc::tileVersion ( ) const
inlineoverrideprivatevirtual

Definition at line 105 of file GeoModelSvc.h.

105{return m_geoDbTagSvc->tileVersion();}

◆ tileVersionOverride()

virtual const std::string & GeoModelSvc::tileVersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 93 of file GeoModelSvc.h.

◆ TRT_Version()

virtual const std::string & GeoModelSvc::TRT_Version ( ) const
inlineoverrideprivatevirtual

Definition at line 103 of file GeoModelSvc.h.

103{return m_geoDbTagSvc->TRT_Version();}

◆ TRT_VersionOverride()

virtual const std::string & GeoModelSvc::TRT_VersionOverride ( ) const
inlineoverrideprivatevirtual

Definition at line 91 of file GeoModelSvc.h.

Member Data Documentation

◆ m_atlasVersion

Gaudi::Property<std::string> GeoModelSvc::m_atlasVersion {this,"AtlasVersion","","ATLAS Geometry Tag"}
private

Definition at line 55 of file GeoModelSvc.h.

55{this,"AtlasVersion","","ATLAS Geometry Tag"};

◆ m_bFieldVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_bFieldVersionOverride {this,"MagFieldVersionOverride","","Overrider for MagField version"}
private

Definition at line 65 of file GeoModelSvc.h.

65{this,"MagFieldVersionOverride","","Overrider for MagField version"};

◆ m_caloVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_caloVersionOverride {this,"CaloVersionOverride","","Overrider for Calo version"}
private

Definition at line 64 of file GeoModelSvc.h.

64{this,"CaloVersionOverride","","Overrider for Calo version"};

◆ m_cavInfraVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_cavInfraVersionOverride {this,"CavernInfraVersionOverride","","Overrider for CavernInfra version"}
private

Definition at line 66 of file GeoModelSvc.h.

66{this,"CavernInfraVersionOverride","","Overrider for CavernInfra version"};

◆ m_checkTagInfo

Gaudi::Property<bool> GeoModelSvc::m_checkTagInfo {this,"CheckTagInfo",true,"Compare TagInfo from the job configuration with the one in the input file"}
private

Definition at line 70 of file GeoModelSvc.h.

70{this,"CheckTagInfo",true,"Compare TagInfo from the job configuration with the one in the input file"};

◆ m_detectorTools

ToolHandleArray<IGeoModelTool> GeoModelSvc::m_detectorTools {this,"DetectorTools",{}}
private

Definition at line 47 of file GeoModelSvc.h.

47{this,"DetectorTools",{}};

◆ m_detStore

ServiceHandle<StoreGateSvc> GeoModelSvc::m_detStore {this,"DetectorStore","DetectorStore",""}
private

Definition at line 51 of file GeoModelSvc.h.

51{this,"DetectorStore","DetectorStore",""};

◆ m_emecStandard

Gaudi::Property<bool> GeoModelSvc::m_emecStandard {this,"EMECStandard",false,"Activate the EMEC construction from standard Geant4 Shapes: G4GenericTrap"}
private

Definition at line 78 of file GeoModelSvc.h.

78{this,"EMECStandard",false,"Activate the EMEC construction from standard Geant4 Shapes: G4GenericTrap"};

◆ m_forDetVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_forDetVersionOverride {this,"ForwardDetectorsVersionOverride","","Overrider for Forward Detectors version"}
private

Definition at line 67 of file GeoModelSvc.h.

67{this,"ForwardDetectorsVersionOverride","","Overrider for Forward Detectors version"};

◆ m_geoDbTagSvc

ServiceHandle<IGeoDbTagSvc> GeoModelSvc::m_geoDbTagSvc {this,"GeoDbTagSvc","GeoDbTagSvc",""}
private

Definition at line 53 of file GeoModelSvc.h.

53{this,"GeoDbTagSvc","GeoDbTagSvc",""};

◆ m_ignoreTagDifference

Gaudi::Property<bool> GeoModelSvc::m_ignoreTagDifference {this,"IgnoreTagDifference",false,"Ignore TagInfo and configuration tag diffs"}
private

Definition at line 71 of file GeoModelSvc.h.

71{this,"IgnoreTagDifference",false,"Ignore TagInfo and configuration tag diffs"};

◆ m_ignoreTagSupport

Gaudi::Property<bool> GeoModelSvc::m_ignoreTagSupport {this,"IgnoreTagSupport",false,"Skip checking if the geometry tag is supported/obsolete"}
private

Definition at line 76 of file GeoModelSvc.h.

76{this,"IgnoreTagSupport",false,"Skip checking if the geometry tag is supported/obsolete"};

◆ m_inDetVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_inDetVersionOverride {this,"InDetVersionOverride","","Overrider for InDet version"}
private

Definition at line 57 of file GeoModelSvc.h.

57{this,"InDetVersionOverride","","Overrider for InDet version"};

◆ m_larVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_larVersionOverride {this,"LAr_VersionOverride","","Overrider for LAr version"}
private

Definition at line 61 of file GeoModelSvc.h.

61{this,"LAr_VersionOverride","","Overrider for LAr version"};

◆ m_muonVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_muonVersionOverride {this,"MuonVersionOverride","","Overrider for Muon version"}
private

Definition at line 63 of file GeoModelSvc.h.

63{this,"MuonVersionOverride","","Overrider for Muon version"};

◆ m_nTheads

Gaudi::Property<unsigned> GeoModelSvc::m_nTheads {this, "nThreads", 0, "Number of available threads for the geometry reading"}
private

Definition at line 82 of file GeoModelSvc.h.

82{this, "nThreads", 0, "Number of available threads for the geometry reading"};

◆ m_pixelVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_pixelVersionOverride {this,"PixelVersionOverride","","Overrider for Pixel version"}
private

Definition at line 58 of file GeoModelSvc.h.

58{this,"PixelVersionOverride","","Overrider for Pixel version"};

◆ m_pSvcLocator

ISvcLocator* GeoModelSvc::m_pSvcLocator {nullptr}
private

Definition at line 49 of file GeoModelSvc.h.

49{nullptr};

◆ m_sctVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_sctVersionOverride {this,"SCT_VersionOverride","","Overrider for SCT version"}
private

Definition at line 59 of file GeoModelSvc.h.

59{this,"SCT_VersionOverride","","Overrider for SCT version"};

◆ m_sqliteDb

Gaudi::Property<bool> GeoModelSvc::m_sqliteDb {this,"SQLiteDB",false,"Activate GeoModel initialization from SQLite"}
private

Definition at line 80 of file GeoModelSvc.h.

80{this,"SQLiteDB",false,"Activate GeoModel initialization from SQLite"};

◆ m_sqliteDbFullPath

Gaudi::Property<std::string> GeoModelSvc::m_sqliteDbFullPath {this,"SQLiteDBFullPath","","Explicit setting of full path to SQLiteDB. For testing purposes only"}
private

Definition at line 81 of file GeoModelSvc.h.

81{this,"SQLiteDBFullPath","","Explicit setting of full path to SQLiteDB. For testing purposes only"};

◆ m_sqliteDbManager

std::shared_ptr<GMDBManager> GeoModelSvc::m_sqliteDbManager {}
private

Definition at line 85 of file GeoModelSvc.h.

85{};

◆ m_sqliteReader

std::unique_ptr<GeoModelIO::ReadGeoModel> GeoModelSvc::m_sqliteReader {}
private

Definition at line 84 of file GeoModelSvc.h.

84{};

◆ m_statisticsToFile

Gaudi::Property<bool> GeoModelSvc::m_statisticsToFile {this,"StatisticsToFile",false,"Generate GeoModelStatistics file in the run directory"}
private

Definition at line 73 of file GeoModelSvc.h.

73{this,"StatisticsToFile",false,"Generate GeoModelStatistics file in the run directory"};

◆ m_supportedGeometry

Gaudi::Property<int> GeoModelSvc::m_supportedGeometry {this,"SupportedGeometry",0,"Supported geometry flag is set in jobOpt and is equal to major release version"}
private

Definition at line 75 of file GeoModelSvc.h.

75{this,"SupportedGeometry",0,"Supported geometry flag is set in jobOpt and is equal to major release version"};

◆ m_tagInfoMgr

ServiceHandle<ITagInfoMgr> GeoModelSvc::m_tagInfoMgr {this,"TagInfoMgr","TagInfoMgr",""}
private

Definition at line 52 of file GeoModelSvc.h.

52{this,"TagInfoMgr","TagInfoMgr",""};

◆ m_tileVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_tileVersionOverride {this,"TileVersionOverride","","Overrider for Tile version"}
private

Definition at line 62 of file GeoModelSvc.h.

62{this,"TileVersionOverride","","Overrider for Tile version"};

◆ m_trtVersionOverride

Gaudi::Property<std::string> GeoModelSvc::m_trtVersionOverride {this,"TRT_VersionOverride","","Overrider for TRT version"}
private

Definition at line 60 of file GeoModelSvc.h.

60{this,"TRT_VersionOverride","","Overrider for TRT version"};

◆ m_useTagInfo

Gaudi::Property<bool> GeoModelSvc::m_useTagInfo {this,"UseTagInfo",true,"Use TagInfo"}
private

Definition at line 69 of file GeoModelSvc.h.

69{this,"UseTagInfo",true,"Use TagInfo"};

The documentation for this class was generated from the following files: