Skip to content

Commit

Permalink
refactor: remove input source links from fitting algorithm (#3580)
Browse files Browse the repository at this point in the history
The data structure seems redundant, since the information is also contained in the measurements I think.
  • Loading branch information
benjaminhuth authored Aug 31, 2024
1 parent 2b106ca commit 49b3f54
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ class TrackFittingAlgorithm final : public IAlgorithm {
struct Config {
/// Input measurements collection.
std::string inputMeasurements;
/// Input source links collection.
std::string inputSourceLinks;
/// Input proto tracks collection, i.e. groups of hit indices.
std::string inputProtoTracks;
/// Input initial track parameter estimates for for each proto track.
Expand Down
15 changes: 2 additions & 13 deletions Examples/Algorithms/TrackFitting/src/TrackFittingAlgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ ActsExamples::TrackFittingAlgorithm::TrackFittingAlgorithm(
if (m_cfg.inputMeasurements.empty()) {
throw std::invalid_argument("Missing input measurement collection");
}
if (m_cfg.inputSourceLinks.empty()) {
throw std::invalid_argument("Missing input source links collection");
}
if (m_cfg.inputProtoTracks.empty()) {
throw std::invalid_argument("Missing input proto tracks collection");
}
Expand All @@ -59,7 +56,6 @@ ActsExamples::TrackFittingAlgorithm::TrackFittingAlgorithm(
}

m_inputMeasurements.initialize(m_cfg.inputMeasurements);
m_inputSourceLinks.initialize(m_cfg.inputSourceLinks);
m_inputProtoTracks.initialize(m_cfg.inputProtoTracks);
m_inputInitialTrackParameters.initialize(m_cfg.inputInitialTrackParameters);
m_inputClusters.maybeInitialize(m_cfg.inputClusters);
Expand All @@ -70,7 +66,6 @@ ActsExamples::ProcessCode ActsExamples::TrackFittingAlgorithm::execute(
const ActsExamples::AlgorithmContext& ctx) const {
// Read input data
const auto& measurements = m_inputMeasurements(ctx);
const auto& sourceLinks = m_inputSourceLinks(ctx);
const auto& protoTracks = m_inputProtoTracks(ctx);
const auto& initialParameters = m_inputInitialTrackParameters(ctx);

Expand Down Expand Up @@ -131,14 +126,8 @@ ActsExamples::ProcessCode ActsExamples::TrackFittingAlgorithm::execute(

// Fill the source links via their indices from the container
for (auto hitIndex : protoTrack) {
if (auto it = sourceLinks.nth(hitIndex); it != sourceLinks.end()) {
const IndexSourceLink& sourceLink = *it;
trackSourceLinks.push_back(Acts::SourceLink{sourceLink});
} else {
ACTS_FATAL("Proto track " << itrack << " contains invalid hit index"
<< hitIndex);
return ProcessCode::ABORT;
}
const auto& measurement = measurements.at(hitIndex);
trackSourceLinks.push_back(measurement.sourceLink());
}

ACTS_DEBUG("Invoke direct fitter for track " << itrack);
Expand Down
3 changes: 0 additions & 3 deletions Examples/Python/python/acts/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,6 @@ def addKalmanTracks(
fitAlg = acts.examples.TrackFittingAlgorithm(
level=customLogLevel(),
inputMeasurements="measurements",
inputSourceLinks="sourcelinks",
inputProtoTracks=inputProtoTracks,
inputInitialTrackParameters="estimatedparameters",
inputClusters=clusters if clusters is not None else "",
Expand Down Expand Up @@ -1373,7 +1372,6 @@ def addTruthTrackingGsf(
gsfAlg = acts.examples.TrackFittingAlgorithm(
level=customLogLevel(),
inputMeasurements="measurements",
inputSourceLinks="sourcelinks",
inputProtoTracks=inputProtoTracks,
inputInitialTrackParameters="estimatedparameters",
outputTracks="gsf_tracks",
Expand Down Expand Up @@ -1601,7 +1599,6 @@ def addGx2fTracks(
fitAlg = acts.examples.TrackFittingAlgorithm(
level=customLogLevel(),
inputMeasurements="measurements",
inputSourceLinks="sourcelinks",
inputProtoTracks=inputProtoTracks,
inputInitialTrackParameters="estimatedparameters",
inputClusters=clusters if clusters is not None else "",
Expand Down
9 changes: 4 additions & 5 deletions Examples/Python/src/TrackFitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ void addTrackFitting(Context& ctx) {
inputSimHits, inputMeasurementSimHitsMap,
outputProtoTracks);

ACTS_PYTHON_DECLARE_ALGORITHM(ActsExamples::TrackFittingAlgorithm, mex,
"TrackFittingAlgorithm", inputMeasurements,
inputSourceLinks, inputProtoTracks,
inputInitialTrackParameters, inputClusters,
outputTracks, fit, pickTrack, calibrator);
ACTS_PYTHON_DECLARE_ALGORITHM(
ActsExamples::TrackFittingAlgorithm, mex, "TrackFittingAlgorithm",
inputMeasurements, inputProtoTracks, inputInitialTrackParameters,
inputClusters, outputTracks, fit, pickTrack, calibrator);

ACTS_PYTHON_DECLARE_ALGORITHM(ActsExamples::RefittingAlgorithm, mex,
"RefittingAlgorithm", inputTracks, outputTracks,
Expand Down

0 comments on commit 49b3f54

Please sign in to comment.