Skip to content

DCMathSegmentMaker - Insert cotangens protection

Hi,

the changes applied in this MR are a minor code clean-up in terms of removing iterators, replacing std::sqrt(2) by the appropiate constants and finally to protect the cot calculations from cases where the argument is 0 or PI_over_2. The latter is needed to avoid the following FPE seen in the latest large-scale tests:

#######################################################################################
Algorithm:  MuGirlAlg_LRT
FPE type:   FPE INVALID
Panda-link: https://bigpanda.cern.ch/job?pandaid=5098935932
#######################################################################################
14:57:46 FPEAuditor                                          2859     7 WARNING FPE INVALID in [Execute] of [MuGirlAlg_LRT] on event 405171245 500 0
14:57:46 FPEAuditor                                          2859     7 WARNING FPE DIVBYZERO in [Execute] of [MuGirlAlg_LRT] on event 405171245 500 0x2b1793366994
14:57:46 FPEAuditor                                          2859     7    INFO FPE stacktrace 0 :
14:57:46   in function : std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) (/cvmfs/sft.cern.ch/lcg/releases/gcc/8.3.0-cebb0/x86_64-centos7/include/c++/8.3.0/ostream:562)
14:57:46   included from : fpe_sig_action (/build/atnight/localbuilds/nightlies/Athena/master/athena/Control/AthenaAuditors/src/FPEAudit_linux.icc:80)
14:57:46   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libAthenaAuditors.so
14:57:46 FPEAuditor                                          2859     7    INFO FPE stacktrace 1 :
14:57:46   in function : __restore_rt (sigaction.c:0)
14:57:46   in library : /lib64/libpthread.so.0
14:57:48 FPEAuditor                                          2859     7    INFO FPE stacktrace 2 :
14:57:48   in function : Muon::DCMathSegmentMaker::distanceToSegment(TrkDriftCircleMath::Segment const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Transform<double, 3, 2, 0>) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx:2040)
14:57:48   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libDCMathSegmentMaker.so
14:57:49 FPEAuditor                                          2859     7    INFO FPE stacktrace 3 :
14:57:49   in function : Muon::DCMathSegmentMaker::associateClustersToSegment(TrkDriftCircleMath::Segment const&, Identifier const&, Eigen::Transform<double, 3, 2, 0>, std::pair<std::vector<Muon::DCMathSegmentMaker::Cluster2D, std::allocator<Muon::DCMathSegmentMaker::Cluster2D> >, std::vector<Muon::DCMathSegmentMaker::Cluster2D, std::allocator<Muon::DCMathSegmentMaker::Cluster2D> > >&, double, double, std::vector<std::pair<double, Trk::MeasurementBase const*>, std::allocator<std::pair<double, Trk::MeasurementBase const*> > >&) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx:1774)
14:57:49   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libDCMathSegmentMaker.so
14:57:50 FPEAuditor                                          2859     7    INFO FPE stacktrace 4 :
14:57:50   in function : Muon::DCMathSegmentMaker::createSegment(TrkDriftCircleMath::Segment&, Identifier const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, std::vector<Muon::MdtDriftCircleOnTrack const*, std::allocator<Muon::MdtDriftCircleOnTrack const*> > const&, bool, Muon::DCMathSegmentMaker::segmentCreationInfo&) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx:613)
14:57:50   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libDCMathSegmentMaker.so
14:57:51 FPEAuditor                                          2859     7    INFO FPE stacktrace 5 :
14:57:51   in function : Muon::DCMathSegmentMaker::find(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&, std::vector<Muon::MdtDriftCircleOnTrack const*, std::allocator<Muon::MdtDriftCircleOnTrack const*> > const&, std::vector<Muon::MuonClusterOnTrack const*, std::allocator<Muon::MuonClusterOnTrack const*> > const&, bool, DataVector<Trk::Segment, DataModel_detail::NoBase>*, double, double) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx:458)
14:57:51   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libDCMathSegmentMaker.so
14:57:52 FPEAuditor                                          2859     7    INFO FPE stacktrace 6 :
14:57:52   in function : Muon::MuonLayerSegmentFinderTool::findMdtSegments(Muon::MuonSystemExtension::Intersection const&, std::vector<Muon::MdtDriftCircleOnTrack const*, std::allocator<Muon::MdtDriftCircleOnTrack const*> > const&, std::vector<Muon::MuonClusterOnTrack const*, std::allocator<Muon::MuonClusterOnTrack const*> > const&, std::vector<std::shared_ptr<Muon::MuonSegment const>, std::allocator<std::shared_ptr<Muon::MuonSegment const> > >&) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx:260)
14:57:52   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libMuonLayerSegmentMakerTools.so
14:57:52 FPEAuditor                                          2859     7    INFO FPE stacktrace 7 :
14:57:52   in function : Muon::MuonLayerSegmentFinderTool::findMdtSegments(Muon::MuonSystemExtension::Intersection const&, Muon::MuonLayerPrepRawData const&, std::vector<std::shared_ptr<Muon::MuonSegment const>, std::allocator<std::shared_ptr<Muon::MuonSegment const> > >&) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx:236)
14:57:52   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libMuonLayerSegmentMakerTools.so
14:57:53 FPEAuditor                                          2859     7    INFO FPE stacktrace 8 :
14:57:53   in function : Muon::MuonLayerSegmentFinderTool::find(Muon::MuonSystemExtension::Intersection const&, std::vector<std::shared_ptr<Muon::MuonSegment const>, std::allocator<std::shared_ptr<Muon::MuonSegment const> > >&, Muon::MuonLayerPrepRawData&, EventContext const&) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonLayerSegmentMakerTools/src/MuonLayerSegmentFinderTool.cxx:62)
14:57:53   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libMuonLayerSegmentMakerTools.so
14:57:55 FPEAuditor                                          2859     7    INFO FPE stacktrace 9 :
14:57:55   in function : std::vector<std::shared_ptr<Muon::MuonSegment const>, std::allocator<std::shared_ptr<Muon::MuonSegment const> > >::empty() const (/cvmfs/sft.cern.ch/lcg/releases/gcc/8.3.0-cebb0/x86_64-centos7/include/c++/8.3.0/bits/stl_vector.h:895)
14:57:55   included from : MuonCombined::MuonInsideOutRecoTool::handleCandidate(MuonCombined::InDetCandidate const&, MuonCombined::InDetCandidateToTagMap*, MuonCombined::IMuonCombinedInDetExtensionTool::MuonPrdData, DataVector<Trk::Track, DataModel_detail::NoBase>*, DataVector<Trk::Track, DataModel_detail::NoBase>*, DataVector<Trk::Segment, DataModel_detail::NoBase>*, EventContext const&) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx:93)
14:57:55   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libMuonCombinedTrackFindingTools.so
14:57:56 FPEAuditor                                          2859     7    INFO FPE stacktrace 10 :
14:57:56   in function : MuonCombined::MuonInsideOutRecoTool::extendWithPRDs(DataVector<MuonCombined::InDetCandidate, DataModel_detail::NoBase> const&, MuonCombined::InDetCandidateToTagMap*, MuonCombined::IMuonCombinedInDetExtensionTool::MuonPrdData, DataVector<Trk::Track, DataModel_detail::NoBase>*, DataVector<Trk::Track, DataModel_detail::NoBase>*, DataVector<Trk::Segment, DataModel_detail::NoBase>*, EventContext const&) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx:51)
14:57:56   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libMuonCombinedTrackFindingTools.so
14:57:58 FPEAuditor                                          2859     7    INFO FPE stacktrace 11 :
14:57:58   in function : MuonCombinedInDetExtensionAlg::execute(EventContext const&) const (/build/atnight/localbuilds/nightlies/Athena/master/athena/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetExtensionAlg.cxx:87)
14:57:58   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libMuonCombinedAlgs.so
14:58:00 FPEAuditor                                          2859     7    INFO FPE stacktrace 12 :
14:58:00   in function : StatusCode::operator=(StatusCode const&) (/build/atnight/localbuilds/nightlies/Athena/master/build/build/AthenaExternals/src/Gaudi/GaudiKernel/include/GaudiKernel/StatusCode.h:142)
14:58:00   included from : Gaudi::Algorithm::sysExecute(EventContext const&) (/build/atnight/localbuilds/nightlies/Athena/master/build/build/AthenaExternals/src/Gaudi/GaudiKernel/src/Lib/Algorithm.cpp:366)
14:58:00   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/AthenaExternals/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libGaudiKernel.so
14:58:01 FPEAuditor                                          2859     7    INFO FPE stacktrace 13 :
14:58:01   in function : AthReentrantAlgorithm::sysExecute(EventContext const&) (/build/atnight/localbuilds/nightlies/Athena/master/athena/Control/AthenaBaseComps/src/AthReentrantAlgorithm.cxx:70)
14:58:01   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/Athena/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libAthenaBaseComps.so
14:58:02 FPEAuditor                                          2859     7    INFO FPE stacktrace 14 :
14:58:02   in function : StatusCode::isSuccess() const (/build/atnight/localbuilds/nightlies/Athena/master/build/build/AthenaExternals/src/Gaudi/GaudiKernel/include/GaudiKernel/StatusCode.h:393)
14:58:02   included from : StatusCode::isFailure() const (/build/atnight/localbuilds/nightlies/Athena/master/build/build/AthenaExternals/src/Gaudi/GaudiKernel/include/GaudiKernel/StatusCode.h:149)
14:58:02   included from : AlgTask<tbb::task>::execute() (/build/atnight/localbuilds/nightlies/Athena/master/build/build/AthenaExternals/src/Gaudi/GaudiHive/src/AlgTask.h:86)
14:58:02   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/2021-06-24T2101/AthenaExternals/22.0.38/InstallArea/x86_64-centos7-gcc8-opt/lib/libGaudiHive.so
14:58:02 FPEAuditor                                          2859     7    INFO FPE stacktrace 15 :
14:58:02   in function : tbb::internal::custom_scheduler<tbb::internal::IntelSchedulerTraits>::process_bypass_loop(tbb::internal::context_guard_helper<false>&, tbb::task*, long) (/workspace/build/externals/tbb-2020_U2/src/tbb/2020_U2/build/linux_intel64_gcc_cc8.3.0_libc2.17_kernel3.10.0_release/../../src/tbb/custom_scheduler.h:474)
14:58:02   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/sw/lcg/releases/LCG_100_ATLAS_4/tbb/2020_U2/x86_64-centos7-gcc8-opt/lib/libtbb.so.2
14:58:02 FPEAuditor                                          2859     7    INFO FPE stacktrace 16 :
14:58:02   in function : tbb::internal::custom_scheduler<tbb::internal::IntelSchedulerTraits>::local_wait_for_all(tbb::task&, tbb::task*) (/workspace/build/externals/tbb-2020_U2/src/tbb/2020_U2/build/linux_intel64_gcc_cc8.3.0_libc2.17_kernel3.10.0_release/../../src/tbb/custom_scheduler.h:636)
14:58:02   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/sw/lcg/releases/LCG_100_ATLAS_4/tbb/2020_U2/x86_64-centos7-gcc8-opt/lib/libtbb.so.2
14:58:02 FPEAuditor                                          2859     7    INFO FPE stacktrace 17 :
14:58:02   in function : tbb::internal::arena::process(tbb::internal::generic_scheduler&) (/workspace/build/externals/tbb-2020_U2/src/tbb/2020_U2/build/linux_intel64_gcc_cc8.3.0_libc2.17_kernel3.10.0_release/../../src/tbb/arena.cpp:196)
14:58:02   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/sw/lcg/releases/LCG_100_ATLAS_4/tbb/2020_U2/x86_64-centos7-gcc8-opt/lib/libtbb.so.2
14:58:02 FPEAuditor                                          2859     7    INFO FPE stacktrace 18 :
14:58:02   in function : tbb::internal::market::process(rml::job&) (/workspace/build/externals/tbb-2020_U2/src/tbb/2020_U2/build/linux_intel64_gcc_cc8.3.0_libc2.17_kernel3.10.0_release/../../src/tbb/market.cpp:666)
14:58:02   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/sw/lcg/releases/LCG_100_ATLAS_4/tbb/2020_U2/x86_64-centos7-gcc8-opt/lib/libtbb.so.2
14:58:02 FPEAuditor                                          2859     7    INFO FPE stacktrace 19 :
14:58:02   in function : tbb::internal::machine_load_store<int, 4ul>::load_with_acquire(int const volatile&) (/workspace/build/externals/tbb-2020_U2/src/tbb/2020_U2/build/linux_intel64_gcc_cc8.3.0_libc2.17_kernel3.10.0_release/../../include/tbb/machine/gcc_generic.h:160)
14:58:02   included from : int tbb::internal::__TBB_load_with_acquire<int>(int const volatile&) (/workspace/build/externals/tbb-2020_U2/src/tbb/2020_U2/build/linux_intel64_gcc_cc8.3.0_libc2.17_kernel3.10.0_release/../../include/tbb/tbb_machine.h:710)
14:58:02   included from : tbb::internal::atomic_impl<tbb::internal::rml::private_worker::state_t>::operator tbb::internal::rml::private_worker::state_t() const volatile (/workspace/build/externals/tbb-2020_U2/src/tbb/2020_U2/build/linux_intel64_gcc_cc8.3.0_libc2.17_kernel3.10.0_release/../../include/tbb/atomic.h:312)
14:58:02   included from : tbb::internal::rml::private_worker::run() (/workspace/build/externals/tbb-2020_U2/src/tbb/2020_U2/build/linux_intel64_gcc_cc8.3.0_libc2.17_kernel3.10.0_release/../../src/tbb/private_server.cpp:264)
14:58:02   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/sw/lcg/releases/LCG_100_ATLAS_4/tbb/2020_U2/x86_64-centos7-gcc8-opt/lib/libtbb.so.2
14:58:02 FPEAuditor                                          2859     7    INFO FPE stacktrace 20 :
14:58:02   in function : tbb::internal::rml::private_worker::thread_routine(void*) (/workspace/build/externals/tbb-2020_U2/src/tbb/2020_U2/build/linux_intel64_gcc_cc8.3.0_libc2.17_kernel3.10.0_release/../../src/tbb/private_server.cpp:221)
14:58:02   in library : /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc8-opt/sw/lcg/releases/LCG_100_ATLAS_4/tbb/2020_U2/x86_64-centos7-gcc8-opt/lib/libtbb.so.2
14:58:02 FPEAuditor                                          2859     7    INFO FPE stacktrace 21 :
14:58:02   in function : start_thread (pthread_create.c:0)
14:58:02   in library : /lib64/libpthread.so.0
14:58:02 FPEAuditor                                          2859     7    INFO FPE stacktrace 22 :
14:58:02   in library : /lib64/libc.so.6

I have not opened a dedicated ticket for this one so let me mention the general ATLASRECTS-5620 for completeness.

Merge request reports