10 #include "GaudiKernel/ConcurrencyFlags.h" 
   11 #include "GaudiKernel/IConversionSvc.h" 
   12 #include "GaudiKernel/ISvcLocator.h" 
   13 #include "GaudiKernel/SystemOfUnits.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" 
   38   if (!m_sqliteDbFullPath.empty())
 
   41   if (!m_sqliteDb && m_supportedGeometry == 0) {
 
   43         "The Supported Geometry flag was not set in Job Options! Exiting ...");
 
   44     return StatusCode::FAILURE;
 
   59   Service *convSvc = 
dynamic_cast<Service *
>(conversionSvc.get());
 
   62     return StatusCode::FAILURE;
 
   64   if (convSvc->FSMState() < Gaudi::StateMachine::INITIALIZED) {
 
   72                                            itPrivEnd = m_detectorTools.end();
 
   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());
 
  101     for (; itPriv != itPrivEnd; ++itPriv) {
 
  104       if (StatusCode::SUCCESS != theTool->registerCallback()) {
 
  106             "IGeoModelTool::align() was not registerred on CondDB object for " 
  115       m_tagInfoMgr->addListener(
this);
 
  121   return StatusCode::SUCCESS;
 
  126   return StatusCode::SUCCESS;
 
  130   PVLink worldPhys{
nullptr};
 
  137   if (dbTagSvc == 
nullptr) {
 
  138     ATH_MSG_FATAL(
"Unable to dyn-cast the IGeoDbTagSvc pointer to GeoDbTagSvc");
 
  139     return StatusCode::FAILURE;
 
  145     std::string sqliteDbPath =
 
  152                     << 
" for reading in persistent GeoModel tree");
 
  153       return StatusCode::FAILURE;
 
  155     ATH_MSG_INFO(
"Successfully located SQLite database file " 
  156                  << sqliteDbPath << 
" for reading in persistent GeoModel tree");
 
  162                     << 
" for reading in persistent GeoModel tree");
 
  163       return StatusCode::FAILURE;
 
  165     GeoThreading::ThreadPool::getPool(
m_nTheads);
 
  167         "Successfully opened SQLite DB file " 
  168         << sqliteDbPath << 
" for reading in persistent GeoModel tree using " 
  169         << GeoThreading::ThreadPool::getPool().
nThreads() << 
" threads.");
 
  173     worldPhys = const_pointer_cast(vWorldPhys);
 
  176           "Having Full Physical Volumes as World Volumes not supported!");
 
  177       return StatusCode::FAILURE;
 
  180         "Successfully read persistent GeoModel description from the file");
 
  186     if (!sqliteReadSvc->connect(sqliteDbPath)) {
 
  188                     << sqliteDbPath << 
" for reading geometry parameters");
 
  189       return StatusCode::FAILURE;
 
  192                    << sqliteDbPath << 
