ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::TrackingVolumeHelper Class Reference

The TrackingVolumeHelper is a simple Tool that helps to construct volumes mainly for gap regions in the fully connective geometry. More...

#include <TrackingVolumeHelper.h>

Inheritance diagram for Trk::TrackingVolumeHelper:
Collaboration diagram for Trk::TrackingVolumeHelper:

Public Member Functions

 TrackingVolumeHelper (const std::string &, const std::string &, const IInterface *)
 Constructor.
virtual ~TrackingVolumeHelper ()
 Destructor.
StatusCode initialize () override
 AlgTool initialize method.
void glueTrackingVolumes (TrackingVolume &firstVol, BoundarySurfaceFace firstFace, TrackingVolume &secondVol, BoundarySurfaceFace secondFace, bool buildBoundaryLayer=false) const override
 Method to glue two Volumes together input:
void glueTrackingVolumes (TrackingVolume &firstVol, BoundarySurfaceFace firstFace, const std::vector< TrackingVolume * > &secondVolumes, BoundarySurfaceFace secondFace, bool buildBoundaryLayer=false, bool boundaryFaceExchange=false) const override
 Method to glue two Volumes together input:
void glueTrackingVolumes (const std::vector< TrackingVolume * > &firstVolumes, BoundarySurfaceFace firstFace, const std::vector< TrackingVolume * > &secondVolumes, BoundarySurfaceFace secondFace, bool buildBoundaryLayer=false, bool boundaryFaceExchange=false) const override
 Method to glue two VolumeArrays together (at navigation level) - without output.
std::unique_ptr< Trk::TrackingVolumeglueTrackingVolumeArrays (std::shared_ptr< TrackingVolume > firstVol, BoundarySurfaceFace firstFace, std::shared_ptr< TrackingVolume > secondVol, BoundarySurfaceFace secondFace, const std::string &name) const override
 Method to glue two VolumeArrays together (at navigation level)
void setInsideTrackingVolume (TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *insidevol) const override
 protected method to set inside Volume of a BoundarySurface: input:
void setInsideTrackingVolumeArray (TrackingVolume &tvol, BoundarySurfaceFace face, std::shared_ptr< BinnedArray< TrackingVolume > > insidevolarray) const override
 protected method to set inside VolumeArray of a BoundarySurface: input:
void setOutsideTrackingVolume (TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *outsidevol) const override
 protected method to set outside Volume of a BoundarySurface: input:
void setOutsideTrackingVolumeArray (TrackingVolume &tvol, BoundarySurfaceFace face, std::shared_ptr< BinnedArray< TrackingVolume > > outsidevolarray) const override
 protected method to set outside VolumeArray of a BoundarySurface: input:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
 DeclareInterfaceID (ITrackingVolumeHelper, 1, 0)
 Creates the InterfaceID and interfaceID() method.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.
void glueVolumes (TrackingVolume &firstVol, BoundarySurfaceFace firstFace, TrackingVolume &secondVol, BoundarySurfaceFace secondFace) const
 protected method to glue two Volumes together input:
void associateLayer (const Layer &lay, Surface &sf) const
 Protected method to register the Layer to the Surface.

Static Protected Member Functions

static void setBoundarySurface (TrackingVolume &tvol, std::shared_ptr< BoundarySurface< TrackingVolume > > bsurf, BoundarySurfaceFace face)
 protected method to set the boundary surface of a tracking volume
static void setInsideVolume (TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *insidevol)
 protected method to set inside Volume of a BoundarySurface: input:
static void setInsideVolumeArray (TrackingVolume &tvol, BoundarySurfaceFace face, const std::shared_ptr< BinnedArray< TrackingVolume > > &insidevolarray)
 protected method to set inside VolumeArray of a BoundarySurface: input:
static void setOutsideVolume (TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *outsidevol)
 protected method to set outside Volume of a BoundarySurface: input:
static void setOutsideVolumeArray (TrackingVolume &tvol, BoundarySurfaceFace face, const std::shared_ptr< BinnedArray< TrackingVolume > > &outsidevolarray)
 protected method to set outside VolumeArray of a BoundarySurface: input:
static void confineVolume (TrackingVolume &tvol, TrackingVolume *outsidevol)
 protected method to confine (dense) volumes: input:

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::unique_ptr< Trk::LayerMaterialPropertieslayerMaterialProperties (const Trk::Surface &sf) const
 < helper method to construct barrel material
void glueTrackingVolumes (const std::vector< std::shared_ptr< TrackingVolume > > &glueVols, BoundarySurfaceFace glueFace, BoundarySurfaceFace secondFace) const
 Execute the glueing - the input volumes are all on navigation level.
void glueTrackingVolumes (const std::vector< TrackingVolume * > &glueVols, BoundarySurfaceFace glueFace, BoundarySurfaceFace secondFace) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static void fillGlueVolumes (const std::vector< TrackingVolume * > &topLevelVolumes, const std::vector< TrackingVolume * > &envelopeFaceVolumes, BoundarySurfaceFace glueFace, std::vector< Trk::TrackingVolume * > &glueVols)
 Private method - it takes the full vector of given volumes to create the supervolume,.
static void fillGlueVolumes (const std::vector< std::shared_ptr< TrackingVolume > > &topLevelVolumes, const std::vector< std::shared_ptr< TrackingVolume > > &envelopeFaceVolumes, BoundarySurfaceFace glueFace, std::vector< Trk::TrackingVolume * > &glueVols)

Private Attributes

PublicToolHandle< ILayerArrayCreatorm_layerArrayCreator {this, "LayerArrayCreator", "Trk::LayerArrayCreator/LayerArrayCreator"}
 A Tool for coherent LayerArray creation.
ToolHandle< ITrackingVolumeArrayCreatorm_trackingVolumeArrayCreator {this, "TrackingVolumeArrayCreator", "Trk::TrackingVolumeArrayCreator/TrackingVolumeArrayCreator"}
 Helper Tool to create TrackingVolume.
Gaudi::Property< int > m_barrelLayerBinsZ {this, "BarrelLayerBinsZ", 1}
 material bins in Z
Gaudi::Property< int > m_barrelLayerBinsPhi {this, "BarrelLayerBinsPhi", 1}
 material bins in Phi
Gaudi::Property< int > m_endcapLayerBinsR {this, "EndcapLayerBinsR", 1}
 material bins in R
Gaudi::Property< int > m_endcapLayerBinsPhi {this, "EndcapLayerBinsPhi", 1}
 material bins in Phi
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Static Private Attributes

static constexpr double s_layerThickness
 standard layer thickness

Detailed Description

The TrackingVolumeHelper is a simple Tool that helps to construct volumes mainly for gap regions in the fully connective geometry.

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch

Definition at line 53 of file TrackingVolumeHelper.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TrackingVolumeHelper()

Trk::TrackingVolumeHelper::TrackingVolumeHelper ( const std::string & t,
const std::string & n,
const IInterface * p )

Constructor.

Definition at line 50 of file TrackingVolumeHelper.cxx.

51: AthAlgTool(t,n,p),
53 declareInterface<ITrackingVolumeHelper>(this);
54}
AthAlgTool()
Default constructor:

◆ ~TrackingVolumeHelper()

Trk::TrackingVolumeHelper::~TrackingVolumeHelper ( )
virtualdefault

Destructor.

Member Function Documentation

◆ associateLayer()

void Trk::ITrackingVolumeHelper::associateLayer ( const Layer & lay,
Surface & sf ) const
inlineprotectedinherited

Protected method to register the Layer to the Surface.

Definition at line 127 of file ITrackingVolumeHelper.h.

128 {
129 sf.associateLayer(lay);
130 }

◆ confineVolume()

void Trk::TrackingVolumeManipulator::confineVolume ( TrackingVolume & tvol,
TrackingVolume * outsidevol )
staticprotectedinherited

protected method to confine (dense) volumes: input:

  • the volume that holdes the BoundarySurfaces (embedded)
  • the volume to be set as outside volume

Definition at line 90 of file TrackingVolumeManipulator.cxx.

