ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
DD4hep Plugin

Detailed Description

Namespaces

namespace  ActsPlugins::DD4hepBinningHelpers

Classes

class  ActsPlugins::DD4hepDetectorElement
 DetectorElement class implementation for DD4hep geometry. More...
struct  ActsPlugins::DD4hepDetectorElementExtension
 This extension holds an ACTS detector element belonging to a DD4hep detector element, and synchronizes ownership. More...
class  ActsPlugins::DD4hepDetectorSurfaceFactory
 A factory to convert DD4hep DetectorElements into sensitive of passive surfaces which are filled into a Cache object, also the create DD4hepDetector elements are provided. More...
class  ActsPlugins::DD4hepFieldAdapter
class  ActsPlugins::DD4hepLayerBuilder
 build layers of one cylinder-endcap setup from DD4hep input More...
class  ActsPlugins::DD4hepVolumeBuilder
 build confined TrackingVolumes of one cylinder setup from DD4hep input. More...

Functions

void ActsPlugins::addCylinderLayerProtoMaterial (dd4hep::DetElement detElement, Acts::Layer &cylinderLayer, const Acts::Logger &logger=Acts::getDummyLogger())
 Helper method to translate DD4hep material to Acts::ISurfaceMaterial.
void ActsPlugins::addDiscLayerProtoMaterial (dd4hep::DetElement detElement, Acts::Layer &discLayer, const Acts::Logger &logger=Acts::getDummyLogger())
 Helper method to translate DD4hep material to Acts::ISurfaceMaterial.
void ActsPlugins::addLayerProtoMaterial (const dd4hep::rec::VariantParameters &params, Acts::Layer &layer, const std::vector< std::pair< const std::string, Acts::BinningOption > > &binning, const Acts::Logger &logger=Acts::getDummyLogger())
 Helper method to be called for Cylinder and Disc Proto material.
void ActsPlugins::collectCompounds_dd4hep (dd4hep::DetElement &detElement, std::vector< dd4hep::DetElement > &compounds)
 Method internally used by convertDD4hepDetector to collect all volumes of a compound detector.
void ActsPlugins::collectLayers_dd4hep (dd4hep::DetElement &detElement, std::vector< dd4hep::DetElement > &layers, const Acts::Logger &logger)
 Method internally used by convertDD4hepDetector.
void ActsPlugins::collectSubDetectors_dd4hep (dd4hep::DetElement &detElement, std::vector< dd4hep::DetElement > &subdetectors, const Acts::Logger &logger)
 Method internally used by convertDD4hepDetector to collect all sub detectors Sub detector means each 'compound' DetElement or DetElements which are declared as 'isBarrel' or 'isBeampipe' by their extension.
std::vector< std::tuple< Acts::DirectedProtoAxis, std::size_t > > ActsPlugins::DD4hepBinningHelpers::convertBinning (const dd4hep::DetElement &dd4hepElement, const std::string &bname)
 This method converts the DD4hep binning into the Acts ProtoAxis.
std::unique_ptr< const Acts::TrackingGeometryActsPlugins::convertDD4hepDetector (dd4hep::DetElement worldDetElement, const Acts::Logger &logger, Acts::BinningType bTypePhi=Acts::equidistant, Acts::BinningType bTypeR=Acts::equidistant, Acts::BinningType bTypeZ=Acts::equidistant, double layerEnvelopeR=Acts::UnitConstants::mm, double layerEnvelopeZ=Acts::UnitConstants::mm, double defaultLayerThickness=Acts::UnitConstants::fm, const std::function< void(std::vector< dd4hep::DetElement > &detectors)> &sortSubDetectors=sortDetElementsByID, const Acts::GeometryContext &gctx=Acts::GeometryContext::dangerouslyDefaultConstruct(), std::shared_ptr< const Acts::IMaterialDecorator > matDecorator=nullptr, std::shared_ptr< const Acts::GeometryIdentifierHook > geometryIdentifierHook=std::make_shared< Acts::GeometryIdentifierHook >(), const DD4hepLayerBuilder::ElementFactory &detectorElementFactory=DD4hepLayerBuilder::defaultDetectorElementFactory)
 Global method which creates the TrackingGeometry from DD4hep input.
