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());
56 if (m_idHelperSvc->hasMM()){
57 m_mmcArray.resize(m_idHelperSvc->mmIdHelper().detectorElement_hash_max());
59 if (m_idHelperSvc->hasSTGC()){
60 m_stgArray.resize(m_idHelperSvc->stgcIdHelper().detectorElement_hash_max());
124 std::string
key =
muonStationKey(mst->getStationType(), mst->getEtaIndex(), mst->getPhiIndex());
130 if (statEtaIndex < 0)
144 return (*it).second.get();
154 return (*it).second.get();
163 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
id)<<
" which has been already added.");
178 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
x->identify())<<
" which has been already added.");
188 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
x->identify())<<
" which has been already added.");
199 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
id)<<
" which has been already added.");
208 return arrayIdx < 0 ? nullptr :
m_mdtArray[arrayIdx].get();
213 return arrayIdx < 0 ? nullptr :
m_mdtArray[arrayIdx].get();
220 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
id)<<
" which has been already added.");
229 return array_idx < 0 ? nullptr :
m_cscArray[array_idx].get();
234 return array_idx < 0 ? nullptr :
m_cscArray[array_idx].get();
241 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Trying to add ReadoutElement "<<
m_idHelperSvc->toStringDetEl(
id)<<
" which has been already added.");
251 return array_idx < 0 ? nullptr :
m_tgcArray[array_idx].get();
255 return array_idx < 0 ? nullptr :
m_tgcArray[array_idx].get();
259 return array_idx < 0 ? nullptr :
m_mmcArray[array_idx].get();
263 return array_idx < 0 ? nullptr :
m_stgArray[array_idx].get();
328 if (alineData.empty()) {
329 ATH_MSG_DEBUG(
"Got empty A-line container (expected for MC), not applying A-lines...");
330 return StatusCode::SUCCESS;
335 unsigned int nLines{0}, nUpdates{0};
336 for (
const ALinePar& ALine : alineData) {
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();
346 if (stType[0] ==
'M' || stType[0] ==
'S') {
348 ATH_MSG_WARNING(
"Unable to set A-line; the manager does not contain NSW readout elements" );
351 if (stType[0] ==
'M') {
358 <<
"PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
359 return StatusCode::FAILURE;
364 }
else if (stType[0] ==
'S') {
371 <<
"PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and Geometry Layout in use");
372 return StatusCode::FAILURE;
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" );
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" );
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" );
403 ATH_MSG_DEBUG(
"Setting delta transform for Station " << ALine);
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));
416 ATH_MSG_DEBUG(
"Setting delta transform for component " << ALine);
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));
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;
437 if (blineData.empty()) {
438 ATH_MSG_DEBUG(
"Got empty B-line container (expected for MC), not applying B-lines..." );
439 return StatusCode::SUCCESS;
441 ATH_MSG_INFO(
"temporary B-line container with size = " << blineData.size() );
444 unsigned int nLines{0}, nUpdates{0};
445 for (
const BLinePar& BLine : blineData) {
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();
454 if (stType[0] ==
'M' || stType[0] ==
'S') {
456 ATH_MSG_WARNING(
"Unable to set B-line; the manager does not contain NSW readout elements" );
459 if (stType[0] ==
'M') {
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;
470 }
else if (stType[0] ==
'S') {
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;
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" );
496 " *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
497 "Geometry Layout in use");
500 ATH_MSG_DEBUG(
"Setting deformation parameters for Station " << stType <<
" " << jzz <<
" " << jff <<
" ");
504 ATH_MSG_WARNING(
"BLinePar with AmdbId " << stType <<
" " << jzz <<
" " << jff <<
" " <<
job <<
" has JOB not 0 ");
505 return StatusCode::FAILURE;
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;
515 if (ilineData.empty()) {
516 ATH_MSG_WARNING(
"Empty temporary CSC I-line container - nothing to do here" );
517 return StatusCode::SUCCESS;
519 ATH_MSG_INFO(
"temporary CSC I-line container with size = " << ilineData.size() );
522 unsigned int nLines{0}, nUpdates{0};
523 for (
const ALinePar& ILine : ilineData) {
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()) );
534 <<
" *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
535 "Geometry Layout in use");
541 ATH_MSG_ERROR(
"The CSC I-lines container includes stations which are no CSCs! This is impossible." );
550 ATH_MSG_ERROR(
"job for CSC I-Lines= " <<
job <<
" is not 3 => This is not valid." );
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;
559 if (asbuiltData.empty()) {
560 ATH_MSG_WARNING(
"Empty temporary As-Built container - nothing to do here" );
561 return StatusCode::SUCCESS;
563 ATH_MSG_INFO(
"temporary As-Built container with size = " << asbuiltData.size() );
566 unsigned int nLines{0}, nUpdates{0};
567 for (
const auto& AsBuiltPar : asbuiltData) {
569 const std::string stType = AsBuiltPar.AmdbStation();
570 const int jff = AsBuiltPar.AmdbPhi();
571 const int jzz = AsBuiltPar.AmdbEta();
574 <<
" is new ID = " <<
m_idHelperSvc->toString(AsBuiltPar.identify()) );
579 ATH_MSG_DEBUG(
"Setting as-built parameters for Station " << AsBuiltPar );
584 <<
" *** No MuonStation found \n PLEASE CHECK FOR possible MISMATCHES between alignment constants from COOL and "
585 "Geometry Layout in use");
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;
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 );
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 );
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 );
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 );
653 std::map<int, int>::const_iterator itr =
m_rpcIdxToStat.find(stationIndex);
670 m_rpcStatToIdx.insert(std::make_pair(rpcHelper.stationNameIndex(
"BIM"), RpcStatType::BIM));
683 m_rpcIdxToStat.insert(std::make_pair(RpcStatType::BIM, rpcHelper.stationNameIndex(
"BIM")));