92{
93
94 const auto& bounds = tvol.boundarySurfaces();
95 for (const auto & bound : bounds) {
96 if (bound->outsideVolume() == nullptr) {
97 bound->setOutsideVolume(outsideVol);
98 }
99 if (bound->insideVolume() == nullptr) {
100 bound->setInsideVolume(outsideVol);
101 }
102 }
103}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ DeclareInterfaceID()

Trk::ITrackingVolumeHelper::DeclareInterfaceID ( ITrackingVolumeHelper ,
1 ,
0  )
inherited

Creates the InterfaceID and interfaceID() method.

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ fillGlueVolumes() [1/2]

void Trk::TrackingVolumeHelper::fillGlueVolumes ( const std::vector< std::shared_ptr< TrackingVolume > > & topLevelVolumes,
const std::vector< std::shared_ptr< TrackingVolume > > & envelopeFaceVolumes,
BoundarySurfaceFace glueFace,
std::vector< Trk::TrackingVolume * > & glueVols )
staticprivate

Definition at line 556 of file TrackingVolumeHelper.cxx.

559 {
560 std::vector<std::shared_ptr<TrackingVolume>> sharedTops{};
561 std::vector<std::shared_ptr<TrackingVolume>> sharedFaces{};
562 return fillGlueVolumes(::toRawVec(topLevelVolumes),
563 ::toRawVec(envelopeFaceVolumes),
564 glueFace, glueVols);
565
566}
static void fillGlueVolumes(const std::vector< TrackingVolume * > &topLevelVolumes, const std::vector< TrackingVolume * > &envelopeFaceVolumes, BoundarySurfaceFace glueFace, std::vector< Trk::TrackingVolume * > &glueVols)
Private method - it takes the full vector of given volumes to create the supervolume,...

◆ fillGlueVolumes() [2/2]

void Trk::TrackingVolumeHelper::fillGlueVolumes ( const std::vector< TrackingVolume * > & topLevelVolumes,
const std::vector< TrackingVolume * > & envelopeFaceVolumes,
BoundarySurfaceFace glueFace,
std::vector< Trk::TrackingVolume * > & glueVols )
staticprivate

Private method - it takes the full vector of given volumes to create the supervolume,.

  • it compares the volumes with the ones scheduled to build the face (could probably be done at once)
  • it checks whether there is a sub-structure (i.e. GlueVolumeDescriptor exists) and adds either the volume itself or the associated subvolume
  • volumes on glueVols level are all on navigation level

Definition at line 567 of file TrackingVolumeHelper.cxx.

570 {
571 // loop over the topLevel Volumes
572 auto refVolIter = topLevelVolumes.begin();
573 for ( ; refVolIter != topLevelVolumes.end(); ++refVolIter ) {
574 // loop over the faceVolumes
575 for (auto *envelopeFaceVolume : envelopeFaceVolumes){
576 // check whether this volume was assigned to on this face
577 if (envelopeFaceVolume==(*refVolIter)) {
578 // get the GlueVolumesDescriptor
579 GlueVolumesDescriptor& glueVolDescriptor = (*refVolIter)->glueVolumesDescriptor();
580 // if the size of glue volumes is 0 -> the referenceVolume is at navigation level
581 if ( (glueVolDescriptor.glueVolumes(glueFace)).empty()) {
582 glueVols.push_back(*refVolIter);
583 } else {
584 // fill all the sub-volumes described by the glueVolumeDescriptor
585 for (auto *isubNavVol : glueVolDescriptor.glueVolumes(glueFace))
586 glueVols.push_back( isubNavVol );
587 }
588 }
589 }// loop over envelopeFaceVolumes
590 } // loop over reference Volumes
591}

◆ glueTrackingVolumeArrays()

std::unique_ptr< TrackingVolume > Trk::TrackingVolumeHelper::glueTrackingVolumeArrays ( std::shared_ptr< TrackingVolume > firstVol,
BoundarySurfaceFace firstFace,
std::shared_ptr< TrackingVolume > secondVol,
BoundarySurfaceFace secondFace,
const std::string & name ) const
overridevirtual

Method to glue two VolumeArrays together (at navigation level)

  • relies on information from glueDescriptor input:
  • first TrackingVolume
  • face of the BoundarySurface of the first volume
  • second volume that gets glued to the first volume
  • face of the BoundarySurface of the second volume output:
    • returns enveloping TrackingVolume with glueDescription set for consequent gluing

— Necessary as friendship cannot be inherited: your father's friend isn't necessary yours —

Implements Trk::ITrackingVolumeHelper.

Definition at line 408 of file TrackingVolumeHelper.cxx.

