416{
417 ATH_MSG_VERBOSE(
" build LayerArray with " << planeLayersInput.size() <<
" plane-like material layers." );
418
419
420 std::unique_ptr<Trk::BinnedArray1D<Trk::Layer>>
planeLayerArray =
nullptr;
421 std::vector< std::pair< std::shared_ptr<Trk::Layer>,
Amg::Vector3D> > layerOrderVector;
423
424
425 std::vector<Trk::PlaneLayer*> planeLayers(planeLayersInput);
426
427 auto sortBegin = planeLayers.begin();
428 auto sortEnd = planeLayers.end();
429 switch (bv) {
434 ATH_MSG_WARNING(
"Plane Layers can only be sorted in x/y/z. Returning 0.");
435 return nullptr;
436 }
437 }
438
439
440 auto layIter = planeLayers.begin();
441
442 switch (btype) {
443
444
446 {
447
448 unsigned int layers = planeLayers.size();
449
450 for ( ; layIter != planeLayers.end(); ++layIter) {
451
452 const Trk::PlaneSurface& layerSurface = (*layIter)->surfaceRepresentation();
453 ATH_MSG_VERBOSE(
"equidistant : registering plane-like MaterialLayer at position : " << layerSurface.
center() );
454
455 layerOrderVector.emplace_back(
456 std::shared_ptr<Layer>(*layIter),
458 }
459
460 auto binUtility = Trk::BinUtility(layers,posmin,posmax,
Trk::open, bv);
461
462 planeLayerArray = std::make_unique<Trk::BinnedArray1D<Trk::Layer>>(layerOrderVector, binUtility);
463
464 } break;
465
466
468 {
469
470 unsigned int layers = planeLayers.size();
471
472 double posStep = (posmax-posmin)/(layers+1);
473
474 double currentPos = posmin + posStep;
475 double lastPos = posmin;
476
477 double minHalfX = 0.;
478 double maxHalfX = 0.;
480
481 double layerThickness = 0.;
482
483
484 for ( ; layIter != planeLayers.end() ; ++layIter) {
485
486
487 const Trk::PlaneSurface& layerSurface = (*layIter)->surfaceRepresentation();
488
489 const Trk::RectangleBounds* recbounds =
dynamic_cast<const Trk::RectangleBounds*
>(&(layerSurface.
bounds()));
490
491 if (recbounds) {
494 } else {
495
496 const Trk::TrapezoidBounds* trapbounds =
dynamic_cast<const Trk::TrapezoidBounds*
>(&(layerSurface.
bounds()));
497 if (trapbounds) {
501 } else {
502
503 minHalfX = 0.;
504 maxHalfX = 10e10;
506 }
507 }
508
509 layerThickness = ((*layIter)->thickness() > layerThickness ) ? (*layIter)->thickness() : layerThickness;
510
511
512 double navigationPos = 0.5*(currentPos+lastPos);
513 double navigationX = (bv ==
Trk::binX) ? navigationPos : 0.;
514 double navigationY = (bv ==
Trk::binY) ? navigationPos : 0.;
515 double navigationZ = (bv ==
Trk::binZ) ? navigationPos : 0.;
517
518 std::unique_ptr<Trk::PlaneSurface> navLayerSurface = nullptr;
520
521 if (std::abs(minHalfX)<10e-5) {
522 navLayerSurface = std::make_unique<Trk::PlaneSurface>(navLayerTransform,
523 maxHalfX,
524 halfY);
525 } else {
526 navLayerSurface = std::make_unique<Trk::PlaneSurface>(navLayerTransform,
527 minHalfX,
528 maxHalfX,
529 halfY);
530 }
531
532 ATH_MSG_VERBOSE(
"bi-equidistant : creating plane-like NavigationLayer at position : " << navigationX );
533
534 layerOrderVector.emplace_back(std::make_shared<Trk::NavigationLayer>(std::move(navLayerSurface)),
536
537 lastPos = currentPos;
538
539
540 ATH_MSG_VERBOSE(
"bi-equidistant : registering plane-like MaterialLayer at position : " << currentPos );
541 layerOrderVector.emplace_back(
542 std::shared_ptr<Trk::Layer>(*layIter),
544
545
546 currentPos += posStep;
547 }
548
549
550 double navigationPosFinal = 0.5*(currentPos+lastPos);
551 double navigationXFinal = (bv ==
Trk::binX) ? navigationPosFinal : 0.;
552 double navigationYFinal = (bv ==
Trk::binY) ? navigationPosFinal : 0.;
553 double navigationZFinal = (bv ==
Trk::binZ) ? navigationPosFinal : 0.;
554
556
557 auto navLayerSurface = (std::abs(minHalfX)<10
e-5) ?
558 std::make_unique<Trk::PlaneSurface>(navLayerTransform, maxHalfX,halfY) :
559 std::make_unique<Trk::PlaneSurface>(navLayerTransform, minHalfX, maxHalfX, halfY);
560
561 ATH_MSG_VERBOSE(
"bi-equidistant : creating plane-like NavigationLayer at position : " << navLayerSurface->center() );
563 layerOrderVector.emplace_back(std::make_shared<Trk::NavigationLayer>(std::move(navLayerSurface)),
564 center);
565
566
567 auto binUtility = Trk::BinUtility(layers, layerThickness, posmin, posmax,
Trk::open, bv);
568
569
570 planeLayerArray = std::make_unique<Trk::BinnedArray1D<Trk::Layer>>(layerOrderVector, binUtility);
571
572 } break;
573
574
576 {
577
578 std::vector<float> boundaries;
579 boundaries.push_back(posmin);
580
581 double minHalfX = 0.;
582 double maxHalfX = 0.;
584
585
586 for ( ; layIter != planeLayers.end(); ++layIter) {
587
588
589 const Trk::PlaneSurface& layerSurface = (*layIter)->surfaceRepresentation();
590
591 const Trk::RectangleBounds* recbounds =
dynamic_cast<const Trk::RectangleBounds*
>(&(layerSurface.
bounds()));
592
593 if (recbounds) {
596 } else {
597
598 const Trk::TrapezoidBounds* trapbounds =
dynamic_cast<const Trk::TrapezoidBounds*
>(&(layerSurface.
bounds()));
599 if (trapbounds) {
603 } else {
604
605 minHalfX = 0.;
606 maxHalfX = 10e10;
608 }
609 }
610
611
612 layerCenter = layerSurface.
center();
613 double layerPosition = layerCenter[bv];
614
615 double layerThickness = (*layIter)->thickness();
616
617 boundaries.push_back(layerPosition-0.5*layerThickness);
618 double navLayerPositionX = (bv ==
Trk::binX) ? 0.5*(layerPosition+boundaries[boundaries.size()-1]) : layerCenter.x();
619 double navLayerPositionY = (bv ==
Trk::binY) ? 0.5*(layerPosition+boundaries[boundaries.size()-1]) : layerCenter.y();
620 double navLayerPositionZ = (bv ==
Trk::binZ) ? 0.5*(layerPosition+boundaries[boundaries.size()-1]) : layerCenter.z();
621 Amg::Translation3D navLayerPosition(navLayerPositionX,navLayerPositionY,navLayerPositionZ);
623
624 auto navLayerSurface = (std::abs(minHalfX)<10
e-5) ?
625 std::make_unique<Trk::PlaneSurface>( navLayerTransform, maxHalfX, halfY ) :
626 std::make_unique<Trk::PlaneSurface>( navLayerTransform, minHalfX, maxHalfX, halfY );
627 ATH_MSG_VERBOSE(
"arbitrary : creating plane-like NavigationLayer at position : " << navLayerPositionX );
628 layerOrderVector.emplace_back(
629 std::make_shared<Trk::NavigationLayer>(std::move(navLayerSurface)),
630 Amg::Vector3D(navLayerPositionX, navLayerPositionY, navLayerPositionZ));
631
632 boundaries.push_back(layerPosition+0.5*layerThickness);
633
634 layerOrderVector.emplace_back(
635 std::shared_ptr<Trk::Layer>(*layIter),
637
638 }
639
640 double navLayerPositionXFinal = (bv ==
Trk::binX) ? 0.5*(posmax+boundaries[boundaries.size()-1]) : layerCenter.x();
641 double navLayerPositionYFinal = (bv ==
Trk::binY) ? 0.5*(posmax+boundaries[boundaries.size()-1]) : layerCenter.y();
642 double navLayerPositionZFinal = (bv ==
Trk::binZ) ? 0.5*(posmax+boundaries[boundaries.size()-1]) : layerCenter.z();
643 Amg::Translation3D navLayerPositionFinal(navLayerPositionXFinal,navLayerPositionYFinal,navLayerPositionZFinal);
645
646 auto navLayerSurfaceFinal = (std::abs(minHalfX)<10
e-5) ?
647 std::make_unique<Trk::PlaneSurface>( navLayerTransformFinal, maxHalfX, halfY ) :
648 std::make_unique<Trk::PlaneSurface>( navLayerTransformFinal, minHalfX, maxHalfX, halfY );
649 ATH_MSG_VERBOSE(
"arbitrary : creating plane-like NavigationLayer at position : " << 0.5*(posmax+boundaries[boundaries.size()-1]) );
650 layerOrderVector.emplace_back(std::make_shared<Trk::NavigationLayer>(std::move(navLayerSurfaceFinal)),
651 Amg::Vector3D(navLayerPositionXFinal, navLayerPositionYFinal, navLayerPositionZFinal));
652
653 ATH_MSG_VERBOSE( layerOrderVector.size() <<
" plane Layers (material + navigation) built. " );
654
655
656 auto binUtility = Trk::BinUtility(boundaries,
Trk::open, bv);
657
658 planeLayerArray = std::make_unique<Trk::BinnedArray1D<Trk::Layer>>(layerOrderVector, binUtility);
659
660 } break;
661
663 }
664
666
667}
#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).