diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp index 892ca8fadf8..818d2c363be 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 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 @@ -25,6 +25,7 @@ #include namespace Acts { + /// @brief Implements an iterative vertex finder class AdaptiveMultiVertexFinder final : public IVertexFinder { using VertexFitter = AdaptiveMultiVertexFitter; @@ -147,6 +148,11 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder { /// to true, and time seeding should be enabled. bool useTime = false; + /// If set to true, the vertex finder will not break the finding loop. + /// Some seeders are not able to cope with this therefore this is + /// disabled by default. + bool doNotBreakWhileSeeding = false; + /// Function to extract parameters from InputTrack InputTrack::Extractor extractParameters; }; @@ -154,6 +160,8 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder { /// State struct for fulfilling interface struct State { std::reference_wrapper magContext; + + IVertexFinder::State seedFinderState; }; /// @brief Constructor for user-defined InputTrack_t type != @@ -197,7 +205,8 @@ class AdaptiveMultiVertexFinder final : public IVertexFinder { IVertexFinder::State makeState( const Acts::MagneticFieldContext& mctx) const override { - return IVertexFinder::State{State{mctx}}; + return IVertexFinder::State{ + State{mctx, IVertexFinder::State{m_cfg.seedFinder->makeState(mctx)}}}; } void setTracksToRemove( diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp index cc6ebfb008d..2bd3827faa7 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp @@ -41,6 +41,7 @@ class AdaptiveMultiVertexFitter { const Acts::MagneticFieldContext& magContext) : ipState{field.makeCache(magContext)}, fieldCache(field.makeCache(magContext)) {} + // Vertex collection to be fitted std::vector vertexCollection; diff --git a/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp b/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp index e410bc2fb01..c6308c17152 100644 --- a/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp +++ b/Core/src/Vertexing/AdaptiveMultiVertexFinder.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020-2023 CERN for the benefit of the Acts project +// Copyright (C) 2020-2024 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 @@ -9,11 +9,12 @@ #include "Acts/Vertexing/AdaptiveMultiVertexFinder.hpp" #include "Acts/Utilities/AlgebraHelpers.hpp" +#include "Acts/Vertexing/IVertexFinder.hpp" #include "Acts/Vertexing/VertexingError.hpp" namespace Acts { -Acts::Result> AdaptiveMultiVertexFinder::find( +Result> AdaptiveMultiVertexFinder::find( const std::vector& allTracks, const VertexingOptions& vertexingOptions, IVertexFinder::State& anyState) const { @@ -23,19 +24,13 @@ Acts::Result> AdaptiveMultiVertexFinder::find( } State& state = anyState.template as(); - - // Original tracks - const std::vector& origTracks = allTracks; - - // Seed tracks - std::vector seedTracks = allTracks; - + IVertexFinder::State& seedFinderState = state.seedFinderState; VertexFitterState fitterState(*m_cfg.bField, vertexingOptions.magFieldContext); - auto seedFinderState = m_cfg.seedFinder->makeState(state.magContext); + const std::vector& origTracks = allTracks; + std::vector seedTracks = allTracks; std::vector> allVertices; - std::vector allVerticesPtr; int iteration = 0; @@ -91,7 +86,11 @@ Acts::Result> AdaptiveMultiVertexFinder::find( "Could not prepare for fit. Discarding the vertex candindate."); allVertices.pop_back(); allVerticesPtr.pop_back(); - break; + if (m_cfg.doNotBreakWhileSeeding) { + continue; + } else { + break; + } } // Update fitter state with all vertices fitterState.addVertexToMultiMap(vtxCandidate); @@ -201,7 +200,7 @@ void AdaptiveMultiVertexFinder::setConstraintAfterSeeding( } } -Acts::Result AdaptiveMultiVertexFinder::getIPSignificance( +Result AdaptiveMultiVertexFinder::getIPSignificance( const InputTrack& track, const Vertex& vtx, const VertexingOptions& vertexingOptions) const { // TODO: In original implementation the covariance of the given vertex is set @@ -240,7 +239,7 @@ Acts::Result AdaptiveMultiVertexFinder::getIPSignificance( return significance; } -Acts::Result AdaptiveMultiVertexFinder::addCompatibleTracksToVertex( +Result AdaptiveMultiVertexFinder::addCompatibleTracksToVertex( const std::vector& tracks, Vertex& vtx, VertexFitterState& fitterState, const VertexingOptions& vertexingOptions) const { @@ -269,7 +268,7 @@ Acts::Result AdaptiveMultiVertexFinder::addCompatibleTracksToVertex( return {}; } -Acts::Result AdaptiveMultiVertexFinder::canRecoverFromNoCompatibleTracks( +Result AdaptiveMultiVertexFinder::canRecoverFromNoCompatibleTracks( const std::vector& allTracks, const std::vector& seedTracks, Vertex& vtx, const Vertex& currentConstraint, VertexFitterState& fitterState, @@ -323,7 +322,7 @@ Acts::Result AdaptiveMultiVertexFinder::canRecoverFromNoCompatibleTracks( return Result::success(true); } -Acts::Result AdaptiveMultiVertexFinder::canPrepareVertexForFit( +Result AdaptiveMultiVertexFinder::canPrepareVertexForFit( const std::vector& allTracks, const std::vector& seedTracks, Vertex& vtx, const Vertex& currentConstraint, VertexFitterState& fitterState, @@ -577,7 +576,7 @@ Result AdaptiveMultiVertexFinder::isMergedVertex( return Result::success(false); } -Acts::Result AdaptiveMultiVertexFinder::deleteLastVertex( +Result AdaptiveMultiVertexFinder::deleteLastVertex( Vertex& vtx, std::vector>& allVertices, std::vector& allVerticesPtr, VertexFitterState& fitterState, const VertexingOptions& vertexingOptions) const { @@ -616,8 +615,7 @@ Acts::Result AdaptiveMultiVertexFinder::deleteLastVertex( return {}; } -Acts::Result> -AdaptiveMultiVertexFinder::getVertexOutputList( +Result> AdaptiveMultiVertexFinder::getVertexOutputList( const std::vector& allVerticesPtr, VertexFitterState& fitterState) const { std::vector outputVec; diff --git a/Examples/Algorithms/Vertexing/CMakeLists.txt b/Examples/Algorithms/Vertexing/CMakeLists.txt index f35ce7f559d..b982e10bc26 100644 --- a/Examples/Algorithms/Vertexing/CMakeLists.txt +++ b/Examples/Algorithms/Vertexing/CMakeLists.txt @@ -4,6 +4,7 @@ add_library( src/IterativeVertexFinderAlgorithm.cpp src/VertexFitterAlgorithm.cpp src/SingleSeedVertexFinderAlgorithm.cpp + src/TruthVertexSeeder.cpp ) target_include_directories( ActsExamplesVertexing diff --git a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/AdaptiveMultiVertexFinderAlgorithm.hpp b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/AdaptiveMultiVertexFinderAlgorithm.hpp index 3c615cbb8ab..735edcd1b0c 100644 --- a/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/AdaptiveMultiVertexFinderAlgorithm.hpp +++ b/Examples/Algorithms/Vertexing/include/ActsExamples/Vertexing/AdaptiveMultiVertexFinderAlgorithm.hpp @@ -22,10 +22,13 @@ #include "Acts/Vertexing/AdaptiveMultiVertexFitter.hpp" #include "Acts/Vertexing/GaussianTrackDensity.hpp" #include "Acts/Vertexing/HelicalTrackLinearizer.hpp" +#include "Acts/Vertexing/IVertexFinder.hpp" #include "Acts/Vertexing/ImpactPointEstimator.hpp" #include "Acts/Vertexing/TrackDensityVertexFinder.hpp" #include "Acts/Vertexing/Vertex.hpp" #include "ActsExamples/EventData/ProtoVertex.hpp" +#include "ActsExamples/EventData/SimParticle.hpp" +#include "ActsExamples/EventData/SimVertex.hpp" #include "ActsExamples/EventData/Track.hpp" #include "ActsExamples/EventData/Trajectories.hpp" #include "ActsExamples/Framework/DataHandle.hpp" @@ -58,11 +61,16 @@ class AdaptiveMultiVertexFinderAlgorithm final : public IAlgorithm { using VertexCollection = std::vector; - enum class SeedFinder { GaussianSeeder, AdaptiveGridSeeder }; + enum class SeedFinder { TruthSeeder, GaussianSeeder, AdaptiveGridSeeder }; struct Config { /// Input track parameters collection std::string inputTrackParameters; + /// Optional + std::string inputTruthParticles; + /// Optional: Input truth vertex collection. This will only be used if + /// `seedFinder == SeedFinder::TruthSeeder`. + std::string inputTruthVertices; /// Output proto vertex collection std::string outputProtoVertices; /// Output vertex collection @@ -117,21 +125,26 @@ class AdaptiveMultiVertexFinderAlgorithm final : public IAlgorithm { const Config& config() const { return m_cfg; } private: - Acts::AdaptiveMultiVertexFinder makeVertexFinder() const; + std::unique_ptr makeVertexSeeder() const; + Acts::AdaptiveMultiVertexFinder makeVertexFinder( + std::shared_ptr seedFinder) const; Config m_cfg; std::shared_ptr m_propagator; Acts::ImpactPointEstimator m_ipEstimator; Linearizer m_linearizer; + std::shared_ptr m_vertexSeeder; Acts::AdaptiveMultiVertexFinder m_vertexFinder; ReadDataHandle m_inputTrackParameters{ this, "InputTrackParameters"}; - + ReadDataHandle m_inputTruthParticles{ + this, "InputTruthParticles"}; + ReadDataHandle m_inputTruthVertices{this, + "InputTruthVertices"}; WriteDataHandle m_outputProtoVertices{ this, "OutputProtoVertices"}; - WriteDataHandle m_outputVertices{this, "OutputVertices"}; }; diff --git a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp index a3c83abcf98..ec933e739f1 100644 --- a/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp +++ b/Examples/Algorithms/Vertexing/src/AdaptiveMultiVertexFinderAlgorithm.cpp @@ -25,15 +25,21 @@ #include "Acts/Vertexing/Vertex.hpp" #include "Acts/Vertexing/VertexingOptions.hpp" #include "ActsExamples/EventData/ProtoVertex.hpp" +#include "ActsExamples/EventData/SimParticle.hpp" +#include "ActsExamples/EventData/SimVertex.hpp" #include "ActsExamples/Framework/AlgorithmContext.hpp" #include "ActsExamples/Framework/ProcessCode.hpp" +#include "ActsExamples/TruthTracking/TruthVertexFinder.hpp" #include #include #include #include #include +#include +#include +#include "TruthVertexSeeder.hpp" #include "VertexingHelpers.hpp" namespace ActsExamples { @@ -64,7 +70,8 @@ AdaptiveMultiVertexFinderAlgorithm::AdaptiveMultiVertexFinderAlgorithm( return Linearizer(ltConfig, logger().cloneWithSuffix("HelicalTrackLinearizer")); }()}, - m_vertexFinder{makeVertexFinder()} { + m_vertexSeeder{makeVertexSeeder()}, + m_vertexFinder{makeVertexFinder(m_vertexSeeder)} { if (m_cfg.inputTrackParameters.empty()) { throw std::invalid_argument("Missing input track parameter collection"); } @@ -74,22 +81,46 @@ AdaptiveMultiVertexFinderAlgorithm::AdaptiveMultiVertexFinderAlgorithm( if (m_cfg.outputVertices.empty()) { throw std::invalid_argument("Missing output vertices collection"); } + if (m_cfg.seedFinder == SeedFinder::TruthSeeder && + m_cfg.inputTruthVertices.empty()) { + throw std::invalid_argument("Missing input truth vertex collection"); + } + + // Sanitize the configuration + if (m_cfg.seedFinder != SeedFinder::TruthSeeder && + (!m_cfg.inputTruthParticles.empty() || + !m_cfg.inputTruthVertices.empty())) { + ACTS_INFO("Ignoring truth input as seed finder is not TruthSeeder"); + m_cfg.inputTruthVertices.clear(); + m_cfg.inputTruthVertices.clear(); + } m_inputTrackParameters.initialize(m_cfg.inputTrackParameters); + m_inputTruthParticles.maybeInitialize(m_cfg.inputTruthParticles); + m_inputTruthVertices.maybeInitialize(m_cfg.inputTruthVertices); m_outputProtoVertices.initialize(m_cfg.outputProtoVertices); m_outputVertices.initialize(m_cfg.outputVertices); } -auto AdaptiveMultiVertexFinderAlgorithm::makeVertexFinder() const - -> Acts::AdaptiveMultiVertexFinder { - std::shared_ptr seedFinder; +std::unique_ptr +AdaptiveMultiVertexFinderAlgorithm::makeVertexSeeder() const { + if (m_cfg.seedFinder == SeedFinder::TruthSeeder) { + using Seeder = ActsExamples::TruthVertexSeeder; + Seeder::Config seederConfig; + seederConfig.useXY = false; + seederConfig.useTime = m_cfg.useTime; + return std::make_unique(seederConfig); + } + if (m_cfg.seedFinder == SeedFinder::GaussianSeeder) { using Seeder = Acts::TrackDensityVertexFinder; Acts::GaussianTrackDensity::Config trkDensityCfg; trkDensityCfg.extractParameters .connect<&Acts::InputTrack::extractParameters>(); - seedFinder = std::make_shared(Seeder::Config{trkDensityCfg}); - } else if (m_cfg.seedFinder == SeedFinder::AdaptiveGridSeeder) { + return std::make_unique(Seeder::Config{trkDensityCfg}); + } + + if (m_cfg.seedFinder == SeedFinder::AdaptiveGridSeeder) { // Set up track density used during vertex seeding Acts::AdaptiveGridTrackDensity::Config trkDensityCfg; // Bin extent in z-direction @@ -104,11 +135,15 @@ auto AdaptiveMultiVertexFinderAlgorithm::makeVertexFinder() const Seeder::Config seederConfig(trkDensity); seederConfig.extractParameters .connect<&Acts::InputTrack::extractParameters>(); - seedFinder = std::make_shared(seederConfig); - } else { - throw std::invalid_argument("Unknown seed finder"); + return std::make_unique(seederConfig); } + throw std::invalid_argument("Unknown seed finder"); +} + +Acts::AdaptiveMultiVertexFinder +AdaptiveMultiVertexFinderAlgorithm::makeVertexFinder( + std::shared_ptr seedFinder) const { // Set up deterministic annealing with user-defined temperatures Acts::AnnealingUtility annealingUtility(m_cfg.annealingConfig); @@ -124,7 +159,7 @@ auto AdaptiveMultiVertexFinderAlgorithm::makeVertexFinder() const logger().cloneWithSuffix("AdaptiveMultiVertexFitter")); Acts::AdaptiveMultiVertexFinder::Config finderConfig( - std::move(fitter), seedFinder, m_ipEstimator, m_cfg.bField); + std::move(fitter), std::move(seedFinder), m_ipEstimator, m_cfg.bField); // Set the initial variance of the 4D vertex position. Since time is on a // numerical scale, we have to provide a greater value in the corresponding // dimension. @@ -149,9 +184,14 @@ auto AdaptiveMultiVertexFinderAlgorithm::makeVertexFinder() const // 5 corresponds to a p-value of ~0.92 using `chi2(x=5,ndf=2)` finderConfig.maxMergeVertexSignificance = 5; } + finderConfig.extractParameters .template connect<&Acts::InputTrack::extractParameters>(); + if (m_cfg.seedFinder == SeedFinder::TruthSeeder) { + finderConfig.doNotBreakWhileSeeding = true; + } + finderConfig.tracksMaxSignificance = m_cfg.tracksMaxSignificance.value_or(finderConfig.tracksMaxSignificance); finderConfig.maxMergeVertexSignificance = @@ -165,10 +205,8 @@ auto AdaptiveMultiVertexFinderAlgorithm::makeVertexFinder() const ProcessCode AdaptiveMultiVertexFinderAlgorithm::execute( const AlgorithmContext& ctx) const { - // retrieve input tracks and convert into the expected format - const auto& inputTrackParameters = m_inputTrackParameters(ctx); - // TODO change this from pointers to tracks parameters to actual tracks + auto inputTracks = makeInputTracks(inputTrackParameters); if (inputTrackParameters.size() != inputTracks.size()) { @@ -185,13 +223,50 @@ ProcessCode AdaptiveMultiVertexFinderAlgorithm::execute( } } - ////////////////////////////////////////////// - /* Full tutorial example code for reference */ - ////////////////////////////////////////////// - // The vertex finder state auto state = m_vertexFinder.makeState(ctx.magFieldContext); + // In case of the truth seeder, we need to wire the truth vertices into the + // vertex finder + if (m_cfg.seedFinder == SeedFinder::TruthSeeder) { + const auto& truthParticles = m_inputTruthParticles(ctx); + const auto& truthVertices = m_inputTruthVertices(ctx); + + auto& vertexSeederState = + state.as() + .seedFinderState.as(); + + std::map vertexParticleCount; + + for (const auto& truthVertex : truthVertices) { + // Skip secondary vertices + if (truthVertex.vertexId().vertexSecondary() != 0) { + continue; + } + vertexSeederState.truthVertices.push_back(truthVertex); + + // Count the number of particles associated with each vertex + std::size_t particleCount = 0; + for (const auto& particle : truthParticles) { + if (particle.particleId().vertexId() == truthVertex.vertexId()) { + ++particleCount; + } + } + vertexParticleCount[truthVertex.vertexId()] = particleCount; + } + + // sort by number of particles + std::sort(vertexSeederState.truthVertices.begin(), + vertexSeederState.truthVertices.end(), + [&vertexParticleCount](const auto& lhs, const auto& rhs) { + return vertexParticleCount[lhs.vertexId()] > + vertexParticleCount[rhs.vertexId()]; + }); + + ACTS_INFO("Got " << truthVertices.size() << " truth vertices and selected " + << vertexSeederState.truthVertices.size() << " in event"); + } + // Default vertexing options, this is where e.g. a constraint could be set Options finderOpts(ctx.geoContext, ctx.magFieldContext); diff --git a/Examples/Algorithms/Vertexing/src/TruthVertexSeeder.cpp b/Examples/Algorithms/Vertexing/src/TruthVertexSeeder.cpp new file mode 100644 index 00000000000..89a3ba90d91 --- /dev/null +++ b/Examples/Algorithms/Vertexing/src/TruthVertexSeeder.cpp @@ -0,0 +1,57 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2024 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 "TruthVertexSeeder.hpp" + +#include "VertexingHelpers.hpp" + +namespace ActsExamples { + +TruthVertexSeeder::TruthVertexSeeder(const Config &cfg) : m_cfg(cfg) {} + +Acts::Result> TruthVertexSeeder::find( + const std::vector & /*trackVector*/, + const Acts::VertexingOptions &vertexingOptions, + Acts::IVertexFinder::State &anyState) const { + auto &state = anyState.template as(); + + if (state.nextVertexIndex >= state.truthVertices.size()) { + return std::vector(); + } + + const auto &truthVertex = state.truthVertices[state.nextVertexIndex]; + ++state.nextVertexIndex; + + Acts::Vertex converted; + converted.fullPosition().z() = truthVertex.position().z(); + if (m_cfg.useXY) { + converted.fullPosition().x() = truthVertex.position().x(); + converted.fullPosition().y() = truthVertex.position().y(); + } + if (m_cfg.useTime) { + converted.setTime(truthVertex.time()); + } + + Acts::SquareMatrix4 seedCov = vertexingOptions.constraint.fullCovariance(); + converted.setFullCovariance(seedCov); + + return std::vector{converted}; +} + +Acts::IVertexFinder::State TruthVertexSeeder::makeState( + const Acts::MagneticFieldContext & /*mctx*/) const { + return Acts::IVertexFinder::State{State{}}; +} + +void TruthVertexSeeder::setTracksToRemove( + Acts::IVertexFinder::State & /*anyState*/, + const std::vector & /*removedTracks*/) const { + // nothing to do +} + +} // namespace ActsExamples diff --git a/Examples/Algorithms/Vertexing/src/TruthVertexSeeder.hpp b/Examples/Algorithms/Vertexing/src/TruthVertexSeeder.hpp new file mode 100644 index 00000000000..27a27425c4b --- /dev/null +++ b/Examples/Algorithms/Vertexing/src/TruthVertexSeeder.hpp @@ -0,0 +1,51 @@ +// This file is part of the Acts project. +// +// Copyright (C) 2024 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/. + +#pragma once + +#include "Acts/MagneticField/MagneticFieldContext.hpp" +#include "Acts/Vertexing/IVertexFinder.hpp" +#include "Acts/Vertexing/TrackAtVertex.hpp" +#include "Acts/Vertexing/Vertex.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" +#include "ActsExamples/EventData/SimVertex.hpp" + +namespace ActsExamples { + +class TruthVertexSeeder final : public Acts::IVertexFinder { + public: + struct Config { + bool useXY = false; + bool useTime = false; + }; + + struct State { + std::vector truthVertices; + + std::size_t nextVertexIndex = 0; + }; + + explicit TruthVertexSeeder(const Config& cfg); + + Acts::Result> find( + const std::vector& trackVector, + const Acts::VertexingOptions& vertexingOptions, + IVertexFinder::State& state) const final; + + IVertexFinder::State makeState( + const Acts::MagneticFieldContext& mctx) const final; + + void setTracksToRemove( + IVertexFinder::State& anyState, + const std::vector& removedTracks) const final; + + private: + Config m_cfg; +}; + +} // namespace ActsExamples diff --git a/Examples/Python/python/acts/examples/reconstruction.py b/Examples/Python/python/acts/examples/reconstruction.py index 039e3a6c8a5..cff5eea0cff 100644 --- a/Examples/Python/python/acts/examples/reconstruction.py +++ b/Examples/Python/python/acts/examples/reconstruction.py @@ -478,7 +478,7 @@ def addTruthSmearedSeeding( selectedParticles: str, particleSmearingSigmas: ParticleSmearingSigmas, initialSigmas: Optional[List[float]], - initialVarInflation: List[float], + initialVarInflation: Optional[List[float]], particleHypothesis: Optional[acts.ParticleHypothesis], logLevel: acts.logging.Level = None, ): @@ -1951,7 +1951,7 @@ def addVertexFitting( tracks = tracks if tracks is not None else "" inputParticles = "particles_input" selectedParticles = "particles_selected" - inputVertices = "vertices_input" + inputTruthVertices = "vertices_input" if vertexFinder == VertexFinder.Truth: findVertices = TruthVertexFinder( @@ -1984,6 +1984,8 @@ def addVertexFitting( findVertices = AdaptiveMultiVertexFinderAlgorithm( level=customLogLevel(), inputTrackParameters=trackParameters, + inputTruthParticles=selectedParticles, + inputTruthVertices=inputTruthVertices, outputProtoVertices=outputProtoVertices, outputVertices=outputVertices, bField=field, @@ -2009,7 +2011,7 @@ def addVertexFitting( level=customLogLevel(), inputVertices=outputVertices, inputTracks=tracks, - inputTruthVertices=inputVertices, + inputTruthVertices=inputTruthVertices, inputParticles=inputParticles, inputSelectedParticles=selectedParticles, inputTrackParticleMatching="track_particle_matching", diff --git a/Examples/Python/src/Vertexing.cpp b/Examples/Python/src/Vertexing.cpp index 1ac36d8833c..44f2ebb8433 100644 --- a/Examples/Python/src/Vertexing.cpp +++ b/Examples/Python/src/Vertexing.cpp @@ -32,16 +32,18 @@ void addVertexing(Context& ctx) { auto& m = ctx.get("main"); py::enum_(m, "VertexSeedFinder") + .value("TruthSeeder", Seeder::TruthSeeder) .value("GaussianSeeder", Seeder::GaussianSeeder) .value("AdaptiveGridSeeder", Seeder::AdaptiveGridSeeder); ACTS_PYTHON_DECLARE_ALGORITHM( ActsExamples::AdaptiveMultiVertexFinderAlgorithm, mex, "AdaptiveMultiVertexFinderAlgorithm", inputTrackParameters, - outputProtoVertices, outputVertices, seedFinder, bField, minWeight, - doSmoothing, maxIterations, useTime, tracksMaxZinterval, initialVariances, - doFullSplitting, tracksMaxSignificance, maxMergeVertexSignificance, - spatialBinExtent, temporalBinExtent); + inputTruthParticles, inputTruthVertices, outputProtoVertices, + outputVertices, seedFinder, bField, minWeight, doSmoothing, maxIterations, + useTime, tracksMaxZinterval, initialVariances, doFullSplitting, + tracksMaxSignificance, maxMergeVertexSignificance, spatialBinExtent, + temporalBinExtent); ACTS_PYTHON_DECLARE_ALGORITHM(ActsExamples::IterativeVertexFinderAlgorithm, mex, "IterativeVertexFinderAlgorithm",