412 {
413 std::unique_ptr<TrackingVolume> enclosingVolume{};
414
415 const auto *cyl1 = dynamic_cast<const CylinderVolumeBounds*>(&(firstVol->volumeBounds()));
416 const auto *cyl2 = dynamic_cast<const CylinderVolumeBounds*>(&(secondVol->volumeBounds()));
417
418 if (!cyl1 || !cyl2) {
419 ATH_MSG_ERROR( "TrackingVolumeHelper::glueTrackingVolumeArrays: input volumes not cylinders, return 0" );
420 return enclosingVolume;
421 }
422 if (cyl1->halfPhiSector()!= M_PI || cyl2->halfPhiSector()!= M_PI ) {
423 ATH_MSG_ERROR( "TrackingVolumeHelper::glueTrackingVolumeArrays: not coded for cylinder Phi sectors yet, return 0" );
424 return enclosingVolume;
425 }
426
427 // if the swap is required
428 BoundarySurfaceFace firstFaceCorr = firstFace;
429 BoundarySurfaceFace secondFaceCorr = secondFace;
430
431
432 // build volume envelope
433 std::vector<std::shared_ptr<TrackingVolume>> vols;
434 std::shared_ptr<CylinderVolumeBounds> envBounds{};
435 std::unique_ptr<Amg::Transform3D> envTransf{};
436 std::unique_ptr<BinnedArray<TrackingVolume>> subVols{};
437 vols.push_back(firstVol);
438 vols.push_back(secondVol);
439 std::vector<std::shared_ptr<TrackingVolume>> envGlueNegXY{};
440 std::vector<std::shared_ptr<TrackingVolume>> envGluePosXY{};
441 std::vector<std::shared_ptr<TrackingVolume>> envGlueOuter;
442 std::vector<std::shared_ptr<TrackingVolume>> envGlueInner{};
443
444 if (firstFace==positiveFaceXY) {
445 envBounds = std::make_shared<CylinderVolumeBounds>(cyl1->innerRadius(),
446 cyl1->outerRadius(),
447 cyl1->halflengthZ() + cyl2->halflengthZ());
448
449 const Amg::Vector3D center{firstVol->center()};
450 envTransf = std::make_unique<Amg::Transform3D>(Amg::getTranslate3D(center.x(),
451 center.y(),
452 center.z() + cyl2->halflengthZ()));
453
454 subVols = m_trackingVolumeArrayCreator->cylinderVolumesArrayInZ(vols, false);
455 envGlueNegXY.push_back(firstVol);
456 envGluePosXY.push_back(secondVol);
457 envGlueOuter = vols;
458 envGlueInner = vols;
459 } else if (firstFace==negativeFaceXY) {
460 envBounds = std::make_shared<CylinderVolumeBounds>(cyl1->innerRadius(),
461 cyl1->outerRadius(),
462 cyl1->halflengthZ()+cyl2->halflengthZ());
463 const Amg::Vector3D center{firstVol->center()};
464 envTransf = std::make_unique<Amg::Transform3D>(Amg::getTranslate3D(center.x(),
465 center.y(),
466 center.z() - cyl2->halflengthZ()));
467 envGlueNegXY.push_back(secondVol);
468 envGluePosXY.push_back(firstVol);
469 // revert vols
470 vols.clear();
471 vols.push_back(secondVol);
472 vols.push_back(firstVol);
473 // --- account for the swapping
474 firstFaceCorr = secondFace;
475 secondFaceCorr = firstFace;
476 //
477 subVols = m_trackingVolumeArrayCreator->cylinderVolumesArrayInZ(vols,false);
478 envGlueOuter = vols;
479 envGlueInner = vols;
480 } else if (firstFace==tubeInnerCover) {
481 if (secondFace==tubeOuterCover){
482 envBounds = std::make_shared<CylinderVolumeBounds>(cyl2->innerRadius(),
483 cyl1->outerRadius(),
484 cyl1->halflengthZ());
485 } else {
486 envBounds = std::make_shared<CylinderVolumeBounds>(cyl1->outerRadius(),
487 cyl1->halflengthZ());
488 }
489 if (!firstVol->transform().isApprox(Amg::Transform3D::Identity())) {
490 envTransf = std::make_unique<Amg::Transform3D>(Amg::getTranslate3D(firstVol->center()));
491 }
492 // revert vols
493 vols.clear();
494 vols.push_back(secondVol);
495 vols.push_back(firstVol);
496 // account for the swapping
497 firstFaceCorr = secondFace;
498 secondFaceCorr = firstFace;
499 //
500 subVols = m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(vols,false);
501 envGlueNegXY = vols;
502 envGluePosXY = vols;
503 envGlueOuter.push_back(firstVol);
504 envGlueInner.push_back(secondVol);
505 } else {
506 envBounds = std::make_shared<CylinderVolumeBounds>(cyl1->innerRadius(),
507 cyl2->outerRadius(),
508 cyl1->halflengthZ());
509 if(!firstVol->transform().isApprox(Amg::Transform3D::Identity())){
510 envTransf = std::make_unique<Amg::Transform3D>(Amg::getTranslate3D(firstVol->center()));
511 }
512 subVols = m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(vols, false);
513 envGlueNegXY = vols;
514 envGluePosXY = vols;
515 envGlueOuter.push_back(secondVol);
516 envGlueInner.push_back(firstVol);
517 // account for the swapping
518 firstFaceCorr = secondFace;
519 secondFaceCorr = firstFace;
520 }
521
522 // create the enveloping volume
523 enclosingVolume = std::make_unique<TrackingVolume>(std::move(envTransf),
524 envBounds,
525 *firstVol,
526 nullptr, std::move(subVols), name);
527
528 // ENVELOPE GLUE DESCRIPTION -----------------------------------------------------------------
529 // glue descriptors ---- they jump to the first one
530 GlueVolumesDescriptor& glueDescr = enclosingVolume->glueVolumesDescriptor();
531
532 // for the outside volumes, could be done in a loop as well, but will only save 4 lines
533 std::vector<TrackingVolume*> glueNegXY{};
534 std::vector<TrackingVolume*> gluePosXY{};
535 std::vector<TrackingVolume*> glueInner{};
536 std::vector<TrackingVolume*> glueOuter{};
537 fillGlueVolumes(vols, envGlueNegXY, negativeFaceXY,glueNegXY);
538 fillGlueVolumes(vols, envGluePosXY, positiveFaceXY,gluePosXY);
539 fillGlueVolumes(vols, envGlueInner, tubeInnerCover,glueInner);
540 fillGlueVolumes(vols, envGlueOuter, tubeOuterCover,glueOuter);
541 // set them to the envelopGlueDescriptor
542 glueDescr.registerGlueVolumes(negativeFaceXY, glueNegXY);
543 glueDescr.registerGlueVolumes(positiveFaceXY, gluePosXY);
544 glueDescr.registerGlueVolumes(tubeInnerCover, glueInner);
545 glueDescr.registerGlueVolumes(tubeOuterCover, glueOuter);
546 glueDescr.registerGlueVolumes(cylinderCover, glueOuter);
547
548 // INTERNAL GLUEING ---------------------------------------------------------------------------
549 glueTrackingVolumes(vols, firstFaceCorr, secondFaceCorr);
550
551 return enclosingVolume;
552}
#define M_PI
#define ATH_MSG_ERROR(x)
void glueTrackingVolumes(TrackingVolume &firstVol, BoundarySurfaceFace firstFace, TrackingVolume &secondVol, BoundarySurfaceFace secondFace, bool buildBoundaryLayer=false) const override
Method to glue two Volumes together input:
ToolHandle< ITrackingVolumeArrayCreator > m_trackingVolumeArrayCreator
Helper Tool to create TrackingVolume.
Amg::Transform3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis
Eigen::Matrix< double, 3, 1 > Vector3D
BoundarySurfaceFace
Enum to describe the position of the BoundarySurface respectively to the frame orientatin of the volu...

◆ glueTrackingVolumes() [1/5]

void Trk::TrackingVolumeHelper::glueTrackingVolumes ( const std::vector< std::shared_ptr< TrackingVolume > > & glueVols,
BoundarySurfaceFace glueFace,
BoundarySurfaceFace secondFace ) const
private

Execute the glueing - the input volumes are all on navigation level.

Definition at line 595 of file TrackingVolumeHelper.cxx.

597 {
598 glueTrackingVolumes(::toRawVec(glueVols), firstFace, secondFace);
599
600}

◆ glueTrackingVolumes() [2/5]

void Trk::TrackingVolumeHelper::glueTrackingVolumes ( const std::vector< TrackingVolume * > & firstVolumes,
BoundarySurfaceFace firstFace,
const std::vector< TrackingVolume * > & secondVolumes,
BoundarySurfaceFace secondFace,
bool buildBoundaryLayer = false,
bool boundaryFaceExchange = false ) const
overridevirtual

Method to glue two VolumeArrays together (at navigation level) - without output.

Simply forward to base class method to enhance friendship relation.

— Necessary as friendship cannot be inherited: your father's friend isn't necessary yours —

Implements Trk::ITrackingVolumeHelper.

Definition at line 190 of file TrackingVolumeHelper.cxx.