std::shared_ptr< Acts::ProtoSurfaceMaterialActsPlugins::createProtoMaterial (const dd4hep::rec::VariantParameters &params, const std::string &valueTag, const std::vector< std::pair< const std::string, Acts::BinningOption > > &binning, const Acts::Logger &logger=Acts::getDummyLogger())
 Helper method to create proto material - to be called from the addProto(...) methods.
std::shared_ptr< const Acts::CylinderVolumeHelperActsPlugins::cylinderVolumeHelper_dd4hep (const Acts::Logger &logger)
 Helper method internally used to create a default Acts::CylinderVolumeBuilder.
template<typename value_type>
std::vector< value_type > ActsPlugins::extractSeries (const dd4hep::DetElement &dd4hepElement, const std::string &bname, const value_type &unitConversion=1)
 A simple helper function to extract a series.
Acts::Transform3 ActsPlugins::extractTransform (const dd4hep::DetElement &dd4hepElement, const std::string &bname, const double unitConversion=1.)
 A simple helper function to extract a transform.
template<typename value_type>
value_type ActsPlugins::getAttrValueOr (const dd4hep::xml::Component &node, const std::string &attrName, const value_type &fallbackValue)
 Helper method to get an attribute with fallback.
Config ActsPlugins::DD4hepLayerBuilder::getConfiguration () const
 get the configuration object
Config ActsPlugins::DD4hepVolumeBuilder::getConfiguration () const
 Get the configuration object.
template<typename T>
ActsPlugins::getParam (const std::string &key, dd4hep::DetElement &elt)
 Helper function to extract a parameter value from a dd4hep detector element from VariantParameters.
template<typename T>
ActsPlugins::getParamOr (const std::string &key, const dd4hep::DetElement &elt, T alternative)
 Get a parameter value or an alternative value if either the VariantParameters extension isn't set, or it doesn't contain the demanded key.
const dd4hep::rec::VariantParameters & ActsPlugins::getParams (const dd4hep::DetElement &elt)
 Helper function to extract a VariantParameters instance, const version.
dd4hep::rec::VariantParameters & ActsPlugins::getParams (dd4hep::DetElement &elt)
 Helper function to extract a VariantParameters instance.
bool ActsPlugins::hasParam (const std::string &key, dd4hep::DetElement &elt)
 Check if a detector element has a key set in its VariantParameters.
bool ActsPlugins::hasParams (dd4hep::DetElement &elt)
 Check if a detector element has VariantParameters set.
const std::string & ActsPlugins::DD4hepLayerBuilder::identification () const final
 Name identification.
const std::string & ActsPlugins::DD4hepVolumeBuilder::identification () const final
 Name identification.
void ActsPlugins::sortDetElementsByID (std::vector< dd4hep::DetElement > &det)
 Sort function which sorts dd4hep::DetElement by their ID.
Acts::AxisDirection ActsPlugins::stringToAxisDirection (const std::string &binningString)
 Helper method to convert the string to binning value.
std::vector< Acts::AxisDirectionActsPlugins::stringToAxisDirections (const std::string &binningString, const char &del=',')
 Helper method to cenvert a binning list string to a vector of binning values e.g.
std::shared_ptr< const Acts::CylinderVolumeBuilderActsPlugins::volumeBuilder_dd4hep (dd4hep::DetElement subDetector, const Acts::Logger &logger, Acts::BinningType bTypePhi=Acts::equidistant, Acts::BinningType bTypeR=Acts::equidistant, Acts::BinningType bTypeZ=Acts::equidistant, double layerEnvelopeR=Acts::UnitConstants::mm, double layerEnvelopeZ=Acts::UnitConstants::mm, double defaultLayerThickness=Acts::UnitConstants::fm, const DD4hepLayerBuilder::ElementFactory &detectorElementFactory=DD4hepLayerBuilder::defaultDetectorElementFactory)
 Method internally used to create an Acts::CylinderVolumeBuilder.

Variables

static const std::vector< std::tuple< std::string, Acts::AxisDirection > > ActsPlugins::allowedBinnings

Function Documentation

◆ addCylinderLayerProtoMaterial()

void ActsPlugins::addCylinderLayerProtoMaterial ( dd4hep::DetElement detElement,
Acts::Layer & cylinderLayer,
const Acts::Logger & logger = Acts::getDummyLogger() )

