16 #include "GeoModelKernel/GeoShape.h"
17 #include "GeoModelKernel/GeoVolumeCursor.h"
21 const std::string&
t,
const std::string&
n,
const IInterface*
p)
28 if (m_simplifyToLayers) {
29 ATH_MSG_INFO(
" option Simplify(Muon)GeometryToLayers no longer maintained ");
32 return StatusCode::SUCCESS;
39 throw std::runtime_error(
"No tree top has been parsed");
44 auto msTypes = buildDetachedTrackingVolumeTypes(treeTop, blend);
45 ATH_MSG_DEBUG(
" obtained " << msTypes.size() <<
" prototypes");
48 for (
auto& [msTV, transforms]: msTypes) {
49 std::string msTypeName = msTV->name();
51 std::unique_ptr<Trk::DetachedTrackingVolume> newStat{msTV->clone(msTypeName, combTr)};
52 mInert.push_back(std::move(newStat));
55 ATH_MSG_DEBUG(
" returns " << mInert.size() <<
" objects (detached volumes)");
66 GeoVolumeCursor vol(
top);
67 while (!vol.atEnd()) {
68 const GeoVPhysVol* cv = vol.getVolume();
69 const GeoLogVol* clv = cv->getLogVol();
70 const std::string_view vname = clv->getName();
71 if (vname.size() > 7 && vname.substr(vname.size() - 7, 7) ==
75 if (vname.substr(0, 3) ==
"BAR" || vname.substr(0, 2) ==
"BT" ||
76 vname.substr(0, 6) ==
"EdgeBT" || vname.substr(0, 6) ==
"HeadBT"){
78 }
else if (vname.substr(0, 3) ==
"ECT") {
79 accepted = m_buildECT;
80 }
else if (vname.substr(0, 4) ==
"Feet" ||
81 (vname.size() > 7 && (vname.substr(3, 4) ==
"Feet" || vname.substr(4, 4) ==
"Feet"))) {
82 accepted = m_buildFeets;
83 }
else if (vname.substr(0, 4) ==
"Rail") {
84 accepted = m_buildRails > 0;
85 }
else if (vname.substr(0, 1) ==
"J") {
86 accepted = m_buildShields > 0;
89 }
else if (vname.substr(0, 3) ==
"NSW" && vname.substr(1, 6) ==
"Spacer") {
90 accepted = m_buildNSWInert;
91 }
else if (vname.substr(0, 3) ==
"NSW" && vname.substr(1, 2) ==
"Al") {
92 accepted = m_buildNSWInert;
93 }
else if (vname.substr(0, 3) ==
"NJD"){
94 accepted = m_buildNSWInert;
95 }
else if (vname.substr(0, 1) ==
"A" && vname.substr(1, 5) ==
"Plate"){
96 accepted = m_buildNSWInert;
98 }
else if (vname.substr(0, 1) !=
"J") {
99 accepted = m_buildSupports > 0;
111 std::vector<std::pair<const GeoVPhysVol*, std::vector<Amg::Transform3D>>> vols;
113 bool simpleTree =
false;
114 if (!cv->getNChildVols()) {
115 if (!m_gmBrowser.findNamePattern(cv,
"Sensitive")) {
116 std::vector<Amg::Transform3D> volTr;
117 volTr.push_back(vol.getTransform());
118 vols.emplace_back(cv, volTr);
122 getObjsForTranslation(cv, Amg::Transform3D::Identity(), vols);
125 for (
auto& [physVol, physVolTrfs]: vols) {
126 std::string protoName(vname);
128 protoName += physVol->getLogVol()->getName();
130 << physVol->getLogVol()->getMaterial()->getName()
131 <<
" x0 " << physVol->getLogVol()->getMaterial()->getRadLength()
132 <<
"," << physVol->getLogVol()->getShape()->type());
136 if (protoName ==
obj.first->name()) {
139 obj.second.push_back(vol.getTransform());
141 obj.second.insert(
obj.second.end(),
142 std::make_move_iterator(physVolTrfs.begin()),
143 std::make_move_iterator(physVolTrfs.end()));
152 auto newType = m_volumeConverter.translate(physVol, m_simplify, blend, m_blendLimit);
154 const std::string volName = newType->volumeName();
155 auto typeDet = std::make_unique<Trk::DetachedTrackingVolume>(volName, newType.release());
156 objs.emplace_back(std::move(typeDet), std::move(physVolTrfs));
175 const GeoVPhysVol*
pv)
const {
176 const GeoLogVol* lv =
pv->getLogVol();
178 << lv->getName() <<
", made of "
179 << lv->getMaterial()->getName() <<
" x0 "
180 << lv->getMaterial()->getRadLength() <<
","
181 << lv->getShape()->type());
182 m_geoShapeConverter.decodeShape(lv->getShape());
187 const GeoVPhysVol*
pv)
const {
189 unsigned int nc =
pv->getNChildVols();
190 for (
unsigned int ic = 0;
ic <
nc;
ic++) {
193 const GeoVPhysVol* cv = &(*(
pv->getChildVol(
ic)));
194 const GeoLogVol* clv = cv->getLogVol();
198 <<
ic <<
":" << clv->getName() <<
", made of "
199 << clv->getMaterial()->getName() <<
" x0 "
200 << clv->getMaterial()->getRadLength() <<
" , "
201 << clv->getShape()->type() <<
"," << transf.translation().x() <<
" "
202 << transf.translation().y() <<
" " << transf.translation().z());
204 m_geoShapeConverter.decodeShape(clv->getShape());
212 std::vector<std::pair<
const GeoVPhysVol*, std::vector<Amg::Transform3D>>>&
215 unsigned int nc =
pv->getNChildVols();
217 <<
pv->getLogVol()->getName() <<
","
218 <<
pv->getLogVol()->getMaterial()->getName()
219 <<
", looping over " <<
nc <<
" children");
220 for (
unsigned int ic = 0;
ic <
nc;
ic++) {
222 const GeoVPhysVol* cv = &(*(
pv->getChildVol(
ic)));
223 const GeoLogVol* clv = cv->getLogVol();
224 if (clv->getMaterial()->getDensity() > 0. &&
225 m_gmBrowser.findNamePattern(cv,
"Sensitive"))
227 if (!cv->getNChildVols()) {
229 for (
auto& vol : vols) {
230 if (clv->getName() == vol.first->getLogVol()->getName()) {
231 if (m_gmBrowser.compareGeoVolumes(cv, vol.first, 1.e-3) !=
234 "INERT name branch matching differences detected "
238 vol.second.push_back(
transform * transf);
243 std::vector<Amg::Transform3D> volTr;
245 vols.emplace_back(cv, volTr);
247 << clv->getName() <<
","
248 << clv->getMaterial()->getName());
253 getObjsForTranslation(cv,
transform * transf, vols);