forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMaterial.cpp
More file actions
168 lines (144 loc) · 6.15 KB
/
Material.cpp
File metadata and controls
168 lines (144 loc) · 6.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// This file is part of the ACTS project.
//
// Copyright (C) 2016 CERN for the benefit of the ACTS project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Material/BinnedSurfaceMaterialAccumulator.hpp"
#include "Acts/Material/HomogeneousSurfaceMaterial.hpp"
#include "Acts/Material/IMaterialDecorator.hpp"
#include "Acts/Material/ISurfaceMaterial.hpp"
#include "Acts/Material/IVolumeMaterial.hpp"
#include "Acts/Material/IntersectionMaterialAssigner.hpp"
#include "Acts/Material/MaterialMapper.hpp"
#include "Acts/Material/MaterialValidator.hpp"
#include "Acts/Material/PropagatorMaterialAssigner.hpp"
#include "Acts/Material/ProtoSurfaceMaterial.hpp"
#include "Acts/Material/SurfaceMaterialMapper.hpp"
#include "Acts/Material/VolumeMaterialMapper.hpp"
#include "Acts/Utilities/Logger.hpp"
#include "ActsPython/Utilities/Helpers.hpp"
#include "ActsPython/Utilities/Macros.hpp"
#include <array>
#include <map>
#include <memory>
#include <tuple>
#include <utility>
#include <vector>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace Acts {
class TrackingGeometry;
} // namespace Acts
namespace py = pybind11;
using namespace pybind11::literals;
using namespace Acts;
namespace ActsPython {
/// @brief Add the material bindings to a module.
/// @param m the module to add the bindings to
void addMaterial(py::module_& m) {
{
py::class_<ISurfaceMaterial, std::shared_ptr<ISurfaceMaterial>>(
m, "ISurfaceMaterial")
.def("toString", &ISurfaceMaterial::toString);
py::class_<ProtoGridSurfaceMaterial, ISurfaceMaterial,
std::shared_ptr<ProtoGridSurfaceMaterial>>(
m, "ProtoGridSurfaceMaterial");
py::class_<ProtoSurfaceMaterial, ISurfaceMaterial,
std::shared_ptr<ProtoSurfaceMaterial>>(m,
"ProtoSurfaceMaterial");
py::class_<HomogeneousSurfaceMaterial, ISurfaceMaterial,
std::shared_ptr<HomogeneousSurfaceMaterial>>(
m, "HomogeneousSurfaceMaterial");
py::class_<IVolumeMaterial, std::shared_ptr<IVolumeMaterial>>(
m, "IVolumeMaterial");
}
{
py::class_<IMaterialDecorator, std::shared_ptr<IMaterialDecorator>>(
m, "IMaterialDecorator")
.def("decorate", py::overload_cast<Surface&>(
&IMaterialDecorator::decorate, py::const_));
}
{
py::class_<IAssignmentFinder, std::shared_ptr<IAssignmentFinder>>(
m, "IAssignmentFinder");
}
{
auto isma =
py::class_<IntersectionMaterialAssigner, IAssignmentFinder,
std::shared_ptr<IntersectionMaterialAssigner>>(
m, "IntersectionMaterialAssigner")
.def(py::init([](const IntersectionMaterialAssigner::Config& config,
Logging::Level level) {
return std::make_shared<IntersectionMaterialAssigner>(
config,
getDefaultLogger("IntersectionMaterialAssigner", level));
}),
py::arg("config"), py::arg("level"))
.def("assignmentCandidates",
&IntersectionMaterialAssigner::assignmentCandidates);
auto c = py::class_<IntersectionMaterialAssigner::Config>(isma, "Config")
.def(py::init<>());
ACTS_PYTHON_STRUCT(c, surfaces, trackingVolumes);
}
{
py::class_<ISurfaceMaterialAccumulator,
std::shared_ptr<ISurfaceMaterialAccumulator>>(
m, "ISurfaceMaterialAccumulator");
}
{
auto bsma =
py::class_<BinnedSurfaceMaterialAccumulator,
ISurfaceMaterialAccumulator,
std::shared_ptr<BinnedSurfaceMaterialAccumulator>>(
m, "BinnedSurfaceMaterialAccumulator")
.def(
py::init(
[](const BinnedSurfaceMaterialAccumulator::Config& config,
Logging::Level level) {
return std::make_shared<BinnedSurfaceMaterialAccumulator>(
config,
getDefaultLogger("BinnedSurfaceMaterialAccumulator",
level));
}),
py::arg("config"), py::arg("level"))
.def("createState", &BinnedSurfaceMaterialAccumulator::createState)
.def("accumulate", &BinnedSurfaceMaterialAccumulator::accumulate)
.def("finalizeMaterial",
&BinnedSurfaceMaterialAccumulator::finalizeMaterial);
auto c =
py::class_<BinnedSurfaceMaterialAccumulator::Config>(bsma, "Config")
.def(py::init<>());
ACTS_PYTHON_STRUCT(c, emptyBinCorrection, materialSurfaces);
}
{
auto mm = py::class_<MaterialMapper, std::shared_ptr<MaterialMapper>>(
m, "MaterialMapper")
.def(py::init([](const MaterialMapper::Config& config,
Logging::Level level) {
return std::make_shared<MaterialMapper>(
config, getDefaultLogger("MaterialMapper", level));
}),
py::arg("config"), py::arg("level"));
auto c = py::class_<MaterialMapper::Config>(mm, "Config").def(py::init<>());
ACTS_PYTHON_STRUCT(c, assignmentFinder, surfaceMaterialAccumulator);
}
{
auto mvc =
py::class_<MaterialValidator, std::shared_ptr<MaterialValidator>>(
m, "MaterialValidator")
.def(py::init([](const MaterialValidator::Config& config,
Logging::Level level) {
return std::make_shared<MaterialValidator>(
config, getDefaultLogger("MaterialValidator", level));
}),
py::arg("config"), py::arg("level"))
.def("recordMaterial", &MaterialValidator::recordMaterial);
auto c =
py::class_<MaterialValidator::Config>(mvc, "Config").def(py::init<>());
ACTS_PYTHON_STRUCT(c, materialAssigner);
}
}
} // namespace ActsPython