ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::SiDetElementsRoadMaker_xk Class Referencefinal

#include <SiDetElementsRoadMaker_xk.h>

Inheritance diagram for InDet::SiDetElementsRoadMaker_xk:
Collaboration diagram for InDet::SiDetElementsRoadMaker_xk:

Public Member Functions

Standard tool methods
 SiDetElementsRoadMaker_xk (const std::string &, const std::string &, const IInterface *)
virtual ~SiDetElementsRoadMaker_xk ()=default
virtual StatusCode initialize () override
virtual StatusCode finalize () override
Main methods for road builder
virtual void detElementsRoad (std::deque< Amg::Vector3D > &globalPositions, std::vector< const InDetDD::SiDetectorElement * > &Road, bool testDirection, SiDetElementRoadMakerData_xk &roadMakerData, const EventContext &ctx) const override
 This signature assumes you already have a list of positions along the trajectory.
virtual void detElementsRoad (const EventContext &ctx, MagField::AtlasFieldCache &fieldCache, const Trk::TrackParameters &Tp, Trk::PropDirection direction, std::vector< const InDetDD::SiDetectorElement * > &Road, SiDetElementRoadMakerData_xk &roadMakerData) const override
 This is the signature used in most ATLAS clients.
Print internal tool parameters and status
MsgStream & dump (MsgStream &out) const override
std::ostream & dump (std::ostream &out) const override

Private Attributes

Service and tool handles
PublicToolHandle< Trk::IPropagatorm_proptool
Condition handle
SG::ReadCondHandleKey< SiDetElementsLayerVectors_xk > m_layerVecKey
 Created by SiDetElementsRoadCondAlg_xk.
SG::ReadCondHandleKey< AtlasFieldCacheCondObjm_fieldCondObjInputKey
Properties
BooleanProperty m_usePIX {this, "usePixel", true}
BooleanProperty m_useSCT {this, "useSCT", true}
FloatProperty m_width {this, "RoadWidth", 20., "Width of the road"}
DoubleProperty m_step {this, "MaxStep", 40., "Max step allowed"}
StringProperty m_pix {this, "PixManagerLocation", "Pixel", "PIX manager location"}
StringProperty m_sct {this, "SCTManagerLocation", "SCT", "SCT manager location"}
StringProperty m_fieldmode {this, "MagneticFieldMode", "MapSolenoid", "Mode of magnetic field"}
BooleanProperty m_ITkGeometry {this, "ITkGeometry", false}

Data members, which are updated only in initialize

Trk::CylinderBounds m_bounds {}
Trk::MagneticFieldMode m_fieldModeEnum {Trk::FullField}
int m_outputlevel {}
void computeBounds ()
Trk::CylinderBounds getBound (MagField::AtlasFieldCache &fieldCache, const Trk::TrackParameters &) const
MsgStream & dumpConditions (MsgStream &out) const
const SiDetElementsLayerVectors_xk * getLayers (const EventContext &ctx) const
static float stepToDetElement (const InDetDD::SiDetectorElement *&, Amg::Vector3D &, Amg::Vector3D &)
static void bookUsageTracker (InDet::SiDetElementRoadMakerData_xk &data, const SiDetElementsLayerVectors_xk &layers)
 this method is used to initialize the detector element usage tracker member of the event data struct in case it has not been previously set.

Detailed Description

Definition at line 59 of file SiDetElementsRoadMaker_xk.h.

Constructor & Destructor Documentation

◆ SiDetElementsRoadMaker_xk()

InDet::SiDetElementsRoadMaker_xk::SiDetElementsRoadMaker_xk ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 34 of file SiDetElementsRoadMaker_xk.cxx.

36 : base_class(t, n, p)
37{
38}

◆ ~SiDetElementsRoadMaker_xk()

virtual InDet::SiDetElementsRoadMaker_xk::~SiDetElementsRoadMaker_xk ( )
virtualdefault

Member Function Documentation

◆ bookUsageTracker()

void InDet::SiDetElementsRoadMaker_xk::bookUsageTracker ( InDet::SiDetElementRoadMakerData_xk & data,
const SiDetElementsLayerVectors_xk & layers )
staticprivate

this method is used to initialize the detector element usage tracker member of the event data struct in case it has not been previously set.

obtain an event usage tracker object

modifies the 'data' argument, based on information in the 'layers' argument.

book sufficient space module_i: iterate over the detector side

for each side, book the number of layers we expect to see

for each layer, book one slot for each detector element on the layer

Definition at line 521 of file SiDetElementsRoadMaker_xk.cxx.

521 {
522
525 for ( unsigned int side_i=0; side_i<3; ++side_i) {
526 data.elementUsageTracker[side_i].resize( layers[side_i].size() );
527 for (unsigned int layer_i=0; layer_i < layers[side_i].size(); ++layer_i) {
529 data.elementUsageTracker[side_i][layer_i].resize( layers[side_i][layer_i].nElements() );
530 }
531 }
532 data.isInitialized=true;
533}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
layers(flags, cells_name, *args, **kw)
Here we define wrapper functions to set up all of the standard corrections.

◆ computeBounds()

void InDet::SiDetElementsRoadMaker_xk::computeBounds ( )
private

Definition at line 606 of file SiDetElementsRoadMaker_xk.cxx.

