94 {
95
96 std::ofstream geoModelStats;
97 int mem{0}, umem{0};
98 float cpu{0.f}, ucpu{0.f};
99
100
102 geoModelStats.open("MuonGeoModelStatistics_MuonDetectorTool");
103 mem = GeoPerfUtils::getMem();
104 cpu =
float(GeoPerfUtils::getCpu() / 100.);
105 geoModelStats << "At MuonDetectorTool::create entry point: \t SZ= " << mem << " Kb \t Time = " << cpu << " seconds " << std::endl;
106
107 umem = GeoPerfUtils::getMem();
108 ucpu =
float(GeoPerfUtils::getCpu() / 100.);
109 geoModelStats << "At MuonDetectorTool::resetting to 0: \t SZ= " << umem - mem << " Kb \t Time = " << ucpu - cpu << " seconds " << std::endl;
110 mem = umem;
111 cpu = ucpu;
112 }
113
114 ATH_MSG_VERBOSE(
" Show properties (user sett.s or default): LayoutName "
117 <<
" Show properties (user sett.s or default): IncludeCtbBis " <<
m_includeCtbBis);
118
119
120 SmartIF<IGeoModelSvc> geoModel{Gaudi::svcLocator()->service("GeoModelSvc")};
122
124 std::string MuonVersion = geoModel->muonVersionOverride();
125
127 ATH_MSG_INFO(
"(from GeoModelSvc) AtlasVersion = <" << AtlasVersion <<
"> MuonVersion = <" << MuonVersion <<
">");
128
129
130
131
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);
135
137 std::map<std::string, std::string> altAsciiDBMap{};
138
139
140
141 ServiceHandle<IGeoDbTagSvc> geoDbTag(
"GeoDbTagSvc",
name());
143 ServiceHandle<IRDBAccessSvc> accessSvc(geoDbTag->getParamSvcName(),
name());
145 GeoModelIO::ReadGeoModel* sqliteReader = geoDbTag->getSqliteReader();
146
147 if (sqliteReader) {
148
149 ATH_MSG_INFO(
"New DD Activated; Muon detector description input from SQLITE file");
150
151 MuonDetectorFactoryLite theFactory(
detStore().operator->(),sqliteReader);
152 theFactory.setRDBAccess(accessSvc.get());
153 theFactory.create(world);
154
155
156 mgr=theFactory.getDetectorManager();
158 mgr->setGeometryVersion(tempLayout);
160
161 return StatusCode::SUCCESS;
162 }
163
164
165
166
167
168
169
170
171 MuonDetectorFactory001 theFactory(
detStore().operator->());
173
174
175 if (MuonVersion == "CUSTOM")
176 ATH_MSG_WARNING(
"Detector Information coming from a custom configuration !!");
177 else {
178
179 ATH_MSG_DEBUG(
"Detector Information coming from the database (job options IGNORED)");
180
181 IRDBRecordset_ptr switchSet = accessSvc->getRecordsetPtr(
"MuonSwitches", detectorKey, detectorNode);
182 if ((*switchSet).size() == 0)
183 return StatusCode::FAILURE;
184 const IRDBRecord *switches = (*switchSet)[0];
185
186
187 tempLayout = switches->
getString(
"LAYOUTNAME");
188
189
190 if (MuonVersion.empty()) {
191 MuonVersion = accessSvc->getChildTag("MuonSpectrometer", detectorKey, detectorNode);
192 ATH_MSG_INFO(
"(from GeoModelSvc) in AtlasVersion = <" << AtlasVersion <<
"> default MuonVersion is <" << MuonVersion <<
">");
193 }
194
196
201 }
202
203
204
205
206
208
209 <<
" LayoutName " << tempLayout.substr(0, 1) <<
endmsg
215
222 return (StatusCode::FAILURE);
223 }
226 }
227
231 }
235 }
236 }
237
239 umem = GeoPerfUtils::getMem();
240 ucpu =
float(GeoPerfUtils::getCpu() / 100.);
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;
243 mem = umem;
244 cpu = ucpu;
245 }
246
248
249 theFactory.setDBAtlasVersion(AtlasVersion);
250 theFactory.setDBMuonVersion(MuonVersion);
251 theFactory.setDBkey(detectorKey);
252 theFactory.setDBnode(detectorNode);
253 theFactory.setLayout(tempLayout);
265
266 theFactory.setRDBAccess(accessSvc.get());
267
268 theFactory.setAltAsciiDBMap(altAsciiDBMap);
269 try {
270
271
272
273
274 theFactory.create(world);
275 } catch (const std::bad_alloc &) {
277 return StatusCode::FAILURE;
278 }
279
281 umem = GeoPerfUtils::getMem();
282 ucpu =
float(GeoPerfUtils::getCpu() / 100.);
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;
285 mem = umem;
286 cpu = ucpu;
287 }
288
290 umem = GeoPerfUtils::getMem();
291 ucpu =
float(GeoPerfUtils::getCpu() / 100.);
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;
294 mem = umem;
295 cpu = ucpu;
296 }
297 }
298 mgr=theFactory.getDetectorManager();
300 return StatusCode::SUCCESS;
301}
#define ATH_MSG_VERBOSE(x)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
static void SetSelectionType(int t)