Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 08:21:20

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 "ActsExamples/Io/EDM4hep/EDM4hepTrackOutputConverter.hpp"
0010 
0011 #include "ActsPlugins/EDM4hep/EDM4hepUtil.hpp"
0012 
0013 #include <edm4hep/TrackCollection.h>
0014 #include <podio/Frame.h>
0015 
0016 namespace ActsExamples {
0017 
0018 EDM4hepTrackOutputConverter::EDM4hepTrackOutputConverter(
0019     const Config& config, std::unique_ptr<const Acts::Logger> logger)
0020     : PodioOutputConverter("EDM4hepTrackOutputConverter", std::move(logger)),
0021       m_cfg(config) {
0022   m_inputTracks.initialize(m_cfg.inputTracks);
0023   m_outputTracks.initialize(m_cfg.outputTracks);
0024 }
0025 
0026 ProcessCode EDM4hepTrackOutputConverter::execute(
0027     const AlgorithmContext& context) const {
0028   edm4hep::TrackCollection trackCollection;
0029 
0030   const auto& tracks = m_inputTracks(context);
0031 
0032   for (const auto& from : tracks) {
0033     auto to = trackCollection.create();
0034     ActsPlugins::EDM4hepUtil::writeTrack(context.recoGeoContext, from, to,
0035                                          m_cfg.Bz);
0036   }
0037 
0038   m_outputTracks(context, std::move(trackCollection));
0039 
0040   return ProcessCode::SUCCESS;
0041 }
0042 
0043 std::vector<std::string> EDM4hepTrackOutputConverter::collections() const {
0044   return {m_cfg.outputTracks};
0045 }
0046 
0047 }  // namespace ActsExamples