ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <fstream>
8#include <utility>
9
11#include "GeoModelKernel/throwExcept.h"
22
23namespace {
24 template <typename read_out> void clearCache(std::vector<std::unique_ptr<read_out>>& array) {
25 for (std::unique_ptr<read_out>& ele : array) {
26 if (ele) ele->clearCache();
27 }
28 }
29 template <typename read_out> void fillCache(std::vector<std::unique_ptr<read_out>>& array) {
30 for (std::unique_ptr<read_out>& ele : array) {
31 if (ele) ele->fillCache();
32 }
33 }
34 template <typename read_out>
35 void unpackSmartPtr(const std::vector<std::unique_ptr<read_out>>& array,
36 std::vector<const MuonGM::MuonReadoutElement*>& unpacked) {
37 unpacked.reserve(array.size() + unpacked.capacity());
38 for (const auto& ptr : array){
39 if (ptr) {
40 unpacked.push_back(ptr.get());
41 }
42 }
43 }
44}
45
46namespace MuonGM {
47
49 setName("Muon");
50 if (m_idHelperSvc.retrieve().isFailure()) {
51 THROW_EXCEPTION("MuonDetectorManager() - No IdHelper svc is available");
52 }
54 if (m_idHelperSvc->hasMDT()){
55 m_mdtArray.resize(m_idHelperSvc->mdtIdHelper().detectorElement_hash_max());
56 }
57 if (m_idHelperSvc->hasCSC()){
58 m_cscArray.resize(m_idHelperSvc->cscIdHelper().detectorElement_hash_max());
59 }
60 if (m_idHelperSvc->hasTGC()){
61 m_tgcArray.resize(m_idHelperSvc->tgcIdHelper().detectorElement_hash_max());
62 }
63 if (m_idHelperSvc->hasRPC()){
64 m_rpcArray.resize(m_idHelperSvc->rpcIdHelper().detectorElement_hash_max());
65 }
66 if (m_idHelperSvc->hasMM()){
67 m_mmcArray.resize(m_idHelperSvc->mmIdHelper().detectorElement_hash_max());
68 }
69 if (m_idHelperSvc->hasSTGC()){
70 m_stgArray.resize(m_idHelperSvc->stgcIdHelper().detectorElement_hash_max());
71 }
72 }
76
78
97 const MuonReadoutElement* reEle{nullptr};
99 switch (m_idHelperSvc->technologyIndex(id)){
100 case TechIndex::MDT:
101 reEle = getMdtReadoutElement(id);
102 break;
103 case TechIndex::RPC:
104 reEle = getRpcReadoutElement(id);
105 break;
106 case TechIndex::TGC:
107 reEle = getTgcReadoutElement(id);
108 break;
109 case TechIndex::CSC:
110 reEle = getCscReadoutElement(id);
111 break;
112 case TechIndex::MM:
113 reEle = getMMReadoutElement(id);
114 break;
115 case TechIndex::STGC:
116 reEle = getsTgcReadoutElement(id);
117 break;
118 default:
119 ATH_MSG_WARNING("Invalid technology ");
120 };
121 if (!reEle) ATH_MSG_WARNING("No readout element retrieved "<<m_idHelperSvc->toString(id));
122 return reEle;
123 }
124
125 unsigned int MuonDetectorManager::getNumTreeTops() const { return m_envelope.size(); }
126
127 PVConstLink MuonDetectorManager::getTreeTop(unsigned int i) const { return m_envelope[i]; }
128 PVLink MuonDetectorManager::getTreeTop(unsigned int i) { return m_envelope[i]; }
130 m_envelope.push_back(pV);
131 }
132
133 void MuonDetectorManager::addMuonStation(std::unique_ptr<MuonStation>&& mst) {
134 std::string key = muonStationKey(mst->getStationType(), mst->getEtaIndex(), mst->getPhiIndex());
135 m_MuonStationMap[key] = std::move(mst);
136 }
137
138 std::string MuonDetectorManager::muonStationKey(const std::string& stName, int statEtaIndex, int statPhiIndex) {
139 std::string key;
140 if (statEtaIndex < 0)
141 key = stName.substr(0, 3) + "_C_zi" + MuonGM::buildString(std::abs(statEtaIndex), 2) + "fi" +
142 MuonGM::buildString(statPhiIndex, 2);
143 else
144 key = stName.substr(0, 3) + "_A_zi" + MuonGM::buildString(std::abs(statEtaIndex), 2) + "fi" +
145 MuonGM::buildString(statPhiIndex, 2);
146 return key;
147 }
148
149 const MuonStation* MuonDetectorManager::getMuonStation(const std::string& stName, int stEtaIndex, int stPhiIndex) const {
150 std::string key = muonStationKey(stName, stEtaIndex, stPhiIndex);
151
152 std::map<std::string, std::unique_ptr<MuonStation>>::const_iterator it = m_MuonStationMap.find(key);
153 if (it != m_MuonStationMap.end())
154 return (*it).second.get();
155 else
156 return nullptr;
157 }
158
159 MuonStation* MuonDetectorManager::getMuonStation(const std::string& stName, int stEtaIndex, int stPhiIndex) {
160 std::string key = muonStationKey(stName, stEtaIndex, stPhiIndex);
161
162 std::map<std::string, std::unique_ptr<MuonStation>>::const_iterator it = m_MuonStationMap.find(key);
163 if (it != m_MuonStationMap.end())
164 return (*it).second.get();
165 else
166 return nullptr;
167 }
168
169 void MuonDetectorManager::addRpcReadoutElement(std::unique_ptr<RpcReadoutElement>&& x) {
170 const Identifier id = x->identify();
171 int idx = rpcIdentToArrayIdx(id);
172 if (m_rpcArray[idx]) {
173 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(id)<<" which has been already added.");
174 THROW_EXCEPTION("Double readout element assignment");
175 }
176 m_rpcArray[idx] = std::move(x);
177 ++m_n_rpcRE;
178 }
179
181 int idx = rpcIdentToArrayIdx(id);
182 return m_rpcArray[idx].get();
183 }
184
185 void MuonDetectorManager::addMMReadoutElement(std::unique_ptr<MMReadoutElement>&& x) {
186 const int array_idx = mmIdenToArrayIdx(x->identify());
187 if (m_mmcArray[array_idx]) {
188 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(x->identify())<<" which has been already added.");
189 THROW_EXCEPTION("Double readout element assignment");
190 }
191 m_mmcArray[array_idx] = std::move(x);
192 ++m_n_mmcRE;
193 }
194
195 void MuonDetectorManager::addsTgcReadoutElement(std::unique_ptr<sTgcReadoutElement>&& x) {
196 const int array_idx = stgcIdentToArrayIdx(x->identify());
197 if (m_stgArray[array_idx]) {
198 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(x->identify())<<" which has been already added.");
199 THROW_EXCEPTION("Double readout element assignment");
200 }
201 m_stgArray[array_idx] = std::move(x);
202 ++m_n_stgRE;
203 }
204
205 void MuonDetectorManager::addMdtReadoutElement(std::unique_ptr<MdtReadoutElement>&& x) {
206 const Identifier id = x->identify();
207 const int arrayIdx = mdtIdentToArrayIdx(id);
208 if (m_mdtArray[arrayIdx]) {
209 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(id)<<" which has been already added.");
210 THROW_EXCEPTION("Double readout element assignment");
211 }
212 m_mdtArray[arrayIdx] = std::move(x);
213 ++m_n_mdtRE;
214 }
215
217 const int arrayIdx = mdtIdentToArrayIdx(id);
218 return arrayIdx < 0 ? nullptr : m_mdtArray[arrayIdx].get();
219 }
220
222 const int arrayIdx = mdtIdentToArrayIdx(id);
223 return arrayIdx < 0 ? nullptr : m_mdtArray[arrayIdx].get();
224 }
225
226 void MuonDetectorManager::addCscReadoutElement(std::unique_ptr<CscReadoutElement>&& x) {
227 const Identifier id = x->identify();
228 const int array_idx = cscIdentToArrayIdx(id);
229 if (m_cscArray[array_idx]) {
230 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(id)<<" which has been already added.");
231 THROW_EXCEPTION("Double readout element assignment");
232 }
233 m_cscArray[array_idx] = std::move(x);
234 ++m_n_cscRE;
235 }
236
238 const int array_idx = cscIdentToArrayIdx(id);
239 return array_idx < 0 ? nullptr : m_cscArray[array_idx].get();
240 }
241
243 const int array_idx = cscIdentToArrayIdx(id);
244 return array_idx < 0 ? nullptr : m_cscArray[array_idx].get();
245 }
246
247 void MuonDetectorManager::addTgcReadoutElement(std::unique_ptr<TgcReadoutElement>&& x) {
248 const Identifier id = x->identify();
249 const int array_idx = tgcIdentToArrayIdx(id);
250 if (m_tgcArray[array_idx]) {
251 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(id)<<" which has been already added.");
252 THROW_EXCEPTION("Double readout element assignment");
253 }
254
255 m_tgcArray[array_idx] = std::move(x);
256 ++m_n_tgcRE;
257 }
258
260 const int array_idx = tgcIdentToArrayIdx(id);
261 return array_idx < 0 ? nullptr : m_tgcArray[array_idx].get();
262 }
264 const int array_idx = tgcIdentToArrayIdx(id);
265 return array_idx < 0 ? nullptr : m_tgcArray[array_idx].get();
266 }
268 const int array_idx = mmIdenToArrayIdx(id);
269 return array_idx < 0 ? nullptr : m_mmcArray[array_idx].get();
270 }
272 const int array_idx = stgcIdentToArrayIdx(id);
273 return array_idx < 0 ? nullptr : m_stgArray[array_idx].get();
274 }
276 const int hash = static_cast<int>(m_idHelperSvc->detElementHash(id));
277#ifndef NDEBUG
278 if (hash <0) {
279 ATH_MSG_WARNING("Failed to retrieve a proper hash for "<<m_idHelperSvc->toString(id));
280 return -1;
281 }
282#endif
283 return hash;
284 }
285
287 const int hash = static_cast<int>(m_idHelperSvc->detElementHash(id));
288#ifndef NDEBUG
289 if (hash <0) {
290 ATH_MSG_WARNING("Failed to retrieve a proper hash for "<<m_idHelperSvc->toString(id));
291 return -1;
292 }
293#endif
294 return hash;
295 }
297 const int hash = static_cast<int>(m_idHelperSvc->detElementHash(id));
298#ifndef NDEBUG
299 if (hash <0) {
300 ATH_MSG_WARNING("Failed to retrieve a proper hash for "<<m_idHelperSvc->toString(id));
301 return -1;
302 }
303#endif
304 return hash;
305 }
307 const int hash = static_cast<int>(m_idHelperSvc->detElementHash(id));
308#ifndef NDEBUG
309 if (hash <0) {
310 ATH_MSG_WARNING("Failed to retrieve a proper hash for "<<m_idHelperSvc->toString(id));
311 return -1;
312 }
313#endif
314 return hash;
315 }
317 const int hash = static_cast<int>(m_idHelperSvc->detElementHash(id));
318#ifndef NDEBUG
319 if (hash <0) {
320 ATH_MSG_WARNING("Failed to retrieve a proper hash for "<<m_idHelperSvc->toString(id));
321 return -1;
322 }
323#endif
324 return hash;
325 }
327 const int hash = static_cast<int>(m_idHelperSvc->detElementHash(id));
328#ifndef NDEBUG
329 if (hash <0) {
330 ATH_MSG_WARNING("Failed to retrieve a proper hash for "<<m_idHelperSvc->toString(id));
331 return -1;
332 }
333#endif
334 return hash;
335 }
336
338 if (alineData.empty()) {
339 ATH_MSG_DEBUG("Got empty A-line container (expected for MC), not applying A-lines...");
340 return StatusCode::SUCCESS;
341 }
342
343 using Parameter = ALinePar::Parameter;
344 // loop over the container of the updates passed by the MuonAlignmentDbTool
345 unsigned int nLines{0}, nUpdates{0};
346 for (const ALinePar& ALine : alineData) {
347 nLines++;
348 ATH_MSG_DEBUG(ALine << " is new. ID = " << m_idHelperSvc->toString(ALine.identify()));
349 const std::string stType = ALine.AmdbStation();
350 const int jff = ALine.AmdbPhi();
351 const int jzz = ALine.AmdbEta();
352 const int job = ALine.AmdbJob();
353 //********************
354 // NSW Cases
355 //********************
356 if (stType[0] == 'M' || stType[0] == 'S') {
357 if (!nMMRE() || !nsTgcRE()) {
358 ATH_MSG_WARNING("Unable to set A-line; the manager does not contain NSW readout elements" );
359 continue;
360 }
361 if (stType[0] == 'M') {
362 // Micromegas
363 const int array_idx = mmIdenToArrayIdx(ALine.identify());
364 MMReadoutElement* RE = m_mmcArray[array_idx].get();
365
366 if (!RE) {
367 ATH_MSG_WARNING(ALine << " *** No MM readout element found\n"
368 << "PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
369 return StatusCode::FAILURE;
370 }
371
372 RE->setDelta(ALine);
373
374 } else if (stType[0] == 'S') {
375 // sTGC
376 const int array_idx = stgcIdentToArrayIdx(ALine.identify());
377 sTgcReadoutElement* RE = m_stgArray[array_idx].get();
378
379 if (!RE) {
380 ATH_MSG_WARNING(ALine << " *** No sTGC readout element found\n"
381 << "PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
382 return StatusCode::FAILURE;
383 }
384
385 RE->setDelta(ALine);
386 }
387 continue;
388 }
389
390
391 //********************
392 // Non-NSW Cases
393 //********************
394 MuonStation* thisStation = getMuonStation(stType, jzz, jff);
395 if (!thisStation) {
396 ATH_MSG_WARNING("ALinePar with AmdbId " << stType << " " << jzz << " " << jff << " " << job << "*** No MuonStation found\n"
397 << "PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use" );
398 continue;
399 }
400
401 if (job != 0) {
402 // job different than 0 (standard for TGC conditions for Sept 2010 repro.)
403 if (stType[0] == 'T') {
404 ATH_MSG_DEBUG( "ALinePar with AmdbId " << stType << " " << jzz << " " << jff << " " << job
405 << " has JOB not 0 - this is expected for TGC" );
406 } else {
407 ATH_MSG_WARNING("ALinePar with AmdbId " << stType << " " << jzz << " " << jff << " " << job
408 << " has JOB not 0 - this is NOT EXPECTED yet for non TGC chambers - skipping this A-line" );
409 continue;
410 }
411 }
412 if (job == 0) {
413 ATH_MSG_DEBUG( "Setting delta transform for Station " << ALine);
414 using Parameter = ALinePar::Parameter;
415 thisStation->setDelta_fromAline(ALine.getParameter(Parameter::transS),
416 ALine.getParameter(Parameter::transZ),
417 ALine.getParameter(Parameter::transT),
418 ALine.getParameter(Parameter::rotS),
419 ALine.getParameter(Parameter::rotZ),
420 ALine.getParameter(Parameter::rotT));
421
422 thisStation->clearCache();
423 thisStation->fillCache();
424 } else {
425 // job different than 0 (standard for TGC conditions for Sept 2010 repro.)
426 ATH_MSG_DEBUG( "Setting delta transform for component " << ALine);
427 thisStation->setDelta_fromAline_forComp(job,
428 ALine.getParameter(Parameter::transS),
429 ALine.getParameter(Parameter::transZ),
430 ALine.getParameter(Parameter::transT),
431 ALine.getParameter(Parameter::rotS),
432 ALine.getParameter(Parameter::rotZ),
433 ALine.getParameter(Parameter::rotT));
434
435 thisStation->getMuonReadoutElement(job)->refreshCache();
436
437 }
438 nUpdates++;
439 }
440 ATH_MSG_INFO( "# of A-lines read from the ALineMapContainer in StoreGate is " << nLines );
441 ATH_MSG_INFO( "# of deltaTransforms updated according to A-lines is " << nUpdates );
442 return StatusCode::SUCCESS;
443 }
444
446 ATH_MSG_DEBUG( "In updateDeformations()" );
447 if (blineData.empty()) {
448 ATH_MSG_DEBUG( "Got empty B-line container (expected for MC), not applying B-lines..." );
449 return StatusCode::SUCCESS;
450 } else
451 ATH_MSG_INFO( "temporary B-line container with size = " << blineData.size() );
452
453 // loop over the container of the updates passed by the MuonAlignmentDbTool
454 unsigned int nLines{0}, nUpdates{0};
455 for (const BLinePar& BLine : blineData) {
456 ++nLines;
457 const std::string stType = BLine.AmdbStation();
458 const int jff = BLine.AmdbPhi();
459 const int jzz = BLine.AmdbEta();
460 const int job = BLine.AmdbJob();
461 //********************
462 // NSW Cases
463 //********************
464 if (stType[0] == 'M' || stType[0] == 'S') {
465 if (!nMMRE() || !nsTgcRE()) {
466 ATH_MSG_WARNING("Unable to set B-line; the manager does not contain NSW readout elements" );
467 continue;
468 }
469 if (stType[0] == 'M') {
470 // Micromegas
471 const int array_idx = mmIdenToArrayIdx(BLine.identify());
472 MMReadoutElement* RE = m_mmcArray[array_idx].get();
473
474 if (!RE) {
475 ATH_MSG_WARNING("BlinePar with AmdbId " <<BLine<< " *** No MM readout element found\n"
476 << "PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
477 return StatusCode::FAILURE;
478 }
479 RE->setBLinePar(BLine);
480 } else if (stType[0] == 'S') {
481 // sTGC
482 const int array_idx = stgcIdentToArrayIdx(BLine.identify());
483 sTgcReadoutElement* RE = m_stgArray[array_idx].get();
484 if (!RE) {
485 ATH_MSG_WARNING("BlinePar with AmdbId " << BLine << " *** No sTGC readout element found\n"
486 << "PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
487 return StatusCode::FAILURE;
488 }
489 RE->setBLinePar(BLine);
490 }
491 continue;
492 }
493
494 //********************
495 // MDT Cases
496 //********************
497 if (stType.at(0) == 'T' || stType.at(0) == 'C' || (stType.substr(0, 3) == "BML" && std::abs(jzz) == 7)) {
498 ATH_MSG_DEBUG( "BLinePar with AmdbId " << BLine << " is not a MDT station - skipping" );
499 continue;
500 }
501 ATH_MSG_DEBUG( "BLinePar with AmdbId " <<BLine << " is new ID = " << m_idHelperSvc->toString(BLine.identify()) );
502 if (job == 0) {
503 MuonStation* thisStation = getMuonStation(stType, jzz, jff);
504 if (!thisStation) {
505 ATH_MSG_WARNING("BLinePar with AmdbId " << BLine <<
506 " *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
507 "Geometry Layout in use");
508 continue;
509 }
510 ATH_MSG_DEBUG( "Setting deformation parameters for Station " << stType << " " << jzz << " " << jff << " ");
511 thisStation->setBline(&BLine);
512 nUpdates++;
513 } else {
514 ATH_MSG_WARNING("BLinePar with AmdbId " << stType << " " << jzz << " " << jff << " " << job << " has JOB not 0 ");
515 return StatusCode::FAILURE;
516 }
517 }
518 ATH_MSG_INFO( "# of B-lines read from the ALineMapContainer in StoreGate is " << nLines );
519 ATH_MSG_INFO( "# of deform-Transforms updated according to B-lines is " << nUpdates );
520 return StatusCode::SUCCESS;
521 }
522
524
525 if (ilineData.empty()) {
526 ATH_MSG_WARNING("Empty temporary CSC I-line container - nothing to do here" );
527 return StatusCode::SUCCESS;
528 } else
529 ATH_MSG_INFO( "temporary CSC I-line container with size = " << ilineData.size() );
530
531 // loop over the container of the updates passed by the MuonAlignmentDbTool
532 unsigned int nLines{0}, nUpdates{0};
533 for (const ALinePar& ILine : ilineData) {
534 nLines++;
535 const std::string stType = ILine.AmdbStation();
536 const int jff = ILine.AmdbPhi();
537 const int jzz = ILine.AmdbEta();
538 const int job = ILine.AmdbJob();
539 ATH_MSG_DEBUG( "CscInternalAlignmentPar with AmdbId " << ILine << " is new ID = " << m_idHelperSvc->toString(ILine.identify()) );
540 if (job == 3) {
541 MuonStation* thisStation = getMuonStation(stType, jzz, jff);
542 if (!thisStation) {
543 ATH_MSG_WARNING("CscInternalAlignmentPar with AmdbId " << ILine
544 << " *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
545 "Geometry Layout in use");
546 continue;
547 }
548 ATH_MSG_DEBUG( "Setting CSC I-Lines for Station " <<ILine);
549 CscReadoutElement* CscRE = dynamic_cast<CscReadoutElement*>(thisStation->getMuonReadoutElement(job));
550 if (!CscRE)
551 ATH_MSG_ERROR( "The CSC I-lines container includes stations which are no CSCs! This is impossible." );
552 else {
553 CscRE->setCscInternalAlignmentPar(ILine);
554 }
555 thisStation->refreshCache();
556
557 nUpdates++;
558
559 } else {
560 ATH_MSG_ERROR( "job for CSC I-Lines= " << job << " is not 3 => This is not valid." );
561 }
562 }
563 ATH_MSG_INFO( "# of CSC I-lines read from the ILineMapContainer in StoreGate is " << nLines );
564 ATH_MSG_INFO( "# of deltaTransforms updated according to A-lines is " << nUpdates );
565 return StatusCode::SUCCESS;
566 }
568
569 if (asbuiltData.empty()) {
570 ATH_MSG_WARNING("Empty temporary As-Built container - nothing to do here" );
571 return StatusCode::SUCCESS;
572 } else
573 ATH_MSG_INFO( "temporary As-Built container with size = " << asbuiltData.size() );
574
575 // loop over the container of the updates passed by the MuonAlignmentDbTool
576 unsigned int nLines{0}, nUpdates{0};
577 for (const auto& AsBuiltPar : asbuiltData) {
578 nLines++;
579 const std::string stType = AsBuiltPar.AmdbStation();
580 const int jff = AsBuiltPar.AmdbPhi();
581 const int jzz = AsBuiltPar.AmdbEta();
582
583 ATH_MSG_DEBUG( "MdtAsBuiltPar with AmdbId " << AsBuiltPar
584 << " is new ID = " << m_idHelperSvc->toString(AsBuiltPar.identify()) );
585
586 MuonStation* thisStation = getMuonStation(stType, jzz, jff);
587 if (thisStation) {
588
589 ATH_MSG_DEBUG( "Setting as-built parameters for Station " << AsBuiltPar );
590 thisStation->setMdtAsBuiltParams(&AsBuiltPar);
591 nUpdates++;
592 } else {
593 ATH_MSG_WARNING("MdtAsBuiltPar with AmdbId " <<AsBuiltPar
594 << " *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
595 "Geometry Layout in use");
596 continue;
597 }
598 }
599 ATH_MSG_INFO( "# of MDT As-Built read from the MdtAsBuiltMapContainer in StoreGate is " << nLines );
600 ATH_MSG_INFO( "# of deltaTransforms updated according to As-Built is " << nUpdates );
601 return StatusCode::SUCCESS;
602 }
603
605 m_nswAsBuilt = nswAsBuiltData;
606 }
607
609 m_mmAsBuilt2 = mmAsBuilt2;
610 }
611
613 m_stgcAsBuildData = stgcAsBuilt;
614 }
615
617#ifndef NDEBUG
618 if (id >= m_idHelperSvc->mdtIdHelper().detectorElement_hash_max()) {
619 ATH_MSG_WARNING(" try to getMdtReadoutElement with hashId " << (unsigned int)id << " outside range 0-"
620 << m_idHelperSvc->mdtIdHelper().detectorElement_hash_max() - 1 );
621 return nullptr;
622 }
623#endif
624 return m_mdtArray[id].get();
625 }
626
628#ifndef NDEBUG
629 if (id >= m_idHelperSvc->rpcIdHelper().detectorElement_hash_max()) {
630 ATH_MSG_WARNING(" try to getRpcReadoutElement with hashId " << (unsigned int)id << " outside range 0-"
631 << m_idHelperSvc->rpcIdHelper().detectorElement_hash_max() - 1 );
632 return nullptr;
633 }
634#endif
635 return m_rpcArray[id].get();
636 }
637
639#ifndef NDEBUG
640 if (id >= m_idHelperSvc->tgcIdHelper().detectorElement_hash_max()) {
641 ATH_MSG_WARNING(" try to getTgcReadoutElement with hashId " << (unsigned int)id << " outside range 0-"
642 << m_idHelperSvc->tgcIdHelper().detectorElement_hash_max() - 1 );
643 return nullptr;
644 }
645#endif
646 return m_tgcArray[id].get();
647 }
648
650#ifndef NDEBUG
651 if (id >= m_idHelperSvc->cscIdHelper().detectorElement_hash_max()) {
652 ATH_MSG_WARNING(" try to getCscReadoutElement with hashId " << (unsigned int)id << " outside range 0-"
653 << m_idHelperSvc->cscIdHelper().detectorElement_hash_max() - 1 );
654 return nullptr;
655 }
656#endif
657 return m_cscArray[id].get();
658 }
659
660 unsigned int MuonDetectorManager::rpcStationTypeIdx(const int stationName) const {
661 std::map<int, int>::const_iterator itr = m_rpcStatToIdx.find(stationName);
662 if (itr != m_rpcStatToIdx.end()) return itr->second;
664 }
665
666 int MuonDetectorManager::rpcStationName(const int stationIndex) const {
667 std::map<int, int>::const_iterator itr = m_rpcIdxToStat.find(stationIndex);
668 if (itr != m_rpcIdxToStat.end()) return itr->second;
669 return -1;
670 }
672
673 if (!m_idHelperSvc->hasRPC()) return;
674 const RpcIdHelper& rpcHelper{m_idHelperSvc->rpcIdHelper()};
675 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BML"), RpcStatType::BML));
676 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BMS"), RpcStatType::BMS));
677 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BOL"), RpcStatType::BOL));
678 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BOS"), RpcStatType::BOS));
679 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BMF"), RpcStatType::BMF));
680 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BOF"), RpcStatType::BOF));
681 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BOG"), RpcStatType::BOG));
682 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BME"), RpcStatType::BME));
683 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BIR"), RpcStatType::BIR));
684 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BIM"), RpcStatType::BIM));
685 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BIL"), RpcStatType::BIL));
686 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BIS"), RpcStatType::BIS));
687
688 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BML, rpcHelper.stationNameIndex("BML")));
689 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BMS, rpcHelper.stationNameIndex("BMS")));
690 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BOL, rpcHelper.stationNameIndex("BOL")));
691 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BOS, rpcHelper.stationNameIndex("BOS")));
692 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BMF, rpcHelper.stationNameIndex("BMF")));
693 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BOF, rpcHelper.stationNameIndex("BOF")));
694 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BOG, rpcHelper.stationNameIndex("BOG")));
695 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BME, rpcHelper.stationNameIndex("BME")));
696 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIR, rpcHelper.stationNameIndex("BIR")));
697 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIM, rpcHelper.stationNameIndex("BIM")));
698 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIL, rpcHelper.stationNameIndex("BIL")));
699 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIS, rpcHelper.stationNameIndex("BIS")));
700 }
701 void MuonDetectorManager::set_DBMuonVersion(const std::string& version) { m_DBMuonVersion = version; }
702 void MuonDetectorManager::setGeometryVersion(const std::string& version) { m_geometryVersion = version; }
706
707 std::vector<const MuonReadoutElement*> MuonDetectorManager::getAllReadoutElements() const {
708 std::vector<const MuonReadoutElement*> res{};
709 unpackSmartPtr(m_mdtArray, res);
710 unpackSmartPtr(m_rpcArray, res);
711 unpackSmartPtr(m_tgcArray, res);
712 unpackSmartPtr(m_stgArray, res);
713 unpackSmartPtr(m_mmcArray, res);
714 unpackSmartPtr(m_cscArray, res);
715 return res;
716 }
717
718} // namespace MuonGM
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::set< ALinePar, std::less<> > ALineContainer
std::set< MdtAsBuiltPar, std::less<> > MdtAsBuiltContainer
std::set< BLinePar, std::less<> > BLineContainer
std::pair< std::vector< unsigned int >, bool > res
#define x
Parameter
amdb frame (s, z, t) = chamber frame (y, z, x)
Definition ALinePar.h:23
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This is a "hash" representation of an Identifier.
void setCscInternalAlignmentPar(const ALinePar &)
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
void setDelta(const ALinePar &aline)
void setBLinePar(const BLinePar &bLine)
read B-line (chamber-deformation) parameters
StatusCode updateCSCInternalAlignmentMap(const ALineContainer &cscIntAline)
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Get any read out element.
void addsTgcReadoutElement(std::unique_ptr< sTgcReadoutElement > &&reEle)
store the sTGCReadoutElement using as "key" the identifier
void addRpcReadoutElement(std::unique_ptr< RpcReadoutElement > &&reEle)
store the RpcReadoutElement using as "key" the identifier
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
int rpcIdentToArrayIdx(const Identifier &id) const
Helper method to convert the Identifier into the corresponding index accessing the array.
static std::string muonStationKey(const std::string &stName, int statEtaIndex, int statPhiIndex)
const MuonStation * getMuonStation(const std::string &stName, int eta, int phi) const
std::map< std::string, std::unique_ptr< MuonStation > > m_MuonStationMap
void addCscReadoutElement(std::unique_ptr< CscReadoutElement > &&reEle)
store the CscReadoutElement using as "key" the identifier
void addMdtReadoutElement(std::unique_ptr< MdtReadoutElement > &&reEle)
store the MdtReadoutElement using as "key" the identifier
std::vector< const MuonReadoutElement * > getAllReadoutElements() const
void addTgcReadoutElement(std::unique_ptr< TgcReadoutElement > &&reEle)
store the TgcReadoutElement using as "key" the identifier
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
void addMMReadoutElement(std::unique_ptr< MMReadoutElement > &&reEle)
store the MMReadoutElement using as "key" the identifier
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Base class for the XxxReadoutElement, with Xxx = Mdt, Rpc, Tgc, Csc.
void setMdtAsBuiltParams(const MdtAsBuiltPar *xtomo)
void setDelta_fromAline(double, double, double, double, double, double)
set the delta transform in the amdb frame and update the geoModel Delta
void setBline(const BLinePar *bline)
const MuonReadoutElement * getMuonReadoutElement(int jobIndex) const
void setDelta_fromAline_forComp(int, double, double, double, double, double, double)
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
void setBLinePar(const BLinePar &bLine)
read B-line (chamber-deformation) parameters
int stationNameIndex(const std::string &name) const
Class holding the sTGC as built conditions data and applying it.
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27
std::string buildString(int i, int ncha)
TechnologyIndex
enum to classify the different layers in the muon spectrometer
void * ptr(T *p)
Definition SGImplSvc.cxx:74
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10