Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MaterialMapping.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MaterialMapping.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 <climits>
24 #include <cstddef>
25 #include <cstdint>
26 #include <functional>
27 #include <map>
28 #include <memory>
29 #include <mutex>
30 #include <string>
31 #include <unordered_map>
32 #include <utility>
33 #include <vector>
34 
35 namespace ActsExamples {
36 class IMaterialWriter;
37 struct AlgorithmContext;
38 } // namespace ActsExamples
39 
40 namespace Acts {
41 
42 class TrackingGeometry;
43 class ISurfaceMaterial;
44 class IVolumeMaterial;
45 
46 using SurfaceMaterialMap =
47  std::map<GeometryIdentifier, std::shared_ptr<const ISurfaceMaterial>>;
48 
49 using VolumeMaterialMap =
50  std::map<GeometryIdentifier, std::shared_ptr<const IVolumeMaterial>>;
51 
52 using DetectorMaterialMaps = std::pair<SurfaceMaterialMap, VolumeMaterialMap>;
53 } // namespace Acts
54 
55 namespace ActsExamples {
56 
72 class MaterialMapping : public IAlgorithm {
73  public:
76  struct Config {
77  // Geometry context for the state creation
78  std::reference_wrapper<const Acts::GeometryContext> geoContext;
79 
80  // MagneticField context for the state creation
81  std::reference_wrapper<const Acts::MagneticFieldContext> magFieldContext;
82 
84  std::string collection = "material_tracks";
85 
87  std::string mappingMaterialCollection = "mapped_material_tracks";
88 
90  std::shared_ptr<Acts::SurfaceMaterialMapper> materialSurfaceMapper =
91  nullptr;
92 
94  std::shared_ptr<Acts::VolumeMaterialMapper> materialVolumeMapper = nullptr;
95 
97  std::vector<std::shared_ptr<IMaterialWriter>> materialWriters{};
98 
100  std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry = nullptr;
101  };
102 
107  MaterialMapping(const Config& cfg,
109 
112  ~MaterialMapping() override;
113 
118  const AlgorithmContext& context) const override;
119 
124  std::vector<std::pair<double, int>> scoringParameters(uint64_t surfaceID);
125 
127  const Config& config() const { return m_cfg; }
128 
129  private:
135  //
136 
138  m_inputMaterialTracks{this, "InputMaterialTracks"};
140  m_outputMaterialTracks{this, "OutputMaterialTracks"};
141 };
142 
143 } // namespace ActsExamples