9 #include <boost/test/unit_test.hpp>
47 struct MaterialCollector {
54 template <
typename propagator_state_t,
typename stepper_t>
57 if (state.navigation.currentVolume !=
nullptr) {
58 auto position = stepper.position(state.stepping);
60 (state.navigation.currentVolume->volumeMaterial() !=
nullptr)
61 ? state.navigation.currentVolume->volumeMaterial()->material(
74 using namespace Acts::UnitLiterals;
89 CuboidVolumeBuilder::VolumeConfig vCfg1;
92 vCfg1.name =
"Vacuum volume";
93 vCfg1.volumeMaterial = std::make_shared<const ProtoVolumeMaterial>(bu1);
96 CuboidVolumeBuilder::VolumeConfig vCfg2;
99 vCfg2.name =
"First material volume";
100 vCfg2.volumeMaterial = std::make_shared<const ProtoVolumeMaterial>(bu2);
103 CuboidVolumeBuilder::VolumeConfig vCfg3;
106 vCfg3.name =
"Second material volume";
107 vCfg3.volumeMaterial = std::make_shared<const ProtoVolumeMaterial>(bu3);
113 cfg.volumeCfg = {vCfg1, vCfg2, vCfg3};
118 CuboidVolumeBuilder cvb(cfg);
120 tgbCfg.trackingVolumeBuilders.push_back(
121 [=](
const auto&
context,
const auto& inner,
const auto&) {
122 return cvb.trackingVolume(
context, inner,
nullptr);
124 TrackingGeometryBuilder tgb(tgbCfg);
125 std::shared_ptr<const TrackingGeometry>
tGeometry = tgb.trackingGeometry(gc);
136 vmmConfig, std::move(propagator),
144 auto mState = vmMapper.createState(gCtx, mfCtx, *
tGeometry);
147 BOOST_CHECK_EQUAL(mState.recordedMaterial.size(), 3
u);
153 using namespace Acts::UnitLiterals;
159 vCfg1.name =
"Vacuum volume";
160 vCfg1.volumeMaterial =
161 std::make_shared<const HomogeneousVolumeMaterial>(
Material());
167 vCfg2.name =
"First material volume";
168 vCfg2.volumeMaterial = std::make_shared<const HomogeneousVolumeMaterial>(
169 Material(95.7, 465.2, 28.03, 14., 2.32
e-3));
175 vCfg3.name =
"Second material volume";
176 vCfg3.volumeMaterial =
177 std::make_shared<const HomogeneousVolumeMaterial>(
Material());
183 cfg.volumeCfg = {vCfg1, vCfg2, vCfg3};
191 [=](
const auto&
context,
const auto& inner,
const auto&) {
198 std::array<double, 3> xAxis{0
_m, 3
_m, 7};
199 std::array<double, 3> yAxis{-0.5_m, 0.5_m, 7};
200 std::array<double, 3> zAxis{-0.5_m, 0.5_m, 7};
203 std::random_device rd;
204 std::mt19937 gen(42);
205 std::uniform_real_distribution<> disX(0., 3
_m);
206 std::uniform_real_distribution<> disYZ(-0.5
_m, 0.5
_m);
210 for (
unsigned int i = 0; i < 1
e4; i++) {
213 (
detector->lowestTrackingVolume(gc, pos)->volumeMaterial() !=
nullptr)
214 ? (
detector->lowestTrackingVolume(gc, pos)->volumeMaterial())
218 matRecord.push_back(std::make_pair(matProp, pos));
223 std::function<Vector3D(Vector3D)> transfoGlobalToLocal =
250 const auto& result = prop.
propagate(sctp, po).value();
256 std::cout << screenOutput.
debugString << std::endl;
260 std::vector<Material> matvector;
261 double gridX0 = 0., gridL0 = 0., trueX0 = 0., trueL0 = 0.;
262 for (
unsigned int i = 0; i < stepResult.position.size(); i++) {
263 matvector.push_back(matGrid.atPosition(stepResult.position[i]));
264 gridX0 += 1 / matvector[i].X0();
265 gridL0 += 1 / matvector[i].L0();
266 trueX0 += 1 / stepResult.matTrue[i].X0();
267 trueL0 += 1 / stepResult.matTrue[i].L0();