16#include "GeoModelKernel/GeoBox.h"
17#include "GeoModelKernel/GeoCons.h"
18#include "GeoModelKernel/GeoPara.h"
19#include "GeoModelKernel/GeoPgon.h"
20#include "GeoModelKernel/GeoShape.h"
21#include "GeoModelKernel/GeoShapeIntersection.h"
22#include "GeoModelKernel/GeoShapeShift.h"
23#include "GeoModelKernel/GeoShapeSubtraction.h"
24#include "GeoModelKernel/GeoShapeUnion.h"
25#include "GeoModelKernel/GeoTrap.h"
26#include "GeoModelKernel/GeoTrd.h"
27#include "GeoModelKernel/GeoTube.h"
28#include "GeoModelKernel/GeoTubs.h"
29#include "GeoModelKernel/GeoVolumeCursor.h"
95 return StatusCode::SUCCESS;
104 std::vector<std::pair<const GeoVPhysVol*, std::vector<GMInfo>>> stations =
retrieveGMsensitive(muonMgr);
106 for (
const auto& mstation : stations) {
114 std::string name = mstation.first->getLogVol()->getName();
116 if (name.substr(0, 4) ==
"sTGC" || name.substr(0, 2) ==
"MM") {
117 for (
unsigned int i = 0; i < mstation.second.size(); i++) {
118 std::string sName = name.substr(name.find(
'-') + 1);
122 mstation.second[0].first.inverse());
123 std::unique_ptr<Trk::DetachedTrackingVolume> newStat{msType->clone(name, trdef)};
125 Trk::Layer* layer = (newStat->layerRepresentation());
130 translatedStations.push_back(std::move(newStat));
133 for (
auto gminfo : mstation.second) {
135 std::unique_ptr<Trk::DetachedTrackingVolume> newStat{msType->clone(name, gminfo.first)};
137 Trk::Layer* layer = newStat->layerRepresentation();
146 translatedStations.push_back(std::move(newStat));
151 ATH_MSG_DEBUG(
"returns " << translatedStations.size() <<
" stations");
152 return translatedStations;
161 std::span<Trk::TrackingVolume* const> components = volArray->
arrayObjects();
170 if (cubVolBounds && binUtilityX) {
175 if (low >= 0 && up >= 0) {
177 for (
unsigned int i = 0; i < components.size() - 1; ++i) {
192 const std::string stationStr = stationName.substr(0, 3);
193 bool is_valid{
false};
197 stationStr, cscEtaSt,
phi + 1, 1, 1, 0, 1, is_valid);
202 stationStr, cscEtaSt,
phi + 1, 2, 1, 0, 1, is_valid);
207 for (
int gasgap = 0; gasgap < cscRE->
Ngasgaps(); gasgap++) {
221 if (assocVol && assocLay) {
232 }
else if (stationStr[0] ==
'T') {
235 if (stationStr ==
"T1F") {
237 }
else if (stationStr ==
"T1E") {
239 }
else if (stationStr ==
"T2F") {
241 }
else if (stationStr ==
"T2E") {
243 }
else if (stationStr ==
"T3F") {
245 }
else if (stationStr ==
"T3E") {
247 }
else if (stationStr ==
"T4F") {
251 const int stationName =
256 auto getReadout = [stationName,
stationEta, muonMgr, &idHelper](
int phi) {
258 bool is_valid{
false};
260 return is_valid ? muonMgr->getTgcReadoutElement(
id) :
nullptr;
265 unsigned int phit = 0;
304 std::span<Trk::Layer* const> layers =
307 for (
unsigned int il = 0; il < layers.size(); il++) {
308 wireId = idHelper.
channelID(stationStr, etaSt, phiSt, il + 1, 1, 1, validId);
311 layers[il]->setLayerType(1);
314 layers[il]->setLayerType(
id);
318 if ((layers[il]->surfaceRepresentation().transform().inverse() * stripSurf->center()).mag() > 0.001)
320 <<
":"<< layers[il]->surfaceRepresentation().transform().inverse() * stripSurf->center());
326 <<
"," <<
eta <<
"," <<
phi);
329 (stationName[0] ==
'B' || stationName[0] ==
'E')) {
335 std::span<Trk::TrackingVolume* const> cVols =
337 for (
auto* cVol : cVols) {
338 if (cVol->confinedLayers()) {
339 std::span<Trk::Layer* const> cLays = cVol->confinedLayers()->arrayObjects();
341 bool is_valid{
false};
343 for (
auto* cLay : cLays) {
355 cLay->setLayerType(newid);
358 double ref = cLay->getRef();
362 double loc = (cLay->surfaceRepresentation().transform().inverse() * mdtROE->
tubePos(newId))[1];
363 if (std::abs(
ref) > 10e6) {
364 double sign = (
ref > 0.) ? 1. : -1.;
365 int dec = int(
ref / 1e5);
367 0.5 * (
sign + 1) * 1e5;
368 if (std::abs(
ref - loc) > 0.001) {
369 cLay->setRef(loc + dec * 1e5 + 0.5 * (
sign + 1) * 1e5);
371 }
else if (std::abs(
ref - loc) > 0.001) {
378 if (!cVol->confinedArbitraryLayers().empty()) {
381 for (
auto* cLay : cLays) {
383 bool is_valid{
false};
388 1, idHelper.
strip(
id),
391 cLay->setLayerType(newid);
400 std::span<Trk::TrackingVolume* const> cVols =
402 for (
auto* cVol : cVols) {
403 if (cVol->confinedLayers()) {
404 std::span<Trk::Layer* const> cLays =
405 cVol->confinedLayers()->arrayObjects();
406 for (
unsigned int il = 0; il < cLays.size(); il++) {
410 <<
"," << cVol->volumeName()
411 <<
", unidentified active layer:" << il);
414 " subvolume " + cVol->volumeName(),
415 muonMgr,
id, cLays[il]);
418 if (!cVol->confinedArbitraryLayers().empty()) {
420 cVol->confinedArbitraryLayers();
421 for (
unsigned int il = 0; il < cLays.size(); il++) {
425 <<
"," << cVol->volumeName()
426 <<
", unidentified active layer:" << il);
429 station->
name() +
" subvolume " +
431 muonMgr,
id, cLays[il]);
437 std::span<Trk::Layer* const> cLays =
439 for (
unsigned int il = 0; il < cLays.size(); il++) {
443 <<
"," << station->
name()
444 <<
", unidentified active layer:" << il);
447 muonMgr,
id, cLays[il]);
459 const bool isStgc{station.
name().substr(0, 4) ==
"sTGC"};
460 const bool isMm{station.
name().substr(0, 2) ==
"MM"};
461 if (!isMm && !isStgc)
return;
462 for (
unsigned int il = 0; il < lays.size(); il++) {
481 const std::string& stationName = station.
volumeName();
483 const std::string stationNameShort = stationName.substr(0, 3);
484 const char stationFirstChar = stationName[0];
485 bool is_valid{
false};
487 if (
m_idHelperSvc->hasMDT() && (stationFirstChar ==
'B' || stationFirstChar ==
'E')) {
491 for (
int multi = 1; multi <= 2; ++multi) {
506 for (
int layer = 1; layer <= nLayers; ++layer) {
514 assocLay->
setLayerType(
id.get_identifier32().get_compact());
521 if (confinedVolumes) {
522 std::span<Trk::TrackingVolume* const> vols = confinedVolumes->
arrayObjects();
523 for (
auto* vol : vols) {
524 if (!
m_idHelperSvc->hasRPC() || vol->volumeName() !=
"RPC") {
530 int nameIndex =
m_idHelperSvc->rpcIdHelper().stationNameIndex(stationNameShort);
532 if (stationNameShort ==
"BME" || stationNameShort ==
"BMG") {
543 if (stationNameShort.find(
"BMS") != std::string::npos && (std::abs(
eta) == 2 || std::abs(
eta) == 4)) {
546 else if (stationNameShort.find(
"BOG") != std::string::npos) {
547 if (std::abs(
eta) == 7 || std::abs(
eta) == 8) {
552 }
else if (stationNameShort.find(
"BOF") != std::string::npos && std::abs(
eta) == 4){
557 for (
int doubletR = 1; doubletR <= 2; ++doubletR) {
563 for (
int doubletZ = 1; doubletZ <= doubletZMax; ++doubletZ) {
564 for (
int doubletPhi = 1; doubletPhi <= 2; doubletPhi++) {
581 for (
auto* layer : layers) {
582 if (layer->layerType() == 0 ||
583 !layer->surfaceRepresentation().isOnSurface(stripLocPos,
false, 0.5* layer->thickness())){
586 const Amg::Vector3D locPos1 =layer->surfaceRepresentation().transform().inverse() * stripLocPos;
589 double swap = (std::abs(locPos1[1] - locPos2[0]) > 0.001) ? 20000. : 0.;
594 const Amg::Vector3D locPos = layer->surfaceRepresentation().transform() *
596 layer->setRef(
swap + locPos[0]);
610 for (
auto* cVol : cVols) {
611 if (cVol->confinedLayers()) {
612 std::span<Trk::Layer* const> cLays = cVol->confinedLayers()->arrayObjects();
613 for (
unsigned int il = 0; il < cLays.size(); il++) {
620 if (!cVol->confinedArbitraryLayers().empty()) {
622 for (
unsigned int il = 0; il < cLays.size(); il++) {
633 for (
unsigned int il = 0; il < cLays.size(); il++) {
645 std::vector<std::pair<std::pair<const GeoLogVol*, Trk::MaterialProperties*>,
646 std::vector<Amg::Transform3D>>>& vols,
647 std::vector<std::string>& volNames)
const {
652 unsigned int nc = pv->getNChildVols();
654 << pv->getLogVol()->getName() <<
","
655 << pv->getLogVol()->getMaterial()->getName()
656 <<
", looping over " << nc <<
" children");
658 for (
unsigned int ic = 0; ic < nc; ic++) {
660 const GeoVPhysVol* cv = pv->getChildVol(ic);
661 const GeoLogVol* clv = cv->getLogVol();
662 std::string childName = clv->getName();
663 ATH_MSG_DEBUG(
"getNSWStationsForTranslation child " << childName);
665 if (childName.empty()) {
666 childName =
"Spacer";
668 if (childName.size() > 9 && childName.substr(childName.size() - 9, 9) ==
"Sensitive") {
669 childName += std::to_string(ic);
672 std::string cName = childName.compare(0, 3,
"NSW") == 0 || childName.compare(0, 8,
"NewSmall") == 0
673 ? name : name + childName;
676 if (!cv->getNChildVols()) {
678 for (
unsigned int is = 0; is < vols.size(); is++) {
679 if (cName == volNames[is]) {
680 if (std::abs((transform * transf).translation().
perp() -
681 vols[is].second.front().translation().perp()) <
686 double phiTr = (transform * transf).translation().phi();
687 if (phiTr > -0.001 && phiTr < 0.4) {
688 vols[is].second.insert(vols[is].second.begin(),
691 vols[is].second.push_back(transform * transf);
694 << clv->getName() <<
","
695 << (transform * transf).translation().perp() <<
","
696 << (transform * transf).translation().z() <<
","
704 std::vector<Amg::Transform3D> volTr;
705 volTr.push_back(transform * transf);
709 if (pv->getLogVol()->getMaterial()->getName() !=
"Ether" &&
710 (childName ==
"MM_Frame" || childName ==
"sTGC_Frame")) {
714 pv->getLogVol()->getMaterial());
723 std::pair<const GeoLogVol*, Trk::MaterialProperties*> cpair(
724 pv->getLogVol(), nMat);
725 vols.emplace_back(cpair, volTr);
727 volNames.push_back(cName);
730 << clv->getMaterial()->getName() <<
", "
731 << volTr.back().translation().z() <<
", "
732 << volTr.back().translation().phi()
744std::vector<std::pair<const GeoVPhysVol*, std::vector<GMInfo>>>
749 std::vector<std::pair<
const GeoVPhysVol*,
750 std::vector<GMInfo>>> sensitive;
758 if (sTGC_top && sTGC_top !=
top) {
759 ATH_MSG_DEBUG(
"sTGC GeoModel branch found:" << sTGC_top->getLogVol()->getName());
760 GeoVolumeCursor vol(sTGC_top);
761 while (!vol.atEnd()) {
762 const GeoVPhysVol* cv = vol.getVolume();
763 const std::string& vname = cv->getLogVol()->getName();
764 if (vname.find(
"sTGC_1") == std::string::npos) {
768 std::vector<std::pair<
const GeoVPhysVol*,
771 while (it < sensitive.end()) {
772 if (vname == (*it).first->getLogVol()->getName() &&
773 m_gmBrowser.compareGeoVolumes(cv, (*it).first, 1.e-3) == 0)
778 if (it == sensitive.end()) {
779 std::vector<std::pair<Amg::Transform3D, int>> cloneList;
780 cloneList.emplace_back(vol.getTransform(), 0);
781 sensitive.emplace_back(cv, cloneList);
785 double phiTr = transf.translation().phi();
786 if (phiTr > -0.001 && phiTr < 0.4)
787 (*it).second.insert((*it).second.begin(),
788 std::make_pair(vol.getTransform(), 0));
790 (*it).second.emplace_back(vol.getTransform(), 0);
796 if (MM_top && MM_top !=
top) {
797 ATH_MSG_DEBUG(
"MM GeoModel branch found:" << MM_top->getLogVol()->getName());
798 GeoVolumeCursor vol(MM_top);
799 while (!vol.atEnd()) {
800 const GeoVPhysVol* cv = vol.getVolume();
801 const std::string& vname = cv->getLogVol()->getName();
802 if (vname.find(
"MM_1") == std::string::npos) {
806 std::vector<std::pair<
const GeoVPhysVol*,
809 while (it < sensitive.end()) {
810 if (vname == (*it).first->getLogVol()->getName() &&
811 m_gmBrowser.compareGeoVolumes(cv, (*it).first, 1.e-3) == 0)
816 if (it == sensitive.end()) {
817 std::vector<std::pair<Amg::Transform3D, int>> cloneList;
818 cloneList.emplace_back(vol.getTransform(), 0);
819 sensitive.emplace_back(cv, cloneList);
823 double phiTr = transf.translation().phi();
824 if (phiTr > -0.001 && phiTr < 0.4)
825 (*it).second.insert((*it).second.begin(), std::make_pair(vol.getTransform(), 0));
827 (*it).second.emplace_back(vol.getTransform(), 0);
833 GeoVolumeCursor vol(
top);
834 while (!vol.atEnd()) {
835 const GeoVPhysVol* cv = &(*(vol.getVolume()));
836 const std::string& vname = cv->getLogVol()->getName();
837 if (vname.find(
"Station") == std::string::npos &&
838 vname.find(
"MM_1") == std::string::npos &&
839 vname.find(
"sTGC_1") == std::string::npos) {
845 if (vname.substr(0, 1) ==
"T") {
848 const GeoLogVol* tlv = tv->getLogVol();
850 const std::string& tgc_name = tlv->getName();
852 std::vector<std::pair<
const GeoVPhysVol*,
855 while (it < sensitive.end()) {
856 if (tgc_name == (*it).first->getLogVol()->getName() &&
857 m_gmBrowser.compareGeoVolumes(tv, (*it).first, 1.e-3) ==
863 if (it == sensitive.end()) {
864 std::vector<std::pair<Amg::Transform3D, int>> cloneList;
865 cloneList.emplace_back(transform, vol.getId().value());
866 sensitive.emplace_back(tv, cloneList);
870 double phiTr = transf.translation().phi();
871 if (phiTr > -0.001 && phiTr < 0.4) {
872 (*it).second.insert((*it).second.begin(),
873 std::make_pair(transform, vol.getId().value()));
876 (*it).second.emplace_back(transform, vol.getId().value());
884 std::vector<std::pair<
const GeoVPhysVol*,
887 while (it < sensitive.end()) {
888 if (vname == (*it).first->getLogVol()->getName() &&
889 m_gmBrowser.compareGeoVolumes(cv, (*it).first, 1.e-3) == 0)
894 if (it == sensitive.end()) {
895 std::vector<std::pair<Amg::Transform3D, int>> cloneList;
896 cloneList.emplace_back(vol.getTransform(), vol.getId().value());
897 sensitive.emplace_back(cv, cloneList);
901 double phiTr = transf.translation().phi();
902 if (phiTr > -0.001 && phiTr < 0.4) {
903 (*it).second.insert((*it).second.begin(),
904 std::make_pair(vol.getTransform(), vol.getId().value()));
907 (*it).second.emplace_back(vol.getTransform(), vol.getId().value());
914 ATH_MSG_DEBUG(
"Number of muon station types in GeoModel tree:" << sensitive.size());
919std::unique_ptr<Trk::DetachedTrackingVolume>
921 const GeoVPhysVol* cv,
922 const GMInfo& gmInfo)
const {
923 const GeoLogVol* clv = cv->getLogVol();
924 const std::string& vname = clv->getName();
925 ATH_MSG_DEBUG(name() <<
" building station prototype for " << cv->getLogVol()->getName());
929 std::unique_ptr<Trk::DetachedTrackingVolume> typeStat{};
931 if (vname.substr(0, 4) ==
"sTGC" || vname.substr(0, 2) ==
"MM") {
932 std::string sName = vname.substr(vname.find(
'-') + 1);
935 if (vname.substr(0, 4) ==
"sTGC" &&
m_idHelperSvc->issTgc(nswId)) {
937 }
else if (vname.substr(0, 2) ==
"MM" &&
m_idHelperSvc->isMM(nswId)) {
946 if (!
m_buildCsc && vname.compare(0, 1,
"C") == 0)
948 if (!
m_buildTgc && vname.compare(0, 1,
"T") == 0)
951 int etaphi = gmInfo.second;
952 int sign = (etaphi < 0) ? -1 : 1;
953 etaphi =
sign * etaphi;
954 int is_mirr = etaphi / 1000;
955 etaphi = etaphi - is_mirr * 1000;
956 int eta = etaphi / 100;
957 int phi = etaphi -
eta * 100;
965 int etaphi = gmInfo.second;
966 int a_etaphi =
static_cast<int>(etaphi / 100000);
967 int sideC =
static_cast<int>(a_etaphi / 10000);
968 a_etaphi -= sideC * 10000;
969 is_mirr =
static_cast<int>(a_etaphi / 1000);
970 a_etaphi -= is_mirr * 1000;
971 eta =
static_cast<int>(a_etaphi / 100);
972 phi = a_etaphi -
eta * 100;
978 std::string stname = (vname.compare(0, 1,
"T") == 0) ? vname : (clv->getName()).substr(0, vname.size() - 8);
980 if (stname.compare(0, 1,
"B") == 0 &&
eta < 0) {
981 stname = (clv->getName()).substr(0, vname.size() - 8) +
"-";
983 ATH_MSG_VERBOSE(
" new station type " << stname <<
"," << clv->getShape()->type());
986 if (stname.compare(0, 2,
"CS") == 0 || stname.compare(0, 1,
"T") == 0) {
988 if (stname.compare(0, 2,
"CS") == 0) {
993 auto layerVec = std ::make_unique<std::vector<Trk::Layer*>>(
Muon::release(layerRepr.second));
994 typeStat = std::make_unique<Trk::DetachedTrackingVolume>(stname, std::move(csc_station),
995 std::move(layerRepr.first), std::move(layerVec));
1001 auto layerVec = std ::make_unique<std::vector<Trk::Layer*>>(
Muon::release(layerRepr.second));
1002 typeStat = std::make_unique<Trk::DetachedTrackingVolume>(stname, std::move(tgc_station),
1003 std::move(layerRepr.first), std::move(layerVec));
1007 const GeoShape* shapeS = clv->getShape();
1008 while (shapeS->type() !=
"Trd") {
1009 if (shapeS->type() ==
"Shift") {
1010 const GeoShapeShift* shift =
dynamic_cast<const GeoShapeShift*
>(shapeS);
1011 shapeS = shift->getOp();
1012 }
else if (shapeS->type() ==
"Subtraction") {
1013 const GeoShapeSubtraction* sub =
dynamic_cast<const GeoShapeSubtraction*
>(shapeS);
1014 shapeS = sub->getOpA();
1015 }
else if (shapeS->type() ==
"Union") {
1016 const GeoShapeUnion* uni =
dynamic_cast<const GeoShapeUnion*
>(shapeS);
1017 shapeS = uni->getOpA();
1019 ATH_MSG_WARNING(
"unexpected station shape ? "<< shapeS->type() <<
", station not built");
1023 const GeoTrd* trd =
dynamic_cast<const GeoTrd*
>(shapeS);
1025 double halfX1{0.}, halfX2{0.}, halfY1{0.}, halfY2{0.}, halfZ{0.};
1028 halfX1 = trd->getXHalfLength1();
1029 halfX2 = trd->getXHalfLength2();
1030 halfY1 = trd->getYHalfLength1();
1031 halfY2 = trd->getYHalfLength2();
1032 halfZ = trd->getZHalfLength();
1035 std::unique_ptr<Trk::TrackingVolumeArray> confinedVolumes{};
1036 std::vector<std::unique_ptr<Trk::Layer>> confinedLayers{};
1037 std::unique_ptr<Trk::Volume> envelope;
1038 std::string shape =
"Trd";
1039 if (halfX1 == halfX2 && halfY1 == halfY2)
1041 if (shape ==
"Box") {
1042 auto envBounds = std::make_shared<Trk::CuboidVolumeBounds>(halfX1, halfY1, halfZ);
1045 if (!confinedVolumes) {
1049 envelope = std::make_unique<Trk::Volume>(
nullptr, std::move(envBounds));
1050 }
else if (shape ==
"Trd") {
1051 std::unique_ptr<Trk::TrapezoidVolumeBounds> envBounds{};
1053 if (halfY1 == halfY2) {
1054 envBounds = std::make_unique<Trk::TrapezoidVolumeBounds>(halfX1, halfX2, halfY1, halfZ);
1055 ATH_MSG_VERBOSE(
"CAUTION!!!: this trapezoid volume does not require XY -> YZ switch");
1057 if (halfY1 != halfY2 && halfX1 == halfX2) {
1059 envBounds = std::make_unique<Trk::TrapezoidVolumeBounds>(halfY1, halfY2, halfZ, halfX1);
1061 if (halfX1 != halfX2 && halfY1 != halfY2) {
1068 envelope = std::make_unique<Trk::Volume>(
makeTransform(transf), std::move(envBounds));
1074 std::unique_ptr<Trk::TrackingVolume> newType{};
1075 if (!confinedLayers.empty()) {
1076 auto confinedLayerPtr = std::make_unique<std::vector<Trk::Layer*>>(
Muon::release(confinedLayers));
1077 newType = std::make_unique<Trk::TrackingVolume>(*envelope,
m_muonMaterial, std::move(confinedLayerPtr), stname);
1079 newType = std::make_unique<Trk::TrackingVolume>(*envelope,
m_muonMaterial,
nullptr, std::move(confinedVolumes), stname);
1084 if ((stname.compare(0, 1,
"B") == 0 || stname.compare(0, 1,
"E") == 0))
1091 auto layerVec = std::make_unique<std::vector<Trk::Layer*>>(
Muon::release(layerRepr.second));
1092 typeStat = std::make_unique<Trk::DetachedTrackingVolume>(stname, std::move(newType),
1093 std::move(layerRepr.first),
1094 std::move(layerVec));
1110 int etaphi = gm_info.second;
1111 int sign = (etaphi < 0) ? -1 : 1;
1112 etaphi =
sign * etaphi;
1113 int is_mirr = etaphi / 1000;
1114 etaphi = etaphi - is_mirr * 1000;
1116 phi = etaphi -
eta * 100;
1126 int etaphi = gm_info.second;
1127 int a_etaphi =
static_cast<int>(etaphi / 100000);
1128 int sideC =
static_cast<int>(a_etaphi / 10000);
1129 a_etaphi -= sideC * 10000;
1130 is_mirr =
static_cast<int>(a_etaphi / 1000);
1131 a_etaphi -= is_mirr * 1000;
1132 eta =
static_cast<int>(a_etaphi / 100);
1133 phi = a_etaphi -
eta * 100;
1144 if (vname.compare(0, 1,
"T") == 0 || vname.compare(0, 1,
"C") == 0) {
1145 stName = vname.substr(0, 4);
1147 stName = (vname.substr(0, vname.size() - 8));
1148 if (
stName.compare(0, 1,
"B") == 0 &&
eta < 0) {
1149 stName = vname.substr(0, vname.size() - 8) +
"-";
1155 bool is_valid{
false};
1161 if (vname.compare(0, 1,
"C") == 0) {
1163 if (transf.translation().z() < 0)
1165 double phic = transf.translation().phi() + 0.1;
1167 static_cast<int>(phic < 0 ? 4 * phic /
M_PI + 8 : 4 * phic /
M_PI);
1169 if (vname.compare(0, 1,
"T") == 0) {
1171 std::string sub = vname.substr(7, 2);
1172 if (transf.translation().z() < 0)
1176 else if (sub ==
"02")
1178 else if (sub ==
"03")
1180 else if (sub ==
"04")
1182 else if (sub ==
"05")
1184 else if (sub ==
"06")
1186 else if (sub ==
"07")
1188 else if (sub ==
"08")
1190 else if (sub ==
"09")
1192 else if (sub ==
"10")
1194 else if (sub ==
"11")
1196 else if (sub ==
"12")
1198 else if (sub ==
"13")
1200 else if (sub ==
"14")
1202 else if (sub ==
"15")
1204 else if (sub ==
"16")
1206 else if (sub ==
"17")
1208 else if (sub ==
"18")
1210 else if (sub ==
"19")
1212 else if (sub ==
"20")
1214 else if (sub ==
"21")
1216 else if (sub ==
"22")
1220 int etaSt =
eta - 4;
1223 double phic = transf.translation().phi();
1224 if (vname.compare(2, 1,
"E") == 0 && vname.compare(0, 3,
"T4E") != 0)
1225 phi =
static_cast<int>(phic < 0 ? 24 * phic /
M_PI + 48
1226 : 24 * phic /
M_PI);
1228 phi =
static_cast<int>(phic < 0 ? 12 * phic /
M_PI + 24
1229 : 12 * phic /
M_PI);
1231 stId =
m_idHelperSvc->tgcIdHelper().elementID(vname.substr(0, 3), etaSt,
1242 << vname <<
"," <<
eta <<
"," <<
phi);
1255 constexpr double tol = 0.5*Gaudi::Units::mm;
1257 ATH_MSG_DEBUG(__FILE__<<
":"<<__LINE__<<
" "<<comment <<
":tube(id) "
const boost::regex ref(r_ef)
Scalar eta() const
pseudorapidity method
Scalar perp() const
perp method - perpendicular length
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
void swap(DataVector< T > &a, DataVector< T > &b)
See DataVector<T, BASE>::swap().
Visitor to process all volumes under a GeoModel node.
GeoVolumeVec_t geoGetVolumes(const GeoGraphNode *node, int depthLimit=1, int sizeHint=20)
Return the child volumes and associated transforms.
Identifier channelID(int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer, int measuresPhi, int strip) const
value_type get_compact() const
Get the compact id.
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
int multilayer(const Identifier &id) const
Access to components of the ID.
int tube(const Identifier &id) const
int tubeLayer(const Identifier &id) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
int multilayer(const Identifier &id) const
Amg::Vector3D tubePos(const Identifier &id) const
Returns the global position of the given tube.
int getNLayers() const
Returns the number of tube layers inside the multilayer.
virtual const Amg::Transform3D & transform(const Identifier &id) const override final
Return local to global transform associated with this identifier.
virtual const Amg::Vector3D & center(const Identifier &) const override final
Return the center of the surface associated with this identifier In the case of silicon it returns th...
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
virtual const Amg::Vector3D & center() const override
Return the center of the element.
virtual const Amg::Transform3D & transform() const override
Return local to global transform.
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
static constexpr int NCscStEtaOffset
Identifier <-> AMDB conversion constants in use.
const CscIdHelper * cscIdHelper() const
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
virtual PVConstLink getTreeTop(unsigned int i) const
const MuonStation * getMuonStation(const std::string &stName, int eta, int phi) const
static constexpr int NTgcStEtaOffset
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
static constexpr int NTgcStatTypeOff
int getStationPhi() const
int getStationEta() const
Identifier identify() const override final
Returns the ATLAS Identifier of the MuonReadOutElement.
Amg::Transform3D getTransform() const
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
Amg::Vector3D stripPos(const Identifier &id) const
virtual int numberOfLayers(bool measphi=true) const override final
number of layers in phi/eta projection, same for eta/phi planes
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
int stationNameIndex(const std::string &name) const
int stationEta(const Identifier &id) const
int stationName(const Identifier &id) const
Gaudi::Property< bool > m_buildCsc
void identifyLayers(Trk::DetachedTrackingVolume *, Identifier, int, int, const MuonGM::MuonDetectorManager *) const
Trk::Material m_muonMaterial
the material
void identifyNSWLayers(Trk::DetachedTrackingVolume &station, const Identifier &id) const
virtual StatusCode initialize() override
Gaudi::Property< bool > m_buildEndcap
void checkLayerId(std::string_view comment, const MuonGM::MuonDetectorManager *muonMgr, Identifier id, const Trk::Layer *lay) const
void identifyPrototype(Trk::TrackingVolume &station, int eta, int phi, const Amg::Transform3D &transf, const MuonGM::MuonDetectorManager *muonMgr) const
ToolHandle< Muon::MuonStationTypeBuilder > m_muonStationTypeBuilder
Helper Tool to create TrackingVolume Arrays.
DetachedVolVec buildDetachedTrackingVolumesImpl(const MuonGM::MuonDetectorManager *muonMgr, bool blend=false) const
Gaudi::Property< bool > m_buildTgc
void glueComponents(Trk::DetachedTrackingVolume *) const
Identifier resolveId(const std::string &vname, const GMInfo &gm_info, int &eta, int &phi, const MuonGM::MuonDetectorManager *muonMgr) const
std::pair< Amg::Transform3D, int > GMInfo
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
std::vector< std::unique_ptr< Trk::DetachedTrackingVolume > > DetachedVolVec
Trk::GMTreeBrowser m_gmBrowser
std::unique_ptr< Trk::DetachedTrackingVolume > buildDetachedTrackingVolumeType(const MuonGM::MuonDetectorManager *muonMgr, const GeoVPhysVol *gv, const GMInfo &info) const
ToolHandle< Trk::ITrackingVolumeHelper > m_trackingVolumeHelper
Helper Tool to create TrackingVolumes.
std::vector< std::pair< const GeoVPhysVol *, std::vector< GMInfo > > > retrieveGMsensitive(const MuonGM::MuonDetectorManager *muonMgr) const
MuonStationBuilderImpl(const std::string &, const std::string &, const IInterface *)
Gaudi::Property< bool > m_buildBarrel
void getNSWStationsForTranslation(const GeoVPhysVol *pv, const std::string &name, const Amg::Transform3D &, std::vector< std::pair< std::pair< const GeoLogVol *, Trk::MaterialProperties * >, std::vector< Amg::Transform3D > > > &vols, std::vector< std::string > &volNames) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
int gasGap(const Identifier &id) const override
get the hashes
Identifier elementID(int stationName, int stationEta, int stationPhi, int doubletR) const
int doubletPhi(const Identifier &id) const
int doubletR(const Identifier &id) const
int strip(const Identifier &id) const
int doubletZ(const Identifier &id) const
Identifier elementID(int stationName, int stationEta, int stationPhi) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
Binned Array for avoiding map searches/.
virtual const BinUtility * binUtility() const =0
Return the BinUtility.
virtual unsigned int arrayObjectsNumber() const =0
Number of Entries in the Array.
virtual std::span< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
Bounds for a cubical Volume, the decomposeToSurfaces method creates a vector of 6 surfaces:
Base Class for a navigation object (active/passive) in the Tracking realm.
const std::string & name() const
returns the Name
const Layer * layerRepresentation() const
returns layer representation
const TrackingVolume * trackingVolume() const
returns the TrackingVolume
static const GeoVPhysVol * findTopBranch(const GeoVPhysVol *gv, std::string_view name)
search of top branch : returns mother volume for children matching name
static Material convert(const GeoMaterial *gm)
Single conversion , input type GeoMaterial - output type Trk::MaterialProperties.
Base Class for a Detector Layer in the Tracking realm.
int layerType() const
get the Layer coding
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
void setRef(double)
set the reference measure
void setLayerType(int identifier)
set the Layer coding
Material with information about thickness of material.
float thicknessInX0() const
Return the radiationlength fraction.
void addMaterial(const Material &mp, float dInX0)
Material averaging.
float x0() const
Return the radiation length.
float thickness() const
Return the thickness in mm.
A common object to be contained by.
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
virtual bool isOnSurface(const Amg::Vector3D &glopo, const BoundaryCheck &bchk=true, double tol1=0., double tol2=0.) const
This method returns true if the GlobalPosition is on the Surface for both, within or without check of...
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
const LayerArray * confinedLayers() const
Return the subLayer array.
const Layer * associatedLayer(const Amg::Vector3D &gp) const
Return the associated Layer.
const TrackingVolumeArray * confinedVolumes() const
Return the subLayer array.
const TrackingVolume * associatedSubVolume(const Amg::Vector3D &gp) const
Return the associated sub Volume, returns THIS if no subVolume exists.
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
int multilayer(const Identifier &id) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int channel) const
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
bool doesNotDeform(const Amg::Transform3D &trans)
Checks whether the linear part of the transformation rotates or stetches any of the basis vectors.
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Amg::Transform3D getRotateY3D(double angle)
get a rotation transformation around Y-axis
const std::string & stName(StIndex index)
convert StIndex into a string
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
std::unique_ptr< Amg::Transform3D > makeTransform(const Amg::Transform3D &trf)
MuonStationBuilderImpl::GMInfo GMInfo
std::vector< ObjType * > release(std::vector< std::unique_ptr< ObjType > > &objVec)
BoundarySurfaceFace
Enum to describe the position of the BoundarySurface respectively to the frame orientatin of the volu...
BinnedArray< TrackingVolume > TrackingVolumeArray
simply for the eye