File indexing completed on 2026-09-26 08:03:38
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 "Acts/Visualization/ViewConfig.hpp"
0016 #include "ActsExamples/Framework/AlgorithmContext.hpp"
0017
0018 #include <filesystem>
0019
0020 namespace ActsExamples {
0021
0022 ObjTrackingGeometryWriter::ObjTrackingGeometryWriter(
0023 const ObjTrackingGeometryWriter::Config& config, Acts::Logging::Level level)
0024 : m_logger{Acts::getDefaultLogger(name(), level)}, m_cfg(config) {}
0025
0026 std::string ObjTrackingGeometryWriter::name() const {
0027 return "ObjTrackingGeometryWriter";
0028 }
0029
0030 ProcessCode ObjTrackingGeometryWriter::write(
0031 const AlgorithmContext& context, const Acts::TrackingGeometry& tGeometry) {
0032 ACTS_DEBUG(">>Obj: Writer for TrackingGeometry object called.");
0033
0034 auto world = tGeometry.highestTrackingVolume();
0035 if (world != nullptr) {
0036 write(context, *world,
0037 tGeometry.geometryVersion() ==
0038 Acts::TrackingGeometry::GeometryVersion::Gen3);
0039 }
0040 return ProcessCode::SUCCESS;
0041 }
0042
0043 void ObjTrackingGeometryWriter::write(const AlgorithmContext& context,
0044 const Acts::TrackingVolume& tVolume,
0045 bool gen3) {
0046 ACTS_DEBUG(">>Obj: Writer for TrackingVolume object called.");
0047
0048 Acts::ObjVisualization3D objVis(m_cfg.outputPrecision, m_cfg.outputScalor);
0049
0050 if (gen3) {
0051 ACTS_VERBOSE(">>Obj: Gen3 geometry detected, using Gen3 visualization");
0052 tVolume.visualize(objVis, context.recoGeoContext);
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.recoGeoContext, 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 }