Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FPGATrackSimGNNRoadMakerTool.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 
3 #ifndef FPGATrackSimGNNRoadMakerTool_H
4 #define FPGATrackSimGNNRoadMakerTool_H
5 
17 #include "GaudiKernel/ServiceHandle.h"
19 
24 #include <boost/graph/adjacency_list.hpp>
25 #include <boost/graph/connected_components.hpp>
26 
27 #include <memory>
28 #include <vector>
29 #include <map>
30 #include <set>
31 
33 {
34  public:
35 
37  // AthAlgTool
38 
39  FPGATrackSimGNNRoadMakerTool(const std::string&, const std::string&, const IInterface*);
40 
41  virtual StatusCode initialize() override;
42 
44  // Functions
45 
46  virtual StatusCode makeRoads(const std::vector<std::shared_ptr<const FPGATrackSimHit>> & hits,
47  const std::vector<std::shared_ptr<FPGATrackSimGNNHit>> & gnn_hits,
48  const std::vector<std::shared_ptr<FPGATrackSimGNNEdge>> & edges,
49  std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads);
50 
51  private:
52 
54  // Handles
55 
56  ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"};
57 
59  // Properties
60 
61  Gaudi::Property<float> m_edgeScoreCut { this, "edgeScoreCut", 0.0, "Cut value for edge scores to pass for road making algorithm" };
62  Gaudi::Property<std::string> m_roadMakerTool { this, "roadMakerTool", "", "Algorithm to perform graph segmentation into roads"};
63 
65  // Convenience
66 
67  int m_num_nodes = 0;
68  std::vector<int> m_pass_edge_index_1{};
69  std::vector<int> m_pass_edge_index_2{};
70  unsigned m_nLayers = 0;
71  std::set<int> m_unique_nodes{};
72  std::map<int, int> m_node_index_map{};
73  std::vector<int> m_unique_indices{};
74  typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> m_Graph;
75  std::vector<int> m_component{};
77  std::vector<int> m_labels{};
78  std::vector<std::vector<int>> m_road_hit_list{};
79 
81  // Helpers
82 
83  void doScoreCut(const std::vector<std::shared_ptr<FPGATrackSimGNNEdge>> & edges);
84  void doConnectedComponents();
85  void addRoads(const std::vector<std::shared_ptr<const FPGATrackSimHit>> & hits,
86  const std::vector<std::shared_ptr<FPGATrackSimGNNHit>> & gnn_hits,
87  std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads);
88  void addRoad(const std::vector<std::shared_ptr<const FPGATrackSimHit>> & hits, const std::vector<int>& road_hitIDs);
89  void resetVectors();
90 
92  // Event Storage
93 
94  std::vector<FPGATrackSimRoad> m_roads{};
95 };
96 
97 
98 #endif // FPGATrackSimGNNRoadMakerTool_H
FPGATrackSimGNNRoadMakerTool::m_edgeScoreCut
Gaudi::Property< float > m_edgeScoreCut
Definition: FPGATrackSimGNNRoadMakerTool.h:61
FPGATrackSimGNNRoadMakerTool::m_component
std::vector< int > m_component
Definition: FPGATrackSimGNNRoadMakerTool.h:75
FPGATrackSimGNNRoadMakerTool::addRoads
void addRoads(const std::vector< std::shared_ptr< const FPGATrackSimHit >> &hits, const std::vector< std::shared_ptr< FPGATrackSimGNNHit >> &gnn_hits, std::vector< std::shared_ptr< const FPGATrackSimRoad >> &roads)
Definition: FPGATrackSimGNNRoadMakerTool.cxx:82
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
FPGATrackSimGNNRoadMakerTool::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimGNNRoadMakerTool.cxx:13
FPGATrackSimGNNRoadMakerTool::m_roadMakerTool
Gaudi::Property< std::string > m_roadMakerTool
Definition: FPGATrackSimGNNRoadMakerTool.h:62
FPGATrackSimGNNRoadMakerTool::m_num_nodes
int m_num_nodes
Definition: FPGATrackSimGNNRoadMakerTool.h:67
IFPGATrackSimMappingSvc.h
FPGATrackSimGNNRoadMakerTool::doConnectedComponents
void doConnectedComponents()
Definition: FPGATrackSimGNNRoadMakerTool.cxx:49
FPGATrackSimGNNRoadMakerTool::m_pass_edge_index_2
std::vector< int > m_pass_edge_index_2
Definition: FPGATrackSimGNNRoadMakerTool.h:69
FPGATrackSimGNNRoadMakerTool::makeRoads
virtual StatusCode makeRoads(const std::vector< std::shared_ptr< const FPGATrackSimHit >> &hits, const std::vector< std::shared_ptr< FPGATrackSimGNNHit >> &gnn_hits, const std::vector< std::shared_ptr< FPGATrackSimGNNEdge >> &edges, std::vector< std::shared_ptr< const FPGATrackSimRoad >> &roads)
Definition: FPGATrackSimGNNRoadMakerTool.cxx:24
FPGATrackSimGNNEdge.h
FPGATrackSim-specific class to represent an edge as a connection between two hits in the detector use...
FPGATrackSimGNNRoadMakerTool::m_unique_nodes
std::set< int > m_unique_nodes
Definition: FPGATrackSimGNNRoadMakerTool.h:71
FPGATrackSimGNNRoadMakerTool::addRoad
void addRoad(const std::vector< std::shared_ptr< const FPGATrackSimHit >> &hits, const std::vector< int > &road_hitIDs)
Definition: FPGATrackSimGNNRoadMakerTool.cxx:107
FPGATrackSimGNNRoadMakerTool::m_node_index_map
std::map< int, int > m_node_index_map
Definition: FPGATrackSimGNNRoadMakerTool.h:72
FPGATrackSimGNNRoadMakerTool::resetVectors
void resetVectors()
Definition: FPGATrackSimGNNRoadMakerTool.cxx:149
FPGATrackSimGNNRoadMakerTool::m_nLayers
unsigned m_nLayers
Definition: FPGATrackSimGNNRoadMakerTool.h:70
FPGATrackSimGNNRoadMakerTool::m_labels
std::vector< int > m_labels
Definition: FPGATrackSimGNNRoadMakerTool.h:77
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
FPGATrackSimGNNRoadMakerTool::m_pass_edge_index_1
std::vector< int > m_pass_edge_index_1
Definition: FPGATrackSimGNNRoadMakerTool.h:68
FPGATrackSimGNNRoadMakerTool
Definition: FPGATrackSimGNNRoadMakerTool.h:33
FPGATrackSimGNNRoadMakerTool::FPGATrackSimGNNRoadMakerTool
FPGATrackSimGNNRoadMakerTool(const std::string &, const std::string &, const IInterface *)
Definition: FPGATrackSimGNNRoadMakerTool.cxx:10
FPGATrackSimGNNRoadMakerTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimGNNRoadMakerTool.h:56
FPGATrackSimGNNHit.h
FPGATrackSim-specific class to represent an hit in the detector used for GNN pattern recognition.
FPGATrackSimGNNRoadMakerTool::m_road_hit_list
std::vector< std::vector< int > > m_road_hit_list
Definition: FPGATrackSimGNNRoadMakerTool.h:78
FPGATrackSimGNNRoadMakerTool::m_num_components
int m_num_components
Definition: FPGATrackSimGNNRoadMakerTool.h:76
FPGATrackSimGNNRoadMakerTool::doScoreCut
void doScoreCut(const std::vector< std::shared_ptr< FPGATrackSimGNNEdge >> &edges)
Definition: FPGATrackSimGNNRoadMakerTool.cxx:39
FPGATrackSimGNNRoadMakerTool::m_roads
std::vector< FPGATrackSimRoad > m_roads
Definition: FPGATrackSimGNNRoadMakerTool.h:94
FPGATrackSimRoad.h
Defines a class for roads.
AthAlgTool
Definition: AthAlgTool.h:26
FPGATrackSimGNNRoadMakerTool::m_unique_indices
std::vector< int > m_unique_indices
Definition: FPGATrackSimGNNRoadMakerTool.h:73
FPGATrackSimGNNRoadMakerTool::m_Graph
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS > m_Graph
Definition: FPGATrackSimGNNRoadMakerTool.h:74
ServiceHandle< IFPGATrackSimMappingSvc >