35 const EventContext& ctx,
36 const std::vector<const xAOD::SpacePointContainer*>&
37 spacePointCollections,
38 const Eigen::Vector3f& beamSpotPos,
float bFieldInZ,
44 std::unique_ptr<GNN_DataStorage> storage = std::make_unique<GNN_DataStorage>(*
m_geo,
m_mlLUT);
46 std::vector<std::vector<GNN_Node> > node_storage;
49 for(
auto& v : node_storage) v.reserve(100000);
51 unsigned int nPixelLoaded = 0;
52 unsigned int nStripLoaded = 0;
54 std::size_t totalSpacePoints = 0;
56 totalSpacePoints += spacePoints->size();
59 std::vector<const xAOD::SpacePoint*> selectedXAODSpacePoints;
60 selectedXAODSpacePoints.reserve(totalSpacePoints);
64 const auto& pos =
sp->globalPosition();
65 const std::vector<xAOD::DetectorIDHashType>& elementlist =
sp->elementIdList();
66 const bool isPixel = (elementlist.size() == 1);
67 const short layer = (isPixel ?
m_pix_h2l :
m_sct_h2l)->at(
static_cast<int>(elementlist[0]));
71 GNN_Node&
node = node_storage[layer].emplace_back(layer);
73 node.m_x = pos.x() - beamSpotPos[0];
74 node.m_y = pos.y() - beamSpotPos[1];
76 node.m_r = std::sqrt(std::pow(
node.m_x, 2) + std::pow(
node.m_y, 2));
78 node.m_idx = selectedXAODSpacePoints.size();
88 selectedXAODSpacePoints.push_back(
sp);
92 for(
size_t l = 0; l < node_storage.size(); l++) {
94 const std::vector<GNN_Node>& nodes = node_storage[l];
96 if(nodes.size() == 0)
continue;
99 nPixelLoaded += storage->loadPixelGraphNodes(l, nodes,
m_useML);
101 nStripLoaded += storage->loadStripGraphNodes(l, nodes);
104 ATH_MSG_DEBUG(
"Loaded "<<nPixelLoaded<<
" pixel spacepoints and "<<nStripLoaded<<
" strip spacepoints");
106 storage->sortByPhi();
108 storage->initializeNodes(
m_useML);
112 std::vector<GNN_Edge> edgeStorage;
116 std::pair<int, int> graphStats =
buildTheGraph(fakeRoi, storage, edgeStorage);
118 ATH_MSG_DEBUG(
"Created graph with "<<graphStats.first<<
" edges and "<<graphStats.second<<
" edge links");
120 if (graphStats.first == 0 || graphStats.second == 0)
return StatusCode::SUCCESS;
122 int maxLevel =
runCCA(graphStats.first, edgeStorage);
124 ATH_MSG_DEBUG(
"Reached Level "<<maxLevel<<
" after GNN iterations");
126 std::vector<std::pair<float, std::vector<unsigned int> > > vOutputSeeds;
130 if (vOutputSeeds.empty())
return StatusCode::SUCCESS;
132 seedContainer.
reserve(vOutputSeeds.size(), 7.0f);
134 for (
const auto& seed : vOutputSeeds) {
136 const float quality = seed.first;
137 const float vertexZ = 0.0f;
140 [&](
const unsigned int spIndex) {
141 return selectedXAODSpacePoints[spIndex];
148 return StatusCode::SUCCESS;