607{
608
610
611 // Get Pixel Detector Manager
612 //
613 const InDetDD::PixelDetectorManager* pixmgr = nullptr;
614 if (m_usePIX) {
615 sc = detStore()->retrieve(pixmgr, m_pix);
616 if (sc.isFailure() || !pixmgr) {
617 ATH_MSG_FATAL("Could not get PixelDetectorManager !");
618 return;
619 }
620 }
621
622 // Get SCT Detector Manager
623 //
624 const InDetDD::SCT_DetectorManager* sctmgr = nullptr;
625 if (m_useSCT) {
626 sc = detStore()->retrieve(sctmgr, m_sct);
627 if (sc.isFailure() || !sctmgr) {
628 ATH_MSG_FATAL("Could not get SCT_DetectorManager !");
629 return;
630 }
631 }
632
633 const PixelID* IDp = nullptr;
634 const SCT_ID* IDs = nullptr;
635
636 if (m_usePIX && detStore()->retrieve(IDp, "PixelID").isFailure()) {
637 ATH_MSG_FATAL("Could not get Pixel ID helper");
638 }
639
640 if (m_useSCT && detStore()->retrieve(IDs, "SCT_ID").isFailure()) {
641 ATH_MSG_FATAL("Could not get SCT ID helper");
642 }
643
644
645 if (!IDs && !IDp) return;
646
648 std::vector<InDetDD::SiDetectorElement const*> pW[3];
649
650 if (IDp) {
651 // Loop over each wafer of pixels
652 //
653 s = pixmgr->getDetectorElementBegin();
654 se = pixmgr->getDetectorElementEnd ();
655
656 for (; s!=se; ++s) {
657 if ((*s)->isBarrel() ) pW[1].push_back((*s)); // Barrel
658 else if ((*s)->center().z() > 0.) pW[2].push_back((*s)); // Right endcap
659 else pW[0].push_back((*s)); // Left endcap
660 }
661 }
662
663 if (IDs) {
664 // Loop over each wafer of sct
665 //
666 s = sctmgr->getDetectorElementBegin();
667 se = sctmgr->getDetectorElementEnd ();
668
669 for (; s!=se; ++s) {
670 if ((*s)->isBarrel() ) pW[1].push_back((*s)); // Barrel
671 else if ((*s)->center().z() > 0.) pW[2].push_back((*s)); // Right endcap
672 else pW[0].push_back((*s)); // Left endcap
673 }
674 }
675
676 int nel = pW[0].size()+pW[1].size()+pW[2].size();
677 if (!nel) return;
678
679 std::sort(pW[1].begin(), pW[1].end(), InDet::compDetElements_RAZ());
680 std::sort(pW[0].begin(), pW[0].end(), InDet::compDetElements_ZRA());
681 std::sort(pW[2].begin(), pW[2].end(), InDet::compDetElements_ZRA());
682
683 double mzmin [3]; // min Z coordinate
684 double mzmax [3]; // max Z coordinate
685 double mrmin [3]; // min radius
686 double mrmax [3]; // max radius
687 bool has[3] {false,false,false};
688
689 for (int N=0; N!=3; ++N) {
690 double P[40];
691 int im = static_cast<int>(pW[N].size()-1);
692 int If = 0 ;
693 double z0 = 0. ;
694 double r0 = 0. ;
695 mrmin[N] = 100000.;
696 mrmax[N] =-100000.;
697 mzmin[N] = 100000.;
698 mzmax[N] =-100000.;
699
700 for (int i = 0; i<= im; ++i) {
702
703 if (P[ 9] < mrmin[N]) mrmin[N] = P[ 9];
704 if (P[10] > mrmax[N]) mrmax[N] = P[10];
705 if (P[11] < mzmin[N]) mzmin[N] = P[11];
706 if (P[12] > mzmax[N]) mzmax[N] = P[12];
707
708 double r = P[0];
709 double z = P[1];
710 bool newl = false;
711 if (N==1) {
712 if (fabs(r-r0) > 10.) {
713 newl=true;
714 r0=r;
715 }
716 } else {
717 if (fabs(z-z0) > 10.) {
718 newl=true;
719 r0=r;
720 z0=z;
721 }
722 }
723
724 if (newl || i==im) {
725 int Il = i-1;
726 if (i==im) ++Il;
727
728 if (If<=Il) {
729 has[N]=true;
730 }
731 If = i;
732 }
733 }
734 }
735
736 // CylinderBounds production
737 //
738 double zmi = +100000;
739 double zma = -100000;
740 double rma = -100000;
741 for (int i=0; i!=3; ++i) {
742 if (has[i]) {
743 if (mzmin[i]<zmi) zmi=mzmin[i];
744 if (mzmax[i]>zma) zma=mzmax[i];
745 if (mrmax[i]>rma) rma=mrmax[i];
746 }
747 }
748
749 double hz = fabs(zma);
750 if (hz<fabs(zmi)) hz = fabs(zmi);
751 const Trk::CylinderBounds CB(rma+20., hz+20.);
752 m_bounds = CB;
753}
#define ATH_MSG_FATAL(x)
static Double_t P(Double_t *tt, Double_t *par)
static Double_t sc
#define z
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
virtual SiDetectorElementCollection::const_iterator getDetectorElementBegin() const override
virtual SiDetectorElementCollection::const_iterator getDetectorElementEnd() const override
virtual SiDetectorElementCollection::const_iterator getDetectorElementBegin() const override
virtual SiDetectorElementCollection::const_iterator getDetectorElementEnd() const override
int r
Definition globals.cxx:22
::StatusCode StatusCode
StatusCode definition for legacy code.
void detElementInformation(const InDetDD::SiDetectorElement &Si, double *P)
const double r0
electron radius{cm}
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ detElementsRoad() [1/2]

void InDet::SiDetElementsRoadMaker_xk::detElementsRoad ( const EventContext & ctx,
MagField::AtlasFieldCache & fieldCache,
const Trk::TrackParameters & Tp,
Trk::PropDirection direction,
std::vector< const InDetDD::SiDetectorElement * > & Road,
SiDetElementRoadMakerData_xk & roadMakerData ) const
overridevirtual

This is the signature used in most ATLAS clients.

