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;
76 BinUtility bu1(4, 0_m, 1_m,
open,
binX);
77 bu1 += BinUtility(2, -0.5_m, 0.5_m,
open,
binY);
78 bu1 += BinUtility(2, -0.5_m, 0.5_m,
open,
binZ);
80 BinUtility bu2(4, 1_m, 2_m,
open,
binX);
81 bu2 += BinUtility(2, -0.5_m, 0.5_m,
open,
binY);
82 bu2 += BinUtility(2, -0.5_m, 0.5_m,
open,
binZ);
84 BinUtility bu3(4, 2_m, 3_m,
open,
binX);
85 bu3 += BinUtility(2, -0.5_m, 0.5_m,
open,
binY);
86 bu3 += BinUtility(2, -0.5_m, 0.5_m,
open,
binZ);
89 CuboidVolumeBuilder::VolumeConfig vCfg1;
90 vCfg1.position =
Vector3D(0.5_m, 0., 0.);
91 vCfg1.length =
Vector3D(1_m, 1_m, 1_m);
92 vCfg1.name =
"Vacuum volume";
93 vCfg1.volumeMaterial = std::make_shared<const ProtoVolumeMaterial>(bu1);
96 CuboidVolumeBuilder::VolumeConfig vCfg2;
97 vCfg2.position =
Vector3D(1.5_m, 0., 0.);
98 vCfg2.length =
Vector3D(1_m, 1_m, 1_m);
99 vCfg2.name =
"First material volume";
100 vCfg2.volumeMaterial = std::make_shared<const ProtoVolumeMaterial>(bu2);
103 CuboidVolumeBuilder::VolumeConfig vCfg3;
104 vCfg3.position =
Vector3D(2.5_m, 0., 0.);
105 vCfg3.length =
Vector3D(1_m, 1_m, 1_m);
106 vCfg3.name =
"Second material volume";
107 vCfg3.volumeMaterial = std::make_shared<const ProtoVolumeMaterial>(bu3);
111 cfg.position =
Vector3D(1.5_m, 0., 0.);
112 cfg.length =
Vector3D(3_m, 1_m, 1_m);
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;
158 vCfg1.length =
Vector3D(1_m, 1_m, 1_m);
159 vCfg1.name =
"Vacuum volume";
160 vCfg1.volumeMaterial =
161 std::make_shared<const HomogeneousVolumeMaterial>(
Material());
166 vCfg2.length =
Vector3D(1_m, 1_m, 1_m);
167 vCfg2.name =
"First material volume";
168 vCfg2.volumeMaterial =
169 std::make_shared<HomogeneousVolumeMaterial>(
makeSilicon());
174 vCfg3.length =
Vector3D(1_m, 1_m, 1_m);
175 vCfg3.name =
"Second material volume";
176 vCfg3.volumeMaterial =
177 std::make_shared<const HomogeneousVolumeMaterial>(
Material());
182 cfg.length =
Vector3D(3_m, 1_m, 1_m);
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 < 1e4; i++) {
212 std::vector<Vector3D> volPos;
213 volPos.push_back(pos);
215 (
detector->lowestTrackingVolume(gc, pos)->volumeMaterial() !=
nullptr)
216 ? (
detector->lowestTrackingVolume(gc, pos)->volumeMaterial())
220 matRecord.push_back(std::make_pair(matProp, volPos));
225 std::function<Vector3D(Vector3D)> transfoGlobalToLocal =
249 const auto& result = prop.
propagate(sctp, po).value();
254 std::vector<Material> matvector;
255 double gridX0 = 0., gridL0 = 0., trueX0 = 0., trueL0 = 0.;
256 for (
unsigned int i = 0; i < stepResult.position.size(); i++) {
257 matvector.push_back(matGrid.atPosition(stepResult.position[i]));
258 gridX0 += 1 / matvector[i].X0();
259 gridL0 += 1 / matvector[i].L0();
260 trueX0 += 1 / stepResult.
matTrue[i].X0();
261 trueL0 += 1 / stepResult.matTrue[i].L0();