ATLAS Offline Software
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>
27 
28 #include <memory>
29 #include <vector>
30 #include <map>
31 #include <set>
32 
34 {
35  public:
36 
38  // AthAlgTool
39 
40  FPGATrackSimGNNRoadMakerTool(const std::string&, const std::string&, const IInterface*);
41 
42  virtual StatusCode initialize() override;
43 
45  // Functions
46 
47  virtual StatusCode makeRoads(const std::vector<std::shared_ptr<const FPGATrackSimHit>> & hits,
48  const std::vector<std::shared_ptr<FPGATrackSimGNNHit>> & gnn_hits,
49  const std::vector<std::shared_ptr<FPGATrackSimGNNEdge>> & edges,
50  std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads);
51 
52  private:
53 
55  // Handles
56 
57  ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"};
58  ToolHandle<ITrigL2LayerNumberTool> m_layerNumberTool{this, "LayerNumberTool", "TrigL2LayerNumberToolITk"};
59 
61  // Properties
62 
63  Gaudi::Property<float> m_edgeScoreCut { this, "edgeScoreCut", 0.0, "Cut value for edge scores to pass for road making algorithm" };
64  Gaudi::Property<std::string> m_roadMakerTool { this, "roadMakerTool", "", "Algorithm to perform graph segmentation into roads"};
65  Gaudi::Property<bool> m_doGNNPixelSeeding { this, "doGNNPixelSeeding", false, "Flag to configure for GNN Pixel Seeding" };
66 
68  // Convenience
69 
70  int m_num_nodes = 0;
71  std::vector<int> m_pass_edge_index_1{};
72  std::vector<int> m_pass_edge_index_2{};
73  unsigned m_nLayers = 0;
74  std::set<int> m_unique_nodes{};
75  std::map<int, int> m_node_index_map{};
76  std::vector<int> m_unique_indices{};
77  typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> m_Graph;
78  std::vector<int> m_component{};
80  std::vector<int> m_labels{};
81  std::vector<std::vector<int>> m_road_hit_list{};
82  const std::vector<short>* m_pix_h2l{nullptr};
83  const std::vector<TrigInDetSiLayer>* m_layerGeometry{nullptr};
84 
86  // Helpers
87 
88  void doScoreCut(const std::vector<std::shared_ptr<FPGATrackSimGNNEdge>> & edges);
89  void doConnectedComponents();
90  void addRoads(const std::vector<std::shared_ptr<const FPGATrackSimHit>> & hits,
91  const std::vector<std::shared_ptr<FPGATrackSimGNNHit>> & gnn_hits,
92  std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads);
93  void addRoad(const std::vector<std::shared_ptr<const FPGATrackSimHit>> & hits, const std::vector<int>& road_hitIDs);
94  void addRoadForPixelSeed(const std::vector<std::shared_ptr<const FPGATrackSimHit>> & hits, const std::vector<int>& road_hitIDs);
95  void resetVectors();
96 
98  // Event Storage
99 
100  std::vector<FPGATrackSimRoad> m_roads{};
101 };
102 
103 
104 #endif // FPGATrackSimGNNRoadMakerTool_H
FPGATrackSimGNNRoadMakerTool::m_layerNumberTool
ToolHandle< ITrigL2LayerNumberTool > m_layerNumberTool
Definition: FPGATrackSimGNNRoadMakerTool.h:58
FPGATrackSimGNNRoadMakerTool::m_edgeScoreCut
Gaudi::Property< float > m_edgeScoreCut
Definition: FPGATrackSimGNNRoadMakerTool.h:63
FPGATrackSimGNNRoadMakerTool::m_component
std::vector< int > m_component
Definition: FPGATrackSimGNNRoadMakerTool.h:78
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:85
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:64
FPGATrackSimGNNRoadMakerTool::m_num_nodes
int m_num_nodes
Definition: FPGATrackSimGNNRoadMakerTool.h:70
FPGATrackSimGNNRoadMakerTool::addRoadForPixelSeed
void addRoadForPixelSeed(const std::vector< std::shared_ptr< const FPGATrackSimHit >> &hits, const std::vector< int > &road_hitIDs)
Definition: FPGATrackSimGNNRoadMakerTool.cxx:150
IFPGATrackSimMappingSvc.h
FPGATrackSimGNNRoadMakerTool::doConnectedComponents
void doConnectedComponents()
Definition: FPGATrackSimGNNRoadMakerTool.cxx:52
FPGATrackSimGNNRoadMakerTool::m_pass_edge_index_2
std::vector< int > m_pass_edge_index_2
Definition: FPGATrackSimGNNRoadMakerTool.h:72
ITrigL2LayerNumberTool.h
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:27
FPGATrackSimGNNRoadMakerTool::m_doGNNPixelSeeding
Gaudi::Property< bool > m_doGNNPixelSeeding
Definition: FPGATrackSimGNNRoadMakerTool.h:65
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:74
FPGATrackSimGNNRoadMakerTool::addRoad
void addRoad(const std::vector< std::shared_ptr< const FPGATrackSimHit >> &hits, const std::vector< int > &road_hitIDs)
Definition: FPGATrackSimGNNRoadMakerTool.cxx:108
FPGATrackSimGNNRoadMakerTool::m_node_index_map
std::map< int, int > m_node_index_map
Definition: FPGATrackSimGNNRoadMakerTool.h:75
FPGATrackSimGNNRoadMakerTool::resetVectors
void resetVectors()
Definition: FPGATrackSimGNNRoadMakerTool.cxx:217
FPGATrackSimGNNRoadMakerTool::m_nLayers
unsigned m_nLayers
Definition: FPGATrackSimGNNRoadMakerTool.h:73
FPGATrackSimGNNRoadMakerTool::m_labels
std::vector< int > m_labels
Definition: FPGATrackSimGNNRoadMakerTool.h:80
FPGATrackSimGNNRoadMakerTool::m_pix_h2l
const std::vector< short > * m_pix_h2l
Definition: FPGATrackSimGNNRoadMakerTool.h:82
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:71
FPGATrackSimGNNRoadMakerTool
Definition: FPGATrackSimGNNRoadMakerTool.h:34
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:57
FPGATrackSimGNNHit.h
FPGATrackSim-specific class to represent an hit in the detector used for GNN pattern recognition.
FPGATrackSimGNNRoadMakerTool::m_layerGeometry
const std::vector< TrigInDetSiLayer > * m_layerGeometry
Definition: FPGATrackSimGNNRoadMakerTool.h:83
FPGATrackSimGNNRoadMakerTool::m_road_hit_list
std::vector< std::vector< int > > m_road_hit_list
Definition: FPGATrackSimGNNRoadMakerTool.h:81
FPGATrackSimGNNRoadMakerTool::m_num_components
int m_num_components
Definition: FPGATrackSimGNNRoadMakerTool.h:79
FPGATrackSimGNNRoadMakerTool::doScoreCut
void doScoreCut(const std::vector< std::shared_ptr< FPGATrackSimGNNEdge >> &edges)
Definition: FPGATrackSimGNNRoadMakerTool.cxx:42
FPGATrackSimGNNRoadMakerTool::m_roads
std::vector< FPGATrackSimRoad > m_roads
Definition: FPGATrackSimGNNRoadMakerTool.h:100
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:76
FPGATrackSimGNNRoadMakerTool::m_Graph
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS > m_Graph
Definition: FPGATrackSimGNNRoadMakerTool.h:77
ServiceHandle< IFPGATrackSimMappingSvc >