Parameters
[in]ctxEvent context
[in]fieldCacheMagnetic field cache
[in]TpTrack parameter hypothesis used for road building. For example obtained from a seed. Will be used to populate a set of space points along the expected trajectory, and to search for detector elements along this linearised trajectory using the signature above
[in]directionDirection of propagation - either along (inside out) or against (cosmic) momentum.
[out]RoadList to be populated with the elements of the search road. Will be sorted along the trajectory.
[in,out]roadMakerDataevent data object used to cache information during an event in a thread-safe way

500 MeV / pT

truncate at huge pt

step size - scaled by pt / 500 MeV

upper limit to step size: 1000 ;

get a list of global positions for the road search by starting from the first surface and walking along the trajectory using the RK propagator

should find at least 2 positions to sample

if we are extrapolating along them momentum direction, we pick out the part ascending in R

if the next point is at lower r than the previous point, remove the previous one

now perform the road building using our set of positions

Definition at line 539 of file SiDetElementsRoadMaker_xk.cxx.

546{
547 if (!m_usePIX && !m_useSCT) return;
549 double qp = fabs(500.*Tp.parameters()[4]);
551 if (qp < 1.e-10) qp = 1.e-10;
553 double S = m_step/qp;
555 if (S > 1000. ) S = 1000. ;
556
557 bool testDirection = true;
558 if (direction<0) {
559 testDirection = false;
560 S=-S;
561 }
562
564 if (!fieldCache.solenoidOn()) fieldModeEnum = Trk::NoField;
565 Trk::MagneticFieldProperties fieldprop(fieldModeEnum);
566
567 // Note: could also give fieldCache directly to propagator if it would be more efficient - would
568 // need to add interface RDS 2020/03
569 std::deque<Amg::Vector3D> G;
570
573 m_proptool->globalPositions(ctx, G, Tp, fieldprop,getBound(fieldCache, Tp), S, Trk::pion);
575 if (G.size()<2) return;
576
579 if (direction > 0) {
580 std::deque<Amg::Vector3D>::iterator currentPosition=G.begin(), nextPosition, endPositions=G.end();
581 float r0 = (*currentPosition).x()*(*currentPosition).x()+(*currentPosition).y()*(*currentPosition).y();
582
583 while (currentPosition!=endPositions) {
584 nextPosition = currentPosition;
585 if (++nextPosition == endPositions) break;
586
587 float r = (*nextPosition).x()*(*nextPosition).x()+(*nextPosition).y()*(*nextPosition).y();
589 if (r < r0) {
590 r0 = r;
591 currentPosition = G.erase(currentPosition);
592 } else {
593 break;
594 }
595 }
596 }
598 detElementsRoad(G, Road,testDirection, roadMakerData,ctx);
599}
static Double_t Tp(Double_t *t, Double_t *par)
#define G(x, y, z)
Definition MD5.cxx:113
virtual void detElementsRoad(std::deque< Amg::Vector3D > &globalPositions, std::vector< const InDetDD::SiDetectorElement * > &Road, bool testDirection, SiDetElementRoadMakerData_xk &roadMakerData, const EventContext &ctx) const override
This signature assumes you already have a list of positions along the trajectory.
PublicToolHandle< Trk::IPropagator > m_proptool
Trk::CylinderBounds getBound(MagField::AtlasFieldCache &fieldCache, const Trk::TrackParameters &) const
bool solenoidOn() const
status of the magnets
MagneticFieldMode
MagneticFieldMode describing the field setup within a volume.
@ NoField
Field is set to 0., 0., 0.,.

◆ detElementsRoad() [2/2]

void InDet::SiDetElementsRoadMaker_xk::detElementsRoad ( std::deque< Amg::Vector3D > & globalPositions,
std::vector< const InDetDD::SiDetectorElement * > & Road,
bool testDirection,
SiDetElementRoadMakerData_xk & roadMakerData,
const EventContext & ctx ) const
overridevirtual

This signature assumes you already have a list of positions along the trajectory.

It will look for detector elements compatible with being crossed by the linearised trajectory provided and fill those into the 'Road' argument. If 'testDirection' is used, we only fill detector elements encountered while traversing in the positive direction.

Parameters
[in]globalPositionsset of points along the trajectory. Will linearise between them.
[out]Roadvector to be populated with the elements of the search road. Will be sorted along the trajectory.
[in]testDirectionIf set, avoid adding detector elements encountered only when travelling in the negative direction. Set true for inside-out tracking, false for cosmic tracking.
[in,out]roadMakerDataevent data object used to cache information during an event in a thread-safe way

this is a vector of vectors of detector elements prepared by the SiDetElementsRoadCondAlg. The outer vector has 3 elements: 0 --> left endcap 1 --> barrel 2 --> right endcap Each of the inner vectors is internally sorted. For the endcaps, sorting is first in z, then for same Z in r, then for same r in phi. For the barrel, we first sort in R, then for same R in phi, then for same phi in Z.

iterators over the positions to consider

fill an array with the reference point (start with the first one), the road width and a placeholder for the step length

check the left endcap layers increment n0 until we are at the layer closest to the first position from the left side

check the barrel layers increment n1 until we are at the layer closest to the first position in the radial direction

and finally, the left endcap. this time, look for the layer closest on the right side.

reset the detector-element usage info. If we are the first client to see this event data object, we allocate the storage for all modules

if we are not the first client, we reset the event data without re-allocation

done with the first probed position. Now we can start to move along the trajectory

store the point we are aiming towards

x of the current position

y of the current position

z of the current position

r of the current position

perform linearisation

dx between the current and the first position

dy between the current and the first position

dz between the current and the first position

3D distance between the current and the first position

if geometry breaks down or two points are duplicates,

we whistle innocently and make a point of looking somewhere else

inverse distance to the first position

now we can book the linearised search direction

