EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackingGeometry.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackingGeometry.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2019 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 // TrackingGeometry.cpp, Acts project
12 
14 
15 #include "Acts/Geometry/Layer.hpp"
19 
20 #include <functional>
21 
23  const MutableTrackingVolumePtr& highestVolume,
24  const IMaterialDecorator* materialDecorator)
25  : m_world(highestVolume),
26  m_beam(Surface::makeShared<PerigeeSurface>(s_origin)) {
27  // Close the geometry: assign geometryID and successively the material
28  size_t volumeID = 0;
29  highestVolume->closeGeometry(materialDecorator, m_trackingVolumes, volumeID);
30 }
31 
33 
35  const GeometryContext& gctx, const Acts::Vector3D& gp) const {
36  const TrackingVolume* searchVolume = m_world.get();
37  const TrackingVolume* currentVolume = nullptr;
38  while (currentVolume != searchVolume && (searchVolume != nullptr)) {
39  currentVolume = searchVolume;
40  searchVolume = searchVolume->lowestTrackingVolume(gctx, gp);
41  }
42  return currentVolume;
43 }
44 
46  const {
47  return (m_world.get());
48 }
49 
51  const std::string& name) const {
52  auto sVol = m_trackingVolumes.begin();
53  sVol = m_trackingVolumes.find(name);
54  if (sVol != m_trackingVolumes.end()) {
55  return (sVol->second);
56  }
57  return nullptr;
58 }
59 
61  const GeometryContext& gctx, const Acts::Vector3D& gp) const {
62  const TrackingVolume* lowestVol = (lowestTrackingVolume(gctx, gp));
63  return lowestVol->associatedLayer(gctx, gp);
64 }
65 
67  std::shared_ptr<const PerigeeSurface> beam) {
68  m_beam = std::move(beam);
69 }
70 
72  return m_beam.get();
73 }
74 
76  const std::function<void(const Acts::Surface*)>& visitor) const {
77  highestTrackingVolume()->visitSurfaces(visitor);
78 }