29 std::unique_ptr<const Logger> logger)
30 : m_cfg(lcConfig), m_logger(std::move(logger)) {}
40 m_logger = std::move(newLogger);
45 std::vector<std::shared_ptr<const Surface>> surfaces,
size_t binsPhi,
46 size_t binsZ, std::optional<ProtoLayer> _protoLayer,
48 std::unique_ptr<ApproachDescriptor> ad)
const {
50 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
55 double layerHalfZ = 0.5 * protoLayer.
range(
binZ);
56 double layerThickness = protoLayer.
range(
binR);
61 << protoLayer.
max(
binR,
false));
62 ACTS_VERBOSE(
" - with R thickness = " << layerThickness);
68 << protoLayer.
min(
binZ,
false) <<
" (-"
70 << protoLayer.
max(
binZ,
false) <<
" (+"
89 ACTS_VERBOSE(
" - # of modules = " << surfaces.size() <<
" ordered in ( "
90 << binsPhi <<
" x " << binsZ <<
")");
91 std::unique_ptr<SurfaceArray> sArray;
92 if (!surfaces.empty()) {
93 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnCylinder(
94 gctx, std::move(surfaces), binsPhi, binsZ, protoLayer);
96 checkBinning(gctx, *sArray);
100 std::shared_ptr<const CylinderBounds> cBounds(
105 addTranslation * transform, cBounds, std::move(sArray), layerThickness,
109 ACTS_ERROR(
"Creation of cylinder layer did not succeed!");
110 associateSurfacesToLayer(*cLayer);
119 BinningType bTypeZ, std::optional<ProtoLayer> _protoLayer,
121 std::unique_ptr<ApproachDescriptor> ad)
const {
123 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
128 double layerHalfZ = 0.5 * protoLayer.
range(
binZ);
129 double layerThickness = protoLayer.
range(
binR);
135 << protoLayer.
max(
binR,
false));
136 ACTS_VERBOSE(
" - with R thickness = " << layerThickness);
141 << protoLayer.
min(
binZ,
false) <<
" (-"
143 << protoLayer.
max(
binZ,
false) <<
" (+"
161 ACTS_VERBOSE(
" - # of modules = " << surfaces.size() <<
"");
164 std::unique_ptr<SurfaceArray> sArray;
165 if (!surfaces.empty()) {
166 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnCylinder(
167 gctx, std::move(surfaces), bTypePhi, bTypeZ, protoLayer);
169 checkBinning(gctx, *sArray);
173 std::shared_ptr<const CylinderBounds> cBounds(
178 addTranslation * transform, cBounds, std::move(sArray), layerThickness,
182 ACTS_ERROR(
"Creation of cylinder layer did not succeed!");
183 associateSurfacesToLayer(*cLayer);
191 std::vector<std::shared_ptr<const Surface>> surfaces,
size_t binsR,
192 size_t binsPhi, std::optional<ProtoLayer> _protoLayer,
194 std::unique_ptr<ApproachDescriptor> ad)
const {
196 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
199 double layerThickness = protoLayer.
range(
binZ);
205 << protoLayer.
max(
binZ,
false));
206 ACTS_VERBOSE(
" - with Z thickness = " << layerThickness);
211 << protoLayer.
min(
binR,
false) <<
" (-"
213 << protoLayer.
max(
binR,
false) <<
" (+"
218 ACTS_VERBOSE(
" - # of modules = " << surfaces.size() <<
" ordered in ( "
219 << binsR <<
" x " << binsPhi <<
")");
227 std::unique_ptr<SurfaceArray> sArray;
228 if (!surfaces.empty()) {
229 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnDisc(
230 gctx, std::move(surfaces), binsR, binsPhi, protoLayer, transform);
232 checkBinning(gctx, *sArray);
236 auto dBounds = std::make_shared<const RadialBounds>(protoLayer.
min(
binR),
244 layerThickness, std::move(ad),
active);
247 ACTS_ERROR(
"Creation of disc layer did not succeed!");
248 associateSurfacesToLayer(*dLayer);
256 BinningType bTypePhi, std::optional<ProtoLayer> _protoLayer,
258 std::unique_ptr<ApproachDescriptor> ad)
const {
260 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
263 double layerThickness = protoLayer.
range(
binZ);
269 << protoLayer.
max(
binZ,
false));
270 ACTS_VERBOSE(
" - with Z thickness = " << layerThickness);
275 << protoLayer.
min(
binR,
false) <<
" (-"
277 << protoLayer.
max(
binR,
false) <<
" (+"
291 std::unique_ptr<SurfaceArray> sArray;
292 if (!surfaces.empty()) {
293 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnDisc(
294 gctx, std::move(surfaces), bTypeR, bTypePhi, protoLayer, transform);
296 checkBinning(gctx, *sArray);
300 auto dBounds = std::make_shared<const RadialBounds>(protoLayer.
min(
binR),
306 layerThickness, std::move(ad),
active);
308 ACTS_ERROR(
"Creation of disc layer did not succeed!");
310 associateSurfacesToLayer(*dLayer);
317 std::vector<std::shared_ptr<const Surface>> surfaces,
size_t bins1,
318 size_t bins2,
BinningValue bValue, std::optional<ProtoLayer> _protoLayer,
320 std::unique_ptr<ApproachDescriptor> ad)
const {
322 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
325 double layerHalf1, layerHalf2, layerThickness;
346 double centerX = 0.5 * (protoLayer.
max(
binX) + protoLayer.
min(
binX));
347 double centerY = 0.5 * (protoLayer.
max(
binY) + protoLayer.
min(
binY));
348 double centerZ = 0.5 * (protoLayer.
max(
binZ) + protoLayer.
min(
binZ));
352 <<
"(" << centerX <<
", " << centerY <<
", " << centerZ <<
")");
357 ACTS_VERBOSE(
" - with Z thickness = " << layerThickness);
367 <<
"(" << centerX <<
", " << centerY <<
", " << centerZ
371 std::unique_ptr<SurfaceArray> sArray;
372 if (!surfaces.empty()) {
373 sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnPlane(
374 gctx, std::move(surfaces), bins1, bins2, bValue, protoLayer, transform);
376 checkBinning(gctx, *sArray);
380 std::shared_ptr<const PlanarBounds> pBounds(
386 layerThickness, std::move(ad),
active);
389 ACTS_ERROR(
"Creation of plane layer did not succeed!");
391 associateSurfacesToLayer(*pLayer);
401 for (
auto&
surface : surfaces) {
416 std::vector<const Surface*> surfaces = sArray.
surfaces();
417 std::set<const Surface*> sensitiveSurfaces(surfaces.begin(), surfaces.end());
418 std::set<const Surface*> accessibleSurfaces;
419 size_t nEmptyBins = 0;
420 size_t nBinsChecked = 0;
423 size_t size = sArray.
size();
424 for (
size_t b = 0; b < size; ++b) {
425 std::vector<const Surface*> binContent = sArray.
at(b);
430 for (
const auto& srf : binContent) {
431 accessibleSurfaces.insert(srf);
433 if (binContent.empty()) {
439 std::vector<const Acts::Surface*> diff;
440 std::set_difference(sensitiveSurfaces.begin(), sensitiveSurfaces.end(),
441 accessibleSurfaces.begin(), accessibleSurfaces.end(),
442 std::inserter(diff, diff.begin()));
444 ACTS_VERBOSE(
" - Checked " << nBinsChecked <<
" valid bins");
446 if (nEmptyBins > 0) {
447 ACTS_ERROR(
" -- Not all bins point to surface. " << nEmptyBins <<
" empty");
454 " -- Not all sensitive surfaces are accessible through binning. "
456 << sensitiveSurfaces.size()
457 <<
" accessible: " << accessibleSurfaces.size());
461 for (
const auto& srf : diff) {
464 ACTS_ERROR(
" Surface(x=" << ctr.x() <<
", y=" << ctr.y()
465 <<
", z=" << ctr.z() <<
", r=" <<
perp(ctr)
466 <<
", phi=" <<
phi(ctr) <<
")");
470 ACTS_VERBOSE(
" -- All sensitive surfaces are accessible through binning.");
473 return nEmptyBins == 0 && diff.empty();