ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsGeometry
src
GeometryEnvelopeTest.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
GeometryEnvelopeTest.h
"
5
6
#include "Acts/Geometry/TrackingVolume.hpp"
7
#include "Acts/Geometry/TrackingGeometry.hpp"
8
#include "Acts/Geometry/VolumeBounds.hpp"
9
#include "Acts/Surfaces/Surface.hpp"
10
#include "Acts/Surfaces/RegularSurface.hpp"
11
#include "Acts/Surfaces/SurfaceBounds.hpp"
12
#include "Acts/Definitions/Units.hpp"
13
#include "
GeoPrimitives/GeoPrimitivesToStringConverter.h
"
14
15
16
using namespace
ActsTrk::detail::GeoVolIds
;
17
using namespace
Acts::UnitLiterals;
18
namespace
ActsTrk
{
19
StatusCode
GeometryEnvelopeTest::initialize
() {
20
ATH_CHECK
(
m_trackingGeometrySvc
.retrieve());
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
GeometryEnvelopeTest::execute
(
const
EventContext& ctx) {
25
const
Acts::GeometryContext tgContext =
m_trackingGeometrySvc
->getNominalContext().context();
26
27
const
Acts::TrackingGeometry* trkGeo =
m_trackingGeometrySvc
->trackingGeometry().get();
30
ATH_CHECK
(
checkVolume
(tgContext, *trkGeo->highestTrackingVolume()));
33
auto
checkEnevelope = [
this
](
const
StringProperty& envName,
34
const
SystemEnvelope
env) -> StatusCode {
35
if
(envName.value().empty()) {
36
ATH_MSG_DEBUG
(
"The envelope "
<<envName<<
" is undefined"
);
37
return
StatusCode::SUCCESS;
38
}
39
const
Acts::TrackingVolume* envelope =
m_trackingGeometrySvc
->getEnvelope(env);
40
if
(!envelope) {
41
ATH_MSG_ERROR
(
"The envelope "
<<envName<<
"/ "
<<env<<
" does not exist in the tracking geometry"
);
42
return
StatusCode::FAILURE;
43
}
44
if
(envelope->volumeName() != envName) {
45
ATH_MSG_ERROR
(
"The envelope "
<<envelope->volumeName()<<
" "
<<envelope->volumeBounds()<<
" "
46
<<
" has a different name than expected: "
<<envName);
47
return
StatusCode::FAILURE;
48
}
49
ATH_MSG_INFO
(
"Envelopes match by name "
<<envelope->volumeName()<<
" "
<<envelope->volumeBounds());
50
return
StatusCode::SUCCESS;
51
};
52
ATH_CHECK
(checkEnevelope(
m_ITkExitVolume
,
SystemEnvelope::ITkExit
));
53
ATH_CHECK
(checkEnevelope(
m_caloExitVolume
,
SystemEnvelope::CaloExit
));
54
ATH_CHECK
(checkEnevelope(
m_MsExitVolume
,
SystemEnvelope::MsExit
));
55
56
ATH_MSG_INFO
(
"Test succeeded "
<<ctx.eventID());
57
return
StatusCode::SUCCESS;
58
}
59
StatusCode
GeometryEnvelopeTest::checkVolume
(
const
Acts::GeometryContext& tgContext,
60
const
Acts::TrackingVolume& volume)
const
{
61
ATH_MSG_VERBOSE
(
"Check whether all volumes are within the envelope defined by "
62
<<volume.volumeName()<<
", "
<<volume.volumeBounds());
63
bool
allGood{
true
};
64
for
(
const
Acts::TrackingVolume& childVolume : volume.volumes()) {
65
for
(
const
Amg::Vector3D
& vert :
edges
(tgContext, childVolume)) {
66
const
Amg::Vector3D
lVert = volume.globalToLocalTransform(tgContext)* vert;
67
68
if
(!volume.volumeBounds().inside(lVert)) {
69
ATH_MSG_ERROR
(
"The vertex "
<<
Amg::toString
(lVert)<<
", perp:"
<<lVert.perp()
70
<<
" is not inside of the volume envelope "
<<volume.volumeName()
71
<<
" "
<<volume.volumeBounds());
72
allGood =
false
;
73
}
74
}
75
}
76
if
(!allGood) {
77
return
StatusCode::FAILURE;
78
}
79
for
(
const
Acts::Surface& surface : volume.surfaces()) {
80
for
(
const
Amg::Vector3D
& vert :
vertices
(tgContext, surface)) {
81
const
Amg::Vector3D
lVert = volume.globalToLocalTransform(tgContext)* vert;
82
if
(!volume.volumeBounds().inside(lVert, 0.1_mm)) {
83
ATH_MSG_ERROR
(
"The vertex "
<<
Amg::toString
(lVert)<<
", perp:"
<<lVert.perp()
84
<<
" is not inside of the volume envelope "
<<volume.volumeName()
85
<<
" "
<<volume.volumeBounds());
86
allGood =
false
;
87
}
88
}
89
}
90
if
(!allGood) {
91
return
StatusCode::FAILURE;
92
}
93
for
(
const
Acts::TrackingVolume& childVolume : volume.volumes()) {
94
ATH_CHECK
(
checkVolume
(tgContext, childVolume));
95
}
96
return
StatusCode::SUCCESS;
97
}
98
std::vector<Amg::Vector3D>
GeometryEnvelopeTest::edges
(
const
Acts::GeometryContext& tgContext,
99
const
Acts::TrackingVolume& volume)
const
{
100
std::vector<Amg::Vector3D> result{};
101
for
(
const
auto
& oriented : volume.volumeBounds().orientedSurfaces(volume.localToGlobalTransform(tgContext))) {
102
std::vector<Amg::Vector3D> verts =
vertices
(tgContext,*oriented.surface);
103
result.insert(result.end(),
104
std::make_move_iterator(verts.begin()),
105
std::make_move_iterator(verts.end()));
106
}
107
return
result;
108
}
109
std::vector<Amg::Vector3D>
GeometryEnvelopeTest::vertices
(
const
Acts::GeometryContext& tgContext,
110
const
Acts::Surface& surface)
const
{
111
Acts::Polyhedron polyhedron = surface.polyhedronRepresentation(tgContext, 10);
112
return
polyhedron.vertices;
113
}
114
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x,...)
Definition
AthMsgStreamMacros.h:42
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
GeoPrimitivesToStringConverter.h
GeometryEnvelopeTest.h
ActsTrk::GeometryEnvelopeTest::m_trackingGeometrySvc
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
The handle to the tracking geometry service.
Definition
GeometryEnvelopeTest.h:40
ActsTrk::GeometryEnvelopeTest::execute
virtual StatusCode execute(const EventContext &ctx) override final
Execute method.
Definition
GeometryEnvelopeTest.cxx:24
ActsTrk::GeometryEnvelopeTest::m_caloExitVolume
Gaudi::Property< std::string > m_caloExitVolume
Definition
GeometryEnvelopeTest.h:44
ActsTrk::GeometryEnvelopeTest::vertices
std::vector< Amg::Vector3D > vertices(const Acts::GeometryContext &tgContext, const Acts::Surface &surface) const
Extracts the vertices from a surface.
Definition
GeometryEnvelopeTest.cxx:109
ActsTrk::GeometryEnvelopeTest::initialize
virtual StatusCode initialize() override final
Definition
GeometryEnvelopeTest.cxx:19
ActsTrk::GeometryEnvelopeTest::m_MsExitVolume
Gaudi::Property< std::string > m_MsExitVolume
Definition
GeometryEnvelopeTest.h:46
ActsTrk::GeometryEnvelopeTest::checkVolume
StatusCode checkVolume(const Acts::GeometryContext &tgContext, const Acts::TrackingVolume &volume) const
Checks whether all subvolumes are contained in the volume Method recursively called for each subvolum...
Definition
GeometryEnvelopeTest.cxx:59
ActsTrk::GeometryEnvelopeTest::edges
std::vector< Amg::Vector3D > edges(const Acts::GeometryContext &tgContext, const Acts::TrackingVolume &volume) const
Extracts the vertices form the TrackingVolume marking its edges.
Definition
GeometryEnvelopeTest.cxx:98
ActsTrk::GeometryEnvelopeTest::m_ITkExitVolume
Gaudi::Property< std::string > m_ITkExitVolume
Definition
GeometryEnvelopeTest.h:42
ActsTrk::detail::GeoVolIds
Define the volume parts of the GeometryIdentifier for each ATLAS subsystem centrally.
Definition
GeometryDefs.h:51
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
ActsTrk::SystemEnvelope
SystemEnvelope
Define an enumeration to retrieve the envelope tracking volume from.
Definition
GeometryDefs.h:42
ActsTrk::SystemEnvelope::CaloExit
@ CaloExit
Definition
GeometryDefs.h:44
ActsTrk::SystemEnvelope::ITkExit
@ ITkExit
Definition
GeometryDefs.h:43
ActsTrk::SystemEnvelope::MsExit
@ MsExit
Definition
GeometryDefs.h:45
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition
GeoPrimitivesToStringConverter.h:40
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:48
Generated on
for ATLAS Offline Software by
1.17.0