Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-17 07:48:34

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 // TODO: update to C++17 style
0012 #include "Acts/Seeding/GbtsDataStorage.hpp"  //includes geo which has trigindetsilayer, may move this to trigbase
0013 #include "Acts/Seeding/GbtsGeometry.hpp"
0014 #include "Acts/Seeding/SeedFinderGbtsConfig.hpp"
0015 
0016 #include <cmath>
0017 #include <cstring>
0018 #include <vector>
0019 
0020 namespace Acts::Experimental {
0021 
0022 /// Per-edge tracking state used by the GBTs filter.
0023 struct GbtsEdgeState {
0024  public:
0025   /// Comparator sorting edge states by descending score.
0026   struct Compare {
0027     /// Compare two edge states by score
0028     /// @param s1 First edge state
0029     /// @param s2 Second edge state
0030     /// @return True if first state has higher score
0031     bool operator()(const struct GbtsEdgeState* s1,
0032                     const struct GbtsEdgeState* s2) {
0033       return s1->m_J > s2->m_J;
0034     }
0035   };
0036 
0037   GbtsEdgeState() = default;
0038 
0039   /// Constructor with initialization flag
0040   /// @param f Initialization flag
0041   explicit GbtsEdgeState(bool f) : m_initialized(f) {}
0042 
0043   /// Initialize from edge
0044   /// @param pS Edge to initialize from
0045   void initialize(GbtsEdge& pS);
0046   /// Clone from another state
0047   /// @param st Source state to clone from
0048   void clone(const struct GbtsEdgeState& st);
0049 
0050   /// Score for comparison
0051   /// Score for comparison
0052   float m_J{};
0053 
0054   /// Vector of edges in the track
0055   std::vector<GbtsEdge*> m_vs;
0056 
0057   /// State vector X
0058   float m_X[3]{};
0059   /// State vector Y
0060   float m_Y[2]{};
0061   /// Covariance matrix for X
0062   float m_Cx[3][3]{};
0063   /// Covariance matrix for Y
0064   float m_Cy[2][2]{};
0065   /// Reference x coordinate
0066   float m_refX{};
0067   /// Reference y coordinate
0068   float m_refY{};
0069   /// Cosine of rotation angle
0070   float m_c{};
0071   /// Sine of rotation angle
0072   float m_s{};
0073 
0074   /// Initialization flag
0075   bool m_initialized{false};
0076 };
0077 
0078 /// Tracking filter operating on the GBTs edge graph.
0079 class GbtsTrackingFilter {
0080  public:
0081   /// Maximum number of edge states
0082   static constexpr std::uint32_t GbtsMaxEdgeState = 2500;
0083   /// Constructor
0084   /// @param g Geometry layer description
0085   /// @param sb Edge storage
0086   /// @param config Configuration for seed finder
0087   GbtsTrackingFilter(const std::vector<TrigInDetSiLayer>& g,
0088                      std::vector<GbtsEdge>& sb,
0089                      const SeedFinderGbtsConfig& config);
0090 
0091   /// Follow track starting from edge
0092   /// @param pS Starting edge
0093   /// @param output Output edge state
0094   void followTrack(GbtsEdge& pS, GbtsEdgeState& output);
0095 
0096  protected:
0097   /// Propagate edge state
0098   /// @param pS Edge to propagate from
0099   /// @param ts Edge state to update
0100   void propagate(GbtsEdge& pS, GbtsEdgeState& ts);
0101 
0102   /// Update edge state with edge
0103   /// @param pS Edge to update with
0104   /// @param ts Edge state to update
0105   /// @return Success flag
0106   bool update(GbtsEdge& pS, GbtsEdgeState& ts);
0107 
0108   /// Get layer type from layer index
0109   /// @param l Layer index
0110   /// @return Layer type
0111   std::uint32_t getLayerType(std::uint32_t l);
0112 
0113   /// Geometry layer description
0114   const std::vector<TrigInDetSiLayer>& m_geo;
0115 
0116   /// Edge storage
0117   std::vector<GbtsEdge>& m_segStore;
0118 
0119   /// State vector
0120   std::vector<GbtsEdgeState*> m_stateVec;
0121 
0122   /// State storage array
0123   std::array<GbtsEdgeState, GbtsMaxEdgeState> m_stateStore;
0124 
0125   /// Global state counter
0126   std::uint32_t m_globalStateCounter{0};
0127 
0128   /// Configuration for seed finder
0129   const SeedFinderGbtsConfig& m_config;
0130 };
0131 
0132 }  // namespace Acts::Experimental