File indexing completed on 2025-01-18 09:11:43
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/Vertexing/SingleSeedVertexFinderAlgorithm.hpp"
0010
0011 #include "Acts/Vertexing/SingleSeedVertexFinder.hpp"
0012 #include "ActsExamples/Framework/WhiteBoard.hpp"
0013
0014 #include <chrono>
0015 #include <vector>
0016
0017 ActsExamples::SingleSeedVertexFinderAlgorithm::SingleSeedVertexFinderAlgorithm(
0018 const Config& cfg, Acts::Logging::Level lvl)
0019 : ActsExamples::IAlgorithm("SingleSeedVertexFinder", lvl), m_cfg(cfg) {
0020 if (m_cfg.inputSpacepoints.empty()) {
0021 ACTS_ERROR("You have to provide seeds");
0022 }
0023 if (m_cfg.outputVertices.empty()) {
0024 ACTS_ERROR("Missing output vertices collection");
0025 }
0026
0027 m_inputSpacepoints.initialize(m_cfg.inputSpacepoints);
0028 m_outputVertices.initialize(m_cfg.outputVertices);
0029 }
0030
0031 ActsExamples::ProcessCode
0032 ActsExamples::SingleSeedVertexFinderAlgorithm::execute(
0033 const ActsExamples::AlgorithmContext& ctx) const {
0034
0035 const std::vector<ActsExamples::SimSpacePoint>& inputSpacepoints =
0036 m_inputSpacepoints(ctx);
0037
0038 Acts::SingleSeedVertexFinder<ActsExamples::SimSpacePoint>::Config
0039 singleSeedVtxCfg;
0040 Acts::SingleSeedVertexFinder<ActsExamples::SimSpacePoint>
0041 SingleSeedVertexFinder(singleSeedVtxCfg);
0042
0043
0044 auto t1 = std::chrono::high_resolution_clock::now();
0045 auto vtx = SingleSeedVertexFinder.findVertex(inputSpacepoints);
0046 auto t2 = std::chrono::high_resolution_clock::now();
0047 if (vtx.ok()) {
0048 ACTS_INFO("Found a vertex in the event in " << (t2 - t1).count() / 1e6
0049 << " ms");
0050 ACTS_INFO("Found vertex at x = " << vtx.value()[0]
0051 << "mm, y = " << vtx.value()[1]
0052 << "mm, z = " << vtx.value()[2] << "mm");
0053
0054 std::vector<Acts::Vertex> vertexCollection;
0055 vertexCollection.emplace_back(vtx.value());
0056
0057
0058 m_outputVertices(ctx, std::move(vertexCollection));
0059 } else {
0060 ACTS_INFO("Not found a vertex in the event after "
0061 << (t2 - t1).count() / 1e6 << " ms");
0062 }
0063
0064 return ActsExamples::ProcessCode::SUCCESS;
0065 }