Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-17 07:59:45

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/Seeding2/GbtsConfig.hpp"
0012 #include "Acts/Seeding2/GbtsDataStorage.hpp"
0013 #include "Acts/Seeding2/GbtsGeometry.hpp"
0014 
0015 #include <cstring>
0016 #include <vector>
0017 
0018 namespace Acts::Experimental {
0019 
0020 /// Per-edge tracking state used by the GBTS filter.
0021 struct GbtsEdgeState final {
0022  public:
0023   GbtsEdgeState() = default;
0024 
0025   /// Constructor with initialization flag
0026   /// @param f Initialization flag
0027   explicit GbtsEdgeState(bool f) : initialized(f) {}
0028 
0029   /// Initialize from edge
0030   /// @param pS Edge to initialize from
0031   void initialize(const GbtsEdge& pS);
0032 
0033   /// Initialization flag
0034   bool initialized{false};
0035 
0036   /// Score for comparison
0037   float j{};
0038 
0039   /// Vector of edges in the track
0040   std::vector<GbtsEdge*> vs;
0041 
0042   /// State vector X
0043   std::array<float, 3> x{};
0044   /// State vector Y
0045   std::array<float, 2> y{};
0046   /// Covariance matrix for X
0047   std::array<std::array<float, 3>, 3> cx{};
0048   /// Covariance matrix for Y
0049   std::array<std::array<float, 2>, 2> cy{};
0050   /// Reference x coordinate
0051   float refX{};
0052   /// Reference y coordinate
0053   float refY{};
0054   /// Cosine of rotation angle
0055   float c{};
0056   /// Sine of rotation angle
0057   float s{};
0058 };
0059 
0060 /// Tracking filter operating on the GBTS edge graph.
0061 class GbtsTrackingFilter final {
0062  public:
0063   /// Maximum number of edge states
0064   static constexpr std::uint32_t GbtsMaxEdgeState = 2500;
0065 
0066   /// Constructor
0067   /// @param config Configuration for seed finder
0068   /// @param layerGeometry Geometry layer description
0069   /// @param sb Edge storage
0070   GbtsTrackingFilter(const GbtsConfig& config,
0071                      const std::vector<TrigInDetSiLayer>& layerGeometry,
0072                      std::vector<GbtsEdge>& sb);
0073 
0074   /// Follow track starting from edge
0075   /// @param pS Starting edge
0076   /// @return Final edge state after following the track
0077   GbtsEdgeState followTrack(GbtsEdge& pS);
0078 
0079  private:
0080   /// Propagate edge state
0081   /// @param pS Edge to propagate from
0082   /// @param ts Edge state to update
0083   void propagate(GbtsEdge& pS, GbtsEdgeState& ts);
0084 
0085   /// Update edge state with edge
0086   /// @param pS Edge to update with
0087   /// @param ts Edge state to update
0088   /// @return Success flag
0089   bool update(const GbtsEdge& pS, GbtsEdgeState& ts) const;
0090 
0091   /// Get layer type from layer index
0092   /// @param l Layer index
0093   /// @return Layer type
0094   std::uint32_t getLayerType(std::uint32_t l) const;
0095 
0096   /// Configuration for seed finder
0097   const GbtsConfig* m_cfg{};
0098 
0099   /// Geometry layer description
0100   const std::vector<TrigInDetSiLayer>* m_layerGeometry{};
0101 
0102   /// Edge storage
0103   std::vector<GbtsEdge>* m_segStore{};
0104 
0105   /// State vector
0106   std::vector<GbtsEdgeState*> m_stateVec;
0107 
0108   /// State storage array
0109   std::array<GbtsEdgeState, GbtsMaxEdgeState> m_stateStore{};
0110 
0111   /// Global state counter
0112   std::uint32_t m_globalStateCounter{0};
0113 };
0114 
0115 }  // namespace Acts::Experimental