ECCE @ EIC 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 
10 // RootMaterialWriter.h
12 
13 #pragma once
14 
24 #include <map>
25 #include <mutex>
26 
28 
29 namespace Acts {
30 using SurfaceMaterialMap =
31  std::map<GeometryID, std::shared_ptr<const ISurfaceMaterial>>;
32 using VolumeMaterialMap =
33  std::map<GeometryID, std::shared_ptr<const IVolumeMaterial>>;
34 using DetectorMaterialMaps = std::pair<SurfaceMaterialMap, VolumeMaterialMap>;
35 } // namespace Acts
36 
37 namespace FW {
38 
44  public:
48  struct Config {
50  bool processSensitives = true;
51 
53  bool processApproaches = true;
54 
56  bool processRepresenting = true;
57 
59  bool processBoundaries = true;
60 
62  bool processVolumes = true;
63 
65  std::string folderNameBase = "Material";
67  std::string voltag = "_vol";
69  std::string boutag = "_bou";
71  std::string laytag = "_lay";
73  std::string apptag = "_app";
75  std::string sentag = "_sen";
77  std::string ntag = "n";
79  std::string vtag = "v";
81  std::string otag = "o";
83  std::string mintag = "min";
85  std::string maxtag = "max";
87  std::string ttag = "t";
89  std::string x0tag = "x0";
91  std::string l0tag = "l0";
93  std::string atag = "A";
95  std::string ztag = "Z";
97  std::string rhotag = "rho";
99  std::string fileName = "material-maps.root";
101  std::shared_ptr<const Acts::Logger> logger;
102  // The name of the writer
103  std::string name = "";
104 
109  Config(const std::string& lname = "RootMaterialWriter",
111  : logger(Acts::getDefaultLogger(lname, lvl)), name(lname) {}
112  };
113 
117  RootMaterialWriter(const Config& cfg);
118 
120  ~RootMaterialWriter() = default;
121 
125  void write(const Acts::DetectorMaterialMaps& detMaterial);
126 
131 
132  private:
137  void collectMaterial(const Acts::TrackingVolume& tVolume,
138  Acts::DetectorMaterialMaps& detMatMap);
139 
144  void collectMaterial(const Acts::Layer& tLayer,
145  Acts::DetectorMaterialMaps& detMatMap);
146 
149 
151  const Acts::Logger& logger() const { return *m_cfg.logger; }
152 };
153 
154 } // namespace FW