Helper method to translate DD4hep material to Acts::ISurfaceMaterial.

This is used to assign proto material to Cylinder Layers

Parameters
detElementthe DD4hep detector element for which this material is assigned
cylinderLayeris the target layer
loggera Logger for output

◆ addDiscLayerProtoMaterial()

void ActsPlugins::addDiscLayerProtoMaterial ( dd4hep::DetElement detElement,
Acts::Layer & discLayer,
const Acts::Logger & logger = Acts::getDummyLogger() )

Helper method to translate DD4hep material to Acts::ISurfaceMaterial.

Thisis used to assign proto material to Disc Layers

Parameters
detElementthe DD4hep detector element for which this material is assigned
discLayeris the target layer
loggera Logger for output

◆ addLayerProtoMaterial()

void ActsPlugins::addLayerProtoMaterial ( const dd4hep::rec::VariantParameters & params,
Acts::Layer & layer,
const std::vector< std::pair< const std::string, Acts::BinningOption > > & binning,
const Acts::Logger & logger = Acts::getDummyLogger() )

Helper method to be called for Cylinder and Disc Proto material.

For both, cylinder and disc, the closed binning value is "binPhi"

Parameters
paramsAn instance of DD4hep::VariantParameters
layerthe Layer to assign the proto material
binningthe Binning prescription for the ActsExtension
loggera Logger for output

◆ collectCompounds_dd4hep()

void ActsPlugins::collectCompounds_dd4hep ( dd4hep::DetElement & detElement,
std::vector< dd4hep::DetElement > & compounds )

Method internally used by convertDD4hepDetector to collect all volumes of a compound detector.

Parameters
[in]detElementthe dd4hep::DetElement of the volume of which the compounds should be collected
[out]compoundsthe DD4hep::DetElements of the compounds contained by detElement

◆ collectLayers_dd4hep()

void ActsPlugins::collectLayers_dd4hep ( dd4hep::DetElement & detElement,
std::vector< dd4hep::DetElement > & layers,
const Acts::Logger & logger )

Method internally used by convertDD4hepDetector.

Parameters
[in]detElementthe dd4hep::DetElement of the volume of which the layers should be collected
[out]layersthe DD4hep::DetElements of the layers contained by detElement
loggera Logger for output

◆ collectSubDetectors_dd4hep()

void ActsPlugins::collectSubDetectors_dd4hep ( dd4hep::DetElement & detElement,
std::vector< dd4hep::DetElement > & subdetectors,
const Acts::Logger & logger )

Method internally used by convertDD4hepDetector to collect all sub detectors Sub detector means each 'compound' DetElement or DetElements which are declared as 'isBarrel' or 'isBeampipe' by their extension.

Parameters
[in]detElementthe dd4hep::DetElement of the volume of which the sub detectors should be collected
[out]subdetectorsthe DD4hep::DetElements of the sub detectors contained by detElement
loggera Logger for output

◆ convertBinning()

std::vector< std::tuple< Acts::DirectedProtoAxis, std::size_t > > ActsPlugins::DD4hepBinningHelpers::convertBinning ( const dd4hep::DetElement & dd4hepElement,
const std::string & bname )

This method converts the DD4hep binning into the Acts ProtoAxis.

Parameters
dd4hepElementthe element which has a binning description attached
bnamethe binning base name, e.g. surface_binning, material_binning
Returns
a vector of proto binning descriptions

◆ convertDD4hepDetector()

std::unique_ptr< const Acts::TrackingGeometry > ActsPlugins::convertDD4hepDetector ( dd4hep::DetElement worldDetElement,
const Acts::Logger & logger,
Acts::BinningType bTypePhi = Acts::equidistant,
Acts::BinningType bTypeR = Acts::equidistant,
Acts::BinningType bTypeZ = Acts::equidistant,
double layerEnvelopeR = Acts::UnitConstants::mm,
double layerEnvelopeZ = Acts::UnitConstants::mm,
double defaultLayerThickness = Acts::UnitConstants::fm,
const std::function< void(std::vector< dd4hep::DetElement > &detectors)> & sortSubDetectors = sortDetElementsByID,
const Acts::GeometryContext & gctx = Acts::GeometryContext::dangerouslyDefaultConstruct(),
std::shared_ptr< const Acts::IMaterialDecorator > matDecorator = nullptr,
std::shared_ptr< const Acts::GeometryIdentifierHook > geometryIdentifierHook = std::make_shared< Acts::GeometryIdentifierHook >(),
const DD4hepLayerBuilder::ElementFactory & detectorElementFactory = DD4hepLayerBuilder::defaultDetectorElementFactory )

