Skip to content

Commit

Permalink
refactor: Rename VertexPerformanceWriter to VertexNTupleWriter (#…
Browse files Browse the repository at this point in the history
…3745)

Similar to #3737. I think performance writer should provide plots we can look at while the `VertexPerformanceWriter` is actually only writing NTuples.
  • Loading branch information
andiwand authored Oct 19, 2024
1 parent af1bcc6 commit f0d6475
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 44 deletions.
23 changes: 0 additions & 23 deletions Examples/Io/Performance/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion Examples/Io/Root/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ add_library(
src/SeedingPerformanceWriter.cpp
src/TrackFinderPerformanceWriter.cpp
src/TrackFitterPerformanceWriter.cpp
src/VertexPerformanceWriter.cpp
src/VertexNTupleWriter.cpp
)
target_include_directories(
ActsExamplesIoRoot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ enum class RecoVertexClassification {
Split,
};

/// @class VertexPerformanceWriter
/// @class VertexNTupleWriter
///
/// Writes out the number of reconstructed primary vertices along with
/// the number of primary vertices in detector acceptance as well as
/// reconstructable primary vertices after track fitting.
/// Additionally it matches the reco vertices to their truth vertices
/// and write out the difference in x,y and z position.
class VertexPerformanceWriter final
: public WriterT<std::vector<Acts::Vertex>> {
class VertexNTupleWriter final : public WriterT<std::vector<Acts::Vertex>> {
public:
struct Config {
/// Input vertex collection.
Expand Down Expand Up @@ -90,9 +89,9 @@ class VertexPerformanceWriter final
///
/// @param config Configuration struct
/// @param level Message level declaration
VertexPerformanceWriter(const Config& config, Acts::Logging::Level level);
VertexNTupleWriter(const Config& config, Acts::Logging::Level level);

~VertexPerformanceWriter() override;
~VertexNTupleWriter() override;

/// End-of-run hook
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/VertexPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/VertexNTupleWriter.hpp"

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"
Expand Down Expand Up @@ -106,9 +106,9 @@ std::uint32_t getNumberOfTruePriVertices(

} // namespace

VertexPerformanceWriter::VertexPerformanceWriter(
const VertexPerformanceWriter::Config& config, Acts::Logging::Level level)
: WriterT(config.inputVertices, "VertexPerformanceWriter", level),
VertexNTupleWriter::VertexNTupleWriter(const VertexNTupleWriter::Config& config,
Acts::Logging::Level level)
: WriterT(config.inputVertices, "VertexNTupleWriter", level),
m_cfg(config) {
if (m_cfg.filePath.empty()) {
throw std::invalid_argument("Missing output filename");
Expand Down Expand Up @@ -253,21 +253,21 @@ VertexPerformanceWriter::VertexPerformanceWriter(
m_outputTree->Branch("trk_pullQOverPFitted", &m_pullQOverPFitted);
}

VertexPerformanceWriter::~VertexPerformanceWriter() {
VertexNTupleWriter::~VertexNTupleWriter() {
if (m_outputFile != nullptr) {
m_outputFile->Close();
}
}

ProcessCode VertexPerformanceWriter::finalize() {
ProcessCode VertexNTupleWriter::finalize() {
m_outputFile->cd();
m_outputTree->Write();
m_outputFile->Close();

return ProcessCode::SUCCESS;
}

ProcessCode VertexPerformanceWriter::writeT(
ProcessCode VertexNTupleWriter::writeT(
const AlgorithmContext& ctx, const std::vector<Acts::Vertex>& vertices) {
const double nan = std::numeric_limits<double>::quiet_NaN();

Expand Down
8 changes: 4 additions & 4 deletions Examples/Python/python/acts/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ def addVertexFitting(
VertexFitterAlgorithm,
IterativeVertexFinderAlgorithm,
AdaptiveMultiVertexFinderAlgorithm,
VertexPerformanceWriter,
VertexNTupleWriter,
)

customLogLevel = acts.examples.defaultLogging(s, logLevel)
Expand Down Expand Up @@ -2230,7 +2230,7 @@ def addVertexFitting(
if not outputDirRoot.exists():
outputDirRoot.mkdir()
s.addWriter(
VertexPerformanceWriter(
VertexNTupleWriter(
level=customLogLevel(),
inputVertices=outputVertices,
inputTracks=tracks,
Expand All @@ -2256,7 +2256,7 @@ def addSingleSeedVertexFinding(
) -> None:
from acts.examples import (
SingleSeedVertexFinderAlgorithm,
VertexPerformanceWriter,
VertexNTupleWriter,
)

customLogLevel = acts.examples.defaultLogging(s, logLevel)
Expand All @@ -2277,7 +2277,7 @@ def addSingleSeedVertexFinding(
outputDirRoot.mkdir()

s.addWriter(
VertexPerformanceWriter(
VertexNTupleWriter(
level=customLogLevel(),
inputAllTruthParticles=inputParticles,
inputSelectedTruthParticles=selectedParticles,
Expand Down
4 changes: 2 additions & 2 deletions Examples/Python/src/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "ActsExamples/Io/Root/SeedingPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/TrackFinderPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/TrackFitterPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/VertexPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/VertexNTupleWriter.hpp"
#include "ActsExamples/MaterialMapping/IMaterialWriter.hpp"
#include "ActsExamples/Plugins/Obj/ObjPropagationStepsWriter.hpp"
#include "ActsExamples/Plugins/Obj/ObjTrackingGeometryWriter.hpp"
Expand Down Expand Up @@ -353,7 +353,7 @@ void addOutput(Context& ctx) {
treeName, fileMode, writeCovMat, writeGsfSpecific, writeGx2fSpecific);

ACTS_PYTHON_DECLARE_WRITER(
ActsExamples::VertexPerformanceWriter, mex, "VertexPerformanceWriter",
ActsExamples::VertexNTupleWriter, mex, "VertexNTupleWriter",
inputVertices, inputTracks, inputTruthVertices, inputParticles,
inputSelectedParticles, inputTrackParticleMatching, bField, filePath,
treeName, fileMode, vertexMatchThreshold, trackMatchThreshold, useTracks);
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 @@ -31,7 +31,7 @@
RootSimHitWriter,
RootTrackStatesWriter,
RootTrackSummaryWriter,
VertexPerformanceWriter,
VertexNTupleWriter,
RootMeasurementWriter,
CsvParticleWriter,
CsvSimHitWriter,
Expand Down Expand Up @@ -259,7 +259,7 @@ def test_csv_simhits_writer(tmp_path, fatras, conf_const):
RootSimHitWriter,
RootTrackStatesWriter,
RootTrackSummaryWriter,
VertexPerformanceWriter,
VertexNTupleWriter,
SeedingPerformanceWriter,
],
)
Expand Down

0 comments on commit f0d6475

Please sign in to comment.