196{
197
198
199 std::unique_ptr<BinnedArray<TrackingVolume>> navArrayOne = nullptr;
200 std::unique_ptr<BinnedArray<TrackingVolume>> navArrayTwo = nullptr;
201
202 std::unique_ptr<Surface> mLayerSurface;
203 std::shared_ptr<MaterialLayer> mLayer;
204
205 ATH_MSG_VERBOSE("Glue configuration firstFace | secondFace = " << firstFace << " | " << secondFace );
206
207 // create the Arrays - assuming cylindrical TrackingVolumes
208 if (firstFace < 2 && secondFace < 2 ) {
209 ATH_MSG_VERBOSE( "The glueing is done along z axis" );
210 navArrayOne = m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(firstVolumes, true);
211 navArrayTwo = m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(secondVolumes, true);
212 // build a disc to separate the two
213 if (buildBoundaryLayer || boundaryFaceExchange){
214 double rmin = 10e10; double rmax = 0; double boundaryz = 0.; double centerzOne = 0.;
215 for (const auto & volIter : firstVolumes ){
216 const CylinderVolumeBounds* cb = dynamic_cast<const CylinderVolumeBounds*>(&(volIter->volumeBounds()));
217 if (cb) {
218 takeSmaller(rmin,cb->innerRadius());
219 takeBigger(rmax,cb->outerRadius());
220 // get the z of the surface
221 boundaryz = volIter->boundarySurfaces()[firstFace]->surfaceRepresentation().center().z();
222 }
223 centerzOne = volIter->center().z();
224 }
225 if (buildBoundaryLayer){
226 Amg::Transform3D mLayerTransform =
227 Amg::Transform3D(Amg::Translation3D(0., 0., boundaryz));
228 // layer surface
229 mLayerSurface = std::make_unique<DiscSurface>(mLayerTransform, rmin, rmax);
230 // create a MaterialLayer
231 std::unique_ptr<LayerMaterialProperties> lmps = layerMaterialProperties(*mLayerSurface);
232 // MaterialLayer clones the LayerMaterialPropteries.
233
234 if (lmps) {
235 mLayer = std::make_shared<MaterialLayerOwnSurf>(std::move(mLayerSurface), std::move(lmps));
236 }
237 }
238 if (boundaryFaceExchange){
239 // creating only one boundary surface
240 ATH_MSG_VERBOSE("Creating a joint boundary surface for n-to-n glueing case.");
241 // check if the seconf volumes have a bigger z value or a smaller one
242 double centerzTwo = secondVolumes[secondVolumes.size()-1]->center().z();
243 // thi sboundary surface is having a z-axix along the global z-axis
244 Amg::Transform3D boundaryTransform = Amg::getTranslateZ3D(boundaryz);
245 // disc surfaces
246 DiscSurface dSurface(boundaryTransform, rmin, rmax);
247 // swap if needed
248 if (centerzTwo < centerzOne){
249 std::swap(navArrayTwo, navArrayOne);
250 }
251 // create the new boudnary surface which spans over the entire volume border
252 std::shared_ptr< BinnedArray<TrackingVolume> > navArrayInside(std::move(navArrayOne));
253 std::shared_ptr< BinnedArray<TrackingVolume> > navArrayOutside(std::move(navArrayTwo));
254 BoundaryDiscSurface<TrackingVolume>* boundarySurface = new BoundaryDiscSurface<TrackingVolume>(navArrayInside,navArrayOutside,dSurface);
255 std::shared_ptr<BoundarySurface<TrackingVolume> > sharedBoundarySurface(boundarySurface);
256 // attach the material layer to the shared boundary if existing
257 if (mLayer) {
258 ATH_MSG_VERBOSE( "Set MaterialLayer to the BoundarySurface of volume from second array." );
259 boundarySurface->surfaceRepresentation().setMaterialLayer(mLayer);
260 }
261 // set the boundary surface to the volumes of both sides
262 for (const auto & volIter : firstVolumes){
263 ATH_MSG_VERBOSE(" -> first array : setting a newly created boundary surface to " << volIter->volumeName());
264 setBoundarySurface(*volIter,sharedBoundarySurface,firstFace);
265 }
266 for (const auto & volIter : secondVolumes){
267 ATH_MSG_VERBOSE(" -> second array : setting a newly created boundary surface to " << volIter->volumeName());
268 setBoundarySurface(*volIter,sharedBoundarySurface,secondFace);
269 }
270 // we are done here
271 return;
272 }
273 }
274 } else {
275 ATH_MSG_VERBOSE( "The glueing is done along the radius." );
276 navArrayOne = m_trackingVolumeArrayCreator->cylinderVolumesArrayInZ(firstVolumes, true);
277 navArrayTwo = m_trackingVolumeArrayCreator->cylinderVolumesArrayInZ(secondVolumes, true);
278 // check if the boundary layer was configured to be built
279 if (buildBoundaryLayer || boundaryFaceExchange){
280 // build a cylinder to separate the two
281 double zmin = 10e10; double zmax = -10e10; double boundaryr = 0.; double volumerOne = 0.; double volumerTwo = 10e10;
282 for (const auto & volIter : firstVolumes ){
283 const CylinderVolumeBounds* cb = dynamic_cast<const CylinderVolumeBounds*>(&(volIter->volumeBounds()));
284 if (cb) {
285 takeSmaller(zmin,volIter->center().z()-cb->halflengthZ());
286 takeBigger(zmax,volIter->center().z()+cb->halflengthZ());
287 // get the z of the surface
288 boundaryr = volIter->boundarySurfaces()[firstFace]->surfaceRepresentation().bounds().r();
289 // get the volume radius
290 volumerOne = cb->outerRadius();
291 }
292 }
293 // check if boundary layer should be built
294 if (buildBoundaryLayer){
295 std::unique_ptr<Amg::Transform3D> mLayerTransform =
296 ((zmin + zmax) * (zmin + zmax) < 10e-4)
297 ? nullptr
298 : std::make_unique < Amg::Transform3D>();
299
300 if (mLayerTransform) (*mLayerTransform) = Amg::Translation3D(0.,0.,0.5*(zmin+zmax));
301 mLayerSurface.reset( mLayerTransform ? new CylinderSurface(*mLayerTransform,boundaryr,0.5*(zmax-zmin)) :
302 new CylinderSurface(boundaryr,0.5*(zmax-zmin)) );
303 // create a MaterialLayer
304 std::unique_ptr<LayerMaterialProperties> lmps = layerMaterialProperties(*mLayerSurface);
305 // LayerMaterialProperties will be cloned in MaterialLayer
306 if (lmps) mLayer = std::make_shared<MaterialLayerOwnSurf>(
307 std::move(mLayerSurface),
308 std::move(lmps) );
309 }
310 // check if boundary face should be exchanged
311 if (boundaryFaceExchange) {
312 // creating only one boundary surface
313 ATH_MSG_VERBOSE("Creating a joint boundary surface for n-to-n glueing case.");
314 // the boundary transform can be 0 for cylinder surfaces
315 std::unique_ptr<Amg::Transform3D> boundaryTransform =
316 ((zmin + zmax) * (zmin + zmax) < 10e-4)
317 ? nullptr
318 : std::make_unique<Amg::Transform3D>();
319
320 if (boundaryTransform) (*boundaryTransform) = Amg::getTranslateZ3D(0.5*(zmin+zmax));
321 // create the cylinder surface for the shared boundary
322 CylinderSurface cSurface = boundaryTransform ? CylinderSurface(*boundaryTransform,boundaryr,0.5*(zmax-zmin)) :
323 CylinderSurface(boundaryr,0.5*(zmax-zmin));
324 // get the volume outer radius of the sconf volumes
325 const CylinderVolumeBounds* cbTwo = dynamic_cast<const CylinderVolumeBounds*>(&(secondVolumes[secondVolumes.size()-1]->volumeBounds()));
326 if (cbTwo){
327 volumerTwo = cbTwo->outerRadius();
328 }
329 // swap if needed
330 if (volumerTwo < volumerOne){
331 std::swap(navArrayTwo, navArrayOne);
332 }
333 // create the new boudnary surface which spans over the entire volume border
334 std::shared_ptr< BinnedArray<TrackingVolume> > navArrayInside(std::move(navArrayOne));
335 std::shared_ptr< BinnedArray<TrackingVolume> > navArrayOutside(std::move(navArrayTwo));
336 BoundaryCylinderSurface<TrackingVolume>* boundarySurface = new BoundaryCylinderSurface<TrackingVolume>(navArrayInside,navArrayOutside,cSurface);
337 std::shared_ptr<BoundarySurface<TrackingVolume> > sharedBoundarySurface(boundarySurface);
338 // attach the material layer to the shared boundary if existing
339 if (mLayer) {
340 ATH_MSG_VERBOSE("Set MaterialLayer to the BoundarySurface of volume from second array.");
341 // assume that now the mlayer onwership goes over to the TrackingVolume
342 boundarySurface->surfaceRepresentation().setMaterialLayer(mLayer);
343 }
344 // set the boundary surface to the volumes of both sides
345 for (const auto & volIter : firstVolumes){
346 ATH_MSG_VERBOSE(" -> first array : setting a newly created boundary surface to " << volIter->volumeName());
347 setBoundarySurface(*volIter,sharedBoundarySurface,firstFace);
348 }
349 for (const auto & volIter : secondVolumes){
350 ATH_MSG_VERBOSE(" -> second array : setting a newly created boundary surface to " << volIter->volumeName());
351 setBoundarySurface(*volIter,sharedBoundarySurface,secondFace);
352 }
353 // we are done here
354 return;
355 }
356 } // build either boundary layer or exchange the face
357 } // radial glueing
358
359
360 // create the boundary faces - not creating a joint one
361 ATH_MSG_VERBOSE("Leaving individual boundary surfaces for n-to-n glueing case.");
362
363 // assign the navigation arrays
364 std::shared_ptr< BinnedArray< TrackingVolume> > navArrayOneShared(std::move(navArrayOne));
365 std::shared_ptr< BinnedArray< TrackingVolume> > navArrayTwoShared(std::move(navArrayTwo));
366
367 // (a) to the first set of volumes
368 for (const auto & tVolIter: firstVolumes) {
369 // take care of the orientation of the normal vector
370 if (firstFace != tubeInnerCover) {
371 setOutsideTrackingVolumeArray(*tVolIter,firstFace,navArrayTwoShared);
372 ATH_MSG_VERBOSE( "Set outsideTrackingVolumeArray at face " << firstFace << " to " << (*tVolIter).volumeName() );
373 } else {
374 setInsideTrackingVolumeArray(*tVolIter,firstFace,navArrayTwoShared);
375 ATH_MSG_VERBOSE( "Set insideTrackingVolumeArray at face " << firstFace << " to " << (*tVolIter).volumeName() );
376 }
377 // set the boundary layer if it exists
378 if (mLayer) {
379 ATH_MSG_VERBOSE( "Set MaterialLayer to the BoundarySurface of volume from first array." );
380 Surface& firstFaceSurface = tVolIter->boundarySurfaces()[firstFace]->surfaceRepresentation();
381 // assume that now the mlayer onwership goes over to the TrackingVolume
382 //cppcheck-suppress ignoredReturnValue
383 firstFaceSurface.setMaterialLayer(mLayer);
384 }
385
386 }
387 // (b) to the second set of volumes
388 for (const auto & tVolIter : secondVolumes) {
389 // take care of the orientation of the normal vector
390 if (secondFace != tubeInnerCover) {
391 ATH_MSG_VERBOSE( "Set outsideTrackingVolumeArray at face " << secondFace << " to " << (*tVolIter).volumeName() );
392 setOutsideTrackingVolumeArray(*tVolIter,secondFace,navArrayOneShared);
393 } else {
394 ATH_MSG_VERBOSE( "Set insideTrackingVolumeArray at face " << secondFace << " to " << (*tVolIter).volumeName() );
395 setInsideTrackingVolumeArray(*tVolIter,secondFace,navArrayOneShared);
396 }
397 if (mLayer) {
398 ATH_MSG_VERBOSE( "Set MaterialLayer to the BoundarySurface of volume from second array." );
399 Surface& secondFaceSurface = tVolIter->boundarySurfaces()[secondFace]->surfaceRepresentation();
400 // assume that now the mlayer onwership goes over to the TrackingVolume
401 //cppcheck-suppress ignoredReturnValue
402 secondFaceSurface.setMaterialLayer(mLayer);
403 }
404 }
405 // coverity will report a bug here for mLayer running out of scope, but the memory management is done later in the TrackingVolume
406}
#define ATH_MSG_VERBOSE(x)
Eigen::Affine3d Transform3D
#define takeSmaller(current, test)
#define takeBigger(current, test)
void setOutsideTrackingVolumeArray(TrackingVolume &tvol, BoundarySurfaceFace face, std::shared_ptr< BinnedArray< TrackingVolume > > outsidevolarray) const override
protected method to set outside VolumeArray of a BoundarySurface: input:
void setInsideTrackingVolumeArray(TrackingVolume &tvol, BoundarySurfaceFace face, std::shared_ptr< BinnedArray< TrackingVolume > > insidevolarray) const override
protected method to set inside VolumeArray of a BoundarySurface: input:
std::unique_ptr< Trk::LayerMaterialProperties > layerMaterialProperties(const Trk::Surface &sf) const
< helper method to construct barrel material
static void setBoundarySurface(TrackingVolume &tvol, std::shared_ptr< BoundarySurface< TrackingVolume > > bsurf, BoundarySurfaceFace face)
protected method to set the boundary surface of a tracking volume
Amg::Transform3D getTranslateZ3D(const double Z)
: Returns a shift transformation along the z-axis
Eigen::Affine3d Transform3D
Eigen::Translation< double, 3 > Translation3D
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)

