Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11: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/PerigeeSurface.hpp"
0010 
0011 #include "Acts/Geometry/GeometryObject.hpp"
0012 
0013 #include <iomanip>
0014 #include <iostream>
0015 #include <memory>
0016 #include <vector>
0017 
0018 namespace Acts {
0019 
0020 PerigeeSurface::PerigeeSurface(const Vector3& gp)
0021     : LineSurface(Transform3(Translation3(gp.x(), gp.y(), gp.z())), nullptr) {}
0022 
0023 PerigeeSurface::PerigeeSurface(const Transform3& transform)
0024     : GeometryObject(), LineSurface(transform) {}
0025 
0026 PerigeeSurface::PerigeeSurface(const PerigeeSurface& other)
0027     : GeometryObject(), LineSurface(other) {}
0028 
0029 PerigeeSurface::PerigeeSurface(const GeometryContext& gctx,
0030                                const PerigeeSurface& other,
0031                                const Transform3& shift)
0032     : GeometryObject(), LineSurface(gctx, other, shift) {}
0033 
0034 PerigeeSurface& PerigeeSurface::operator=(const PerigeeSurface& other) {
0035   if (this != &other) {
0036     LineSurface::operator=(other);
0037   }
0038   return *this;
0039 }
0040 
0041 Surface::SurfaceType PerigeeSurface::type() const {
0042   return Surface::Perigee;
0043 }
0044 
0045 std::string PerigeeSurface::name() const {
0046   return "Acts::PerigeeSurface";
0047 }
0048 
0049 std::ostream& PerigeeSurface::toStreamImpl(const GeometryContext& gctx,
0050                                            std::ostream& sl) const {
0051   sl << std::setiosflags(std::ios::fixed);
0052   sl << std::setprecision(7);
0053   sl << "Acts::PerigeeSurface:" << std::endl;
0054   const Vector3& sfCenter = center(gctx);
0055   sl << "     Center position  (x, y, z) = (" << sfCenter.x() << ", "
0056      << sfCenter.y() << ", " << sfCenter.z() << ")";
0057   sl << std::setprecision(-1);
0058   return sl;
0059 }
0060 
0061 Polyhedron PerigeeSurface::polyhedronRepresentation(
0062     const GeometryContext& gctx, unsigned int /*quarterSegments*/) const {
0063   // Prepare vertices and faces
0064   std::vector<Vector3> vertices;
0065   std::vector<Polyhedron::FaceType> faces;
0066   std::vector<Polyhedron::FaceType> triangularMesh;
0067 
0068   const Transform3& ctransform = transform(gctx);
0069   Vector3 left(0, 0, -100.);
0070   Vector3 right(0, 0, 100.);
0071 
0072   // The central wire/straw
0073   vertices.push_back(ctransform * left);
0074   vertices.push_back(ctransform * right);
0075   faces.push_back({0, 1});
0076   vertices.push_back(ctransform * Vector3(0., 0., 0.));
0077   triangularMesh.push_back({0, 2, 1});
0078 
0079   return Polyhedron(vertices, faces, triangularMesh);
0080 }
0081 
0082 }  // namespace Acts