Having found the search direction, we are ready to look for detector elements and iterate. Before doing so, we add an additional test to ensure we probe the perigee point if we cross it on the way.

transverse component of the separation vector

negative component of the global location of the previous position into the direction connecting our positions in the x-y plane corresponds to the path length opposite to the linearised direction to reach the perigee

a positive value of SM means the closest approach to the beamline is between the two positions we are considering. In this case, we do not want to iterate to the next point, but instead insert an additional step where we use the perigee point as our reference. We do this by setting the target point to the perigee, which will be made the reference point when repeating the loop. Since the perigee is estimated using the linearised direction, this direction stays valid and does not need to be updated.

only add the perigee point if the next point is beyond the perigee, and if we are not too close anyway

now, the target point is the perigee estimate, while the reference point for this round stays unchanged.

allow 2cm on top of the perigee location when extrapolating inward.

Start collecting detector elements traversed by our linearised path.

First, barrel elements

if we are moving outwards in r:

loop over all barrel layers (starting with the closest one previously identified)

stop if we moved past the targer point in R

collect all compatible detector elements from the current layer

if we are moving inward in R, iterate the other way for the barrel

stop if we moved past the test point in R

collect all compatible detector elements

Positive endcap again check if we are moving forward or back in z

collect all compatible detector elements

collect all compatible detector elements

Negative endcap same game as above

collect all compatible detector elements

collect all compatible detector elements

update the starting point to be the current target point

and increment the total propagation distance

Definition at line 305 of file SiDetElementsRoadMaker_xk.cxx.

