36 class DetecorElementBase;
47 using SurfacePosition = std::pair<const Acts::Surface*, Acts::Vector3D>;
51 std::vector<std::shared_ptr<const Acts::Surface>>
surfaces;
61 template <
typename detector_element_t>
64 using LayerStore = std::vector<std::shared_ptr<detector_element_t>>;
102 std::vector<std::shared_ptr<const Acts::ISurfaceMaterial>>
139 std::vector<std::vector<std::shared_ptr<const Acts::ISurfaceMaterial>>>
153 std::unique_ptr<const Acts::Logger>
logger =
199 template <
typename detector_element_t>
200 std::vector<ProtoLayerSurfaces>
204 std::vector<ProtoLayerSurfaces> cpLayers;
210 for (
auto& eLayers : detectorStore) {
211 imodule += eLayers.size();
217 size_t numcLayers = m_cfg.centralLayerRadii.size();
219 ACTS_DEBUG(
"Configured to build " << numcLayers
220 <<
" active central layers.");
221 cpLayers.reserve(numcLayers);
223 for (
size_t icl = 0; icl < numcLayers; ++icl) {
225 double layerR = m_cfg.centralLayerRadii.at(icl);
227 ACTS_DEBUG(
"Build layer " << icl <<
" with target radius = " << layerR);
230 std::vector<std::shared_ptr<const Acts::Surface>> sVector;
232 double layerEnvelopeCoverZ =
233 m_cfg.centralLayerEnvelopes.size()
234 ? m_cfg.centralLayerEnvelopes.at(icl).second
237 double modulePhiTilt = m_cfg.centralModuleTiltPhi.at(icl);
238 double moduleHalfX = m_cfg.centralModuleHalfX.at(icl);
239 double moduleHalfY = m_cfg.centralModuleHalfY.at(icl);
240 double moduleThickness = m_cfg.centralModuleThickness.at(icl);
244 size_t nCentralModules = m_cfg.centralModuleBinningSchema.at(icl).first *
245 m_cfg.centralModuleBinningSchema.at(icl).second;
248 << nCentralModules <<
" ( from "
249 << m_cfg.centralModuleBinningSchema.at(icl).first <<
" x "
250 << m_cfg.centralModuleBinningSchema.at(icl).second <<
" )");
252 sVector.reserve(nCentralModules);
256 std::shared_ptr<const Acts::DigitizationModule> moduleDigitizationPtr =
258 if (m_cfg.centralModuleReadoutBinsX.size()) {
260 std::shared_ptr<const Acts::Segmentation> moduleSegmentation =
261 std::make_shared<const Acts::CartesianSegmentation>(
263 m_cfg.centralModuleReadoutBinsY.at(icl));
265 moduleDigitizationPtr =
266 std::make_shared<const Acts::DigitizationModule>(
267 moduleSegmentation, 0.5 * m_cfg.centralModuleThickness.at(icl),
268 m_cfg.centralModuleReadoutSide.at(icl),
269 m_cfg.centralModuleLorentzAngle.at(icl));
274 std::shared_ptr<const Acts::ISurfaceMaterial> moduleMaterialPtr =
nullptr;
275 if (m_cfg.centralModuleMaterial.size()) {
277 moduleMaterialPtr = m_cfg.centralModuleMaterial.at(icl);
281 if (m_cfg.centralModulePositions.at(icl).size() != nCentralModules) {
282 ACTS_WARNING(
"Mismatching module numbers, configuration error!");
283 ACTS_WARNING(
"- Binning schema suggests : " << nCentralModules);
285 << m_cfg.centralModulePositions.at(icl).size());
288 for (
auto& moduleCenter : m_cfg.centralModulePositions.at(icl)) {
290 double modulePhi =
phi(moduleCenter);
293 sin(modulePhi + modulePhiTilt), 0.);
298 cos(modulePhi + modulePhiTilt), 0.);
301 moduleRotation.col(0) = moduleLocalX;
302 moduleRotation.col(1) = moduleLocalY;
303 moduleRotation.col(2) = moduleLocalZ;
305 std::shared_ptr<Acts::Transform3D> mutableModuleTransform =
306 std::make_shared<Acts::Transform3D>(
309 if (m_cfg.centralModuleFrontsideStereo.size() &&
310 m_cfg.centralModuleFrontsideStereo.at(icl) != 0.) {
312 double stereo = m_cfg.centralModuleFrontsideStereo.at(icl);
313 (*mutableModuleTransform.get()) *=
320 mutableModuleTransform);
322 auto module = std::make_shared<detector_element_t>(
323 moduleIdentifier, moduleTransform,
moduleBounds, moduleThickness,
324 moduleMaterialPtr, moduleDigitizationPtr);
327 layerStore.push_back(module);
329 sVector.push_back(module->surface().getSharedPtr());
332 if (m_cfg.centralModuleBacksideGap.size()) {
337 m_cfg.centralModuleBacksideGap.at(icl) * moduleLocalZ;
338 mutableModuleTransform = std::make_shared<Acts::Transform3D>(
341 if (m_cfg.centralModuleBacksideStereo.size()) {
343 double stereoBackSide = m_cfg.centralModuleBacksideStereo.at(icl);
344 (*mutableModuleTransform.get()) *=
349 mutableModuleTransform);
351 auto bsmodule = std::make_shared<detector_element_t>(
352 moduleIdentifier, moduleTransform,
moduleBounds, moduleThickness,
353 moduleMaterialPtr, moduleDigitizationPtr);
355 layerStore.push_back(std::move(bsmodule));
359 size_t phiBins = m_cfg.centralModuleBinningSchema.at(icl).first;
360 phiBins *= m_cfg.centralLayerBinMultipliers.first;
361 size_t zBins = m_cfg.centralModuleBinningSchema.at(icl).second;
362 zBins *= m_cfg.centralLayerBinMultipliers.second;
366 pl.
envR = {m_cfg.approachSurfaceEnvelope, m_cfg.approachSurfaceEnvelope};
367 pl.
envZ = {layerEnvelopeCoverZ, layerEnvelopeCoverZ};
371 cpLayers.push_back(std::move(pls));
373 detectorStore.push_back(std::move(layerStore));
379 template <
typename detector_element_t>
380 std::vector<ProtoLayerSurfaces>
383 return createProtoLayers(gctx, detectorStore, -1);
386 template <
typename detector_element_t>
387 std::vector<ProtoLayerSurfaces>
390 return createProtoLayers(gctx, detectorStore, 1);
393 template <
typename detector_element_t>
396 std::unique_ptr<const Acts::Logger> log)
397 : m_cfg(cfg), m_logger(std::move(log)) {}
399 template <
typename detector_element_t>
400 std::vector<ProtoLayerSurfaces>
406 for (
auto& eLayers : detectorStore) {
407 imodule += eLayers.size();
411 std::vector<ProtoLayerSurfaces> epLayers;
416 size_t numpnLayers = m_cfg.posnegLayerPositionsZ.size();
419 << numpnLayers <<
" passive positive/negative side layers.");
420 epLayers.reserve(numpnLayers);
423 for (
size_t ipnl = 0; ipnl < numpnLayers; ++ipnl) {
426 << ipnl <<
" and " << numpnLayers + ipnl <<
" at z = "
427 << side * m_cfg.posnegLayerPositionsZ.at(ipnl));
430 double layerEnvelopeR = m_cfg.posnegLayerEnvelopeR.at(ipnl);
432 std::vector<std::shared_ptr<const Acts::Surface>> esVector;
435 for (
auto& discModulePositions : m_cfg.posnegModulePositions.at(ipnl)) {
436 ACTS_VERBOSE(
"- building ring " << ipnR <<
" for this layer.");
439 double moduleThickness = m_cfg.posnegModuleThickness.at(ipnl).at(ipnR);
440 double moduleMinHalfX = m_cfg.posnegModuleMinHalfX.at(ipnl).at(ipnR);
441 double moduleMaxHalfX = 0.;
442 if (m_cfg.posnegModuleMaxHalfX.size() > ipnl &&
443 m_cfg.posnegModuleMaxHalfX.at(ipnl).size() > ipnR) {
444 moduleMaxHalfX = m_cfg.posnegModuleMaxHalfX.at(ipnl).at(ipnR);
446 double moduleHalfY = m_cfg.posnegModuleHalfY.at(ipnl).at(ipnR);
450 if (moduleMaxHalfX != 0. && moduleMinHalfX != moduleMaxHalfX)
456 std::shared_ptr<const Acts::PlanarBounds>
moduleBounds(pBounds);
458 std::shared_ptr<const Acts::DigitizationModule> moduleDigitizationPtr =
460 if (m_cfg.posnegModuleReadoutBinsX.size()) {
462 std::shared_ptr<const Acts::Segmentation> moduleSegmentation =
463 std::make_shared<const Acts::CartesianSegmentation>(
465 m_cfg.posnegModuleReadoutBinsX.at(ipnl).at(ipnR),
466 m_cfg.posnegModuleReadoutBinsY.at(ipnl).at(ipnR));
468 moduleDigitizationPtr =
469 std::make_shared<const Acts::DigitizationModule>(
470 moduleSegmentation, 0.5 * moduleThickness,
471 m_cfg.posnegModuleReadoutSide.at(ipnl).at(ipnR),
472 m_cfg.posnegModuleLorentzAngle.at(ipnl).at(ipnR));
476 std::shared_ptr<const Acts::ISurfaceMaterial> moduleMaterialPtr =
478 if (m_cfg.posnegModuleMaterial.size()) {
480 moduleMaterialPtr = m_cfg.posnegModuleMaterial.at(ipnl).at(ipnR);
484 for (
auto& ringModulePosition : discModulePositions) {
486 double modulePhi =
phi(ringModulePosition);
497 moduleRotation.col(0) = moduleLocalX;
498 moduleRotation.col(1) = moduleLocalY;
499 moduleRotation.col(2) = moduleLocalZ;
501 std::shared_ptr<const Acts::Transform3D> moduleTransform =
502 std::make_shared<const Acts::Transform3D>(
509 auto module = std::make_shared<detector_element_t>(
510 moduleIdentifier, moduleTransform,
moduleBounds, moduleThickness,
511 moduleMaterialPtr, moduleDigitizationPtr);
512 layerStore.push_back(module);
515 if (m_cfg.posnegModuleBacksideGap.size()) {
521 m_cfg.posnegModuleBacksideGap.at(ipnl).at(ipnR) * moduleLocalZ;
523 auto mutableModuleTransform = std::make_shared<Acts::Transform3D>(
526 if (m_cfg.posnegModuleBacksideStereo.size()) {
528 double stereoBackSide =
529 m_cfg.posnegModuleBacksideStereo.at(ipnl).at(ipnR);
530 (*mutableModuleTransform.get()) *=
535 mutableModuleTransform);
537 auto bsmodule = std::make_shared<detector_element_t>(
539 moduleThickness, moduleMaterialPtr, moduleDigitizationPtr);
541 layerStore.push_back(std::move(bsmodule));
544 esVector.push_back(module->surface().getSharedPtr());
550 size_t layerBinsR = m_cfg.posnegModulePhiBins.at(ipnl).size();
552 if (layerBinsR > 1) {
554 layerBinsR *= m_cfg.posnegLayerBinMultipliers.first;
556 size_t layerBinsPhi = 0;
558 for (
unsigned int phiBins : m_cfg.posnegModulePhiBins.at(ipnl)) {
559 layerBinsPhi = phiBins < layerBinsPhi ? phiBins : layerBinsPhi;
560 layerBinsPhi *= m_cfg.posnegLayerBinMultipliers.second;
564 ple.
envR = {layerEnvelopeR, layerEnvelopeR};
565 ple.
envZ = {m_cfg.approachSurfaceEnvelope, m_cfg.approachSurfaceEnvelope};
570 epLayers.push_back(std::move(ples));
572 detectorStore.push_back(std::move(layerStore));