Global method which creates the TrackingGeometry from DD4hep input.

This method returns a std::unique_ptr of the TrackingGeometry from the World DD4hep DetElement.

Precondition
Before using this method make sure, that the preconditions described in DD4hepPlugins are met.
Parameters
[in]worldDetElementthe DD4hep DetElement of the world
[in]loggerA logger instance geometry building
[in]bTypePhiis how the sensitive surfaces (modules) should be binned in a layer in phi direction.
Note
Possible binningtypes:
  • arbitrary - of the sizes if the surfaces and the distance in between vary. This mode finds out the bin boundaries by scanning through the surfaces.
  • equidistant - if the sensitive surfaces are placed equidistantly
equidistant binningtype is recommended because it is faster not only while building the geometry but also for look up during the extrapolation
Parameters
[in]bTypeRis how the sensitive surfaces (modules) should be binned in a layer in r direction
[in]bTypeZis how the sensitive surfaces (modules) should be binned in a layer in z direction
[in]layerEnvelopeRthe tolerance added to the geometrical extension in r of the layers contained to build the volume envelope around
[in]layerEnvelopeZthe tolerance added to the geometrical extension in z of the layers contained to build the volume envelope around
[in]defaultLayerThicknessIn case no surfaces (to be contained by the layer) are handed over, the layer thickness will be set to this value
Note
Layers containing surfaces per default are not allowed to be attached to each other (navigation will fail at this point). However, to allow material layers (not containing surfaces) to be attached to each other, this default thickness is needed. In this way, the layer will be thin (with space to the next layer), but the material will have the 'real' thickness.
Attention
The default thickness should be set thin enough that no touching or overlapping with the next layer can happen.
Parameters
[in]sortSubDetectorsstd::function which should be used in order to sort all sub detectors (=all Detelements collected by the method collectSubDetectors() ) from bottom to top to ensure correct wrapping of the volumes, which is needed for navigation. Therefore the different hierarchies need to be sorted ascending. The default is sorting by ID.
gctxThe geometry context to use
matDecoratoris the material decorator that loads material maps
geometryIdentifierHookHook to apply to surfaces during geometry closure.
detectorElementFactoryFactory function to create ActsPlugins::DD4hepDetectorElement or derived classes
Exceptions
std::logic_errorif an error in the translation occurs
Returns
std::unique_ptr to the full TrackingGeometry
  • The Tracking geometry needs to be built from bottom to top to ensure Navigation. Therefore the different hierarchies need to be sorted ascending. Per default the sub detectors are sorted by the id of their dd4hep::DetElement. In case another sorting needs to be applied, the users can provide their own function

◆ createProtoMaterial()

std::shared_ptr< Acts::ProtoSurfaceMaterial > ActsPlugins::createProtoMaterial ( const dd4hep::rec::VariantParameters & params,
const std::string & valueTag,
const std::vector< std::pair< const std::string, Acts::BinningOption > > & binning,
const Acts::Logger & logger = Acts::getDummyLogger() )

Helper method to create proto material - to be called from the addProto(...) methods.

Parameters
paramsAn instance of DD4hep::VariantParameters
valueTagthe xml tag for to ActsExtension to be parsed
binningthe Binning prescription for the ActsExtension
loggera Logger for output
Returns
Shared pointer to ProtoSurfaceMaterial created from DD4hep parameters

◆ cylinderVolumeHelper_dd4hep()

std::shared_ptr< const Acts::CylinderVolumeHelper > ActsPlugins::cylinderVolumeHelper_dd4hep ( const Acts::Logger & logger)

Helper method internally used to create a default Acts::CylinderVolumeBuilder.

Parameters
loggerLogging instance
Returns
Shared pointer to CylinderVolumeHelper

◆ extractSeries()

