Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:34

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