Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 07:45:30

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Surfaces/StrawSurface.hpp"
0010 
0011 #include "Acts/Geometry/GeometryObject.hpp"
0012 #include "Acts/Geometry/Polyhedron.hpp"
0013 #include "Acts/Surfaces/LineBounds.hpp"
0014 #include "Acts/Surfaces/detail/FacesHelper.hpp"
0015 #include "Acts/Surfaces/detail/VerticesHelper.hpp"
0016 
0017 #include <numbers>
0018 #include <utility>
0019 #include <vector>
0020 
0021 namespace Acts {
0022 
0023 Polyhedron StrawSurface::polyhedronRepresentation(
0024     const GeometryContext& gctx, unsigned int quarterSegments) const {
0025   // Prepare vertices and faces
0026   std::vector<Vector3> vertices;
0027   std::vector<Polyhedron::FaceType> faces;
0028   std::vector<Polyhedron::FaceType> triangularMesh;
0029 
0030   const Transform3& ctransform = localToGlobalTransform(gctx);
0031   // Draw the bounds if more than one segment are chosen
0032   if (quarterSegments > 0u) {
0033     double r = m_bounds->get(LineBounds::eR);
0034     // Write the two bows/circles on either side
0035     std::vector<int> sides = {-1, 1};
0036     for (auto& side : sides) {
0037       // Helper method to create the segment
0038       auto svertices = detail::VerticesHelper::segmentVertices(
0039           {r, r}, -std::numbers::pi, std::numbers::pi, {}, quarterSegments,
0040           Vector3(0., 0., side * m_bounds->get(LineBounds::eHalfLengthZ)),
0041           ctransform);
0042       vertices.insert(vertices.end(), svertices.begin(), svertices.end());
0043     }
0044     auto facesMesh = detail::FacesHelper::cylindricalFaceMesh(vertices);
0045     faces = facesMesh.first;
0046     triangularMesh = facesMesh.second;
0047   }
0048 
0049   std::size_t bvertices = vertices.size();
0050   Vector3 left(0, 0, -m_bounds->get(LineBounds::eHalfLengthZ));
0051   Vector3 right(0, 0, m_bounds->get(LineBounds::eHalfLengthZ));
0052   // The central wire/straw
0053   vertices.push_back(ctransform * left);
0054   vertices.push_back(ctransform * right);
0055   faces.push_back({bvertices, bvertices + 1});
0056   vertices.push_back(ctransform * Vector3(0., 0., 0.));
0057   triangularMesh.push_back({bvertices, bvertices + 2, bvertices + 1});
0058 
0059   return Polyhedron(vertices, faces, triangularMesh, false);
0060 }
0061 
0062 }  // namespace Acts