39 std::unique_ptr<const Logger>
logger)
55 std::vector<std::shared_ptr<const Surface>> surfaces,
size_t binsPhi,
56 size_t binsZ, std::optional<ProtoLayer> _protoLayer,
59 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
64 double layerHalfZ = 0.5 * protoLayer.
range(
binZ);
65 double layerThickness = protoLayer.
range(
binR);
70 << protoLayer.
max(
binR,
false));
71 ACTS_VERBOSE(
" - with R thickness = " << layerThickness);
77 << protoLayer.
min(
binZ,
false) <<
" (-"
79 << protoLayer.
max(
binZ,
false) <<
" (+"
89 if (transform.isApprox(Transform3::Identity())) {
97 ACTS_VERBOSE(
" - # of modules = " << surfaces.size() <<
" ordered in ( "
98 << binsPhi <<
" x " << binsZ <<
")");
99 std::unique_ptr<SurfaceArray> sArray;
100 if (!surfaces.empty()) {
101 sArray =
m_cfg.surfaceArrayCreator->surfaceArrayOnCylinder(
102 gctx,
std::move(surfaces), binsPhi, binsZ, protoLayer);
104 checkBinning(gctx, *sArray);
108 std::shared_ptr<const CylinderBounds> cBounds(
113 addTranslation * transform, cBounds,
std::move(sArray), layerThickness,
117 ACTS_ERROR(
"Creation of cylinder layer did not succeed!");
119 associateSurfacesToLayer(*cLayer);
127 std::vector<std::shared_ptr<const Surface>> surfaces,
BinningType bTypePhi,
128 BinningType bTypeZ, std::optional<ProtoLayer> _protoLayer,
131 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
136 double layerHalfZ = 0.5 * protoLayer.
range(
binZ);
137 double layerThickness = protoLayer.
range(
binR);
143 << protoLayer.
max(
binR,
false));
144 ACTS_VERBOSE(
" - with R thickness = " << layerThickness);
149 << protoLayer.
min(
binZ,
false) <<
" (-"
151 << protoLayer.
max(
binZ,
false) <<
" (+"
161 if (transform.isApprox(Transform3::Identity()) && bTypeZ ==
equidistant) {
169 ACTS_VERBOSE(
" - # of modules = " << surfaces.size() <<
"");
172 std::unique_ptr<SurfaceArray> sArray;
173 if (!surfaces.empty()) {
174 sArray =
m_cfg.surfaceArrayCreator->surfaceArrayOnCylinder(
175 gctx,
std::move(surfaces), bTypePhi, bTypeZ, protoLayer);
177 checkBinning(gctx, *sArray);
181 std::shared_ptr<const CylinderBounds> cBounds(
186 addTranslation * transform, cBounds,
std::move(sArray), layerThickness,
190 ACTS_ERROR(
"Creation of cylinder layer did not succeed!");
192 associateSurfacesToLayer(*cLayer);
200 std::vector<std::shared_ptr<const Surface>> surfaces,
size_t binsR,
201 size_t binsPhi, std::optional<ProtoLayer> _protoLayer,
204 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
207 double layerThickness = protoLayer.
range(
binZ);
213 << protoLayer.
max(
binZ,
false));
214 ACTS_VERBOSE(
" - with Z thickness = " << layerThickness);
219 << protoLayer.
min(
binR,
false) <<
" (-"
221 << protoLayer.
max(
binR,
false) <<
" (+"
226 ACTS_VERBOSE(
" - # of modules = " << surfaces.size() <<
" ordered in ( "
227 << binsR <<
" x " << binsPhi <<
")");
231 if (transform.isApprox(Transform3::Identity())) {
235 std::unique_ptr<SurfaceArray> sArray;
236 if (!surfaces.empty()) {
237 sArray =
m_cfg.surfaceArrayCreator->surfaceArrayOnDisc(
238 gctx,
std::move(surfaces), binsR, binsPhi, protoLayer, transform);
240 checkBinning(gctx, *sArray);
244 auto dBounds = std::make_shared<const RadialBounds>(protoLayer.
min(
binR),
255 ACTS_ERROR(
"Creation of disc layer did not succeed!");
257 associateSurfacesToLayer(*dLayer);
264 std::vector<std::shared_ptr<const Surface>> surfaces,
BinningType bTypeR,
265 BinningType bTypePhi, std::optional<ProtoLayer> _protoLayer,
268 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
271 double layerThickness = protoLayer.
range(
binZ);
277 << protoLayer.
max(
binZ,
false));
278 ACTS_VERBOSE(
" - with Z thickness = " << layerThickness);
283 << protoLayer.
min(
binR,
false) <<
" (-"
285 << protoLayer.
max(
binR,
false) <<
" (+"
294 if (transform.isApprox(Transform3::Identity())) {
299 std::unique_ptr<SurfaceArray> sArray;
300 if (!surfaces.empty()) {
301 sArray =
m_cfg.surfaceArrayCreator->surfaceArrayOnDisc(
302 gctx,
std::move(surfaces), bTypeR, bTypePhi, protoLayer, transform);
304 checkBinning(gctx, *sArray);
308 auto dBounds = std::make_shared<const RadialBounds>(protoLayer.
min(
binR),
316 ACTS_ERROR(
"Creation of disc layer did not succeed!");
318 associateSurfacesToLayer(*dLayer);
325 std::vector<std::shared_ptr<const Surface>> surfaces,
size_t bins1,
326 size_t bins2,
BinningValue bValue, std::optional<ProtoLayer> _protoLayer,
329 _protoLayer ? *_protoLayer :
ProtoLayer(gctx, surfaces);
332 double layerHalf1 = 0, layerHalf2 = 0, layerThickness = 0;
353 throw std::invalid_argument(
"Invalid binning value");
356 double centerX = 0.5 * (protoLayer.
max(
binX) + protoLayer.
min(
binX));
357 double centerY = 0.5 * (protoLayer.
max(
binY) + protoLayer.
min(
binY));
358 double centerZ = 0.5 * (protoLayer.
max(
binZ) + protoLayer.
min(
binZ));
362 <<
"(" << centerX <<
", " << centerY <<
", " << centerZ <<
")");
367 ACTS_VERBOSE(
" - with Z thickness = " << layerThickness);
376 if (transform.isApprox(Transform3::Identity())) {
377 addTranslation =
Translation3(centerX, centerY, centerZ);
379 <<
"(" << centerX <<
", " << centerY <<
", " << centerZ
383 std::unique_ptr<SurfaceArray> sArray;
384 if (!surfaces.empty()) {
385 sArray =
m_cfg.surfaceArrayCreator->surfaceArrayOnPlane(
386 gctx,
std::move(surfaces), bins1, bins2, bValue, protoLayer, transform);
388 checkBinning(gctx, *sArray);
392 std::shared_ptr<const PlanarBounds> pBounds(
401 ACTS_ERROR(
"Creation of plane layer did not succeed!");
403 associateSurfacesToLayer(*pLayer);
413 for (
auto&
surface : surfaces) {
428 std::vector<const Surface*> surfaces = sArray.
surfaces();
429 std::set<const Surface*> sensitiveSurfaces(surfaces.begin(), surfaces.end());
430 std::set<const Surface*> accessibleSurfaces;
431 size_t nEmptyBins = 0;
432 size_t nBinsChecked = 0;
436 for (
size_t b = 0;
b <
size; ++
b) {
437 std::vector<const Surface*> binContent = sArray.
at(
b);
442 for (
const auto& srf : binContent) {
443 accessibleSurfaces.insert(srf);
445 if (binContent.empty()) {
451 std::vector<const Acts::Surface*> diff;
452 std::set_difference(sensitiveSurfaces.begin(), sensitiveSurfaces.end(),
453 accessibleSurfaces.begin(), accessibleSurfaces.end(),
454 std::inserter(diff, diff.begin()));
456 ACTS_VERBOSE(
" - Checked " << nBinsChecked <<
" valid bins");
458 if (nEmptyBins > 0) {
459 ACTS_ERROR(
" -- Not all bins point to surface. " << nEmptyBins <<
" empty");
466 " -- Not all sensitive surfaces are accessible through binning. "
468 << sensitiveSurfaces.size()
469 <<
" accessible: " << accessibleSurfaces.size());
473 for (
const auto& srf : diff) {
476 ACTS_ERROR(
" Surface(x=" << ctr.x() <<
", y=" << ctr.y()
477 <<
", z=" << ctr.z() <<
", r=" <<
perp(ctr)
478 <<
", phi=" <<
phi(ctr) <<
")");
482 ACTS_VERBOSE(
" -- All sensitive surfaces are accessible through binning.");
485 return nEmptyBins == 0 && diff.empty();