ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Layer.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Layer.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 // Layer.cpp, Acts project
12 
13 // Geometry module
14 #include "Acts/Geometry/Layer.hpp"
18 
19 Acts::Layer::Layer(std::unique_ptr<SurfaceArray> surfaceArray, double thickness,
20  std::unique_ptr<ApproachDescriptor> ades, LayerType laytyp)
21  : m_nextLayers(NextLayers(nullptr, nullptr)),
22  m_surfaceArray(surfaceArray.release()),
23  m_layerThickness(thickness),
24  m_approachDescriptor(nullptr),
25  m_representingVolume(nullptr),
26  m_layerType(laytyp),
27  m_ssRepresentingSurface(1) {
28  if (ades) {
29  ades->registerLayer(*this);
30  m_approachDescriptor = std::move(ades);
31  m_ssApproachSurfaces = 1; // indicates existence
32  }
33  // indicates existence of sensitive surfaces
34  if (m_surfaceArray) {
36  }
37 }
38 
40  return m_approachDescriptor.get();
41 }
42 
44  return const_cast<ApproachDescriptor*>(m_approachDescriptor.get());
45 }
46 
47 void Acts::Layer::closeGeometry(const IMaterialDecorator* materialDecorator,
48  const GeometryID& layerID) {
49  // set the volumeID of this
50  assignGeoID(layerID);
51  // assign to the representing surface
52  Surface* rSurface = const_cast<Surface*>(&surfaceRepresentation());
53  if (materialDecorator != nullptr) {
54  materialDecorator->decorate(*rSurface);
55  }
56 
57  // also find out how the sub structure is defined
58  if (surfaceRepresentation().surfaceMaterial() != nullptr) {
59  m_ssRepresentingSurface = 2;
60  }
61  // loop over the approach surfaces
62  if (m_approachDescriptor) {
63  // indicates the existance of approach surfaces
64  m_ssApproachSurfaces = 1;
65  // loop through the approachSurfaces and assign unique GeomeryID
66  GeometryID::Value iasurface = 0;
67  for (auto& aSurface : m_approachDescriptor->containedSurfaces()) {
68  auto asurfaceID = GeometryID(layerID).setApproach(++iasurface);
69  auto mutableASurface = const_cast<Surface*>(aSurface);
70  mutableASurface->assignGeoID(asurfaceID);
71  if (materialDecorator != nullptr) {
72  materialDecorator->decorate(*mutableASurface);
73  }
74  // if any of the approach surfaces has material
75  if (aSurface->surfaceMaterial() != nullptr) {
76  m_ssApproachSurfaces = 2;
77  }
78  }
79  }
80  // check if you have sensitive surfaces
81  if (m_surfaceArray) {
82  // indicates the existance of sensitive surfaces
83  m_ssSensitiveSurfaces = 1;
84  // loop sensitive surfaces and assign unique GeometryID
85  GeometryID::Value issurface = 0;
86  for (auto& sSurface : m_surfaceArray->surfaces()) {
87  auto ssurfaceID = GeometryID(layerID).setSensitive(++issurface);
88  auto mutableSSurface = const_cast<Surface*>(sSurface);
89  mutableSSurface->assignGeoID(ssurfaceID);
90  if (materialDecorator != nullptr) {
91  materialDecorator->decorate(*mutableSSurface);
92  }
93  // if any of the sensitive surfaces has material
94  if (sSurface->surfaceMaterial() != nullptr) {
95  m_ssSensitiveSurfaces = 2;
96  }
97  }
98  }
99 }