Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-22 07:52:27

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "TruthVertexSeeder.hpp"
0010 
0011 namespace ActsExamples {
0012 
0013 TruthVertexSeeder::TruthVertexSeeder(const Config &cfg) : m_cfg(cfg) {}
0014 
0015 Acts::Result<std::vector<Acts::Vertex>> TruthVertexSeeder::find(
0016     const std::vector<Acts::InputTrack> & /*trackVector*/,
0017     const Acts::VertexingOptions &vertexingOptions,
0018     Acts::IVertexFinder::State &anyState) const {
0019   auto &state = anyState.template as<State>();
0020 
0021   if (state.nextVertexIndex >= state.truthVertices.size()) {
0022     return std::vector<Acts::Vertex>();
0023   }
0024 
0025   std::vector<Acts::Vertex> seeds;
0026   for (std::size_t i = 0; i < m_cfg.simultaneousSeeds; ++i) {
0027     if (state.nextVertexIndex >= state.truthVertices.size()) {
0028       break;
0029     }
0030 
0031     const auto &truthVertex = state.truthVertices[state.nextVertexIndex];
0032     ++state.nextVertexIndex;
0033 
0034     Acts::Vertex converted;
0035     converted.fullPosition().z() = truthVertex.position().z();
0036     if (m_cfg.useXY) {
0037       converted.fullPosition().x() = truthVertex.position().x();
0038       converted.fullPosition().y() = truthVertex.position().y();
0039     }
0040     if (m_cfg.useTime) {
0041       converted.setTime(truthVertex.time());
0042     }
0043 
0044     Acts::SquareMatrix4 seedCov = vertexingOptions.constraint.fullCovariance();
0045     converted.setFullCovariance(seedCov);
0046 
0047     seeds.push_back(converted);
0048   }
0049 
0050   return seeds;
0051 }
0052 
0053 Acts::IVertexFinder::State TruthVertexSeeder::makeState(
0054     const Acts::MagneticFieldContext & /*mctx*/) const {
0055   return Acts::IVertexFinder::State{State{}};
0056 }
0057 
0058 void TruthVertexSeeder::setTracksToRemove(
0059     Acts::IVertexFinder::State & /*anyState*/,
0060     const std::vector<Acts::InputTrack> & /*removedTracks*/) const {
0061   // nothing to do
0062 }
0063 
0064 }  // namespace ActsExamples