Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-13 07:50:19

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