10 #include "Acts/Surfaces/ConeSurface.hpp"
11 #include "Acts/Surfaces/CylinderSurface.hpp"
12 #include "Acts/Surfaces/DiscSurface.hpp"
13 #include "Acts/Surfaces/PerigeeSurface.hpp"
14 #include "Acts/Surfaces/PlaneSurface.hpp"
15 #include "Acts/Surfaces/RectangleBounds.hpp"
16 #include "Acts/Surfaces/StrawSurface.hpp"
17 #include "Acts/Surfaces/SurfaceBounds.hpp"
21 std::vector<float>& translation,
23 std::vector<float>& boundValues,
24 const Acts::Surface* surface,
25 const Acts::GeometryContext& geoContext) {
30 switch (surface->type()){
42 surfaceType = xAOD::SurfaceType::Perigee;
54 surfaceType = xAOD::SurfaceType::Other;
58 Acts::RotationMatrix3 lRotation =
59 surface->transform(geoContext).rotation();
60 Acts::Vector3 eulerAngles = lRotation.eulerAngles(2, 1, 0);
61 Acts::Vector3 lTranslation = surface->center(geoContext);
63 for (
int i = 0;
i < 3; ++
i) {
65 translation.push_back(lTranslation[
i]);
68 const std::vector<double>&
values = surface->bounds().values();
69 boundValues.insert(boundValues.end(),
values.begin(),
values.end());
73 const Acts::Surface* surface,
74 const Acts::GeometryContext&
geo) {
76 s->boundValues[
i], surface,
geo);
80 const Acts::GeometryContext&
geo) {
82 std::vector<float> translation,
rotation, bounds;
85 s->setSurfaceType(surfaceType);
86 s->setTranslation(translation);
88 s->setBoundValues(bounds);
93 const std::vector<float>&
rotation,
const std::vector<float>& boundValues) {
104 switch (surfaceType) {
107 return Acts::Surface::makeShared<Acts::ConeSurface>(std::move(
transform),
108 boundValues[0], boundValues[1], boundValues[2], boundValues[3]);
111 const float fixedPhi = boundValues[2] >
M_PI - 0.001 ?
M_PI - 0.001 : boundValues[2];
112 return Acts::Surface::makeShared<Acts::CylinderSurface>(std::move(
transform),
113 boundValues[0], boundValues[1], fixedPhi, boundValues[3], boundValues[4]);
115 return Acts::Surface::makeShared<Acts::DiscSurface>(std::move(
transform),
116 boundValues[0], boundValues[1], boundValues[2]);
118 return Acts::Surface::makeShared<Acts::PerigeeSurface>(std::move(
transform));
120 Acts::Vector2
min(boundValues[0], boundValues[1]),
121 max(boundValues[2], boundValues[3]);
122 auto rBounds = std::make_shared<const Acts::RectangleBounds>(
min,
max);
123 return Acts::Surface::makeShared<Acts::PlaneSurface>(std::move(
transform), rBounds);
125 return Acts::Surface::makeShared<Acts::StrawSurface>(std::move(
transform),
126 boundValues[0], boundValues[1]);
129 THROW_EXCEPTION(
"EncodeSurface this type " <<
static_cast<int>(surfaceType)<<
130 " of xAOD::surface cannot be converted into an Acts one");