diff --git a/Core/include/Acts/Utilities/RangeXD.hpp b/Core/include/Acts/Utilities/RangeXD.hpp index b93970b291a..bb7c130c9c4 100644 --- a/Core/include/Acts/Utilities/RangeXD.hpp +++ b/Core/include/Acts/Utilities/RangeXD.hpp @@ -645,8 +645,8 @@ void to_json(nlohmann::json& j, const Range1D& r) { template void from_json(const nlohmann::json& j, Range1D& r) { - r.setMin(static_cast(j["min"])); - r.setMax(static_cast(j["max"])); + r.setMin(j.at("min").template get()); + r.setMax(j.at("max").template get()); } } // namespace Acts diff --git a/Core/src/Geometry/Extent.cpp b/Core/src/Geometry/Extent.cpp index 4a940d924ec..8a9094401c9 100644 --- a/Core/src/Geometry/Extent.cpp +++ b/Core/src/Geometry/Extent.cpp @@ -240,15 +240,15 @@ void Acts::to_json(nlohmann::json& j, const Acts::Extent& e) { } void Acts::from_json(const nlohmann::json& j, Acts::Extent& e) { - const auto& jrange = j["range"]; + const auto& jrange = j.at("range"); for (const auto& [key, value] : jrange.items()) { BinningValue bval = binningValueFromName(key); - e.set(bval, value["min"], value["max"]); + e.set(bval, value.at("min"), value.at("max")); } if (j.contains("envelope")) { - const auto& jenvelope = j["envelope"]; + const auto& jenvelope = j.at("envelope"); ExtentEnvelope envelope; for (const auto& [key, value] : jenvelope.items()) { diff --git a/Plugins/Json/src/MaterialJsonConverter.cpp b/Plugins/Json/src/MaterialJsonConverter.cpp index 5a40b9f7a53..e00a8ccd9ac 100644 --- a/Plugins/Json/src/MaterialJsonConverter.cpp +++ b/Plugins/Json/src/MaterialJsonConverter.cpp @@ -697,7 +697,7 @@ nlohmann::json Acts::MaterialJsonConverter::toJsonDetray( bUtility = std::move(nbUtility); swapped = true; } else { - std::runtime_error("Unsupported binning for Detray"); + throw std::runtime_error("Unsupported binning for Detray"); } } else if (bUtility.dimensions() == 2u && bUtility.binningData()[0u].binvalue == BinningValue::binZ && diff --git a/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp b/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp index d0282aac3de..aa6aaf21703 100644 --- a/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp +++ b/Tests/UnitTests/Core/Utilities/BinUtilityTests.cpp @@ -142,12 +142,12 @@ bool isEqual(const BinningData& ba, const BinningData& bb, float tolerance) { (std::abs(ba.step - bb.step) < tolerance); BOOST_CHECK(equalRange); - bool euqalStructure = + bool equalStructure = (ba.subBinningData != nullptr) ? isEqual(*ba.subBinningData, *bb.subBinningData, tolerance) : (bb.subBinningData == nullptr); - BOOST_CHECK(euqalStructure); + BOOST_CHECK(equalStructure); bool equalBoundaries = (ba.boundaries().size() == bb.boundaries().size()); if (equalBoundaries) { @@ -161,7 +161,7 @@ bool isEqual(const BinningData& ba, const BinningData& bb, float tolerance) { } BOOST_CHECK(equalBoundaries); - return equalBool && equalRange && euqalStructure; + return equalBool && equalRange && equalStructure; } /// Check whether the BinUtility objects are equal