Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-25 09:02:28

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