Skip to content

Commit

Permalink
clear method for Track Container
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlo Varni committed Jul 10, 2023
1 parent d0ad664 commit da37cec
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Core/include/Acts/EventData/TrackContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ class TrackContainer {
container().ensureDynamicColumns_impl(other.container());
}

/// Clear the content of the track container
template <bool RO = ReadOnly, typename = std::enable_if_t<!RO>>
void clear() {
m_container->clear_impl();
m_traj->clear_impl();
}

protected:
template <typename T, HashedString key, bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/EventData/VectorTrackContainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ class VectorTrackContainer final : public detail_vtc::VectorTrackContainerBase {
const detail_vtc::VectorTrackContainerBase& other);

void reserve(IndexType size);
void clear();

void clear_impl();
void setReferenceSurface_impl(IndexType itrack,
std::shared_ptr<const Surface> surface) {
m_referenceSurfaces[itrack] = std::move(surface);
}

// END INTERFACE
};

Expand Down
2 changes: 1 addition & 1 deletion Core/src/EventData/VectorTrackContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void VectorTrackContainer::reserve(IndexType size) {
}
}

void VectorTrackContainer::clear() {
void VectorTrackContainer::clear_impl() {
m_tipIndex.clear();

m_params.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithm::execute(
auto trackContainerTemp = std::make_shared<Acts::VectorTrackContainer>();
auto trackStateContainerTemp =
std::make_shared<Acts::VectorMultiTrajectory>();

TrackContainer tracks(trackContainer, trackStateContainer);
TrackContainer tracksTemp(trackContainerTemp, trackStateContainerTemp);

Expand All @@ -134,8 +134,8 @@ ActsExamples::ProcessCode ActsExamples::TrackFindingAlgorithm::execute(
unsigned int nSeed = 0;

for (std::size_t iseed = 0; iseed < initialParameters.size(); ++iseed) {
trackContainerTemp->clear();
trackStateContainerTemp->clear();
tracksTemp.clear();

auto result =
(*m_cfg.findTracks)(initialParameters.at(iseed), options, tracksTemp);
m_nTotalSeeds++;
Expand Down

0 comments on commit da37cec

Please sign in to comment.