Skip to content

Commit

Permalink
Reduce number of moduleConnections_ lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Aug 12, 2024
1 parent 80ffdc3 commit a0432cc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions RecoTracker/LSTCore/src/ModuleConnectionMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,17 @@ void lst::ModuleConnectionMap::add(std::string const& filename) {
connected_detids.push_back(connected_detid);
}

auto& thisModuleConnections = moduleConnections_.at(detid);

// Concatenate
moduleConnections_[detid].insert(moduleConnections_[detid].end(), connected_detids.begin(), connected_detids.end());
thisModuleConnections.insert(thisModuleConnections.end(), connected_detids.begin(), connected_detids.end());

// Sort
std::sort(moduleConnections_[detid].begin(), moduleConnections_[detid].end());
std::sort(thisModuleConnections.begin(), thisModuleConnections.end());

// Unique
moduleConnections_[detid].erase(std::unique(moduleConnections_[detid].begin(), moduleConnections_[detid].end()),
moduleConnections_[detid].end());
thisModuleConnections.erase(std::unique(thisModuleConnections.begin(), thisModuleConnections.end()),
thisModuleConnections.end());
}
}

Expand Down

0 comments on commit a0432cc

Please sign in to comment.