Skip to content

Commit

Permalink
refactor: Rename CKFPerformanceWriter to `TrackFinderPerformanceWri…
Browse files Browse the repository at this point in the history
…ter`
  • Loading branch information
andiwand committed Oct 19, 2024
1 parent ba060ce commit 43b31a6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Examples/Io/Root/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ add_library(
src/RootAthenaDumpReader.cpp
src/RootNuclearInteractionParametersWriter.cpp
src/detail/NuclearInteractionParametrisation.cpp
src/CKFPerformanceWriter.cpp
src/TrackFinderPerformanceWriter.cpp
src/SeedingPerformanceWriter.cpp
src/TrackFinderNTupleWriter.cpp
src/TrackFitterPerformanceWriter.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct AlgorithmContext;
/// done by setting the Config::rootFile pointer to an existing file.
///
/// Safe to use from multiple writer threads - uses a std::mutex lock.
class CKFPerformanceWriter final : public WriterT<ConstTrackContainer> {
class TrackFinderPerformanceWriter final : public WriterT<ConstTrackContainer> {
public:
struct Config {
/// Input (found) tracks collection.
Expand All @@ -68,8 +68,8 @@ class CKFPerformanceWriter final : public WriterT<ConstTrackContainer> {
};

/// Construct from configuration and log level.
CKFPerformanceWriter(Config cfg, Acts::Logging::Level lvl);
~CKFPerformanceWriter() override;
TrackFinderPerformanceWriter(Config cfg, Acts::Logging::Level lvl);
~TrackFinderPerformanceWriter() override;

/// Finalize plots.
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/CKFPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/TrackFinderPerformanceWriter.hpp"

#include "Acts/EventData/TrackParameters.hpp"
#include "Acts/Utilities/VectorHelpers.hpp"
Expand All @@ -27,9 +27,9 @@ using Acts::VectorHelpers::phi;

namespace ActsExamples {

CKFPerformanceWriter::CKFPerformanceWriter(CKFPerformanceWriter::Config cfg,
Acts::Logging::Level lvl)
: WriterT(cfg.inputTracks, "CKFPerformanceWriter", lvl),
TrackFinderPerformanceWriter::TrackFinderPerformanceWriter(
TrackFinderPerformanceWriter::Config cfg, Acts::Logging::Level lvl)
: WriterT(cfg.inputTracks, "TrackFinderPerformanceWriter", lvl),
m_cfg(std::move(cfg)),
m_effPlotTool(m_cfg.effPlotToolConfig, lvl),
m_fakeRatePlotTool(m_cfg.fakeRatePlotToolConfig, lvl),
Expand Down Expand Up @@ -76,7 +76,7 @@ CKFPerformanceWriter::CKFPerformanceWriter(CKFPerformanceWriter::Config cfg,
m_trackSummaryPlotTool.book(m_trackSummaryPlotCache);
}

CKFPerformanceWriter::~CKFPerformanceWriter() {
TrackFinderPerformanceWriter::~TrackFinderPerformanceWriter() {
m_effPlotTool.clear(m_effPlotCache);
m_fakeRatePlotTool.clear(m_fakeRatePlotCache);
m_duplicationPlotTool.clear(m_duplicationPlotCache);
Expand All @@ -86,7 +86,7 @@ CKFPerformanceWriter::~CKFPerformanceWriter() {
}
}

ProcessCode CKFPerformanceWriter::finalize() {
ProcessCode TrackFinderPerformanceWriter::finalize() {
float eff_tracks = static_cast<float>(m_nTotalMatchedTracks) / m_nTotalTracks;
float fakeRate_tracks =
static_cast<float>(m_nTotalFakeTracks) / m_nTotalTracks;
Expand Down Expand Up @@ -147,8 +147,8 @@ ProcessCode CKFPerformanceWriter::finalize() {
return ProcessCode::SUCCESS;
}

ProcessCode CKFPerformanceWriter::writeT(const AlgorithmContext& ctx,
const ConstTrackContainer& tracks) {
ProcessCode TrackFinderPerformanceWriter::writeT(
const AlgorithmContext& ctx, const ConstTrackContainer& tracks) {
// The number of majority particle hits and fitted track parameters
using Acts::VectorHelpers::perp;

Expand Down
18 changes: 9 additions & 9 deletions Examples/Python/python/acts/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ def addCKFTracks(
outputDirRoot=outputDirRoot,
writeStates=writeTrajectories,
writeSummary=writeTrajectories,
writeCKFperformance=True,
writePerformance=True,
logLevel=logLevel,
writeCovMat=writeCovMat,
)
Expand Down Expand Up @@ -1606,7 +1606,7 @@ def addTrackWriters(
outputDirRoot: Optional[Union[Path, str]] = None,
writeStates: bool = True,
writeSummary: bool = True,
writeCKFperformance: bool = True,
writePerformance: bool = True,
logLevel: Optional[acts.logging.Level] = None,
writeCovMat=False,
):
Expand Down Expand Up @@ -1644,17 +1644,17 @@ def addTrackWriters(
)
s.addWriter(trackSummaryWriter)

if writeCKFperformance:
if writePerformance:
# Write CKF performance data
ckfPerfWriter = acts.examples.CKFPerformanceWriter(
trackFinderPerfWriter = acts.examples.TrackFinderPerformanceWriter(
level=customLogLevel(),
inputTracks=tracks,
inputParticles="particles_selected",
inputTrackParticleMatching="track_particle_matching",
inputParticleTrackMatching="particle_track_matching",
filePath=str(outputDirRoot / f"performance_{name}.root"),
)
s.addWriter(ckfPerfWriter)
s.addWriter(trackFinderPerfWriter)

if outputDirCsv is not None:
outputDirCsv = Path(outputDirCsv)
Expand Down Expand Up @@ -1907,7 +1907,7 @@ def addAmbiguityResolution(
outputDirRoot=outputDirRoot,
writeStates=writeTrajectories,
writeSummary=writeTrajectories,
writeCKFperformance=True,
writePerformance=True,
logLevel=logLevel,
writeCovMat=writeCovMat,
)
Expand Down Expand Up @@ -1961,7 +1961,7 @@ def addScoreBasedAmbiguityResolution(
outputDirRoot=outputDirRoot,
writeStates=writeTrajectories,
writeSummary=writeTrajectories,
writeCKFperformance=True,
writePerformance=True,
logLevel=logLevel,
writeCovMat=writeCovMat,
)
Expand Down Expand Up @@ -2018,7 +2018,7 @@ def addAmbiguityResolutionML(
outputDirRoot=outputDirRoot,
writeStates=writeTrajectories,
writeSummary=writeTrajectories,
writeCKFperformance=True,
writePerformance=True,
logLevel=logLevel,
)

Expand Down Expand Up @@ -2062,7 +2062,7 @@ def addAmbiguityResolutionMLDBScan(
outputDirCsv=outputDirCsv,
writeStates=writeTrajectories,
writeSummary=writeTrajectories,
writeCKFperformance=True,
writePerformance=True,
logLevel=logLevel,
)

Expand Down
17 changes: 9 additions & 8 deletions Examples/Python/src/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "ActsExamples/Io/Csv/CsvTrackParameterWriter.hpp"
#include "ActsExamples/Io/Csv/CsvTrackWriter.hpp"
#include "ActsExamples/Io/Csv/CsvTrackingGeometryWriter.hpp"
#include "ActsExamples/Io/Root/CKFPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/RootBFieldWriter.hpp"
#include "ActsExamples/Io/Root/RootMaterialTrackWriter.hpp"
#include "ActsExamples/Io/Root/RootMaterialWriter.hpp"
Expand All @@ -44,6 +43,7 @@
#include "ActsExamples/Io/Root/RootVertexWriter.hpp"
#include "ActsExamples/Io/Root/SeedingPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/TrackFinderNTupleWriter.hpp"
#include "ActsExamples/Io/Root/TrackFinderPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/TrackFitterPerformanceWriter.hpp"
#include "ActsExamples/Io/Root/VertexPerformanceWriter.hpp"
#include "ActsExamples/MaterialMapping/IMaterialWriter.hpp"
Expand Down Expand Up @@ -163,7 +163,7 @@ void addOutput(Context& ctx) {
ACTS_PYTHON_STRUCT_END();
}

// Bindings for the binning in e.g., CKFPerformanceWriter
// Bindings for the binning in e.g., TrackFinderPerformanceWriter
{
py::class_<PlotHelpers::Binning>(mex, "Binning")
.def(py::init<std::string, int, double, double>(), "title"_a, "bins"_a,
Expand Down Expand Up @@ -395,12 +395,13 @@ void addOutput(Context& ctx) {
trackingGeometry, outputDir, outputPrecision, writeSensitive,
writeBoundary, writeSurfaceGrid, writeLayerVolume, writePerEvent);

ACTS_PYTHON_DECLARE_WRITER(
ActsExamples::CKFPerformanceWriter, mex, "CKFPerformanceWriter",
inputTracks, inputParticles, inputTrackParticleMatching,
inputParticleTrackMatching, filePath, fileMode, effPlotToolConfig,
fakeRatePlotToolConfig, duplicationPlotToolConfig,
trackSummaryPlotToolConfig, writeMatchingDetails);
ACTS_PYTHON_DECLARE_WRITER(ActsExamples::TrackFinderPerformanceWriter, mex,
"TrackFinderPerformanceWriter", inputTracks,
inputParticles, inputTrackParticleMatching,
inputParticleTrackMatching, filePath, fileMode,
effPlotToolConfig, fakeRatePlotToolConfig,
duplicationPlotToolConfig,
trackSummaryPlotToolConfig, writeMatchingDetails);

ACTS_PYTHON_DECLARE_WRITER(
ActsExamples::RootNuclearInteractionParametersWriter, mex,
Expand Down

0 comments on commit 43b31a6

Please sign in to comment.