From dbed574b5e6070a144ed810f3f69f77ddc9e9ed4 Mon Sep 17 00:00:00 2001 From: 2xB <31772910+2xB@users.noreply.github.com> Date: Wed, 2 Sep 2026 17:11:38 +0200 Subject: [PATCH 1/7] CI: Test update BREW packages --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d028aee8..109a5e7c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -90,6 +90,7 @@ jobs: - uses: actions/checkout@v3 - name: Install dependencies run: | + brew update brew install \ cmake \ coreutils \ From b78b8627eb455cb2db08dec7ac7fd898e8761b2f Mon Sep 17 00:00:00 2001 From: 2xB <31772910+2xB@users.noreply.github.com> Date: Fri, 4 Sep 2026 03:49:50 +0200 Subject: [PATCH 2/7] Kommon: Fix non-existent "uint" Got "error: unknown type name 'uint'; did you mean 'int'?" when building on a recent macOS with Clang from Homebrew. --- Kommon/Math/include/KMathIntegrator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kommon/Math/include/KMathIntegrator.h b/Kommon/Math/include/KMathIntegrator.h index 1cb6422e..7725ed7b 100644 --- a/Kommon/Math/include/KMathIntegrator.h +++ b/Kommon/Math/include/KMathIntegrator.h @@ -516,7 +516,7 @@ template inline XFloatT KMathIntegrator::QAGS(XIntegrandType&& integrand) { /*Use gsl implementation for integral int_a^b. Implementation is experimental. */ - const uint ws_size = 100; + const size_t ws_size = 100; gsl_integration_workspace* workspace = gsl_integration_workspace_alloc(ws_size); FType proxy = integrand; gsl_function F=GSLFunction(proxy); @@ -561,7 +561,7 @@ template inline XFloatT KMathIntegrator::QAGIU(XIntegrandType&& integrand) { /*Use gsl implementation for integral int_xmin^infty. Use case is the krypton spectrum. Implementation is experimental. */ - const uint ws_size = 100; + const size_t ws_size = 100; gsl_integration_workspace* workspace = gsl_integration_workspace_alloc(ws_size); FType proxy = integrand; gsl_function F=GSLFunction(proxy); From 8ee59425b548007fcc8fafc9a0876e2f5e5c4479 Mon Sep 17 00:00:00 2001 From: 2xB <31772910+2xB@users.noreply.github.com> Date: Fri, 4 Sep 2026 04:11:05 +0200 Subject: [PATCH 3/7] Enforce C++ version used by ROOT This avoids weird compile time errors like: *** Break *** bus error [/usr/lib/system/libsystem_platform.dylib] _sigtramp (no debug info) [/usr/lib/dyld] invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const::$_0::operator()() const (no debug info) [/usr/lib/dyld] invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const (no debug info) [/usr/lib/dyld] invocation function for block in mach_o::UnsafeHeader::forEachSection(void (mach_o::UnsafeHeader::SectionInfo const&, bool&) block_pointer) const (no debug info) [/usr/lib/dyld] mach_o::UnsafeHeader::forEachLoadCommand(void (load_command const*, bool&) block_pointer) const (no debug info) [/usr/lib/dyld] mach_o::UnsafeHeader::forEachSection(void (mach_o::UnsafeHeader::SectionInfo const&, bool&) block_pointer) const (no debug info) [/usr/lib/dyld] dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const (no debug info) [/usr/lib/dyld] dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const (no debug info) [/usr/lib/dyld] dyld4::JustInTimeLoader::runInitializers(dyld4::RuntimeState&) const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, lsl::Vector>&, lsl::Vector>&) const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, lsl::Vector>&, lsl::Vector>&) const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, lsl::Vector>&, lsl::Vector>&) const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, lsl::Vector>&, lsl::Vector>&) const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, lsl::Vector>&, lsl::Vector>&) const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, lsl::Vector>&, lsl::Vector>&) const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, lsl::Vector>&, lsl::Vector>&) const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, lsl::Vector>&, lsl::Vector>&) const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_0::operator()() const (no debug info) [/usr/lib/dyld] dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const (no debug info) [/usr/lib/dyld] dyld4::prepare(dyld4::APIs&, mach_o::UnsafeHeader const*) (no debug info) [/usr/lib/dyld] dyld4::start(dyld4::KernelArgs*, void*, void*, unsigned long long)::$_1::operator()() const (no debug info) [/usr/lib/dyld] start (no debug info) --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49dd87f7..e3aa1f44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,14 @@ set( Boost_USE_STATIC_RUNTIME OFF ) set( CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested to build this target" ) mark_as_advanced( FORCE CMAKE_CXX_STANDARD ) + +# ROOT may force a newer C++ standard +# Using the same C++ standard as ROOT is recommended in https://root.cern/manual/integrate_root_into_my_cmake_project/ . +find_package(ROOT QUIET) +if(ROOT_FOUND AND KASPER_USE_ROOT) + set( CMAKE_CXX_STANDARD ${ROOT_CXX_STANDARD} CACHE STRING "The C++ standard, as requested by the ROOT library. Can't be changed." FORCE) +endif() + set( CMAKE_CXX_STANDARD_REQUIRED ON ) set( CMAKE_CXX_EXTENSIONS ON ) set( CMAKE_EXPORT_COMPILE_COMMANDS ON ) @@ -187,7 +195,7 @@ mark_as_advanced( CLEAR CMAKE_VERBOSE_MAKEFILE ) #option( KASPER_USE_BOOST "Build Boost dependent modules" ${Boost_FOUND} ) set(KASPER_USE_BOOST ON) -find_package(ROOT QUIET) +#ROOT was already searched at the beginning for the C++ standard if(ROOT_FOUND AND NOT DEFINED KASPER_USE_ROOT) message("ROOT was found and enabled automatically. Set KASPER_USE_ROOT=OFF to change this.") endif() From c2a08fa26698904ceb633106a93f028824fb9259 Mon Sep 17 00:00:00 2001 From: 2xB <31772910+2xB@users.noreply.github.com> Date: Fri, 4 Sep 2026 04:12:55 +0200 Subject: [PATCH 4/7] Fix for C++20: Cast enum to int explicitly --- .../Trajectories/Source/KSTrajTermPropagation.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Kassiopeia/Trajectories/Source/KSTrajTermPropagation.cxx b/Kassiopeia/Trajectories/Source/KSTrajTermPropagation.cxx index 914a4abe..4e30327c 100644 --- a/Kassiopeia/Trajectories/Source/KSTrajTermPropagation.cxx +++ b/Kassiopeia/Trajectories/Source/KSTrajTermPropagation.cxx @@ -25,7 +25,7 @@ KSTrajTermPropagation::~KSTrajTermPropagation() = default; void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajExactParticle& aParticle, KSTrajExactDerivative& aDerivative) const { - KThreeVector tVelocity = fDirection * aParticle.GetVelocity(); + KThreeVector tVelocity = (+fDirection) * aParticle.GetVelocity(); KThreeVector tForce = aParticle.GetCharge() * (aParticle.GetElectricField() + tVelocity.Cross(aParticle.GetMagneticField())); @@ -39,7 +39,7 @@ void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajExactSpi { double TempSN = std::sqrt(aParticle.GetSpin().MagnitudeSquared() - aParticle.GetSpin0() * aParticle.GetSpin0()); - KThreeVector tVelocity = fDirection * aParticle.GetVelocity(); + KThreeVector tVelocity = (+fDirection) * aParticle.GetVelocity(); KThreeVector MagneticMoment = aParticle.GetGyromagneticRatio() * aParticle.GetSpin() / aParticle.GetSpin().Magnitude() * aParticle.GetSpinMagnitude() * @@ -157,7 +157,7 @@ void KSTrajTermPropagation::Differentiate(double aTime, const KSTrajExactTrapped void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajAdiabaticParticle& aParticle, KSTrajAdiabaticDerivative& aDerivative) const { - double tLongVelocity = fDirection * aParticle.GetLongVelocity(); + double tLongVelocity = (+fDirection) * aParticle.GetLongVelocity(); double tLongitudinalMomentum = aParticle.GetLongMomentum(); double tTransverseMomentum = aParticle.GetTransMomentum(); double tLorentzFactor = aParticle.GetLorentzFactor(); @@ -219,7 +219,7 @@ void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajAdiabati GradE1 / E1.Magnitude() - KThreeMatrix::OuterProduct(E1, GradE1Magnitude) / E1.Magnitude() / E1.Magnitude(); KThreeVector A = Grade1 * e2; - KThreeVector tVelocity = fDirection * aParticle.GetVelocity(); + KThreeVector tVelocity = (+fDirection) * aParticle.GetVelocity(); KThreeVector tForce = aParticle.GetCharge() * (aParticle.GetElectricField() + tVelocity.Cross(aParticle.GetMagneticField())) + aParticle.GetGyromagneticRatio() * aParticle.GetSpinMagnitude() * katrin::KConst::Hbar() * @@ -244,7 +244,7 @@ void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajAdiabati void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajMagneticParticle& aParticle, KSTrajMagneticDerivative& aDerivative) const { - KThreeVector tVelocity = fDirection * aParticle.GetMagneticField().Unit(); + KThreeVector tVelocity = (+fDirection) * aParticle.GetMagneticField().Unit(); aDerivative.AddToVelocity(tVelocity); @@ -254,7 +254,7 @@ void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajMagnetic void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajElectricParticle& aParticle, KSTrajElectricDerivative& aDerivative) const { - KThreeVector tVelocity = fDirection * aParticle.GetElectricField().Unit(); + KThreeVector tVelocity = (+fDirection) * aParticle.GetElectricField().Unit(); aDerivative.AddToVelocity(tVelocity); From 24b2d37319c85463025a59da3ead49b6f271cf18 Mon Sep 17 00:00:00 2001 From: 2xB <31772910+2xB@users.noreply.github.com> Date: Fri, 4 Sep 2026 04:17:39 +0200 Subject: [PATCH 5/7] Removing unused "KAlgorithm.h" This file has always only been used at KATRIN internally, so moving to where it was actually used. This makes sense since the CI pipeline does not touch this file at all, making it very hard to notice issues with it here. --- Kommon/Base/CMakeLists.txt | 1 - Kommon/Base/Utility/KAlgorithm.h | 53 -------------------------------- 2 files changed, 54 deletions(-) delete mode 100644 Kommon/Base/Utility/KAlgorithm.h diff --git a/Kommon/Base/CMakeLists.txt b/Kommon/Base/CMakeLists.txt index 54b0cbd4..5f4b839a 100644 --- a/Kommon/Base/CMakeLists.txt +++ b/Kommon/Base/CMakeLists.txt @@ -38,7 +38,6 @@ set(KOMMON_BASE_HEADER_FILES Utility/Gnuplot.hpp Utility/KUtilityMessage.h - Utility/KAlgorithm.h Utility/KException.h Utility/KCast.h Utility/KConst_2006.h diff --git a/Kommon/Base/Utility/KAlgorithm.h b/Kommon/Base/Utility/KAlgorithm.h deleted file mode 100644 index 0df16150..00000000 --- a/Kommon/Base/Utility/KAlgorithm.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file KAlgorithm.h - * - * @date 05.10.2017 - * @author Valerian Sibille - */ -#ifndef K_ALGORITHM_H_ -#define K_ALGORITHM_H_ - -#include -#include - -namespace katrin -{ - -namespace Algorithm -{ -// the following supports maps implemented as std::vector which lack map::at -template const auto& FindValue(const Map& map, const Key& key) -{ - - auto it = std::find_if(std::cbegin(map), std::cend(map), [&](const auto& pair) { return pair.first == key; }); - if (it == std::cend(map)) - throw std::out_of_range("Utility::Algorithm::FindValue(map, key): key not in map"); - - return it->second; -} - -template const auto& FindKey(const Map& map, const Value& value) -{ - - auto it = std::find_if(std::cbegin(map), std::cend(map), [&](const auto& pair) { return pair.second == value; }); - if (it == std::cend(map)) - throw std::out_of_range("Utility::Algorithm::FindKey(map, value): value not in map"); - - return it->first; -} - -template -RandomAccessIt SumStride(RandomAccessIt begin, RandomAccessIt end, Distance stride) -{ - while (begin != end) { - *begin += *(begin + stride); - ++begin; - } - return begin; -} - -} // namespace Algorithm - -} // namespace katrin - -#endif From 006e4792ca3bf01404253eb677813abf2107db68 Mon Sep 17 00:00:00 2001 From: Richard Salomon Date: Fri, 4 Sep 2026 10:11:21 +0200 Subject: [PATCH 6/7] Fix false-positive GCC 16 -Wmaybe-uninitialized in Mesh/Complex meshers x_min/x_max are always set on the i==0 loop iteration (a port housing always has at least one port), and p0[0]/p0[1] are always set before being read past the discretization loop, but GCC 16 can't prove either invariant under RelWithDebInfo inlining. Initialize them like the neighboring n1/n2 arrays already do. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_015FxJDQWXHJjTY21Fc5bP6E --- .../Extensions/Mesh/Complex/Source/KGExtrudedSurfaceMesher.cc | 2 +- .../Mesh/Complex/Source/KGPortHousingSurfaceMesher.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGExtrudedSurfaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGExtrudedSurfaceMesher.cc index 10a92df3..50495553 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGExtrudedSurfaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGExtrudedSurfaceMesher.cc @@ -261,7 +261,7 @@ void KGExtrudedSurfaceMesher::DiscretizeSegment(const KGExtrudedObject::Arc* arc double n1[3] = {}; n1[2] = 0; - double p0[3]; + double p0[3] = {}; p0[2] = fExtrudedObject->GetZMin(); double xy_len = 0; diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGPortHousingSurfaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGPortHousingSurfaceMesher.cc index 4a7bf0e6..73e0c7a5 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGPortHousingSurfaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGPortHousingSurfaceMesher.cc @@ -40,8 +40,8 @@ void KGPortHousingSurfaceMesher::VisitWrappedSurface(KGWrappedSurface Date: Fri, 4 Sep 2026 10:26:15 +0200 Subject: [PATCH 7/7] CMake: Don't force an empty C++ standard when ROOT doesn't export one Older ROOT releases (e.g. the prebuilt 6.24.08 used on the Ubuntu 20.04 CI image) don't set ROOT_CXX_STANDARD in their CMake config, so the unconditional FORCE overwrote CMAKE_CXX_STANDARD with an empty string, tripping the "Unsupported C++ standard" check right after it. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_015FxJDQWXHJjTY21Fc5bP6E --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3aa1f44..947a8a56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,9 @@ mark_as_advanced( FORCE CMAKE_CXX_STANDARD ) # ROOT may force a newer C++ standard # Using the same C++ standard as ROOT is recommended in https://root.cern/manual/integrate_root_into_my_cmake_project/ . +# Older ROOT releases don't export ROOT_CXX_STANDARD at all, so only override our default when it's actually set. find_package(ROOT QUIET) -if(ROOT_FOUND AND KASPER_USE_ROOT) +if(ROOT_FOUND AND KASPER_USE_ROOT AND ROOT_CXX_STANDARD) set( CMAKE_CXX_STANDARD ${ROOT_CXX_STANDARD} CACHE STRING "The C++ standard, as requested by the ROOT library. Can't be changed." FORCE) endif()