21 return StatusCode::SUCCESS;
27 StatusCode FPGATrackSimGNNRoadMakerTool::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)
39 return StatusCode::SUCCESS;
44 for (
const auto& edge : edges) {
86 const std::vector<std::shared_ptr<FPGATrackSimGNNHit>> & gnn_hits,
87 std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads)
111 std::vector<std::shared_ptr<const FPGATrackSimHit>> mapped_road_hits;
115 for (
const auto& hitID : road_hitIDs) {
116 if(hitID+1 <
static_cast<int>(
hits.size()) &&
hits[hitID]->isStrip() &&
hits[hitID+1]->isStrip() &&
118 hits[hitID]->getX() ==
hits[hitID+1]->getX()) {
119 auto &hit1 =
hits[hitID];
120 std::shared_ptr<FPGATrackSimHit> hitCopy1 = std::make_shared<FPGATrackSimHit>(*hit1);
121 pmap->
map(*hitCopy1);
122 hitLayers |= 1 << hitCopy1->
getLayer();
123 mapped_road_hits.push_back(std::move(hitCopy1));
125 auto &hit2 =
hits[hitID+1];
126 std::shared_ptr<FPGATrackSimHit> hitCopy2 = std::make_shared<FPGATrackSimHit>(*hit2);
127 pmap->
map(*hitCopy2);
128 hitLayers |= 1 << hitCopy2->
getLayer();
129 mapped_road_hits.push_back(std::move(hitCopy2));
132 auto &hit =
hits[hitID];
133 std::shared_ptr<FPGATrackSimHit> hitCopy = std::make_shared<FPGATrackSimHit>(*hit);
135 hitLayers |= 1 << hitCopy->
getLayer();
136 mapped_road_hits.push_back(std::move(hitCopy));
145 r.setHitLayers(hitLayers);
146 r.setHits(std::vector<std::vector<std::shared_ptr<const FPGATrackSimHit>>>(std::move(sorted_hits)));
152 std::vector<std::shared_ptr<const FPGATrackSimHit>> all_hits;
153 std::vector<std::shared_ptr<const FPGATrackSimHit>> track_hit_list;
155 for (
const auto& hitID : road_hitIDs) {
156 auto &hit =
hits[hitID];
157 all_hits.push_back(hit);
161 std::sort(all_hits.begin(), all_hits.end(),
162 [](
const std::shared_ptr<const FPGATrackSimHit>& hit1,
163 const std::shared_ptr<const FPGATrackSimHit>& hit2) {
164 double rho1 = std::hypot(hit1->getX(), hit1->getY());
165 double rho2 = std::hypot(hit2->getX(), hit2->getY());
170 std::unordered_set<int> seenLayers;
171 for (
const auto &hit : all_hits) {
172 short layer =
m_pix_h2l->at(
static_cast<int>(hit->getIdentifierHash()));
174 int combinedId = layerGeometry.
m_subdet;
176 if (seenLayers.count(combinedId) == 0) {
177 track_hit_list.push_back(hit);
178 seenLayers.insert(combinedId);
182 std::size_t nSp = track_hit_list.size();
183 std::vector<std::vector<std::shared_ptr<const FPGATrackSimHit>>> seed_hit_list;
189 auto spacePointIndicesFun = [](std::size_t nSp, std::size_t nSeeds) -> std::vector<std::size_t> {
190 std::vector<std::size_t>
idx;
192 for (std::size_t
i = 0;
i < nSeeds; ++
i) {
193 std::size_t
pos = (
i * (nSp - 1)) / (nSeeds - 1);
203 std::size_t nSeeds = std::min<std::size_t>(5, nSp);
204 auto indices = spacePointIndicesFun(nSp, nSeeds);
207 seed_hit_list.push_back({track_hit_list[
idx]});
212 r.setHits(std::move(seed_hit_list));