template<typename value_type>
std::vector< value_type > ActsPlugins::extractSeries ( const dd4hep::DetElement & dd4hepElement,
const std::string & bname,
const value_type & unitConversion = 1 )

A simple helper function to extract a series.

Template Parameters
value_typethe primitive type allowed by variant parameters
Parameters
dd4hepElementthe detector element with associated variant parameters
bnameThe base name attribute of the variant parameter pack
unitConversionis a conversion factor DD4hep -> ACTS
Returns
the extracted series as a vector

◆ extractTransform()

Acts::Transform3 ActsPlugins::extractTransform ( const dd4hep::DetElement & dd4hepElement,
const std::string & bname,
const double unitConversion = 1. )

A simple helper function to extract a transform.

Parameters
dd4hepElementthe detector element with associated variant parameters
bnameThe base name attribute of the variant parameter pack
unitConversionis a conversion factor DD4hep -> ACTS
Returns
a transform extracted from parameters

◆ getAttrValueOr()

template<typename value_type>
value_type ActsPlugins::getAttrValueOr ( const dd4hep::xml::Component & node,
const std::string & attrName,
const value_type & fallbackValue )

Helper method to get an attribute with fallback.

Note
the fallback value has to be provided
Template Parameters
value_typethe primitive type allowed by variant parameters
Parameters
nodethe node object from DD4hep
attrNamethe name of the attribute that is checked
fallbackValuethe fallbackValue
Returns
either the gathered attribute or the fallback

◆ getConfiguration() [1/2]

DD4hepLayerBuilder::Config ActsPlugins::DD4hepLayerBuilder::getConfiguration ( ) const

get the configuration object

Returns
Copy of the current configuration

◆ getConfiguration() [2/2]

DD4hepVolumeBuilder::Config ActsPlugins::DD4hepVolumeBuilder::getConfiguration ( ) const

Get the configuration object.

Returns
The used configuration struct

◆ getParam()

template<typename T>
T ActsPlugins::getParam ( const std::string & key,
dd4hep::DetElement & elt )

Helper function to extract a parameter value from a dd4hep detector element from VariantParameters.

Template Parameters
TThe value type
Parameters
keyThe key of the value to extract
eltThe detector element instance
Returns
A copy of the value contained in the params instance

◆ getParamOr()

template<typename T>
T ActsPlugins::getParamOr ( const std::string & key,
const dd4hep::DetElement & elt,
T alternative )

Get a parameter value or an alternative value if either the VariantParameters extension isn't set, or it doesn't contain the demanded key.

Template Parameters
TThe value type
Parameters
keyThe key of the value to extract
eltThe detector element instance
alternativeThe value to return if no params are set of the key doesn't exist
Returns
The value behind key, or alternative

◆ getParams() [1/2]

const dd4hep::rec::VariantParameters & ActsPlugins::getParams ( const dd4hep::DetElement & elt)

Helper function to extract a VariantParameters instance, const version.

Parameters
eltThe detector element instance
Returns
The VariantParameters instance

◆ getParams() [2/2]

dd4hep::rec::VariantParameters & ActsPlugins::getParams ( dd4hep::DetElement & elt)

Helper function to extract a VariantParameters instance.

Parameters
eltThe detector element instance
Returns
The VariantParameters instance

◆ hasParam()

bool ActsPlugins::hasParam ( const std::string & key,
dd4hep::DetElement & elt )

Check if a detector element has a key set in its VariantParameters.

Parameters
keyThe key to check existence for
eltThe detector element instance
Returns
True if the element has VariantParameters and the key exists, false if either of these is not true

◆ hasParams()

bool ActsPlugins::hasParams ( dd4hep::DetElement & elt)

Check if a detector element has VariantParameters set.

Parameters
eltThe detector element instance
Returns
True if the VariantParameters exist, false if not

◆ identification() [1/2]

const std::string & ActsPlugins::DD4hepLayerBuilder::identification ( ) const
finalvirtual

Name identification.

Returns
the string based identification of this configuration

Implements Acts::ILayerBuilder.

◆ identification() [2/2]

const std::string & ActsPlugins::DD4hepVolumeBuilder::identification ( ) const
finalvirtual

Name identification.

Returns
The string based identification of this configuration

