Skip to content

Commit

Permalink
refactor: Rename TrackFinderPerformanceWriter in Examples (#3737)
Browse files Browse the repository at this point in the history
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 
- #3742
  • Loading branch information
andiwand authored Oct 19, 2024
1 parent f0d6475 commit 0627ea9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Examples/Io/Root/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ConstTrackContainer> {
class TrackFinderNTupleWriter final : public WriterT<ConstTrackContainer> {
public:
struct Config {
/// Input reconstructed track collection.
Expand All @@ -48,9 +48,9 @@ class TrackFinderPerformanceWriter final : public WriterT<ConstTrackContainer> {
/// 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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -32,7 +32,7 @@
#include <TFile.h>
#include <TTree.h>

struct ActsExamples::TrackFinderPerformanceWriter::Impl {
struct ActsExamples::TrackFinderNTupleWriter::Impl {
Config cfg;

ReadDataHandle<SimParticleContainer> inputParticles;
Expand Down Expand Up @@ -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"},
Expand Down Expand Up @@ -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<Impl>(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);
Expand All @@ -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;
}
2 changes: 1 addition & 1 deletion Examples/Python/python/acts/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Examples/Python/src/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Examples/Python/tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from acts import UnitConstants as u
from acts.examples import (
ObjPropagationStepsWriter,
TrackFinderPerformanceWriter,
TrackFinderNTupleWriter,
SeedingPerformanceWriter,
RootPropagationStepsWriter,
RootParticleWriter,
Expand Down Expand Up @@ -250,7 +250,7 @@ def test_csv_simhits_writer(tmp_path, fatras, conf_const):
[
RootPropagationStepsWriter,
RootParticleWriter,
TrackFinderPerformanceWriter,
TrackFinderNTupleWriter,
SeedingPerformanceWriter,
RootTrackParameterWriter,
RootMaterialTrackWriter,
Expand Down
2 changes: 1 addition & 1 deletion Examples/Scripts/TrackingPerformance/TreeReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0627ea9

Please sign in to comment.