ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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}
35
36namespace MuonGM {
37
39 setName("Muon");
40 if (m_idHelperSvc.retrieve().isFailure()) {
41 THROW_EXCEPTION("MuonDetectorManager() - No IdHelper svc is available");
42 }
44 if (m_idHelperSvc->hasMDT()){
45 m_mdtArray.resize(m_idHelperSvc->mdtIdHelper().detectorElement_hash_max());
46 }
47 if (m_idHelperSvc->hasCSC()){
48 m_cscArray.resize(m_idHelperSvc->cscIdHelper().detectorElement_hash_max());
49 }
50 if (m_idHelperSvc->hasTGC()){
51 m_tgcArray.resize(m_idHelperSvc->tgcIdHelper().detectorElement_hash_max());
52 }
53 if (m_idHelperSvc->hasRPC()){
54 m_rpcArray.resize(m_idHelperSvc->rpcIdHelper().detectorElement_hash_max());
55 }
56 if (m_idHelperSvc->hasMM()){
57 m_mmcArray.resize(m_idHelperSvc->mmIdHelper().detectorElement_hash_max());
58 }
59 if (m_idHelperSvc->hasSTGC()){
60 m_stgArray.resize(m_idHelperSvc->stgcIdHelper().detectorElement_hash_max());
61 }
62 }
66
68
87 const MuonReadoutElement* reEle{nullptr};
89 switch (m_idHelperSvc->technologyIndex(id)){
90 case TechIndex::MDT:
91 reEle = getMdtReadoutElement(id);
92 break;
93 case TechIndex::RPC:
94 reEle = getRpcReadoutElement(id);
95 break;
96 case TechIndex::TGC:
97 reEle = getTgcReadoutElement(id);
98 break;
99 case TechIndex::CSC:
100 reEle = getCscReadoutElement(id);
101 break;
102 case TechIndex::MM:
103 reEle = getMMReadoutElement(id);
104 break;
105 case TechIndex::STGC:
106 reEle = getsTgcReadoutElement(id);
107 break;
108 default:
109 ATH_MSG_WARNING("Invalid technology ");
110 };
111 if (!reEle) ATH_MSG_WARNING("No readout element retrieved "<<m_idHelperSvc->toString(id));
112 return reEle;
113 }
114
115 unsigned int MuonDetectorManager::getNumTreeTops() const { return m_envelope.size(); }
116
117 PVConstLink MuonDetectorManager::getTreeTop(unsigned int i) const { return m_envelope[i]; }
118 PVLink MuonDetectorManager::getTreeTop(unsigned int i) { return m_envelope[i]; }
120 m_envelope.push_back(pV);
121 }
122
123 void MuonDetectorManager::addMuonStation(std::unique_ptr<MuonStation>&& mst) {
124 std::string key = muonStationKey(mst->getStationType(), mst->getEtaIndex(), mst->getPhiIndex());
125 m_MuonStationMap[key] = std::move(mst);
126 }
127
128 std::string MuonDetectorManager::muonStationKey(const std::string& stName, int statEtaIndex, int statPhiIndex) {
129 std::string key;
130 if (statEtaIndex < 0)
131 key = stName.substr(0, 3) + "_C_zi" + MuonGM::buildString(std::abs(statEtaIndex), 2) + "fi" +
132 MuonGM::buildString(statPhiIndex, 2);
133 else
134 key = stName.substr(0, 3) + "_A_zi" + MuonGM::buildString(std::abs(statEtaIndex), 2) + "fi" +
135 MuonGM::buildString(statPhiIndex, 2);
136 return key;
137 }
138
139 const MuonStation* MuonDetectorManager::getMuonStation(const std::string& stName, int stEtaIndex, int stPhiIndex) const {
140 std::string key = muonStationKey(stName, stEtaIndex, stPhiIndex);
141
142 std::map<std::string, std::unique_ptr<MuonStation>>::const_iterator it = m_MuonStationMap.find(key);
143 if (it != m_MuonStationMap.end())
144 return (*it).second.get();
145 else
146 return nullptr;
147 }
148
149 MuonStation* MuonDetectorManager::getMuonStation(const std::string& stName, int stEtaIndex, int stPhiIndex) {
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 void MuonDetectorManager::addRpcReadoutElement(std::unique_ptr<RpcReadoutElement>&& x) {
160 const Identifier id = x->identify();
161 int idx = rpcIdentToArrayIdx(id);
162 if (m_rpcArray[idx]) {
163 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(id)<<" which has been already added.");
164 THROW_EXCEPTION("Double readout element assignment");
165 }
166 m_rpcArray[idx] = std::move(x);
167 ++m_n_rpcRE;
168 }
169
171 int idx = rpcIdentToArrayIdx(id);
172 return m_rpcArray[idx].get();
173 }
174
175 void MuonDetectorManager::addMMReadoutElement(std::unique_ptr<MMReadoutElement>&& x) {
176 const int array_idx = mmIdenToArrayIdx(x->identify());
177 if (m_mmcArray[array_idx]) {
178 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(x->identify())<<" which has been already added.");
179 THROW_EXCEPTION("Double readout element assignment");
180 }
181 m_mmcArray[array_idx] = std::move(x);
182 ++m_n_mmcRE;
183 }
184
185 void MuonDetectorManager::addsTgcReadoutElement(std::unique_ptr<sTgcReadoutElement>&& x) {
186 const int array_idx = stgcIdentToArrayIdx(x->identify());
187 if (m_stgArray[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_stgArray[array_idx] = std::move(x);
192 ++m_n_stgRE;
193 }
194
195 void MuonDetectorManager::addMdtReadoutElement(std::unique_ptr<MdtReadoutElement>&& x) {
196 const Identifier id = x->identify();
197 const int arrayIdx = mdtIdentToArrayIdx(id);
198 if (m_mdtArray[arrayIdx]) {
199 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(id)<<" which has been already added.");
200 THROW_EXCEPTION("Double readout element assignment");
201 }
202 m_mdtArray[arrayIdx] = std::move(x);
203 ++m_n_mdtRE;
204 }
205
207 const int arrayIdx = mdtIdentToArrayIdx(id);
208 return arrayIdx < 0 ? nullptr : m_mdtArray[arrayIdx].get();
209 }
210
212 const int arrayIdx = mdtIdentToArrayIdx(id);
213 return arrayIdx < 0 ? nullptr : m_mdtArray[arrayIdx].get();
214 }
215
216 void MuonDetectorManager::addCscReadoutElement(std::unique_ptr<CscReadoutElement>&& x) {
217 const Identifier id = x->identify();
218 const int array_idx = cscIdentToArrayIdx(id);
219 if (m_cscArray[array_idx]) {
220 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(id)<<" which has been already added.");
221 THROW_EXCEPTION("Double readout element assignment");
222 }
223 m_cscArray[array_idx] = std::move(x);
224 ++m_n_cscRE;
225 }
226
228 const int array_idx = cscIdentToArrayIdx(id);
229 return array_idx < 0 ? nullptr : m_cscArray[array_idx].get();
230 }
231
233 const int array_idx = cscIdentToArrayIdx(id);
234 return array_idx < 0 ? nullptr : m_cscArray[array_idx].get();
235 }
236
237 void MuonDetectorManager::addTgcReadoutElement(std::unique_ptr<TgcReadoutElement>&& x) {
238 const Identifier id = x->identify();
239 const int array_idx = tgcIdentToArrayIdx(id);
240 if (m_tgcArray[array_idx]) {
241 ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Trying to add ReadoutElement "<<m_idHelperSvc->toStringDetEl(id)<<" which has been already added.");
242 THROW_EXCEPTION("Double readout element assignment");
243 }
244
245 m_tgcArray[array_idx] = std::move(x);
246 ++m_n_tgcRE;
247 }
248
250 const int array_idx = tgcIdentToArrayIdx(id);
251 return array_idx < 0 ? nullptr : m_tgcArray[array_idx].get();
252 }
254 const int array_idx = tgcIdentToArrayIdx(id);
255 return array_idx < 0 ? nullptr : m_tgcArray[array_idx].get();
256 }
258 const int array_idx = mmIdenToArrayIdx(id);
259 return array_idx < 0 ? nullptr : m_mmcArray[array_idx].get();
260 }
262 const int array_idx = stgcIdentToArrayIdx(id);
263 return array_idx < 0 ? nullptr : m_stgArray[array_idx].get();
264 }
266 const int hash = static_cast<int>(m_idHelperSvc->detElementHash(id));
267#ifndef NDEBUG
268 if (hash <0) {
269 ATH_MSG_WARNING("Failed to retrieve a proper hash for "<<m_idHelperSvc->toString(id));
270 return -1;
271 }
272#endif
273 return hash;
274 }
275
277 const int hash = static_cast<int>(m_idHelperSvc->detElementHash(id));
278#ifndef NDEBUG
279 if (hash <0) {
280 ATH_MSG_WARNING("Failed to retrieve a proper hash for "<<m_idHelperSvc->toString(id));
281 return -1;
282 }
283#endif
284 return hash;
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 }
326
328 if (alineData.empty()) {
329 ATH_MSG_DEBUG("Got empty A-line container (expected for MC), not applying A-lines...");
330 return StatusCode::SUCCESS;
331 }
332
333 using Parameter = ALinePar::Parameter;
334 // loop over the container of the updates passed by the MuonAlignmentDbTool
335 unsigned int nLines{0}, nUpdates{0};
336 for (const ALinePar& ALine : alineData) {
337 nLines++;
338 ATH_MSG_DEBUG(ALine << " is new. ID = " << m_idHelperSvc->toString(ALine.identify()));
339 const std::string stType = ALine.AmdbStation();
340 const int jff = ALine.AmdbPhi();
341 const int jzz = ALine.AmdbEta();
342 const int job = ALine.AmdbJob();
343 //********************
344 // NSW Cases
345 //********************
346 if (stType[0] == 'M' || stType[0] == 'S') {
347 if (!nMMRE() || !nsTgcRE()) {
348 ATH_MSG_WARNING("Unable to set A-line; the manager does not contain NSW readout elements" );
349 continue;
350 }
351 if (stType[0] == 'M') {
352 // Micromegas
353 const int array_idx = mmIdenToArrayIdx(ALine.identify());
354 MMReadoutElement* RE = m_mmcArray[array_idx].get();
355
356 if (!RE) {
357 ATH_MSG_WARNING(ALine << " *** No MM readout element found\n"
358 << "PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
359 return StatusCode::FAILURE;
360 }
361
362 RE->setDelta(ALine);
363
364 } else if (stType[0] == 'S') {
365 // sTGC
366 const int array_idx = stgcIdentToArrayIdx(ALine.identify());
367 sTgcReadoutElement* RE = m_stgArray[array_idx].get();
368
369 if (!RE) {
370 ATH_MSG_WARNING(ALine << " *** No sTGC readout element found\n"
371 << "PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
372 return StatusCode::FAILURE;
373 }
374
375 RE->setDelta(ALine);
376 }
377 continue;
378 }
379
380
381 //********************
382 // Non-NSW Cases
383 //********************
384 MuonStation* thisStation = getMuonStation(stType, jzz, jff);
385 if (!thisStation) {
386 ATH_MSG_WARNING("ALinePar with AmdbId " << stType << " " << jzz << " " << jff << " " << job << "*** No MuonStation found\n"
387 << "PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use" );
388 continue;
389 }
390
391 if (job != 0) {
392 // job different than 0 (standard for TGC conditions for Sept 2010 repro.)
393 if (stType[0] == 'T') {
394 ATH_MSG_DEBUG( "ALinePar with AmdbId " << stType << " " << jzz << " " << jff << " " << job
395 << " has JOB not 0 - this is expected for TGC" );
396 } else {
397 ATH_MSG_WARNING("ALinePar with AmdbId " << stType << " " << jzz << " " << jff << " " << job
398 << " has JOB not 0 - this is NOT EXPECTED yet for non TGC chambers - skipping this A-line" );
399 continue;
400 }
401 }
402 if (job == 0) {
403 ATH_MSG_DEBUG( "Setting delta transform for Station " << ALine);
404 using Parameter = ALinePar::Parameter;
405 thisStation->setDelta_fromAline(ALine.getParameter(Parameter::transS),
406 ALine.getParameter(Parameter::transZ),
407 ALine.getParameter(Parameter::transT),
408 ALine.getParameter(Parameter::rotS),
409 ALine.getParameter(Parameter::rotZ),
410 ALine.getParameter(Parameter::rotT));
411
412 thisStation->clearCache();
413 thisStation->fillCache();
414 } else {
415 // job different than 0 (standard for TGC conditions for Sept 2010 repro.)
416 ATH_MSG_DEBUG( "Setting delta transform for component " << ALine);
417 thisStation->setDelta_fromAline_forComp(job,
418 ALine.getParameter(Parameter::transS),
419 ALine.getParameter(Parameter::transZ),
420 ALine.getParameter(Parameter::transT),
421 ALine.getParameter(Parameter::rotS),
422 ALine.getParameter(Parameter::rotZ),
423 ALine.getParameter(Parameter::rotT));
424
425 thisStation->getMuonReadoutElement(job)->refreshCache();
426
427 }
428 nUpdates++;
429 }
430 ATH_MSG_INFO( "# of A-lines read from the ALineMapContainer in StoreGate is " << nLines );
431 ATH_MSG_INFO( "# of deltaTransforms updated according to A-lines is " << nUpdates );
432 return StatusCode::SUCCESS;
433 }
434
436 ATH_MSG_DEBUG( "In updateDeformations()" );
437 if (blineData.empty()) {
438 ATH_MSG_DEBUG( "Got empty B-line container (expected for MC), not applying B-lines..." );
439 return StatusCode::SUCCESS;
440 } else
441 ATH_MSG_INFO( "temporary B-line container with size = " << blineData.size() );
442
443 // loop over the container of the updates passed by the MuonAlignmentDbTool
444 unsigned int nLines{0}, nUpdates{0};
445 for (const BLinePar& BLine : blineData) {
446 ++nLines;
447 const std::string stType = BLine.AmdbStation();
448 const int jff = BLine.AmdbPhi();
449 const int jzz = BLine.AmdbEta();
450 const int job = BLine.AmdbJob();
451 //********************
452 // NSW Cases
453 //********************
454 if (stType[0] == 'M' || stType[0] == 'S') {
455 if (!nMMRE() || !nsTgcRE()) {
456 ATH_MSG_WARNING("Unable to set B-line; the manager does not contain NSW readout elements" );
457 continue;
458 }
459 if (stType[0] == 'M') {
460 // Micromegas
461 const int array_idx = mmIdenToArrayIdx(BLine.identify());
462 MMReadoutElement* RE = m_mmcArray[array_idx].get();
463
464 if (!RE) {
465 ATH_MSG_WARNING("BlinePar with AmdbId " <<BLine<< " *** No MM readout element found\n"
466 << "PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
467 return StatusCode::FAILURE;
468 }
469 RE->setBLinePar(BLine);
470 } else if (stType[0] == 'S') {
471 // sTGC
472 const int array_idx = stgcIdentToArrayIdx(BLine.identify());
473 sTgcReadoutElement* RE = m_stgArray[array_idx].get();
474 if (!RE) {
475 ATH_MSG_WARNING("BlinePar with AmdbId " << BLine << " *** No sTGC 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 }
481 continue;
482 }
483
484 //********************
485 // MDT Cases
486 //********************
487 if (stType.at(0) == 'T' || stType.at(0) == 'C' || (stType.substr(0, 3) == "BML" && std::abs(jzz) == 7)) {
488 ATH_MSG_DEBUG( "BLinePar with AmdbId " << BLine << " is not a MDT station - skipping" );
489 continue;
490 }
491 ATH_MSG_DEBUG( "BLinePar with AmdbId " <<BLine << " is new ID = " << m_idHelperSvc->toString(BLine.identify()) );
492 if (job == 0) {
493 MuonStation* thisStation = getMuonStation(stType, jzz, jff);
494 if (!thisStation) {
495 ATH_MSG_WARNING("BLinePar with AmdbId " << BLine <<
496 " *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
497 "Geometry Layout in use");
498 continue;
499 }
500 ATH_MSG_DEBUG( "Setting deformation parameters for Station " << stType << " " << jzz << " " << jff << " ");
501 thisStation->setBline(&BLine);
502 nUpdates++;
503 } else {
504 ATH_MSG_WARNING("BLinePar with AmdbId " << stType << " " << jzz << " " << jff << " " << job << " has JOB not 0 ");
505 return StatusCode::FAILURE;
506 }
507 }
508 ATH_MSG_INFO( "# of B-lines read from the ALineMapContainer in StoreGate is " << nLines );
509 ATH_MSG_INFO( "# of deform-Transforms updated according to B-lines is " << nUpdates );
510 return StatusCode::SUCCESS;
511 }
512
514
515 if (ilineData.empty()) {
516 ATH_MSG_WARNING("Empty temporary CSC I-line container - nothing to do here" );
517 return StatusCode::SUCCESS;
518 } else
519 ATH_MSG_INFO( "temporary CSC I-line container with size = " << ilineData.size() );
520
521 // loop over the container of the updates passed by the MuonAlignmentDbTool
522 unsigned int nLines{0}, nUpdates{0};
523 for (const ALinePar& ILine : ilineData) {
524 nLines++;
525 const std::string stType = ILine.AmdbStation();
526 const int jff = ILine.AmdbPhi();
527 const int jzz = ILine.AmdbEta();
528 const int job = ILine.AmdbJob();
529 ATH_MSG_DEBUG( "CscInternalAlignmentPar with AmdbId " << ILine << " is new ID = " << m_idHelperSvc->toString(ILine.identify()) );
530 if (job == 3) {
531 MuonStation* thisStation = getMuonStation(stType, jzz, jff);
532 if (!thisStation) {
533 ATH_MSG_WARNING("CscInternalAlignmentPar with AmdbId " << ILine
534 << " *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
535 "Geometry Layout in use");
536 continue;
537 }
538 ATH_MSG_DEBUG( "Setting CSC I-Lines for Station " <<ILine);
539 CscReadoutElement* CscRE = dynamic_cast<CscReadoutElement*>(thisStation->getMuonReadoutElement(job));
540 if (!CscRE)
541 ATH_MSG_ERROR( "The CSC I-lines container includes stations which are no CSCs! This is impossible." );
542 else {
543 CscRE->setCscInternalAlignmentPar(ILine);
544 }
545 thisStation->refreshCache();
546
547 nUpdates++;
548
549 } else {
550 ATH_MSG_ERROR( "job for CSC I-Lines= " << job << " is not 3 => This is not valid." );
551 }
552 }
553 ATH_MSG_INFO( "# of CSC I-lines read from the ILineMapContainer in StoreGate is " << nLines );
554 ATH_MSG_INFO( "# of deltaTransforms updated according to A-lines is " << nUpdates );
555 return StatusCode::SUCCESS;
556 }
558
559 if (asbuiltData.empty()) {
560 ATH_MSG_WARNING("Empty temporary As-Built container - nothing to do here" );
561 return StatusCode::SUCCESS;
562 } else
563 ATH_MSG_INFO( "temporary As-Built container with size = " << asbuiltData.size() );
564
565 // loop over the container of the updates passed by the MuonAlignmentDbTool
566 unsigned int nLines{0}, nUpdates{0};
567 for (const auto& AsBuiltPar : asbuiltData) {
568 nLines++;
569 const std::string stType = AsBuiltPar.AmdbStation();
570 const int jff = AsBuiltPar.AmdbPhi();
571 const int jzz = AsBuiltPar.AmdbEta();
572
573 ATH_MSG_DEBUG( "MdtAsBuiltPar with AmdbId " << AsBuiltPar
574 << " is new ID = " << m_idHelperSvc->toString(AsBuiltPar.identify()) );
575
576 MuonStation* thisStation = getMuonStation(stType, jzz, jff);
577 if (thisStation) {
578
579 ATH_MSG_DEBUG( "Setting as-built parameters for Station " << AsBuiltPar );
580 thisStation->setMdtAsBuiltParams(&AsBuiltPar);
581 nUpdates++;
582 } else {
583 ATH_MSG_WARNING("MdtAsBuiltPar with AmdbId " <<AsBuiltPar
584 << " *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
585 "Geometry Layout in use");
586 continue;
587 }
588 }
589 ATH_MSG_INFO( "# of MDT As-Built read from the MdtAsBuiltMapContainer in StoreGate is " << nLines );
590 ATH_MSG_INFO( "# of deltaTransforms updated according to As-Built is " << nUpdates );
591 return StatusCode::SUCCESS;
592 }
593
595 m_nswAsBuilt = nswAsBuiltData;
596 }
597
599 m_stgcAsBuildData = stgcAsBuilt;
600 }
601
603#ifndef NDEBUG
604 if (id >= m_idHelperSvc->mdtIdHelper().detectorElement_hash_max()) {
605 ATH_MSG_WARNING(" try to getMdtReadoutElement with hashId " << (unsigned int)id << " outside range 0-"
606 << m_idHelperSvc->mdtIdHelper().detectorElement_hash_max() - 1 );
607 return nullptr;
608 }
609#endif
610 return m_mdtArray[id].get();
611 }
612
614#ifndef NDEBUG
615 if (id >= m_idHelperSvc->rpcIdHelper().detectorElement_hash_max()) {
616 ATH_MSG_WARNING(" try to getRpcReadoutElement with hashId " << (unsigned int)id << " outside range 0-"
617 << m_idHelperSvc->rpcIdHelper().detectorElement_hash_max() - 1 );
618 return nullptr;
619 }
620#endif
621 return m_rpcArray[id].get();
622 }
623
625#ifndef NDEBUG
626 if (id >= m_idHelperSvc->tgcIdHelper().detectorElement_hash_max()) {
627 ATH_MSG_WARNING(" try to getTgcReadoutElement with hashId " << (unsigned int)id << " outside range 0-"
628 << m_idHelperSvc->tgcIdHelper().detectorElement_hash_max() - 1 );
629 return nullptr;
630 }
631#endif
632 return m_tgcArray[id].get();
633 }
634
636#ifndef NDEBUG
637 if (id >= m_idHelperSvc->cscIdHelper().detectorElement_hash_max()) {
638 ATH_MSG_WARNING(" try to getCscReadoutElement with hashId " << (unsigned int)id << " outside range 0-"
639 << m_idHelperSvc->cscIdHelper().detectorElement_hash_max() - 1 );
640 return nullptr;
641 }
642#endif
643 return m_cscArray[id].get();
644 }
645
646 unsigned int MuonDetectorManager::rpcStationTypeIdx(const int stationName) const {
647 std::map<int, int>::const_iterator itr = m_rpcStatToIdx.find(stationName);
648 if (itr != m_rpcStatToIdx.end()) return itr->second;
650 }
651
652 int MuonDetectorManager::rpcStationName(const int stationIndex) const {
653 std::map<int, int>::const_iterator itr = m_rpcIdxToStat.find(stationIndex);
654 if (itr != m_rpcIdxToStat.end()) return itr->second;
655 return -1;
656 }
658
659 if (!m_idHelperSvc->hasRPC()) return;
660 const RpcIdHelper& rpcHelper{m_idHelperSvc->rpcIdHelper()};
661 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BML"), RpcStatType::BML));
662 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BMS"), RpcStatType::BMS));
663 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BOL"), RpcStatType::BOL));
664 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BOS"), RpcStatType::BOS));
665 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BMF"), RpcStatType::BMF));
666 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BOF"), RpcStatType::BOF));
667 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BOG"), RpcStatType::BOG));
668 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BME"), RpcStatType::BME));
669 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BIR"), RpcStatType::BIR));
670 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BIM"), RpcStatType::BIM));
671 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BIL"), RpcStatType::BIL));
672 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex("BIS"), RpcStatType::BIS));
673
674 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BML, rpcHelper.stationNameIndex("BML")));
675 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BMS, rpcHelper.stationNameIndex("BMS")));
676 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BOL, rpcHelper.stationNameIndex("BOL")));
677 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BOS, rpcHelper.stationNameIndex("BOS")));
678 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BMF, rpcHelper.stationNameIndex("BMF")));
679 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BOF, rpcHelper.stationNameIndex("BOF")));
680 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BOG, rpcHelper.stationNameIndex("BOG")));
681 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BME, rpcHelper.stationNameIndex("BME")));
682 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIR, rpcHelper.stationNameIndex("BIR")));
683 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIM, rpcHelper.stationNameIndex("BIM")));
684 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIL, rpcHelper.stationNameIndex("BIL")));
685 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIS, rpcHelper.stationNameIndex("BIS")));
686 }
687 void MuonDetectorManager::set_DBMuonVersion(const std::string& version) { m_DBMuonVersion = version; }
688 void MuonDetectorManager::setGeometryVersion(const std::string& version) { m_geometryVersion = version; }
692
693
694} // 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
#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
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
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10