311{
312 if (!m_usePIX && !m_useSCT) return;
313
325 const SiDetElementsLayerVectors_xk &layer = *getLayers(ctx);
326
328 std::deque<Amg::Vector3D>::iterator currentPosition=globalPositions.begin(), endPositions=globalPositions.end();
329
332 std::array<float,6> par_startingPoint{static_cast<float>((*currentPosition).x()), // x of first position
333 static_cast<float>((*currentPosition).y()), // y of first position
334 static_cast<float>((*currentPosition).z()), // Z of first position
335 static_cast<float>(sqrt((*currentPosition).x()*(*currentPosition).x()+(*currentPosition).y()*(*currentPosition).y())), // r of first position
336 m_width, // road width
337 0.};
338
342 int n0 = 0;
343 for (; n0!=static_cast<int>(layer[0].size()); ++n0) {
344 if (par_startingPoint[2] > layer[0][n0].z()) break;
345 }
346
350 int n1 = 0;
351 for (; n1!=static_cast<int>(layer[1].size()); ++n1) {
352 if (par_startingPoint[3] < layer[1][n1].r()) break;
353 }
356 int n2 = 0;
357 for (; n2!=static_cast<int>(layer[2].size()); ++n2) {
358 if (par_startingPoint[2] < layer[2][n2].z()) break;
359 }
360
361
362
366 if (!roadMakerData.isInitialized){
367 bookUsageTracker(roadMakerData,layer);
368 }
369 else{
372 roadMakerData.resetUsageTracker();
373 }
374
375 std::vector<InDet::SiDetElementLink_xk::ElementWay> lDE;
376 lDE.reserve(8); //reasonable minimum guess
378 ++currentPosition;
379 while (currentPosition!=endPositions) {
381 std::array<float,4> par_targetPoint{static_cast<float>((*currentPosition).x()),
382 static_cast<float>((*currentPosition).y()),
383 static_cast<float>((*currentPosition).z()),
384 static_cast<float>(sqrt((*currentPosition).x()*(*currentPosition).x()+(*currentPosition).y()*(*currentPosition).y()))
385 };
386
388 float dx = par_targetPoint[0]-par_startingPoint[0];
389 float dy = par_targetPoint[1]-par_startingPoint[1];
390 float dz = par_targetPoint[2]-par_startingPoint[2];
391 float dist3D = std::sqrt(dx*dx+dy*dy+dz*dz);
392 if (dist3D <=0.) {
393 ++currentPosition;
394 continue;
395 }
396 float inverseDistance = 1./dist3D;
398 std::array<float,3> searchDirection{dx*inverseDistance, dy*inverseDistance, dz*inverseDistance};
399
403 float unitSepTransverseComp = searchDirection[0]*searchDirection[0]+searchDirection[1]*searchDirection[1];
404 float dr = 0. ;
405 if (unitSepTransverseComp!=0.) {
408 float sm = -( searchDirection[0]*par_startingPoint[0] +
409 searchDirection[1]*par_startingPoint[1])
410 /unitSepTransverseComp;
411
417 if (sm > 1. && sm < dist3D) {
418 par_targetPoint[0] = par_startingPoint[0]+searchDirection[0]*sm;
419 par_targetPoint[1] = par_startingPoint[1]+searchDirection[1]*sm;
420 par_targetPoint[2] = par_startingPoint[2]+searchDirection[2]*sm;
421 par_targetPoint[3] = std::sqrt(par_targetPoint[0]*par_targetPoint[0]+par_targetPoint[1]*par_targetPoint[1]);
424 dr = 20.;
425 } else {
426 ++currentPosition;
427 }
428 } else {
429 ++currentPosition;
430 }
431
433
435
437 if (par_targetPoint[3]>par_startingPoint[3]) {
439 for (; n1<static_cast<int>(layer[1].size()); ++n1) {
441 if (par_targetPoint[3] < layer[1][n1].r()) break;
442 assert( roadMakerData.elementUsageTracker[1].size() > static_cast<unsigned int>(n1) );
444 if(m_ITkGeometry) layer[1][n1].getITkBarrelDetElements(par_startingPoint, searchDirection, lDE, roadMakerData.elementUsageTracker[1][n1]);
445 else layer[1][n1].getBarrelDetElements(par_startingPoint, searchDirection, lDE, roadMakerData.elementUsageTracker[1][n1]);
446 }
448 } else {
449 for (--n1; n1>=0; --n1) {
451 if (par_targetPoint[3] > layer[1][n1].r()+dr) break;
452 assert( roadMakerData.elementUsageTracker[1].size() > static_cast<unsigned int>(n1) );
454 if(m_ITkGeometry) layer[1][n1].getITkBarrelDetElements(par_startingPoint, searchDirection, lDE, roadMakerData.elementUsageTracker[1][n1]);
455 else layer[1][n1].getBarrelDetElements(par_startingPoint, searchDirection, lDE, roadMakerData.elementUsageTracker[1][n1]);
456
457 }
458 ++n1;
459 }
460
463 if (par_targetPoint[2]>par_startingPoint[2]) {
464 for (; n2<static_cast<int>(layer[2].size()); ++n2) {
465 if (par_targetPoint[2] < layer[2][n2].z()) break;
466 assert( roadMakerData.elementUsageTracker[2].size() > static_cast<unsigned int>(n2) );
468 if(m_ITkGeometry) layer[2][n2].getITkEndcapDetElements(par_startingPoint, searchDirection, lDE,roadMakerData.elementUsageTracker[2][n2]);
469 else layer[2][n2].getEndcapDetElements(par_startingPoint, searchDirection, lDE,roadMakerData.elementUsageTracker[2][n2]);
470 }
471 } else {
472 for (--n2; n2>=0; --n2) {
473 if (par_targetPoint[2] > layer[2][n2].z()) break;
474 assert( roadMakerData.elementUsageTracker[2].size() > static_cast<unsigned int>(n2) );
476 if(m_ITkGeometry) layer[2][n2].getITkEndcapDetElements(par_startingPoint, searchDirection, lDE, roadMakerData.elementUsageTracker[2][n2]);
477 else layer[2][n2].getEndcapDetElements(par_startingPoint, searchDirection, lDE, roadMakerData.elementUsageTracker[2][n2]);
478 }
479 ++n2;
480 }
481
484 if (par_targetPoint[2]<par_startingPoint[2]) {
485 for (; n0<static_cast<int>(layer[0].size()); ++n0) {
486 if (par_targetPoint[2] > layer[0][n0].z()) break;
487 assert( roadMakerData.elementUsageTracker[0].size() > static_cast<unsigned int>(n0) );
489 if(m_ITkGeometry) layer[0][n0].getITkEndcapDetElements(par_startingPoint, searchDirection, lDE,roadMakerData.elementUsageTracker[0][n0]);
490 else layer[0][n0].getEndcapDetElements(par_startingPoint, searchDirection, lDE,roadMakerData.elementUsageTracker[0][n0]);
491 }
492 } else {
493 for (--n0; n0>=0; --n0) {
494 if (par_targetPoint[2] < layer[0][n0].z()) break;
495 assert( roadMakerData.elementUsageTracker[0].size() > static_cast<unsigned int>(n0) );
497 if(m_ITkGeometry) layer[0][n0].getITkEndcapDetElements(par_startingPoint, searchDirection, lDE,roadMakerData.elementUsageTracker[0][n0]);
498 else layer[0][n0].getEndcapDetElements(par_startingPoint, searchDirection, lDE,roadMakerData.elementUsageTracker[0][n0]);
499 }
500 ++n0;
501 }
503 par_startingPoint[0] = par_targetPoint[0];
504 par_startingPoint[1] = par_targetPoint[1];
505 par_startingPoint[2] = par_targetPoint[2];
506 par_startingPoint[3] = par_targetPoint[3];
508 par_startingPoint[5]+= dist3D;
509 }
510 auto vec2 = lDE;
511 std::sort(lDE.begin(),lDE.end(),InDet::compDetElementWays());
512 // Fill pointers to detector elements
513 Road.reserve(lDE.size());
514 for (auto & d : lDE){
515 if (testDirection && d.way() < 0) {continue;}
516 Road.push_back(d.link()->detElement());
517 }
518}
const SiDetElementsLayerVectors_xk * getLayers(const EventContext &ctx) const
static void bookUsageTracker(InDet::SiDetElementRoadMakerData_xk &data, const SiDetElementsLayerVectors_xk &layers)
this method is used to initialize the detector element usage tracker member of the event data struct ...
std::vector< D3PDTest::MyVec2 > vec2
@ layer
Definition HitInfo.h:79

◆ dump() [1/2]

MsgStream & InDet::SiDetElementsRoadMaker_xk::dump ( MsgStream & out) const
override

Definition at line 93 of file SiDetElementsRoadMaker_xk.cxx.

94{
95 out<<"\n";
96 return dumpConditions(out);
97}
MsgStream & dumpConditions(MsgStream &out) const

◆ dump() [2/2]

std::ostream & InDet::SiDetElementsRoadMaker_xk::dump ( std::ostream & out) const
override

Definition at line 275 of file SiDetElementsRoadMaker_xk.cxx.

276{
277 return out;
278}

◆ dumpConditions()

MsgStream & InDet::SiDetElementsRoadMaker_xk::dumpConditions ( MsgStream & out) const
private

Definition at line 103 of file SiDetElementsRoadMaker_xk.cxx.

