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"
17 #include "GaudiKernel/ISvcLocator.h"
18 #include "GaudiKernel/IConversionSvc.h"
19 #include "GaudiKernel/SystemOfUnits.h"
28 #include "GeoModelHelpers/defineWorld.h"
42 if(!m_sqliteDbFullPath.empty()) m_sqliteDb=
true;
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;
61 Service* convSvc=
dynamic_cast<Service*
>(conversionSvc.get());
64 return StatusCode::FAILURE;
66 if (convSvc->FSMState() < Gaudi::StateMachine::INITIALIZED) {
74 itPrivEnd = m_detectorTools.end();
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());
103 for (; itPriv!=itPrivEnd; ++itPriv) {
106 if(StatusCode::SUCCESS != theTool->registerCallback()) {
107 ATH_MSG_DEBUG(
"IGeoModelTool::align() was not registerred on CondDB object for the tool " << theTool->name());
114 m_tagInfoMgr->addListener(
this );
120 return StatusCode::SUCCESS;
126 return StatusCode::SUCCESS;
131 PVLink worldPhys{
nullptr};
138 if(dbTagSvc==
nullptr) {
139 ATH_MSG_FATAL(
"Unable to dyn-cast the IGeoDbTagSvc pointer to GeoDbTagSvc");
140 return StatusCode::FAILURE;
150 ATH_MSG_FATAL(
"Failed to find SQLite database file " << sqliteDbName <<
" for reading in persistent GeoModel tree");
151 return StatusCode::FAILURE;
154 ATH_MSG_INFO(
"Successfully located SQLite database file " << sqliteDbPath <<
" for reading in persistent GeoModel tree");
159 ATH_MSG_INFO(
"Successfully opened SQLite DB file " << sqliteDbPath <<
" for reading in persistent GeoModel tree");
161 ATH_MSG_FATAL(
"Failed to open SQLite database " << sqliteDbPath <<
" for reading in persistent GeoModel tree");
162 return StatusCode::FAILURE;
166 worldPhys = const_pointer_cast(vWorldPhys);
168 ATH_MSG_FATAL(
"Having Full Physical Volumes as World Volumes not supported!");
169 return StatusCode::FAILURE;
171 ATH_MSG_INFO(
"Successfully read persistent GeoModel description from the file");
176 if(!sqliteReadSvc->connect(sqliteDbPath)) {
177 ATH_MSG_FATAL(
"Failed to open SQLite database file " << sqliteDbPath <<
" for reading geometry parameters");
178 return StatusCode::FAILURE;
180 ATH_MSG_INFO(
"Successfully opened SQLite DB file: " << sqliteDbPath <<
" for reading Det Descr parameters");
186 return StatusCode::FAILURE;
208 if(!rdbAccess->connect()) {
210 return StatusCode::FAILURE;
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;
226 const coral::AttributeSpecification& supportedSpec = atlasTagDetails[
"SUPPORTED"].specification();
227 if(supportedSpec.type()==
typeid(
bool)) {
228 if(!atlasTagDetails[
"SUPPORTED"].data<bool>()) {
230 return StatusCode::FAILURE;
233 else if(supportedSpec.type()==
typeid(
int)) {
237 <<
" and can NOT be supported any more! *** ***");
238 return StatusCode::FAILURE;
258 return StatusCode::FAILURE;
262 return StatusCode::FAILURE;
266 std::unique_ptr<StoredMaterialManager> theMaterialManager{};
268 theMaterialManager = std::make_unique<RDBMaterialManager>(
m_pSvcLocator);
270 catch(std::runtime_error&
e) {
272 return StatusCode::FAILURE;
276 worldPhys= createGeoWorld();
280 auto theExperiment = std::make_unique<GeoModelExperiment>(std::move(worldPhys));
286 geoModelStats <<
"Detector Configuration flag = " <<
m_atlasVersion << std::endl;
293 for(; itPriv!=itPrivEnd; ++itPriv) {
296 mem = GeoPerfUtils::getMem();
302 geoModelStats << theTool->name() <<
"\t SZ= "
303 << GeoPerfUtils::getMem() - mem <<
"Kb \t Time = " << (
GeoPerfUtils::getCpu() - cpu) * 0.01 <<
"S" << std::endl;
307 << GeoPerfUtils::getMem() - mem <<
"Kb \t Time = " << (
GeoPerfUtils::getCpu() - cpu) * 0.01 <<
"S");
313 rdbAccess->shutdown();
316 return StatusCode::SUCCESS;
328 bool tagsMatch =
true;
334 for(
const auto& pair :
pairs ) {
335 std::string tagPairName = pair.first;
336 if(tagPairName==
"GeoAtlas") {
346 std::vector<std::string> tokensTagInfo, tokensJobOpt;
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));
355 tokensTagInfo.push_back(currStr.substr(startpos));
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);
363 if(tagInfoFollowsTheScheme) {
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));
371 tokensJobOpt.push_back(currStr.substr(startpos));
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) {
390 else if(tagPairName==
"GeoInDet")
392 else if(tagPairName==
"GeoPixel")
394 else if(tagPairName==
"GeoSCT")
396 else if(tagPairName==
"GeoTRT")
398 else if(tagPairName==
"GeoLAr")
400 else if(tagPairName==
"GeoTile")
402 else if(tagPairName==
"GeoMuon")
405 if(!tagsMatch)
break;
410 <<
"*** *** Geometry configured through jobOptions does not match TagInfo tags! *** ***" <<
endmsg;
425 for (
const auto& pair :
pairs) {
426 std::string tagPairName = pair.first;
427 if(tagPairName==
"GeoAtlas")
429 else if(tagPairName==
"GeoInDet")
431 else if(tagPairName==
"GeoPixel")
433 else if(tagPairName==
"GeoSCT")
435 else if(tagPairName==
"GeoTRT")
437 else if(tagPairName==
"GeoLAr")
439 else if(tagPairName==
"GeoTile")
441 else if(tagPairName==
"GeoMuon")
443 else if(tagPairName==
"GeoCalo")
445 else if(tagPairName==
"GeoMagField")
447 else if(tagPairName==
"GeoCavernInfra")
449 else if(tagPairName==
"GeoForwardDetectors")
454 ATH_MSG_INFO(
"*** *** Please fix geometry tag settings *** ***");
455 return StatusCode::FAILURE;
459 ATH_MSG_DEBUG(
"Geometry configurations in jobOptions and TagInfo are consistent");
461 return StatusCode::SUCCESS;
471 return StatusCode::FAILURE;
476 return StatusCode::FAILURE;
482 return StatusCode::FAILURE;
489 return StatusCode::FAILURE;
496 return StatusCode::FAILURE;
503 return StatusCode::FAILURE;
510 return StatusCode::FAILURE;
517 return StatusCode::FAILURE;
524 return StatusCode::FAILURE;
531 return StatusCode::FAILURE;
538 return StatusCode::FAILURE;
545 return StatusCode::FAILURE;
552 return StatusCode::FAILURE;
556 return StatusCode::SUCCESS;
562 if(
tool->name().find(toolName)!=std::string::npos)
575 if(
tool->clear().isFailure()) {
577 return StatusCode::FAILURE;
584 std::vector<std::string> sgkeysExp;
586 for (
const std::string&
key : sgkeysExp) {
595 std::vector<std::string> sgkeysMat;
597 for (
const std::string&
key : sgkeysMat) {
605 return StatusCode::SUCCESS;