ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractVolume.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AbstractVolume.cpp
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 
10 // AbstractVolume.cpp, Acts project
12 
14 #include <iostream>
15 #include <utility>
19 
21  std::shared_ptr<const Transform3D> htrans,
22  std::shared_ptr<const VolumeBounds> volbounds)
23  : Volume(std::move(htrans), std::move(volbounds)) {
24  createBoundarySurfaces();
25 }
26 
28 
29 const std::vector<Acts::BoundarySurfacePtr>&
31  return m_boundarySurfaces;
32 }
33 
35  // transform Surfaces To BoundarySurfaces
36  std::vector<std::shared_ptr<const Surface>> surfaces =
37  Volume::volumeBounds().decomposeToSurfaces(m_transform.get());
38 
39  // counter to flip the inner/outer position for Cylinders
40  int sfCounter = 0;
41  size_t sfNumber = surfaces.size();
42 
43  for (auto& sf : surfaces) {
44  // flip inner/outer for cylinders
45  AbstractVolume* inner =
46  (sf->type() == Surface::Cylinder && sfCounter == 3 && sfNumber > 3)
47  ? nullptr
48  : this;
49  AbstractVolume* outer = (inner) != nullptr ? nullptr : this;
50  // create the boundary surface
51  BoundarySurfacePtr bSurface =
52  std::make_shared<const BoundarySurfaceT<AbstractVolume>>(std::move(sf),
53  inner, outer);
54  m_boundarySurfaces.push_back(bSurface);
55  }
56 }