Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Acts/Detector/LayerStructureBuilder.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2023 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 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Detector/DetectorComponents.hpp"
0013 #include "Acts/Detector/ProtoBinning.hpp"
0014 #include "Acts/Detector/ProtoSupport.hpp"
0015 #include "Acts/Detector/interface/IInternalStructureBuilder.hpp"
0016 #include "Acts/Detector/interface/ISurfacesProvider.hpp"
0017 #include "Acts/Geometry/GeometryContext.hpp"
0018 #include "Acts/Surfaces/Surface.hpp"
0019 #include "Acts/Utilities/BinningData.hpp"
0020 #include "Acts/Utilities/BinningType.hpp"
0021 #include "Acts/Utilities/Logger.hpp"
0022 
0023 #include <array>
0024 #include <cstddef>
0025 #include <functional>
0026 #include <memory>
0027 #include <optional>
0028 #include <string>
0029 #include <vector>
0030 
0031 namespace Acts::Experimental {
0032 
0033 /// @brief This is a builder of layer structures to be contained
0034 /// within a DetectorVolume, it extends the IInternalStructureBuilder
0035 /// interface and provides the internal structure components of
0036 /// DetectorVolume objects to be constructed.
0037 ///
0038 /// It uses the IndexedSurfaceGrid to bin the internal surfaces,
0039 /// and allows for additional support surfaces that are added to the
0040 /// structure and indexing mechanism. Those support structures can
0041 /// also be approximated by planar surfaces, in order to facilitate
0042 /// vectorization of surface intersection calls.
0043 ///
0044 /// The binning can be chosen with a so called `expansion`, a number
0045 /// which indicates the configured expanded bin window in which the
0046 /// surfaces are going to be filled, the details to this strategy
0047 /// can be found in the IndexedGridFiller and IndexedSurfacesGenerator
0048 /// classes.
0049 ///
0050 /// No sub volumes are added to this structure builders, hence,
0051 /// the DetectorVolumeFinder navigation delegate uses the "NoopFinder"
0052 /// breakpoint to indicate the bottom of the volume hierarchy.
0053 ///
0054 class LayerStructureBuilder : public IInternalStructureBuilder {
0055  public:
0056   /// @brief A holder struct for surfaces
0057   class SurfacesHolder final : public ISurfacesProvider {
0058    public:
0059     /// Constructor with predefined surfaces
0060     /// @param isurfaces is the vector of surfaces
0061     SurfacesHolder(std::vector<std::shared_ptr<Surface>> isurfaces)
0062         : m_surfaces(std::move(isurfaces)) {}
0063 
0064     /// Return the surfaces from the holder
0065     /// @param gctx is the geometry context
0066     std::vector<std::shared_ptr<Surface>> surfaces(
0067         [[maybe_unused]] const GeometryContext& gctx) const final {
0068       return m_surfaces;
0069     }
0070 
0071    private:
0072     std::vector<std::shared_ptr<Surface>> m_surfaces = {};
0073   };
0074 
0075   /// @brief Configuration struct for the LayerStructureBuilder
0076   ///
0077   /// It contain:
0078   /// - a source of the surfaces to be built
0079   /// - a definition of surface binning on this layer
0080   /// - a definition of supports to be built
0081   struct Config {
0082     /// Connection point for a function to provide surfaces
0083     std::shared_ptr<ISurfacesProvider> surfacesProvider = nullptr;
0084     /// Definition of Supports
0085     std::vector<ProtoSupport> supports = {};
0086     /// Definition of Binnings
0087     std::vector<ProtoBinning> binnings = {};
0088     /// Optional extent (if already parsed), will trigger binning autorange
0089     /// check
0090     std::optional<Extent> extent = std::nullopt;
0091     /// Minimum number of surfaces to build an internal structure
0092     /// - otherwise the tryAll options is used
0093     unsigned int nMinimalSurfaces = 4u;
0094     /// Polyhedron approximations
0095     unsigned int nSegments = 1u;
0096     /// Extra information, mainly for screen output
0097     std::string auxiliary = "";
0098   };
0099 
0100   /// Constructor
0101   ///
0102   /// @param cfg is the configuration struct
0103   /// @param logger logging instance for screen output
0104   LayerStructureBuilder(const Config& cfg,
0105                         std::unique_ptr<const Logger> logger = getDefaultLogger(
0106                             "LayerStructureBuilder", Logging::INFO));
0107 
0108   /// The interface definition for internal structure creation
0109   ///
0110   /// @param gctx the geometry context at the creation of the internal structure
0111   ///
0112   /// This will take the surfaces from the surfaces provider and use the binning
0113   /// description to create an internal indexed surface structure.
0114   ///
0115   /// @note if the configuration provides an extent, the range of the binning
0116   ///      will be checked againstit and adapted if necessary
0117   ///
0118   /// @return a consistent set of detector volume internals
0119   InternalStructure construct(const GeometryContext& gctx) const final;
0120 
0121  private:
0122   /// Configuration object
0123   Config m_cfg;
0124 
0125   /// Private access method to the logger
0126   const Logger& logger() const { return *m_logger; }
0127 
0128   /// Logging instance
0129   std::unique_ptr<const Logger> m_logger;
0130 };
0131 
0132 }  // namespace Acts::Experimental