Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-05-15 07:57:14

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