From ba060ce56005d56dbd07b3d3331ae212881dadc9 Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Sat, 19 Oct 2024 11:58:28 +0200 Subject: [PATCH] refactor: Rename track finder performance writers in Examples --- Examples/Io/Performance/CMakeLists.txt | 23 ------------------ 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 +- 8 files changed, 22 insertions(+), 47 deletions(-) delete mode 100644 Examples/Io/Performance/CMakeLists.txt rename Examples/Io/Root/include/ActsExamples/Io/Root/{TrackFinderPerformanceWriter.hpp => TrackFinderNTupleWriter.hpp} (90%) rename Examples/Io/Root/src/{TrackFinderPerformanceWriter.cpp => TrackFinderNTupleWriter.cpp} (92%) diff --git a/Examples/Io/Performance/CMakeLists.txt b/Examples/Io/Performance/CMakeLists.txt deleted file mode 100644 index b41bf76ea07..00000000000 --- a/Examples/Io/Performance/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -add_library( - ActsExamplesIoPerformance - SHARED - ActsExamples/Io/Performance/CKFPerformanceWriter.cpp - ActsExamples/Io/Performance/SeedingPerformanceWriter.cpp - ActsExamples/Io/Performance/TrackFinderPerformanceWriter.cpp - ActsExamples/Io/Performance/TrackFitterPerformanceWriter.cpp - ActsExamples/Io/Performance/VertexPerformanceWriter.cpp -) -target_include_directories( - ActsExamplesIoPerformance - PUBLIC $ -) -target_link_libraries( - ActsExamplesIoPerformance - PUBLIC ActsExamplesFramework - PRIVATE ActsCore ROOT::Core ROOT::Tree -) - -install( - TARGETS ActsExamplesIoPerformance - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -) diff --git a/Examples/Io/Root/CMakeLists.txt b/Examples/Io/Root/CMakeLists.txt index f384c291bc1..eb199cd120d 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/VertexPerformanceWriter.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 287cf361999..51cca689b00 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 92% rename from Examples/Io/Root/src/TrackFinderPerformanceWriter.cpp rename to Examples/Io/Root/src/TrackFinderNTupleWriter.cpp index 14e04252283..3642d35f318 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::TrackContainer& 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 38d64100fd3..73117ff3100 100644 --- a/Examples/Python/python/acts/examples/reconstruction.py +++ b/Examples/Python/python/acts/examples/reconstruction.py @@ -1838,7 +1838,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 bda45b3cab7..b81b39ba82f 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/VertexPerformanceWriter.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 a3098c743c9..b63d680e620 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