11 #include "GeoModelKernel/throwExcept.h"
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();
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();
40 if (m_idHelperSvc.retrieve().isFailure()) {
41 THROW_EXCEPTION(
"MuonDetectorManager() - No IdHelper svc is available");
44 if (m_idHelperSvc->hasMDT()){
45 m_mdtArray.resize(m_idHelperSvc->mdtIdHelper().detectorElement_hash_max());
47 if (m_idHelperSvc->hasCSC()){
48 m_cscArray.resize(m_idHelperSvc->cscIdHelper().detectorElement_hash_max());
50 if (m_idHelperSvc->hasTGC()){
51 m_tgcArray.resize(m_idHelperSvc->tgcIdHelper().detectorElement_hash_max());
53 if (m_idHelperSvc->hasRPC()){
54 m_rpcArray.resize(m_idHelperSvc->rpcIdHelper().detectorElement_hash_max());
57 if (m_idHelperSvc->hasMM()){
58 m_mmcArray.resize(m_idHelperSvc->mmIdHelper().detectorElement_hash_max());
60 if (m_idHelperSvc->hasSTGC()){
61 m_stgArray.resize(m_idHelperSvc->stgcIdHelper().detectorElement_hash_max());
122 std::string
key =
muonStationKey(mst->getStationType(), mst->getEtaIndex(), mst->getPhiIndex());
128 if (statEtaIndex < 0)
142 return (*it).second.get();
152 return (*it).second.get();
161 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
id)<<
" which has been already added.");
176 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
x->identify())<<
" which has been already added.");
186 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
x->identify())<<
" which has been already added.");
197 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
id)<<
" which has been already added.");
206 return arrayIdx < 0 ? nullptr :
m_mdtArray[arrayIdx].get();
211 return arrayIdx < 0 ? nullptr :
m_mdtArray[arrayIdx].get();
218 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
id)<<
" which has been already added.");
227 return array_idx < 0 ? nullptr :
m_cscArray[array_idx].get();
232 return array_idx < 0 ? nullptr :
m_cscArray[array_idx].get();
239 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
id)<<
" which has been already added.");
249 return array_idx < 0 ? nullptr :
m_tgcArray[array_idx].get();
253 return array_idx < 0 ? nullptr :
m_tgcArray[array_idx].get();
257 return array_idx < 0 ? nullptr :
m_mmcArray[array_idx].get();
261 return array_idx < 0 ? nullptr :
m_stgArray[array_idx].get();
326 if (alineData.empty()) {
327 ATH_MSG_DEBUG(
"Got empty A-line container (expected for MC), not applying A-lines...");
328 return StatusCode::SUCCESS;
333 unsigned int nLines{0}, nUpdates{0};
334 for (
const ALinePar& ALine : alineData) {
337 const std::string stType = ALine.AmdbStation();
338 const int jff = ALine.AmdbPhi();
339 const int jzz = ALine.AmdbEta();
340 const int job = ALine.AmdbJob();
344 if (stType[0] ==
'M' || stType[0] ==
'S') {
346 ATH_MSG_WARNING(
"Unable to set A-line; the manager does not contain NSW readout elements" );
349 if (stType[0] ==
'M') {
356 <<
"PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
357 return StatusCode::FAILURE;
362 }
else if (stType[0] ==
'S') {
369 <<
"PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
370 return StatusCode::FAILURE;
384 ATH_MSG_WARNING(
"ALinePar with AmdbId " << stType <<
" " << jzz <<
" " << jff <<
" " <<
job <<
"*** No MuonStation found\n"
385 <<
"PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use" );
391 if (stType[0] ==
'T') {
392 ATH_MSG_DEBUG(
"ALinePar with AmdbId " << stType <<
" " << jzz <<
" " << jff <<
" " <<
job
393 <<
" has JOB not 0 - this is expected for TGC" );
395 ATH_MSG_WARNING(
"ALinePar with AmdbId " << stType <<
" " << jzz <<
" " << jff <<
" " <<
job
396 <<
" has JOB not 0 - this is NOT EXPECTED yet for non TGC chambers - skipping this A-line" );
401 ATH_MSG_DEBUG(
"Setting delta transform for Station " << ALine);
404 ALine.getParameter(Parameter::transZ),
405 ALine.getParameter(Parameter::transT),
406 ALine.getParameter(Parameter::rotS),
407 ALine.getParameter(Parameter::rotZ),
408 ALine.getParameter(Parameter::rotT));
414 ATH_MSG_DEBUG(
"Setting delta transform for component " << ALine);
416 ALine.getParameter(Parameter::transS),
417 ALine.getParameter(Parameter::transZ),
418 ALine.getParameter(Parameter::transT),
419 ALine.getParameter(Parameter::rotS),
420 ALine.getParameter(Parameter::rotZ),
421 ALine.getParameter(Parameter::rotT));
428 ATH_MSG_INFO(
"# of A-lines read from the ALineMapContainer in StoreGate is " << nLines );
429 ATH_MSG_INFO(
"# of deltaTransforms updated according to A-lines is " << nUpdates );
430 return StatusCode::SUCCESS;
435 if (blineData.empty()) {
436 ATH_MSG_DEBUG(
"Got empty B-line container (expected for MC), not applying B-lines..." );
437 return StatusCode::SUCCESS;
439 ATH_MSG_INFO(
"temporary B-line container with size = " << blineData.size() );
442 unsigned int nLines{0}, nUpdates{0};
443 for (
const BLinePar& BLine : blineData) {
445 const std::string stType = BLine.AmdbStation();
446 const int jff = BLine.AmdbPhi();
447 const int jzz = BLine.AmdbEta();
448 const int job = BLine.AmdbJob();
452 if (stType[0] ==
'M' || stType[0] ==
'S') {
454 ATH_MSG_WARNING(
"Unable to set B-line; the manager does not contain NSW readout elements" );
457 if (stType[0] ==
'M') {
463 ATH_MSG_WARNING(
"BlinePar with AmdbId " <<BLine<<
" *** No MM readout element found\n"
464 <<
"PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
465 return StatusCode::FAILURE;
468 }
else if (stType[0] ==
'S') {
473 ATH_MSG_WARNING(
"BlinePar with AmdbId " << BLine <<
" *** No sTGC readout element found\n"
474 <<
"PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
475 return StatusCode::FAILURE;
485 if (stType.at(0) ==
'T' || stType.at(0) ==
'C' || (stType.substr(0, 3) ==
"BML" && std::abs(jzz) == 7)) {
486 ATH_MSG_DEBUG(
"BLinePar with AmdbId " << BLine <<
" is not a MDT station - skipping" );
494 " *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
495 "Geometry Layout in use");
498 ATH_MSG_DEBUG(
"Setting deformation parameters for Station " << stType <<
" " << jzz <<
" " << jff <<
" ");
502 ATH_MSG_WARNING(
"BLinePar with AmdbId " << stType <<
" " << jzz <<
" " << jff <<
" " <<
job <<
" has JOB not 0 ");
503 return StatusCode::FAILURE;
506 ATH_MSG_INFO(
"# of B-lines read from the ALineMapContainer in StoreGate is " << nLines );
507 ATH_MSG_INFO(
"# of deform-Transforms updated according to B-lines is " << nUpdates );
508 return StatusCode::SUCCESS;
513 if (ilineData.empty()) {
514 ATH_MSG_WARNING(
"Empty temporary CSC I-line container - nothing to do here" );
515 return StatusCode::SUCCESS;
517 ATH_MSG_INFO(
"temporary CSC I-line container with size = " << ilineData.size() );
520 unsigned int nLines{0}, nUpdates{0};
521 for (
const ALinePar& ILine : ilineData) {
523 const std::string stType = ILine.AmdbStation();
524 const int jff = ILine.AmdbPhi();
525 const int jzz = ILine.AmdbEta();
526 const int job = ILine.AmdbJob();
527 ATH_MSG_DEBUG(
"CscInternalAlignmentPar with AmdbId " << ILine <<
" is new ID = " <<
m_idHelperSvc->toString(ILine.identify()) );
532 <<
" *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
533 "Geometry Layout in use");
539 ATH_MSG_ERROR(
"The CSC I-lines container includes stations which are no CSCs! This is impossible." );
548 ATH_MSG_ERROR(
"job for CSC I-Lines= " <<
job <<
" is not 3 => This is not valid." );
551 ATH_MSG_INFO(
"# of CSC I-lines read from the ILineMapContainer in StoreGate is " << nLines );
552 ATH_MSG_INFO(
"# of deltaTransforms updated according to A-lines is " << nUpdates );
553 return StatusCode::SUCCESS;
557 if (asbuiltData.empty()) {
558 ATH_MSG_WARNING(
"Empty temporary As-Built container - nothing to do here" );
559 return StatusCode::SUCCESS;
561 ATH_MSG_INFO(
"temporary As-Built container with size = " << asbuiltData.size() );
564 unsigned int nLines{0}, nUpdates{0};
565 for (
const auto& AsBuiltPar : asbuiltData) {
567 const std::string stType = AsBuiltPar.AmdbStation();
568 const int jff = AsBuiltPar.AmdbPhi();
569 const int jzz = AsBuiltPar.AmdbEta();
572 <<
" is new ID = " <<
m_idHelperSvc->toString(AsBuiltPar.identify()) );
577 ATH_MSG_DEBUG(
"Setting as-built parameters for Station " << AsBuiltPar );
582 <<
" *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
583 "Geometry Layout in use");
587 ATH_MSG_INFO(
"# of MDT As-Built read from the MdtAsBuiltMapContainer in StoreGate is " << nLines );
588 ATH_MSG_INFO(
"# of deltaTransforms updated according to As-Built is " << nUpdates );
589 return StatusCode::SUCCESS;
602 if (
id >=
m_idHelperSvc->mdtIdHelper().detectorElement_hash_max()) {
603 ATH_MSG_WARNING(
" try to getMdtReadoutElement with hashId " << (
unsigned int)
id <<
" outside range 0-"
604 <<
m_idHelperSvc->mdtIdHelper().detectorElement_hash_max() - 1 );
613 if (
id >=
m_idHelperSvc->rpcIdHelper().detectorElement_hash_max()) {
614 ATH_MSG_WARNING(
" try to getRpcReadoutElement with hashId " << (
unsigned int)
id <<
" outside range 0-"
615 <<
m_idHelperSvc->rpcIdHelper().detectorElement_hash_max() - 1 );
624 if (
id >=
m_idHelperSvc->tgcIdHelper().detectorElement_hash_max()) {
625 ATH_MSG_WARNING(
" try to getTgcReadoutElement with hashId " << (
unsigned int)
id <<
" outside range 0-"
626 <<
m_idHelperSvc->tgcIdHelper().detectorElement_hash_max() - 1 );
635 if (
id >=
m_idHelperSvc->cscIdHelper().detectorElement_hash_max()) {
636 ATH_MSG_WARNING(
" try to getCscReadoutElement with hashId " << (
unsigned int)
id <<
" outside range 0-"
637 <<
m_idHelperSvc->cscIdHelper().detectorElement_hash_max() - 1 );
651 std::map<int, int>::const_iterator itr =
m_rpcIdxToStat.find(stationIndex);
668 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex(
"BIM"), RpcStatType::BIM));
681 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIM, rpcHelper.stationNameIndex(
"BIM")));