forked from sPHENIX-Collaboration/acts
/
PlaneLayer.cpp
84 lines (76 loc) · 3.27 KB
/
PlaneLayer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// This file is part of the Acts project.
//
// Copyright (C) 2016-2018 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
///////////////////////////////////////////////////////////////////
// PlaneLayer.cpp, Acts project
///////////////////////////////////////////////////////////////////
// Geometry module
#include <utility>
#include "Acts/Geometry/GenericApproachDescriptor.hpp"
#include "Acts/Geometry/PlaneLayer.hpp"
#include "Acts/Utilities/Definitions.hpp"
#include "Acts/Utilities/Helpers.hpp"
Acts::PlaneLayer::PlaneLayer(std::shared_ptr<const Transform3D> transform,
std::shared_ptr<const PlanarBounds>& pbounds,
std::unique_ptr<SurfaceArray> surfaceArray,
double thickness,
std::unique_ptr<ApproachDescriptor> ades,
LayerType laytyp)
: PlaneSurface(std::move(transform), pbounds),
Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) {
// @todo create representing volume
// register the layer to the surface
Acts::PlaneSurface::associateLayer(*this);
// deal with the approach descriptor
if (!m_approachDescriptor && m_surfaceArray) {
buildApproachDescriptor();
}
// register the layer to the approach descriptor
if (m_approachDescriptor) {
approachDescriptor()->registerLayer(*this);
}
}
const Acts::PlaneSurface& Acts::PlaneLayer::surfaceRepresentation() const {
return (*this);
}
Acts::PlaneSurface& Acts::PlaneLayer::surfaceRepresentation() {
return (*this);
}
void Acts::PlaneLayer::buildApproachDescriptor() {
// delete it
m_approachDescriptor.reset(nullptr);
// delete the surfaces
std::vector<std::shared_ptr<const Acts::Surface>> aSurfaces;
// get the appropriate transform, the center and the normal vector
//@todo fix with representing volume
const Transform3D& lTransform = PlaneSurface::transform(GeometryContext());
RotationMatrix3D lRotation = lTransform.rotation();
const Vector3D& lCenter = PlaneSurface::center(GeometryContext());
const Vector3D& lVector = Surface::normal(GeometryContext(), lCenter);
// create new surfaces
const Transform3D* apnTransform = new Transform3D(
Translation3D(lCenter - 0.5 * Layer::m_layerThickness * lVector) *
lRotation);
const Transform3D* appTransform = new Transform3D(
Translation3D(lCenter + 0.5 * Layer::m_layerThickness * lVector) *
lRotation);
// create the new surfaces
aSurfaces.push_back(Surface::makeShared<Acts::PlaneSurface>(
std::shared_ptr<const Transform3D>(apnTransform),
PlaneSurface::m_bounds));
aSurfaces.push_back(Surface::makeShared<Acts::PlaneSurface>(
std::shared_ptr<const Transform3D>(appTransform),
PlaneSurface::m_bounds));
// set the layer and make TrackingGeometry
for (auto& sfPtr : aSurfaces) {
auto mutableSf = const_cast<Surface*>(sfPtr.get());
mutableSf->associateLayer(*this);
}
// @todo check if we can provide the layer at surface creation
m_approachDescriptor =
std::make_unique<const GenericApproachDescriptor>(std::move(aSurfaces));
}