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