Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:41

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2016-2020 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 http://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 Acts::PerigeeSurface::PerigeeSurface(const Vector3& gp)
0019     : LineSurface(Transform3(Translation3(gp.x(), gp.y(), gp.z())), nullptr) {}
0020 
0021 Acts::PerigeeSurface::PerigeeSurface(const Transform3& transform)
0022     : GeometryObject(), LineSurface(transform) {}
0023 
0024 Acts::PerigeeSurface::PerigeeSurface(const PerigeeSurface& other)
0025     : GeometryObject(), LineSurface(other) {}
0026 
0027 Acts::PerigeeSurface::PerigeeSurface(const GeometryContext& gctx,
0028                                      const PerigeeSurface& other,
0029                                      const Transform3& shift)
0030     : GeometryObject(), LineSurface(gctx, other, shift) {}
0031 
0032 Acts::PerigeeSurface& Acts::PerigeeSurface::operator=(
0033     const PerigeeSurface& other) {
0034   if (this != &other) {
0035     LineSurface::operator=(other);
0036   }
0037   return *this;
0038 }
0039 
0040 Acts::Surface::SurfaceType Acts::PerigeeSurface::type() const {
0041   return Surface::Perigee;
0042 }
0043 
0044 std::string Acts::PerigeeSurface::name() const {
0045   return "Acts::PerigeeSurface";
0046 }
0047 
0048 std::ostream& Acts::PerigeeSurface::toStream(const GeometryContext& gctx,
0049                                              std::ostream& sl) const {
0050   sl << std::setiosflags(std::ios::fixed);
0051   sl << std::setprecision(7);
0052   sl << "Acts::PerigeeSurface:" << std::endl;
0053   const Vector3& sfCenter = center(gctx);
0054   sl << "     Center position  (x, y, z) = (" << sfCenter.x() << ", "
0055      << sfCenter.y() << ", " << sfCenter.z() << ")";
0056   sl << std::setprecision(-1);
0057   return sl;
0058 }
0059 
0060 Acts::Polyhedron Acts::PerigeeSurface::polyhedronRepresentation(
0061     const GeometryContext& gctx, std::size_t /*lseg*/) const {
0062   // Prepare vertices and faces
0063   std::vector<Vector3> vertices;
0064   std::vector<Polyhedron::FaceType> faces;
0065   std::vector<Polyhedron::FaceType> triangularMesh;
0066 
0067   const Transform3& ctransform = transform(gctx);
0068   Vector3 left(0, 0, -100.);
0069   Vector3 right(0, 0, 100.);
0070 
0071   // The central wire/straw
0072   vertices.push_back(ctransform * left);
0073   vertices.push_back(ctransform * right);
0074   faces.push_back({0, 1});
0075   vertices.push_back(ctransform * Vector3(0., 0., 0.));
0076   triangularMesh.push_back({0, 2, 1});
0077 
0078   return Polyhedron(vertices, faces, triangularMesh);
0079 }