From 166c57a7a2883db2f452a738a3ddb39b312ee1d3 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sat, 28 Oct 2023 11:04:39 +0200 Subject: [PATCH] refactor: Refactor FPE masks in Examples (#2581) We are currently mixing where we set masks and some of them are not accurate anymore. Here I try to reduce the masks to a minimum and set them in the code when appropriate. blocked by: - https://github.com/acts-project/acts/pull/2580 --- CI/physmon/fpe_masks.yml | 8 ---- CI/physmon/workflows/physmon_ckf_tracking.py | 3 -- CI/physmon/workflows/physmon_simulation.py | 3 -- .../workflows/physmon_track_finding_ttbar.py | 48 ------------------- .../workflows/physmon_truth_tracking_gsf.py | 3 -- .../physmon_truth_tracking_kalman.py | 3 -- CI/physmon/workflows/physmon_vertexing.py | 3 -- .../Acts/TrackFitting/detail/GsfUtils.hpp | 2 +- .../Vertexing/AdaptiveMultiVertexFinder.ipp | 2 + 9 files changed, 3 insertions(+), 72 deletions(-) delete mode 100644 CI/physmon/fpe_masks.yml diff --git a/CI/physmon/fpe_masks.yml b/CI/physmon/fpe_masks.yml deleted file mode 100644 index 33fd9a6381c..00000000000 --- a/CI/physmon/fpe_masks.yml +++ /dev/null @@ -1,8 +0,0 @@ -"Fatras/include/ActsFatras/Physics/ElectroMagnetic/BetheHeitler.hpp:66": - FLTUND: 1 -"Core/include/Acts/TrackFitting/detail/GsfUtils.hpp:197": - FLTUND: 1 -"Core/include/Acts/TrackFitting/detail/GsfUtils.hpp:201": - FLTUND: 1 -"Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.ipp:120": - FLTUND: 1 diff --git a/CI/physmon/workflows/physmon_ckf_tracking.py b/CI/physmon/workflows/physmon_ckf_tracking.py index 0ce835a6eaf..6304b4bfd14 100755 --- a/CI/physmon/workflows/physmon_ckf_tracking.py +++ b/CI/physmon/workflows/physmon_ckf_tracking.py @@ -43,9 +43,6 @@ def run_ckf_tracking(truthSmearedSeeded, truthEstimatedSeeded, label): events=500, numThreads=-1, logLevel=acts.logging.INFO, - fpeMasks=acts.examples.Sequencer.FpeMask.fromFile( - Path(__file__).parent.parent / "fpe_masks.yml" - ), ) tp = Path(temp) diff --git a/CI/physmon/workflows/physmon_simulation.py b/CI/physmon/workflows/physmon_simulation.py index 5ee85812dee..5e2a2ef91cf 100755 --- a/CI/physmon/workflows/physmon_simulation.py +++ b/CI/physmon/workflows/physmon_simulation.py @@ -27,9 +27,6 @@ events=1000, numThreads=1, logLevel=acts.logging.INFO, - fpeMasks=acts.examples.Sequencer.FpeMask.fromFile( - Path(__file__).parent.parent / "fpe_masks.yml" - ), ) for d in setup.decorators: diff --git a/CI/physmon/workflows/physmon_track_finding_ttbar.py b/CI/physmon/workflows/physmon_track_finding_ttbar.py index 28727254778..ffa9cd3acf0 100755 --- a/CI/physmon/workflows/physmon_track_finding_ttbar.py +++ b/CI/physmon/workflows/physmon_track_finding_ttbar.py @@ -9,7 +9,6 @@ addFatras, addDigitization, ) - from acts.examples.reconstruction import ( addSeeding, TruthSeedRanges, @@ -34,57 +33,10 @@ with tempfile.TemporaryDirectory() as temp: - fpeMasks = acts.examples.Sequencer.FpeMask.fromFile( - Path(__file__).parent.parent / "fpe_masks.yml" - ) + [ - acts.examples.Sequencer.FpeMask( - "Examples/Algorithms/Fatras/src/FatrasSimulation.cpp", - (172, 173), - acts.FpeType.FLTINV, - 1, - ), - acts.examples.Sequencer.FpeMask( - "Examples/Algorithms/Fatras/src/FatrasSimulation.cpp", - (235, 236), - acts.FpeType.FLTINV, - 1, - ), - acts.examples.Sequencer.FpeMask( - "Examples/Algorithms/Fatras/src/FatrasSimulation.cpp", - (235, 236), - acts.FpeType.FLTOVF, - 1, - ), - acts.examples.Sequencer.FpeMask( - "Examples/Io/Root/src/RootTrajectorySummaryWriter.cpp", - (371, 372), - acts.FpeType.FLTINV, - 1, - ), - acts.examples.Sequencer.FpeMask( - "Core/src/Utilities/AnnealingUtility.cpp", - (38, 39), - acts.FpeType.FLTUND, - 1, - ), - acts.examples.Sequencer.FpeMask( - "Fatras/include/ActsFatras/Kernel/detail/SimulationActor.hpp", - (110, 111), - acts.FpeType.FLTINV, - 1, - ), - acts.examples.Sequencer.FpeMask( - "Fatras/include/ActsFatras/Kernel/Simulation.hpp", - (96, 97), - acts.FpeType.FLTOVF, - 1, - ), - ] s = acts.examples.Sequencer( events=3, numThreads=-1, logLevel=acts.logging.INFO, - fpeMasks=fpeMasks, ) tp = Path(temp) diff --git a/CI/physmon/workflows/physmon_truth_tracking_gsf.py b/CI/physmon/workflows/physmon_truth_tracking_gsf.py index ca92f7b183a..d56cd603f23 100755 --- a/CI/physmon/workflows/physmon_truth_tracking_gsf.py +++ b/CI/physmon/workflows/physmon_truth_tracking_gsf.py @@ -15,9 +15,6 @@ events=10000, numThreads=-1, logLevel=acts.logging.INFO, - fpeMasks=acts.examples.Sequencer.FpeMask.fromFile( - Path(__file__).parent.parent / "fpe_masks.yml" - ), ) tp = Path(temp) diff --git a/CI/physmon/workflows/physmon_truth_tracking_kalman.py b/CI/physmon/workflows/physmon_truth_tracking_kalman.py index c01e1a0e182..aad4e8e40c7 100755 --- a/CI/physmon/workflows/physmon_truth_tracking_kalman.py +++ b/CI/physmon/workflows/physmon_truth_tracking_kalman.py @@ -15,9 +15,6 @@ events=10000, numThreads=-1, logLevel=acts.logging.INFO, - fpeMasks=acts.examples.Sequencer.FpeMask.fromFile( - Path(__file__).parent.parent / "fpe_masks.yml" - ), ) tp = Path(temp) diff --git a/CI/physmon/workflows/physmon_vertexing.py b/CI/physmon/workflows/physmon_vertexing.py index 41098229cd2..1b86c7f018a 100755 --- a/CI/physmon/workflows/physmon_vertexing.py +++ b/CI/physmon/workflows/physmon_vertexing.py @@ -41,9 +41,6 @@ def run_vertexing(fitter, mu, events): events=events, numThreads=-1, logLevel=acts.logging.INFO, - fpeMasks=acts.examples.Sequencer.FpeMask.fromFile( - Path(__file__).parent.parent / "fpe_masks.yml" - ), ) tp = Path(temp) diff --git a/Core/include/Acts/TrackFitting/detail/GsfUtils.hpp b/Core/include/Acts/TrackFitting/detail/GsfUtils.hpp index 5d38f44a6b6..4413a90f000 100644 --- a/Core/include/Acts/TrackFitting/detail/GsfUtils.hpp +++ b/Core/include/Acts/TrackFitting/detail/GsfUtils.hpp @@ -194,7 +194,7 @@ void computePosteriorWeights( .data(), state.predictedCovariance(), state.projector(), state.calibratedSize()); - const auto factor = std::sqrt(1. / detR) * std::exp(-0.5 * chi2); + const auto factor = std::sqrt(1. / detR) * safeExp(-0.5 * chi2); // If something is not finite here, just leave the weight as it is if (std::isfinite(factor)) { diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.ipp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.ipp index 11ff5a0a9bb..5d2dbe655b6 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.ipp @@ -116,8 +116,10 @@ auto Acts::AdaptiveMultiVertexFinder::find( break; } } + // MARK: fpeMaskBegin(FLTUND, 1, #2590) bool keepVertex = isGoodVertex && keepNewVertex(vtxCandidate, allVerticesPtr, fitterState); + // MARK: fpeMaskEnd(FLTUND) ACTS_DEBUG("New vertex will be saved: " << keepVertex); // Delete vertex from allVertices list again if it's not kept