Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:00

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/Svg/SvgTrackingGeometryWriter.hpp"
0010 
0011 #include "ActsExamples/Utilities/Paths.hpp"
0012 #include <Acts/Geometry/Layer.hpp>
0013 #include <Acts/Geometry/TrackingGeometry.hpp>
0014 #include <Acts/Geometry/TrackingVolume.hpp>
0015 #include <Acts/Plugins/ActSVG/LayerSvgConverter.hpp>
0016 
0017 #include <iostream>
0018 #include <string>
0019 
0020 ActsExamples::SvgTrackingGeometryWriter::SvgTrackingGeometryWriter(
0021     const ActsExamples::SvgTrackingGeometryWriter::Config& config,
0022     Acts::Logging::Level level)
0023     : m_logger{Acts::getDefaultLogger(name(), level)}, m_cfg(config) {}
0024 
0025 std::string ActsExamples::SvgTrackingGeometryWriter::name() const {
0026   return "SvgTrackingGeometryWriter";
0027 }
0028 
0029 ActsExamples::ProcessCode ActsExamples::SvgTrackingGeometryWriter::write(
0030     const AlgorithmContext& context, const Acts::TrackingGeometry& tGeometry) {
0031   ACTS_DEBUG(">>Svg: Writer for TrackingGeometry object called.");
0032 
0033   m_writeMutex.lock();
0034 
0035   auto geometrySheets = Acts::Svg::TrackingGeometryConverter::convert(
0036       context.geoContext, tGeometry, m_cfg.converterOptions);
0037 
0038   // Write them out
0039   for (const auto& sheet : geometrySheets) {
0040     Acts::Svg::toFile({sheet}, joinPaths(m_cfg.outputDir, sheet._id + ".svg"));
0041   }
0042   // Successfully done
0043   return ActsExamples::ProcessCode::SUCCESS;
0044 }