Skip to content

Commit

Permalink
some sonarcloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ssdetlab committed Nov 12, 2024
1 parent c61b846 commit 3432e57
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class TrackParamsLookupAccumulator {
typename grid_t::value_type::first_type>::element_type;

/// @brief Constructor
TrackParamsLookupAccumulator(grid_t grid) : m_grid(std::move(grid)) {}
explicit TrackParamsLookupAccumulator(grid_t grid)
: m_grid(std::move(grid)) {}

/// @brief Add track parameters to the accumulator
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ class TrackParamsLookupEstimation : public IAlgorithm {
/// @brief Constructor
TrackParamsLookupEstimation(const Config& config, Acts::Logging::Level level);

/// @brief Destructor
~TrackParamsLookupEstimation() = default;

/// @brief The execute method
ProcessCode execute(const AlgorithmContext& ctx) const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

ActsExamples::TrackParamsLookupEstimation::TrackParamsLookupEstimation(
const Config& config, Acts::Logging::Level level)
: IAlgorithm("TrackParamsLookupEstimation", level),
m_cfg(std::move(config)) {
: IAlgorithm("TrackParamsLookupEstimation", level), m_cfg(config) {
// Iterate over the reference layers and create
// track parameter accumulators
for (const auto& [geoId, refSurface] : m_cfg.refLayers) {
Expand Down Expand Up @@ -52,7 +51,7 @@ ActsExamples::TrackParamsLookupEstimation::finalize() {
for (auto& [id, acc] : m_accumulators) {
lookup.insert({id, acc->finalizeLookup()});
}
for (auto& writer : m_cfg.trackLookupGridWriters) {
for (const auto& writer : m_cfg.trackLookupGridWriters) {
writer->writeLookup(lookup);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class JsonTrackParamsLookupReader final : public ITrackParamsLookupReader {
std::pair<std::size_t, std::size_t> bins;
};

JsonTrackParamsLookupReader(const Config& config) : m_cfg(config) {};
explicit JsonTrackParamsLookupReader(const Config& config) : m_cfg(config) {};

~JsonTrackParamsLookupReader() override = default;

Expand All @@ -44,7 +44,7 @@ class JsonTrackParamsLookupReader final : public ITrackParamsLookupReader {
/// @param path path to the json file
///
/// @return lookup table for track parameter estimation
TrackParamsLookup readLookup(const std::string& path) final {
TrackParamsLookup readLookup(const std::string& path) override {
// Read the json file
std::ifstream ifj(path);
nlohmann::json jLookup;
Expand All @@ -55,7 +55,7 @@ class JsonTrackParamsLookupReader final : public ITrackParamsLookupReader {
for (const auto& jGrid : jLookup) {
Acts::GeometryIdentifier id(jGrid["geo_id"]);

if (m_cfg.refLayers.find(id) == m_cfg.refLayers.end()) {
if (m_cfg.refLayers.contains(id)) {
throw std::invalid_argument("Geometry identifier not found");
}

Expand Down Expand Up @@ -84,7 +84,7 @@ class JsonTrackParamsLookupReader final : public ITrackParamsLookupReader {
TrackParamsLookupPair>(
jGrid["grid"], axisGen);

lookup.insert({id, std::move(grid)});
lookup.try_emplace(id, std::move(grid));
}

return lookup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class JsonTrackParamsLookupWriter final : public ITrackParamsLookupWriter {
/// Constructor
///
/// @param config The configuration struct of the writer
JsonTrackParamsLookupWriter(const Config& config) : m_cfg(config) {};
explicit JsonTrackParamsLookupWriter(const Config& config) : m_cfg(config) {};

/// Virtual destructor
~JsonTrackParamsLookupWriter() override = default;

/// Write out track parameters lookup table
///
/// @param lookup The lookup to write
void writeLookup(const TrackParamsLookup& lookup) const final {
void writeLookup(const TrackParamsLookup& lookup) const override {
nlohmann::json jLookup;

// Iterate over the lookup and serialize the grids
Expand Down

0 comments on commit 3432e57

Please sign in to comment.