EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VolumeBounds.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file VolumeBounds.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2018 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 
9 #pragma once
10 #include "Acts/Geometry/Volume.hpp"
14 
15 #include <iomanip>
16 #include <iostream>
17 #include <memory>
18 
19 namespace Acts {
20 
21 class Surface;
22 class Volume;
23 
24 class VolumeBounds;
25 using VolumeBoundsPtr = std::shared_ptr<const VolumeBounds>;
26 
27 using SurfacePtr = std::shared_ptr<const Surface>;
28 using OrientedSurface = std::pair<SurfacePtr, NavigationDirection>;
29 using OrientedSurfaces = std::vector<OrientedSurface>;
30 
31 // Planar definitions to help construct the boundary surfaces
32 static const Transform3D s_planeXY = Transform3D::Identity();
33 static const Transform3D s_planeYZ =
34  AngleAxis3D(0.5 * M_PI, Vector3D::UnitY()) *
35  AngleAxis3D(0.5 * M_PI, Vector3D::UnitZ()) * Transform3D::Identity();
36 static const Transform3D s_planeZX =
37  AngleAxis3D(-0.5 * M_PI, Vector3D::UnitX()) *
38  AngleAxis3D(-0.5 * M_PI, Vector3D::UnitZ()) * Transform3D::Identity();
39 
51 
52 class VolumeBounds {
53  public:
54  // @enum BoundsType
57  enum BoundsType : int {
58  eCone = 0,
59  eCuboid = 1,
61  eCylinder = 3,
64  eOther = 6
65  };
66 
67  VolumeBounds() = default;
68 
69  virtual ~VolumeBounds() = default;
70 
74  virtual BoundsType type() const = 0;
75 
80  virtual std::vector<double> values() const = 0;
81 
88  virtual bool inside(const Vector3D& gpos, double tol = 0.) const = 0;
89 
101  const Transform3D& transform = Transform3D::Identity()) const = 0;
102 
109  const Transform3D* trf = nullptr, const Vector3D& envelope = {0, 0, 0},
110  const Volume* entity = nullptr) const = 0;
111 
117  virtual Vector3D binningOffset(BinningValue bValue) const;
118 
124  virtual double binningBorder(BinningValue bValue) const;
125 
129  virtual std::ostream& toStream(std::ostream& sl) const = 0;
130 };
131 
134  BinningValue /*bValue*/) const { // standard offset is 0.,0.,0.
135  return Vector3D(0., 0., 0.);
136 }
137 
138 inline double VolumeBounds::binningBorder(BinningValue /*bValue*/) const {
139  return 0.;
140 }
141 
143 std::ostream& operator<<(std::ostream& sl, const VolumeBounds& vb);
144 
145 inline bool operator==(const VolumeBounds& lhs, const VolumeBounds& rhs) {
146  if (&lhs == &rhs) {
147  return true;
148  }
149  return (lhs.type() == rhs.type()) && (lhs.values() == rhs.values());
150 }
151 
152 } // namespace Acts