" for reading Det Descr parameters");
 
  198       return StatusCode::FAILURE;
 
  219     if (!rdbAccess->connect()) {
 
  221       return StatusCode::FAILURE;
 
  225     if (rdbAccess->getChildTag(
"ATLAS", 
m_atlasVersion, 
"ATLAS") == 
"") {
 
  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;
 
  240       const coral::AttributeSpecification &supportedSpec =
 
  241           atlasTagDetails[
"SUPPORTED"].specification();
 
  242       if (supportedSpec.type() == 
typeid(
bool)) {
 
  243         if (!atlasTagDetails[
"SUPPORTED"].data<bool>()) {
 
  245               " *** *** ATLAS layout " 
  247               << 
" is OBSOLETE and can NOT be supported any more! *** ***");
 
  248           return StatusCode::FAILURE;
 
  250       } 
else if (supportedSpec.type() == 
typeid(
int)) {
 
  255                         << 
" and can NOT be supported any more! *** ***");
 
  256           return StatusCode::FAILURE;
 
  276       return StatusCode::FAILURE;
 
  280       return StatusCode::FAILURE;
 
  284     std::unique_ptr<StoredMaterialManager> theMaterialManager{};
 
  286       theMaterialManager = std::make_unique<RDBMaterialManager>(
m_pSvcLocator);
 
  287     } 
catch (std::runtime_error &
e) {
 
  289       return StatusCode::FAILURE;
 
  293     worldPhys = createGeoWorld();
 
  298       std::make_unique<GeoModelExperiment>(std::move(worldPhys));
 
  304     geoModelStats << 
"Detector Configuration flag = " << 
m_atlasVersion 
  312   for (; itPriv != itPrivEnd; ++itPriv) {
 
  315     mem = GeoPerfUtils::getMem();
 
  321       geoModelStats << theTool->name()
 
  322                     << 
"\t SZ= " << GeoPerfUtils::getMem() - mem
 
  327                    << 
"\t SZ= " << GeoPerfUtils::getMem() - mem
 
  335     rdbAccess->shutdown();
 
  338   return StatusCode::SUCCESS;
 
  346   bool tagsMatch = 
true;
 
  352   for (
const auto &pair : 
pairs) {
 
  353     std::string tagPairName = pair.first;
 
  354     if (tagPairName == 
"GeoAtlas") {
 
  368       std::vector<std::string> tokensTagInfo, tokensJobOpt;
 
  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;
 
  378       tokensTagInfo.push_back(currStr.substr(startpos));
 
  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);
 
  387       if (tagInfoFollowsTheScheme) {
 
  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;
 
  397         tokensJobOpt.push_back(currStr.substr(startpos));
 
  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) {
 
  407           tagsMatch = (pair.second.substr(0, currStr.size() - 6) ==
 
  415     } 
else if (tagPairName == 
"GeoInDet")
 
  417     else if (tagPairName == 
"GeoPixel")
 
  419     else if (tagPairName == 
"GeoSCT")
 
  421     else if (tagPairName == 
"GeoTRT")
 
  423     else if (tagPairName == 
"GeoLAr")
 
  425     else if (tagPairName == 
"GeoTile")
 
  427     else if (tagPairName == 
"GeoMuon")
 
  436         << 
"*** *** Geometry configured through jobOptions does not match " 
  437            "TagInfo tags! *** ***" 
  453     for (
const auto &pair : 
pairs) {
 
  454       const std::string &tagPairName = pair.first;
 
  455       if (tagPairName == 
"GeoAtlas") {
 
  457       } 
else if (tagPairName == 
"GeoInDet") {
 
  459       } 
else if (tagPairName == 
"GeoPixel") {
 
  461       } 
else if (tagPairName == 
"GeoSCT") {
 
  463       } 
else if (tagPairName == 
"GeoTRT") {
 
  465       } 
else if (tagPairName == 
"GeoLAr") {
 
  467       } 
else if (tagPairName == 
"GeoTile") {
 
  469       } 
else if (tagPairName == 
"GeoMuon") {
 
  471       } 
else if (tagPairName == 
"GeoCalo") {
 
  473       } 
else if (tagPairName == 
"GeoMagField") {
 
  475       } 
else if (tagPairName == 
"GeoCavernInfra") {
 
  477       } 
else if (tagPairName == 
"GeoForwardDetectors") {
 
  483       ATH_MSG_INFO(
"*** *** Please fix geometry tag settings *** ***");
 
  484       return StatusCode::FAILURE;
 
  488         "Geometry configurations in jobOptions and TagInfo are consistent");
 
  490   return StatusCode::SUCCESS;
 
  499     return StatusCode::FAILURE;
 
  504                                             << 
" not added to TagInfo ");
 
  505     return StatusCode::FAILURE;
 
  511                                               << 
" not added to TagInfo ");
 
  512       return StatusCode::FAILURE;
 
  519                                               << 
" not added to TagInfo ");
 
  520       return StatusCode::FAILURE;
 
  527                                             << 
" not added to TagInfo ");
 
  528       return StatusCode::FAILURE;
 
  535                                             << 
" not added to TagInfo ");
 
  536       return StatusCode::FAILURE;
 
  543                                             << 
" not added to TagInfo ");
 
  544       return StatusCode::FAILURE;
 
  551                                              << 
" not added to TagInfo ");
 
  552       return StatusCode::FAILURE;
 
  559                                              << 
" not added to TagInfo ");
 
  560       return StatusCode::FAILURE;
 
  567                                              << 
" not added to TagInfo ");
 
  568       return StatusCode::FAILURE;
 
  576                                                  << 
" not added to TagInfo ");
 
  577       return StatusCode::FAILURE;
 
  586       return StatusCode::FAILURE;
 
  595       return StatusCode::FAILURE;
 
  599   return StatusCode::SUCCESS;
 
  604     if (
tool->name().find(toolName) != std::string::npos)
 
  616     if (
tool->clear().isFailure()) {
 
  618       return StatusCode::FAILURE;
 
  625   std::vector<std::string> sgkeysExp;
 
  627   for (
const std::string &
key : sgkeysExp) {
 
  637   std::vector<std::string> sgkeysMat;
 
  639   for (
const std::string &
key : sgkeysMat) {
 
  648   return StatusCode::SUCCESS;