20 #include "GaudiKernel/MsgStream.h"
21 #include "GaudiKernel/SystemOfUnits.h"
36 , m_boundaryAccessors()
42 , m_outerRadius(std::abs(
radius))
43 , m_halfPhiSector(
M_PI)
44 , m_halfZ(std::abs(halez))
45 , m_boundaryAccessors()
53 , m_innerRadius(std::abs(rinner))
54 , m_outerRadius(std::abs(router))
55 , m_halfPhiSector(
M_PI)
56 , m_halfZ(std::abs(halez))
57 , m_boundaryAccessors()
66 , m_innerRadius(std::abs(rinner))
67 , m_outerRadius(std::abs(router))
68 , m_halfPhiSector(haphi)
69 , m_halfZ(std::abs(halez))
70 , m_boundaryAccessors()
76 , m_innerRadius(cylbo.m_innerRadius)
77 , m_outerRadius(cylbo.m_outerRadius)
78 , m_halfPhiSector(cylbo.m_halfPhiSector)
79 , m_halfZ(cylbo.m_halfZ)
80 , m_boundaryAccessors()
97 std::vector<std::unique_ptr<Trk::Surface>>
101 auto retsf = std::vector<std::unique_ptr<Trk::Surface>>();
106 bool isConcentric =
transform.isApprox(Amg::Transform3D::Identity());
113 bottomDiscRot.col(0) = discRot.col(1);
114 bottomDiscRot.col(1) = discRot.col(0);
115 bottomDiscRot.col(2) = -discRot.col(2);
116 retsf.push_back(std::make_unique<Trk::DiscSurface>(
120 bottomDiscBounds()));
122 retsf.push_back(std::make_unique<Trk::DiscSurface>(
127 retsf.push_back(std::make_unique<Trk::CylinderSurface>(
130 retsf.push_back(std::make_unique<Trk::CylinderSurface>(outerCylinderBounds()));
133 if (innerRadius() > s_numericalStable) {
135 retsf.push_back(std::make_unique<Trk::CylinderSurface>(
138 retsf.push_back(std::make_unique<Trk::CylinderSurface>(innerCylinderBounds()));
141 if (std::abs(halfPhiSector() -
M_PI) > s_numericalStable) {
143 retsf.push_back(std::make_unique<Trk::PlaneSurface>(
149 sectorPlaneBounds()));
151 retsf.push_back(std::make_unique<Trk::PlaneSurface>(
157 sectorPlaneBounds()));
170 m_innerRadius > s_numericalStable &&
171 std::abs(m_halfPhiSector -
M_PI) < s_numericalStable) {
173 double posZ = gp.z();
174 double posR = gp.perp();
182 bool isOnFace =
false;
183 bool intersectionIndicator = (
deltaR > 0.);
184 bool choiceIndicator =
false;
189 std::abs(
posZ + m_halfZ) < s_numericalStable ||
193 std::abs(
posZ - m_halfZ) < s_numericalStable ||
198 std::abs(posR - m_innerRadius) < s_numericalStable ||
199 (posR < m_innerRadius && deltaR > 0.)) {
205 std::abs(posR - m_outerRadius) < s_numericalStable ||
206 (posR > m_outerRadius &&
deltaR < 0.)) {
216 if (intersectionIndicator) {
220 double zOfIntersect = intersectRmax.
yOfX;
222 if (std::abs(zOfIntersect) <= m_halfZ)
223 return {(choiceIndicator || zOfIntersect > 0.)
224 ? m_boundaryAccessors.tubeAccessor(
226 : m_boundaryAccessors.tubeAccessor(
230 (choiceIndicator || zOfIntersect > 0.)
232 : m_boundaryAccessors.tubeAccessor(
238 double zOfIntersect = intersectRmin.
yOfX;
240 if (std::abs(zOfIntersect) <= m_halfZ)
242 (choiceIndicator || zOfIntersect > 0.)
244 : m_boundaryAccessors.tubeAccessor(
248 (choiceIndicator || zOfIntersect > 0.)
257 if (posR < m_innerRadius &&
deltaR < 0.)
259 if (posR > m_outerRadius &&
deltaR > 0.)
272 double zOfIntersect = intersectRmax.
yOfX;
274 if (std::abs(zOfIntersect) <= m_halfZ && zOfIntersect > 0.)
276 if (std::abs(zOfIntersect) <= m_halfZ && zOfIntersect < 0.)
278 if (std::abs(zOfIntersect) > m_halfZ && zOfIntersect < 0.)
280 if (std::abs(zOfIntersect) > m_halfZ && zOfIntersect > 0.)
288 double zOfIntersect = intersectRmin.
yOfX;
290 if (std::abs(zOfIntersect) <= m_halfZ && zOfIntersect > 0.)
292 if (std::abs(zOfIntersect) <= m_halfZ && zOfIntersect < 0.)
294 if (std::abs(zOfIntersect) > m_halfZ && zOfIntersect > 0.)
301 m_innerRadius < s_numericalStable &&
302 std::abs(m_halfPhiSector -
M_PI) < s_numericalStable) {
305 double posZ = gp.z();
306 double posR = gp.perp();
309 bool isOnCylinder = (std::abs(posR - m_outerRadius) < s_numericalStable);
317 int radiusSign =
deltaR > 0. ? 1 : -1;
325 radiusSign * m_outerRadius);
328 double zOfIntersect = intersectR.
yOfX;
330 bool intersectsCylinder =
331 !isOnCylinder ? (zOfIntersect * zOfIntersect <= m_halfZ * m_halfZ)
335 if (intersectsCylinder && zOfIntersect > 0.)
337 if (intersectsCylinder && zOfIntersect <= 0.)
344 if (m_innerRadius != 0. && std::abs(m_halfPhiSector -
M_PI) > 10
e-3)
345 return {m_boundaryAccessors.sectoralCylinderAccessor(
351 std::shared_ptr<Trk::CylinderBounds>
354 return std::make_shared<Trk::CylinderBounds>(m_innerRadius, m_halfPhiSector, m_halfZ);
357 std::shared_ptr<Trk::CylinderBounds>
360 return std::make_shared<Trk::CylinderBounds>(m_outerRadius, m_halfPhiSector, m_halfZ);
363 std::shared_ptr<Trk::DiscBounds>
366 return std::make_shared<Trk::DiscBounds>(m_innerRadius, m_outerRadius, m_halfPhiSector);
369 std::shared_ptr<Trk::RectangleBounds>
372 return std::make_shared<Trk::RectangleBounds>(
373 0.5 * (m_outerRadius - m_innerRadius), m_halfZ);
381 std::stringstream temp_sl;
382 temp_sl << std::setiosflags(std::ios::fixed);
383 temp_sl << std::setprecision(2);
384 temp_sl <<
"Trk::CylinderVolumeBounds: (rMin, rMax, halfPhi, halfZ) = ";
385 temp_sl << m_innerRadius <<
", " << m_outerRadius <<
", " << m_halfPhiSector
394 std::stringstream temp_sl;
395 temp_sl << std::setiosflags(std::ios::fixed);
396 temp_sl << std::setprecision(2);
397 temp_sl <<
"Trk::CylinderVolumeBounds: (rMin, rMax, halfPhi, halfZ) = ";
398 temp_sl << m_innerRadius <<
", " << m_outerRadius <<
", " << m_halfPhiSector