Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-13 08:15:57

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/EventData/SourceLink.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/SpacePointFormation/SpacePointBuilderConfig.hpp"
0014 #include "Acts/SpacePointFormation/SpacePointBuilderOptions.hpp"
0015 #include "Acts/Utilities/Logger.hpp"
0016 #include "Acts/Utilities/SpacePointUtility.hpp"
0017 
0018 #include <boost/container/static_vector.hpp>
0019 
0020 namespace Acts {
0021 
0022 /// @class SpacePointBuilder
0023 ///
0024 /// After the particle interaction with surfaces are recorded and digitized
0025 /// measurements on the pixel or strip detectors need further treatment. This
0026 /// class takes the SouceLinks and provides the corresponding space points.
0027 ///
0028 template <typename spacepoint_t>
0029 class SpacePointBuilder {
0030  public:
0031   /// Type alias for space point builder function
0032   using BuilderFunction = std::function<spacepoint_t(
0033       Acts::Vector3, std::optional<double>, Acts::Vector2,
0034       std::optional<double>, boost::container::static_vector<SourceLink, 2>)>;
0035 
0036   // Constructor
0037   /// @param cfg The configuration for the space point builder
0038   /// @param func The function that provides user's SP constructor with global pos, global cov, and sourceLinks.
0039   /// @param logger The logging instance
0040   SpacePointBuilder(const SpacePointBuilderConfig& cfg, BuilderFunction func,
0041                     std::unique_ptr<const Logger> logger =
0042                         getDefaultLogger("SpacePointBuilder", Logging::INFO));
0043 
0044   // Default constructor
0045   SpacePointBuilder() = default;
0046 
0047   /// @brief Calculates the space points out of a given collection of SourceLinks
0048   /// and stores the results
0049   ///
0050   /// @param gctx The current geometry context object, e.g. alignment
0051   /// @param sourceLinks vector of Sourcelink
0052   /// @param opt option for the space point building. It contains the ends of the strips for strip SP building
0053   /// @param spacePointIt Output iterator for the space point
0054   template <template <typename...> typename container_t>
0055   void buildSpacePoint(
0056       const GeometryContext& gctx, const std::vector<SourceLink>& sourceLinks,
0057       const SpacePointBuilderOptions& opt,
0058       std::back_insert_iterator<container_t<spacepoint_t>> spacePointIt) const;
0059 
0060   /// @brief Searches possible combinations of two SourceLinks on different
0061   /// surfaces that may come from the same particles
0062   ///
0063   /// @param gctx The current geometry context object, e.g. alignment
0064   /// @param slinksFront vector of Sourcelinks on a surface
0065   /// @param slinksBack vector of SoruceLinks on another surface
0066   /// @param slinkPairs storage of the SouceLink pairs
0067   /// @param pairOpt pair maker option with paramCovAccessor
0068   void makeSourceLinkPairs(
0069       const GeometryContext& gctx, const std::vector<SourceLink>& slinksFront,
0070       const std::vector<SourceLink>& slinksBack,
0071       std::vector<std::pair<SourceLink, SourceLink>>& slinkPairs,
0072       const StripPairOptions& pairOpt) const;
0073 
0074  protected:
0075   /// Configuration of the single hit space point builder
0076   SpacePointBuilderConfig m_config;
0077 
0078   /// @brief Function to create external space point
0079   /// The constructor of spacepoint_t with Vector3 global pos, Vector2 global
0080   /// cov, and vector of source link pointers.
0081   BuilderFunction m_spConstructor;
0082 
0083   /// the logging instance
0084   std::unique_ptr<const Acts::Logger> m_logger;
0085 
0086   /// Utility for space point calculations
0087   std::shared_ptr<const SpacePointUtility> m_spUtility;
0088 
0089   /// Get the logger instance
0090   /// @return Reference to the logger
0091   const Logger& logger() const { return *m_logger; }
0092 };
0093 
0094 }  // namespace Acts
0095 
0096 #include "Acts/SpacePointFormation/SpacePointBuilder.ipp"