◆ glueTrackingVolumes() [3/5]

void Trk::TrackingVolumeHelper::glueTrackingVolumes ( const std::vector< TrackingVolume * > & glueVols,
BoundarySurfaceFace glueFace,
BoundarySurfaceFace secondFace ) const
private

Definition at line 601 of file TrackingVolumeHelper.cxx.

603 {
604
605 if (glueVols.size()<2) {
606 ATH_MSG_VERBOSE( "Nothing to do in glueVolumes() " );
607 return;
608 }
609
610
611 ATH_MSG_VERBOSE( " glueTrackingVolumes() called with boundary faces " << static_cast<int>(firstFace)
612 << " and " << static_cast<int>(secondFace) << "." );
613
614 // the iterators through the volumes
615 std::vector<TrackingVolume*>::const_iterator firstVol = glueVols.begin();
616 std::vector<TrackingVolume*>::const_iterator secondVol = firstVol + 1;
617 for ( ; secondVol != glueVols.end(); ++firstVol, ++secondVol) {
618
619 if (msgLvl(MSG::VERBOSE))
620 ATH_MSG_VERBOSE( "Processing '" << (*firstVol)->volumeName() << "' and '" << (*secondVol)->volumeName() << "'." );
621
622 // get the glue volume descriptors to see that we have all subvolumes
623 GlueVolumesDescriptor& glueDescr1 = (*firstVol)->glueVolumesDescriptor();
624 GlueVolumesDescriptor& glueDescr2 = (*secondVol)->glueVolumesDescriptor();
625
626 // glue volumes at navigation level
627 std::vector<TrackingVolume*> glueVols1{};
628 std::vector<TrackingVolume*> glueVols2{};
629 glueVols1 = glueDescr1.glueVolumes(firstFace);
630 glueVols2 = glueDescr2.glueVolumes(secondFace);
631
632 // trivial cases
633 // (glue one to the other)
634 if (glueVols1.empty() && glueVols2.empty()) {
635 glueTrackingVolumes(**firstVol,firstFace,**secondVol,secondFace);
636 continue;
637 // (glue one to many)
638 } else if (glueVols1.empty() && !glueVols2.empty()) {
639 glueVols1.push_back(*firstVol);
640 // (glue the other one to many)
641 } else if (!glueVols1.empty() && glueVols2.empty()) {
642 glueVols2.push_back(*secondVol);
643 }
644
645 // non-trivial case :: array against array
646 // in Z : assume 2dim R/Phi
647 if (firstFace==negativeFaceXY || firstFace==positiveFaceXY ) {
648 // turn both vectors into R/Phi 2dim binnedArrays; assume equidistant binning in Phi
649 std::shared_ptr<BinnedArray<TrackingVolume>> sgv1{m_trackingVolumeArrayCreator->cylinderVolumesArrayInPhiR(glueVols1,true)};
650 std::shared_ptr<BinnedArray<TrackingVolume>> sgv2{m_trackingVolumeArrayCreator->cylinderVolumesArrayInPhiR(glueVols2,true)};
651
652 // array vs. array in Z
653 if (glueVols2.size()>1)
654 for (auto & vol : glueVols1) setOutsideTrackingVolumeArray( *vol, firstFace, sgv2 );
655 else
656 for (auto & vol : glueVols1) setOutsideTrackingVolume( *vol, firstFace, glueVols2[0] );
657
658 if (glueVols1.size()>1)
659 for (auto & vol : glueVols2) setOutsideTrackingVolumeArray( *vol, secondFace, sgv1 );
660 else
661 for (auto & vol : glueVols2) setOutsideTrackingVolume( *vol, secondFace, glueVols1[0] );
662
663
664 } else {
665 // turn both vectors into Z/Phi 2dim binnedArrays; assume equidistant binning in Phi
666 std::shared_ptr<BinnedArray<TrackingVolume>> sgv1{m_trackingVolumeArrayCreator->cylinderVolumesArrayInPhiZ(glueVols1,true)};
667 std::shared_ptr<BinnedArray<TrackingVolume>> sgv2{m_trackingVolumeArrayCreator->cylinderVolumesArrayInPhiZ(glueVols2,true)};
668
669 // the glue cases -----------------------------------------------------------------------------------
670 // handle the tube with care !
671 // first vol
672 for (auto & vol : glueVols1) {
673 // set the array as the outside array of the firstVol
674 if (firstFace != tubeInnerCover) {
675 if (glueVols2.size()>1)
676 setOutsideTrackingVolumeArray( *vol, firstFace, sgv2 );
677 else
678 setOutsideTrackingVolume( *vol, firstFace, glueVols2[0] );
679 } else {
680 if (glueVols2.size()>1){
681 setInsideTrackingVolumeArray( *vol, firstFace, sgv2 );
682 setOutsideTrackingVolume( *vol, firstFace, vol );
683 } else {
684 setInsideTrackingVolume( *vol, firstFace, glueVols2[0] );
685 setOutsideTrackingVolume( *vol, firstFace, vol );
686 }
687 }
688 }
689 // second
690 for (auto & vol : glueVols2) {
691 // set the array as the outside array of the secondVol
692 if (secondFace != tubeInnerCover)
693 setOutsideTrackingVolumeArray( *vol, secondFace, sgv1 );
694 else {
695 setInsideTrackingVolumeArray( *vol, secondFace, sgv1 );
696 setOutsideTrackingVolume( *vol, secondFace, vol );
697 }
698 }
699 }
700 }
701}
bool msgLvl(const MSG::Level lvl) const
void setOutsideTrackingVolume(TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *outsidevol) const override
protected method to set outside Volume of a BoundarySurface: input:
void setInsideTrackingVolume(TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *insidevol) const override
protected method to set inside Volume of a BoundarySurface: input:

