7 #include <GeoModelKernel/GeoBox.h>
8 #include <GeoModelKernel/GeoTrd.h>
9 #include <GeoModelKernel/GeoSimplePolygonBrep.h>
11 #include <GeoModelKernel/GeoTube.h>
13 #include <GeoModelKernel/GeoShapeUnion.h>
14 #include <GeoModelKernel/GeoShapeIntersection.h>
15 #include <GeoModelKernel/GeoShapeSubtraction.h>
16 #include <GeoModelKernel/GeoShapeShift.h>
18 #include <GeoModelKernel/GeoTransform.h>
20 #include <GeoModelKernel/GeoVolumeCursor.h>
22 #include <GeoModelHelpers/GeoShapeUtils.h>
23 #include <GeoModelHelpers/TransformToStringConverter.h>
33 MuonGeoUtilityTool::~MuonGeoUtilityTool() =
default;
34 MuonGeoUtilityTool::MuonGeoUtilityTool(
const std::string &
type,
const std::string &
name,
39 const GeoLogVol* logVol = physVol->getLogVol();
41 ATH_MSG_ERROR(__FILE__<<
":"<<__LINE__<<
" Physical volume has no logical volume attached ");
49 ATH_MSG_INFO(__FILE__<<
":"<<__LINE__<<
" "<<__func__<<
" nullptr given ");
52 if (inShape->typeID() == GeoShapeShift::getClassTypeID()) {
53 const GeoShapeShift* shift = dynamic_pointer_cast<const GeoShapeShift>(compressShift(inShape));
56 <<
". Continue navigation "<<shift);
59 if (inShape->typeID() == GeoShapeSubtraction::getClassTypeID()){
61 "Shape is a subtraction. Extract the basic shape. Continue navigation "<<inShape);
62 const GeoShapeSubtraction* subtract =
static_cast<const GeoShapeSubtraction*
>(inShape);
68 const GeoLogVol* logVol = physVol->getLogVol();
70 ATH_MSG_ERROR(__FILE__<<
":"<<__LINE__<<
" Physical volume has no logical volume attached. ");
71 return Amg::Transform3D::Identity();
78 ATH_MSG_ERROR(__FILE__<<
":"<<__LINE__<<
" "<<__func__<<
" nullptr given ");
79 return Amg::Transform3D::Identity();
82 if (inShape->typeID() == GeoShapeShift::getClassTypeID()) {
83 const GeoShapeShift* shift = dynamic_pointer_cast<const GeoShapeShift>(compressShift(inShape));
84 ATH_MSG_VERBOSE(__FILE__<<
":"<<__LINE__<<
" "<<__func__<<
" Shape is a shift . Continue navigation "<<shift);
85 sumTrans = shift->getX();
95 std::stringstream sstr{};
96 if (!physVol || !physVol->getLogVol()){
97 ATH_MSG_WARNING(__FILE__<<
":"<<__LINE__<<
" "<<__func__<<
" No logical volume attached ");
103 <<
" Failed to extract shape from phys volume "
104 << physVol->getLogVol()->getName());
107 sstr<<
"logical volume "<<physVol->getLogVol()->getName()<<
", ";
108 if (physVol->isShared() || !physVol->getParent()){
109 sstr<<
"shared volume, ";
111 const GeoVPhysVol*
pv = physVol;
112 if (
typeid(*
pv) ==
typeid(GeoFullPhysVol)){
113 const Amg::Transform3D absTrans =
static_cast<const GeoFullPhysVol&
>(*physVol).getAbsoluteTransform();
124 sstr<<
"number of children "<<physVol->getNChildVols()<<
", "<<std::endl;
125 std::vector<GeoChildNodeWithTrf>
children = getChildrenWithRef(physVol,
false);
126 for (
unsigned int child = 0; child <
children.size(); ++child) {
134 PVConstLink
parent{physVol->getParent()}, child{physVol};
136 const GeoGraphNode *
const * node1 =
parent->findChildNode(child);
137 const GeoGraphNode *
const * fence =
parent->getChildNode(0);
140 if (
dynamic_cast<const GeoVPhysVol*
>(
node))
break;
141 const GeoAlignableTransform* alignTrans{
dynamic_cast<const GeoAlignableTransform*
>(
node)};
142 if (alignTrans)
return alignTrans;
145 parent = child->getParent();
151 const std::vector<physVolWithTrans>
children = getChildrenWithRef(physVol,
false);
152 std::vector<physVolWithTrans> foundVols{};
155 if (child.volume->getLogVol()->getName() == volumeName || child.nodeName == volumeName) {
156 foundVols.push_back(child);
159 if (!child.volume->getNChildVols()) {
164 std::make_move_iterator(grandChildren.end()), std::back_inserter(foundVols),
166 vol.transform = child.transform * vol.transform;
173 return getBooleanComponents(booleanShape);
179 for (
unsigned int i = 0;
i < polygon.getNVertices(); ++
i) {
180 polygonEdges.emplace_back(polygon.getXVertex(
i), polygon.getYVertex(
i));
188 return getPolyShapeEdges(shape, refTrf);