Skip to content

Commit

Permalink
factorize fit function in vertex test.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Dec 14, 2023
1 parent 1a2deaf commit c8fc009
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ MagneticFieldContext magFieldContext = MagneticFieldContext();

const std::string toolString = "AMVF";

namespace BoundAmvf {
using Propagator = Acts::Propagator<EigenStepper<>>;
using Linearizer = HelicalTrackLinearizer<Propagator>;
using Fitter = AdaptiveMultiVertexFitter<BoundTrackParameters, Linearizer>;
using SeedFinder =
TrackDensityVertexFinder<Fitter,
GaussianTrackDensity<BoundTrackParameters>>;
using Finder = AdaptiveMultiVertexFinder<Fitter, SeedFinder>;
} // namespace BoundAmvf

Result<std::vector<Vertex<BoundTrackParameters>>> find(
const BoundAmvf::Finder& finder,
const std::vector<const BoundTrackParameters*>& allTracks,
const VertexingOptions<BoundTrackParameters>& vertexingOptions,
BoundAmvf::Finder::State& state);

/// @brief AMVF test with Gaussian seed finder
BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) {
// Set debug mode
Expand Down Expand Up @@ -151,7 +167,9 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) {
geoContext, magFieldContext, bsConstr);

auto t1 = std::chrono::system_clock::now();
auto findResult = finder.find(tracksPtr, vertexingOptions, state);
// auto findResult = finder.find(tracksPtr, vertexingOptions, state);
auto findResult = find(finder, tracksPtr, vertexingOptions, state);
#if 0
auto t2 = std::chrono::system_clock::now();

auto timediff =
Expand Down Expand Up @@ -203,8 +221,11 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) {
CHECK_CLOSE_OR_SMALL(recoVtx.tracks()[0].vertexCompatibility,
expVtx.trk1Comp, relTol, small);
}
#endif
}

#if 0

// Dummy user-defined InputTrack type
struct InputTrack {
InputTrack(const BoundTrackParameters& params, int id)
Expand Down Expand Up @@ -367,6 +388,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_usertype_test) {
}
}


/// @brief AMVF test with grid seed finder
BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_grid_seed_finder_test) {
// Set debug mode
Expand Down Expand Up @@ -666,5 +688,7 @@ BOOST_AUTO_TEST_CASE(
}
}

#endif

} // namespace Test
} // namespace Acts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// This file is part of the Acts project.
//
// Copyright (C) 2023 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include "Acts/EventData/TrackParameters.hpp"
#include "Acts/Propagator/EigenStepper.hpp"
#include "Acts/Vertexing/AdaptiveMultiVertexFinder.hpp"
#include "Acts/Vertexing/AdaptiveMultiVertexFitter.hpp"
#include "Acts/Vertexing/GaussianTrackDensity.hpp"
#include "Acts/Vertexing/HelicalTrackLinearizer.hpp"
#include "Acts/Vertexing/TrackDensityVertexFinder.hpp"
#include "Acts/Vertexing/Vertex.hpp"
#include "Acts/Vertexing/VertexingOptions.hpp"

namespace Acts::Test {

namespace BoundAmvf {
using Propagator = Acts::Propagator<EigenStepper<>>;
using Linearizer = HelicalTrackLinearizer<Propagator>;
using Fitter = AdaptiveMultiVertexFitter<BoundTrackParameters, Linearizer>;
using SeedFinder =
TrackDensityVertexFinder<Fitter,
GaussianTrackDensity<BoundTrackParameters>>;
using Finder = AdaptiveMultiVertexFinder<Fitter, SeedFinder>;
} // namespace BoundAmvf

// template <typename input_track_t, typename finder_t>
// Result<std::vector<Vertex<input_track_t>>> find_impl(
// const finder_t& finder, const std::vector<const input_track_t*>& allTracks,
// const VertexingOptions<input_track_t>& vertexingOptions,
// typename finder_t::state_t& state) {
// return finder.find(allTracks, vertexingOptions, state);
// }

Result<std::vector<Vertex<BoundTrackParameters>>> find(
const BoundAmvf::Finder& finder,
const std::vector<const BoundTrackParameters*>& allTracks,
const VertexingOptions<BoundTrackParameters>& vertexingOptions,
BoundAmvf::Finder::State& state) {
return finder.find(allTracks, vertexingOptions, state);
}

} // namespace Acts::Test
8 changes: 6 additions & 2 deletions Tests/UnitTests/Core/Vertexing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ add_unittest(KalmanVertexTrackUpdater KalmanVertexTrackUpdaterTests.cpp)
add_unittest(KalmanVertexUpdater KalmanVertexUpdaterTests.cpp)
add_unittest(LinearizedTrackFactory LinearizedTrackFactoryTests.cpp)
add_unittest(AdaptiveMultiVertexFitter AdaptiveMultiVertexFitterTests.cpp)
add_unittest(AdaptiveMultiVertexFinder AdaptiveMultiVertexFinderTests.cpp)
add_unittest(ZScanVertexFinder ZScanVertexFinderTests.cpp)
add_unittest(TrackDensityVertexFinder TrackDensityVertexFinderTests.cpp)
add_unittest(GaussianGridTrackDensity GaussianGridTrackDensityTests.cpp)
add_unittest(GridDensityVertexFinder GridDensityVertexFinderTests.cpp)
add_unittest(AdaptiveGridTrackDensity AdaptiveGridTrackDensityTests.cpp)
add_unittest(SingleSeedVertexFinder SingleSeedVertexFinderTests.cpp)
add_unittest(SingleSeedVertexFinder SingleSeedVertexFinderTests.cpp)


add_unittest(AdaptiveMultiVertexFinder AdaptiveMultiVertexFinderTests.cpp)
target_sources(ActsUnitTestAdaptiveMultiVertexFinder PRIVATE
AdaptiveMultiVertexFinderTestsHelper.cpp)

0 comments on commit c8fc009

Please sign in to comment.