From 0627ea98dd0445bca8b76da5c9439fa3d692d84c Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sat, 19 Oct 2024 17:14:25 +0200 Subject: [PATCH] refactor: Rename `TrackFinderPerformanceWriter` in Examples (#3737) I usually expect some accumulated plots in the performance writers we can directly look at. At the same time the `CKFPerformanceWriter` is generic enough to write the performance for any finder. Therefore I propose to - Rename `TrackFinderPerformanceWriter` to `TrackFinderNTupleWriter` (this pr) - (and later) Rename `CKFPerformanceWriter` to `TrackFinderPerformanceWriter` blocked by - https://github.com/acts-project/acts/pull/3742 --- Examples/Io/Root/CMakeLists.txt | 2 +- ...Writer.hpp => TrackFinderNTupleWriter.hpp} | 6 ++--- ...Writer.cpp => TrackFinderNTupleWriter.cpp} | 24 +++++++++---------- .../python/acts/examples/reconstruction.py | 2 +- Examples/Python/src/Output.cpp | 6 ++--- Examples/Python/tests/test_writer.py | 4 ++-- .../Scripts/TrackingPerformance/TreeReader.h | 2 +- 7 files changed, 22 insertions(+), 24 deletions(-) rename Examples/Io/Root/include/ActsExamples/Io/Root/{TrackFinderPerformanceWriter.hpp => TrackFinderNTupleWriter.hpp} (90%) rename Examples/Io/Root/src/{TrackFinderPerformanceWriter.cpp => TrackFinderNTupleWriter.cpp} (93%) diff --git a/Examples/Io/Root/CMakeLists.txt b/Examples/Io/Root/CMakeLists.txt index e2ca474b774..9bc17e8893e 100644 --- a/Examples/Io/Root/CMakeLists.txt +++ b/Examples/Io/Root/CMakeLists.txt @@ -27,7 +27,7 @@ add_library( src/detail/NuclearInteractionParametrisation.cpp src/CKFPerformanceWriter.cpp src/SeedingPerformanceWriter.cpp - src/TrackFinderPerformanceWriter.cpp + src/TrackFinderNTupleWriter.cpp src/TrackFitterPerformanceWriter.cpp src/VertexNTupleWriter.cpp ) diff --git a/Examples/Io/Root/include/ActsExamples/Io/Root/TrackFinderPerformanceWriter.hpp b/Examples/Io/Root/include/ActsExamples/Io/Root/TrackFinderNTupleWriter.hpp similarity index 90% rename from Examples/Io/Root/include/ActsExamples/Io/Root/TrackFinderPerformanceWriter.hpp rename to Examples/Io/Root/include/ActsExamples/Io/Root/TrackFinderNTupleWriter.hpp index 688f69a9eb1..799471be784 100644 --- a/Examples/Io/Root/include/ActsExamples/Io/Root/TrackFinderPerformanceWriter.hpp +++ b/Examples/Io/Root/include/ActsExamples/Io/Root/TrackFinderNTupleWriter.hpp @@ -24,7 +24,7 @@ struct AlgorithmContext; /// /// Only considers the track finding itself, i.e. grouping of hits into tracks, /// and computes relevant per-track and per-particles statistics. -class TrackFinderPerformanceWriter final : public WriterT { +class TrackFinderNTupleWriter final : public WriterT { public: struct Config { /// Input reconstructed track collection. @@ -48,9 +48,9 @@ class TrackFinderPerformanceWriter final : public WriterT { /// Constructor /// @param config the configuration /// @param level The log level - TrackFinderPerformanceWriter(Config config, Acts::Logging::Level level); + TrackFinderNTupleWriter(Config config, Acts::Logging::Level level); - ~TrackFinderPerformanceWriter() override; + ~TrackFinderNTupleWriter() override; ProcessCode finalize() override; diff --git a/Examples/Io/Root/src/TrackFinderPerformanceWriter.cpp b/Examples/Io/Root/src/TrackFinderNTupleWriter.cpp similarity index 93% rename from Examples/Io/Root/src/TrackFinderPerformanceWriter.cpp rename to Examples/Io/Root/src/TrackFinderNTupleWriter.cpp index 38802a35f58..3ddfc2b6f84 100644 --- a/Examples/Io/Root/src/TrackFinderPerformanceWriter.cpp +++ b/Examples/Io/Root/src/TrackFinderNTupleWriter.cpp @@ -6,7 +6,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -#include "ActsExamples/Io/Root/TrackFinderPerformanceWriter.hpp" +#include "ActsExamples/Io/Root/TrackFinderNTupleWriter.hpp" #include "Acts/Definitions/Units.hpp" #include "ActsExamples/EventData/Index.hpp" @@ -32,7 +32,7 @@ #include #include -struct ActsExamples::TrackFinderPerformanceWriter::Impl { +struct ActsExamples::TrackFinderNTupleWriter::Impl { Config cfg; ReadDataHandle inputParticles; @@ -86,7 +86,7 @@ struct ActsExamples::TrackFinderPerformanceWriter::Impl { // extra logger reference for the logging macros const Acts::Logger& _logger; - Impl(TrackFinderPerformanceWriter* parent, Config&& c, const Acts::Logger& l) + Impl(TrackFinderNTupleWriter* parent, Config&& c, const Acts::Logger& l) : cfg(std::move(c)), inputParticles{parent, "InputParticles"}, inputMeasurementParticlesMap{parent, "InputMeasurementParticlesMap"}, @@ -265,16 +265,15 @@ struct ActsExamples::TrackFinderPerformanceWriter::Impl { } }; -ActsExamples::TrackFinderPerformanceWriter::TrackFinderPerformanceWriter( - ActsExamples::TrackFinderPerformanceWriter::Config config, +ActsExamples::TrackFinderNTupleWriter::TrackFinderNTupleWriter( + ActsExamples::TrackFinderNTupleWriter::Config config, Acts::Logging::Level level) - : WriterT(config.inputTracks, "TrackFinderPerformanceWriter", level), + : WriterT(config.inputTracks, "TrackFinderNTupleWriter", level), m_impl(std::make_unique(this, std::move(config), logger())) {} -ActsExamples::TrackFinderPerformanceWriter::~TrackFinderPerformanceWriter() = - default; +ActsExamples::TrackFinderNTupleWriter::~TrackFinderNTupleWriter() = default; -ActsExamples::ProcessCode ActsExamples::TrackFinderPerformanceWriter::writeT( +ActsExamples::ProcessCode ActsExamples::TrackFinderNTupleWriter::writeT( const ActsExamples::AlgorithmContext& ctx, const ActsExamples::ConstTrackContainer& tracks) { const auto& particles = m_impl->inputParticles(ctx); @@ -285,13 +284,12 @@ ActsExamples::ProcessCode ActsExamples::TrackFinderPerformanceWriter::writeT( return ProcessCode::SUCCESS; } -ActsExamples::ProcessCode -ActsExamples::TrackFinderPerformanceWriter::finalize() { +ActsExamples::ProcessCode ActsExamples::TrackFinderNTupleWriter::finalize() { m_impl->close(); return ProcessCode::SUCCESS; } -const ActsExamples::TrackFinderPerformanceWriter::Config& -ActsExamples::TrackFinderPerformanceWriter::config() const { +const ActsExamples::TrackFinderNTupleWriter::Config& +ActsExamples::TrackFinderNTupleWriter::config() const { return m_impl->cfg; } diff --git a/Examples/Python/python/acts/examples/reconstruction.py b/Examples/Python/python/acts/examples/reconstruction.py index 93532be9224..0062e9cac90 100644 --- a/Examples/Python/python/acts/examples/reconstruction.py +++ b/Examples/Python/python/acts/examples/reconstruction.py @@ -1848,7 +1848,7 @@ def addExaTrkX( # Write truth track finding / seeding performance if outputDirRoot is not None: s.addWriter( - acts.examples.TrackFinderPerformanceWriter( + acts.examples.TrackFinderNTupleWriter( level=customLogLevel(), inputProtoTracks=findingAlg.config.outputProtoTracks, # the original selected particles after digitization diff --git a/Examples/Python/src/Output.cpp b/Examples/Python/src/Output.cpp index b8e113cc38a..278b4ce06a8 100644 --- a/Examples/Python/src/Output.cpp +++ b/Examples/Python/src/Output.cpp @@ -43,7 +43,7 @@ #include "ActsExamples/Io/Root/RootTrackSummaryWriter.hpp" #include "ActsExamples/Io/Root/RootVertexWriter.hpp" #include "ActsExamples/Io/Root/SeedingPerformanceWriter.hpp" -#include "ActsExamples/Io/Root/TrackFinderPerformanceWriter.hpp" +#include "ActsExamples/Io/Root/TrackFinderNTupleWriter.hpp" #include "ActsExamples/Io/Root/TrackFitterPerformanceWriter.hpp" #include "ActsExamples/Io/Root/VertexNTupleWriter.hpp" #include "ActsExamples/MaterialMapping/IMaterialWriter.hpp" @@ -200,8 +200,8 @@ void addOutput(Context& ctx) { "RootVertexWriter", inputVertices, filePath, fileMode, treeName); - ACTS_PYTHON_DECLARE_WRITER(ActsExamples::TrackFinderPerformanceWriter, mex, - "TrackFinderPerformanceWriter", inputTracks, + ACTS_PYTHON_DECLARE_WRITER(ActsExamples::TrackFinderNTupleWriter, mex, + "TrackFinderNTupleWriter", inputTracks, inputParticles, inputMeasurementParticlesMap, inputTrackParticleMatching, filePath, fileMode, treeNameTracks, treeNameParticles); diff --git a/Examples/Python/tests/test_writer.py b/Examples/Python/tests/test_writer.py index 14c4ffe5504..95cd67decd1 100644 --- a/Examples/Python/tests/test_writer.py +++ b/Examples/Python/tests/test_writer.py @@ -21,7 +21,7 @@ from acts import UnitConstants as u from acts.examples import ( ObjPropagationStepsWriter, - TrackFinderPerformanceWriter, + TrackFinderNTupleWriter, SeedingPerformanceWriter, RootPropagationStepsWriter, RootParticleWriter, @@ -250,7 +250,7 @@ def test_csv_simhits_writer(tmp_path, fatras, conf_const): [ RootPropagationStepsWriter, RootParticleWriter, - TrackFinderPerformanceWriter, + TrackFinderNTupleWriter, SeedingPerformanceWriter, RootTrackParameterWriter, RootMaterialTrackWriter, diff --git a/Examples/Scripts/TrackingPerformance/TreeReader.h b/Examples/Scripts/TrackingPerformance/TreeReader.h index 1346d5197ea..d171fa85b72 100644 --- a/Examples/Scripts/TrackingPerformance/TreeReader.h +++ b/Examples/Scripts/TrackingPerformance/TreeReader.h @@ -400,7 +400,7 @@ struct TrackSummaryReader : public TreeReader { }; /// Struct used for reading particles written out by the -/// TrackFinderPerformanceWriter +/// TrackFinderNTupleWriter /// struct ParticleReader : public TreeReader { // Delete the default constructor