11 #include "GeoModelKernel/GeoPerfUtils.h"
12 #include "GeoModelKernel/GeoPhysVol.h"
33 declareInterface<IGeoModelTool>(
this);
38 return StatusCode::SUCCESS;
52 std::ofstream geoModelStats;
54 float cpu{0.f}, ucpu{0.f};
59 GeoIntrusivePtr<GeoPhysVol> world{theExpt->
getPhysVol()};
70 umem = GeoPerfUtils::getMem();
72 geoModelStats <<
"At MuonDetectorTool::everything done \t SZ= " << umem <<
" Kb \t Time = " << ucpu <<
" seconds ---- \t DeltaM = " << umem - mem
73 <<
" \t Delta T =" << ucpu - cpu << std::endl;
74 geoModelStats.close();
81 std::vector<int> *sectorHashVec =
new std::vector<int>(tgcHashMax, 0);
82 for (
unsigned int i = 0;
i < tgcHashMax; ++
i) {
87 if (
detStore()->record(sectorHashVec,
"TGC_SectorMapping").isFailure()) {
91 return StatusCode::SUCCESS;
96 std::ofstream geoModelStats;
98 float cpu{0.f}, ucpu{0.f};
102 geoModelStats.open(
"MuonGeoModelStatistics_MuonDetectorTool");
103 mem = GeoPerfUtils::getMem();
105 geoModelStats <<
"At MuonDetectorTool::create entry point: \t SZ= " << mem <<
" Kb \t Time = " << cpu <<
" seconds " << std::endl;
107 umem = GeoPerfUtils::getMem();
109 geoModelStats <<
"At MuonDetectorTool::resetting to 0: \t SZ= " << umem - mem <<
" Kb \t Time = " << ucpu - cpu <<
" seconds " << std::endl;
114 ATH_MSG_VERBOSE(
" Show properties (user sett.s or default): LayoutName "
117 <<
" Show properties (user sett.s or default): IncludeCtbBis " <<
m_includeCtbBis);
120 SmartIF<IGeoModelSvc> geoModel{Gaudi::svcLocator()->service(
"GeoModelSvc")};
124 std::string MuonVersion = geoModel->muonVersionOverride();
132 std::string detectorKey = MuonVersion.empty() ?
AtlasVersion : MuonVersion;
133 std::string detectorNode = MuonVersion.empty() ?
"ATLAS" :
"MuonSpectrometer";
134 ATH_MSG_INFO(
"Keys for Muon Switches are (key) " << detectorKey <<
" (node) " << detectorNode);
137 std::map<std::string, std::string> altAsciiDBMap{};
145 GeoModelIO::ReadGeoModel* sqliteReader = geoDbTag->getSqliteReader();
149 ATH_MSG_INFO(
"New DD Activated; Muon detector description input from SQLITE fie");
153 theFactory.create(world);
156 mgr=theFactory.getDetectorManager();
158 mgr->setGeometryVersion(tempLayout);
161 return StatusCode::SUCCESS;
175 if (MuonVersion ==
"CUSTOM")
176 ATH_MSG_WARNING(
"Detector Information coming from a custom configuration !!");
179 ATH_MSG_DEBUG(
"Detector Information coming from the database (job options IGNORED)");
181 IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr(
"MuonSwitches", detectorKey, detectorNode);
182 if ((*switchSet).size() == 0)
183 return StatusCode::FAILURE;
187 tempLayout = switches->
getString(
"LAYOUTNAME");
190 if (MuonVersion.empty()) {
191 MuonVersion = accessSvc->getChildTag(
"MuonSpectrometer", detectorKey, detectorNode);
192 ATH_MSG_INFO(
"(from GeoModelSvc) in AtlasVersion = <" <<
AtlasVersion <<
"> default MuonVersion is <" << MuonVersion <<
">");
209 <<
" LayoutName " << tempLayout.substr(0, 1) <<
endmsg
222 return (StatusCode::FAILURE);
239 umem = GeoPerfUtils::getMem();
241 geoModelStats <<
"At MuonDetectorTool::material mgr done \t SZ= " << umem <<
" Kb \t Time = " << ucpu <<
" seconds ---- \t DeltaM = " << umem - mem
242 <<
" \t Delta T =" << ucpu - cpu << std::endl;
250 theFactory.setDBMuonVersion(MuonVersion);
251 theFactory.setDBkey(detectorKey);
252 theFactory.setDBnode(detectorNode);
253 theFactory.setLayout(tempLayout);
266 theFactory.setRDBAccess(accessSvc.get());
268 theFactory.setAltAsciiDBMap(altAsciiDBMap);
274 theFactory.create(world);
275 }
catch (
const std::bad_alloc &) {
277 return StatusCode::FAILURE;
281 umem = GeoPerfUtils::getMem();
283 geoModelStats <<
"At MuonDetectorTool::factory created \t SZ= " << umem <<
" Kb \t Time = " << ucpu <<
" seconds ---- \t DeltaM = " << umem - mem
284 <<
" \t Delta T =" << ucpu - cpu << std::endl;
290 umem = GeoPerfUtils::getMem();
292 geoModelStats <<
"At MuonDetectorTool::trk cache done \t SZ= " << umem <<
" Kb \t Time = " << ucpu <<
" seconds ---- \t DeltaM = " << umem - mem
293 <<
" \t Delta T =" << ucpu - cpu << std::endl;
298 mgr=theFactory.getDetectorManager();
300 return StatusCode::SUCCESS;
309 return StatusCode::SUCCESS;