Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RootMaterialWriter.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RootMaterialWriter.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
22 
23 #include <map>
24 #include <memory>
25 #include <mutex>
26 #include <string>
27 #include <utility>
28 
29 class TFile;
30 
31 namespace Acts {
32 class ISurfaceMaterial;
33 class IVolumeMaterial;
34 class Layer;
35 class TrackingGeometry;
36 class TrackingVolume;
37 
38 using SurfaceMaterialMap =
39  std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;
40 using VolumeMaterialMap =
41  std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;
42 using DetectorMaterialMaps = std::pair<SurfaceMaterialMap, VolumeMaterialMap>;
43 } // namespace Acts
44 
45 namespace ActsExamples {
46 
52  public:
56  struct Config {
58  bool processSensitives = true;
59 
61  bool processApproaches = true;
62 
64  bool processRepresenting = true;
65 
67  bool processBoundaries = true;
68 
70  bool processVolumes = true;
71 
73  std::string folderSurfaceNameBase = "SurfaceMaterial";
75  std::string folderVolumeNameBase = "VolumeMaterial";
77  std::string voltag = "_vol";
79  std::string boutag = "_bou";
81  std::string laytag = "_lay";
83  std::string apptag = "_app";
85  std::string sentag = "_sen";
109  std::string filePath = "material-maps.root";
111  std::string fileMode = "RECREATE";
112  };
113 
119 
121  ~RootMaterialWriter() override;
122 
126  void writeMaterial(const Acts::DetectorMaterialMaps& detMaterial) override;
127 
132 
134  const Config& config() const { return m_cfg; }
135 
136  private:
141  void collectMaterial(const Acts::TrackingVolume& tVolume,
142  Acts::DetectorMaterialMaps& detMatMap);
143 
148  void collectMaterial(const Acts::Layer& tLayer,
149  Acts::DetectorMaterialMaps& detMatMap);
150 
153 
155  std::unique_ptr<const Acts::Logger> m_logger;
156 
158  const Acts::Logger& logger() const { return *m_logger; }
159 
160  TFile* m_outputFile{nullptr};
161 };
162 
163 } // namespace ActsExamples