Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-26 08:45:08

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/Units.hpp"
0012 #include "Acts/Seeding/GbtsBinning.hpp"
0013 #include "Acts/Seeding/GbtsLayerConnection.hpp"
0014 #include "Acts/Seeding/GbtsLayerDescription.hpp"
0015 #include "Acts/Seeding/detail/GbtsLayer.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017 
0018 #include <cstdint>
0019 #include <map>
0020 #include <optional>
0021 #include <span>
0022 #include <vector>
0023 
0024 namespace Acts::Experimental {
0025 
0026 class GbtsNodeStorage;
0027 class GbtsTrackingFilter;
0028 class GraphBasedTrackSeeder;
0029 
0030 /// z0 range two eta bins must share a trajectory within, which fixes the bin
0031 /// table. A separate cut from `GraphBasedTrackSeeder::Config::minZ0`.
0032 struct GbtsZ0Range final {
0033   /// Minimum z0.
0034   float min = -168.0f * UnitConstants::mm;
0035   /// Maximum z0.
0036   float max = 168.0f * UnitConstants::mm;
0037   /// Margin added to both ends of the range, for hits off the layer line.
0038   float z0Tolerance = 5.0f * UnitConstants::mm;
0039 };
0040 
0041 /// Geometry helper built from layers and connectors.
0042 class GbtsGeometry final {
0043  public:
0044   /// Constructor
0045   /// @param layerDescriptions Layer descriptions for the layers
0046   /// @param layerConnections Pairs of layers the seeder may connect
0047   /// @param etaBinWidth Width of the eta bins each layer is split into
0048   /// @param z0Range z0 range the bin table is built against
0049   /// @param logger Logging instance, only used during construction
0050   GbtsGeometry(std::span<const GbtsLayerDescription> layerDescriptions,
0051                std::span<const GbtsLayerConnection> layerConnections,
0052                float etaBinWidth, const GbtsZ0Range& z0Range = {},
0053                const Logger& logger = getDummyLogger());
0054 
0055   /// Get the number of layers the geometry was built from
0056   /// @return The layer count
0057   std::size_t numLayers() const { return m_layers.size(); }
0058 
0059   /// Get the number of eta bins across all layers
0060   /// @return The bin count
0061   std::uint32_t numBins() const { return m_nEtaBins; }
0062 
0063   /// Resolve a layer id into the index GbtsNodeStorage::insert takes.
0064   /// @param id Layer id, as the layer descriptions carry it
0065   /// @return The layer's index, or nullopt if this geometry has no such layer
0066   std::optional<GbtsLayerIndex> layerIndex(GbtsExperimentLayerId id) const;
0067 
0068   /// Get the description a layer was built from
0069   /// @param idx Layer index
0070   /// @return Reference to the layer description
0071   const GbtsLayerDescription& layerDescription(GbtsLayerIndex idx) const {
0072     return layerByIndex(idx).layerDescription();
0073   }
0074 
0075   /// Get the eta binning the geometry gave a layer
0076   /// @param idx Layer index
0077   /// @return Reference to the layer's binning
0078   const GbtsLayerBinning& layerBinning(GbtsLayerIndex idx) const {
0079     return layerByIndex(idx).binning();
0080   }
0081 
0082   /// Get the eta bin pairs the graph is built over, in build order
0083   /// @return The bin groups
0084   std::span<const GbtsBinGroup> binGroups() const { return m_binGroups; }
0085 
0086  private:
0087   // The layer object is shared only with the classes that build the graph.
0088   friend class GbtsNodeStorage;
0089   friend class GbtsTrackingFilter;
0090   friend class GraphBasedTrackSeeder;
0091 
0092   /// Get layer by ID
0093   /// @param id Layer ID
0094   /// @return Pointer to layer or nullptr
0095   const detail::GbtsLayer* layerById(GbtsExperimentLayerId id) const;
0096 
0097   /// Get layer by index
0098   /// @param idx Layer index
0099   /// @return Reference to layer
0100   const detail::GbtsLayer& layerByIndex(GbtsLayerIndex idx) const;
0101 
0102   /// @param layerDescription Layer description for the layer
0103   /// @param bin0 Starting bin index
0104   /// @return Reference to the newly added layer
0105   const detail::GbtsLayer& createLayer(
0106       const GbtsLayerDescription& layerDescription, std::uint32_t bin0);
0107 
0108   /// Eta bin width
0109   float m_etaBinWidth{};
0110 
0111   /// Layer array
0112   std::vector<detail::GbtsLayer> m_layers;
0113   /// Layer per user ID map
0114   std::map<GbtsExperimentLayerId, GbtsLayerIndex> m_layerFromUserIdMap;
0115   /// Number of eta bins
0116   std::uint32_t m_nEtaBins{};
0117 
0118   /// Bin groups
0119   std::vector<GbtsBinGroup> m_binGroups;
0120 };
0121 
0122 }  // namespace Acts::Experimental