Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:53

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 #pragma once
0010 
0011 #include "ActsExamples/Framework/AlgorithmContext.hpp"
0012 #include "ActsExamples/Framework/ProcessCode.hpp"
0013 #include <Acts/Utilities/Logger.hpp>
0014 #include <Acts/Visualization/ViewConfig.hpp>
0015 
0016 #include <cstddef>
0017 #include <fstream>
0018 #include <iostream>
0019 #include <memory>
0020 #include <mutex>
0021 #include <string>
0022 
0023 namespace Acts {
0024 class TrackingVolume;
0025 class TrackingGeometry;
0026 }  // namespace Acts
0027 
0028 namespace ActsExamples {
0029 struct AlgorithmContext;
0030 
0031 /// @class ObjTrackingGeometryWriter
0032 ///
0033 /// An Obj writer for the geometry: TrackingGeometry master
0034 /// It delegates the writing of surfaces to the surface writers
0035 class ObjTrackingGeometryWriter {
0036  public:
0037   // @class Config
0038   //
0039   // The nested config class
0040   class Config {
0041    public:
0042     double outputScalor = 1.0;        ///< scale output values
0043     std::size_t outputPrecision = 6;  ///< floating point precision
0044     std::string outputDir = ".";
0045 
0046     Acts::ViewConfig containerView = {.color = {220, 220, 220}};
0047     Acts::ViewConfig volumeView = {.color = {220, 220, 0}};
0048     Acts::ViewConfig sensitiveView = {.color = {0, 180, 240}};
0049     Acts::ViewConfig passiveView = {.color = {240, 280, 0}};
0050     Acts::ViewConfig gridView = {.color = {220, 0, 0}};
0051   };
0052 
0053   /// Constructor
0054   /// @param config is the configuration class
0055   /// @param level the log level
0056   ObjTrackingGeometryWriter(const Config& config, Acts::Logging::Level level);
0057 
0058   /// Framework name() method
0059   /// @return the name of the tool
0060   std::string name() const;
0061 
0062   /// The write interface
0063   /// @param context the Algorithm/Event context of this call
0064   /// @param tGeometry is the geometry to be written out
0065   /// @return ProcessCode to indicate success/failure
0066   ActsExamples::ProcessCode write(const AlgorithmContext& context,
0067                                   const Acts::TrackingGeometry& tGeometry);
0068 
0069  private:
0070   std::unique_ptr<const Acts::Logger> m_logger;  ///< the logger instance
0071 
0072   Config m_cfg;  ///< the config class
0073 
0074   /// process this volume
0075   /// @param context the Algorithm/Event context for this call
0076   /// @param tVolume the volume to be processed
0077   void write(const AlgorithmContext& context,
0078              const Acts::TrackingVolume& tVolume);
0079 
0080   /// Private access to the logging instance
0081   const Acts::Logger& logger() const { return *m_logger; }
0082 };
0083 
0084 }  // namespace ActsExamples