ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsMonitoring
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
14
#include "
MuonReadoutGeometryR4/BoundsExpander.h
"
15
#include "
GeoPrimitives/GeoPrimitivesToStringConverter.h
"
16
17
18
using namespace
ActsTrk::detail::GeoVolIds
;
19
using namespace
Acts::UnitLiterals;
20
namespace
ActsTrk
{
21
StatusCode
GeometryEnvelopeTest::initialize
() {
22
ATH_CHECK
(
m_trackingGeometrySvc
.retrieve());
23
return
StatusCode::SUCCESS;
24
}
25
26
StatusCode
GeometryEnvelopeTest::execute
(
const
EventContext& ctx) {
27
const
Acts::GeometryContext tgContext =
m_trackingGeometrySvc
->getNominalContext().context();
28
29
const
Acts::TrackingGeometry* trkGeo =
m_trackingGeometrySvc
->trackingGeometry().get();
32
ATH_CHECK
(
checkVolume
(tgContext, *trkGeo->highestTrackingVolume()));
35
auto
checkEnevelope = [
this
](
const
StringProperty& envName,
36
const
SystemEnvelope
env) -> StatusCode {
37
if
(envName.value().empty()) {
38
ATH_MSG_DEBUG
(
"The envelope "
<<envName<<
" is undefined"
);
39
return
StatusCode::SUCCESS;
40
}
41
const
Acts::TrackingVolume* envelope =
m_trackingGeometrySvc
->getEnvelope(env);
42
if
(!envelope) {
43
ATH_MSG_ERROR
(
"The envelope "
<<envName<<
"/ "
<<env<<
" does not exist in the tracking geometry"
);
44
return
StatusCode::FAILURE;
45
}
46
if
(envelope->volumeName() != envName) {
47
ATH_MSG_ERROR
(
"The envelope "
<<envelope->volumeName()<<
" "
<<envelope->volumeBounds()<<
" "
48
<<
" has a different name than expected: "
<<envName);
49
return
StatusCode::FAILURE;
50
}
51
ATH_MSG_INFO
(
"Envelopes match by name "
<<envelope->volumeName()<<
" "
<<envelope->volumeBounds());
52
return
StatusCode::SUCCESS;
53
};
54
ATH_CHECK
(checkEnevelope(
m_ITkExitVolume
,
SystemEnvelope::ITkExit
));
55
ATH_CHECK
(checkEnevelope(
m_caloExitVolume
,
SystemEnvelope::CaloExit
));
56
ATH_CHECK
(checkEnevelope(
m_MsExitVolume
,
SystemEnvelope::MsExit
));
57
58
ATH_MSG_INFO
(
"Test succeeded "
<<ctx.eventID());
59
return
StatusCode::SUCCESS;
60
}
61
StatusCode
GeometryEnvelopeTest::checkVolume
(
const
Acts::GeometryContext& tgContext,
62
const
Acts::TrackingVolume& volume)
const
{
63
ATH_MSG_VERBOSE
(
"Check whether all volumes are within the envelope defined by "
64
<<volume.volumeName()<<
", "
<<volume.volumeBounds());
65
bool
allGood{
true
};
66
std::vector<Amg::Vector3D> allSurfVertices{};
67
68
for
(
const
Acts::Surface& surface : volume.surfaces()) {
69
ATH_MSG_INFO
(
"Check surface "
<<surface.geometryId()<<
", "
<<surface.bounds()<<
", "
70
<<
Amg::toString
(surface.center(tgContext)));
71
std::vector<Amg::Vector3D> surfaceVertices =
MuonGMR4::BoundsExpander::cornerPoints
(tgContext, surface,
m_nVertices
);
72
for
(
const
Amg::Vector3D
& vert : surfaceVertices) {
73
const
Amg::Vector3D
lVert = volume.globalToLocalTransform(tgContext)* vert;
74
if
(!volume.volumeBounds().inside(lVert, 0.1_mm)) {
75
ATH_MSG_ERROR
(
"The vertex "
<<
Amg::toString
(lVert)<<
", perp:"
<<lVert.perp()
76
<<
" is not inside of the volume envelope "
<<volume.volumeName()
77
<<
" "
<<volume.volumeBounds());
78
allGood =
false
;
79
}
80
}
81
allSurfVertices.insert(allSurfVertices.end(),
82
std::make_move_iterator(surfaceVertices.begin()),
83
std::make_move_iterator(surfaceVertices.end()));
84
}
85
86
for
(
const
Acts::TrackingVolume& childVolume : volume.volumes()) {
88
for
(
const
Amg::Vector3D
& vert :
MuonGMR4::BoundsExpander::cornerPoints
(tgContext, childVolume,
89
m_nVertices
)) {
90
const
Amg::Vector3D
lVert = volume.globalToLocalTransform(tgContext)* vert;
91
if
(!volume.volumeBounds().inside(lVert)) {
92
ATH_MSG_ERROR
(
"The vertex "
<<
Amg::toString
(lVert)<<
", perp:"
<<lVert.perp()
93
<<
" is not inside of the volume envelope "
<<volume.volumeName()
94
<<
" "
<<volume.volumeBounds());
95
allGood =
false
;
96
}
97
}
98
for
(
const
Amg::Vector3D
& vert : allSurfVertices) {
99
const
Amg::Vector3D
lVert = childVolume.globalToLocalTransform(tgContext)* vert;
100
if
(childVolume.volumeBounds().inside(lVert)) {
101
ATH_MSG_ERROR
(
"The vertex "
<<
Amg::toString
(lVert)<<
", perp: "
<<lVert.perp()
102
<<
" is inside of the volume envelope "
<<childVolume.volumeName()
103
<<
" "
<<childVolume.volumeBounds());
104
allGood =
false
;
105
}
106
}
107
}
108
if
(!allGood) {
109
return
StatusCode::FAILURE;
110
}
111
for
(
const
Acts::TrackingVolume& childVolume : volume.volumes()) {
112
ATH_CHECK
(
checkVolume
(tgContext, childVolume));
113
}
114
return
StatusCode::SUCCESS;
115
}
116
}
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
BoundsExpander.h
GeoPrimitivesToStringConverter.h
GeometryEnvelopeTest.h
ActsTrk::GeometryEnvelopeTest::m_trackingGeometrySvc
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
The handle to the tracking geometry service.
Definition
GeometryEnvelopeTest.h:30
ActsTrk::GeometryEnvelopeTest::execute
virtual StatusCode execute(const EventContext &ctx) override final
Execute method.
Definition
GeometryEnvelopeTest.cxx:26
ActsTrk::GeometryEnvelopeTest::m_nVertices
Gaudi::Property< unsigned > m_nVertices
Definition
GeometryEnvelopeTest.h:38
ActsTrk::GeometryEnvelopeTest::m_caloExitVolume
Gaudi::Property< std::string > m_caloExitVolume
Definition
GeometryEnvelopeTest.h:34
ActsTrk::GeometryEnvelopeTest::initialize
virtual StatusCode initialize() override final
Definition
GeometryEnvelopeTest.cxx:21
ActsTrk::GeometryEnvelopeTest::m_MsExitVolume
Gaudi::Property< std::string > m_MsExitVolume
Definition
GeometryEnvelopeTest.h:36
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:61
ActsTrk::GeometryEnvelopeTest::m_ITkExitVolume
Gaudi::Property< std::string > m_ITkExitVolume
Definition
GeometryEnvelopeTest.h:32
MuonGMR4::BoundsExpander::cornerPoints
static std::vector< Amg::Vector3D > cornerPoints(const Acts::GeometryContext &tgContext, const Acts::Volume &volume, const std::size_t nSegments=3)
Returns the vertices from a volume.
Definition
BoundsExpander.cxx:114
ActsTrk::detail::GeoVolIds
Define the volume parts of the GeometryIdentifier for each ATLAS subsystem centrally.
Definition
GeometryDefs.h:62
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:50
ActsTrk::SystemEnvelope::CaloExit
@ CaloExit
Definition
GeometryDefs.h:55
ActsTrk::SystemEnvelope::ITkExit
@ ITkExit
Definition
GeometryDefs.h:51
ActsTrk::SystemEnvelope::MsExit
@ MsExit
Definition
GeometryDefs.h:56
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