104{
105 int n = 62-m_proptool.type().size();
106 std::string s1;
107 for (int i=0; i<n; ++i) s1.append(" ");
108 s1.append("|");
109
110 std::string fieldmode[9] = {"NoField" , "ConstantField", "SolenoidalField",
111 "ToroidalField" , "Grid3DField" , "RealisticField" ,
112 "UndefinedField", "AthenaField" , "?????" };
113
115
116 SG::ReadCondHandle<AtlasFieldCacheCondObj> fieldHandle(m_fieldCondObjInputKey);
117 const AtlasFieldCacheCondObj* fieldCondObj(*fieldHandle);
118 if (fieldCondObj) {
119 MagField::AtlasFieldCache fieldCache;
120 fieldCondObj->getInitializedCache(fieldCache);
121 if (!fieldCache.solenoidOn()) fieldModeEnum = Trk::NoField;
122 }
123
124 Trk::MagneticFieldProperties fieldprop(fieldModeEnum);
125
126 int mode = fieldprop.magneticFieldMode();
127 if (mode<0 || mode>8) mode = 8;
128
129 n = 62-fieldmode[mode].size();
130 std::string s3;
131 for (int i=0; i<n; ++i) s3.append(" ");
132 s3.append("|");
133
134 n = 62-m_sct.size();
135 std::string s5;
136 for (int i=0; i<n; ++i) s5.append(" ");
137 s5.append("|");
138
139 n = 62-m_pix.size();
140 std::string s6;
141 for (int i=0; i<n; ++i) s6.append(" ");
142 s6.append("|");
143
144 const EventContext& ctx = Gaudi::Hive::currentContext();
145
146 const SiDetElementsLayerVectors_xk &layer = *getLayers(ctx);
147
148 int maps = 0;
149 if (!layer[0].empty()) ++maps;
150 if (!layer[1].empty()) ++maps;
151 if (!layer[2].empty()) ++maps;
152 out<<"|----------------------------------------------------------------------"
153 <<"-------------------|"
154 <<"\n";
155 if (m_useSCT) {
156 out<<"| SCT detector manager | "<<m_sct <<s5<<"\n";
157 }
158 if (m_usePIX) {
159 out<<"| Pixel detector manager | "<<m_pix <<s6<<"\n";
160 }
161 out<<"| Tool for propagation | "<<m_proptool.type() <<s1<<"\n";
162 out<<"| Magnetic field mode | "<<fieldmode[mode] <<s3<<"\n";
163 out<<"| Width of the road (mm) | "
164 <<std::setw(12)<<std::setprecision(5)<<m_width
165 <<" |"<<"\n";
166 out<<"|----------------------------------------------------------------------"
167 <<"-------------------|"
168 <<"\n";
169
170 if (!maps || m_outputlevel==0) return out;
171
172 if (!layer[1].empty()) {
173 int nl = layer[1].size();
174 int nc = 0;
175 for (const auto & i : layer[1]) nc+=i.nElements();
176 out<<"|----------------------------------------------------------------|"
177 <<"\n";
178 out<<"| Barrel map contains "
179 <<std::setw(3)<<nl<<" layers and"
180 <<std::setw(5)<<nc<<" elements |"
181 <<"\n";
182 out<<"|------|-----------|------------|------------|------------|------|"
183 <<"\n";
184 out<<"| n | R | Z min | Z max | max dF | nEl |"
185 <<"\n";
186 out<<"|------|-----------|------------|------------|------------|------|"
187 <<"\n";
188 for (unsigned int i=0; i!=layer[1].size(); ++i) {
189 double zmin = layer[1].at(i).z()-layer[1].at(i).dz();
190 double zmax = layer[1].at(i).z()+layer[1].at(i).dz();
191 out<<"| "
192 <<std::setw(4)<<i<<" |"
193 <<std::setw(10)<<std::setprecision(4)<< layer[1].at(i).r ()<<" | "
194 <<std::setw(10)<<std::setprecision(4)<< zmin<<" | "
195 <<std::setw(10)<<std::setprecision(4)<< zmax<<" | "
196 <<std::setw(10)<<std::setprecision(4)<< layer[1].at(i).dfe()<<" | "
197 <<std::setw(4)<<layer[1].at(i).nElements()<<" | "
198 <<"\n";
199 }
200 out<<"|------|-----------|------------|------------|------------|------|"
201 <<"\n";
202
203 }
204 if (!layer[0].empty()) {
205 int nl = layer[0].size();
206 int nc = 0;
207 for (const auto & i : layer[0]) nc+=i.nElements();
208 out<<"|----------------------------------------------------------------|"
209 <<"\n";
210 out<<"| L.Endcap map contains"
211 <<std::setw(3)<<nl<<" layers and"
212 <<std::setw(5)<<nc<<" elements |"
213 <<"\n";
214
215 out<<"|------|-----------|------------|------------|------------|------|"
216 <<"\n";
217 out<<"| n | Z | R min | R max | max dF | nEl |"
218 <<"\n";
219 out<<"|------|-----------|------------|------------|------------|------|"
220 <<"\n";
221 for (unsigned int i=0; i!=layer[0].size(); ++i) {
222 double rmin = layer[0].at(i).r()-layer[0].at(i).dr();
223 double rmax = layer[0].at(i).r()+layer[0].at(i).dr();
224 out<<"| "
225 <<std::setw(4)<<i<<" |"
226 <<std::setw(10)<<std::setprecision(4)<< layer[0].at(i).z()<<" | "
227 <<std::setw(10)<<std::setprecision(4)<< rmin<<" | "
228 <<std::setw(10)<<std::setprecision(4)<< rmax<<" | "
229 <<std::setw(10)<<std::setprecision(4)<<layer[0].at(i).dfe()<<" | "
230 <<std::setw(4)<<layer[0].at(i).nElements()<<" | "
231 <<"\n";
232 }
233 out<<"|------|-----------|------------|------------|------------|------|"
234 <<"\n";
235 }
236 if (!layer[2].empty()) {
237 int nl = layer[2].size();
238 int nc = 0;
239 for (const auto & i : layer[2]) nc+=i.nElements();
240 out<<"|----------------------------------------------------------------|"
241 <<"\n";
242 out<<"| R.Endcap map contains"
243 <<std::setw(3)<<nl<<" layers and"
244 <<std::setw(5)<<nc<<" elements |"
245 <<"\n";
246 out<<"|------|-----------|------------|------------|------------|------|"
247 <<"\n";
248 out<<"| n | Z | R min | R max | max dF | nEl |"
249 <<"\n";
250 out<<"|------|-----------|------------|------------|------------|------|"
251 <<"\n";
252 for (unsigned int i=0; i!=layer[2].size(); ++i) {
253 double rmin = layer[2].at(i).r()-layer[2].at(i).dr();
254 double rmax = layer[2].at(i).r()+layer[2].at(i).dr();
255 out<<"| "
256 <<std::setw(4)<<i<<" |"
257 <<std::setw(10)<<std::setprecision(4)<< layer[2].at(i).z()<<" | "
258 <<std::setw(10)<<std::setprecision(4)<< rmin<<" | "
259 <<std::setw(10)<<std::setprecision(4)<< rmax<<" | "
260 <<std::setw(10)<<std::setprecision(4)<<layer[2].at(i).dfe()<<" | "
261 <<std::setw(4)<<layer[2].at(i).nElements()<<" | "
262 <<"\n";
263 }
264 out<<"|------|-----------|------------|------------|------------|------|"
265 <<"\n";
266 }
267 out<<"\n";
268 return out;
269}
static const Attributes_t empty
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey

