31 std::unique_ptr<const Logger> logger)
32 : m_cfg(lcConfig), m_logger(std::move(logger)) {}
42 m_logger = std::move(newLogger);
47 std::vector<std::shared_ptr<const Surface>> surfaces,
size_t binsPhi,
48 size_t binsZ, std::optional<ProtoLayer> _protoLayer,
49 std::shared_ptr<const Transform3D>
transform,
50 std::unique_ptr<ApproachDescriptor> ad)
const {
52 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
55 double layerR = 0.5 * (protoLayer.
minR - protoLayer.
envR.first +
56 protoLayer.
maxR + protoLayer.
envR.second);
57 double binPosZ = 0.5 * (protoLayer.
minZ + protoLayer.
maxZ);
59 double envZShift = 0.5 * (-protoLayer.
envZ.first + protoLayer.
envZ.second);
60 double layerZ = binPosZ + envZShift;
61 double layerHalfZ = 0.5 *
std::abs(protoLayer.
maxZ + protoLayer.
envZ.second -
62 (protoLayer.
minZ - protoLayer.
envZ.first));
63 double layerThickness = (protoLayer.
maxR - protoLayer.
minR) +
64 protoLayer.
envR.first + protoLayer.
envR.second;
70 ACTS_VERBOSE(
" - with R thickness = " << layerThickness);
72 << protoLayer.
envR.second);
75 << protoLayer.
minZ <<
" (-" << protoLayer.
envZ.first <<
") / "
76 << protoLayer.
maxZ <<
" (+" << protoLayer.
envZ.second <<
")");
87 std::make_shared<const Transform3D>(
Translation3D(0., 0., layerZ));
93 ACTS_VERBOSE(
" - # of modules = " << surfaces.size() <<
" ordered in ( "
94 << binsPhi <<
" x " << binsZ <<
")");
95 std::unique_ptr<SurfaceArray> sArray;
96 if (!surfaces.empty()) {
97 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnCylinder(
98 gctx, std::move(surfaces), binsPhi, binsZ, protoLayer,
nullptr);
100 checkBinning(gctx, *sArray);
104 std::shared_ptr<const CylinderBounds> cBounds(
110 layerThickness, std::move(ad),
active);
113 ACTS_ERROR(
"Creation of cylinder layer did not succeed!");
114 associateSurfacesToLayer(*cLayer);
122 std::vector<std::shared_ptr<const Surface>> surfaces,
BinningType bTypePhi,
123 BinningType bTypeZ, std::optional<ProtoLayer> _protoLayer,
124 std::shared_ptr<const Transform3D>
transform,
125 std::unique_ptr<ApproachDescriptor> ad)
const {
127 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
130 double layerR = 0.5 * (protoLayer.
minR - protoLayer.
envR.first +
131 protoLayer.
maxR + protoLayer.
envR.second);
132 double binPosZ = 0.5 * (protoLayer.
minZ + protoLayer.
maxZ);
133 double envZShift = 0.5 * (-protoLayer.
envZ.first + protoLayer.
envZ.second);
134 double layerZ = binPosZ + envZShift;
136 double layerHalfZ = 0.5 *
std::abs(protoLayer.
maxZ + protoLayer.
envZ.second -
137 (protoLayer.
minZ - protoLayer.
envZ.first));
139 double layerThickness = (protoLayer.
maxR - protoLayer.
minR) +
140 protoLayer.
envR.first + protoLayer.
envR.second;
147 ACTS_VERBOSE(
" - with R thickness = " << layerThickness);
149 << protoLayer.
envR.second);
151 << protoLayer.
minZ <<
" (-" << protoLayer.
envZ.first <<
") / "
152 << protoLayer.
maxZ <<
" (+" << protoLayer.
envZ.second <<
")");
161 std::make_shared<const Transform3D>(
Translation3D(0., 0., layerZ));
167 ACTS_VERBOSE(
" - # of modules = " << surfaces.size() <<
"");
170 std::unique_ptr<SurfaceArray> sArray;
171 if (!surfaces.empty()) {
172 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnCylinder(
173 gctx, std::move(surfaces), bTypePhi, bTypeZ, protoLayer,
nullptr);
175 checkBinning(gctx, *sArray);
179 std::shared_ptr<const CylinderBounds> cBounds(
185 layerThickness, std::move(ad),
active);
188 ACTS_ERROR(
"Creation of cylinder layer did not succeed!");
189 associateSurfacesToLayer(*cLayer);
197 std::vector<std::shared_ptr<const Surface>> surfaces,
size_t binsR,
198 size_t binsPhi, std::optional<ProtoLayer> _protoLayer,
199 std::shared_ptr<const Transform3D>
transform,
200 std::unique_ptr<ApproachDescriptor> ad)
const {
202 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
204 double layerZ = 0.5 * (protoLayer.
minZ - protoLayer.
envZ.first +
205 protoLayer.
maxZ + protoLayer.
envZ.second);
206 double layerThickness = (protoLayer.
maxZ - protoLayer.
minZ) +
207 protoLayer.
envZ.first + protoLayer.
envZ.second;
214 ACTS_VERBOSE(
" - with Z thickness = " << layerThickness);
216 << protoLayer.
envZ.second);
218 << protoLayer.
minR <<
" (-" << protoLayer.
envR.first <<
") / "
219 << protoLayer.
maxR <<
" (+" << protoLayer.
envR.second <<
")");
222 ACTS_VERBOSE(
" - # of modules = " << surfaces.size() <<
" ordered in ( "
223 << binsR <<
" x " << binsPhi <<
")");
228 std::make_shared<const Transform3D>(
Translation3D(0., 0., layerZ));
231 std::unique_ptr<SurfaceArray> sArray;
232 if (!surfaces.empty()) {
233 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnDisc(
234 gctx, std::move(surfaces), binsR, binsPhi, protoLayer, transform);
236 checkBinning(gctx, *sArray);
240 auto dBounds = std::make_shared<const RadialBounds>(
241 protoLayer.
minR - protoLayer.
envR.first,
242 protoLayer.
maxR + protoLayer.
envR.second);
252 ACTS_ERROR(
"Creation of disc layer did not succeed!");
253 associateSurfacesToLayer(*dLayer);
260 std::vector<std::shared_ptr<const Surface>> surfaces,
BinningType bTypeR,
261 BinningType bTypePhi, std::optional<ProtoLayer> _protoLayer,
262 std::shared_ptr<const Transform3D>
transform,
263 std::unique_ptr<ApproachDescriptor> ad)
const {
265 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
267 double layerZ = 0.5 * (protoLayer.
minZ - protoLayer.
envZ.first +
268 protoLayer.
maxZ + protoLayer.
envZ.second);
270 protoLayer.
envZ.first + protoLayer.
envZ.second;
277 ACTS_VERBOSE(
" - with Z thickness = " << layerThickness);
279 << protoLayer.
envZ.second);
281 << protoLayer.
minR <<
" (-" << protoLayer.
envR.first <<
") / "
282 << protoLayer.
maxR <<
" (+" << protoLayer.
envR.second <<
")");
290 std::make_shared<const Transform3D>(
Translation3D(0., 0., layerZ));
294 std::unique_ptr<SurfaceArray> sArray;
295 if (!surfaces.empty()) {
296 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnDisc(
297 gctx, std::move(surfaces), bTypeR, bTypePhi, protoLayer, transform);
299 checkBinning(gctx, *sArray);
303 auto dBounds = std::make_shared<const RadialBounds>(
304 protoLayer.
minR - protoLayer.
envR.first,
305 protoLayer.
maxR + protoLayer.
envR.second);
312 ACTS_ERROR(
"Creation of disc layer did not succeed!");
313 associateSurfacesToLayer(*dLayer);
320 std::vector<std::shared_ptr<const Surface>> surfaces,
size_t bins1,
321 size_t bins2,
BinningValue bValue, std::optional<ProtoLayer> _protoLayer,
322 std::shared_ptr<const Transform3D>
transform,
323 std::unique_ptr<ApproachDescriptor> ad)
const {
325 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
328 double layerHalf1, layerHalf2, layerThickness;
331 layerHalf1 = 0.5 * (protoLayer.
maxY - protoLayer.
minY);
332 layerHalf2 = 0.5 * (protoLayer.
maxZ - protoLayer.
minZ);
333 layerThickness = (protoLayer.
maxX - protoLayer.
minX);
337 layerHalf1 = 0.5 * (protoLayer.
maxX - protoLayer.
minX);
338 layerHalf2 = 0.5 * (protoLayer.
maxZ - protoLayer.
minZ);
339 layerThickness = (protoLayer.
maxY - protoLayer.
minY);
343 layerHalf1 = 0.5 * (protoLayer.
maxX - protoLayer.
minX);
344 layerHalf2 = 0.5 * (protoLayer.
maxY - protoLayer.
minY);
345 layerThickness = (protoLayer.
maxZ - protoLayer.
minZ);
349 double centerX = 0.5 * (protoLayer.
maxX + protoLayer.
minX);
350 double centerY = 0.5 * (protoLayer.
maxY + protoLayer.
minY);
351 double centerZ = 0.5 * (protoLayer.
maxZ + protoLayer.
minZ);
355 <<
"(" << centerX <<
", " << centerY <<
", " << centerZ <<
")");
360 ACTS_VERBOSE(
" - with Z thickness = " << layerThickness);
367 transform = std::make_shared<const Transform3D>(
370 <<
"(" << centerX <<
", " << centerY <<
", " << centerZ
374 std::unique_ptr<SurfaceArray> sArray;
375 if (!surfaces.empty()) {
376 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnPlane(
377 gctx, std::move(surfaces), bins1, bins2, bValue, protoLayer, transform);
379 checkBinning(gctx, *sArray);
383 std::shared_ptr<const PlanarBounds> pBounds(
392 ACTS_ERROR(
"Creation of plane layer did not succeed!");
393 associateSurfacesToLayer(*pLayer);
403 for (
auto&
surface : surfaces) {
418 std::vector<const Surface*> surfaces = sArray.
surfaces();
419 std::set<const Surface*> sensitiveSurfaces(surfaces.begin(), surfaces.end());
420 std::set<const Surface*> accessibleSurfaces;
421 size_t nEmptyBins = 0;
422 size_t nBinsChecked = 0;
425 size_t size = sArray.
size();
426 for (
size_t b = 0;
b < size; ++
b) {
427 std::vector<const Surface*> binContent = sArray.
at(
b);
432 for (
const auto& srf : binContent) {
433 accessibleSurfaces.insert(srf);
435 if (binContent.empty()) {
441 std::vector<const Acts::Surface*> diff;
442 std::set_difference(sensitiveSurfaces.begin(), sensitiveSurfaces.end(),
443 accessibleSurfaces.begin(), accessibleSurfaces.end(),
444 std::inserter(diff, diff.begin()));
446 ACTS_VERBOSE(
" - Checked " << nBinsChecked <<
" valid bins");
448 if (nEmptyBins > 0) {
449 ACTS_ERROR(
" -- Not all bins point to surface. " << nEmptyBins <<
" empty");
456 " -- Not all sensitive surfaces are accessible through binning. "
458 << sensitiveSurfaces.size()
459 <<
" accessible: " << accessibleSurfaces.size());
463 for (
const auto& srf : diff) {
466 ACTS_ERROR(
" Surface(x=" << ctr.x() <<
", y=" << ctr.y()
467 <<
", z=" << ctr.z() <<
", r=" <<
perp(ctr)
468 <<
", phi=" <<
phi(ctr) <<
")");
472 ACTS_VERBOSE(
" -- All sensitive surfaces are accessible through binning.");
475 return nEmptyBins == 0 && diff.empty();