◆ glueTrackingVolumes() [4/5]

void Trk::TrackingVolumeHelper::glueTrackingVolumes ( TrackingVolume & firstVol,
BoundarySurfaceFace firstFace,
const std::vector< TrackingVolume * > & secondVolumes,
BoundarySurfaceFace secondFace,
bool buildBoundaryLayer = false,
bool boundaryFaceExchange = false ) const
overridevirtual

Method to glue two Volumes together input:

Simply forward to base class method to enhance friendship relation.

— Necessary as friendship cannot be inherited: your father's friend isn't necessary yours —

Implements Trk::ITrackingVolumeHelper.

Definition at line 102 of file TrackingVolumeHelper.cxx.

108{
109
110 if (msgLvl(MSG::VERBOSE)) {
111 ATH_MSG_VERBOSE( "Glue Volume '" << firstVol.volumeName() << "' to " << secondVolumes.size() << " volume(s): " );
112 for (const auto & volIter : secondVolumes)
113 ATH_MSG_VERBOSE( " -> " << (volIter)->volumeName() );
114 }
115 // prepare the material layer if needed
116 std::shared_ptr<MaterialLayer> mLayer{};
117 // ----------------------------------------------------------------------------------------
118 // create a MaterialLayer as a boundary
119 if (buildBoundaryLayer){
120 // the first face surface
121 Surface& firstFaceSurface = firstVol.boundarySurfaces()[firstFace]->surfaceRepresentation();
122 std::unique_ptr<LayerMaterialProperties> lmps = layerMaterialProperties(firstFaceSurface);
123 // LayerMaterialProperties are cloned by MaterialLayer
124
125 // the material layer is ready - it can be assigned
126 mLayer = std::make_shared<MaterialLayerNoOwnSurf>(&firstFaceSurface, std::move(lmps));
127 ATH_MSG_VERBOSE( "Set MaterialLayer to the BoundarySurface of first volume (may be shared with second volume)." );
128 firstFaceSurface.setMaterialLayer(mLayer);
129 }
130 // if only one volume was given in the vector call the standard one-to-one glueing
131 // 1-to-1 case
132 if (secondVolumes.size() == 1) {
133 // self call for one-on-one
134 glueTrackingVolumes(firstVol, firstFace, *(secondVolumes[0]), secondFace);
135 } else {
136 // create the navigation bin array
137 std::unique_ptr<BinnedArray<TrackingVolume>> navArray = nullptr;
138 // create the Array - either r-binned or z-binned
139 if (firstFace == negativeFaceXY || firstFace == positiveFaceXY )
140 navArray = m_trackingVolumeArrayCreator->cylinderVolumesArrayInR(secondVolumes, true);
141 else
142 navArray = m_trackingVolumeArrayCreator->cylinderVolumesArrayInZ(secondVolumes, true);
143
144 // set the volume array to the first boundary surface - this must always happen
145 if (firstFace != tubeInnerCover){
146 setOutsideTrackingVolumeArray( firstVol, firstFace, std::move(navArray) );
147 }
148 else{
149 setInsideTrackingVolumeArray( firstVol, firstFace, std::move(navArray) );
150 }
151 // the navigation arrays are completed now - check if the boundary face should be exchanged
152 // [1] the boundary face exchange ----------------------------------------------------------------------------------------
153 if (boundaryFaceExchange){
154 // creating only one boundary surface
155 ATH_MSG_VERBOSE("Creating a joint boundary surface for 1-to-n glueing case.");
156 // get the dimension of boundary surface of the first volume
157 std::shared_ptr<BoundarySurface<TrackingVolume> > bSurface = firstVol.boundarySurfaces()[firstFace];
158 // replace the boundary surface
159 for ( const auto & volIter: secondVolumes )
160 setBoundarySurface(*volIter, bSurface, secondFace);
161 } else {
162 // [2] the traditional way, keeping two boundary surfaces
163 // now set the face to the volume array -------------------------------------------------------------------------------
164 for ( const auto & volIter: secondVolumes ) {
165 // the secondGlueFace
166 BoundarySurfaceFace secondGlueFace = secondFace;
167 if (secondFace == tubeOuterCover) {
168 //check for cylinder case
169 const CylinderVolumeBounds* currentVolBounds = dynamic_cast<const CylinderVolumeBounds*>(&((volIter)->volumeBounds()));
170 // protection : there may be a cylinder within the tube vector
171 if (currentVolBounds && currentVolBounds->innerRadius() < 10e-3)
172 secondGlueFace = cylinderCover;
173 setOutsideTrackingVolume(*volIter, secondGlueFace, (&(firstVol)));
174 } // for all surfaces except the tunbeInnerCover outside of the surface is identical to outside of the volume
175 else if (secondGlueFace != tubeInnerCover)
176 setOutsideTrackingVolume(*volIter, secondGlueFace, (&(firstVol)));
177 else
178 setInsideTrackingVolume(*volIter, secondGlueFace, (&(firstVol)));
179 // if existing, set the material Layer
180 // get the second face surface and set the new MaterialLayer
181 Surface& secondFaceSurface = volIter->boundarySurfaces()[secondFace]->surfaceRepresentation();
182 secondFaceSurface.setMaterialLayer(mLayer);
183 }
184 }
185 } // 1-to-n case
186}

◆ glueTrackingVolumes() [5/5]

void Trk::TrackingVolumeHelper::glueTrackingVolumes ( TrackingVolume & firstVol,
BoundarySurfaceFace firstFace,
TrackingVolume & secondVol,
BoundarySurfaceFace secondFace,
bool buildBoundaryLayer = false ) const
overridevirtual

Method to glue two Volumes together input:

Simply forward to base class method to enhance friendship relation.

— Necessary as friendship cannot be inherited: your father's friend isn't necessary yours —

Implements Trk::ITrackingVolumeHelper.

Definition at line 70 of file TrackingVolumeHelper.cxx.

75{
76 TrackingVolumeManipulator::glueVolumes( firstVol, firstFace, secondVol, secondFace );
77
78 // ----------------------------------------------------------------------------------------
79 // create a MaterialLayer as a boundary
80 if (buildBoundaryLayer){
81 auto& bSurfacesFirst = firstVol.boundarySurfaces();
82 auto& bSurfacesSecond = secondVol.boundarySurfaces();
83 // get the boundary surfaces
84 Surface& firstFaceSurface = bSurfacesFirst[firstFace]->surfaceRepresentation();
85 Surface& secondFaceSurface = bSurfacesSecond[secondFace]->surfaceRepresentation();
86 // dynamic_cast to the right type
87 std::unique_ptr<LayerMaterialProperties> lmps = layerMaterialProperties(firstFaceSurface);
88 // LayerMaterialProperties will be cloned in MaterialLayer
89
90 // set the layer to the two surfaces
91 if (lmps){
92 auto mLayer = std::make_shared<MaterialLayerNoOwnSurf>(&firstFaceSurface, std::move(lmps));
93 ATH_MSG_VERBOSE( "Set MaterialLayer to the BoundarySurface of first volume." );
94 firstFaceSurface.setMaterialLayer(mLayer);
95 ATH_MSG_VERBOSE("Set MaterialLayer to the BoundarySurface of second volume.");
96 secondFaceSurface.setMaterialLayer(mLayer);
97 }
98 }
99}
void glueVolumes(TrackingVolume &firstVol, BoundarySurfaceFace firstFace, TrackingVolume &secondVol, BoundarySurfaceFace secondFace) const
protected method to glue two Volumes together input:

