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,
37 declareInterface<IMuonGeoUtilityTool>(
this);
41 const GeoLogVol* logVol = physVol->getLogVol();
43 ATH_MSG_ERROR(__FILE__<<
":"<<__LINE__<<
" Physical volume has no logical volume attached ");
51 ATH_MSG_INFO(__FILE__<<
":"<<__LINE__<<
" "<<__func__<<
" nullptr given ");
54 if (inShape->typeID() == GeoShapeShift::getClassTypeID()) {
55 const GeoShapeShift* shift = dynamic_pointer_cast<const GeoShapeShift>(compressShift(inShape));
58 <<
". Continue navigation "<<shift);
61 if (inShape->typeID() == GeoShapeSubtraction::getClassTypeID()){
63 "Shape is a subtraction. Extract the basic shape. Continue navigation "<<inShape);
64 const GeoShapeSubtraction* subtract =
static_cast<const GeoShapeSubtraction*
>(inShape);
70 const GeoLogVol* logVol = physVol->getLogVol();
72 ATH_MSG_ERROR(__FILE__<<
":"<<__LINE__<<
" Physical volume has no logical volume attached. ");
73 return Amg::Transform3D::Identity();
80 ATH_MSG_ERROR(__FILE__<<
":"<<__LINE__<<
" "<<__func__<<
" nullptr given ");
81 return Amg::Transform3D::Identity();
84 if (inShape->typeID() == GeoShapeShift::getClassTypeID()) {
85 const GeoShapeShift* shift = dynamic_pointer_cast<const GeoShapeShift>(compressShift(inShape));
86 ATH_MSG_VERBOSE(__FILE__<<
":"<<__LINE__<<
" "<<__func__<<
" Shape is a shift . Continue navigation "<<shift);
87 sumTrans = shift->getX();
97 std::stringstream sstr{};
98 if (!physVol || !physVol->getLogVol()){
99 ATH_MSG_WARNING(__FILE__<<
":"<<__LINE__<<
" "<<__func__<<
" No logical volume attached ");
105 <<
" Failed to extract shape from phys volume "
106 << physVol->getLogVol()->getName());
109 sstr<<
"logical volume "<<physVol->getLogVol()->getName()<<
", ";
110 if (physVol->isShared() || !physVol->getParent()){
111 sstr<<
"shared volume, ";
113 const GeoVPhysVol*
pv = physVol;
114 if (
typeid(*
pv) ==
typeid(GeoFullPhysVol)){
115 const Amg::Transform3D absTrans =
static_cast<const GeoFullPhysVol&
>(*physVol).getAbsoluteTransform();
126 sstr<<
"number of children "<<physVol->getNChildVols()<<
", "<<std::endl;
127 std::vector<GeoChildNodeWithTrf>
children = getChildrenWithRef(physVol,
false);
128 for (
unsigned int child = 0; child <
children.size(); ++child) {
136 PVConstLink
parent{physVol->getParent()}, child{physVol};
138 const GeoGraphNode *
const * node1 =
parent->findChildNode(child);
139 const GeoGraphNode *
const * fence =
parent->getChildNode(0);
142 if (
dynamic_cast<const GeoVPhysVol*
>(
node))
break;
143 const GeoAlignableTransform* alignTrans{
dynamic_cast<const GeoAlignableTransform*
>(
node)};
144 if (alignTrans)
return alignTrans;
147 parent = child->getParent();
153 const std::vector<physVolWithTrans>
children = getChildrenWithRef(physVol,
false);
154 std::vector<physVolWithTrans> foundVols{};
157 if (child.volume->getLogVol()->getName() == volumeName || child.nodeName == volumeName) {
158 foundVols.push_back(child);
161 if (!child.volume->getNChildVols()) {
166 std::make_move_iterator(grandChildren.end()), std::back_inserter(foundVols),
168 vol.transform = child.transform * vol.transform;
175 return getBooleanComponents(booleanShape);
181 for (
unsigned int i = 0;
i < polygon.getNVertices(); ++
i) {
182 polygonEdges.emplace_back(polygon.getXVertex(
i), polygon.getYVertex(
i));
190 return getPolyShapeEdges(shape, refTrf);