ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkDetDescr
TrkVolumes
src
CuboidVolumeBounds.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// CuboidVolumeBounds.cxx, (c) ATLAS Detector software
8
9
// Trk
10
#include "
TrkVolumes/CuboidVolumeBounds.h
"
11
// TrkSurfaces
12
#include "
TrkSurfaces/PlaneSurface.h
"
13
#include "
TrkSurfaces/RectangleBounds.h
"
14
#include "
TrkSurfaces/Surface.h
"
15
// Gaudi
16
#include "GaudiKernel/MsgStream.h"
17
#include "GaudiKernel/SystemOfUnits.h"
18
// STD
19
#include <cmath>
20
#include <iostream>
21
22
Trk::CuboidVolumeBounds::CuboidVolumeBounds
()
23
:
VolumeBounds
()
24
,
m_halfX
(0.)
25
,
m_halfY
(0.)
26
,
m_halfZ
(0.)
27
,
m_objectAccessor
()
28
{}
29
30
Trk::CuboidVolumeBounds::CuboidVolumeBounds
(
31
double
halex,
32
double
haley,
33
double
halez)
34
:
VolumeBounds
()
35
,
m_halfX
(halex)
36
,
m_halfY
(haley)
37
,
m_halfZ
(halez)
38
,
m_objectAccessor
()
39
{}
40
41
Trk::CuboidVolumeBounds::CuboidVolumeBounds
(
const
Trk::CuboidVolumeBounds
& bobo)
42
:
VolumeBounds
()
43
,
m_halfX
(bobo.
m_halfX
)
44
,
m_halfY
(bobo.
m_halfY
)
45
,
m_halfZ
(bobo.
m_halfZ
)
46
,
m_objectAccessor
(bobo.
m_objectAccessor
)
47
{}
48
49
Trk::CuboidVolumeBounds::~CuboidVolumeBounds
() =
default
;
50
51
Trk::CuboidVolumeBounds
&
52
Trk::CuboidVolumeBounds::operator=
(
const
Trk::CuboidVolumeBounds
& bobo)
53
{
54
if
(
this
!= &bobo) {
55
m_halfX
= bobo.
m_halfX
;
56
m_halfY
= bobo.
m_halfY
;
57
m_halfZ
= bobo.
m_halfZ
;
58
m_objectAccessor
= bobo.
m_objectAccessor
;
59
}
60
return
*
this
;
61
}
62
63
std::vector<std::unique_ptr<Trk::Surface>>
64
Trk::CuboidVolumeBounds::decomposeToSurfaces
65
(
const
Amg::Transform3D
& transform)
66
{
67
68
auto
retsf = std::vector<std::unique_ptr<Trk::Surface>>() ;
69
// memory optimisation
70
retsf.reserve(6);
71
// face surfaces xy
72
// (1) - at negative local z
73
retsf.push_back(std::make_unique<Trk::PlaneSurface>(
74
Amg::Transform3D
(
75
transform *
76
Amg::AngleAxis3D
(180. * Gaudi::Units::deg,
Amg::Vector3D
(0., 1., 0.)) *
77
Amg::Translation3D
(
Amg::Vector3D
(0., 0., this->
halflengthZ
()))),
78
this->
faceXYRectangleBounds
()));
79
// (2) - at positive local z
80
retsf.push_back(std::make_unique<Trk::PlaneSurface>(
81
Amg::Transform3D
(
82
transform *
83
Amg::Translation3D
(
Amg::Vector3D
(0., 0., this->
halflengthZ
()))),
84
this->
faceXYRectangleBounds
()));
85
// face surfaces yz
86
// transmute cyclical
87
// (3) - at negative local x
88
retsf.push_back(std::make_unique<Trk::PlaneSurface>(
89
Amg::Transform3D
(
90
transform *
91
Amg::AngleAxis3D
(180. * Gaudi::Units::deg,
Amg::Vector3D
(0., 0., 1.)) *
92
Amg::Translation3D
(
Amg::Vector3D
(this->
halflengthX
(), 0., 0)) *
93
Amg::AngleAxis3D
(90. * Gaudi::Units::deg,
Amg::Vector3D
(0., 1., 0)) *
94
Amg::AngleAxis3D
(90. * Gaudi::Units::deg,
Amg::Vector3D
(0., 0., 1.))),
95
this->
faceYZRectangleBounds
()));
96
// (4) - at positive local x
97
retsf.push_back(std::make_unique<Trk::PlaneSurface>(
98
Amg::Transform3D
(
99
transform *
100
Amg::Translation3D
(
Amg::Vector3D
(this->
halflengthX
(), 0., 0.)) *
101
Amg::AngleAxis3D
(90. * Gaudi::Units::deg,
Amg::Vector3D
(0., 1., 0.)) *
102
Amg::AngleAxis3D
(90. * Gaudi::Units::deg,
Amg::Vector3D
(0., 0., 1.))),
103
this->
faceYZRectangleBounds
()));
104
// face surfaces zx
105
// (5) - at negative local y
106
retsf.push_back(std::make_unique<Trk::PlaneSurface>(
107
Amg::Transform3D
(
108
transform *
109
Amg::AngleAxis3D
(180. * Gaudi::Units::deg,
Amg::Vector3D
(1., 0., 0.)) *
110
Amg::Translation3D
(
Amg::Vector3D
(0., this->
halflengthY
(), 0.)) *
111
Amg::AngleAxis3D
(-90 * Gaudi::Units::deg,
Amg::Vector3D
(0., 1., 0.)) *
112
Amg::AngleAxis3D
(-90. * Gaudi::Units::deg,
Amg::Vector3D
(1., 0., 0.))),
113
this->
faceZXRectangleBounds
()));
114
// (6) - at positive local y
115
retsf.push_back(std::make_unique<Trk::PlaneSurface>(
116
Amg::Transform3D
(
117
transform *
118
Amg::Translation3D
(
Amg::Vector3D
(0., this->
halflengthY
(), 0.)) *
119
Amg::AngleAxis3D
(-90 * Gaudi::Units::deg,
Amg::Vector3D
(0., 1., 0.)) *
120
Amg::AngleAxis3D
(-90. * Gaudi::Units::deg,
Amg::Vector3D
(1., 0., 0.))),
121
this->
faceZXRectangleBounds
()));
122
123
return
retsf;
124
}
125
126
std::shared_ptr<Trk::RectangleBounds>
127
Trk::CuboidVolumeBounds::faceXYRectangleBounds
()
const
128
{
129
return
std::make_shared<Trk::RectangleBounds>(
m_halfX
,
m_halfY
);
130
}
131
132
std::shared_ptr<Trk::RectangleBounds>
133
Trk::CuboidVolumeBounds::faceYZRectangleBounds
()
const
134
{
135
return
std::make_shared<Trk::RectangleBounds>(
m_halfY
,
m_halfZ
);
136
}
137
138
std::shared_ptr<Trk::RectangleBounds>
139
Trk::CuboidVolumeBounds::faceZXRectangleBounds
()
const
140
{
141
return
std::make_shared<Trk::RectangleBounds>(
m_halfZ
,
m_halfX
);
142
}
143
144
// ostream operator overload
145
146
MsgStream&
147
Trk::CuboidVolumeBounds::dump
(MsgStream& sl)
const
148
{
149
150
std::stringstream temp_sl;
151
temp_sl << std::setiosflags(std::ios::fixed);
152
temp_sl << std::setprecision(7);
153
temp_sl <<
"Trk::CuboidVolumeBounds: (halfX, halfY, halfZ) = "
;
154
temp_sl <<
"("
<<
m_halfX
<<
", "
<<
m_halfY
<<
", "
<<
m_halfZ
<<
")"
;
155
sl << temp_sl.str();
156
return
sl;
157
}
158
159
std::ostream&
160
Trk::CuboidVolumeBounds::dump
(std::ostream& sl)
const
161
{
162
std::stringstream temp_sl;
163
temp_sl << std::setiosflags(std::ios::fixed);
164
temp_sl << std::setprecision(7);
165
temp_sl <<
"Trk::CuboidVolumeBounds: (halfX, halfY, halfZ) = "
;
166
temp_sl <<
"("
<<
m_halfX
<<
", "
<<
m_halfY
<<
", "
<<
m_halfZ
<<
")"
;
167
sl << temp_sl.str();
168
return
sl;
169
}
170
CuboidVolumeBounds.h
PlaneSurface.h
RectangleBounds.h
Surface.h
Trk::CuboidVolumeBounds
Bounds for a cubical Volume, the decomposeToSurfaces method creates a vector of 6 surfaces:
Definition
CuboidVolumeBounds.h:52
Trk::CuboidVolumeBounds::m_objectAccessor
SixObjectsAccessor m_objectAccessor
There's only one single object Acessor for the moment has to be implemented if Cuboids are used more ...
Definition
CuboidVolumeBounds.h:119
Trk::CuboidVolumeBounds::CuboidVolumeBounds
CuboidVolumeBounds()
Default Constructor.
Definition
CuboidVolumeBounds.cxx:22
Trk::CuboidVolumeBounds::halflengthX
double halflengthX() const
This method returns the halflength in local x.
Definition
CuboidVolumeBounds.h:132
Trk::CuboidVolumeBounds::decomposeToSurfaces
virtual std::vector< std::unique_ptr< Trk::Surface > > decomposeToSurfaces(const Amg::Transform3D &transform) override final
Method to decompose the Bounds into boundarySurfaces.
Definition
CuboidVolumeBounds.cxx:65
Trk::CuboidVolumeBounds::faceZXRectangleBounds
std::shared_ptr< RectangleBounds > faceZXRectangleBounds() const
This method returns the associated RecantleBounds of the face PlaneSurface parallel to local zx plane...
Definition
CuboidVolumeBounds.cxx:139
Trk::CuboidVolumeBounds::operator=
CuboidVolumeBounds & operator=(const CuboidVolumeBounds &bobo)
Assignment operator.
Definition
CuboidVolumeBounds.cxx:52
Trk::CuboidVolumeBounds::dump
MsgStream & dump(MsgStream &sl) const override final
Output Method for MsgStream.
Definition
CuboidVolumeBounds.cxx:147
Trk::CuboidVolumeBounds::m_halfX
double m_halfX
Definition
CuboidVolumeBounds.h:113
Trk::CuboidVolumeBounds::~CuboidVolumeBounds
virtual ~CuboidVolumeBounds()
Destructor.
Trk::CuboidVolumeBounds::faceYZRectangleBounds
std::shared_ptr< RectangleBounds > faceYZRectangleBounds() const
This method returns the associated RecantleBounds of the face PlaneSurface parallel to local yz plane...
Definition
CuboidVolumeBounds.cxx:133
Trk::CuboidVolumeBounds::m_halfZ
double m_halfZ
Definition
CuboidVolumeBounds.h:115
Trk::CuboidVolumeBounds::halflengthY
double halflengthY() const
This method returns the halflength in local y.
Definition
CuboidVolumeBounds.h:134
Trk::CuboidVolumeBounds::faceXYRectangleBounds
std::shared_ptr< RectangleBounds > faceXYRectangleBounds() const
This method returns the associated RecantleBounds of the face PlaneSurface parallel to local xy plane...
Definition
CuboidVolumeBounds.cxx:127
Trk::CuboidVolumeBounds::m_halfY
double m_halfY
Definition
CuboidVolumeBounds.h:114
Trk::CuboidVolumeBounds::halflengthZ
double halflengthZ() const
This method returns the halflength in local z.
Definition
CuboidVolumeBounds.h:136
Trk::VolumeBounds::VolumeBounds
VolumeBounds()
Default Constructor.
Definition
VolumeBounds.h:49
Amg::AngleAxis3D
Eigen::AngleAxisd AngleAxis3D
Definition
GeoPrimitives.h:45
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition
GeoPrimitives.h:46
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Amg::Translation3D
Eigen::Translation< double, 3 > Translation3D
Definition
GeoPrimitives.h:44
Generated on
for ATLAS Offline Software by
1.17.0