Skip to content

Commit

Permalink
refactor: Rename VertexPerformanceWriter to VertexNTupleWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed Oct 17, 2024
1 parent 7436f40 commit b4f776d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
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/Performance/VertexPerformanceWriter.hpp"
#include "ActsExamples/Io/Performance/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
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
2 changes: 1 addition & 1 deletion Examples/Io/Performance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ add_library(
ActsExamples/Io/Performance/SeedingPerformanceWriter.cpp
ActsExamples/Io/Performance/TrackFinderPerformanceWriter.cpp
ActsExamples/Io/Performance/TrackFitterPerformanceWriter.cpp
ActsExamples/Io/Performance/VertexPerformanceWriter.cpp
ActsExamples/Io/Performance/VertexNTupleWriter.cpp
)
target_include_directories(
ActsExamplesIoPerformance
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 @@ -2180,7 +2180,7 @@ def addVertexFitting(
VertexFitterAlgorithm,
IterativeVertexFinderAlgorithm,
AdaptiveMultiVertexFinderAlgorithm,
VertexPerformanceWriter,
VertexNTupleWriter,
)

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

customLogLevel = acts.examples.defaultLogging(s, logLevel)
Expand All @@ -2310,7 +2310,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 @@ -31,7 +31,7 @@
#include "ActsExamples/Io/Performance/SeedingPerformanceWriter.hpp"
#include "ActsExamples/Io/Performance/TrackFinderPerformanceWriter.hpp"
#include "ActsExamples/Io/Performance/TrackFitterPerformanceWriter.hpp"
#include "ActsExamples/Io/Performance/VertexPerformanceWriter.hpp"
#include "ActsExamples/Io/Performance/VertexNTupleWriter.hpp"
#include "ActsExamples/Io/Root/RootBFieldWriter.hpp"
#include "ActsExamples/Io/Root/RootMaterialTrackWriter.hpp"
#include "ActsExamples/Io/Root/RootMaterialWriter.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 b4f776d

Please sign in to comment.