Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:43

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 #include "VertexingHelpers.hpp"
0012 
0013 namespace ActsExamples {
0014 
0015 TruthVertexSeeder::TruthVertexSeeder(const Config &cfg) : m_cfg(cfg) {}
0016 
0017 Acts::Result<std::vector<Acts::Vertex>> TruthVertexSeeder::find(
0018     const std::vector<Acts::InputTrack> & /*trackVector*/,
0019     const Acts::VertexingOptions &vertexingOptions,
0020     Acts::IVertexFinder::State &anyState) const {
0021   auto &state = anyState.template as<State>();
0022 
0023   if (state.nextVertexIndex >= state.truthVertices.size()) {
0024     return std::vector<Acts::Vertex>();
0025   }
0026 
0027   const auto &truthVertex = state.truthVertices[state.nextVertexIndex];
0028   ++state.nextVertexIndex;
0029 
0030   Acts::Vertex converted;
0031   converted.fullPosition().z() = truthVertex.position().z();
0032   if (m_cfg.useXY) {
0033     converted.fullPosition().x() = truthVertex.position().x();
0034     converted.fullPosition().y() = truthVertex.position().y();
0035   }
0036   if (m_cfg.useTime) {
0037     converted.setTime(truthVertex.time());
0038   }
0039 
0040   Acts::SquareMatrix4 seedCov = vertexingOptions.constraint.fullCovariance();
0041   converted.setFullCovariance(seedCov);
0042 
0043   return std::vector<Acts::Vertex>{converted};
0044 }
0045 
0046 Acts::IVertexFinder::State TruthVertexSeeder::makeState(
0047     const Acts::MagneticFieldContext & /*mctx*/) const {
0048   return Acts::IVertexFinder::State{State{}};
0049 }
0050 
0051 void TruthVertexSeeder::setTracksToRemove(
0052     Acts::IVertexFinder::State & /*anyState*/,
0053     const std::vector<Acts::InputTrack> & /*removedTracks*/) const {
0054   // nothing to do
0055 }
0056 
0057 }  // namespace ActsExamples