Implements Acts::IConfinedTrackingVolumeBuilder.

◆ sortDetElementsByID()

void ActsPlugins::sortDetElementsByID ( std::vector< dd4hep::DetElement > & det)

Sort function which sorts dd4hep::DetElement by their ID.

Parameters
[in,out]detthe dd4hep::DetElements to be sorted

◆ stringToAxisDirection()

Acts::AxisDirection ActsPlugins::stringToAxisDirection ( const std::string & binningString)

Helper method to convert the string to binning value.

Parameters
binningString
Returns
a binningValue

◆ stringToAxisDirections()

std::vector< Acts::AxisDirection > ActsPlugins::stringToAxisDirections ( const std::string & binningString,
const char & del = ',' )

Helper method to cenvert a binning list string to a vector of binning values e.g.

"r,z" -> {AxisR, AxisZ}

Parameters
binningString
delthe delimiter for the splitting
Returns
a vector of binninng values

◆ volumeBuilder_dd4hep()

std::shared_ptr< const Acts::CylinderVolumeBuilder > ActsPlugins::volumeBuilder_dd4hep ( dd4hep::DetElement subDetector,
const Acts::Logger & logger,
Acts::BinningType bTypePhi = Acts::equidistant,
Acts::BinningType bTypeR = Acts::equidistant,
Acts::BinningType bTypeZ = Acts::equidistant,
double layerEnvelopeR = Acts::UnitConstants::mm,
double layerEnvelopeZ = Acts::UnitConstants::mm,
double defaultLayerThickness = Acts::UnitConstants::fm,
const DD4hepLayerBuilder::ElementFactory & detectorElementFactory = DD4hepLayerBuilder::defaultDetectorElementFactory )

Method internally used to create an Acts::CylinderVolumeBuilder.

This method creates an Acts::CylinderVolumeBuilder from a sub detector (= 'compound' DetElement or DetElements which are declared as 'isBarrel' or 'isBeampipe' by their extension.

Parameters
[in]subDetectorthe DD4hep DetElement of the subdetector
[in]loggerA logger instance
[in]bTypePhiis how the sensitive surfaces (modules) should be binned in a layer in phi direction.
Note
Possible binningtypes:
  • arbitrary - of the sizes if the surfaces and the distance in between vary. This mode finds out the bin boundaries by scanning through the surfaces.
  • equidistant - if the sensitive surfaces are placed equidistantly
equidistant binningtype is recommended because it is faster not only while building the geometry but also for look up during the extrapolation
Parameters
[in]bTypeRis how the sensitive surfaces (modules) should be binned in a layer in r direction
[in]bTypeZis how the sensitive surfaces (modules) should be binned in a layer in z direction
[in]layerEnvelopeRthe tolerance added to the geometrical extension in r of the layers contained to build the volume envelope around
[in]layerEnvelopeZthe tolerance added to the geometrical extension in z of the layers contained to build the volume envelope around
[in]defaultLayerThicknessIn case no surfaces (to be contained by the layer) are handed over, the layer thickness will be set to this value
Note
Layers containing surfaces per default are not allowed to be attached to each other (navigation will fail at this point). However, to allow material layers (not containing surfaces) to be attached to each other, this default thickness is needed. In this way, the layer will be thin (with space to the next layer), but the material will have the 'real' thickness.
Parameters
detectorElementFactoryFactory function to create ActsPlugins::DD4hepDetectorElement or derived classes
Attention
The default thickness should be set thin enough that no touching or overlapping with the next layer can happen.
Returns
std::shared_ptr the Acts::CylinderVolumeBuilder which can be used to build the full tracking geometry

Variable Documentation

◆ allowedBinnings

const std::vector<std::tuple<std::string, Acts::AxisDirection> > ActsPlugins::allowedBinnings
static
Initial value:
@ AxisX
AxisX, AxisY, AxisZ are the cartesian directions in the local frame.
Definition AxisDefinitions.hpp:20
@ AxisR
AxisR is a radial direction.
Definition AxisDefinitions.hpp:24
@ AxisPhi
AxisPhi is the azimuthal direction.
Definition AxisDefinitions.hpp:26
@ AxisY
Definition AxisDefinitions.hpp:21
@ AxisZ
Definition AxisDefinitions.hpp:22