File indexing completed on 2025-01-18 09:27:42
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Geometry/TrackingVolume.hpp"
0012 #include "Acts/Material/IMaterialDecorator.hpp"
0013 #include "Acts/Material/ISurfaceMaterial.hpp"
0014 #include "Acts/Material/IVolumeMaterial.hpp"
0015 #include "Acts/Plugins/Json/MaterialMapJsonConverter.hpp"
0016 #include "Acts/Surfaces/Surface.hpp"
0017
0018 #include <fstream>
0019 #include <map>
0020 #include <mutex>
0021
0022
0023
0024 namespace Acts {
0025
0026
0027
0028
0029
0030 class JsonMaterialDecorator : public IMaterialDecorator {
0031 public:
0032 using SurfaceMaterialMap =
0033 std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;
0034
0035 using VolumeMaterialMap =
0036 std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;
0037
0038 JsonMaterialDecorator(const MaterialMapJsonConverter::Config& rConfig,
0039 const std::string& jFileName,
0040 Acts::Logging::Level level,
0041 bool clearSurfaceMaterial = true,
0042 bool clearVolumeMaterial = true);
0043
0044
0045
0046
0047 void decorate(Surface& surface) const final;
0048
0049
0050
0051
0052 void decorate(TrackingVolume& volume) const final;
0053
0054 private:
0055 MaterialMapJsonConverter::Config m_readerConfig;
0056 SurfaceMaterialMap m_surfaceMaterialMap;
0057 VolumeMaterialMap m_volumeMaterialMap;
0058
0059 bool m_clearSurfaceMaterial{true};
0060 bool m_clearVolumeMaterial{true};
0061
0062 std::unique_ptr<const Logger> m_logger;
0063
0064 const Logger& logger() const { return *m_logger; }
0065 };
0066 }