◆ glueVolumes()

void Trk::TrackingVolumeManipulator::glueVolumes ( Trk::TrackingVolume & firstVol,
Trk::BoundarySurfaceFace firstFace,
Trk::TrackingVolume & secondVol,
Trk::BoundarySurfaceFace secondFace ) const
protectedinherited

protected method to glue two Volumes together input:

Definition at line 17 of file TrackingVolumeManipulator.cxx.

22{
23 // check if it is a cylinder volume
24 const Trk::CylinderVolumeBounds* cylBounds =
25 dynamic_cast<const Trk::CylinderVolumeBounds*>(&(firstVol.volumeBounds()));
26
27 if (firstFace == Trk::tubeOuterCover && secondFace == Trk::tubeInnerCover)
28 return glueVolumes(secondVol, secondFace, firstVol, firstFace);
29
30 // the second volume gets the face of the first volume assigned
31 (secondVol.m_boundarySurfaces)[secondFace] =
32 (firstVol.m_boundarySurfaces)[firstFace];
33 // the face of the first volume has been an inner tube
34 if (cylBounds && firstFace == Trk::tubeInnerCover &&
35 secondFace == Trk::tubeOuterCover) {
36 (secondVol.m_boundarySurfaces)[secondFace]->setInsideVolume(&secondVol);
37 } else {
38 (secondVol.m_boundarySurfaces)[secondFace]->setOutsideVolume(&secondVol);
39 }
40}
static void setOutsideVolume(TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *outsidevol)
protected method to set outside Volume of a BoundarySurface: input:
static void setInsideVolume(TrackingVolume &tvol, BoundarySurfaceFace face, TrackingVolume *insidevol)
protected method to set inside Volume of a BoundarySurface: input:
std::vector< std::shared_ptr< BoundarySurface< TrackingVolume > > > m_boundarySurfaces
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Definition Volume.h:96

◆ initialize()

StatusCode Trk::TrackingVolumeHelper::initialize ( )
override

AlgTool initialize method.

Definition at line 60 of file TrackingVolumeHelper.cxx.

60 {
61
62 ATH_MSG_DEBUG( "initialize() " );
65 return StatusCode::SUCCESS;
66}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
PublicToolHandle< ILayerArrayCreator > m_layerArrayCreator
A Tool for coherent LayerArray creation.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ layerMaterialProperties()

std::unique_ptr< LayerMaterialProperties > Trk::TrackingVolumeHelper::layerMaterialProperties ( const Trk::Surface & sf) const
private

< helper method to construct barrel material

Definition at line 704 of file TrackingVolumeHelper.cxx.

704 {
705
706 std::unique_ptr<LayerMaterialProperties> layerMaterial{};
707
708 if (boundarySurface.type() == SurfaceType::Cylinder){
709 const CylinderBounds* cb = dynamic_cast<const CylinderBounds*>(&boundarySurface.bounds());
710 if (!cb) throw std::logic_error("Not CylinderBounds");
711 // --------------- material estimation ----------------------------------------------------------------
712 // -- material with 1D binning
713 double hz = cb->halflengthZ();
714 double r = cb->r();
715 BinUtility layerBinUtilityZ(m_barrelLayerBinsZ, -hz, hz, open, binZ);
716 if (m_barrelLayerBinsPhi==1){
717 layerMaterial = std::make_unique<BinnedLayerMaterial>(layerBinUtilityZ);
718 } else { // -- material with 2D binning
719 BinUtility layerBinUtilityRPhiZ(m_barrelLayerBinsPhi, -r*M_PI, r*M_PI, closed,binRPhi);
720 layerBinUtilityRPhiZ += layerBinUtilityZ;
721 layerMaterial = std::make_unique<BinnedLayerMaterial>(layerBinUtilityRPhiZ);
722 }
723 // --------------- material estimation ----------------------------------------------------------------
724 }
725 if (boundarySurface.type() == SurfaceType::Disc){
726 // --------------- material estimation ----------------------------------------------------------------
727 const DiscBounds* db = dynamic_cast<const DiscBounds*>(&boundarySurface.bounds());
728 if (!db) throw std::logic_error("Not DiscBounds");
729 double rMin = db->rMin();
730 double rMax = db->rMax();
731 BinUtility layerBinUtilityR(m_endcapLayerBinsR,rMin,rMax,open, binR);
732 // -- material with 1D binning
733 if (m_endcapLayerBinsPhi==1){
734 layerMaterial = std::make_unique<BinnedLayerMaterial>(layerBinUtilityR);
735 } else { // -- material with 2D binning
736 BinUtility layerBinUtilityPhi(m_endcapLayerBinsPhi,-M_PI,M_PI,closed,binPhi);
737 layerBinUtilityR += layerBinUtilityPhi;
738 layerMaterial = std::make_unique<BinnedLayerMaterial>(layerBinUtilityR);
739 }
740 // --------------- material estimation ----------------------------------------------------------------
741 }
742 // return what you have
743 return layerMaterial;
744}
Gaudi::Property< int > m_endcapLayerBinsR
material bins in R
Gaudi::Property< int > m_barrelLayerBinsPhi
material bins in Phi
Gaudi::Property< int > m_endcapLayerBinsPhi
material bins in Phi
Gaudi::Property< int > m_barrelLayerBinsZ
material bins in Z
int r
Definition globals.cxx:22
@ open
Definition BinningType.h:40
@ closed
Definition BinningType.h:41
@ binR
Definition BinningType.h:50
@ binPhi
Definition BinningType.h:51
@ binRPhi
Definition BinningType.h:52
@ binZ
Definition BinningType.h:49

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setBoundarySurface()

void Trk::TrackingVolumeManipulator::setBoundarySurface ( Trk::TrackingVolume & tvol,
std::shared_ptr< BoundarySurface< TrackingVolume > > bsurf,
Trk::BoundarySurfaceFace face )
staticprotectedinherited

protected method to set the boundary surface of a tracking volume

Definition at line 43 of file TrackingVolumeManipulator.cxx.

47{
48 (tvol.m_boundarySurfaces)[face] = std::move(bsurf);
49}

◆ setInsideTrackingVolume()

void Trk::TrackingVolumeHelper::setInsideTrackingVolume ( TrackingVolume & tvol,
BoundarySurfaceFace face,
TrackingVolume * insidevol ) const
overridevirtual

protected method to set inside Volume of a BoundarySurface: input:

Simply forward to base class method to enhance friendship relation.

  • the volume that holds the BoundarySurface
  • the face type of the boundary to be set
  • the volume to be set as inside volume

— Necessary as friendship cannot be inherited: your father's friend isn't necessary yours —

Implements Trk::ITrackingVolumeHelper.

Definition at line 749 of file TrackingVolumeHelper.cxx.

751 {
752 TrackingVolumeManipulator::setInsideVolume( tvol, face, insidevol );
753}

◆ setInsideTrackingVolumeArray()

void Trk::TrackingVolumeHelper::setInsideTrackingVolumeArray ( TrackingVolume & tvol,
BoundarySurfaceFace face,
std::shared_ptr< BinnedArray< TrackingVolume > > insidevolarray ) const
overridevirtual

protected method to set inside VolumeArray of a BoundarySurface: input:

Simply forward to base class method to enhance friendship relation.

  • the volume that holds the BoundarySurface
  • the face type of the boundary to be set
  • the volume array to be set as inside volume array