◆ finalize()

StatusCode InDet::SiDetElementsRoadMaker_xk::finalize ( )
overridevirtual

Definition at line 83 of file SiDetElementsRoadMaker_xk.cxx.

84{
85 return StatusCode::SUCCESS;
86}

◆ getBound()

Trk::CylinderBounds InDet::SiDetElementsRoadMaker_xk::getBound ( MagField::AtlasFieldCache & fieldCache,
const Trk::TrackParameters & Tp ) const
private

Definition at line 774 of file SiDetElementsRoadMaker_xk.cxx.

777{
778 const double cor = 1.;
779
780 double zfield = 0.;
781 if (m_fieldModeEnum!=Trk::NoField && fieldCache.solenoidOn()) {
782 const Amg::Vector3D& pos = Tp.position();
783 double f[3], p[3] = {pos[Amg::x], pos[Amg::y], pos[Amg::z]};
784
785 fieldCache.getFieldZR(p, f);
786
787 zfield = 299.7925*f[2];
788 }
789
790 if (fabs(zfield) < .0000001) return m_bounds;
791
792 const AmgVector(5)& Vp = Tp.parameters();
793
794 double cur = zfield*Vp[4]/sin(Vp[3]);
795
796 if (fabs(cur)*m_bounds.r() < cor) return m_bounds;
797
798 double rad = 1./cur;
799 if (cor*fabs(rad) > m_bounds.r() ) return m_bounds;
800
801 const Amg::Vector3D& Gp = Tp.position();
802
803 double S, C;
804 sincos(Vp[2], &S, &C);
805
806 double xc = Gp.x()+S*rad;
807 double yc = Gp.y()-C*rad;
808 double rm = (sqrt(xc*xc+yc*yc)+fabs(rad))*cor;
809 if (rm > m_bounds.r()) return m_bounds;
810 Trk::CylinderBounds CB(rm, m_bounds.halflengthZ());
811 return CB;
812}
#define AmgVector(rows)
void getFieldZR(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field valaue on the z-r plane at given position works only inside the solenoid.
struct color C
Eigen::Matrix< double, 3, 1 > Vector3D

◆ getLayers()

const SiDetElementsLayerVectors_xk * InDet::SiDetElementsRoadMaker_xk::getLayers ( const EventContext & ctx) const
inlineprivate

Definition at line 181 of file SiDetElementsRoadMaker_xk.h.

181 {
182 SG::ReadCondHandle<SiDetElementsLayerVectors_xk> layerVec(m_layerVecKey,ctx);
183 if (not layerVec.isValid()) {
184 ATH_MSG_ERROR("Failed to get " << m_layerVecKey.key());
185 }
186 return layerVec.cptr();
187 }
#define ATH_MSG_ERROR(x)
SG::ReadCondHandleKey< SiDetElementsLayerVectors_xk > m_layerVecKey
Created by SiDetElementsRoadCondAlg_xk.

◆ initialize()

StatusCode InDet::SiDetElementsRoadMaker_xk::initialize ( )
overridevirtual

Definition at line 44 of file SiDetElementsRoadMaker_xk.cxx.

45{
46 //Class optimization checks
47 static_assert(std::is_trivially_copyable<SiDetElementLink_xk::ElementWay>::value);
48 static_assert(std::is_trivially_destructible<SiDetElementLink_xk::ElementWay>::value);
49 static_assert(std::is_trivially_copyable<SiDetElementLink_xk>::value);
50 static_assert(std::is_trivially_destructible<SiDetElementLink_xk>::value);
51 static_assert(std::is_nothrow_move_constructible<SiDetElementsLayer_xk>::value);
52
53
54 if (!m_usePIX && !m_useSCT) {
55 ATH_MSG_FATAL("Please don't call this tool if usePixel and useSCT are false");
56 return StatusCode::FAILURE;
57 }
58
59 if (m_fieldmode == "NoField") m_fieldModeEnum = Trk::NoField;
60 else if (m_fieldmode == "MapSolenoid") m_fieldModeEnum = Trk::FastField;
62
63 // Get propagator tool
64 //
65 ATH_CHECK(m_proptool.retrieve());
66
67 // Get output print level
68 //
69 m_outputlevel = msg().level()-MSG::DEBUG;
70
72
73 ATH_CHECK(m_layerVecKey.initialize());
75
76 return StatusCode::SUCCESS;
77}
#define ATH_CHECK
Evaluate an expression and check for errors.
@ FastField
call the fast field access method of the FieldSvc
@ FullField
Field is set to be realistic, but within a given Volume.
MsgStream & msg
Definition testRead.cxx:32

◆ stepToDetElement()

float InDet::SiDetElementsRoadMaker_xk::stepToDetElement ( const InDetDD::SiDetectorElement *& de,
Amg::Vector3D & r,
Amg::Vector3D & a )
staticprivate

Definition at line 760 of file SiDetElementsRoadMaker_xk.cxx.

762{
763 Amg::Vector3D R = de->center();
764 Amg::Vector3D A = de->normal();
765 double D = a.x()*A.x()+a.y()*A.y()+a.z()*A.z();
766 if (D==0.) return static_cast<float>(D);
767 return static_cast<float>((A.x()*(R.x()-r.x())+A.y()*(R.y()-r.y())+A.z()*(R.z()-r.z()))/D);
768}
static Double_t a
virtual const Amg::Vector3D & normal() const override final
Get reconstruction local normal axes in global frame.
virtual const Amg::Vector3D & center() const override final
Center in global coordinates.
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)

