420{
421 ATH_MSG_VERBOSE(
" build LayerArray with " << planeLayersInput.size() <<
" plane-like material layers." );
422
423
424 std::unique_ptr<Trk::BinnedArray1D<Trk::Layer>>
planeLayerArray =
nullptr;
425 std::vector< std::pair< std::shared_ptr<Trk::Layer>,
Amg::Vector3D> > layerOrderVector;
427
428
429 std::vector<Trk::PlaneLayer*> planeLayers(planeLayersInput);
430
431 auto sortBegin = planeLayers.begin();
432 auto sortEnd = planeLayers.end();
433 switch (bv) {
438 ATH_MSG_WARNING(
"Plane Layers can only be sorted in x/y/z. Returning 0.");
439 return nullptr;
440 }
441 }
442
443
444 auto layIter = planeLayers.begin();
445
446 switch (btype) {
447
448
450 {
451
452 unsigned int layers = planeLayers.size();
453
454 for ( ; layIter != planeLayers.end(); ++layIter) {
455
456 const Trk::PlaneSurface& layerSurface = (*layIter)->surfaceRepresentation();
457 ATH_MSG_VERBOSE(
"equidistant : registering plane-like MaterialLayer at position : " << layerSurface.
center() );
458
459 layerOrderVector.emplace_back(
460 std::shared_ptr<Layer>(*layIter),
462 }
463
464 auto binUtility = Trk::BinUtility(layers,posmin,posmax,
Trk::open, bv);
465
466 planeLayerArray = std::make_unique<Trk::BinnedArray1D<Trk::Layer>>(layerOrderVector, binUtility);
467
468 } break;
469
470
472 {
473
474 unsigned int layers = planeLayers.size();
475
476 double posStep = (posmax-posmin)/(layers+1);
477
478 double currentPos = posmin + posStep;
479 double lastPos = posmin;
480
481 double minHalfX = 0.;
482 double maxHalfX = 0.;
484
485 double layerThickness = 0.;
486
487
488 for ( ; layIter != planeLayers.end() ; ++layIter) {
489
490
491 const Trk::PlaneSurface& layerSurface = (*layIter)->surfaceRepresentation();
492
493 const Trk::RectangleBounds* recbounds =
dynamic_cast<const Trk::RectangleBounds*
>(&(layerSurface.
bounds()));
494
495 if (recbounds) {
498 } else {
499
500 const Trk::TrapezoidBounds* trapbounds =
dynamic_cast<const Trk::TrapezoidBounds*
>(&(layerSurface.
bounds()));
501 if (trapbounds) {
505 } else {
506
507 minHalfX = 0.;
508 maxHalfX = 10e10;
510 }
511 }
512
513 layerThickness = ((*layIter)->thickness() > layerThickness ) ? (*layIter)->thickness() : layerThickness;
514
515
516 double navigationPos = 0.5*(currentPos+lastPos);
517 double navigationX = (bv ==
Trk::binX) ? navigationPos : 0.;
518 double navigationY = (bv ==
Trk::binY) ? navigationPos : 0.;
519 double navigationZ = (bv ==
Trk::binZ) ? navigationPos : 0.;
521
522 std::unique_ptr<Trk::PlaneSurface> navLayerSurface = nullptr;
524
525 if (std::abs(minHalfX)<10e-5) {
526 navLayerSurface = std::make_unique<Trk::PlaneSurface>(navLayerTransform,
527 maxHalfX,
528 halfY);
529 } else {
530 navLayerSurface = std::make_unique<Trk::PlaneSurface>(navLayerTransform,
531 minHalfX,
532 maxHalfX,
533 halfY);
534 }
535
536 ATH_MSG_VERBOSE(
"bi-equidistant : creating plane-like NavigationLayer at position : " << navigationX );
537
538 layerOrderVector.emplace_back(std::make_shared<Trk::NavigationLayer>(std::move(navLayerSurface)),
540
541 lastPos = currentPos;
542
543
544 ATH_MSG_VERBOSE(
"bi-equidistant : registering plane-like MaterialLayer at position : " << currentPos );
545 layerOrderVector.emplace_back(
546 std::shared_ptr<Trk::Layer>(*layIter),
548
549
550 currentPos += posStep;
551 }
552
553
554 double navigationPosFinal = 0.5*(currentPos+lastPos);
555 double navigationXFinal = (bv ==
Trk::binX) ? navigationPosFinal : 0.;
556 double navigationYFinal = (bv ==
Trk::binY) ? navigationPosFinal : 0.;
557 double navigationZFinal = (bv ==
Trk::binZ) ? navigationPosFinal : 0.;
558
560
561 auto navLayerSurface = (std::abs(minHalfX)<10
e-5) ?
562 std::make_unique<Trk::PlaneSurface>(navLayerTransform, maxHalfX,halfY) :
563 std::make_unique<Trk::PlaneSurface>(navLayerTransform, minHalfX, maxHalfX, halfY);
564
565 ATH_MSG_VERBOSE(
"bi-equidistant : creating plane-like NavigationLayer at position : " << navLayerSurface->center() );
567 layerOrderVector.emplace_back(std::make_shared<Trk::NavigationLayer>(std::move(navLayerSurface)),
568 center);
569
570
571 auto binUtility = Trk::BinUtility(layers, layerThickness, posmin, posmax,
Trk::open, bv);
572
573
574 planeLayerArray = std::make_unique<Trk::BinnedArray1D<Trk::Layer>>(layerOrderVector, binUtility);
575
576 } break;
577
578
580 {
581
582 std::vector<float> boundaries;
583 boundaries.push_back(posmin);
584
585 double minHalfX = 0.;
586 double maxHalfX = 0.;
588
589
590 for ( ; layIter != planeLayers.end(); ++layIter) {
591
592
593 const Trk::PlaneSurface& layerSurface = (*layIter)->surfaceRepresentation();
594
595 const Trk::RectangleBounds* recbounds =
dynamic_cast<const Trk::RectangleBounds*
>(&(layerSurface.
bounds()));
596
597 if (recbounds) {
600 } else {
601
602 const Trk::TrapezoidBounds* trapbounds =
dynamic_cast<const Trk::TrapezoidBounds*
>(&(layerSurface.
bounds()));
603 if (trapbounds) {
607 } else {
608
609 minHalfX = 0.;
610 maxHalfX = 10e10;
612 }
613 }
614
615
616 layerCenter = layerSurface.
center();
617 double layerPosition = layerCenter[bv];
618
619 double layerThickness = (*layIter)->thickness();
620
621 boundaries.push_back(layerPosition-0.5*layerThickness);
622 double navLayerPositionX = (bv ==
Trk::binX) ? 0.5*(layerPosition+boundaries[boundaries.size()-1]) : layerCenter.x();
623 double navLayerPositionY = (bv ==
Trk::binY) ? 0.5*(layerPosition+boundaries[boundaries.size()-1]) : layerCenter.y();
624 double navLayerPositionZ = (bv ==
Trk::binZ) ? 0.5*(layerPosition+boundaries[boundaries.size()-1]) : layerCenter.z();
625 Amg::Translation3D navLayerPosition(navLayerPositionX,navLayerPositionY,navLayerPositionZ);
627
628 auto navLayerSurface = (std::abs(minHalfX)<10
e-5) ?
629 std::make_unique<Trk::PlaneSurface>( navLayerTransform, maxHalfX, halfY ) :
630 std::make_unique<Trk::PlaneSurface>( navLayerTransform, minHalfX, maxHalfX, halfY );
631 ATH_MSG_VERBOSE(
"arbitrary : creating plane-like NavigationLayer at position : " << navLayerPositionX );
632 layerOrderVector.emplace_back(
633 std::make_shared<Trk::NavigationLayer>(std::move(navLayerSurface)),
634 Amg::Vector3D(navLayerPositionX, navLayerPositionY, navLayerPositionZ));
635
636 boundaries.push_back(layerPosition+0.5*layerThickness);
637
638 layerOrderVector.emplace_back(
639 std::shared_ptr<Trk::Layer>(*layIter),
641
642 }
643
644 double navLayerPositionXFinal = (bv ==
Trk::binX) ? 0.5*(posmax+boundaries[boundaries.size()-1]) : layerCenter.x();
645 double navLayerPositionYFinal = (bv ==
Trk::binY) ? 0.5*(posmax+boundaries[boundaries.size()-1]) : layerCenter.y();
646 double navLayerPositionZFinal = (bv ==
Trk::binZ) ? 0.5*(posmax+boundaries[boundaries.size()-1]) : layerCenter.z();
647 Amg::Translation3D navLayerPositionFinal(navLayerPositionXFinal,navLayerPositionYFinal,navLayerPositionZFinal);
649
650 auto navLayerSurfaceFinal = (std::abs(minHalfX)<10
e-5) ?
651 std::make_unique<Trk::PlaneSurface>( navLayerTransformFinal, maxHalfX, halfY ) :
652 std::make_unique<Trk::PlaneSurface>( navLayerTransformFinal, minHalfX, maxHalfX, halfY );
653 ATH_MSG_VERBOSE(
"arbitrary : creating plane-like NavigationLayer at position : " << 0.5*(posmax+boundaries[boundaries.size()-1]) );
654 layerOrderVector.emplace_back(std::make_shared<Trk::NavigationLayer>(std::move(navLayerSurfaceFinal)),
655 Amg::Vector3D(navLayerPositionXFinal, navLayerPositionYFinal, navLayerPositionZFinal));
656
657 ATH_MSG_VERBOSE( layerOrderVector.size() <<
" plane Layers (material + navigation) built. " );
658
659
660 auto binUtility = Trk::BinUtility(boundaries,
Trk::open, bv);
661
662 planeLayerArray = std::make_unique<Trk::BinnedArray1D<Trk::Layer>>(layerOrderVector, binUtility);
663
664 } break;
665
667 }
668
670
671}
#define ATH_MSG_WARNING(x)
std::unique_ptr< Trk::BinnedArray1D< Layer > > planeLayerArray(const std::vector< PlaneLayer * > &layers, double min, double max, BinningType btype=arbitrary, Trk::BinningValue bv=Trk::binX) const
LayerArrayCreator interface method - for Planar-like layers.
virtual const SurfaceBounds & bounds() const override final
This method returns the bounds by reference, static NoBounds in case of no boundaries.
double halflengthX() const
for consistant naming
double halflengthY() const
for consitant naming
double halflengthY() const
This method returns the halflength in Y (second coordinate of local surface frame)
double minHalflengthX() const
This method returns the minimal halflength in X (first coordinate of local surface frame)
double maxHalflengthX() const
This method returns the maximal halflength in X (first coordinate of local surface frame)
double halfY(const Acts::VolumeBounds &bounds)
Returns the half-Y length for the parsed volume bounds (Trapezoid/ Cuboid)