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 
15 #include "Acts/Geometry/Layer.hpp"
20 
23 
25  const std::shared_ptr<const DiscBounds>& dbounds,
26  std::unique_ptr<SurfaceArray> surfaceArray,
27  double thickness,
28  std::unique_ptr<ApproachDescriptor> ades,
29  LayerType laytyp)
30  : DiscSurface(transform, dbounds),
31  Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) {
32  // In case we have Radial bounds
33  const RadialBounds* rBounds =
34  dynamic_cast<const RadialBounds*>(DiscSurface::m_bounds.get());
35  if (rBounds != nullptr) {
36  // The volume bounds
37  auto rVolumeBounds =
38  std::make_shared<const CylinderVolumeBounds>(*rBounds, thickness);
39  // @todo rotate around x for the avePhi if you have a sector
41  std::make_unique<AbstractVolume>(m_transform, rVolumeBounds);
42  }
43  // associate the layer to the layer surface itself
44  DiscSurface::associateLayer(*this);
45  // build an approach descriptor if none provided
48  }
49  // register the layer to the approach descriptor
52  }
53 }
54 
55 const Acts::DiscSurface& Acts::DiscLayer::surfaceRepresentation() const {
56  return (*this);
57 }
58 
60  return (*this);
61 }
62 
64  // delete it
65  m_approachDescriptor.reset(nullptr);
66  // take the boundary surfaces of the representving volume if they exist
67  if (m_representingVolume != nullptr) {
68  // get the boundary surfaces
69  const std::vector<std::shared_ptr<const BoundarySurfaceT<AbstractVolume>>>&
70  bSurfaces = m_representingVolume->boundarySurfaces();
71  // fill in the surfaces into the vector
72  std::vector<std::shared_ptr<const Surface>> aSurfaces;
73  aSurfaces.push_back(
74  bSurfaces.at(negativeFaceXY)->surfaceRepresentation().getSharedPtr());
75  aSurfaces.push_back(
76  bSurfaces.at(positiveFaceXY)->surfaceRepresentation().getSharedPtr());
77  // create an ApproachDescriptor with Boundary surfaces
78  m_approachDescriptor =
79  std::make_unique<const GenericApproachDescriptor>(std::move(aSurfaces));
80  }
81 
82  // @todo check if we can give the layer at curface creation
83  for (auto& sfPtr : (m_approachDescriptor->containedSurfaces())) {
84  if (sfPtr != nullptr) {
85  auto& mutableSf = *(const_cast<Surface*>(sfPtr));
86  mutableSf.associateLayer(*this);
87  }
88  }
89 }