Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:45

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 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Units.hpp"
0013 #include "Acts/Geometry/Extent.hpp"
0014 #include "Acts/Surfaces/Surface.hpp"
0015 
0016 #include <array>
0017 #include <functional>
0018 #include <memory>
0019 #include <optional>
0020 #include <tuple>
0021 #include <vector>
0022 
0023 namespace Acts {
0024 
0025 using namespace UnitLiterals;
0026 
0027 /// @brief  This file contains helper methods to build common support structures
0028 /// such as support cylinders or discs.
0029 ///
0030 /// It allows to model those as Disc/CylinderSurface objects, but also - if
0031 /// configured such - as approximations built from palanr surfaces
0032 namespace Experimental::detail::SupportSurfacesHelper {
0033 
0034 using SupportSurfaceComponents =
0035     std::tuple<Surface::SurfaceType, std::vector<double>, Acts::Transform3>;
0036 
0037 /// @brief  A support creator turns an extend into a vector of bound values
0038 using SurfaceComponentsCreator =
0039     std::function<SupportSurfaceComponents(const Extent&)>;
0040 
0041 /// @brief function descriptor for cylindrical support
0042 struct CylindricalSupport {
0043   /// Offset in R
0044   /// - negative indicates inner support
0045   /// - zero is centered (not recommended)
0046   /// - positive indicates outer support
0047   double rOffset = 0.;
0048 
0049   /// Clearance in z in order to make the support surfaces
0050   /// not touch the volume boundaries
0051   std::array<double, 2u> zClearance = {1_mm, 1_mm};
0052 
0053   /// Clearance in phi if a sectoral support is chosen
0054   /// not to touch the volume boundaries
0055   std::array<double, 2u> phiClearance = {0.0001_rad, 0.0001_rad};
0056 
0057   // Type is obviously a cylinder
0058   static constexpr Surface::SurfaceType type = Surface::SurfaceType::Cylinder;
0059 
0060   /// The support creator function
0061   ///
0062   /// @param lExtent the layer and/or volume extent
0063   ///
0064   /// @return the support surface components
0065   SupportSurfaceComponents operator()(const Extent& lExtent) const;
0066 };
0067 
0068 /// @brief function descriptor for disc-like support
0069 struct DiscSupport {
0070   /// Offset in z
0071   /// - negative indicates support an z min
0072   /// - zero is centered
0073   /// - positive indicates support at z max
0074   double zOffset = 0.;
0075 
0076   /// Clearance in r in order to make the support surfaces
0077   /// not touch the volume boundaries
0078   std::array<double, 2u> rClearance = {1_mm, 1_mm};
0079 
0080   /// Clearance in phi if a sectoral support is chosen
0081   /// not to touch the volume boundaries
0082   std::array<double, 2u> phiClearance = {0.0001_rad, 0.0001_rad};
0083 
0084   // Type is obviously a disc
0085   static constexpr Surface::SurfaceType type = Surface::SurfaceType::Disc;
0086 
0087   /// The support creator function
0088   ///
0089   /// @param lExtent the layer and/or volume extent
0090   ///
0091   /// @return the support surface components
0092   SupportSurfaceComponents operator()(const Extent& lExtent) const;
0093 };
0094 
0095 /// @brief Helper method to build planar support structure
0096 struct RectangularSupport {
0097   /// Placement - the remaining loc0, loc1 are then cyclic
0098   AxisDirection pPlacement = AxisDirection::AxisZ;
0099 
0100   /// Offset in position placement
0101   double pOffset = 0.;
0102 
0103   /// Clearance in first local direction - cyclic order
0104   std::array<double, 2u> loc0Clearance = {1_mm, 1_mm};
0105 
0106   /// Clearance in phi if a sectoral support is chosen
0107   /// not to touch the volume boundaries
0108   std::array<double, 2u> loc1Clearance = {1_mm, 1_mm};
0109 
0110   // Type is obviously a plane
0111   static constexpr Surface::SurfaceType type = Surface::SurfaceType::Plane;
0112 
0113   /// The support creator function
0114   ///
0115   /// @param lExtent the layer and/or volume extent
0116   ///
0117   /// @return the support surface components
0118   SupportSurfaceComponents operator()(const Extent& lExtent) const;
0119 };
0120 
0121 /// @brief Helper method to build cylindrical support structure
0122 ///
0123 /// @param components are the components generated by the SurfaceComponentsCreator function
0124 /// @param splits the number of surfaces through which the surface is approximated (1u ... cylinder)
0125 ///
0126 /// @return a vector of surfaces that represent this support
0127 std::vector<std::shared_ptr<Surface>> cylindricalSupport(
0128     const SupportSurfaceComponents& components, unsigned int splits = 1u);
0129 
0130 /// @brief Helper method to build disc support structure
0131 ///
0132 /// @param components are the components generated by the SurfaceComponentsCreator function
0133 /// @param splits the number of surfaces through which the surface is approximated (1u ... disc)
0134 ///
0135 /// @return a vector of surfaces that represent this support
0136 std::vector<std::shared_ptr<Surface>> discSupport(
0137     const SupportSurfaceComponents& components, unsigned int splits = 1u);
0138 
0139 /// @brief Helper method to build planar support structure
0140 ///
0141 /// @param components are the components generated by the SurfaceComponentsCreator function
0142 ///
0143 /// @return a vector of surfaces that represent this support
0144 std::vector<std::shared_ptr<Surface>> rectangularSupport(
0145     const SupportSurfaceComponents& components);
0146 
0147 /// Add support to already existing surfaces
0148 ///
0149 /// @param layerSurfaces [in, out] the surfaces to which those are added
0150 /// @param assignToAll [in, out] indices that are assigned to all bins in the indexing
0151 /// @param layerExtent the externally provided layer Extent
0152 /// @param componentCreator a function the support component creator
0153 /// @param supportSplits the number of splits if splitting is configured
0154 ///
0155 /// @note this modifies the layerSurfaces and toAllIndices
0156 void addSupport(std::vector<std::shared_ptr<Surface>>& layerSurfaces,
0157                 std::vector<std::size_t>& assignToAll,
0158                 const Extent& layerExtent,
0159                 const SurfaceComponentsCreator& componentCreator,
0160                 unsigned int supportSplits = 1u);
0161 
0162 }  // namespace Experimental::detail::SupportSurfacesHelper
0163 }  // namespace Acts