From 68ba21b960277bd4b2cd715e767f98bff27b0499 Mon Sep 17 00:00:00 2001 From: Nicolas Koehler <nicolas.koehler@cern.ch> Date: Mon, 20 Apr 2020 16:38:07 +0000 Subject: [PATCH] Add MuonAGDD2GeoSwitches option to dump-geo and VP1 --- .../AGDDControl/AGDDControl/XercesParser.h | 46 +++---- .../AGDD/AGDDControl/src/AGDDController.cxx | 13 +- .../AGDD/AGDDControl/src/XercesParser.cxx | 130 ++++++------------ .../GeoModelStandalone/DumpGeo/share/dump-geo | 16 +-- .../DumpGeo/share/dump-geo.py | 24 ++++ graphics/VP1/VP1Algs/share/vp1 | 20 ++- graphics/VP1/VP1Algs/share/vp1.py | 51 +++++-- 7 files changed, 159 insertions(+), 141 deletions(-) diff --git a/DetectorDescription/AGDD/AGDDControl/AGDDControl/XercesParser.h b/DetectorDescription/AGDD/AGDDControl/AGDDControl/XercesParser.h index 1b84a656d72..1e4a34febcf 100644 --- a/DetectorDescription/AGDD/AGDDControl/AGDDControl/XercesParser.h +++ b/DetectorDescription/AGDD/AGDDControl/AGDDControl/XercesParser.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef XercesParser_H @@ -12,33 +12,29 @@ #include <xercesc/dom/DOM.hpp> #include <xercesc/parsers/XercesDOMParser.hpp> -//using namespace xercesc; - class XercesParser: public IAGDDParser { public: - XercesParser(); - XercesParser(std::string); - ~XercesParser(); - bool ParseFile(std::string); - bool ParseFileAndNavigate(std::string); - bool ParseString(std::string); - bool ParseStringAndNavigate(std::string); - bool WriteToFile(std::string); - void navigateTree(); - static void elementLoop(); - static void elementLoop(xercesc::DOMNode*); - static ExpressionEvaluator& Evaluator(); - static xercesc::DOMNode* GetCurrentElement() {return s_currentElement;} - bool Initialize(); - bool Finalize(); -private: - xercesc::DOMDocument *m_doc; - - xercesc::XercesDOMParser *m_parser; - - bool m_initialized; + XercesParser(); + XercesParser(std::string); + ~XercesParser(); + bool ParseFile(std::string); + bool ParseFileAndNavigate(std::string); + bool ParseString(std::string); + bool ParseStringAndNavigate(std::string); + bool WriteToFile(std::string); + void navigateTree(); + static void elementLoop(); + static void elementLoop(xercesc::DOMNode*); + static ExpressionEvaluator& Evaluator(); + static xercesc::DOMNode* GetCurrentElement() {return s_currentElement;} + bool Initialize(); + bool Finalize(); protected: - static xercesc::DOMNode *s_currentElement; + static xercesc::DOMNode *s_currentElement; +private: + xercesc::DOMDocument *m_doc; + xercesc::XercesDOMParser *m_parser; + bool m_initialized; }; #endif diff --git a/DetectorDescription/AGDD/AGDDControl/src/AGDDController.cxx b/DetectorDescription/AGDD/AGDDControl/src/AGDDController.cxx index c771dce1c05..236a138742e 100644 --- a/DetectorDescription/AGDD/AGDDControl/src/AGDDController.cxx +++ b/DetectorDescription/AGDD/AGDDControl/src/AGDDController.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "AGDDControl/AGDDController.h" @@ -26,6 +26,7 @@ #include <string> #include <fstream> #include <ctime> +#include <TString.h> // for Form std::vector<const GeoLogVol*> volumeMap; @@ -40,10 +41,6 @@ void navigateVolumeContents(const GeoVPhysVol *pv, unsigned int ilev) { volumeMap.push_back(cvl); } -// for (unsigned int i=0;i<ilev;i++) -// std::cout<<"\t"; -// std::cout<<"----- volume "<<vname<<std::endl; - unsigned int ivol=pv->getNChildVols(); for (unsigned int i=0;i<ivol;i++) { @@ -99,8 +96,9 @@ void AGDDController::AddVolume(std::string section) void AGDDController::ParseFiles() { if (!m_theParser) m_theParser=new XercesParser; - for (unsigned int i=0;i<m_filesToParse.size();i++) - m_theParser->ParseFileAndNavigate(m_filesToParse[i]); + for (unsigned int i=0;i<m_filesToParse.size();i++) { + if (!m_theParser->ParseFileAndNavigate(m_filesToParse[i])) throw std::runtime_error(Form("File: %s, Line: %d\nAGDDController::ParseFiles() - Could parse file %s.", __FILE__, __LINE__, m_filesToParse[i].c_str())); + } } void AGDDController::BuildSections() @@ -151,7 +149,6 @@ bool AGDDController::WriteAGDDtoDBFile(std::string s) AGDDController* AGDDController::GetController() { -// std::cout<<" this is AGDDController::GetController()"<<std::endl; static AGDDController* theController=new AGDDController; return theController; } diff --git a/DetectorDescription/AGDD/AGDDControl/src/XercesParser.cxx b/DetectorDescription/AGDD/AGDDControl/src/XercesParser.cxx index c91f9764907..20cd7d47a46 100644 --- a/DetectorDescription/AGDD/AGDDControl/src/XercesParser.cxx +++ b/DetectorDescription/AGDD/AGDDControl/src/XercesParser.cxx @@ -1,27 +1,26 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include <iostream> - #include "AGDDControl/XercesParser.h" #include "AGDDControl/XMLHandler.h" #include "AGDDControl/XMLHandlerStore.h" #include "PathResolver/PathResolver.h" +#include "AthenaKernel/getMessageSvc.h" +#include "GaudiKernel/MsgStream.h" #include "xercesc/util/PlatformUtils.hpp" #include "xercesc/util/XMLException.hpp" - #include <xercesc/dom/DOM.hpp> - #include <xercesc/framework/StdOutFormatTarget.hpp> #include <xercesc/framework/LocalFileFormatTarget.hpp> #include <xercesc/framework/MemBufInputSource.hpp> #include <xercesc/parsers/XercesDOMParser.hpp> #include <xercesc/util/XMLUni.hpp> - #include <xercesc/util/OutOfMemoryException.hpp> +#include <iostream> + using namespace xercesc; DOMNode* XercesParser::s_currentElement=0; @@ -33,31 +32,24 @@ XercesParser::~XercesParser() Finalize(); } -XercesParser::XercesParser():IAGDDParser(),m_doc(0),m_parser(0),m_initialized(false) -{ -// std::cout<<"+++++++++++> Xerces Parser being created!" <<std::endl; -// AGDDController::GetController()->SetParser(this); -// std::cout<<"exiting constructor"<<std::endl; -} -XercesParser::XercesParser(std::string s):IAGDDParser(s),m_doc(0),m_parser(0),m_initialized(false) -{ -// std::cout<<"+++++++++++> Xerces Parser being created!" <<std::endl; -// AGDDController::GetController()->SetParser(this); -// std::cout<<"exiting constructor"<<std::endl; -} +XercesParser::XercesParser():IAGDDParser(),m_doc(0),m_parser(0),m_initialized(false) {} + +XercesParser::XercesParser(std::string s):IAGDDParser(s),m_doc(0),m_parser(0),m_initialized(false) {} + bool XercesParser::ParseFile(std::string s) { -// std::cout<<"+++++++++++> Xerces Parser parsing file "<<s <<std::endl; - m_fileName=s; + bool errorsOccured = false; + m_fileName=s; s=PathResolver::find_file(s,"XMLPATH",PathResolver::RecursiveSearch); - if (s.empty()) - std::cout<<" something wrong, could not find XML file "<<s<<std::endl; + if (s.empty()) { + MsgStream log(Athena::getMessageSvc(), "XercesParser"); + log<<MSG::WARNING<<"ParseFile() - something wrong, could not find XML file "<<s<<endmsg; + errorsOccured = true; + } else { -// std::cout<<" loading file "<<s<<std::endl; if (!m_initialized) Initialize(); m_parser = new XercesDOMParser; - bool errorsOccured = false; try { m_parser->parse(s.c_str()); @@ -75,7 +67,7 @@ bool XercesParser::ParseFile(std::string s) } catch (const DOMException& e) { - const unsigned int maxChars = 2047; + const unsigned int maxChars = 2047; XMLCh errText[maxChars + 1]; XERCES_STD_QUALIFIER cerr << "\nDOM Error during parsing: '" << s << "'\n" @@ -86,7 +78,6 @@ bool XercesParser::ParseFile(std::string s) errorsOccured = true; } - catch (...) { XERCES_STD_QUALIFIER cerr << "An error occurred during parsing\n " << XERCES_STD_QUALIFIER endl; @@ -95,21 +86,17 @@ bool XercesParser::ParseFile(std::string s) m_doc=m_parser->getDocument(); return errorsOccured; } - - return false; - + return errorsOccured; } bool XercesParser::ParseFileAndNavigate(std::string s) { -// std::cout<<"+++++++++++> Xerces Parser parsing and navigating file "<<s <<std::endl; bool errorOccured = ParseFile(s); - if (!errorOccured) navigateTree(); + if (errorOccured) return false; + navigateTree(); return true; } bool XercesParser::ParseString(std::string s) { -// std::cout<<"+++++++++++> Xerces Parser parsing string "<<std::endl; -// std::cout<<s<<std::endl; const char* str=s.c_str(); static const char* memBufID="prodInfo"; MemBufInputSource* memBuf = new MemBufInputSource((const XMLByte*)str,strlen(str),memBufID,false); @@ -144,7 +131,6 @@ bool XercesParser::ParseString(std::string s) errorsOccured = true; } - catch (...) { XERCES_STD_QUALIFIER cerr << "An error occurred during parsing\n " << XERCES_STD_QUALIFIER endl; @@ -155,8 +141,6 @@ bool XercesParser::ParseString(std::string s) } bool XercesParser::ParseStringAndNavigate(std::string s) { -// std::cout<<"+++++++++++> Xerces Parser parsing and navigating string "<<s <<std::endl; - bool errorOccured = ParseString(s); if (!errorOccured) navigateTree(); return true; @@ -188,28 +172,25 @@ bool XercesParser::WriteToFile(std::string s) void XercesParser::navigateTree() { - if (!m_doc) - { - std::cout<<" something is wrong! no document set!"<<std::endl; - std::cout<<" doing nothing!"<<std::endl; - return; - } - DOMNode* node = 0; - node = dynamic_cast<DOMNode*>(m_doc->getDocumentElement()); - if( !node ) throw; - s_currentElement=node; - elementLoop(node); + if (!m_doc) { + MsgStream log(Athena::getMessageSvc(), "XercesParser"); + log<<MSG::WARNING<<"navigateTree() - something is wrong! no document set! doing nothing!"<<endmsg; + return; + } + DOMNode* node = 0; + node = dynamic_cast<DOMNode*>(m_doc->getDocumentElement()); + if( !node ) throw; + s_currentElement=node; + elementLoop(node); } -void XercesParser::elementLoop() -{ -} +void XercesParser::elementLoop() {} void XercesParser::elementLoop(DOMNode *e) { - if (!e) - { - std::cout<<"Calling elementLoop() with NULL pointer!!!"<<std::endl; + if (!e) { + MsgStream log(Athena::getMessageSvc(), "XercesParser"); + log<<MSG::WARNING<<"Calling elementLoop() with NULL pointer!!!"<<endmsg; return; } if (!(e->getNodeType()==DOMNode::ELEMENT_NODE)) return; @@ -227,33 +208,14 @@ void XercesParser::elementLoop(DOMNode *e) { char* name=XMLString::transcode(e->getNodeName()); sName=name; -// std::cout <<" found element "<<name<<std::endl; XMLString::release(&name); for (child=e->getFirstChild();child!=0;child=child->getNextSibling()) { if (child->getNodeType()==DOMNode::ELEMENT_NODE) { -// std::cout<<sName<<" child name "<<XMLString::transcode(child->getNodeName())<<std::endl; elementLoop(child); } } } -// XMLHandler *h=XMLHandlerStore::GetHandlerStore()->GetHandler(element); -// bool stopLoop=false; -// if (h) -// { -// h->Handle(element); -// stopLoop=h->IsLoopToBeStopped(); -// } -// TiXmlElement* subelement; -// subelement=element->FirstChildElement(); -// -// if (!stopLoop && subelement) -// do -// { -// // std::cout<<" \telement "<<subelement->Value()<<std::endl; -// elementLoop(subelement); -// subelement = subelement->NextSiblingElement(); -// } while (subelement); } ExpressionEvaluator& XercesParser::Evaluator() @@ -264,20 +226,18 @@ ExpressionEvaluator& XercesParser::Evaluator() bool XercesParser::Initialize() { - try - { - XMLPlatformUtils::Initialize(); - } + try { + XMLPlatformUtils::Initialize(); + } - catch(const XMLException &toCatch) - { - XERCES_STD_QUALIFIER cerr << "Error during Xerces-c Initialization.\n" - << " Exception message:" - << XERCES_STD_QUALIFIER endl; - return 1; - } - m_initialized=true; - return 0; + catch(const XMLException &toCatch) { + XERCES_STD_QUALIFIER cerr << "Error during Xerces-c Initialization.\n" + << " Exception message:" + << XERCES_STD_QUALIFIER endl; + return 1; + } + m_initialized=true; + return 0; } bool XercesParser::Finalize() diff --git a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo index 83619679390..0c5dd4c8525 100755 --- a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo +++ b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo @@ -182,25 +182,25 @@ while [ $i -le $# ]; do elif [ "x${arg}" == "x-customgeom" ]; then FLAG_CUSTOMGEOMETRY=1 ## Muon Layout - elif [ "x${arg:0:12}" == "x-muonLayout" ]; then - ERRORS="$ERRORS\nNeed argument to -muonLayout. Example: -muonLayout=MuonSpectrometer-R.09.00.AsymNSW" + elif [ "x${arg:0:11}" == "x-muonLayout" ]; then + ERRORS="$ERRORS\nNeed argument to -muonLayout. Example: -muonLayout=MuonSpectrometer-R.09.02.NSW" elif [ "x${arg:0:12}" == "x-muonLayout=" ]; then MUONLAYOUT=${arg:12:$((${#arg}-12))} if [ "x$MUONLAYOUT" == "x" ]; then - ERRORS="$ERRORS\nNeed argument to -muonLayout. Example: -muonLayout=MuonSpectrometer-R.09.00.AsymNSW" + ERRORS="$ERRORS\nNeed argument to -muonLayout. Example: -muonLayout=MuonSpectrometer-R.09.02.NSW" fi # Muon NSW AGDD custom file - elif [ "x${arg:0:9}" == "x-nswagdd" ]; then - ERRORS="$ERRORS\nNeed argument to -nswagdd. Example: -nswagdd=stations.v2.06.xml" + elif [ "x${arg:0:8}" == "x-nswagdd" ]; then + ERRORS="$ERRORS\nNeed argument to -nswagdd. Example: -nswagdd=stations.v2.07.xml" elif [ "x${arg:0:9}" == "x-nswagdd=" ]; then NSWAGDDFILE=${arg:9:$((${#arg}-9))} if [ "x$NSWAGDDFILE" == "x" ]; then - ERRORS="$ERRORS\nNeed argument to -nswagdd. Example: -nswagdd=stations.v2.06.xml" + ERRORS="$ERRORS\nNeed argument to -nswagdd. Example: -nswagdd=stations.v2.07.xml" fi ### # Muon NSW AGDD custom file - elif [ "x${arg:0:10}" == "x-muonagdd" ]; then - ERRORS="$ERRORS\nNeed argument to -muonagdd. Example: -muonagdd=muon_passive_r.08.01.xml" + elif [ "x${arg:0:9}" == "x-muonagdd" ]; then + ERRORS="$ERRORS\nNeed argument to -muonagdd. Example: -muonagdd=muon_passive_r.08.01.xml" elif [ "x${arg:0:10}" == "x-muonagdd=" ]; then MUONAGDDFILE=${arg:10:$((${#arg}-10))} if [ "x$MUONAGDDFILE" == "x" ]; then diff --git a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py index 91197abcbd9..29c474c9096 100644 --- a/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py +++ b/DetectorDescription/GeoModel/GeoModelStandalone/DumpGeo/share/dump-geo.py @@ -39,6 +39,7 @@ if not 'vp1Trig' in dir(): vp1Trig=False if not 'vp1CustomGeometry' in dir(): vp1CustomGeometry=False if not 'vp1SLHC' in dir(): vp1SLHC=False if not 'vp1MuonAGDDFiles' in dir(): vp1MuonAGDDFiles=[] +if not 'vp1MuonAGDD2GeoSwitches' in dir(): vp1MuonAGDD2GeoSwitches=[] if not 'vp1NSWAGDDFiles' in dir(): vp1NSWAGDDFiles=[] if not 'vp1MuonLayout' in dir(): vp1MuonLayout="" @@ -251,6 +252,29 @@ if (vp1Muon): if b.name()=="MuonSpectrometer": b.ReadAGDD=False b.XMLFiles=vp1MuonAGDDFiles + if len(vp1MuonAGDD2GeoSwitches)>0: + print ("*** DumpGeo NOTE *** You specified custom vp1MuonAGDD2GeoSwitches, configuring MuonAGDDTool to build volumes: '%s'"%(', '.join(vp1MuonAGDD2GeoSwitches))) + b.Volumes=vp1MuonAGDD2GeoSwitches + else: + # the default AGDD2GeoSwitches for Run2 + b.Volumes=["ECT_Toroids", + "BAR_Toroid", + "Feet", + "RailAssembly", + "JFSH_Shield", + "JDSH_Shield", + "JTSH_Shield", + "pp2", + "MBAP_AccessPlatform", + "MBWH_BigWheels", + "SADL_CalorimeterSaddle", + "TBWH_BigWheels", + "TGC3_BigWheels", + "TGC1_BigWheels", + "MDTRail", + "servicesAtZ0", + "HFTruckRail", + "RUN2_Services"] if len(vp1NSWAGDDFiles)>0: print ("*** DumpGeo NOTE *** You specified custom vp1NSWAGDDFiles, configuring NSWAGDDTool to read NSWAGDD information from custom file(s) '%s' instead from built-in geometry"%(', '.join(vp1NSWAGDDFiles))) if hasattr(svcMgr,"AGDDtoGeoSvc"): diff --git a/graphics/VP1/VP1Algs/share/vp1 b/graphics/VP1/VP1Algs/share/vp1 index b7605277790..a662e1ef094 100755 --- a/graphics/VP1/VP1Algs/share/vp1 +++ b/graphics/VP1/VP1Algs/share/vp1 @@ -131,6 +131,7 @@ ERRORS="" DETDESCRTAG="" MUONLAYOUT="" NSWAGDDFILE="" +MUONAGDDFILE="" GLOBCONDTAG="" SKIPEVENTS="" CRUISEWITHTIME="" @@ -329,21 +330,30 @@ while [ $i -le $# ]; do if [ "x$DETDESCRTAG_2" == "x" ]; then ERRORS="$ERRORS\nNeed argument to -detdescr. Example: -detdescr=ATLAS-GEO-20-00-01" fi + elif [ "x${arg:0:11}" == "x-muonLayout" ]; then + ERRORS="$ERRORS\nNeed argument to -muonLayout. Example: -muonLayout=MuonSpectrometer-R.09.02.NSW" elif [ "x${arg:0:12}" == "x-muonLayout=" ]; then MUONLAYOUT=${arg:12:$((${#arg}-12))} if [ "x$MUONLAYOUT" == "x" ]; then - ERRORS="$ERRORS\nNeed argument to -muonLayout. Example: -muonLayout=MuonSpectrometer-R.09.00.AsymNSW" + ERRORS="$ERRORS\nNeed argument to -muonLayout. Example: -muonLayout=MuonSpectrometer-R.09.02.NSW" fi elif [ "x${arg:0:9}" == "x-nswagdd=" ]; then NSWAGDDFILE=${arg:9:$((${#arg}-9))} if [ "x$NSWAGDDFILE" == "x" ]; then - ERRORS="$ERRORS\nNeed argument to -nswagdd. Example: -nswagdd=stations.v2.06.xml" + ERRORS="$ERRORS\nNeed argument to -nswagdd. Example: -nswagdd=stations.v2.07.xml" fi elif [ "x${arg:0:8}" == "x-nswagdd" ]; then NSWAGDDFILE=${arg:8:$((${#arg}-8))} if [ "x$NSWAGDDFILE" == "x" ]; then - ERRORS="$ERRORS\nNeed argument to -nswagdd. Example: -nswagdd=stations.v2.06.xml" + ERRORS="$ERRORS\nNeed argument to -nswagdd. Example: -nswagdd=stations.v2.07.xml" fi + elif [ "x${arg:0:9}" == "x-muonagdd" ]; then + ERRORS="$ERRORS\nNeed argument to -muonagdd. Example: -muonagdd=muon_passive_r.08.01.xml" + elif [ "x${arg:0:10}" == "x-muonagdd=" ]; then + MUONAGDDFILE=${arg:10:$((${#arg}-10))} + if [ "x$MUONAGDDFILE" == "x" ]; then + ERRORS="$ERRORS\nNeed argument to -muonagdd. Example: -muonagdd=muon_passive_r.08.01.xml" + fi elif [ "x${arg:0:10}" == "x-globcond=" ]; then GLOBCONDTAG=${arg:10:$((${#arg}-10))} if [ "x$GLOBCONDTAG" == "x" ]; then @@ -931,6 +941,10 @@ if [ "x$NSWAGDDFILE" != "x" ]; then if [ "x$OPTS" != "x" ]; then OPTS="$OPTS;"; fi OPTS="${OPTS}vp1NSWAGDDFiles=[\"${NSWAGDDFILE}\"]" fi +if [ "x$MUONAGDDFILE" != "x" ]; then + if [ "x$OPTS" != "x" ]; then OPTS="$OPTS;"; fi + OPTS="${OPTS}vp1MuonAGDDFiles=[\"${MUONAGDDFILE}\"]" +fi if [ "x$GLOBCONDTAG" != "x" ]; then if [ "x$OPTS" != "x" ]; then OPTS="$OPTS;"; fi OPTS="${OPTS}vp1GlobCond=\"$GLOBCONDTAG\"" diff --git a/graphics/VP1/VP1Algs/share/vp1.py b/graphics/VP1/VP1Algs/share/vp1.py index d62c3322107..4cef9284cfc 100644 --- a/graphics/VP1/VP1Algs/share/vp1.py +++ b/graphics/VP1/VP1Algs/share/vp1.py @@ -35,6 +35,8 @@ if not 'vp1SpacePoints' in dir(): vp1SpacePoints=False if not 'vp1Cavern' in dir(): vp1Cavern=False if not 'vp1NoAutoConf' in dir(): vp1NoAutoConf=False if not 'vp1Trig' in dir(): vp1Trig=False +if not 'vp1MuonAGDDFiles' in dir(): vp1MuonAGDDFiles=[] +if not 'vp1MuonAGDD2GeoSwitches' in dir(): vp1MuonAGDD2GeoSwitches=[] if not 'vp1NSWAGDDFiles' in dir(): vp1NSWAGDDFiles=[] if not 'vp1MuonLayout' in dir(): vp1MuonLayout="" @@ -262,17 +264,6 @@ from AtlasGeoModel import SetGeometryVersion from AtlasGeoModel import GeoModelInit from AthenaCommon.AppMgr import ToolSvc -if vp1Muon and len(vp1NSWAGDDFiles)>0: - printfunc ("*** VP1 NOTE *** You specified custom vp1NSWAGDDFiles, creating NSWAGDDTool to read NSWAGDD information from custom file(s) '%s' instead from built-in geometry"%(', '.join(vp1NSWAGDDFiles))) - from AthenaCommon.AppMgr import theApp - from AGDD2GeoSvc.AGDD2GeoSvcConf import AGDDtoGeoSvc - AGDD2Geo = AGDDtoGeoSvc() - theApp.CreateSvc += ["AGDDtoGeoSvc"] - svcMgr += AGDD2Geo - from AthenaCommon import CfgMgr - from MuonAGDD.MuonAGDDConf import NSWAGDDTool - NSWAGDDTool = CfgMgr.NSWAGDDTool("NewSmallWheel", DefaultDetector="Muon", ReadAGDD=False, XMLFiles=vp1NSWAGDDFiles, Volumes=["NewSmallWheel"]) - AGDD2Geo.Builders += [ NSWAGDDTool ] if vp1Muon and vp1MuonLayout!="": printfunc ("*** VP1 NOTE *** You specified custom vp1MuonLayout, using %s as muon geometry"%vp1MuonLayout) from GeoModelSvc.GeoModelSvcConf import GeoModelSvc @@ -291,7 +282,43 @@ if vp1Cavern: # - Major geometry version is greater than 10 if (vp1Muon): from AtlasGeoModel import Agdd2Geo - + if len(vp1MuonAGDDFiles)>0: + printfunc ("*** VP1 NOTE *** You specified custom vp1MuonAGDDFiles, configuring MuonAGDDTool to read MuonAGDD information from custom file(s) '%s' instead from built-in geometry"%(', '.join(vp1MuonAGDDFiles))) + if hasattr(svcMgr,"AGDDtoGeoSvc"): + for b in getattr(svcMgr,"AGDDtoGeoSvc").Builders: + if b.name()=="MuonSpectrometer": + b.ReadAGDD=False + b.XMLFiles=vp1MuonAGDDFiles + if len(vp1MuonAGDD2GeoSwitches)>0: + printfunc ("*** VP1 NOTE *** You specified custom vp1MuonAGDD2GeoSwitches, configuring MuonAGDDTool to build volumes: '%s'"%(', '.join(vp1MuonAGDD2GeoSwitches))) + b.Volumes=vp1MuonAGDD2GeoSwitches + else: + # the default AGDD2GeoSwitches for Run2 + b.Volumes=["ECT_Toroids", + "BAR_Toroid", + "Feet", + "RailAssembly", + "JFSH_Shield", + "JDSH_Shield", + "JTSH_Shield", + "pp2", + "MBAP_AccessPlatform", + "MBWH_BigWheels", + "SADL_CalorimeterSaddle", + "TBWH_BigWheels", + "TGC3_BigWheels", + "TGC1_BigWheels", + "MDTRail", + "servicesAtZ0", + "HFTruckRail", + "RUN2_Services"] + if len(vp1NSWAGDDFiles)>0: + printfunc ("*** VP1 NOTE *** You specified custom vp1NSWAGDDFiles, configuring NSWAGDDTool to read NSWAGDD information from custom file(s) '%s' instead from built-in geometry"%(', '.join(vp1NSWAGDDFiles))) + if hasattr(svcMgr,"AGDDtoGeoSvc"): + for b in getattr(svcMgr,"AGDDtoGeoSvc").Builders: + if b.name()=="NewSmallWheel": + b.ReadAGDD=False + b.XMLFiles=vp1NSWAGDDFiles #MagneticField: import MagFieldServices.SetupField -- GitLab