File indexing completed on 2026-03-31 07:46:08
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/Io/Obj/ObjTrackingGeometryWriter.hpp"
0010
0011 #include "Acts/Geometry/TrackingGeometry.hpp"
0012 #include "Acts/Utilities/Logger.hpp"
0013 #include "Acts/Visualization/GeometryView3D.hpp"
0014 #include "Acts/Visualization/ObjVisualization3D.hpp"
0015 #include "ActsExamples/Framework/AlgorithmContext.hpp"
0016
0017 #include <filesystem>
0018
0019 namespace ActsExamples {
0020
0021 ObjTrackingGeometryWriter::ObjTrackingGeometryWriter(
0022 const ObjTrackingGeometryWriter::Config& config, Acts::Logging::Level level)
0023 : m_logger{Acts::getDefaultLogger(name(), level)}, m_cfg(config) {}
0024
0025 std::string ObjTrackingGeometryWriter::name() const {
0026 return "ObjTrackingGeometryWriter";
0027 }
0028
0029 ProcessCode ObjTrackingGeometryWriter::write(
0030 const AlgorithmContext& context, const Acts::TrackingGeometry& tGeometry) {
0031 ACTS_DEBUG(">>Obj: Writer for TrackingGeometry object called.");
0032
0033 auto world = tGeometry.highestTrackingVolume();
0034 if (world != nullptr) {
0035 write(context, *world,
0036 tGeometry.geometryVersion() ==
0037 Acts::TrackingGeometry::GeometryVersion::Gen3);
0038 }
0039 return ProcessCode::SUCCESS;
0040 }
0041
0042 void ObjTrackingGeometryWriter::write(const AlgorithmContext& context,
0043 const Acts::TrackingVolume& tVolume,
0044 bool gen3) {
0045 ACTS_DEBUG(">>Obj: Writer for TrackingVolume object called.");
0046
0047 Acts::ObjVisualization3D objVis(m_cfg.outputPrecision, m_cfg.outputScalor);
0048
0049 if (gen3) {
0050 ACTS_VERBOSE(">>Obj: Gen3 geometry detected, using Gen3 visualization");
0051 tVolume.visualize(objVis, context.geoContext, m_cfg.volumeView,
0052 m_cfg.portalView, m_cfg.sensitiveView);
0053 objVis.write(m_cfg.outputDir / "geometry");
0054 } else {
0055 ACTS_VERBOSE(">>Obj: Gen1 geometry detected, using Gen1 visualization");
0056 Acts::GeometryView3D::drawTrackingVolume(
0057 objVis, tVolume, context.geoContext, m_cfg.containerView,
0058 m_cfg.volumeView, m_cfg.passiveView, m_cfg.sensitiveView,
0059 m_cfg.gridView, true, "", std::filesystem::path(m_cfg.outputDir));
0060 }
0061 }
0062
0063 }