Member Data Documentation

◆ m_bounds

Trk::CylinderBounds InDet::SiDetElementsRoadMaker_xk::m_bounds {}
private

Definition at line 162 of file SiDetElementsRoadMaker_xk.h.

162{};

◆ m_fieldCondObjInputKey

SG::ReadCondHandleKey<AtlasFieldCacheCondObj> InDet::SiDetElementsRoadMaker_xk::m_fieldCondObjInputKey
private
Initial value:
{this, "AtlasFieldCacheCondObj", "fieldCondObj",
"Name of the Magnetic Field conditions object key"}

Definition at line 144 of file SiDetElementsRoadMaker_xk.h.

144 {this, "AtlasFieldCacheCondObj", "fieldCondObj",
145 "Name of the Magnetic Field conditions object key"}; // Necessary only for dumpConditions method

◆ m_fieldmode

StringProperty InDet::SiDetElementsRoadMaker_xk::m_fieldmode {this, "MagneticFieldMode", "MapSolenoid", "Mode of magnetic field"}
private

Definition at line 156 of file SiDetElementsRoadMaker_xk.h.

156{this, "MagneticFieldMode", "MapSolenoid", "Mode of magnetic field"};

◆ m_fieldModeEnum

Trk::MagneticFieldMode InDet::SiDetElementsRoadMaker_xk::m_fieldModeEnum {Trk::FullField}
private

Definition at line 163 of file SiDetElementsRoadMaker_xk.h.

◆ m_ITkGeometry

BooleanProperty InDet::SiDetElementsRoadMaker_xk::m_ITkGeometry {this, "ITkGeometry", false}
private

Definition at line 157 of file SiDetElementsRoadMaker_xk.h.

157{this, "ITkGeometry", false};

◆ m_layerVecKey

SG::ReadCondHandleKey<SiDetElementsLayerVectors_xk> InDet::SiDetElementsRoadMaker_xk::m_layerVecKey
private
Initial value:
{this, "LayerVecKey",
"SiDetElementsLayerVectors_xk", "Key of SiDetElementsLayerVectors_xk"}

Created by SiDetElementsRoadCondAlg_xk.

Definition at line 141 of file SiDetElementsRoadMaker_xk.h.

141 {this, "LayerVecKey",
142 "SiDetElementsLayerVectors_xk", "Key of SiDetElementsLayerVectors_xk"};

◆ m_outputlevel

int InDet::SiDetElementsRoadMaker_xk::m_outputlevel {}
private

Definition at line 164 of file SiDetElementsRoadMaker_xk.h.

164{};

◆ m_pix

StringProperty InDet::SiDetElementsRoadMaker_xk::m_pix {this, "PixManagerLocation", "Pixel", "PIX manager location"}
private

Definition at line 154 of file SiDetElementsRoadMaker_xk.h.

154{this, "PixManagerLocation", "Pixel", "PIX manager location"};

◆ m_proptool

PublicToolHandle<Trk::IPropagator> InDet::SiDetElementsRoadMaker_xk::m_proptool
private
Initial value:
{this, "PropagatorTool",
"Trk::RungeKuttaPropagator/InDetPropagator", "Propagator tool"}

Definition at line 135 of file SiDetElementsRoadMaker_xk.h.

135 {this, "PropagatorTool",
136 "Trk::RungeKuttaPropagator/InDetPropagator", "Propagator tool"};

◆ m_sct

StringProperty InDet::SiDetElementsRoadMaker_xk::m_sct {this, "SCTManagerLocation", "SCT", "SCT manager location"}
private

Definition at line 155 of file SiDetElementsRoadMaker_xk.h.

155{this, "SCTManagerLocation", "SCT", "SCT manager location"};

◆ m_step

DoubleProperty InDet::SiDetElementsRoadMaker_xk::m_step {this, "MaxStep", 40., "Max step allowed"}
private

Definition at line 153 of file SiDetElementsRoadMaker_xk.h.

153{this, "MaxStep", 40., "Max step allowed"};

◆ m_usePIX

BooleanProperty InDet::SiDetElementsRoadMaker_xk::m_usePIX {this, "usePixel", true}
private

Definition at line 150 of file SiDetElementsRoadMaker_xk.h.

150{this, "usePixel", true};

◆ m_useSCT

BooleanProperty InDet::SiDetElementsRoadMaker_xk::m_useSCT {this, "useSCT", true}
private

Definition at line 151 of file SiDetElementsRoadMaker_xk.h.

151{this, "useSCT", true};

◆ m_width

FloatProperty InDet::SiDetElementsRoadMaker_xk::m_width {this, "RoadWidth", 20., "Width of the road"}
private

Definition at line 152 of file SiDetElementsRoadMaker_xk.h.

152{this, "RoadWidth", 20., "Width of the road"};

The documentation for this class was generated from the following files: