EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CuboidVolumeBounds.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CuboidVolumeBounds.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
15 
16 #include <cmath>
17 #include <iostream>
18 
20  double halez)
21  : VolumeBounds(), m_values({halex, haley, halez}) {
22  checkConsistency();
24 }
25 
27  : VolumeBounds(),
28  m_values(bobo.m_values),
29  m_xyBounds(bobo.m_xyBounds),
30  m_yzBounds(bobo.m_yzBounds),
31  m_zxBounds(bobo.m_zxBounds) {}
32 
34  const CuboidVolumeBounds& bobo) {
35  if (this != &bobo) {
36  m_values = bobo.m_values;
37  m_xyBounds = bobo.m_xyBounds;
38  m_yzBounds = bobo.m_yzBounds;
39  m_zxBounds = bobo.m_zxBounds;
40  }
41  return *this;
42 }
43 
45  const Transform3D& transform) const {
46  OrientedSurfaces oSurfaces;
47  oSurfaces.reserve(6);
48  // Face surfaces xy -------------------------------------
49  // (1) - at negative local z
50  auto sf = Surface::makeShared<PlaneSurface>(
51  transform * Translation3D(0., 0., -get(eHalfLengthZ)), m_xyBounds);
52  oSurfaces.push_back(OrientedSurface(std::move(sf), forward));
53  // (2) - at positive local z
54  sf = Surface::makeShared<PlaneSurface>(
55  transform * Translation3D(0., 0., get(eHalfLengthZ)), m_xyBounds);
56  oSurfaces.push_back(OrientedSurface(std::move(sf), backward));
57  // Face surfaces yz -------------------------------------
58  // (3) - at negative local x
59  sf = Surface::makeShared<PlaneSurface>(
60  transform * Translation3D(-get(eHalfLengthX), 0., 0.) * s_planeYZ,
61  m_yzBounds);
62  oSurfaces.push_back(OrientedSurface(std::move(sf), forward));
63  // (4) - at positive local x
64  sf = Surface::makeShared<PlaneSurface>(
65  transform * Translation3D(get(eHalfLengthX), 0., 0.) * s_planeYZ,
66  m_yzBounds);
67  oSurfaces.push_back(OrientedSurface(std::move(sf), backward));
68  // Face surfaces zx -------------------------------------
69  // (5) - at negative local y
70  sf = Surface::makeShared<PlaneSurface>(
71  transform * Translation3D(0., -get(eHalfLengthY), 0.) * s_planeZX,
72  m_zxBounds);
73  oSurfaces.push_back(OrientedSurface(std::move(sf), forward));
74  // (6) - at positive local y
75  sf = Surface::makeShared<PlaneSurface>(
76  transform * Translation3D(0., get(eHalfLengthY), 0.) * s_planeZX,
77  m_zxBounds);
78  oSurfaces.push_back(OrientedSurface(std::move(sf), backward));
79 
80  return oSurfaces;
81 }
82 
83 std::ostream& Acts::CuboidVolumeBounds::toStream(std::ostream& sl) const {
84  return dumpT(sl);
85 }
86 
88  const Acts::Transform3D* trf, const Vector3D& envelope,
89  const Volume* entity) const {
90  Vector3D vmin(-get(eHalfLengthX), -get(eHalfLengthY), -get(eHalfLengthZ));
91  Vector3D vmax(get(eHalfLengthX), get(eHalfLengthY), get(eHalfLengthZ));
92 
93  Volume::BoundingBox box(entity, vmin - envelope, vmax + envelope);
94  return trf == nullptr ? box : box.transformed(*trf);
95 }
96 
98  m_xyBounds = std::make_shared<const RectangleBounds>(get(eHalfLengthX),
99  get(eHalfLengthY));
100  m_yzBounds = std::make_shared<const RectangleBounds>(get(eHalfLengthY),
101  get(eHalfLengthZ));
102  m_zxBounds = std::make_shared<const RectangleBounds>(get(eHalfLengthZ),
103  get(eHalfLengthX));
104 }