ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DiscLayer.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DiscLayer.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 // DiscLayer.cpp, Acts project
12 
18 #include "Acts/Geometry/Layer.hpp"
23 
26 
27 Acts::DiscLayer::DiscLayer(const std::shared_ptr<const Transform3D>& transform,
28  const std::shared_ptr<const DiscBounds>& dbounds,
29  std::unique_ptr<SurfaceArray> surfaceArray,
30  double thickness,
31  std::unique_ptr<ApproachDescriptor> ades,
32  LayerType laytyp)
33  : DiscSurface(transform, dbounds),
34  Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) {
35  // In case we have Radial bounds
36  const RadialBounds* rBounds =
37  dynamic_cast<const RadialBounds*>(DiscSurface::m_bounds.get());
38  if (rBounds != nullptr) {
39  // The volume bounds
40  auto rVolumeBounds =
41  std::make_shared<const CylinderVolumeBounds>(*rBounds, thickness);
42  // @todo rotate around x for the avePhi if you have a sector
44  std::make_unique<AbstractVolume>(m_transform, rVolumeBounds);
45  }
46  // associate the layer to the layer surface itself
47  DiscSurface::associateLayer(*this);
48  // build an approach descriptor if none provided
51  }
52  // register the layer to the approach descriptor
55  }
56 }
57 
58 const Acts::DiscSurface& Acts::DiscLayer::surfaceRepresentation() const {
59  return (*this);
60 }
61 
63  return (*this);
64 }
65 
67  // delete it
68  m_approachDescriptor.reset(nullptr);
69  // take the boundary surfaces of the representving volume if they exist
70  if (m_representingVolume != nullptr) {
71  // get the boundary surfaces
72  const std::vector<std::shared_ptr<const BoundarySurfaceT<AbstractVolume>>>&
73  bSurfaces = m_representingVolume->boundarySurfaces();
74  // fill in the surfaces into the vector
75  std::vector<std::shared_ptr<const Surface>> aSurfaces;
76  aSurfaces.push_back(
77  bSurfaces.at(negativeFaceXY)->surfaceRepresentation().getSharedPtr());
78  aSurfaces.push_back(
79  bSurfaces.at(positiveFaceXY)->surfaceRepresentation().getSharedPtr());
80  // create an ApproachDescriptor with Boundary surfaces
81  m_approachDescriptor =
82  std::make_unique<const GenericApproachDescriptor>(std::move(aSurfaces));
83  }
84 
85  // @todo check if we can give the layer at curface creation
86  for (auto& sfPtr : (m_approachDescriptor->containedSurfaces())) {
87  if (sfPtr != nullptr) {
88  auto& mutableSf = *(const_cast<Surface*>(sfPtr));
89  mutableSf.associateLayer(*this);
90  }
91  }
92 }