ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonPhaseII
MuonDetDescr
MuonGeoModelR4
src
MuonGeoUtilitiyTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
MuonGeoUtilityTool.h
"
5
6
#include <
MuonReadoutGeometryR4/MuonDetectorDefs.h
>
7
#include <GeoModelKernel/GeoBox.h>
8
#include <GeoModelKernel/GeoTrd.h>
9
#include <GeoModelKernel/GeoSimplePolygonBrep.h>
10
11
#include <GeoModelKernel/GeoTube.h>
12
13
#include <GeoModelKernel/GeoShapeUnion.h>
14
#include <GeoModelKernel/GeoShapeIntersection.h>
15
#include <GeoModelKernel/GeoShapeSubtraction.h>
16
#include <GeoModelKernel/GeoShapeShift.h>
17
18
#include <GeoModelKernel/GeoTransform.h>
19
20
#include <GeoModelKernel/GeoVolumeCursor.h>
21
22
#include <GeoModelHelpers/GeoShapeUtils.h>
23
#include <GeoModelHelpers/printVolume.h>
24
#include <GeoModelHelpers/TransformToStringConverter.h>
25
26
27
#include <set>
28
#include <sstream>
29
#include <string>
30
31
32
using namespace
ActsTrk
;
33
namespace
MuonGMR4
{
34
35
MuonGeoUtilityTool::~MuonGeoUtilityTool
() =
default
;
36
37
const
GeoShape*
MuonGeoUtilityTool::extractShape
(
const
PVConstLink& physVol)
const
{
38
return
extractShape
(physVol->getLogVol()->getShape());
39
}
40
const
GeoShape*
MuonGeoUtilityTool::extractShape
(
const
GeoShape* inShape)
const
{
41
42
if
(inShape->typeID() == GeoShapeShift::getClassTypeID()) {
43
const
auto
shift = dynamic_pointer_cast<const GeoShapeShift>(compressShift(inShape));
44
ATH_MSG_VERBOSE
(__FILE__<<
":"
<<__LINE__<<
" "
<<__func__<<
45
"Shape is a shift by "
<<GeoTrf::toString(shift->getX())
46
<<
". Continue navigation "
<<printGeoShape(shift));
47
return
extractShape
(shift->getOp());
48
}
49
if
(inShape->typeID() == GeoShapeSubtraction::getClassTypeID()){
50
ATH_MSG_VERBOSE
(__FILE__<<
":"
<<__LINE__<<
" "
<<__func__<<
51
"Shape is a subtraction. Extract the basic shape. Continue navigation "
<<inShape);
52
const
GeoShapeSubtraction* subtract =
static_cast<
const
GeoShapeSubtraction*
>
(inShape);
53
return
extractShape
(subtract->getOpA());
54
}
55
return
inShape;
56
}
57
std::string
MuonGeoUtilityTool::dumpShape
(
const
GeoShape* shape)
const
{
return
printGeoShape(shape); }
58
std::string
MuonGeoUtilityTool::dumpVolume
(
const
PVConstLink& physVol)
const
{
return
printVolume(physVol); }
59
const
GeoAlignableTransform*
MuonGeoUtilityTool::findAlignableTransform
(
const
PVConstLink& physVol)
const
{
60
PVConstLink parent{physVol->getParent()}, child{physVol};
61
while
(parent) {
62
const
GeoGraphNode *
const
* node1 = parent->findChildNode(child);
63
const
GeoGraphNode *
const
* fence = parent->getChildNode(0);
64
for
(
const
GeoGraphNode *
const
* current = node1 - 1; current>=fence; current--) {
65
const
GeoGraphNode*
node
{*current};
66
if
(
dynamic_cast<
const
GeoVPhysVol*
>
(
node
)) {
67
break
;
68
}
69
const
GeoAlignableTransform* alignTrans{
dynamic_cast<
const
GeoAlignableTransform*
>
(
node
)};
70
if
(alignTrans) {
71
return
alignTrans;
72
}
73
}
74
child = parent;
75
parent = child->getParent();
76
}
77
return
nullptr
;
78
}
79
80
std::vector<MuonGeoUtilityTool::physVolWithTrans>
MuonGeoUtilityTool::findAllLeafNodesByName
(
const
PVConstLink& physVol,
const
std::string& volumeName)
const
{
81
return
getAllSubVolumes(physVol,[&volumeName](
const
physVolWithTrans
& child){
82
return
child.volume->getLogVol()->getName() == volumeName || child.nodeName == volumeName;
83
});
84
}
85
std::vector<const GeoShape*>
MuonGeoUtilityTool::getComponents
(
const
GeoShape* booleanShape)
const
{
86
return
getBooleanComponents(booleanShape);
87
}
88
89
std::vector<Amg::Vector2D>
MuonGeoUtilityTool::polygonEdges
(
const
GeoSimplePolygonBrep& polygon)
const
{
90
std::vector<Amg::Vector2D>
polygonEdges
{};
91
polygonEdges
.reserve(polygon.getNVertices());
92
for
(
unsigned
int
i = 0; i < polygon.getNVertices(); ++i) {
93
polygonEdges
.emplace_back(polygon.getXVertex(i), polygon.getYVertex(i));
94
ATH_MSG_VERBOSE
(
"Polygon vertext point "
<< i <<
": "
<< GeoTrf::toString(
polygonEdges
.back(), 2));
95
}
96
return
polygonEdges
;
97
}
98
99
std::vector<Amg::Vector3D>
MuonGeoUtilityTool::shapeEdges
(
const
GeoShape* shape,
100
const
Amg::Transform3D
& refTrf)
const
{
101
return
getPolyShapeEdges(shape, refTrf);
102
}
103
104
105
}
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
MuonDetectorDefs.h
MuonGeoUtilityTool.h
MuonGMR4::MuonGeoUtilityTool::dumpShape
std::string dumpShape(const GeoShape *inShape) const override final
Dumps the shape to string.
Definition
MuonGeoUtilitiyTool.cxx:57
MuonGMR4::MuonGeoUtilityTool::getComponents
std::vector< const GeoShape * > getComponents(const GeoShape *booleanShape) const override final
Definition
MuonGeoUtilitiyTool.cxx:85
MuonGMR4::MuonGeoUtilityTool::findAlignableTransform
const GeoAlignableTransform * findAlignableTransform(const PVConstLink &physVol) const override final
Definition
MuonGeoUtilitiyTool.cxx:59
MuonGMR4::MuonGeoUtilityTool::extractShape
const GeoShape * extractShape(const PVConstLink &physVol) const override final
Definition
MuonGeoUtilitiyTool.cxx:37
MuonGMR4::MuonGeoUtilityTool::~MuonGeoUtilityTool
virtual ~MuonGeoUtilityTool() override final
MuonGMR4::MuonGeoUtilityTool::shapeEdges
std::vector< Amg::Vector3D > shapeEdges(const GeoShape *shape, const Amg::Transform3D &refTrf) const override
Definition
MuonGeoUtilitiyTool.cxx:99
MuonGMR4::MuonGeoUtilityTool::dumpVolume
std::string dumpVolume(const PVConstLink &physVol) const override final
Definition
MuonGeoUtilitiyTool.cxx:58
MuonGMR4::MuonGeoUtilityTool::findAllLeafNodesByName
std::vector< physVolWithTrans > findAllLeafNodesByName(const PVConstLink &physVol, const std::string &volumeName) const override final
Definition
MuonGeoUtilitiyTool.cxx:80
MuonGMR4::MuonGeoUtilityTool::polygonEdges
std::vector< Amg::Vector2D > polygonEdges(const GeoSimplePolygonBrep &polygon) const override
Transforms the vertices of the Polygon shape into a std::vector consisting of Amg::Vector2D objects.
Definition
MuonGeoUtilitiyTool.cxx:89
node
Definition
node.h:24
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition
GeoPrimitives.h:46
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition
MdtCalibInput.h:19
MuonGMR4::physVolWithTrans
IMuonGeoUtilityTool::physVolWithTrans physVolWithTrans
Definition
MdtReadoutGeomTool.cxx:31
Generated on
for ATLAS Offline Software by
1.17.0