Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Volume.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Volume.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 
13 
14 #include <iostream>
15 #include <utility>
16 
17 using namespace Acts::UnitLiterals;
18 
20  std::shared_ptr<const VolumeBounds> volbounds)
21  : GeometryObject(),
22  m_transform(transform),
23  m_itransform(m_transform.inverse()),
25  m_volumeBounds(std::move(volbounds)),
27  nullptr, {0.05_mm, 0.05_mm, 0.05_mm}, this)) {}
28 
29 Acts::Volume::Volume(const Volume& vol, const Transform3& shift)
30  : GeometryObject(),
31  m_transform(shift * vol.m_transform),
32  m_itransform(m_transform.inverse()),
36  nullptr, {0.05_mm, 0.05_mm, 0.05_mm}, this)) {}
37 
39  Acts::BinningValue bValue) const {
40  // for most of the binning types it is actually the center,
41  // just for R-binning types the
42  if (bValue == Acts::binR || bValue == Acts::binRPhi) {
43  // the binning Position for R-type may have an offset
44  return (center() + m_volumeBounds->binningOffset(bValue));
45  }
46  // return the center
47  return center();
48 }
49 
50 // assignment operator
52  if (this != &vol) {
54  m_center = vol.m_center;
56  }
57  return *this;
58 }
59 
60 bool Acts::Volume::inside(const Acts::Vector3& gpos, double tol) const {
61  Acts::Vector3 posInVolFrame((transform().inverse()) * gpos);
62  return (volumeBounds()).inside(posInVolFrame, tol);
63 }
64 
65 std::ostream& Acts::operator<<(std::ostream& sl, const Acts::Volume& vol) {
66  sl << "Volume with " << vol.volumeBounds() << std::endl;
67  return sl;
68 }
69 
71  const Vector3& envelope) const {
72  return m_volumeBounds->boundingBox(&m_transform, envelope, this);
73 }
74 
76  return m_orientedBoundingBox;
77 }