— Necessary as friendship cannot be inherited: your father's friend isn't necessary yours —

Implements Trk::ITrackingVolumeHelper.

Definition at line 757 of file TrackingVolumeHelper.cxx.

759 {
760 TrackingVolumeManipulator::setInsideVolumeArray(tvol,face,insidevolarray);
761}
static void setInsideVolumeArray(TrackingVolume &tvol, BoundarySurfaceFace face, const std::shared_ptr< BinnedArray< TrackingVolume > > &insidevolarray)
protected method to set inside VolumeArray of a BoundarySurface: input:

◆ setInsideVolume()

void Trk::TrackingVolumeManipulator::setInsideVolume ( Trk::TrackingVolume & tvol,
Trk::BoundarySurfaceFace face,
Trk::TrackingVolume * insidevol )
staticprotectedinherited

protected method to set inside Volume of a BoundarySurface: input:

  • the volume that holdes the BoundarySurface
  • the face type of the boundary to be set
  • the volume to be set as inside volume

Definition at line 52 of file TrackingVolumeManipulator.cxx.

55{
56
57 (tvol.m_boundarySurfaces)[face]->setInsideVolume(insidevol);
58}

◆ setInsideVolumeArray()

void Trk::TrackingVolumeManipulator::setInsideVolumeArray ( Trk::TrackingVolume & tvol,
Trk::BoundarySurfaceFace face,
const std::shared_ptr< BinnedArray< TrackingVolume > > & insidevolarray )
staticprotectedinherited

protected method to set inside VolumeArray of a BoundarySurface: input:

  • ithe volume that holdes the BoundarySurface
  • the face type of the boundary to be set
  • the volume array to be set as inside volume array

Definition at line 61 of file TrackingVolumeManipulator.cxx.

66{
67 (tvol.m_boundarySurfaces)[face]->setInsideVolumeArray(insidevolarray);
68}

◆ setOutsideTrackingVolume()

void Trk::TrackingVolumeHelper::setOutsideTrackingVolume ( TrackingVolume & tvol,
BoundarySurfaceFace face,
TrackingVolume * outsidevol ) const
overridevirtual

protected method to set outside Volume of a BoundarySurface: input:

Simply forward to base class method to enhance friendship relation.

  • the volume that holds the BoundarySurface
  • the face type of the boundary to be set
  • the volume to be set as outside volume

— Necessary as friendship cannot be inherited: your father's friend isn't necessary yours —

Implements Trk::ITrackingVolumeHelper.

Definition at line 765 of file TrackingVolumeHelper.cxx.

767 {
768 ATH_MSG_VERBOSE( " -> Glue '" << outsidevol->volumeName() << "' at face " << face << " to '" << tvol.volumeName() << "'.");
769 TrackingVolumeManipulator::setOutsideVolume( tvol, face, outsidevol );
770}

◆ setOutsideTrackingVolumeArray()

void Trk::TrackingVolumeHelper::setOutsideTrackingVolumeArray ( TrackingVolume & tvol,
BoundarySurfaceFace face,
std::shared_ptr< BinnedArray< TrackingVolume > > outsidevolarray ) const
overridevirtual

protected method to set outside VolumeArray of a BoundarySurface: input:

Simply forward to base class method to enhance friendship relation.

  • the volume that holds the BoundarySurface
  • the face type of the boundary to be set
  • the volume array to be set as outside volume array

Implements Trk::ITrackingVolumeHelper.

Definition at line 774 of file TrackingVolumeHelper.cxx.

776 {
777 unsigned int numVols = outsidevolarray.get()->arrayObjects().size() ;
778 ATH_MSG_VERBOSE( " -> Glue " << numVols << " volumes at face " << face << " to '" << tvol.volumeName() );
779 TrackingVolumeManipulator::setOutsideVolumeArray( tvol, face, outsidevolarray );
780}
static void setOutsideVolumeArray(TrackingVolume &tvol, BoundarySurfaceFace face, const std::shared_ptr< BinnedArray< TrackingVolume > > &outsidevolarray)
protected method to set outside VolumeArray of a BoundarySurface: input:

◆ setOutsideVolume()

void Trk::TrackingVolumeManipulator::setOutsideVolume ( Trk::TrackingVolume & tvol,
Trk::BoundarySurfaceFace face,
Trk::TrackingVolume * outsidevol )
staticprotectedinherited

protected method to set outside Volume of a BoundarySurface: input:

  • the volume that holdes the BoundarySurface
  • the face type of the boundary to be set
  • the volume to be set as outside volume

Definition at line 71 of file TrackingVolumeManipulator.cxx.

75{
76 (tvol.m_boundarySurfaces)[face]->setOutsideVolume(outsidevol);
77}

◆ setOutsideVolumeArray()

void Trk::TrackingVolumeManipulator::setOutsideVolumeArray ( Trk::TrackingVolume & tvol,
Trk::BoundarySurfaceFace face,
const std::shared_ptr< BinnedArray< TrackingVolume > > & outsidevolarray )
staticprotectedinherited

protected method to set outside VolumeArray of a BoundarySurface: input:

  • the volume that holdes the BoundarySurface
  • the face type of the boundary to be set
  • the volume array to be set as outside volume array

Definition at line 80 of file TrackingVolumeManipulator.cxx.

85{
86 (tvol.m_boundarySurfaces)[face]->setOutsideVolumeArray(outsidevolarray);
87}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_barrelLayerBinsPhi

Gaudi::Property<int> Trk::TrackingVolumeHelper::m_barrelLayerBinsPhi {this, "BarrelLayerBinsPhi", 1}
private

material bins in Phi

Definition at line 232 of file TrackingVolumeHelper.h.

232{this, "BarrelLayerBinsPhi", 1};

◆ m_barrelLayerBinsZ

Gaudi::Property<int> Trk::TrackingVolumeHelper::m_barrelLayerBinsZ {this, "BarrelLayerBinsZ", 1}
private

material bins in Z

Definition at line 231 of file TrackingVolumeHelper.h.

231{this, "BarrelLayerBinsZ", 1};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_endcapLayerBinsPhi

Gaudi::Property<int> Trk::TrackingVolumeHelper::m_endcapLayerBinsPhi {this, "EndcapLayerBinsPhi", 1}
private

material bins in Phi

Definition at line 234 of file TrackingVolumeHelper.h.

234{this, "EndcapLayerBinsPhi", 1};

◆ m_endcapLayerBinsR

Gaudi::Property<int> Trk::TrackingVolumeHelper::m_endcapLayerBinsR {this, "EndcapLayerBinsR", 1}
private

material bins in R

Definition at line 233 of file TrackingVolumeHelper.h.

233{this, "EndcapLayerBinsR", 1};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_layerArrayCreator

PublicToolHandle<ILayerArrayCreator> Trk::TrackingVolumeHelper::m_layerArrayCreator {this, "LayerArrayCreator", "Trk::LayerArrayCreator/LayerArrayCreator"}
private

A Tool for coherent LayerArray creation.

Definition at line 226 of file TrackingVolumeHelper.h.

226{this, "LayerArrayCreator", "Trk::LayerArrayCreator/LayerArrayCreator"};

◆ m_trackingVolumeArrayCreator

ToolHandle<ITrackingVolumeArrayCreator> Trk::TrackingVolumeHelper::m_trackingVolumeArrayCreator {this, "TrackingVolumeArrayCreator", "Trk::TrackingVolumeArrayCreator/TrackingVolumeArrayCreator"}
private

Helper Tool to create TrackingVolume.

Arrays

Definition at line 228 of file TrackingVolumeHelper.h.

228{this, "TrackingVolumeArrayCreator", "Trk::TrackingVolumeArrayCreator/TrackingVolumeArrayCreator"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ s_layerThickness

double Trk::TrackingVolumeHelper::s_layerThickness
staticconstexprprivate
Initial value:
=
1. * Gaudi::Units::mm

standard layer thickness

Definition at line 236 of file TrackingVolumeHelper.h.


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