diff --git a/.clang-tidy b/.clang-tidy index b77eb7afc9..069842df90 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -9,7 +9,7 @@ Checks: ' -bugprone-easily-swappable-parameters, -bugprone-macro-parentheses, -bugprone-narrowing-conversions, - -bugprone-unchecked-optional-access, + -modernize-use-trailing-return-type, -modernize-avoid-c-arrays, -modernize-use-nodiscard, diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 824bafa87a..7e6f9af9ba 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -251,11 +251,12 @@ jobs: with: platform-release: "${{ env.platform }}:${{ env.release }}" run: | + git diff ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.base.sha }} --name-only | tee changed_files.txt # reduce headers until diff is stable while [[ ${sha:-} != $(git diff | sha256sum) ]] ; do sha=$(git diff | sha256sum) echo $sha - iwyu_tool.py -p build $(git diff --name-only ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.base.sha }}) -- -Xiwyu --verbose=3 -Xiwyu --no_fwd_decls -Xiwyu --cxx17ns -Xiwyu --mapping_file=${{github.workspace}}/.github/iwyu.imp -Xiwyu --regex=ecmascript | tee iwyu_fixes.log + iwyu_tool.py -p build $(cat changed_files.txt | grep -E '\.(cpp|cc|cxx|c\+\+)$' | paste -sd ' ') -- -Xiwyu --verbose=3 -Xiwyu --no_fwd_decls -Xiwyu --cxx17ns -Xiwyu --mapping_file=${{github.workspace}}/.github/iwyu.imp -Xiwyu --regex=ecmascript | tee iwyu_fixes.log fix_includes.py --blank_lines --nosafe_headers --reorder --separate_project_includes="" --keep_iwyu_namespace_format < iwyu_fixes.log git diff | tee iwyu_fixes.patch done diff --git a/src/algorithms/tracking/ActsToTracks.cc b/src/algorithms/tracking/ActsToTracks.cc index ce694ffc90..64485f3a35 100644 --- a/src/algorithms/tracking/ActsToTracks.cc +++ b/src/algorithms/tracking/ActsToTracks.cc @@ -97,6 +97,10 @@ void ActsToTracks::process(const Input& input, const Output& output) const { // Get the fitted track parameter const auto& boundParam = traj->trackParameters(trackTip); const auto& parameter = boundParam.parameters(); + if (!boundParam.covariance().has_value()) { + warning("Track parameters do not have covariance matrix, skipping track"); + continue; + } const auto& covariance = *boundParam.covariance(); auto pars = track_parameters->create(); diff --git a/src/algorithms/tracking/TrackPropagation.cc b/src/algorithms/tracking/TrackPropagation.cc index 5582707da5..ed393ea76c 100644 --- a/src/algorithms/tracking/TrackPropagation.cc +++ b/src/algorithms/tracking/TrackPropagation.cc @@ -316,8 +316,16 @@ TrackPropagation::propagate(const edm4eic::Track& /* track */, m_log->trace(" propagation result is OK"); // Pulling results to convenient variables - auto trackStateParams = *((*result).endParameters); - const auto& parameter = trackStateParams.parameters(); + if (!(*result).endParameters.has_value()) { + m_log->trace(" propagation failed (endParameters not available)"); + return nullptr; + } + auto trackStateParams = *((*result).endParameters); + const auto& parameter = trackStateParams.parameters(); + if (!trackStateParams.covariance().has_value()) { + m_log->trace(" propagation failed (covariance not available)"); + return nullptr; + } const auto& covariance = *trackStateParams.covariance(); // Path length diff --git a/src/benchmarks/reconstruction/tracking_efficiency/TrackingEfficiency_processor.cc b/src/benchmarks/reconstruction/tracking_efficiency/TrackingEfficiency_processor.cc index ae89fbc66c..b6374cddd8 100644 --- a/src/benchmarks/reconstruction/tracking_efficiency/TrackingEfficiency_processor.cc +++ b/src/benchmarks/reconstruction/tracking_efficiency/TrackingEfficiency_processor.cc @@ -108,6 +108,10 @@ void TrackingEfficiency_processor::Process(const std::shared_ptr& if (traj->hasTrackParameters(trackTip)) { const auto& boundParam = traj->trackParameters(trackTip); const auto& parameter = boundParam.parameters(); + if (!boundParam.covariance().has_value()) { + m_log->debug("Track parameters do not have covariance matrix"); + continue; + } const auto& covariance = *boundParam.covariance(); m_log->debug("{:>10.2f} {:>10.2f} {:>10.2f} {:>10.3f} {:>10.4f} {:>10.3f} {:>12.4e} " "{:>12.4e} {:>12.4e} {:>8.2f}",