diff --git a/Core/include/Acts/Detector/TrackingVolume.hpp b/Core/include/Acts/Detector/TrackingVolume.hpp index 6042e8326f6f2429ea17dc0c1819195266160fcc..735bce9f829ff861ac35f979d8bbf86372991ac7 100644 --- a/Core/include/Acts/Detector/TrackingVolume.hpp +++ b/Core/include/Acts/Detector/TrackingVolume.hpp @@ -255,6 +255,9 @@ public: /// /// @param visitor The callable. Will be called for each sensitive surface /// that is found + /// + /// If a context is needed for the vist, the vistitor has to provide this + /// e.g. as a private member void visitSurfaces(const std::function<void(const Acts::Surface*)>& visitor) const; @@ -274,11 +277,13 @@ public: /// - if common face is set the glued volumes are sharing the boundary, down /// to the last navigation volume /// + /// @param gctx The current geometry context object, e.g. alignment /// @param bsfMine is the boundary face indicater where to glue /// @param neighbor is the TrackingVolume to be glued /// @param bsfNeighbor is the boudnary surface of the neighbor void - glueTrackingVolume(BoundarySurfaceFace bsfMine, + glueTrackingVolume(const GeometryContext& gctx, + BoundarySurfaceFace bsfMine, const MutableTrackingVolumePtr& neighbor, BoundarySurfaceFace bsfNeighbor); @@ -286,12 +291,13 @@ public: /// - if common face is set the glued volumes are sharing the boundary, down /// to the last navigation volume /// - /// + /// @param gctx The current geometry context object, e.g. alignment /// @param bsfMine is the boundary face indicater where to glue /// @param neighbors are the TrackingVolumes to be glued /// @param bsfNeighbor are the boudnary surface of the neighbors void - glueTrackingVolumes(BoundarySurfaceFace bsfMine, + glueTrackingVolumes(const GeometryContext& gctx, + BoundarySurfaceFace bsfMine, const std::shared_ptr<TrackingVolumeArray>& neighbors, BoundarySurfaceFace bsfNeighbor); diff --git a/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp b/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp index eec50cf446f53ab2ee8de5255b62266025efdb1d..4f099a627c228bc9775c475601711f5c00d33941 100644 --- a/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp +++ b/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp @@ -197,12 +197,12 @@ public: /// is described. /// /// @param gctx The current geometry context object, e.g. alignment + /// It is ignored for Curvilinear parameters /// /// @note For a curvilinear track parameterisation this is identical to /// the rotation matrix of the intrinsic planar surface. RotationMatrix3D - referenceFrame(const GeometryContext& gctx - = DefaultGeometryContext()) const final + referenceFrame(const GeometryContext& gctx) const final { return m_upSurface->transform(gctx).linear(); } diff --git a/Core/include/Acts/Tools/CuboidVolumeBuilder.hpp b/Core/include/Acts/Tools/CuboidVolumeBuilder.hpp index 5344ca73a828c1a15223d30930c4d98b56c34953..3ba7c0510a4b80bbf73d04a5b73ab221cbcd0d83 100644 --- a/Core/include/Acts/Tools/CuboidVolumeBuilder.hpp +++ b/Core/include/Acts/Tools/CuboidVolumeBuilder.hpp @@ -98,9 +98,6 @@ public: Vector3D length = Vector3D(0., 0., 0.); // Configuration of its volumes std::vector<VolumeConfig> volumeCfg = {}; - - /// The building context - GeometryContext buildContext = DefaultGeometryContext(); }; /// @brief Default constructor without a configuration @@ -123,45 +120,56 @@ public: /// @brief This function creates a surface with a given configuration. A /// detector element is attached if the template parameter is non-void. /// + /// @param [in] gctx the geometry context for this building /// @param [in] cfg Configuration of the surface + /// /// @return Pointer to the created surface std::shared_ptr<const PlaneSurface> - buildSurface(const SurfaceConfig& cfg) const; + buildSurface(const GeometryContext& gctx, const SurfaceConfig& cfg) const; /// @brief This function creates a layer with a surface encaspulated with a /// given configuration. The surface gets a detector element attached if the /// template parameter is non-void. /// + /// @param [in] gctx the geometry context for this building /// @param [in, out] cfg Configuration of the layer and the surface + /// /// @return Pointer to the created layer std::shared_ptr<const Layer> - buildLayer(LayerConfig& cfg) const; + buildLayer(const GeometryContext& gctx, LayerConfig& cfg) const; /// @brief This function creates a TrackingVolume with a configurable number /// of layers and surfaces. Each surface gets a detector element attached if /// the template parameter is non-void. /// + /// @param [in] gctx the geometry context for this building /// @param [in, out] cfg Configuration of the TrackingVolume + /// /// @return Pointer to the created TrackingVolume std::shared_ptr<TrackingVolume> - buildVolume(VolumeConfig& cfg) const; + buildVolume(const GeometryContext& gctx, VolumeConfig& cfg) const; /// @brief This function evaluates the minimum and maximum of the binning as /// given by the configurations of the surfaces and layers. The ordering /// depends on the binning value specified in the configuration of the volume. /// + /// @param [in] gctx the geometry context for this building /// @param [in] cfg Container with the given surfaces and layers + /// /// @return Pair containing the minimum and maximum along the binning /// direction std::pair<double, double> - binningRange(const VolumeConfig& cfg) const; + binningRange(const GeometryContext& gctx, const VolumeConfig& cfg) const; /// @brief This function builds a world TrackingVolume based on a given /// configuration /// + /// @param [in] gctx the geometry context for this building + /// /// @return Pointer to the created TrackingGeometry std::shared_ptr<TrackingVolume> - trackingVolume(std::shared_ptr<const TrackingVolume> /*unused*/, + trackingVolume(const GeometryContext& gctx, + std::shared_ptr<const TrackingVolume> /*unused*/, std::shared_ptr<const VolumeBounds> /*unused*/) const override; private: diff --git a/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp b/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp index 6e01264c49b8a5242bbf0448289a77bdb2733c6a..41916b9c3238c490c7a805f4805ce205ec0a9341 100644 --- a/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp +++ b/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp @@ -520,9 +520,6 @@ public: /// the additional envelope in Z to create zMin, zMax double layerEnvelopeZ = 10. * Acts::units::_mm; - /// The building context - GeometryContext buildContext = DefaultGeometryContext(); - /// the volume signature int volumeSignature = -1; }; @@ -541,6 +538,7 @@ public: /// CylinderVolumeBuilder main call method /// + /// @param [in] gctx geometry context for which this cylinder volume is built /// @param [in] existingVolume is an (optional) volume to be included /// @param [in] externalBounds are (optional) external confinement /// constraints @@ -548,8 +546,9 @@ public: /// optionally provided exisitingVolume consistently for further /// processing MutableTrackingVolumePtr - trackingVolume(TrackingVolumePtr existingVolume = nullptr, - VolumeBoundsPtr externalBounds = nullptr) const override; + trackingVolume(const GeometryContext& gctx, + TrackingVolumePtr existingVolume = nullptr, + VolumeBoundsPtr externalBounds = nullptr) const override; /// Set configuration method /// @@ -587,14 +586,17 @@ private: /// Analyze the layer config to gather needed dimension /// + /// @param [in] gctx the geometry context for this building /// @param [in] lVector is the vector of layers that are parsed + /// /// @return a VolumeConfig representing this layer VolumeConfig - analyzeLayers(const LayerVector& lVector) const; + analyzeLayers(const GeometryContext& gctx, const LayerVector& lVector) const; /// Helper method check the layer containment, /// both for inside / outside. /// + /// @param [in] gctx the geometry context for this building /// @param [in] layerConfig is the VolumeConfig to be tested /// the wrapping flag may be set /// @param [in] insideConfig is the inside volume in order to @@ -604,10 +606,11 @@ private: /// /// @return boolean that indicates the test result bool - checkLayerContainment(VolumeConfig& layerConfig, - const VolumeConfig& insideConfig, - const VolumeConfig& volumeConfig, - int sign) const; + checkLayerContainment(const GeometryContext& gctx, + VolumeConfig& layerConfig, + const VolumeConfig& insideConfig, + const VolumeConfig& volumeConfig, + int sign) const; }; /// Return the configuration object diff --git a/Core/include/Acts/Tools/CylinderVolumeHelper.hpp b/Core/include/Acts/Tools/CylinderVolumeHelper.hpp index 7850a1f42dacfb55f58db3d3b0bcf69210f061f5..1acc9ac1c88f16ba1d3e1b498376472105406b47 100644 --- a/Core/include/Acts/Tools/CylinderVolumeHelper.hpp +++ b/Core/include/Acts/Tools/CylinderVolumeHelper.hpp @@ -61,8 +61,6 @@ public: int passiveLayerPhiBins = 1; /// bins in r/z for the passive layer int passiveLayerRzBins = 100; - /// The building context - GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor @@ -78,6 +76,7 @@ public: /// Create a TrackingVolume* from a set of layers and (optional) parameters /// + /// @param [in] gctx the geometry context for this building /// @param layers vector of static layers confined by the TrackingVolume /// if no bounds or HepTransform is given, they define the size /// together with the volume enevlope parameters @@ -91,7 +90,8 @@ public: /// /// @return shared pointer to a new TrackingVolume MutableTrackingVolumePtr - createTrackingVolume(const LayerVector& layers, + createTrackingVolume(const GeometryContext& gctx, + const LayerVector& layers, std::shared_ptr<const Material> matprop, VolumeBoundsPtr volBounds, std::shared_ptr<const Transform3D> transform = nullptr, @@ -101,6 +101,7 @@ public: /// Create a TrackingVolume* from a set of layers and (optional) parameters /// @note this TrackingVolume is restricted to Translation only /// + /// @param [in] gctx the geometry context for this building /// @param layers vector of static layers confined by the TrackingVolume /// if no bounds or HepTransform is given, they define the size /// together with the volume enevlope parameters @@ -114,7 +115,8 @@ public: /// /// @return shared pointer to a new TrackingVolume MutableTrackingVolumePtr - createTrackingVolume(const LayerVector& layers, + createTrackingVolume(const GeometryContext& gctx, + const LayerVector& layers, std::shared_ptr<const Material> matprop, double rMin, double rMax, @@ -126,6 +128,7 @@ public: /// Create a gap volume from dimensions and /// @note this TrackingVolume is restricted to Translation only /// + /// @param [in] gctx the geometry context for this building /// @param matprop dense material properties for this TrackingVolume /// @param rMin minimum radius /// @param rMax maximum radius @@ -137,7 +140,8 @@ public: /// /// @return shared pointer to a new TrackingVolume MutableTrackingVolumePtr - createGapTrackingVolume(std::shared_ptr<const Material> matprop, + createGapTrackingVolume(const GeometryContext& gctx, + std::shared_ptr<const Material> matprop, double rMin, double rMax, double zMin, @@ -149,6 +153,7 @@ public: /// Create a gap volume from dimensions and /// + /// @param [in] gctx the geometry context for this building /// @param matprop dense material properties for this TrackingVolume /// @param rMin minimum radius /// @param rMax maximum radius @@ -161,7 +166,8 @@ public: /// /// @return shared pointer to a new TrackingVolume MutableTrackingVolumePtr - createGapTrackingVolume(std::shared_ptr<const Material> matprop, + createGapTrackingVolume(const GeometryContext& gctx, + std::shared_ptr<const Material> matprop, double rMin, double rMax, double zMin, @@ -174,12 +180,14 @@ public: /// Create a container volumes from sub volumes, input volumes are ordered in /// R or Z by convention /// + /// @param [in] gctx the geometry context for this building /// @param volumes the volumes to be contained /// /// /// @return shared pointer to a new TrackingVolume MutableTrackingVolumePtr createContainerTrackingVolume( + const GeometryContext& gctx, const TrackingVolumeVector& volumes) const override; /// Set configuration method @@ -216,6 +224,7 @@ private: /// Private method - it estimates the CylinderBounds and Translation /// of layers, these are checked against the layer positions/dimensions. /// + /// @param gctx [in] the geometry context of this build /// @param layers the layers for which the dimensions are checked /// @param cylinderVolumeBounds the cylinder volume bounds needed for wrapping /// @param transform a transformation of the layers, volume @@ -226,7 +235,8 @@ private: /// @param bValue the binning value in which the binning works /// @param bType is the type of binning: equidistant, arbitrary bool - estimateAndCheckDimension(const LayerVector& layers, + estimateAndCheckDimension(const GeometryContext& gctx, + const LayerVector& layers, const CylinderVolumeBounds*& cylinderVolumeBounds, std::shared_ptr<const Transform3D>& transform, double& rMinClean, @@ -239,6 +249,7 @@ private: /// Private method - interglue all volumes contained by a TrackingVolume /// and set the outside glue volumes in the descriptor /// + /// @param gctx [in] the geometry context of this build /// @param tVolume the tracking volume that is glued together /// @param rBinned a boolean indicating if it is binned in r /// @param rMin the minimum radius of the volume @@ -247,7 +258,8 @@ private: /// @param zMin the minimum z extend of the volume /// @param zMax the maximum z extend of the volume bool - interGlueTrackingVolume(const MutableTrackingVolumePtr& tVolume, + interGlueTrackingVolume(const GeometryContext& gctx, + const MutableTrackingVolumePtr& tVolume, bool rBinned, double rMin, double rGlueMin, @@ -257,6 +269,7 @@ private: /// Private method - glue volume to the other /// + /// @param gctx [in] the geometry context of this build /// @param tvolOne is the first volume in the glue process /// @param faceOne is the first boundary face of the glue process /// @param tvolTwo is the second volume in the glue process @@ -267,7 +280,8 @@ private: /// @param zMin the minimum z extend of the volume /// @param zMax the maximum z extend of the volume void - glueTrackingVolumes(const MutableTrackingVolumePtr& tvolOne, + glueTrackingVolumes(const GeometryContext& gctx, + const MutableTrackingVolumePtr& tvolOne, BoundarySurfaceFace faceOne, const MutableTrackingVolumePtr& tvolTwo, BoundarySurfaceFace faceTwo, diff --git a/Core/include/Acts/Tools/ILayerArrayCreator.hpp b/Core/include/Acts/Tools/ILayerArrayCreator.hpp index 7e8356a9ab2ec3e030f0fef37c96c66e137a469d..d91632c0b17db2efc06b962ef3d5e52a47d259b1 100644 --- a/Core/include/Acts/Tools/ILayerArrayCreator.hpp +++ b/Core/include/Acts/Tools/ILayerArrayCreator.hpp @@ -15,6 +15,7 @@ #include <vector> #include "Acts/Utilities/BinnedArray.hpp" #include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -41,6 +42,7 @@ public: /// LayerArrayCreator interface method /// + /// @param gctx ist the geometry context for witch the volume is built /// @param layers are the layers to be moved into an array /// @param min is the minimul value for binning /// @param max is the maximum value for binning @@ -49,10 +51,11 @@ public: /// /// @return unqiue pointer to a new LayerArray virtual std::unique_ptr<const LayerArray> - layerArray(const LayerVector& layers, - double min, - double max, - BinningType btype = arbitrary, - BinningValue bvalue = binX) const = 0; + layerArray(const GeometryContext& gctx, + const LayerVector& layers, + double min, + double max, + BinningType btype = arbitrary, + BinningValue bvalue = binX) const = 0; }; } // namespace \ No newline at end of file diff --git a/Core/include/Acts/Tools/ILayerBuilder.hpp b/Core/include/Acts/Tools/ILayerBuilder.hpp index 31809cb503a4b17da9ca05003fe2b6f6d333bfe1..058ee76fcf53a7b19bc32ff34402a4b299314e92 100644 --- a/Core/include/Acts/Tools/ILayerBuilder.hpp +++ b/Core/include/Acts/Tools/ILayerBuilder.hpp @@ -14,6 +14,7 @@ #include <memory> #include <string> #include <vector> +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -32,20 +33,33 @@ class ILayerBuilder public: /// Virtual destructor virtual ~ILayerBuilder() = default; + /// LayerBuilder interface method + /// + /// @param gctx ist the geometry context under + /// which the geometry is built + /// /// @return the layers at negative side virtual const LayerVector - negativeLayers() const = 0; + negativeLayers(const GeometryContext& gctx) const = 0; /// LayerBuilder interface method + /// + /// @param gctx ist the geometry context under + /// which the geometry is built + /// /// @return the layers at the central sector virtual const LayerVector - centralLayers() const = 0; + centralLayers(const GeometryContext& gctx) const = 0; /// LayerBuilder interface method + /// + /// @param gctx ist the geometry context under + /// which the geometry is built + /// /// @return the layers at positive side virtual const LayerVector - positiveLayers() const = 0; + positiveLayers(const GeometryContext& gctx) const = 0; /// Name identification /// @return the string based identification diff --git a/Core/include/Acts/Tools/ITrackingGeometryBuilder.hpp b/Core/include/Acts/Tools/ITrackingGeometryBuilder.hpp index 711119f5aa237697f72bb9111cfbe0465369aabe..cb4ded8aa71125affc9a6cd36071b6cc14e699fd 100644 --- a/Core/include/Acts/Tools/ITrackingGeometryBuilder.hpp +++ b/Core/include/Acts/Tools/ITrackingGeometryBuilder.hpp @@ -12,6 +12,7 @@ #pragma once #include <memory> +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { class TrackingGeometry; @@ -34,8 +35,11 @@ public: virtual ~ITrackingGeometryBuilder() = default; /// TrackingGeometry Interface methode + /// + /// @param gctx ist the geometry context for witch the geometry is built + /// /// @return unique pointer to a newly created TrackingGeometry virtual std::unique_ptr<const TrackingGeometry> - trackingGeometry() const = 0; + trackingGeometry(const GeometryContext& gctx) const = 0; }; } // namespace \ No newline at end of file diff --git a/Core/include/Acts/Tools/ITrackingVolumeArrayCreator.hpp b/Core/include/Acts/Tools/ITrackingVolumeArrayCreator.hpp index 5eff186c92911498cecb4fad7a74a0153791d260..644b0aa9f22c51ee27c11583118b4965e87923f6 100644 --- a/Core/include/Acts/Tools/ITrackingVolumeArrayCreator.hpp +++ b/Core/include/Acts/Tools/ITrackingVolumeArrayCreator.hpp @@ -15,6 +15,7 @@ #include <vector> #include "Acts/Utilities/BinnedArray.hpp" #include "Acts/Utilities/BinningType.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -50,12 +51,14 @@ public: /// TrackingVolumeArrayCreator interface method - creates array depending on /// the binning type /// + /// @param [in] gctx the geometry context for this building /// @param vols are the TrackingVolumes ordered in a tracker /// @param bVal is the binning value for the volume binning /// /// @return sahred pointer to a new TrackingVolumeArray virtual std::shared_ptr<const TrackingVolumeArray> - trackingVolumeArray(const TrackingVolumeVector& vols, + trackingVolumeArray(const GeometryContext& gctx, + const TrackingVolumeVector& vols, BinningValue bVal) const = 0; }; } // namespace \ No newline at end of file diff --git a/Core/include/Acts/Tools/ITrackingVolumeBuilder.hpp b/Core/include/Acts/Tools/ITrackingVolumeBuilder.hpp index da0de7a30124477b2e7e0607e9cf8df1ba5795f1..9eae925cd63980c7bfdb96ff74e6321fd780c6c2 100644 --- a/Core/include/Acts/Tools/ITrackingVolumeBuilder.hpp +++ b/Core/include/Acts/Tools/ITrackingVolumeBuilder.hpp @@ -14,6 +14,7 @@ #include <memory> #include <tuple> #include <vector> +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -46,13 +47,15 @@ public: /// ITrackingVolumeBuilder interface method /// + /// @param gctx ist the geometry context for witch the volume is built /// @param insideVolume is an (optional) volume to be wrapped /// @param outsideBounds is an (optional) outside confinement /// /// @return shared pointer to a newly created TrackingVolume virtual MutableTrackingVolumePtr - trackingVolume(TrackingVolumePtr insideVolume = nullptr, - VolumeBoundsPtr outsideBounds = nullptr) const = 0; + trackingVolume(const GeometryContext& gctx, + TrackingVolumePtr insideVolume = nullptr, + VolumeBoundsPtr outsideBounds = nullptr) const = 0; }; } // namespace \ No newline at end of file diff --git a/Core/include/Acts/Tools/ITrackingVolumeHelper.hpp b/Core/include/Acts/Tools/ITrackingVolumeHelper.hpp index c35132469c59089de5c4c2da9e18be2a93144e14..e34c392714821f807921d4564e05beffc0d523dc 100644 --- a/Core/include/Acts/Tools/ITrackingVolumeHelper.hpp +++ b/Core/include/Acts/Tools/ITrackingVolumeHelper.hpp @@ -52,6 +52,7 @@ public: /// Create a TrackingVolume* from a set of layers and (optional) parameters /// + /// @param gctx ist the geometry context for witch the volume is built /// @param layers vector of static layers confined by the TrackingVolume /// if no bounds or HepTransform is given, they define the size /// together with the volume enevlope parameters @@ -65,7 +66,8 @@ public: /// /// @return shared pointer to a new TrackingVolume virtual MutableTrackingVolumePtr - createTrackingVolume(const LayerVector& layers, + createTrackingVolume(const GeometryContext& gctx, + const LayerVector& layers, std::shared_ptr<const Material> matprop, VolumeBoundsPtr volBounds, std::shared_ptr<const Transform3D> transform = nullptr, @@ -74,6 +76,7 @@ public: /// Create a TrackingVolume* from a set of layers and (optional) parameters /// + /// @param gctx ist the geometry context for witch the volume is built /// @param layers vector of static layers confined by the TrackingVolume /// if no bounds or HepTransform is given, they define the size /// together with the volume enevlope parameters @@ -85,7 +88,8 @@ public: /// /// @return shared pointer to a new TrackingVolume virtual MutableTrackingVolumePtr - createTrackingVolume(const LayerVector& layers, + createTrackingVolume(const GeometryContext& gctx, + const LayerVector& layers, std::shared_ptr<const Material> matprop, double loc0Min, double loc0Max, @@ -96,6 +100,7 @@ public: /// Create a gap volume from dimensions and /// + /// @param gctx ist the geometry context for witch the volume is built /// @param matprop dense material properties for this TrackingVolume /// @param loc0Min, loc0Max, loc1Min, loc1Max : local position in space, /// this TrackingVolume is restricted to Translation only @@ -105,7 +110,8 @@ public: /// /// @return shared pointer to a new TrackingVolume virtual MutableTrackingVolumePtr - createGapTrackingVolume(std::shared_ptr<const Material> matprop, + createGapTrackingVolume(const GeometryContext& gctx, + std::shared_ptr<const Material> matprop, double loc0Min, double loc0Max, double loc1Min, @@ -117,6 +123,7 @@ public: /// Create a gap volume from dimensions and /// + /// @param gctx ist the geometry context for witch the volume is built /// @param matprop dense material properties for this TrackingVolume /// @param loc0Min, loc0Max, loc1Min, loc1Max local position in space, /// @param layerPositions custom layer positions @@ -126,7 +133,8 @@ public: /// /// @return shared pointer to a new TrackingVolume virtual MutableTrackingVolumePtr - createGapTrackingVolume(std::shared_ptr<const Material> matprop, + createGapTrackingVolume(const GeometryContext& gctx, + std::shared_ptr<const Material> matprop, double loc0Min, double loc0Max, double loc1Min, @@ -138,11 +146,13 @@ public: /// Create a one level higher TrackingVolue /// + /// @param gctx ist the geometry context for witch the volume is built /// @param volumes the volumes to be contained /// /// @return shared pointer to a new TrackingVolume virtual MutableTrackingVolumePtr - createContainerTrackingVolume(const TrackingVolumeVector& volumes) const = 0; + createContainerTrackingVolume(const GeometryContext& gctx, + const TrackingVolumeVector& volumes) const = 0; }; } // namespace \ No newline at end of file diff --git a/Core/include/Acts/Tools/LayerArrayCreator.hpp b/Core/include/Acts/Tools/LayerArrayCreator.hpp index 423a13d11a460d65bef0d6048f615d3dd03a1efa..0934f7ffee33f8f2a400f77760155d66d9c8ecb0 100644 --- a/Core/include/Acts/Tools/LayerArrayCreator.hpp +++ b/Core/include/Acts/Tools/LayerArrayCreator.hpp @@ -47,18 +47,15 @@ public: /// @brief This struct stores the configuration of the tracking geometry struct Config { - - /// The building context - GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor /// /// @param logger logging instance - LayerArrayCreator(const Config& cfg, + LayerArrayCreator(const Config& /*cfg*/, std::unique_ptr<const Logger> logger = getDefaultLogger("LayerArrayCreator", Logging::INFO)) - : m_cfg(cfg), m_logger(std::move(logger)) + : m_logger(std::move(logger)) { } @@ -67,6 +64,7 @@ public: /// LayerArrayCreator interface method /// + /// @param gctx ist the geometry context for witch the array is built /// @param layersInput are the layers to be moved into an array /// @param min is the minimum value for binning /// @param max is the maximum value for binning @@ -75,11 +73,12 @@ public: /// /// @return unique pointer to a newly created LayerArray std::unique_ptr<const LayerArray> - layerArray(const LayerVector& layersInput, - double min, - double max, - BinningType bType = arbitrary, - BinningValue bValue = binX) const override; + layerArray(const GeometryContext& gctx, + const LayerVector& layersInput, + double min, + double max, + BinningType bType = arbitrary, + BinningValue bValue = binX) const override; /// set logging instance void @@ -96,17 +95,21 @@ private: return *m_logger; } - Config m_cfg; - /// logging instance std::unique_ptr<const Logger> m_logger = nullptr; /// Private helper method for creating a surface for - /// the NavigationLayer + /// the NavigationLayer, it clones the + /// @param layer object and thus needs the + /// @param gctx geometry context. + /// + /// @param bValue is the Binning value for the layer array + /// @param offset is the sift for the navigation layer std::shared_ptr<Surface> - createNavigationSurface(const Layer& layer, - BinningValue bValue, - double offset) const; + createNavigationSurface(const GeometryContext& gctx, + const Layer& layer, + BinningValue bValue, + double offset) const; }; } // namespace \ No newline at end of file diff --git a/Core/include/Acts/Tools/LayerCreator.hpp b/Core/include/Acts/Tools/LayerCreator.hpp index 7c0da640397d62c5cd7b375befc0bdb9f0195e1c..066c06aed48e5aef27a70fb081f13f4b089cf2ce 100644 --- a/Core/include/Acts/Tools/LayerCreator.hpp +++ b/Core/include/Acts/Tools/LayerCreator.hpp @@ -58,8 +58,6 @@ public: double cylinderZtolerance{10.}; /// cylinder module phi tolerance : it counts at same phi, if ... double cylinderPhiTolerance{0.1}; - /// The context for geometry building - GeometryContext buildContext = DefaultGeometryContext(); /// standard constructor Config() = default; }; @@ -77,6 +75,7 @@ public: /// returning a cylindrical layer /// + /// @param gctx ist the geometry context with which the geometry is built /// @param surfaces is the vector of pointers to sensitive surfaces /// represented by this layer /// @pre the pointers to the sensitive surfaces in the surfaces vectors all @@ -92,7 +91,8 @@ public: /// /// @return shared pointer to a newly created layer MutableLayerPtr - cylinderLayer(std::vector<std::shared_ptr<const Surface>> surfaces, + cylinderLayer(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi, size_t binsZ, boost::optional<ProtoLayer> _protoLayer = boost::none, @@ -101,6 +101,7 @@ public: /// returning a cylindrical layer /// + /// @param gctx ist the geometry context with which the geometry is built /// @param surfaces is the vector of pointers to sensitive surfaces /// represented by this layer /// @pre the pointers to the sensitive surfaces in the surfaces vectors all @@ -116,7 +117,8 @@ public: /// /// @return shared pointer to a newly created layer MutableLayerPtr - cylinderLayer(std::vector<std::shared_ptr<const Surface>> surfaces, + cylinderLayer(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypePhi, BinningType bTypeZ, boost::optional<ProtoLayer> _protoLayer = boost::none, @@ -125,6 +127,7 @@ public: /// returning a disc layer /// + /// @param gctx ist the geometry context with which the geometry is built /// @param surfaces is the vector of pointers to sensitive surfaces /// represented by this layer /// @pre the pointers to the sensitive surfaces in the surfaces vectors all @@ -140,7 +143,8 @@ public: /// /// @return shared pointer to a newly created layer MutableLayerPtr - discLayer(std::vector<std::shared_ptr<const Surface>> surfaces, + discLayer(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR, size_t binsPhi, boost::optional<ProtoLayer> _protoLayer = boost::none, @@ -149,6 +153,7 @@ public: /// returning a disc layer /// + /// @param gctx ist the geometry context with which the geometry is built /// @param surfaces is the vector of pointers to sensitive surfaces /// represented by this layer /// @pre the pointers to the sensitive surfaces in the surfaces vectors all @@ -164,7 +169,8 @@ public: /// /// @return shared pointer to a newly created layer MutableLayerPtr - discLayer(std::vector<std::shared_ptr<const Surface>> surfaces, + discLayer(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, BinningType bTypePhi, boost::optional<ProtoLayer> _protoLayer = boost::none, @@ -173,6 +179,7 @@ public: /// returning a plane layer /// + /// @param gctx ist the geometry context with which the geometry is built /// @param [in] surfaces is the vector of pointers to sensitive surfaces /// represented by this layer /// @pre the pointers to the sensitive surfaces in the surfaces vectors all @@ -192,7 +199,8 @@ public: /// /// @return shared pointer to a newly created layer MutableLayerPtr - planeLayer(std::vector<std::shared_ptr<const Surface>> surfaces, + planeLayer(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, size_t bins2, BinningValue bValue = BinningValue::binX, @@ -225,7 +233,7 @@ private: /// @param surfGrid is the object grid from the surface array /// @para surfaces is the vector of sensitive surfaces bool - checkBinning(const SurfaceArray& sArray) const; + checkBinning(const GeometryContext& gctx, const SurfaceArray& sArray) const; /// configuration object Config m_cfg; diff --git a/Core/include/Acts/Tools/PassiveLayerBuilder.hpp b/Core/include/Acts/Tools/PassiveLayerBuilder.hpp index d23ad8478f47f30d6a724420f3451feea511aa45..fb15344c85cfa42f456e263a525876bae50f79e3 100644 --- a/Core/include/Acts/Tools/PassiveLayerBuilder.hpp +++ b/Core/include/Acts/Tools/PassiveLayerBuilder.hpp @@ -50,9 +50,6 @@ public: std::vector<double> posnegLayerThickness; ///< p/n layer specs std::vector<std::shared_ptr<const SurfaceMaterial>> posnegLayerMaterial; ///< p/n layer specs - - /// The building context - GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor @@ -67,19 +64,31 @@ public: ~PassiveLayerBuilder() override = default; /// LayerBuilder interface method + /// + /// @param gctx ist the geometry context under + /// which the geometry is built + /// /// @return the layers at negative side const LayerVector - negativeLayers() const override; + negativeLayers(const GeometryContext& gctx) const override; /// LayerBuilder interface method + /// + /// @param gctx ist the geometry context under + /// which the geometry is built + /// /// @return the layers at the central sector const LayerVector - centralLayers() const override; + centralLayers(const GeometryContext& gctx) const override; /// LayerBuilder interface method + /// + /// @param gctx ist the geometry context under + /// which the geometry is built + /// /// @return the layers at positive side const LayerVector - positiveLayers() const override; + positiveLayers(const GeometryContext& gctx) const override; /// Name identification /// @return the string based identification @@ -110,6 +119,16 @@ protected: Config m_cfg; //!< configuration private: + /// Helper interface method + /// + /// @param gctx ist the geometry context under + /// which the geometry is built + /// @param side is the side of the layer to be built + /// + /// @return the layers at positive side + const LayerVector + endcapLayers(const GeometryContext& gctx, int side) const; + const Logger& logger() const { @@ -118,13 +137,6 @@ private: /// logging instance std::unique_ptr<const Logger> m_logger; - - void - constructLayers(); - - LayerVector m_nLayers; ///< layers on negative side - LayerVector m_cLayers; ///< layers on central side - LayerVector m_pLayers; ///< layers on positive side }; inline PassiveLayerBuilder::Config @@ -133,22 +145,4 @@ PassiveLayerBuilder::getConfiguration() const return m_cfg; } -inline const LayerVector -PassiveLayerBuilder::positiveLayers() const -{ - return m_pLayers; -} - -inline const LayerVector -PassiveLayerBuilder::negativeLayers() const -{ - return m_nLayers; -} - -inline const LayerVector -PassiveLayerBuilder::centralLayers() const -{ - return m_cLayers; -} - } // namespace \ No newline at end of file diff --git a/Core/include/Acts/Tools/SurfaceArrayCreator.hpp b/Core/include/Acts/Tools/SurfaceArrayCreator.hpp index 3ecced73cab240f5cc5a7a30b6b0b3308a8df11b..5c58b9a44588a47cf3a99f1bc126f807f4d7b76f 100644 --- a/Core/include/Acts/Tools/SurfaceArrayCreator.hpp +++ b/Core/include/Acts/Tools/SurfaceArrayCreator.hpp @@ -86,9 +86,6 @@ public: /// of bins to the lowest number of non-equivalent phi surfaces /// of all r-bins. If false, this step is skipped. bool doPhiBinningOptimization = true; - - /// The building context - GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor with default config @@ -122,6 +119,7 @@ public: /// to be ordered on the cylinder /// @pre the pointers to the sensitive surfaces in the surfaces vectors all /// need to be valid, since no check is performed + /// @param [in] gctx The gometry context fro this building call /// @param protoLayerOpt The proto layer containing the layer size /// @param binsPhi is the number of bins in phi for the surfaces /// @param binsZ is the number of bin in Z for the surfaces @@ -129,7 +127,8 @@ public: /// /// @return a unique pointer to a new SurfaceArray std::unique_ptr<SurfaceArray> - surfaceArrayOnCylinder(std::vector<std::shared_ptr<const Surface>> surfaces, + surfaceArrayOnCylinder(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi, size_t binsZ, boost::optional<ProtoLayer> protoLayerOpt @@ -147,6 +146,7 @@ public: /// to be ordered on the cylinder /// @pre the pointers to the sensitive surfaces in the surfaces vectors all /// need to be valid, since no check is performed + /// @param [in] gctx The gometry context fro this building call /// @param protoLayerOpt The proto layer containing the layer size /// @param bTypePhi the binning type in phi direction (equidistant/aribtrary) /// @param bTypeZ the binning type in z direction (equidistant/aribtrary) @@ -154,7 +154,8 @@ public: /// /// @return a unique pointer a new SurfaceArray std::unique_ptr<Acts::SurfaceArray> - surfaceArrayOnCylinder(std::vector<std::shared_ptr<const Surface>> surfaces, + surfaceArrayOnCylinder(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypePhi = equidistant, BinningType bTypeZ = equidistant, boost::optional<ProtoLayer> protoLayerOpt @@ -171,6 +172,7 @@ public: /// @pre the pointers to the sensitive surfaces in the surfaces vectors all /// need to be valid, since no check is performed /// @warning This function requires the disc aligned with the z-axis + /// @param [in] gctx The gometry context fro this building call /// @param protoLayerOpt The proto layer containing the layer size /// @param binsPhi is the number of bins in phi for the surfaces /// @param binsR is the number of bin in R for the surfaces @@ -178,7 +180,8 @@ public: /// /// @return a unique pointer a new SurfaceArray std::unique_ptr<SurfaceArray> - surfaceArrayOnDisc(std::vector<std::shared_ptr<const Surface>> surfaces, + surfaceArrayOnDisc(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR, size_t binsPhi, boost::optional<ProtoLayer> protoLayerOpt = boost::none, @@ -195,6 +198,7 @@ public: /// @pre the pointers to the sensitive surfaces in the surfaces vectors all /// need to be valid, since no check is performed /// @warning This function requires the disc aligned with the z-axis + /// @param [in] gctx The gometry context fro this building call /// @param protoLayerOpt The proto layer containing the layer size /// @param bTypeR the binning type in r direction (equidistant/aribtrary) /// @param bTypePhi the binning type in phi direction (equidistant/aribtrary) @@ -205,7 +209,8 @@ public: /// will be set to lowest number of surfaces of any R-ring. /// This ignores bTypePhi and produces equidistant binning in phi std::unique_ptr<Acts::SurfaceArray> - surfaceArrayOnDisc(std::vector<std::shared_ptr<const Surface>> surfaces, + surfaceArrayOnDisc(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, BinningType bTypePhi, boost::optional<ProtoLayer> protoLayerOpt = boost::none, @@ -215,6 +220,7 @@ public: /// SurfaceArrayCreator interface method /// - create an array on a plane /// + /// @param [in] gctx The gometry context fro this building call /// @param [in] surfaces is the vector of pointers to sensitive surfaces /// to be ordered on the plane /// @pre the pointers to the sensitive surfaces in the surfaces vectors all @@ -232,7 +238,8 @@ public: /// /// @return a unique pointer a new SurfaceArray std::unique_ptr<SurfaceArray> - surfaceArrayOnPlane(std::vector<std::shared_ptr<const Surface>> surfaces, + surfaceArrayOnPlane(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, size_t bins2, BinningValue bValue = BinningValue::binX, @@ -240,6 +247,12 @@ public: const std::shared_ptr<const Transform3D>& transformOpt = nullptr) const; + /// Static check funtion for surface equivalent + /// + /// @param [in] gctx the geometry context for this check + /// @param bValue the binning value for the binning + /// @param a first surface for checking + /// @param b second surface for checking static bool isSurfaceEquivalent(const GeometryContext& gctx, BinningValue bValue, @@ -306,7 +319,8 @@ private: const std::function<bool(const Surface*, const Surface*)>& equal) const; size_t - determineBinCount(const std::vector<const Surface*>& surfaces, + determineBinCount(const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces, BinningValue bValue) const; /// SurfaceArrayCreator internal method @@ -321,6 +335,7 @@ private: /// last surface. /// @note currently implemented for phi, r and z bining /// @todo implement for x,y binning + /// @param [in] gctx the geometry context for this call /// @param surfaces are the sensitive surfaces to be /// @param bValue the BinningValue in which direction should be binned /// (currently possible: binPhi, binR, binZ) @@ -330,7 +345,8 @@ private: /// @note This only creates the @c ProtoAxis, this needs to be turned /// into an actual @c Axis object to be used ProtoAxis - createVariableAxis(const std::vector<const Surface*>& surfaces, + createVariableAxis(const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces, BinningValue bValue, ProtoLayer protoLayer, Transform3D& transform) const; @@ -347,6 +363,7 @@ private: /// binning direction) to the first/last surface. /// @note currently implemented for phi, r and z bining /// @todo implement for x,y binning + /// @param [in] gctx the geometry context for this call /// @param surfaces are the sensitive surfaces to be /// @param bValue the BinningValue in which direction should be binned /// (currently possible: binPhi, binR, binZ) @@ -356,7 +373,8 @@ private: /// @note This only creates the @c ProtoAxis, this needs to be turned /// into an actual @c Axis object to be used ProtoAxis - createEquidistantAxis(const std::vector<const Surface*>& surfaces, + createEquidistantAxis(const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces, BinningValue bValue, ProtoLayer protoLayer, Transform3D& transform, @@ -448,16 +466,18 @@ private: /// I.e. to put a finer granularity binning onto your surface /// Neighbour bins are then filled to contain pointers as well /// This method delegates to SurfaceGridLookup itself. + /// @param [in] gctx the geometry context for this call /// @param sl The @c SurfaceGridLookup /// @param surfaces the surfaces void - completeBinning(SurfaceArray::ISurfaceGridLookup& sl, + completeBinning(const GeometryContext& gctx, + SurfaceArray::ISurfaceGridLookup& sl, const std::vector<const Surface*>& surfaces) const { ACTS_VERBOSE("Complete binning by filling closest neighbour surfaces into " "empty bins."); - size_t binCompleted = sl.completeBinning(m_cfg.buildContext, surfaces); + size_t binCompleted = sl.completeBinning(gctx, surfaces); ACTS_VERBOSE(" filled : " << binCompleted << " (includes under/overflow)"); @@ -465,11 +485,13 @@ private: /// Private helper method to transform the vertices of surface bounds into /// global coordinates + /// @param [in] gctx the geometry context for this call /// @param surface the surface associated with the given vertices /// @param locVertices a vector of the vertices in local coordinates /// @return a vector of the vertices in global coordinates std::vector<Acts::Vector3D> - makeGlobalVertices(const Acts::Surface& surface, + makeGlobalVertices(const GeometryContext& gctx, + const Acts::Surface& surface, const std::vector<Acts::Vector2D>& locVertices) const; }; diff --git a/Core/include/Acts/Tools/TrackingGeometryBuilder.hpp b/Core/include/Acts/Tools/TrackingGeometryBuilder.hpp index 743c5b63fc37b2518896897855322ce704f016ab..a66e4a1325602aaf9a80affb6f86ab845de01c51 100644 --- a/Core/include/Acts/Tools/TrackingGeometryBuilder.hpp +++ b/Core/include/Acts/Tools/TrackingGeometryBuilder.hpp @@ -52,9 +52,6 @@ public: /// the tracking volume helper for detector construction std::shared_ptr<const ITrackingVolumeHelper> trackingVolumeHelper = nullptr; - - /// The building context - GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor @@ -70,9 +67,12 @@ public: ~TrackingGeometryBuilder() override = default; /// TrackingGeometry Interface method + /// + /// @param gctx geometry context of that building call + /// /// @return a unique pointer to a TrackingGeometry std::unique_ptr<const TrackingGeometry> - trackingGeometry() const final; + trackingGeometry(const GeometryContext& gctx) const final; /// Set configuration method /// diff --git a/Core/include/Acts/Tools/TrackingVolumeArrayCreator.hpp b/Core/include/Acts/Tools/TrackingVolumeArrayCreator.hpp index fda4511945d3f5ee471a270c5c908f4ad2c062f1..d44fcfea1fb6466faa99eb854faebc009111583e 100644 --- a/Core/include/Acts/Tools/TrackingVolumeArrayCreator.hpp +++ b/Core/include/Acts/Tools/TrackingVolumeArrayCreator.hpp @@ -37,18 +37,16 @@ public: /// @brief This struct stores the configuration of the tracking geometry struct Config { - /// The building context - GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor /// /// @param logger logging instance - TrackingVolumeArrayCreator(const Config& cfg, + TrackingVolumeArrayCreator(const Config& /*cfg*/, std::unique_ptr<const Logger> logger = getDefaultLogger("LayerArrayCreator", Logging::INFO)) - : m_cfg(cfg), m_logger(std::move(logger)) + : m_logger(std::move(logger)) { } @@ -57,12 +55,14 @@ public: /// create a tracking volume array /// - /// @param tVolumes is the vector of TrackingVolumes to be - /// @param bValue is the binning value + /// @param [in] gctx the geometry context for this building + /// @param [in] tVolumes is the vector of TrackingVolumes to be + /// @param [in] bValue is the binning value /// /// @return new created volume array std::shared_ptr<const TrackingVolumeArray> - trackingVolumeArray(const TrackingVolumeVector& tVolumes, + trackingVolumeArray(const GeometryContext& gctx, + const TrackingVolumeVector& tVolumes, BinningValue bValue) const override; /// Set logging instance @@ -82,9 +82,6 @@ private: return *m_logger; } - /// The config class - Config m_cfg; - /// logging instance std::unique_ptr<const Logger> m_logger; }; diff --git a/Core/include/Acts/Utilities/CalibrationContext.hpp b/Core/include/Acts/Utilities/CalibrationContext.hpp index 0f6770794491cc8a1a6ac2efb7846987e653e974..c34365ad84a789a0ca4c8d0a27e7ef54b7f88e16 100644 --- a/Core/include/Acts/Utilities/CalibrationContext.hpp +++ b/Core/include/Acts/Utilities/CalibrationContext.hpp @@ -8,7 +8,7 @@ #pragma once -/// Set the CalibrationContext PLUGIN +/// Set the Calibration Context PLUGIN #ifdef ACTS_CORE_CALIBRATIONCONTEXT_PLUGIN #include ACTS_CORE_CALIBRATIONCONTEXT_PLUGIN #else @@ -23,8 +23,7 @@ namespace Acts { /// It is propagated through the code to allow for event/thread /// dependent calibration -using CalibrationContext = std::any; -using DefaultCalibrationContext = CalibrationContext; +using CalibrationContext = std::any; } // namespace Acts diff --git a/Core/include/Acts/Utilities/GeometryContext.hpp b/Core/include/Acts/Utilities/GeometryContext.hpp index 1aadb1ba271a409337b6c41df23e5218ff38089b..a2c07451cfaa11cbce4109d1114b452e6e4464b9 100644 --- a/Core/include/Acts/Utilities/GeometryContext.hpp +++ b/Core/include/Acts/Utilities/GeometryContext.hpp @@ -8,7 +8,7 @@ #pragma once -/// Set the GeometryContext PLUGIN +/// Set the Geometry Context PLUGIN #ifdef ACTS_CORE_GEOMETRYCONTEXT_PLUGIN #include ACTS_CORE_GEOMETRYCONTEXT_PLUGIN #else @@ -23,8 +23,7 @@ namespace Acts { /// It is propagated through the code to allow for event/thread /// dependent geometry changes -using GeometryContext = std::any; -using DefaultGeometryContext = GeometryContext; +using GeometryContext = std::any; } // namespace Acts diff --git a/Core/include/Acts/Utilities/MagneticFieldContext.hpp b/Core/include/Acts/Utilities/MagneticFieldContext.hpp index e65891a4f2938e8a6fb135e04a950a19203d4606..ecbc5118d8954207bc97e7b2f3510627ed2b3b37 100644 --- a/Core/include/Acts/Utilities/MagneticFieldContext.hpp +++ b/Core/include/Acts/Utilities/MagneticFieldContext.hpp @@ -8,7 +8,7 @@ #pragma once -/// Set the MAgneticFieldContext PLUGIN +/// Set the Mangetic Field Context PLUGIN #ifdef ACTS_CORE_MAGFIELDCONTEXT_PLUGIN #include ACTS_CORE_MAGFIELDCONTEXT_PLUGIN #else @@ -23,8 +23,7 @@ namespace Acts { /// It is propagated through the code to allow for event/thread /// dependent magnetic field changes -using MagneticFieldContext = std::any; -using DefaultMagneticFieldContext = MagneticFieldContext; +using MagneticFieldContext = std::any; } // namespace Acts diff --git a/Core/src/Detector/TrackingVolume.cpp b/Core/src/Detector/TrackingVolume.cpp index 5c163cb124f1b5f8680c9b75a58deccbda192237..c2dab9040072b2f3efebff08a37e61f4427b3370 100644 --- a/Core/src/Detector/TrackingVolume.cpp +++ b/Core/src/Detector/TrackingVolume.cpp @@ -137,6 +137,7 @@ Acts::TrackingVolume::createBoundarySurfaces() void Acts::TrackingVolume::glueTrackingVolume( + const GeometryContext& gctx, BoundarySurfaceFace bsfMine, const std::shared_ptr<TrackingVolume>& neighbor, BoundarySurfaceFace bsfNeighbor) @@ -144,16 +145,16 @@ Acts::TrackingVolume::glueTrackingVolume( // find the connection of the two tracking volumes : binR returns the center // except for cylindrical volumes - Vector3D bPosition(binningPosition(DefaultGeometryContext(), binR)); - Vector3D distance = Vector3D( - neighbor->binningPosition(DefaultGeometryContext(), binR) - bPosition); + Vector3D bPosition(binningPosition(gctx, binR)); + Vector3D distance + = Vector3D(neighbor->binningPosition(gctx, binR) - bPosition); // glue to the face std::shared_ptr<const BoundarySurfaceT<TrackingVolume>> bSurfaceMine = boundarySurfaces().at(bsfMine); // @todo - complex glueing could be possible with actual intersection for the // normal vector - Vector3D normal = bSurfaceMine->surfaceRepresentation().normal( - DefaultGeometryContext(), bPosition); + Vector3D normal + = bSurfaceMine->surfaceRepresentation().normal(gctx, bPosition); // estimate the orientation BoundaryOrientation bOrientation = (normal.dot(distance) > 0.) ? outsideVolume : insideVolume; @@ -173,6 +174,7 @@ Acts::TrackingVolume::glueTrackingVolume( void Acts::TrackingVolume::glueTrackingVolumes( + const GeometryContext& gctx, BoundarySurfaceFace bsfMine, const std::shared_ptr<TrackingVolumeArray>& neighbors, BoundarySurfaceFace bsfNeighbor) @@ -182,16 +184,16 @@ Acts::TrackingVolume::glueTrackingVolumes( std::shared_ptr<const TrackingVolume> nRefVolume = neighbors->arrayObjects().at(0); // get the distance - Vector3D bPosition(binningPosition(DefaultGeometryContext(), binR)); - Vector3D distance = Vector3D( - nRefVolume->binningPosition(DefaultGeometryContext(), binR) - bPosition); + Vector3D bPosition(binningPosition(gctx, binR)); + Vector3D distance + = Vector3D(nRefVolume->binningPosition(gctx, binR) - bPosition); // take the normal at the binning positio std::shared_ptr<const BoundarySurfaceT<TrackingVolume>> bSurfaceMine = boundarySurfaces().at(bsfMine); // @todo - complex glueing could be possible with actual intersection for the // normal vector - Vector3D normal = bSurfaceMine->surfaceRepresentation().normal( - DefaultGeometryContext(), bPosition); + Vector3D normal + = bSurfaceMine->surfaceRepresentation().normal(gctx, bPosition); // estimate the orientation BoundaryOrientation bOrientation = (normal.dot(distance) > 0.) ? outsideVolume : insideVolume; diff --git a/Core/src/Layers/PlaneLayer.cpp b/Core/src/Layers/PlaneLayer.cpp index ae4bce274ce2ab6f0f3811d1ac366df0c67e1026..ab93c9fad87d8accea3a6b2cbc523d4b30312cdc 100644 --- a/Core/src/Layers/PlaneLayer.cpp +++ b/Core/src/Layers/PlaneLayer.cpp @@ -63,11 +63,10 @@ Acts::PlaneLayer::buildApproachDescriptor() // get the appropriate transform, the center and the normal vector //@todo fix with representing volume - const Transform3D& lTransform - = PlaneSurface::transform(DefaultGeometryContext()); - RotationMatrix3D lRotation = lTransform.rotation(); - const Vector3D& lCenter = PlaneSurface::center(DefaultGeometryContext()); - const Vector3D& lVector = Surface::normal(DefaultGeometryContext(), lCenter); + const Transform3D& lTransform = PlaneSurface::transform(GeometryContext()); + RotationMatrix3D lRotation = lTransform.rotation(); + const Vector3D& lCenter = PlaneSurface::center(GeometryContext()); + const Vector3D& lVector = Surface::normal(GeometryContext(), lCenter); // create new surfaces const Transform3D* apnTransform = new Transform3D( Translation3D(lCenter - 0.5 * Layer::m_layerThickness * lVector) diff --git a/Core/src/Tools/CuboidVolumeBuilder.cpp b/Core/src/Tools/CuboidVolumeBuilder.cpp index a7025cca8d8a5ea14fcec5c18450daa6bf48d974..36d0e3b0a13c0c5f412ecd7b62ad9426d2417724 100644 --- a/Core/src/Tools/CuboidVolumeBuilder.cpp +++ b/Core/src/Tools/CuboidVolumeBuilder.cpp @@ -27,7 +27,8 @@ std::shared_ptr<const Acts::PlaneSurface> Acts::CuboidVolumeBuilder::buildSurface( - const Acts::CuboidVolumeBuilder::SurfaceConfig& cfg) const + const GeometryContext& /*gctx*/, + const CuboidVolumeBuilder::SurfaceConfig& cfg) const { std::shared_ptr<PlaneSurface> surface; @@ -52,11 +53,12 @@ Acts::CuboidVolumeBuilder::buildSurface( std::shared_ptr<const Acts::Layer> Acts::CuboidVolumeBuilder::buildLayer( + const GeometryContext& gctx, Acts::CuboidVolumeBuilder::LayerConfig& cfg) const { // Build the surface if (cfg.surface == nullptr) { - cfg.surface = buildSurface(cfg.surfaceCfg); + cfg.surface = buildSurface(gctx, cfg.surfaceCfg); } // Build transformation centered at the surface position Transform3D trafo(Transform3D::Identity() * cfg.surfaceCfg.rotation); @@ -66,7 +68,8 @@ Acts::CuboidVolumeBuilder::buildLayer( lCfg.surfaceArrayCreator = std::make_shared<const SurfaceArrayCreator>(); LayerCreator layerCreator(lCfg); - return layerCreator.planeLayer({cfg.surface}, + return layerCreator.planeLayer(gctx, + {cfg.surface}, cfg.binsY, cfg.binsZ, BinningValue::binX, @@ -76,6 +79,7 @@ Acts::CuboidVolumeBuilder::buildLayer( std::pair<double, double> Acts::CuboidVolumeBuilder::binningRange( + const GeometryContext& /*gctx*/, const Acts::CuboidVolumeBuilder::VolumeConfig& cfg) const { // Construct return value @@ -95,6 +99,7 @@ Acts::CuboidVolumeBuilder::binningRange( std::shared_ptr<Acts::TrackingVolume> Acts::CuboidVolumeBuilder::buildVolume( + const GeometryContext& gctx, Acts::CuboidVolumeBuilder::VolumeConfig& cfg) const { // Build transformation @@ -131,7 +136,7 @@ Acts::CuboidVolumeBuilder::buildVolume( cfg.layers.reserve(cfg.layerCfg.size()); for (auto& layerCfg : cfg.layerCfg) { - cfg.layers.push_back(buildLayer(layerCfg)); + cfg.layers.push_back(buildLayer(gctx, layerCfg)); layVec.push_back(cfg.layers.back()); } } else { @@ -141,13 +146,13 @@ Acts::CuboidVolumeBuilder::buildVolume( } // Build layer array - std::pair<double, double> minMax = binningRange(cfg); + std::pair<double, double> minMax = binningRange(gctx, cfg); LayerArrayCreator::Config lacCnf; - lacCnf.buildContext = m_cfg.buildContext; - LayerArrayCreator layArrCreator( + LayerArrayCreator layArrCreator( lacCnf, getDefaultLogger("LayerArrayCreator", Logging::INFO)); std::unique_ptr<const LayerArray> layArr( - layArrCreator.layerArray(layVec, + layArrCreator.layerArray(gctx, + layVec, minMax.first, minMax.second, BinningType::arbitrary, @@ -166,7 +171,9 @@ Acts::CuboidVolumeBuilder::buildVolume( return trackVolume; } -Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume( +Acts::MutableTrackingVolumePtr +Acts::CuboidVolumeBuilder::trackingVolume( + const GeometryContext& gctx, Acts::TrackingVolumePtr /*unused*/, Acts::VolumeBoundsPtr /*unused*/) const { @@ -174,15 +181,17 @@ Acts::MutableTrackingVolumePtr Acts::CuboidVolumeBuilder::trackingVolume( std::vector<std::shared_ptr<TrackingVolume>> volumes; volumes.reserve(m_cfg.volumeCfg.size()); for (VolumeConfig volCfg : m_cfg.volumeCfg) { - volumes.push_back(buildVolume(volCfg)); + volumes.push_back(buildVolume(gctx, volCfg)); } // Glue volumes for (unsigned int i = 0; i < volumes.size() - 1; i++) { - volumes[i + 1]->glueTrackingVolume(BoundarySurfaceFace::negativeFaceYZ, + volumes[i + 1]->glueTrackingVolume(gctx, + BoundarySurfaceFace::negativeFaceYZ, volumes[i], BoundarySurfaceFace::positiveFaceYZ); - volumes[i]->glueTrackingVolume(BoundarySurfaceFace::positiveFaceYZ, + volumes[i]->glueTrackingVolume(gctx, + BoundarySurfaceFace::positiveFaceYZ, volumes[i + 1], BoundarySurfaceFace::negativeFaceYZ); } diff --git a/Core/src/Tools/CylinderVolumeBuilder.cpp b/Core/src/Tools/CylinderVolumeBuilder.cpp index c0225f783943452247833d7d00af5812feb0927a..5ba45fa82d0209322ef41a07603598571cb28e50 100644 --- a/Core/src/Tools/CylinderVolumeBuilder.cpp +++ b/Core/src/Tools/CylinderVolumeBuilder.cpp @@ -47,8 +47,9 @@ Acts::CylinderVolumeBuilder::setLogger(std::unique_ptr<const Logger> newLogger) std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeBuilder::trackingVolume( - TrackingVolumePtr existingVolume, - VolumeBoundsPtr externalBounds) const + const GeometryContext& gctx, + TrackingVolumePtr existingVolume, + VolumeBoundsPtr externalBounds) const { ACTS_DEBUG("Configured to build volume : " << m_cfg.volumeName); @@ -68,11 +69,11 @@ Acts::CylinderVolumeBuilder::trackingVolume( // the layers are built by the layer builder if (m_cfg.layerBuilder) { // the negative Layers - negativeLayers = m_cfg.layerBuilder->negativeLayers(); + negativeLayers = m_cfg.layerBuilder->negativeLayers(gctx); // the central Layers - centralLayers = m_cfg.layerBuilder->centralLayers(); + centralLayers = m_cfg.layerBuilder->centralLayers(gctx); // the positive Layer - positiveLayers = m_cfg.layerBuilder->positiveLayers(); + positiveLayers = m_cfg.layerBuilder->positiveLayers(gctx); } // (0) PREP WORK ------------------------------------------------ // @@ -128,9 +129,9 @@ Acts::CylinderVolumeBuilder::trackingVolume( // Find out with Layer analysis // analyze the layers - wConfig.nVolumeConfig = analyzeLayers(negativeLayers); - wConfig.cVolumeConfig = analyzeLayers(centralLayers); - wConfig.pVolumeConfig = analyzeLayers(positiveLayers); + wConfig.nVolumeConfig = analyzeLayers(gctx, negativeLayers); + wConfig.cVolumeConfig = analyzeLayers(gctx, centralLayers); + wConfig.pVolumeConfig = analyzeLayers(gctx, positiveLayers); std::string layerConfiguration = "|"; if (wConfig.nVolumeConfig) { @@ -183,7 +184,8 @@ Acts::CylinderVolumeBuilder::trackingVolume( auto tvHelper = m_cfg.trackingVolumeHelper; // the barrel is always created auto barrel = wConfig.cVolumeConfig - ? tvHelper->createTrackingVolume(wConfig.cVolumeConfig.layers, + ? tvHelper->createTrackingVolume(gctx, + wConfig.cVolumeConfig.layers, m_cfg.volumeMaterial, wConfig.cVolumeConfig.rMin, wConfig.cVolumeConfig.rMax, @@ -194,7 +196,8 @@ Acts::CylinderVolumeBuilder::trackingVolume( // the negative endcap is created if present auto nEndcap = wConfig.nVolumeConfig - ? tvHelper->createTrackingVolume(wConfig.nVolumeConfig.layers, + ? tvHelper->createTrackingVolume(gctx, + wConfig.nVolumeConfig.layers, m_cfg.volumeMaterial, wConfig.nVolumeConfig.rMin, wConfig.nVolumeConfig.rMax, @@ -205,7 +208,8 @@ Acts::CylinderVolumeBuilder::trackingVolume( // the positive endcap is created auto pEndcap = wConfig.pVolumeConfig - ? tvHelper->createTrackingVolume(wConfig.pVolumeConfig.layers, + ? tvHelper->createTrackingVolume(gctx, + wConfig.pVolumeConfig.layers, m_cfg.volumeMaterial, wConfig.pVolumeConfig.rMin, wConfig.pVolumeConfig.rMax, @@ -236,7 +240,7 @@ Acts::CylinderVolumeBuilder::trackingVolume( } // and low lets create the new volume volume = volumesContainer.size() > 1 - ? tvHelper->createContainerTrackingVolume(volumesContainer) + ? tvHelper->createContainerTrackingVolume(gctx, volumesContainer) : volume; } else if (wConfig.wCondition != Attaching) { // the new volume is the only one present @@ -252,7 +256,8 @@ Acts::CylinderVolumeBuilder::trackingVolume( if (wConfig.fGapVolumeConfig) { // create the gap volume auto fGap - = tvHelper->createGapTrackingVolume(m_cfg.volumeMaterial, + = tvHelper->createGapTrackingVolume(gctx, + m_cfg.volumeMaterial, wConfig.fGapVolumeConfig.rMin, wConfig.fGapVolumeConfig.rMax, wConfig.fGapVolumeConfig.zMin, @@ -267,7 +272,8 @@ Acts::CylinderVolumeBuilder::trackingVolume( if (wConfig.sGapVolumeConfig) { // create the gap volume auto sGap - = tvHelper->createGapTrackingVolume(m_cfg.volumeMaterial, + = tvHelper->createGapTrackingVolume(gctx, + m_cfg.volumeMaterial, wConfig.sGapVolumeConfig.rMin, wConfig.sGapVolumeConfig.rMax, wConfig.sGapVolumeConfig.zMin, @@ -281,7 +287,7 @@ Acts::CylinderVolumeBuilder::trackingVolume( // and low lets create the new existing volume with gaps existingVolumeCp = existingContainer.size() > 1 - ? tvHelper->createContainerTrackingVolume(existingContainer) + ? tvHelper->createContainerTrackingVolume(gctx, existingContainer) : existingVolumeCp; // for central wrapping or inserting, we need to update once more @@ -296,7 +302,7 @@ Acts::CylinderVolumeBuilder::trackingVolume( } // update existingVolumeCp = !existingContainer.empty() - ? tvHelper->createContainerTrackingVolume(existingContainer) + ? tvHelper->createContainerTrackingVolume(gctx, existingContainer) : existingVolumeCp; std::vector<std::shared_ptr<const TrackingVolume>> totalContainer; @@ -321,7 +327,7 @@ Acts::CylinderVolumeBuilder::trackingVolume( return nullptr; } // now create the new container volume - volume = tvHelper->createContainerTrackingVolume(totalContainer); + volume = tvHelper->createContainerTrackingVolume(gctx, totalContainer); } // sign the volume and return it volume->sign(GeometrySignature(m_cfg.volumeSignature)); @@ -331,7 +337,8 @@ Acts::CylinderVolumeBuilder::trackingVolume( // ----------------------------- Acts::VolumeConfig -Acts::CylinderVolumeBuilder::analyzeLayers(const LayerVector& lVector) const +Acts::CylinderVolumeBuilder::analyzeLayers(const GeometryContext& gctx, + const LayerVector& lVector) const { // @TODO add envelope tolerance // @@ -346,8 +353,7 @@ Acts::CylinderVolumeBuilder::analyzeLayers(const LayerVector& lVector) const // the thickness of the layer needs to be taken into account double thickness = layer->thickness(); // get the center of the layer - const Vector3D& center - = layer->surfaceRepresentation().center(DefaultGeometryContext()); + const Vector3D& center = layer->surfaceRepresentation().center(gctx); // check if it is a cylinder layer const CylinderLayer* cLayer = dynamic_cast<const CylinderLayer*>(layer.get()); diff --git a/Core/src/Tools/CylinderVolumeHelper.cpp b/Core/src/Tools/CylinderVolumeHelper.cpp index 9625e640fe457680a634842ba200102096c2e34a..bcf1981a9a326c81870ae675a50b1ec1556abe30 100644 --- a/Core/src/Tools/CylinderVolumeHelper.cpp +++ b/Core/src/Tools/CylinderVolumeHelper.cpp @@ -54,6 +54,7 @@ Acts::CylinderVolumeHelper::setLogger(std::unique_ptr<const Logger> newLogger) std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createTrackingVolume( + const GeometryContext& gctx, const LayerVector& layers, std::shared_ptr<const Material> matprop, std::shared_ptr<const VolumeBounds> volBounds, @@ -92,7 +93,8 @@ Acts::CylinderVolumeHelper::createTrackingVolume( BinningValue bValue = binR; // check the dimension and fill raw data - if (not estimateAndCheckDimension(layers, + if (not estimateAndCheckDimension(gctx, + layers, cylinderBounds, transform, rMinRaw, @@ -126,9 +128,10 @@ Acts::CylinderVolumeHelper::createTrackingVolume( // create the Layer Array layerArray = (bValue == binR) - ? m_cfg.layerArrayCreator->layerArray(layers, rMin, rMax, bType, bValue) + ? m_cfg.layerArrayCreator->layerArray( + gctx, layers, rMin, rMax, bType, bValue) : m_cfg.layerArrayCreator->layerArray( - layers, zMin, zMax, bType, bValue); + gctx, layers, zMin, zMax, bType, bValue); } // layers are created and done // make sure the ownership of the bounds is correct @@ -153,6 +156,7 @@ Acts::CylinderVolumeHelper::createTrackingVolume( std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createTrackingVolume( + const GeometryContext& gctx, const LayerVector& layers, std::shared_ptr<const Material> matprop, double rMin, @@ -199,12 +203,18 @@ Acts::CylinderVolumeHelper::createTrackingVolume( ? std::make_shared<const Transform3D>(Translation3D(0., 0., zPosition)) : nullptr; // call to the creation method with Bounds & Translation3D - return createTrackingVolume( - layers, matprop, VolumeBoundsPtr(cBounds), transform, volumeName, bType); + return createTrackingVolume(gctx, + layers, + matprop, + VolumeBoundsPtr(cBounds), + transform, + volumeName, + bType); } std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createGapTrackingVolume( + const GeometryContext& gctx, std::shared_ptr<const Material> matprop, double rMin, double rMax, @@ -237,7 +247,8 @@ Acts::CylinderVolumeHelper::createGapTrackingVolume( } // now call the main method - return createGapTrackingVolume(matprop, + return createGapTrackingVolume(gctx, + matprop, rMin, rMax, zMin, @@ -250,6 +261,7 @@ Acts::CylinderVolumeHelper::createGapTrackingVolume( std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createGapTrackingVolume( + const GeometryContext& gctx, std::shared_ptr<const Material> matprop, double rMin, double rMax, @@ -302,11 +314,12 @@ Acts::CylinderVolumeHelper::createGapTrackingVolume( } // now call the createTrackingVolume() method return createTrackingVolume( - layers, matprop, rMin, rMax, zMin, zMax, volumeName, bType); + gctx, layers, matprop, rMin, rMax, zMin, zMax, volumeName, bType); } std::shared_ptr<Acts::TrackingVolume> Acts::CylinderVolumeHelper::createContainerTrackingVolume( + const GeometryContext& gctx, const TrackingVolumeVector& volumes) const { // check if you have more than one volume @@ -409,8 +422,10 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( // create the volume array with the ITrackingVolumeArrayCreator std::shared_ptr<const TrackingVolumeArray> volumeArray = (rCase) - ? m_cfg.trackingVolumeArrayCreator->trackingVolumeArray(volumes, binR) - : m_cfg.trackingVolumeArrayCreator->trackingVolumeArray(volumes, binZ); + ? m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( + gctx, volumes, binR) + : m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( + gctx, volumes, binZ); if (volumeArray == nullptr) { ACTS_WARNING( "Creation of TrackingVolume array did not succeed - returning 0 "); @@ -426,7 +441,7 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( // glueing section // -------------------------------------------------------------------------------------- if (not interGlueTrackingVolume( - topVolume, rCase, rMin, rGlueMin, rMax, zSep1, zSep2)) { + gctx, topVolume, rCase, rMin, rGlueMin, rMax, zSep1, zSep2)) { ACTS_WARNING("Problem with inter-glueing of TrackingVolumes (needed) - " "returning 0 "); return nullptr; @@ -442,6 +457,7 @@ Acts::CylinderVolumeHelper::createContainerTrackingVolume( * volume */ bool Acts::CylinderVolumeHelper::estimateAndCheckDimension( + const GeometryContext& gctx, const LayerVector& layers, const CylinderVolumeBounds*& cylinderVolumeBounds, std::shared_ptr<const Transform3D>& transform, @@ -493,9 +509,7 @@ Acts::CylinderVolumeHelper::estimateAndCheckDimension( radial = true; // get the raw data double currentR = cylBounds->r(); - double centerZ = (layerIter->surfaceRepresentation()) - .center(DefaultGeometryContext()) - .z(); + double centerZ = (layerIter->surfaceRepresentation()).center(gctx).z(); // check for min/max in the cylinder bounds case currentRmin = currentR - (0.5 * (layerIter)->thickness()); currentRmax = currentR + (0.5 * (layerIter)->thickness()); @@ -507,12 +521,11 @@ Acts::CylinderVolumeHelper::estimateAndCheckDimension( &(layerIter->surfaceRepresentation()).bounds()); if (discBounds != nullptr) { // check for min/max in the cylinder bounds case - double centerZ - = (layerIter->surfaceRepresentation()).center(m_cfg.buildContext).z(); - currentRmin = discBounds->rMin(); - currentRmax = discBounds->rMax(); - currentZmin = centerZ - (0.5 * (layerIter)->thickness()); - currentZmax = centerZ + (0.5 * (layerIter)->thickness()); + double centerZ = (layerIter->surfaceRepresentation()).center(gctx).z(); + currentRmin = discBounds->rMin(); + currentRmax = discBounds->rMax(); + currentZmin = centerZ - (0.5 * (layerIter)->thickness()); + currentZmax = centerZ + (0.5 * (layerIter)->thickness()); } // the raw data takeSmaller(rMinClean, currentRmin); @@ -610,6 +623,7 @@ Acts::CylinderVolumeHelper::estimateAndCheckDimension( bool Acts::CylinderVolumeHelper::interGlueTrackingVolume( + const GeometryContext& gctx, const std::shared_ptr<TrackingVolume>& tVolume, bool rBinned, double rMin, @@ -674,7 +688,8 @@ Acts::CylinderVolumeHelper::interGlueTrackingVolume( = std::const_pointer_cast<TrackingVolume>(*tVolIter); std::shared_ptr<TrackingVolume> tVol2 = std::const_pointer_cast<TrackingVolume>(*(++tVolIter)); - glueTrackingVolumes(tVol1, + glueTrackingVolumes(gctx, + tVol1, tubeOuterCover, tVol2, tubeInnerCover, @@ -708,7 +723,8 @@ Acts::CylinderVolumeHelper::interGlueTrackingVolume( = std::const_pointer_cast<TrackingVolume>(*tVolIter); std::shared_ptr<TrackingVolume> tVol2 = std::const_pointer_cast<TrackingVolume>(*(++tVolIter)); - glueTrackingVolumes(tVol1, + glueTrackingVolumes(gctx, + tVol1, positiveFaceXY, tVol2, negativeFaceXY, @@ -726,7 +742,7 @@ Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr<const TrackingVolumeArray> glueVolumesNegativeFaceArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - glueVolumesNegativeFace, binR); + gctx, glueVolumesNegativeFace, binR); // register the glue voluems glueDescr.registerGlueVolumes(negativeFaceXY, glueVolumesNegativeFaceArray); @@ -735,7 +751,7 @@ Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr<const TrackingVolumeArray> glueVolumesPositiveFaceArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - glueVolumesPositiveFace, binR); + gctx, glueVolumesPositiveFace, binR); // register the glue voluems glueDescr.registerGlueVolumes(positiveFaceXY, glueVolumesPositiveFaceArray); @@ -744,7 +760,7 @@ Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr<const TrackingVolumeArray> glueVolumesInnerTubeArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - glueVolumesInnerTube, binZ); + gctx, glueVolumesInnerTube, binZ); // register the glue voluems glueDescr.registerGlueVolumes(tubeInnerCover, glueVolumesInnerTubeArray); } @@ -752,7 +768,7 @@ Acts::CylinderVolumeHelper::interGlueTrackingVolume( // create the outside volume array std::shared_ptr<const TrackingVolumeArray> glueVolumesOuterTubeArray = m_cfg.trackingVolumeArrayCreator->trackingVolumeArray( - glueVolumesOuterTube, binZ); + gctx, glueVolumesOuterTube, binZ); // register the glue voluems glueDescr.registerGlueVolumes(tubeOuterCover, glueVolumesOuterTubeArray); } @@ -789,6 +805,7 @@ Acts::CylinderVolumeHelper::interGlueTrackingVolume( /** private helper method to fill the glue volumes (or the volume itself in) */ void Acts::CylinderVolumeHelper::glueTrackingVolumes( + const GeometryContext& gctx, const std::shared_ptr<TrackingVolume>& tvolOne, BoundarySurfaceFace faceOne, const std::shared_ptr<TrackingVolume>& tvolTwo, @@ -845,7 +862,8 @@ Acts::CylinderVolumeHelper::glueTrackingVolumes( << faceTwo << " ]"); // one to one is easy - mutableGlueVolOne->glueTrackingVolume(faceOne, mutableGlueVolTwo, faceTwo); + mutableGlueVolOne->glueTrackingVolume( + gctx, faceOne, mutableGlueVolTwo, faceTwo); } else if (volOneGlueVols <= 1) { // (ii) one -> many @@ -859,7 +877,7 @@ Acts::CylinderVolumeHelper::glueTrackingVolumes( auto mutableFaceTwoVolumes = std::const_pointer_cast<TrackingVolumeArray>( gvDescriptorTwo.glueVolumes(faceTwo)); mutableGlueVolOne->glueTrackingVolumes( - faceOne, mutableFaceTwoVolumes, faceTwo); + gctx, faceOne, mutableFaceTwoVolumes, faceTwo); } else if (volTwoGlueVols <= 1) { // (iii) many -> one ACTS_VERBOSE(" glue : many[ " << tvolOne->volumeName() << " @ " @@ -872,7 +890,7 @@ Acts::CylinderVolumeHelper::glueTrackingVolumes( auto mutableFaceOneVolumes = std::const_pointer_cast<TrackingVolumeArray>( gvDescriptorOne.glueVolumes(faceOne)); mutableGlueVolTwo->glueTrackingVolumes( - faceTwo, mutableFaceOneVolumes, faceOne); + gctx, faceTwo, mutableFaceOneVolumes, faceOne); } else { // (iv) glue array to array ACTS_VERBOSE(" glue : many[ " << tvolOne->volumeName() << " @ " diff --git a/Core/src/Tools/LayerArrayCreator.cpp b/Core/src/Tools/LayerArrayCreator.cpp index 2c10cf0e3c3e3c66bb11b930cab21fe40b916c16..ec3e818cf63cd55eaef42813f0469cb528770b93 100644 --- a/Core/src/Tools/LayerArrayCreator.cpp +++ b/Core/src/Tools/LayerArrayCreator.cpp @@ -28,11 +28,12 @@ #include "Acts/Utilities/GeometryStatics.hpp" std::unique_ptr<const Acts::LayerArray> -Acts::LayerArrayCreator::layerArray(const LayerVector& layersInput, - double min, - double max, - BinningType bType, - BinningValue bValue) const +Acts::LayerArrayCreator::layerArray(const GeometryContext& gctx, + const LayerVector& layersInput, + double min, + double max, + BinningType bType, + BinningValue bValue) const { ACTS_VERBOSE("Build LayerArray with " << layersInput.size() << " layers at input."); @@ -44,8 +45,7 @@ Acts::LayerArrayCreator::layerArray(const LayerVector& layersInput, LayerVector layers(layersInput); // sort it accordingly to the binning value - GeometryObjectSorterT<std::shared_ptr<const Layer>> layerSorter( - m_cfg.buildContext, bValue); + GeometryObjectSorterT<std::shared_ptr<const Layer>> layerSorter(gctx, bValue); std::sort(layers.begin(), layers.end(), layerSorter); // useful typedef using LayerOrderPosition = std::pair<std::shared_ptr<const Layer>, Vector3D>; @@ -61,9 +61,9 @@ Acts::LayerArrayCreator::layerArray(const LayerVector& layersInput, // loop over layers and put them in for (auto& layIter : layers) { ACTS_VERBOSE("equidistant : registering a Layer at binning position : " - << (layIter->binningPosition(m_cfg.buildContext, bValue))); - layerOrderVector.push_back(LayerOrderPosition( - layIter, layIter->binningPosition(m_cfg.buildContext, bValue))); + << (layIter->binningPosition(gctx, bValue))); + layerOrderVector.push_back( + LayerOrderPosition(layIter, layIter->binningPosition(gctx, bValue))); } // create the binUitlity binUtility = std::make_unique<const BinUtility>( @@ -84,7 +84,7 @@ Acts::LayerArrayCreator::layerArray(const LayerVector& layersInput, for (auto& layIter : layers) { // estimate the offset layerThickness = layIter->thickness(); - layerValue = layIter->binningPositionValue(m_cfg.buildContext, bValue); + layerValue = layIter->binningPositionValue(gctx, bValue); // register the new boundaries in the step vector boundaries.push_back(layerValue - 0.5 * layerThickness); boundaries.push_back(layerValue + 0.5 * layerThickness); @@ -110,30 +110,27 @@ Acts::LayerArrayCreator::layerArray(const LayerVector& layersInput, // create the navigation layer surface from the layer std::shared_ptr<const Surface> navLayerSurface = createNavigationSurface( - *layIter, bValue, -std::abs(layerValue - navigationValue)); - ACTS_VERBOSE( - "arbitrary : creating a NavigationLayer at " - << (navLayerSurface->binningPosition(m_cfg.buildContext, bValue)).x() - << ", " - << (navLayerSurface->binningPosition(m_cfg.buildContext, bValue)).y() - << ", " - << (navLayerSurface->binningPosition(m_cfg.buildContext, bValue)) - .z()); + gctx, *layIter, bValue, -std::abs(layerValue - navigationValue)); + ACTS_VERBOSE("arbitrary : creating a NavigationLayer at " + << (navLayerSurface->binningPosition(gctx, bValue)).x() + << ", " + << (navLayerSurface->binningPosition(gctx, bValue)).y() + << ", " + << (navLayerSurface->binningPosition(gctx, bValue)).z()); navLayer = NavigationLayer::create(std::move(navLayerSurface)); // push the navigation layer in layerOrderVector.push_back(LayerOrderPosition( - navLayer, navLayer->binningPosition(m_cfg.buildContext, bValue))); + navLayer, navLayer->binningPosition(gctx, bValue))); // push the original layer in - layerOrderVector.push_back(LayerOrderPosition( - layIter, layIter->binningPosition(m_cfg.buildContext, bValue))); - ACTS_VERBOSE( - "arbitrary : registering MaterialLayer at " - << (layIter->binningPosition(m_cfg.buildContext, bValue)).x() - << ", " - << (layIter->binningPosition(m_cfg.buildContext, bValue)).y() - << ", " - << (layIter->binningPosition(m_cfg.buildContext, bValue)).z()); + layerOrderVector.push_back( + LayerOrderPosition(layIter, layIter->binningPosition(gctx, bValue))); + ACTS_VERBOSE("arbitrary : registering MaterialLayer at " + << (layIter->binningPosition(gctx, bValue)).x() + << ", " + << (layIter->binningPosition(gctx, bValue)).y() + << ", " + << (layIter->binningPosition(gctx, bValue)).z()); // remember the last lastLayer = layIter; } @@ -144,19 +141,17 @@ Acts::LayerArrayCreator::layerArray(const LayerVector& layersInput, if (navigationValue != max) { // create the navigation layer surface from the layer std::shared_ptr<const Surface> navLayerSurface = createNavigationSurface( - *lastLayer, bValue, navigationValue - layerValue); - ACTS_VERBOSE( - "arbitrary : creating a NavigationLayer at " - << (navLayerSurface->binningPosition(m_cfg.buildContext, bValue)).x() - << ", " - << (navLayerSurface->binningPosition(m_cfg.buildContext, bValue)).y() - << ", " - << (navLayerSurface->binningPosition(m_cfg.buildContext, bValue)) - .z()); + gctx, *lastLayer, bValue, navigationValue - layerValue); + ACTS_VERBOSE("arbitrary : creating a NavigationLayer at " + << (navLayerSurface->binningPosition(gctx, bValue)).x() + << ", " + << (navLayerSurface->binningPosition(gctx, bValue)).y() + << ", " + << (navLayerSurface->binningPosition(gctx, bValue)).z()); navLayer = NavigationLayer::create(std::move(navLayerSurface)); // push the navigation layer in layerOrderVector.push_back(LayerOrderPosition( - navLayer, navLayer->binningPosition(m_cfg.buildContext, bValue))); + navLayer, navLayer->binningPosition(gctx, bValue))); } // now close the boundaries boundaries.push_back(max); @@ -179,9 +174,10 @@ Acts::LayerArrayCreator::layerArray(const LayerVector& layersInput, } std::shared_ptr<Acts::Surface> -Acts::LayerArrayCreator::createNavigationSurface(const Layer& layer, - BinningValue bValue, - double offset) const +Acts::LayerArrayCreator::createNavigationSurface(const GeometryContext& gctx, + const Layer& layer, + BinningValue bValue, + double offset) const { // surface reference const Surface& layerSurface = layer.surfaceRepresentation(); @@ -220,7 +216,7 @@ Acts::LayerArrayCreator::createNavigationSurface(const Layer& layer, if (layerSurface.type() != Surface::Cylinder) { // create a transform that does the shift Transform3D shift = Transform3D(Translation3D(translation)); - navigationSurface = layerSurface.clone(m_cfg.buildContext, shift); + navigationSurface = layerSurface.clone(gctx, shift); } else { // get the bounds const CylinderBounds* cBounds @@ -229,9 +225,8 @@ Acts::LayerArrayCreator::createNavigationSurface(const Layer& layer, double halflengthZ = cBounds->halflengthZ(); // create the new layer surface std::shared_ptr<const Transform3D> navTrasform - = (!layerSurface.transform(m_cfg.buildContext).isApprox(s_idTransform)) - ? std::make_shared<const Transform3D>( - layerSurface.transform(m_cfg.buildContext)) + = (!layerSurface.transform(gctx).isApprox(s_idTransform)) + ? std::make_shared<const Transform3D>(layerSurface.transform(gctx)) : nullptr; // new navigation layer navigationSurface = Surface::makeShared<CylinderSurface>( diff --git a/Core/src/Tools/LayerCreator.cpp b/Core/src/Tools/LayerCreator.cpp index 5de5cbce0cfbfcb680d028e4f42a12a602466d6b..47130b1c6eac802c1d59fa5a051468278eb7d6d0 100644 --- a/Core/src/Tools/LayerCreator.cpp +++ b/Core/src/Tools/LayerCreator.cpp @@ -29,9 +29,8 @@ using Acts::VectorHelpers::phi; Acts::LayerCreator::LayerCreator(const Acts::LayerCreator::Config& lcConfig, std::unique_ptr<const Logger> logger) - : m_cfg(), m_logger(std::move(logger)) + : m_cfg(lcConfig), m_logger(std::move(logger)) { - setConfiguration(lcConfig); } void @@ -50,6 +49,7 @@ Acts::LayerCreator::setLogger(std::unique_ptr<const Logger> newLogger) Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi, size_t binsZ, @@ -59,7 +59,7 @@ Acts::LayerCreator::cylinderLayer( { ProtoLayer protoLayer - = _protoLayer ? *_protoLayer : ProtoLayer(m_cfg.buildContext, surfaces); + = _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); // remaining layer parameters double layerR @@ -114,9 +114,9 @@ Acts::LayerCreator::cylinderLayer( std::unique_ptr<SurfaceArray> sArray; if (!surfaces.empty()) { sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnCylinder( - std::move(surfaces), binsPhi, binsZ, protoLayer, nullptr); + gctx, std::move(surfaces), binsPhi, binsZ, protoLayer, nullptr); - checkBinning(*sArray); + checkBinning(gctx, *sArray); } // create the layer and push it back @@ -140,6 +140,7 @@ Acts::LayerCreator::cylinderLayer( Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypePhi, BinningType bTypeZ, @@ -149,7 +150,7 @@ Acts::LayerCreator::cylinderLayer( { ProtoLayer protoLayer - = _protoLayer ? *_protoLayer : ProtoLayer(m_cfg.buildContext, surfaces); + = _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); // remaining layer parameters double layerR @@ -201,9 +202,9 @@ Acts::LayerCreator::cylinderLayer( std::unique_ptr<SurfaceArray> sArray; if (!surfaces.empty()) { sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnCylinder( - std::move(surfaces), bTypePhi, bTypeZ, protoLayer, nullptr); + gctx, std::move(surfaces), bTypePhi, bTypeZ, protoLayer, nullptr); - checkBinning(*sArray); + checkBinning(gctx, *sArray); } // create the layer and push it back @@ -227,6 +228,7 @@ Acts::LayerCreator::cylinderLayer( Acts::MutableLayerPtr Acts::LayerCreator::discLayer( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR, size_t binsPhi, @@ -235,7 +237,7 @@ Acts::LayerCreator::discLayer( std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer - = _protoLayer ? *_protoLayer : ProtoLayer(m_cfg.buildContext, surfaces); + = _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); double layerZ = 0.5 * (protoLayer.minZ - protoLayer.envZ.first + protoLayer.maxZ @@ -275,9 +277,9 @@ Acts::LayerCreator::discLayer( std::unique_ptr<SurfaceArray> sArray; if (!surfaces.empty()) { sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnDisc( - std::move(surfaces), binsR, binsPhi, protoLayer, transform); + gctx, std::move(surfaces), binsR, binsPhi, protoLayer, transform); - checkBinning(*sArray); + checkBinning(gctx, *sArray); } // create the share disc bounds @@ -303,6 +305,7 @@ Acts::LayerCreator::discLayer( Acts::MutableLayerPtr Acts::LayerCreator::discLayer( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, BinningType bTypePhi, @@ -311,7 +314,7 @@ Acts::LayerCreator::discLayer( std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer - = _protoLayer ? *_protoLayer : ProtoLayer(m_cfg.buildContext, surfaces); + = _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); double layerZ = 0.5 * (protoLayer.minZ - protoLayer.envZ.first + protoLayer.maxZ @@ -348,9 +351,9 @@ Acts::LayerCreator::discLayer( std::unique_ptr<SurfaceArray> sArray; if (!surfaces.empty()) { sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnDisc( - std::move(surfaces), bTypeR, bTypePhi, protoLayer, transform); + gctx, std::move(surfaces), bTypeR, bTypePhi, protoLayer, transform); - checkBinning(*sArray); + checkBinning(gctx, *sArray); } // create the shared disc bounds @@ -373,6 +376,7 @@ Acts::LayerCreator::discLayer( Acts::MutableLayerPtr Acts::LayerCreator::planeLayer( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, size_t bins2, @@ -382,7 +386,7 @@ Acts::LayerCreator::planeLayer( std::unique_ptr<ApproachDescriptor> ad) const { ProtoLayer protoLayer - = _protoLayer ? *_protoLayer : ProtoLayer(m_cfg.buildContext, surfaces); + = _protoLayer ? *_protoLayer : ProtoLayer(gctx, surfaces); // remaining layer parameters double layerHalf1, layerHalf2, layerThickness; @@ -445,9 +449,9 @@ Acts::LayerCreator::planeLayer( std::unique_ptr<SurfaceArray> sArray; if (!surfaces.empty()) { sArray = m_cfg.surfaceArrayCreator->surfaceArrayOnPlane( - std::move(surfaces), bins1, bins2, bValue, protoLayer, transform); + gctx, std::move(surfaces), bins1, bins2, bValue, protoLayer, transform); - checkBinning(*sArray); + checkBinning(gctx, *sArray); } // create the layer and push it back @@ -483,7 +487,8 @@ Acts::LayerCreator::associateSurfacesToLayer(Layer& layer) const } bool -Acts::LayerCreator::checkBinning(const SurfaceArray& sArray) const +Acts::LayerCreator::checkBinning(const GeometryContext& gctx, + const SurfaceArray& sArray) const { // do consistency check: can we access all sensitive surfaces @@ -541,7 +546,7 @@ Acts::LayerCreator::checkBinning(const SurfaceArray& sArray) const ACTS_ERROR(" -- Inaccessible surfaces: "); for (const auto& srf : diff) { // have to choose BinningValue here - Vector3D ctr = srf->binningPosition(m_cfg.buildContext, binR); + Vector3D ctr = srf->binningPosition(gctx, binR); ACTS_ERROR(" Surface(x=" << ctr.x() << ", y=" << ctr.y() << ", z=" << ctr.z() << ", r=" diff --git a/Core/src/Tools/PassiveLayerBuilder.cpp b/Core/src/Tools/PassiveLayerBuilder.cpp index 2853fb032395f36051f0423b546a7c29b6d5285e..feb6aa1fe50379153c769b453bb7d03ba3793e64 100644 --- a/Core/src/Tools/PassiveLayerBuilder.cpp +++ b/Core/src/Tools/PassiveLayerBuilder.cpp @@ -22,7 +22,7 @@ Acts::PassiveLayerBuilder::PassiveLayerBuilder( const PassiveLayerBuilder::Config& plConfig, std::unique_ptr<const Logger> logger) - : m_cfg(), m_logger(std::move(logger)), m_nLayers(), m_cLayers(), m_pLayers() + : m_cfg(), m_logger(std::move(logger)) { setConfiguration(plConfig); } @@ -33,7 +33,6 @@ Acts::PassiveLayerBuilder::setConfiguration( { //!< @todo add configuration check m_cfg = plConfig; - constructLayers(); } void @@ -42,61 +41,36 @@ Acts::PassiveLayerBuilder::setLogger(std::unique_ptr<const Logger> newLogger) m_logger = std::move(newLogger); } -void -Acts::PassiveLayerBuilder::constructLayers() +const Acts::LayerVector +Acts::PassiveLayerBuilder::positiveLayers(const GeometryContext& gctx) const { - // DEBUG: Flush layers in case the class was already initialized before - m_nLayers.clear(); - m_cLayers.clear(); - m_pLayers.clear(); + return endcapLayers(gctx, 1); +} - // the central layers - size_t numcLayers = m_cfg.centralLayerRadii.size(); - if (numcLayers != 0u) { - ACTS_DEBUG("Configured to build " << numcLayers - << " passive central layers."); - m_cLayers.reserve(numcLayers); - // loop through - for (size_t icl = 0; icl < numcLayers; ++icl) { - // some screen output - ACTS_VERBOSE("- build layer " << icl << " with radius = " - << m_cfg.centralLayerRadii.at(icl) - << " and halfZ = " - << m_cfg.centralLayerHalflengthZ.at(icl)); - // create the layer and push it back - auto cBounds = std::make_shared<const CylinderBounds>( - m_cfg.centralLayerRadii[icl], m_cfg.centralLayerHalflengthZ.at(icl)); - // create the layer - MutableLayerPtr cLayer = CylinderLayer::create( - nullptr, cBounds, nullptr, m_cfg.centralLayerThickness.at(icl)); - // assign the material to the layer surface - std::shared_ptr<const SurfaceMaterial> material = nullptr; - // create the material from jobOptions - if (!m_cfg.centralLayerMaterial.empty()) { - // create homogeneous material - material = m_cfg.centralLayerMaterial.at(icl); - // sign it to the surface - cLayer->surfaceRepresentation().setAssociatedMaterial(material); - } - // push it into the layer vector - m_cLayers.push_back(cLayer); - } - } +const Acts::LayerVector +Acts::PassiveLayerBuilder::negativeLayers(const GeometryContext& gctx) const +{ + return endcapLayers(gctx, -1); +} +const Acts::LayerVector +Acts::PassiveLayerBuilder::endcapLayers(const Acts::GeometryContext& /*gctx*/, + int side) const +{ + LayerVector eLayers; // pos/neg layers size_t numpnLayers = m_cfg.posnegLayerPositionZ.size(); if (numpnLayers != 0u) { - ACTS_DEBUG("Configured to build 2 * " - << numpnLayers - << " passive positive/negative side layers."); - m_pLayers.reserve(numpnLayers); - m_nLayers.reserve(numpnLayers); + ACTS_DEBUG("Configured to build " << numpnLayers + << " passive layers on side :" + << side); + eLayers.reserve(numpnLayers); // loop through for (size_t ipnl = 0; ipnl < numpnLayers; ++ipnl) { // some screen output - ACTS_VERBOSE("- build layers " << (2 * ipnl) << " and " << (2 * ipnl) + 1 - << " at +/- z = " - << m_cfg.posnegLayerPositionZ.at(ipnl) + ACTS_VERBOSE("- build layers " << (ipnl) << " at = " + << side + * m_cfg.posnegLayerPositionZ.at(ipnl) << " and rMin/rMax = " << m_cfg.posnegLayerRmin.at(ipnl) << " / " @@ -106,21 +80,15 @@ Acts::PassiveLayerBuilder::constructLayers() = std::make_shared<const RadialBounds>( m_cfg.posnegLayerRmin.at(ipnl), m_cfg.posnegLayerRmax.at(ipnl)); // create the layer transforms - const Transform3D* nTransform = new Transform3D( - Translation3D(0., 0., -m_cfg.posnegLayerPositionZ.at(ipnl))); - const Transform3D* pTransform = new Transform3D( - Translation3D(0., 0., m_cfg.posnegLayerPositionZ.at(ipnl))); + const Transform3D* eTransform = new Transform3D( + Translation3D(0., 0., side * m_cfg.posnegLayerPositionZ.at(ipnl))); // create the layers - MutableLayerPtr nLayer - = DiscLayer::create(std::shared_ptr<const Transform3D>(nTransform), - dBounds, - nullptr, - m_cfg.posnegLayerThickness.at(ipnl)); - MutableLayerPtr pLayer - = DiscLayer::create(std::shared_ptr<const Transform3D>(pTransform), + MutableLayerPtr eLayer + = DiscLayer::create(std::shared_ptr<const Transform3D>(eTransform), dBounds, nullptr, m_cfg.posnegLayerThickness.at(ipnl)); + // assign the material to the layer surface std::shared_ptr<const SurfaceMaterial> material = nullptr; // create the material from jobOptions @@ -128,12 +96,52 @@ Acts::PassiveLayerBuilder::constructLayers() // create homogeneous material material = m_cfg.posnegLayerMaterial.at(ipnl); // sign it to the surface - nLayer->surfaceRepresentation().setAssociatedMaterial(material); - pLayer->surfaceRepresentation().setAssociatedMaterial(material); + eLayer->surfaceRepresentation().setAssociatedMaterial(material); + } + // push it into the layer vector + eLayers.push_back(eLayer); + } + } + return eLayers; +} + +const Acts::LayerVector +Acts::PassiveLayerBuilder::centralLayers( + const Acts::GeometryContext& /*gctx*/) const +{ + LayerVector cLayers; + // the central layers + size_t numcLayers = m_cfg.centralLayerRadii.size(); + if (numcLayers != 0u) { + + ACTS_DEBUG("Configured to build " << numcLayers + << " passive central layers."); + cLayers.reserve(numcLayers); + // loop through + for (size_t icl = 0; icl < numcLayers; ++icl) { + // some screen output + ACTS_VERBOSE("- build layer " << icl << " with radius = " + << m_cfg.centralLayerRadii.at(icl) + << " and halfZ = " + << m_cfg.centralLayerHalflengthZ.at(icl)); + // create the layer and push it back + auto cBounds = std::make_shared<const CylinderBounds>( + m_cfg.centralLayerRadii[icl], m_cfg.centralLayerHalflengthZ.at(icl)); + // create the layer + MutableLayerPtr cLayer = CylinderLayer::create( + nullptr, cBounds, nullptr, m_cfg.centralLayerThickness.at(icl)); + // assign the material to the layer surface + std::shared_ptr<const SurfaceMaterial> material = nullptr; + // create the material from jobOptions + if (!m_cfg.centralLayerMaterial.empty()) { + // create homogeneous material + material = m_cfg.centralLayerMaterial.at(icl); + // sign it to the surface + cLayer->surfaceRepresentation().setAssociatedMaterial(material); } // push it into the layer vector - m_nLayers.push_back(nLayer); - m_pLayers.push_back(pLayer); + cLayers.push_back(cLayer); } } + return cLayers; } diff --git a/Core/src/Tools/SurfaceArrayCreator.cpp b/Core/src/Tools/SurfaceArrayCreator.cpp index ffda4ab3cc3e92c139f66184d13bdb6ed982b771..bd66bc6b99997f0d80dae07afe3d89fa923877bc 100644 --- a/Core/src/Tools/SurfaceArrayCreator.cpp +++ b/Core/src/Tools/SurfaceArrayCreator.cpp @@ -29,6 +29,7 @@ using Acts::VectorHelpers::perp; std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsPhi, size_t binsZ, @@ -37,9 +38,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it - ProtoLayer protoLayer = protoLayerOpt - ? *protoLayerOpt - : ProtoLayer(m_cfg.buildContext, surfacesRaw); + ProtoLayer protoLayer + = protoLayerOpt ? *protoLayerOpt : ProtoLayer(gctx, surfacesRaw); ACTS_VERBOSE("Creating a SurfaceArray on a cylinder"); ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") @@ -51,9 +51,9 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( = transformOpt != nullptr ? *transformOpt : Transform3D::Identity(); ProtoAxis pAxisPhi = createEquidistantAxis( - surfacesRaw, binPhi, protoLayer, transform, binsPhi); - ProtoAxis pAxisZ - = createEquidistantAxis(surfacesRaw, binZ, protoLayer, transform, binsZ); + gctx, surfacesRaw, binPhi, protoLayer, transform, binsPhi); + ProtoAxis pAxisZ = createEquidistantAxis( + gctx, surfacesRaw, binZ, protoLayer, transform, binsZ); double R = protoLayer.maxR - protoLayer.minR; @@ -73,8 +73,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxisPhi, pAxisZ); - sl->fill(m_cfg.buildContext, surfacesRaw); - completeBinning(*sl, surfacesRaw); + sl->fill(gctx, surfacesRaw); + completeBinning(gctx, *sl, surfacesRaw); return std::make_unique<SurfaceArray>( std::move(sl), @@ -84,6 +84,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypePhi, BinningType bTypeZ, @@ -92,9 +93,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it - ProtoLayer protoLayer = protoLayerOpt - ? *protoLayerOpt - : ProtoLayer(m_cfg.buildContext, surfacesRaw); + ProtoLayer protoLayer + = protoLayerOpt ? *protoLayerOpt : ProtoLayer(gctx, surfacesRaw); double R = 0.5 * (protoLayer.maxR - protoLayer.minR); Transform3D transform @@ -104,16 +104,18 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( ProtoAxis pAxisZ; if (bTypePhi == equidistant) { - pAxisPhi - = createEquidistantAxis(surfacesRaw, binPhi, protoLayer, transform, 0); + pAxisPhi = createEquidistantAxis( + gctx, surfacesRaw, binPhi, protoLayer, transform, 0); } else { - pAxisPhi = createVariableAxis(surfacesRaw, binPhi, protoLayer, transform); + pAxisPhi + = createVariableAxis(gctx, surfacesRaw, binPhi, protoLayer, transform); } if (bTypeZ == equidistant) { - pAxisZ = createEquidistantAxis(surfacesRaw, binZ, protoLayer, transform); + pAxisZ + = createEquidistantAxis(gctx, surfacesRaw, binZ, protoLayer, transform); } else { - pAxisZ = createVariableAxis(surfacesRaw, binZ, protoLayer, transform); + pAxisZ = createVariableAxis(gctx, surfacesRaw, binZ, protoLayer, transform); } Transform3D itransform = transform.inverse(); @@ -131,8 +133,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxisPhi, pAxisZ); - sl->fill(m_cfg.buildContext, surfacesRaw); - completeBinning(*sl, surfacesRaw); + sl->fill(gctx, surfacesRaw); + completeBinning(gctx, *sl, surfacesRaw); // get the number of bins auto axes = sl->getAxes(); @@ -153,6 +155,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnCylinder( std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnDisc( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t binsR, size_t binsPhi, @@ -161,19 +164,18 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it - ProtoLayer protoLayer = protoLayerOpt - ? *protoLayerOpt - : ProtoLayer(m_cfg.buildContext, surfacesRaw); + ProtoLayer protoLayer + = protoLayerOpt ? *protoLayerOpt : ProtoLayer(gctx, surfacesRaw); ACTS_VERBOSE("Creating a SurfaceArray on a disc"); Transform3D transform = transformOpt != nullptr ? *transformOpt : Transform3D::Identity(); - ProtoAxis pAxisR - = createEquidistantAxis(surfacesRaw, binR, protoLayer, transform, binsR); + ProtoAxis pAxisR = createEquidistantAxis( + gctx, surfacesRaw, binR, protoLayer, transform, binsR); ProtoAxis pAxisPhi = createEquidistantAxis( - surfacesRaw, binPhi, protoLayer, transform, binsPhi); + gctx, surfacesRaw, binPhi, protoLayer, transform, binsPhi); double Z = 0.5 * (protoLayer.minZ + protoLayer.maxZ); ACTS_VERBOSE("- z-position of disk estimated as " << Z); @@ -203,8 +205,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( ACTS_VERBOSE(" -- with r x phi = " << bins0 << " x " << bins1 << " = " << bins0 * bins1 << " bins."); - sl->fill(m_cfg.buildContext, surfacesRaw); - completeBinning(*sl, surfacesRaw); + sl->fill(gctx, surfacesRaw); + completeBinning(gctx, *sl, surfacesRaw); return std::make_unique<SurfaceArray>( std::move(sl), @@ -214,6 +216,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnDisc( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, BinningType bTypePhi, @@ -222,9 +225,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it - ProtoLayer protoLayer = protoLayerOpt - ? *protoLayerOpt - : ProtoLayer(m_cfg.buildContext, surfacesRaw); + ProtoLayer protoLayer + = protoLayerOpt ? *protoLayerOpt : ProtoLayer(gctx, surfacesRaw); ACTS_VERBOSE("Creating a SurfaceArray on a disc"); @@ -235,9 +237,10 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( ProtoAxis pAxisR; if (bTypeR == equidistant) { - pAxisR = createEquidistantAxis(surfacesRaw, binR, protoLayer, transform); + pAxisR + = createEquidistantAxis(gctx, surfacesRaw, binR, protoLayer, transform); } else { - pAxisR = createVariableAxis(surfacesRaw, binR, protoLayer, transform); + pAxisR = createVariableAxis(gctx, surfacesRaw, binR, protoLayer, transform); } // if we have more than one R ring, we need to figure out @@ -247,16 +250,15 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( // this FORCES equidistant binning std::vector<std::vector<const Surface*>> phiModules(pAxisR.nBins); for (const auto& srf : surfacesRaw) { - Vector3D bpos = srf->binningPosition(m_cfg.buildContext, binR); + Vector3D bpos = srf->binningPosition(gctx, binR); size_t bin = pAxisR.getBin(perp(bpos)); phiModules.at(bin).push_back(srf); } std::vector<size_t> nPhiModules; auto matcher = m_cfg.surfaceMatcher; - auto context = m_cfg.buildContext; - auto equal = [&context, &matcher](const Surface* a, const Surface* b) { - return matcher(context, binPhi, a, b); + auto equal = [&gctx, &matcher](const Surface* a, const Surface* b) { + return matcher(gctx, binPhi, a, b); }; std::transform( @@ -276,15 +278,16 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( size_t nBinsPhi = (*std::min_element(nPhiModules.begin(), nPhiModules.end())); pAxisPhi = createEquidistantAxis( - surfacesRaw, binPhi, protoLayer, transform, nBinsPhi); + gctx, surfacesRaw, binPhi, protoLayer, transform, nBinsPhi); } else { // use regular determination if (bTypePhi == equidistant) { pAxisPhi = createEquidistantAxis( - surfacesRaw, binPhi, protoLayer, transform, 0); + gctx, surfacesRaw, binPhi, protoLayer, transform, 0); } else { - pAxisPhi = createVariableAxis(surfacesRaw, binPhi, protoLayer, transform); + pAxisPhi = createVariableAxis( + gctx, surfacesRaw, binPhi, protoLayer, transform); } } @@ -317,8 +320,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( << bins0 * bins1 << " bins."); - sl->fill(m_cfg.buildContext, surfacesRaw); - completeBinning(*sl, surfacesRaw); + sl->fill(gctx, surfacesRaw); + completeBinning(gctx, *sl, surfacesRaw); return std::make_unique<SurfaceArray>( std::move(sl), @@ -329,6 +332,7 @@ Acts::SurfaceArrayCreator::surfaceArrayOnDisc( /// SurfaceArrayCreator interface method - create an array on a plane std::unique_ptr<Acts::SurfaceArray> Acts::SurfaceArrayCreator::surfaceArrayOnPlane( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Surface>> surfaces, size_t bins1, size_t bins2, @@ -338,9 +342,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( { std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); // check if we have proto layer, else build it - ProtoLayer protoLayer = protoLayerOpt - ? *protoLayerOpt - : ProtoLayer(m_cfg.buildContext, surfacesRaw); + ProtoLayer protoLayer + = protoLayerOpt ? *protoLayerOpt : ProtoLayer(gctx, surfacesRaw); ACTS_VERBOSE("Creating a SurfaceArray on a plance"); ACTS_VERBOSE(" -- with " << surfaces.size() << " surfaces.") @@ -367,9 +370,9 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( switch (bValue) { case BinningValue::binX: { ProtoAxis pAxis1 = createEquidistantAxis( - surfacesRaw, binY, protoLayer, transform, bins1); + gctx, surfacesRaw, binY, protoLayer, transform, bins1); ProtoAxis pAxis2 = createEquidistantAxis( - surfacesRaw, binZ, protoLayer, transform, bins2); + gctx, surfacesRaw, binZ, protoLayer, transform, bins2); sl = makeSurfaceGridLookup2D<detail::AxisBoundaryType::Bound, detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxis1, pAxis2); @@ -377,9 +380,9 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( } case BinningValue::binY: { ProtoAxis pAxis1 = createEquidistantAxis( - surfacesRaw, binX, protoLayer, transform, bins1); + gctx, surfacesRaw, binX, protoLayer, transform, bins1); ProtoAxis pAxis2 = createEquidistantAxis( - surfacesRaw, binZ, protoLayer, transform, bins2); + gctx, surfacesRaw, binZ, protoLayer, transform, bins2); sl = makeSurfaceGridLookup2D<detail::AxisBoundaryType::Bound, detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxis1, pAxis2); @@ -387,9 +390,9 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( } case BinningValue::binZ: { ProtoAxis pAxis1 = createEquidistantAxis( - surfacesRaw, binX, protoLayer, transform, bins1); + gctx, surfacesRaw, binX, protoLayer, transform, bins1); ProtoAxis pAxis2 = createEquidistantAxis( - surfacesRaw, binY, protoLayer, transform, bins2); + gctx, surfacesRaw, binY, protoLayer, transform, bins2); sl = makeSurfaceGridLookup2D<detail::AxisBoundaryType::Bound, detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxis1, pAxis2); @@ -402,8 +405,8 @@ Acts::SurfaceArrayCreator::surfaceArrayOnPlane( } } - sl->fill(m_cfg.buildContext, surfacesRaw); - completeBinning(*sl, surfacesRaw); + sl->fill(gctx, surfacesRaw); + completeBinning(gctx, *sl, surfacesRaw); return std::make_unique<SurfaceArray>( std::move(sl), @@ -436,16 +439,15 @@ Acts::SurfaceArrayCreator::findKeySurfaces( size_t Acts::SurfaceArrayCreator::determineBinCount( + const GeometryContext& gctx, const std::vector<const Surface*>& surfaces, BinningValue bValue) const { auto matcher = m_cfg.surfaceMatcher; - auto context = m_cfg.buildContext; - auto equal - = [&context, &bValue, &matcher](const Surface* a, const Surface* b) { - return matcher(context, bValue, a, b); - }; + auto equal = [&gctx, &bValue, &matcher](const Surface* a, const Surface* b) { + return matcher(gctx, bValue, a, b); + }; std::vector<const Surface*> keys = findKeySurfaces(surfaces, equal); return keys.size(); @@ -453,6 +455,7 @@ Acts::SurfaceArrayCreator::determineBinCount( Acts::SurfaceArrayCreator::ProtoAxis Acts::SurfaceArrayCreator::createVariableAxis( + const GeometryContext& gctx, const std::vector<const Surface*>& surfaces, BinningValue bValue, ProtoLayer protoLayer, @@ -467,26 +470,23 @@ Acts::SurfaceArrayCreator::createVariableAxis( // bind matcher with binning type auto matcher = m_cfg.surfaceMatcher; - auto context = m_cfg.buildContext; // find the key surfaces - auto equal - = [&context, &bValue, &matcher](const Surface* a, const Surface* b) { - return matcher(context, bValue, a, b); - }; + auto equal = [&gctx, &bValue, &matcher](const Surface* a, const Surface* b) { + return matcher(gctx, bValue, a, b); + }; std::vector<const Acts::Surface*> keys = findKeySurfaces(surfaces, equal); std::vector<double> bValues; if (bValue == Acts::binPhi) { - std::stable_sort( - keys.begin(), - keys.end(), - [&context](const Acts::Surface* a, const Acts::Surface* b) { - return (phi(a->binningPosition(context, binPhi)) - < phi(b->binningPosition(context, binPhi))); - }); + std::stable_sort(keys.begin(), + keys.end(), + [&gctx](const Acts::Surface* a, const Acts::Surface* b) { + return (phi(a->binningPosition(gctx, binPhi)) + < phi(b->binningPosition(gctx, binPhi))); + }); - double maxPhi = 0.5 * (phi(keys.at(0)->binningPosition(context, binPhi)) - + phi(keys.at(1)->binningPosition(context, binPhi))); + double maxPhi = 0.5 * (phi(keys.at(0)->binningPosition(gctx, binPhi)) + + phi(keys.at(1)->binningPosition(gctx, binPhi))); // create rotation, so that maxPhi is +pi double angle = -(M_PI + maxPhi); @@ -495,7 +495,7 @@ Acts::SurfaceArrayCreator::createVariableAxis( // iterate over all key surfaces, and use their mean position as bValues, // but // rotate using transform from before - double previous = phi(keys.at(0)->binningPosition(context, binPhi)); + double previous = phi(keys.at(0)->binningPosition(gctx, binPhi)); // go through key surfaces for (size_t i = 1; i < keys.size(); i++) { const Surface* surface = keys.at(i); @@ -503,10 +503,10 @@ Acts::SurfaceArrayCreator::createVariableAxis( // positions in the binning direction of the current and previous // surface double edge - = 0.5 * (previous + phi(surface->binningPosition(context, binPhi))) + = 0.5 * (previous + phi(surface->binningPosition(gctx, binPhi))) + angle; bValues.push_back(edge); - previous = phi(surface->binningPosition(context, binPhi)); + previous = phi(surface->binningPosition(gctx, binPhi)); } // get the bounds of the last surfaces @@ -518,7 +518,7 @@ Acts::SurfaceArrayCreator::createVariableAxis( "other bounds yet! "); // get the global vertices std::vector<Acts::Vector3D> backVertices - = makeGlobalVertices(*backSurface, backBounds->vertices()); + = makeGlobalVertices(gctx, *backSurface, backBounds->vertices()); double maxBValue = phi( *std::max_element(backVertices.begin(), backVertices.end(), @@ -531,42 +531,40 @@ Acts::SurfaceArrayCreator::createVariableAxis( bValues.push_back(M_PI); } else if (bValue == Acts::binZ) { - std::stable_sort( - keys.begin(), - keys.end(), - [&context](const Acts::Surface* a, const Acts::Surface* b) { - return (a->binningPosition(context, binZ).z() - < b->binningPosition(context, binZ).z()); - }); + std::stable_sort(keys.begin(), + keys.end(), + [&gctx](const Acts::Surface* a, const Acts::Surface* b) { + return (a->binningPosition(gctx, binZ).z() + < b->binningPosition(gctx, binZ).z()); + }); bValues.push_back(protoLayer.minZ); bValues.push_back(protoLayer.maxZ); // the z-center position of the previous surface - double previous = keys.front()->binningPosition(context, binZ).z(); + double previous = keys.front()->binningPosition(gctx, binZ).z(); // go through key surfaces for (auto surface = keys.begin() + 1; surface != keys.end(); surface++) { // create central binning values which is the mean of the center // positions in the binning direction of the current and previous // surface bValues.push_back( - 0.5 * (previous + (*surface)->binningPosition(context, binZ).z())); - previous = (*surface)->binningPosition(context, binZ).z(); + 0.5 * (previous + (*surface)->binningPosition(gctx, binZ).z())); + previous = (*surface)->binningPosition(gctx, binZ).z(); } } else { // binR - std::stable_sort( - keys.begin(), - keys.end(), - [&context](const Acts::Surface* a, const Acts::Surface* b) { - return (perp(a->binningPosition(context, binR)) - < perp(b->binningPosition(context, binR))); - }); + std::stable_sort(keys.begin(), + keys.end(), + [&gctx](const Acts::Surface* a, const Acts::Surface* b) { + return (perp(a->binningPosition(gctx, binR)) + < perp(b->binningPosition(gctx, binR))); + }); bValues.push_back(protoLayer.minR); bValues.push_back(protoLayer.maxR); // the r-center position of the previous surface - double previous = perp(keys.front()->binningPosition(context, binR)); + double previous = perp(keys.front()->binningPosition(gctx, binR)); // go through key surfaces for (auto surface = keys.begin() + 1; surface != keys.end(); surface++) { @@ -574,8 +572,8 @@ Acts::SurfaceArrayCreator::createVariableAxis( // positions in the binning direction of the current and previous // surface bValues.push_back( - 0.5 * (previous + perp((*surface)->binningPosition(context, binR)))); - previous = perp((*surface)->binningPosition(context, binR)); + 0.5 * (previous + perp((*surface)->binningPosition(gctx, binR)))); + previous = perp((*surface)->binningPosition(gctx, binR)); } } std::sort(bValues.begin(), bValues.end()); @@ -598,6 +596,7 @@ Acts::SurfaceArrayCreator::createVariableAxis( Acts::SurfaceArrayCreator::ProtoAxis Acts::SurfaceArrayCreator::createEquidistantAxis( + const GeometryContext& gctx, const std::vector<const Surface*>& surfaces, BinningValue bValue, ProtoLayer protoLayer, @@ -623,7 +622,7 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( size_t binNumber; if (nBins == 0) { // determine bin count - binNumber = determineBinCount(surfaces, bValue); + binNumber = determineBinCount(gctx, surfaces, bValue); } else { // use bin count binNumber = nBins; @@ -631,7 +630,6 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( // bind matcher & context with binning type auto matcher = m_cfg.surfaceMatcher; - auto context = m_cfg.buildContext; // now check the binning value switch (bValue) { @@ -644,15 +642,15 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( const Acts::Surface* maxElem = *std::max_element( surfaces.begin(), surfaces.end(), - [&context](const Acts::Surface* a, const Acts::Surface* b) { - return phi(a->binningPosition(context, binR)) - < phi(b->binningPosition(context, binR)); + [&gctx](const Acts::Surface* a, const Acts::Surface* b) { + return phi(a->binningPosition(gctx, binR)) + < phi(b->binningPosition(gctx, binR)); }); // get the key surfaces at the different phi positions auto equal - = [&context, &bValue, &matcher](const Surface* a, const Surface* b) { - return matcher(context, bValue, a, b); + = [&gctx, &bValue, &matcher](const Surface* a, const Surface* b) { + return matcher(gctx, bValue, a, b); }; keys = findKeySurfaces(surfaces, equal); @@ -668,7 +666,7 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( // rotate to max phi module plus one half step // this should make sure that phi wrapping at +- pi // never falls on a module center - double max = phi(maxElem->binningPosition(context, binR)); + double max = phi(maxElem->binningPosition(gctx, binR)); double angle = M_PI - (max + 0.5 * step); // replace given transform ref @@ -748,14 +746,14 @@ Acts::SurfaceArrayCreator::createEquidistantAxis( std::vector<Acts::Vector3D> Acts::SurfaceArrayCreator::makeGlobalVertices( + const GeometryContext& gctx, const Acts::Surface& surface, const std::vector<Acts::Vector2D>& locVertices) const { std::vector<Acts::Vector3D> globVertices; for (auto& vertex : locVertices) { Acts::Vector3D globVertex(0., 0., 0.); - surface.localToGlobal( - m_cfg.buildContext, vertex, Acts::Vector3D(), globVertex); + surface.localToGlobal(gctx, vertex, Acts::Vector3D(), globVertex); globVertices.push_back(globVertex); } return globVertices; diff --git a/Core/src/Tools/TrackingGeometryBuilder.cpp b/Core/src/Tools/TrackingGeometryBuilder.cpp index b87c8cdb5e26114ef3190e1a785e5c439afec1d4..c0aedd67da799be5f8394534c8ce225a67389788 100644 --- a/Core/src/Tools/TrackingGeometryBuilder.cpp +++ b/Core/src/Tools/TrackingGeometryBuilder.cpp @@ -45,7 +45,8 @@ Acts::TrackingGeometryBuilder::setLogger( } std::unique_ptr<const Acts::TrackingGeometry> -Acts::TrackingGeometryBuilder::trackingGeometry() const +Acts::TrackingGeometryBuilder::trackingGeometry( + const GeometryContext& gctx) const { // the return geometry with the highest volume std::unique_ptr<const TrackingGeometry> trackingGeometry; diff --git a/Core/src/Tools/TrackingVolumeArrayCreator.cpp b/Core/src/Tools/TrackingVolumeArrayCreator.cpp index 4d5abe81a13c243765b42fd7bd8516ebcc790aed..250b0adc393e5894772d99d5505c391461faa743 100644 --- a/Core/src/Tools/TrackingVolumeArrayCreator.cpp +++ b/Core/src/Tools/TrackingVolumeArrayCreator.cpp @@ -20,6 +20,7 @@ std::shared_ptr<const Acts::TrackingVolumeArray> Acts::TrackingVolumeArrayCreator::trackingVolumeArray( + const GeometryContext& gctx, const TrackingVolumeVector& tVolumes, BinningValue bValue) const { @@ -29,7 +30,7 @@ Acts::TrackingVolumeArrayCreator::trackingVolumeArray( TrackingVolumeVector volumes(tVolumes); // sort it accordingly to the binning value GeometryObjectSorterT<std::shared_ptr<const TrackingVolume>> volumeSorter( - m_cfg.buildContext, bValue); + gctx, bValue); std::sort(volumes.begin(), volumes.end(), volumeSorter); // prepare what we need : @@ -42,11 +43,10 @@ Acts::TrackingVolumeArrayCreator::trackingVolumeArray( // let's loop over the (sorted) volumes for (auto& tVolume : volumes) { // get the binning position - Vector3D binningPosition - = tVolume->binningPosition(m_cfg.buildContext, bValue); - double binningBorder = tVolume->volumeBounds().binningBorder(bValue); + Vector3D binningPosition = tVolume->binningPosition(gctx, bValue); + double binningBorder = tVolume->volumeBounds().binningBorder(bValue); // get the center value according to the bin - double value = tVolume->binningPositionValue(m_cfg.buildContext, bValue); + double value = tVolume->binningPositionValue(gctx, bValue); // for the first one take low and high boundary if (boundaries.empty()) { boundaries.push_back(value - binningBorder); diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp index 800a129e34d1863fd8ef1eec446d4c3b92c1568c..33503c8d933bd8af7c786cae88dd82969b293898 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp @@ -93,7 +93,8 @@ convertDD4hepDetector( double defaultLayerThickness = 10e-10 * units::_mm, const std::function<void(std::vector<dd4hep::DetElement>& detectors)>& sortSubDetectors - = sortDetElementsByID); + = sortDetElementsByID, + const GeometryContext& gctx = GeometryContext()); /// @brief Method internally used to create an Acts::CylinderVolumeBuilder /// diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp index 22d38379c14a34623edde30ce9ef870861725f09..b9f44f7b736e979ac9586e18c53e92d740c89e32 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp @@ -73,8 +73,6 @@ public: /// @attention The default thickness should be set thin enough that no /// touching or overlapping with the next layer can happen. double defaultThickness = 10e-10 * Acts::units::_mm; - /// Context for building of the geometry - GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor @@ -86,19 +84,28 @@ public: ~DD4hepLayerBuilder() override; /// LayerBuilder interface method + /// + /// @param gctx the geometry context for this build call + /// /// @return the layers at negative side const LayerVector - negativeLayers() const final; + negativeLayers(const GeometryContext& gctx) const final; /// LayerBuilder interface method + /// + /// @param gctx the geometry context for this build call + /// /// @return the layers at the central sector const LayerVector - centralLayers() const final; + centralLayers(const GeometryContext& gctx) const final; /// LayerBuilder interface method + /// + /// @param gctx the geometry context for this build call + /// /// @return the layers at positive side const LayerVector - positiveLayers() const final; + positiveLayers(const GeometryContext& gctx) const final; /// Name identification /// @return the string based identification of this configuration @@ -134,6 +141,7 @@ private: /// Private helper function collecting all sensitive detector elements of a /// layer + /// @param gctx the geometry context of this call /// @param detElement the DD4hep::DetElement of the layer /// @param surfaces the vector of surfaces which should be filled with the /// sensitive detector elements diff --git a/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp b/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp index bc043b77c7c79bae5179e874b34b0189f4184d4f..4cc4bd302bb9321a99c324e4060d79a62c96dd86 100644 --- a/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp +++ b/Plugins/DD4hep/src/ConvertDD4hepDetector.cpp @@ -19,6 +19,7 @@ #include "Acts/Tools/SurfaceArrayCreator.hpp" #include "Acts/Tools/TrackingGeometryBuilder.hpp" #include "Acts/Tools/TrackingVolumeArrayCreator.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "TGeoManager.h" namespace Acts { @@ -107,7 +108,7 @@ convertDD4hepDetector( tgbConfig.trackingVolumeBuilders = std::move(volumeFactories); auto trackingGeometryBuilder = std::make_shared<const Acts::TrackingGeometryBuilder>(tgbConfig); - return (trackingGeometryBuilder->trackingGeometry()); + return (trackingGeometryBuilder->trackingGeometry(Acts::GeometryContext())); } std::shared_ptr<const CylinderVolumeBuilder> diff --git a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp index 7e02e74e4c6fbf84a7a31c1b16dae8db90c88599..a3b956be2441eab57c8375f34e1ff6ec7411fd2d 100644 --- a/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp +++ b/Plugins/DD4hep/src/DD4hepLayerBuilder.cpp @@ -49,7 +49,7 @@ Acts::DD4hepLayerBuilder::setConfiguration( } const Acts::LayerVector -Acts::DD4hepLayerBuilder::negativeLayers() const +Acts::DD4hepLayerBuilder::negativeLayers(const GeometryContext& gctx) const { LayerVector layers; if (m_cfg.negativeLayers.empty()) { @@ -77,7 +77,7 @@ Acts::DD4hepLayerBuilder::negativeLayers() const TGeoShape* geoShape = detElement.placement().ptr()->GetVolume()->GetShape(); // create the proto layer - ProtoLayer pl(m_cfg.buildContext, layerSurfaces); + ProtoLayer pl(gctx, layerSurfaces); if (detExtension->buildEnvelope()) { // set the values of the proto layer in case enevelopes are handed over pl.envR = {detExtension->envelopeR(), detExtension->envelopeR()}; @@ -241,7 +241,8 @@ Acts::DD4hepLayerBuilder::negativeLayers() const } else { negativeLayer - = m_cfg.layerCreator->discLayer(layerSurfaces, + = m_cfg.layerCreator->discLayer(gctx, + layerSurfaces, m_cfg.bTypeR, m_cfg.bTypePhi, pl, @@ -278,7 +279,7 @@ Acts::DD4hepLayerBuilder::negativeLayers() const } const Acts::LayerVector -Acts::DD4hepLayerBuilder::centralLayers() const +Acts::DD4hepLayerBuilder::centralLayers(const GeometryContext& gctx) const { LayerVector layers; if (m_cfg.centralLayers.empty()) { @@ -306,7 +307,7 @@ Acts::DD4hepLayerBuilder::centralLayers() const TGeoShape* geoShape = detElement.placement().ptr()->GetVolume()->GetShape(); // create the proto layer - ProtoLayer pl(m_cfg.buildContext, layerSurfaces); + ProtoLayer pl(gctx, layerSurfaces); if (detExtension->buildEnvelope()) { // set the values of the proto layer in case enevelopes are handed over pl.envR = {detExtension->envelopeR(), detExtension->envelopeR()}; @@ -448,7 +449,8 @@ Acts::DD4hepLayerBuilder::centralLayers() const } else { centralLayer - = m_cfg.layerCreator->cylinderLayer(layerSurfaces, + = m_cfg.layerCreator->cylinderLayer(gctx, + layerSurfaces, m_cfg.bTypePhi, m_cfg.bTypeZ, pl, @@ -486,7 +488,7 @@ Acts::DD4hepLayerBuilder::centralLayers() const } const Acts::LayerVector -Acts::DD4hepLayerBuilder::positiveLayers() const +Acts::DD4hepLayerBuilder::positiveLayers(const GeometryContext& gctx) const { LayerVector layers; if (m_cfg.positiveLayers.empty()) { @@ -514,7 +516,7 @@ Acts::DD4hepLayerBuilder::positiveLayers() const TGeoShape* geoShape = detElement.placement().ptr()->GetVolume()->GetShape(); // create the proto layer - ProtoLayer pl(m_cfg.buildContext, layerSurfaces); + ProtoLayer pl(gctx, layerSurfaces); if (detExtension->buildEnvelope()) { // set the values of the proto layer in case enevelopes are handed over pl.envR = {detExtension->envelopeR(), detExtension->envelopeR()}; @@ -674,7 +676,8 @@ Acts::DD4hepLayerBuilder::positiveLayers() const } else { positiveLayer - = m_cfg.layerCreator->discLayer(layerSurfaces, + = m_cfg.layerCreator->discLayer(gctx, + layerSurfaces, m_cfg.bTypeR, m_cfg.bTypePhi, pl, diff --git a/Plugins/MaterialMapping/include/Acts/Plugins/MaterialMapping/SurfaceMaterialMapper.hpp b/Plugins/MaterialMapping/include/Acts/Plugins/MaterialMapping/SurfaceMaterialMapper.hpp index 44cc692f6c734d79e59197dd04f00bc7d8cd19b8..b09050cb89568d97b383d09ad8d2c4a63357825f 100644 --- a/Plugins/MaterialMapping/include/Acts/Plugins/MaterialMapping/SurfaceMaterialMapper.hpp +++ b/Plugins/MaterialMapping/include/Acts/Plugins/MaterialMapping/SurfaceMaterialMapper.hpp @@ -117,6 +117,14 @@ public: /// Nested State struct which is used for the mapping prococess struct State { + + /// Constructor of the Sate with contexts + State(std::reference_wrapper<const GeometryContext> gctx, + std::reference_wrapper<const MagneticFieldContext> mctx) + : mappingContext(gctx), magFieldContext(mctx) + { + } + /// The accumulated material per geometry ID std::map<GeometryID, AccumulatedSurfaceMaterial> accumulatedMaterial; @@ -124,9 +132,11 @@ public: std::map<GeometryID, std::unique_ptr<const SurfaceMaterial>> surfaceMaterial; - /// The context for the mapping - GeometryContext mappingContext = DefaultGeometryContext(); - MagneticFieldContext magFieldContext = DefaultMagneticFieldContext(); + /// Reference to the geometry context for the mapping + std::reference_wrapper<const GeometryContext> mappingContext; + + /// Reference to the magnetic field context + std::reference_wrapper<const MagneticFieldContext> magFieldContext; }; /// Delete the Default constructor @@ -151,7 +161,9 @@ public: /// finds all surfaces with material proxis /// and returns you a Cache object tO be used State - createState(const TrackingGeometry& tGeometry) const; + createState(const GeometryContext& gctx, + const MagneticFieldContext& mctx, + const TrackingGeometry& tGeometry) const; /// @brief Method to finalize the maps /// diff --git a/Plugins/MaterialMapping/src/SurfaceMaterialMapper.cpp b/Plugins/MaterialMapping/src/SurfaceMaterialMapper.cpp index 644c7b149ec6d2dd99d0804e9882357f83f643f3..0c7121a93181e695c5b83c6d7aff1d4fec995ea9 100644 --- a/Plugins/MaterialMapping/src/SurfaceMaterialMapper.cpp +++ b/Plugins/MaterialMapping/src/SurfaceMaterialMapper.cpp @@ -32,12 +32,14 @@ Acts::SurfaceMaterialMapper::SurfaceMaterialMapper( Acts::SurfaceMaterialMapper::State Acts::SurfaceMaterialMapper::createState( - const TrackingGeometry& tGeometry) const + const GeometryContext& gctx, + const MagneticFieldContext& mctx, + const TrackingGeometry& tGeometry) const { // Parse the geometry and find all surfaces with material proxies auto world = tGeometry.highestTrackingVolume(); // The Surface material mapping state - State mState; + State mState(gctx, mctx); resolveMaterialSurfaces(mState, *world); ACTS_DEBUG(mState.accumulatedMaterial.size() diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp index bea9e177804f230d87aeba6fdcc5e032dde3fc04..ebb5683f812c7cc974a02b82f08351876d2c5867 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp @@ -71,8 +71,6 @@ public: bool setVisibility; // layer creator std::shared_ptr<const LayerCreator> layerCreator = nullptr; - // The building context - GeometryContext buildContext = DefaultGeometryContext(); // configurations std::vector<LayerConfig> negativeLayerConfigs; std::vector<LayerConfig> centralLayerConfigs; @@ -90,16 +88,25 @@ public: ~TGeoLayerBuilder() override; /// LayerBuilder interface method - returning the layers at negative side + /// + /// @param gctx the geometry context for this build call + /// const LayerVector - negativeLayers() const final; + negativeLayers(const GeometryContext& gctx) const final; /// LayerBuilder interface method - returning the central layers + /// + /// @param gctx the geometry context for this build call + /// const LayerVector - centralLayers() const final; + centralLayers(const GeometryContext& gctx) const final; /// LayerBuilder interface method - returning the layers at negative side + /// + /// @param gctx the geometry context for this build call + /// const LayerVector - positiveLayers() const final; + positiveLayers(const GeometryContext& gctx) const final; /// Name identification const std::string& @@ -140,8 +147,11 @@ private: std::vector<std::shared_ptr<const TGeoDetectorElement>> m_elementStore; /// Private helper function to parse the geometry tree + /// @param gcts the geometry context of this call + /// @param layerSurfaces are the surfaces that build the layer void - resolveSensitive(std::vector<std::shared_ptr<const Surface>>& layerSurfaces, + resolveSensitive(const GeometryContext& gctx, + std::vector<std::shared_ptr<const Surface>>& layerSurfaces, TGeoVolume* tgVolume, TGeoNode* tgNode, const TGeoMatrix& tgTransform, @@ -150,15 +160,16 @@ private: bool correctBranch = false, const std::string& offset = ""); - // Private helper method : build layers - // @param layers is goint to be filled - // @param type is the indication which ones to build -1 | 0 | 1 + /// Private helper method : build layers + /// @param gcts the geometry context of this call + /// @param layers is goint to be filled + /// @param type is the indication which ones to build -1 | 0 | 1 void - buildLayers(LayerVector& layers, int type = 0); + buildLayers(const GeometryContext& gctx, LayerVector& layers, int type = 0); - // Private helper method : match string with wildcards - // @param wc is the one with the potential wildcard - // @param test is the test string + /// Private helper method : match string with wildcards + /// @param wc is the one with the potential wildcard + /// @param test is the test string bool match(const char* first, const char* second) const; }; diff --git a/Plugins/TGeo/src/TGeoLayerBuilder.cpp b/Plugins/TGeo/src/TGeoLayerBuilder.cpp index a20354b7d2d187493e63458ee3d2ce92003cdbd7..cd2a09e97887e85405257544ba09bb5091a93c6b 100644 --- a/Plugins/TGeo/src/TGeoLayerBuilder.cpp +++ b/Plugins/TGeo/src/TGeoLayerBuilder.cpp @@ -37,37 +37,39 @@ Acts::TGeoLayerBuilder::setLogger(std::unique_ptr<const Logger> newLogger) } const Acts::LayerVector -Acts::TGeoLayerBuilder::negativeLayers() const +Acts::TGeoLayerBuilder::negativeLayers(const GeometryContext& gctx) const { // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<TGeoLayerBuilder*>(this); LayerVector nVector; - mutableThis->buildLayers(nVector, -1); + mutableThis->buildLayers(gctx, nVector, -1); return nVector; } const Acts::LayerVector -Acts::TGeoLayerBuilder::centralLayers() const +Acts::TGeoLayerBuilder::centralLayers(const GeometryContext& gctx) const { // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<TGeoLayerBuilder*>(this); LayerVector cVector; - mutableThis->buildLayers(cVector, 0); + mutableThis->buildLayers(gctx, cVector, 0); return cVector; } const Acts::LayerVector -Acts::TGeoLayerBuilder::positiveLayers() const +Acts::TGeoLayerBuilder::positiveLayers(const GeometryContext& gctx) const { // @todo Remove this hack once the m_elementStore mess is sorted out auto mutableThis = const_cast<TGeoLayerBuilder*>(this); LayerVector pVector; - mutableThis->buildLayers(pVector, -1); + mutableThis->buildLayers(gctx, pVector, -1); return pVector; } void -Acts::TGeoLayerBuilder::buildLayers(LayerVector& layers, int type) +Acts::TGeoLayerBuilder::buildLayers(const GeometryContext& gctx, + LayerVector& layers, + int type) { // bail out if you have no gGeoManager @@ -107,24 +109,29 @@ Acts::TGeoLayerBuilder::buildLayers(LayerVector& layers, int type) TGeoVolume* tvolume = gGeoManager->GetTopVolume(); if (tvolume != nullptr) { // recursively step down - resolveSensitive( - layerSurfaces, tvolume, nullptr, TGeoIdentity(), layerCfg, type); + resolveSensitive(gctx, + layerSurfaces, + tvolume, + nullptr, + TGeoIdentity(), + layerCfg, + type); // screen output ACTS_DEBUG( "- number of senstive sensors found : " << layerSurfaces.size()); // create the layer - either way if (type == 0) { - ProtoLayer pl(m_cfg.buildContext, layerSurfaces); + ProtoLayer pl(gctx, layerSurfaces); pl.envR = {layerCfg.envelope.first, layerCfg.envelope.second}; pl.envZ = {layerCfg.envelope.second, layerCfg.envelope.second}; layers.push_back(m_cfg.layerCreator->cylinderLayer( - layerSurfaces, layerCfg.binsLoc0, layerCfg.binsLoc1, pl)); + gctx, layerSurfaces, layerCfg.binsLoc0, layerCfg.binsLoc1, pl)); } else { - ProtoLayer pl(m_cfg.buildContext, layerSurfaces); + ProtoLayer pl(gctx, layerSurfaces); pl.envR = {layerCfg.envelope.first, layerCfg.envelope.second}; pl.envZ = {layerCfg.envelope.second, layerCfg.envelope.second}; layers.push_back(m_cfg.layerCreator->discLayer( - layerSurfaces, layerCfg.binsLoc0, layerCfg.binsLoc1, pl)); + gctx, layerSurfaces, layerCfg.binsLoc0, layerCfg.binsLoc1, pl)); } } } @@ -132,6 +139,7 @@ Acts::TGeoLayerBuilder::buildLayers(LayerVector& layers, int type) void Acts::TGeoLayerBuilder::resolveSensitive( + const GeometryContext& gctx, std::vector<std::shared_ptr<const Acts::Surface>>& layerSurfaces, TGeoVolume* tgVolume, TGeoNode* tgNode, @@ -174,7 +182,8 @@ Acts::TGeoLayerBuilder::resolveSensitive( // dynamic_cast to a node TGeoNode* node = dynamic_cast<TGeoNode*>(obj); if (node != nullptr) { - resolveSensitive(layerSurfaces, + resolveSensitive(gctx, + layerSurfaces, nullptr, node, tgTransform, @@ -252,7 +261,8 @@ Acts::TGeoLayerBuilder::resolveSensitive( // if it's not accepted, get the associated volume TGeoVolume* nodeVolume = tgNode->GetVolume(); // step down one further - resolveSensitive(layerSurfaces, + resolveSensitive(gctx, + layerSurfaces, nodeVolume, nullptr, nTransform, diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp index d5c3d799fb7074ec4a327cef493ae7a6816e4353..9179153a836753e79438c460e6bcd05d77168c8f 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp @@ -6,6 +6,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. +#include <functional> #include <vector> #include "Acts/Detector/TrackingGeometry.hpp" #include "Acts/Detector/TrackingVolume.hpp" @@ -20,6 +21,7 @@ #include "Acts/Utilities/BinnedArray.hpp" #include "Acts/Utilities/BinnedArrayXD.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Volumes/CuboidVolumeBounds.hpp" namespace Acts { @@ -29,7 +31,10 @@ namespace Test { { /// Default constructor for the Cubit tracking geometry - CubicTrackingGeometry() + /// + /// @param gctx the geometry context for this geometry at building time + CubicTrackingGeometry(std::reference_wrapper<const GeometryContext> gctx) + : geoContext(gctx) { // Construct the rotation double rotationAngle = M_PI * 0.5; @@ -116,7 +121,8 @@ namespace Test { layVec.push_back(layers[0]); layVec.push_back(layers[1]); std::unique_ptr<const LayerArray> layArr1( - layArrCreator.layerArray(layVec, + layArrCreator.layerArray(geoContext, + layVec, -2. * units::_m - 1. * units::_mm, -1. * units::_m + 1. * units::_mm, BinningType::arbitrary, @@ -138,7 +144,8 @@ namespace Test { layVec.clear(); for (i = 2; i < 6; i++) layVec.push_back(layers[i]); std::unique_ptr<const LayerArray> layArr2( - layArrCreator.layerArray(layVec, + layArrCreator.layerArray(geoContext, + layVec, 1. * units::_m - 2. * units::_mm, 2. * units::_m + 2. * units::_mm, BinningType::arbitrary, @@ -155,11 +162,13 @@ namespace Test { trackVolume2->sign(GeometrySignature::Global); // Glue volumes - trackVolume2->glueTrackingVolume(BoundarySurfaceFace::negativeFaceYZ, + trackVolume2->glueTrackingVolume(geoContext, + BoundarySurfaceFace::negativeFaceYZ, trackVolume1, BoundarySurfaceFace::positiveFaceYZ); - trackVolume1->glueTrackingVolume(BoundarySurfaceFace::positiveFaceYZ, + trackVolume1->glueTrackingVolume(geoContext, + BoundarySurfaceFace::positiveFaceYZ, trackVolume2, BoundarySurfaceFace::negativeFaceYZ); @@ -204,6 +213,8 @@ namespace Test { std::shared_ptr<const SurfaceMaterial> surfaceMaterial = nullptr; std::vector<std::unique_ptr<const DetectorElementStub>> detectorStore = {}; + + std::reference_wrapper<const GeometryContext> geoContext; }; } // namespace Test } // namespace Acts diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp index 465823d6b4e9526b99fccd927290795839e1e226..de9057555c7a91fef102351315f1952b3d12cac2 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp @@ -8,6 +8,7 @@ #pragma once +#include <functional> #include <vector> #include "Acts/Detector/TrackingGeometry.hpp" #include "Acts/Detector/TrackingVolume.hpp" @@ -38,8 +39,14 @@ namespace Test { struct CylindricalTrackingGeometry { - /// Default constructor - CylindricalTrackingGeometry() = default; + std::reference_wrapper<const GeometryContext> geoContext; + + /// Only allowed constructor with reference wrapper + CylindricalTrackingGeometry( + std::reference_wrapper<const GeometryContext> gctx) + : geoContext(gctx) + { + } /// The detector store for memory management std::vector<std::unique_ptr<const DetectorElementStub>> detectorStore = {}; @@ -142,8 +149,8 @@ namespace Test { // create the bounds and the volume auto beamPipeBounds = std::make_shared<const CylinderVolumeBounds>(0., 25., 1100.); - auto beamPipeVolume - = beamPipeVolumeBuilder->trackingVolume(nullptr, beamPipeBounds); + auto beamPipeVolume = beamPipeVolumeBuilder->trackingVolume( + geoContext, nullptr, beamPipeBounds); //------------------------------------------------------------------------------------- // some prep work for the material @@ -223,9 +230,10 @@ namespace Test { detectorStore.push_back(std::move(detElement)); } // create the layer and store it - ProtoLayer protoLayer(DefaultGeometryContext(), layerModules); + ProtoLayer protoLayer(geoContext, layerModules); protoLayer.envR = {0.5, 0.5}; - auto pLayer = layerCreator->cylinderLayer(std::move(layerModules), + auto pLayer = layerCreator->cylinderLayer(geoContext, + std::move(layerModules), pLayerBinning[ilp].first, pLayerBinning[ilp].second, protoLayer); @@ -240,8 +248,8 @@ namespace Test { } // loop over layers // layer array - auto pLayerArray - = layerArrayCreator->layerArray(pLayers, 25., 300., arbitrary, binR); + auto pLayerArray = layerArrayCreator->layerArray( + geoContext, pLayers, 25., 300., arbitrary, binR); auto pVolumeBounds = std::make_shared<const CylinderVolumeBounds>(25., 300., 1100.); // create the Tracking volume @@ -252,9 +260,9 @@ namespace Test { nullptr, "Pixel::Barrel"); - // the combined volume + // The combined volume auto detectorVolume = cylinderVolumeHelper->createContainerTrackingVolume( - {beamPipeVolume, pVolume}); + geoContext, {beamPipeVolume, pVolume}); // create and return the geometry return std::make_shared<const TrackingGeometry>(detectorVolume); diff --git a/Tests/Core/Detector/TrackingGeometryClosureTests.cpp b/Tests/Core/Detector/TrackingGeometryClosureTests.cpp index f57ab640d3bdf1f146eb7917c937b06d76f37511..4801297873af663001273fe0b37f42611bcf3c2a 100644 --- a/Tests/Core/Detector/TrackingGeometryClosureTests.cpp +++ b/Tests/Core/Detector/TrackingGeometryClosureTests.cpp @@ -22,7 +22,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); /// we test a two-level hierarchy /// every deeper level hierarchy is a a derivate of this diff --git a/Tests/Core/Detector/TrackingGeometryCreationTests.cpp b/Tests/Core/Detector/TrackingGeometryCreationTests.cpp index 52259ad82b94dd4fcaf96a41f40cd692d78557ed..1ea343a35490074a9bec398e3f6bdbba7f12e8ca 100644 --- a/Tests/Core/Detector/TrackingGeometryCreationTests.cpp +++ b/Tests/Core/Detector/TrackingGeometryCreationTests.cpp @@ -18,16 +18,19 @@ namespace Acts { namespace Test { + // Create a test context + GeometryContext tgContext = GeometryContext(); + BOOST_AUTO_TEST_CASE(CylindricalTrackingGeometryTest) { - CylindricalTrackingGeometry cGeometry; + CylindricalTrackingGeometry cGeometry(tgContext); auto tGeometry = cGeometry(); BOOST_CHECK_NE(tGeometry, nullptr); } BOOST_AUTO_TEST_CASE(CubicTrackingGeometryTest) { - CubicTrackingGeometry cGeometry; + CubicTrackingGeometry cGeometry(tgContext); auto tGeometry = cGeometry(); BOOST_CHECK_NE(tGeometry, nullptr); } diff --git a/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp b/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp index 0aa1e983d98185d7fe9341bf89e52b6a29e1e2c3..f446daa2aa01bfeb2a9fc5d3b17daff2a3388ddf 100644 --- a/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp +++ b/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp @@ -20,7 +20,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); /// create three cylinder surfaces /// the surface radius (will also be the layer radius) diff --git a/Tests/Core/EventData/BoundParametersTests.cpp b/Tests/Core/EventData/BoundParametersTests.cpp index 0fd7f002c054a5c24b5f359409632d26a2f53122..2ed59eac12574bd59ec0b48528bde13fe4b64b55 100644 --- a/Tests/Core/EventData/BoundParametersTests.cpp +++ b/Tests/Core/EventData/BoundParametersTests.cpp @@ -37,7 +37,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); /// @brief Unit test for parameters at a plane /// diff --git a/Tests/Core/EventData/CurvilinearParametersTests.cpp b/Tests/Core/EventData/CurvilinearParametersTests.cpp index 5aa620b0cd3197b3ba67536cbc758348ca91be19..4d0b4fd806246382e429111d3bfecc12702fff72 100644 --- a/Tests/Core/EventData/CurvilinearParametersTests.cpp +++ b/Tests/Core/EventData/CurvilinearParametersTests.cpp @@ -30,7 +30,7 @@ namespace Test { { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); // some position and momentum Vector3D pos(1.34, 2.34, 3.45); @@ -80,9 +80,12 @@ namespace Test { mFrame.col(0) = uAxis; mFrame.col(1) = vAxis; mFrame.col(2) = tAxis; - CHECK_CLOSE_OR_SMALL(mFrame, curvilinear_pos.referenceFrame(), 1e-6, 1e-9); - CHECK_CLOSE_OR_SMALL(mFrame, curvilinear_neg.referenceFrame(), 1e-6, 1e-9); - CHECK_CLOSE_OR_SMALL(mFrame, curvilinear_neut.referenceFrame(), 1e-6, 1e-9); + CHECK_CLOSE_OR_SMALL( + mFrame, curvilinear_pos.referenceFrame(tgContext), 1e-6, 1e-9); + CHECK_CLOSE_OR_SMALL( + mFrame, curvilinear_neg.referenceFrame(tgContext), 1e-6, 1e-9); + CHECK_CLOSE_OR_SMALL( + mFrame, curvilinear_neut.referenceFrame(tgContext), 1e-6, 1e-9); /// copy construction test CurvilinearParameters curvilinear_pos_copy(curvilinear_pos); diff --git a/Tests/Core/EventData/TrackStateTests.cpp b/Tests/Core/EventData/TrackStateTests.cpp index 3ec390e54defc914487ed04b98e3779d0cda7fe5..a787a55a647d65c8a5ae57445043446d5b34d087 100644 --- a/Tests/Core/EventData/TrackStateTests.cpp +++ b/Tests/Core/EventData/TrackStateTests.cpp @@ -24,7 +24,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); using Jacobian = ActsMatrixD<5, 5>; using Identifier = unsigned long int; diff --git a/Tests/Core/Extrapolator/ExtrapolatorTests.cpp b/Tests/Core/Extrapolator/ExtrapolatorTests.cpp index 16a607ce7eff4dfde691db2e51916a6a0da1589f..caf89e378c50981d0e4f643ece46d9c89a270ea1 100644 --- a/Tests/Core/Extrapolator/ExtrapolatorTests.cpp +++ b/Tests/Core/Extrapolator/ExtrapolatorTests.cpp @@ -40,8 +40,8 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); // Global definitions // The path limit abort @@ -49,7 +49,7 @@ namespace Test { std::vector<std::unique_ptr<const Surface>> stepState; - CylindricalTrackingGeometry cGeometry; + CylindricalTrackingGeometry cGeometry(tgContext); auto tGeometry = cGeometry(); // Get the navigator and provide the TrackingGeometry diff --git a/Tests/Core/Extrapolator/KalmanExtrapolatorTests.cpp b/Tests/Core/Extrapolator/KalmanExtrapolatorTests.cpp index 076ae9b34e256a9ac4714515b3cbb26b6f7069b2..db61ecb03b28e1c887d3264df74ae057a439cf85 100644 --- a/Tests/Core/Extrapolator/KalmanExtrapolatorTests.cpp +++ b/Tests/Core/Extrapolator/KalmanExtrapolatorTests.cpp @@ -36,8 +36,8 @@ namespace Test { using Jacobian = ActsMatrixD<5, 5>; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); /// /// @brief the bound state propagation /// @@ -114,7 +114,7 @@ namespace Test { BOOST_AUTO_TEST_CASE(kalman_extrapolator) { // Build detector, take the cubic detector - CubicTrackingGeometry cGeometry; + CubicTrackingGeometry cGeometry(tgContext); auto detector = cGeometry(); // The Navigator through the detector geometry diff --git a/Tests/Core/Extrapolator/MaterialCollectionTests.cpp b/Tests/Core/Extrapolator/MaterialCollectionTests.cpp index 7c0f3748db6d91f553602d81a73811fca98401b9..fd3da107b08c53526bae0f1b70d1b3e91c7d858f 100644 --- a/Tests/Core/Extrapolator/MaterialCollectionTests.cpp +++ b/Tests/Core/Extrapolator/MaterialCollectionTests.cpp @@ -44,14 +44,14 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); // Global definitions // The path limit abort using path_limit = detail::PathLimitReached; - CylindricalTrackingGeometry cGeometry; + CylindricalTrackingGeometry cGeometry(tgContext); auto tGeometry = cGeometry(); // create a navigator for this tracking geometry diff --git a/Tests/Core/Extrapolator/NavigatorTests.cpp b/Tests/Core/Extrapolator/NavigatorTests.cpp index d948ac7ba6519ec0e31b418d867950eba6865d2e..2e70fc6f96d0afe7e9a9b8d80290638abcc55a7d 100644 --- a/Tests/Core/Extrapolator/NavigatorTests.cpp +++ b/Tests/Core/Extrapolator/NavigatorTests.cpp @@ -37,6 +37,9 @@ using VectorHelpers::perp; namespace Test { + // Create a test context + GeometryContext tgContext = GeometryContext(); + /// This is a simple cache struct to mimic the /// Propagator cache struct PropagatorState @@ -144,7 +147,7 @@ namespace Test { Navigator::state_type navigation; // The context cache for this propagation - GeometryContext geoContext = DefaultGeometryContext(); + GeometryContext geoContext = GeometryContext(); }; template <typename stepper_state_t> @@ -159,7 +162,7 @@ namespace Test { // the surface cache & the creation of the geometry - CylindricalTrackingGeometry cGeometry; + CylindricalTrackingGeometry cGeometry(tgContext); auto tGeometry = cGeometry(); // the debug boolean diff --git a/Tests/Core/Fitter/GainMatrixTests.cpp b/Tests/Core/Fitter/GainMatrixTests.cpp index da23f699b1a603ee3de2c3a3a42e6316b9f83eb2..5d702f37ff4774ef739b44306810638a4567c466 100644 --- a/Tests/Core/Fitter/GainMatrixTests.cpp +++ b/Tests/Core/Fitter/GainMatrixTests.cpp @@ -32,7 +32,7 @@ namespace Test { using TrackState = TrackState<Identifier, BoundParameters>; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_CASE(gain_matrix_updator) { diff --git a/Tests/Core/Fitter/KalmanFitterTests.cpp b/Tests/Core/Fitter/KalmanFitterTests.cpp index 60ec225d955367404287e4e6ca184e49b98f6888..2456ecccdb2746efffbad917c63a553fe54669b5 100644 --- a/Tests/Core/Fitter/KalmanFitterTests.cpp +++ b/Tests/Core/Fitter/KalmanFitterTests.cpp @@ -66,9 +66,9 @@ namespace Test { bool debugMode = false; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); - CalibrationContext calContext = DefaultCalibrationContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); + CalibrationContext calContext = CalibrationContext(); /// @brief This struct creates FittableMeasurements on the /// detector surfaces, according to the given smearing xxparameters @@ -211,7 +211,7 @@ namespace Test { BOOST_AUTO_TEST_CASE(kalman_fitter_zero_field) { // Build detector - CubicTrackingGeometry cGeometry; + CubicTrackingGeometry cGeometry(tgContext); auto detector = cGeometry(); // Build navigator for the measurement creatoin diff --git a/Tests/Core/Layers/CylinderLayerTests.cpp b/Tests/Core/Layers/CylinderLayerTests.cpp index c656089b30349442aa8e3bdc89bf772f91413520..f31b1264e1753abde8a8896ed12d9e757054418c 100644 --- a/Tests/Core/Layers/CylinderLayerTests.cpp +++ b/Tests/Core/Layers/CylinderLayerTests.cpp @@ -35,7 +35,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); namespace Layers { BOOST_AUTO_TEST_SUITE(Layers) diff --git a/Tests/Core/Layers/DiscLayerTests.cpp b/Tests/Core/Layers/DiscLayerTests.cpp index 8e0eef2de4ebc4fa85f0d5ce4b5cae713bec1875..24dc7ba8a395a7504129a531d191f47816c55420 100644 --- a/Tests/Core/Layers/DiscLayerTests.cpp +++ b/Tests/Core/Layers/DiscLayerTests.cpp @@ -36,7 +36,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); namespace Layers { BOOST_AUTO_TEST_SUITE(Layers) diff --git a/Tests/Core/Layers/GenericApproachDescriptorTests.cpp b/Tests/Core/Layers/GenericApproachDescriptorTests.cpp index 6ec881c13ebd8f1dff13645ec646428062efbb77..46c1597d0c19e046a4d0ff14a020085319f4c4f5 100644 --- a/Tests/Core/Layers/GenericApproachDescriptorTests.cpp +++ b/Tests/Core/Layers/GenericApproachDescriptorTests.cpp @@ -30,7 +30,7 @@ namespace Test { namespace Layers { // Build a default context for testing - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_SUITE(Layers) diff --git a/Tests/Core/Layers/LayerTests.cpp b/Tests/Core/Layers/LayerTests.cpp index b1545cee6592f94738685d26fb3586aba29e1ae9..79b7a1b933fbb8a4c24cd319320fe78de9004250 100644 --- a/Tests/Core/Layers/LayerTests.cpp +++ b/Tests/Core/Layers/LayerTests.cpp @@ -37,7 +37,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); namespace Layers { diff --git a/Tests/Core/Layers/NavigationLayerTests.cpp b/Tests/Core/Layers/NavigationLayerTests.cpp index 4a0d1b9b2e8e3dd5d9a613270f822b7848801f75..2d51797857106d796a32817308dc167c1f3efd7d 100644 --- a/Tests/Core/Layers/NavigationLayerTests.cpp +++ b/Tests/Core/Layers/NavigationLayerTests.cpp @@ -31,7 +31,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); namespace Layers { BOOST_AUTO_TEST_SUITE(Layers) diff --git a/Tests/Core/Layers/PlaneLayerTests.cpp b/Tests/Core/Layers/PlaneLayerTests.cpp index 6ae1210db4b78b365210b2864a3f6f32c4476929..ca2414bd27c279fab17dd5e87973e5107737f071 100644 --- a/Tests/Core/Layers/PlaneLayerTests.cpp +++ b/Tests/Core/Layers/PlaneLayerTests.cpp @@ -37,7 +37,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); namespace Layers { BOOST_AUTO_TEST_SUITE(Layers) @@ -65,7 +65,8 @@ namespace Test { const double thickness(1.0); SurfaceArrayCreator sac; size_t binsX(2), binsY(4); - auto pSurfaceArray = sac.surfaceArrayOnPlane(aSurfaces, binsX, binsY); + auto pSurfaceArray + = sac.surfaceArrayOnPlane(tgContext, aSurfaces, binsX, binsY); auto pPlaneLayerFromSurfaces = PlaneLayer::create( pTransform, pRectangle, std::move(pSurfaceArray)); BOOST_CHECK_EQUAL(pPlaneLayerFromSurfaces->layerType(), diff --git a/Tests/Core/MagneticField/ConstantBFieldTests.cpp b/Tests/Core/MagneticField/ConstantBFieldTests.cpp index fc4719af443af9b8f3b20726f2b1a61f11cea258..dd59fd5cc0ba19fe481c1786b1b4ecb8e66ac320 100644 --- a/Tests/Core/MagneticField/ConstantBFieldTests.cpp +++ b/Tests/Core/MagneticField/ConstantBFieldTests.cpp @@ -27,7 +27,7 @@ namespace Acts { namespace Test { // Create a test context - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); /// @brief unit test for construction of constant magnetic field /// diff --git a/Tests/Core/MagneticField/InterpolatedBFieldMapTests.cpp b/Tests/Core/MagneticField/InterpolatedBFieldMapTests.cpp index 20e814472400e0fcf5d9520fe6487ccf7a97f68c..eb48979770bc6ee7079ed9c16301ff4d6a48d890 100644 --- a/Tests/Core/MagneticField/InterpolatedBFieldMapTests.cpp +++ b/Tests/Core/MagneticField/InterpolatedBFieldMapTests.cpp @@ -30,7 +30,7 @@ namespace Acts { namespace Test { // Create a test context - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); BOOST_AUTO_TEST_CASE(InterpolatedBFieldMap_rz) { diff --git a/Tests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp b/Tests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp index 0e22d4df30fe6d1d1c4f728ddf28757a04579e8a..b5d9ace11be26fd0c3aea7a865f6c25cbe880826 100644 --- a/Tests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp +++ b/Tests/Core/MagneticField/MagneticFieldInterfaceConsistencyTests.cpp @@ -33,7 +33,7 @@ namespace Acts { namespace Test { // Create a test context - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); /// This is the canonical interface that all field implementations /// need to comply with. diff --git a/Tests/Core/MagneticField/SolenoidBFieldTests.cpp b/Tests/Core/MagneticField/SolenoidBFieldTests.cpp index 0b325753449495a82a8b5e87f622bdfb9d9e1f3f..ea189b413b4e460ff0c8feb9572f9b5aebb6be92 100644 --- a/Tests/Core/MagneticField/SolenoidBFieldTests.cpp +++ b/Tests/Core/MagneticField/SolenoidBFieldTests.cpp @@ -34,7 +34,7 @@ namespace Test { { // Create a test context - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); SolenoidBField::Config cfg; cfg.length = 5.8 * Acts::units::_m; diff --git a/Tests/Core/Propagator/AtlasStepperBenchmark.cpp b/Tests/Core/Propagator/AtlasStepperBenchmark.cpp index a8142c6e3c15ae60e77af83843d998cee83ad851..cb71d8bc47b0c97c2477f3cf0b0d71505bd6a977 100644 --- a/Tests/Core/Propagator/AtlasStepperBenchmark.cpp +++ b/Tests/Core/Propagator/AtlasStepperBenchmark.cpp @@ -31,8 +31,8 @@ main(int argc, char* argv[]) bool withCov = true; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); try { po::options_description desc("Allowed options"); diff --git a/Tests/Core/Propagator/EigenStepperBenchmark.cpp b/Tests/Core/Propagator/EigenStepperBenchmark.cpp index cad30a3510110f5013bceff0a7da5a963af3246f..2e0dc3932af4a9e96db3aa90a18c8d86d4c02958 100644 --- a/Tests/Core/Propagator/EigenStepperBenchmark.cpp +++ b/Tests/Core/Propagator/EigenStepperBenchmark.cpp @@ -31,8 +31,8 @@ main(int argc, char* argv[]) bool withCov = true; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); try { po::options_description desc("Allowed options"); diff --git a/Tests/Core/Propagator/IntersectionCorrectorTests.cpp b/Tests/Core/Propagator/IntersectionCorrectorTests.cpp index 5b87db19c54eb27c00e788f17ec3371061e00dab..9d55f053f8f37d8a3ae19e06fafb3ba1da3c8ddd 100644 --- a/Tests/Core/Propagator/IntersectionCorrectorTests.cpp +++ b/Tests/Core/Propagator/IntersectionCorrectorTests.cpp @@ -36,7 +36,7 @@ namespace Test { { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); // construct the surface Vector3D pcenter(-4., 4., 0.); diff --git a/Tests/Core/Propagator/JacobianTests.cpp b/Tests/Core/Propagator/JacobianTests.cpp index 9218d8007d7ff4d830e612e2d76fa98843934c1c..898492055e38e498ad52099c7cb033be6bdaaeb1 100644 --- a/Tests/Core/Propagator/JacobianTests.cpp +++ b/Tests/Core/Propagator/JacobianTests.cpp @@ -39,8 +39,8 @@ namespace Test { using AtlasStepperType = AtlasStepper<BFieldType>; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); /// Helper method to create a transform for a plane /// to mimic detector situations, the plane is roughly diff --git a/Tests/Core/Propagator/LoopProtectionTests.cpp b/Tests/Core/Propagator/LoopProtectionTests.cpp index 4b241f3415838d65e0f4ac14840ac658f0cb155e..e4b8881819c023f6ad2bcdfe3e24c69d60bad89f 100644 --- a/Tests/Core/Propagator/LoopProtectionTests.cpp +++ b/Tests/Core/Propagator/LoopProtectionTests.cpp @@ -36,8 +36,8 @@ using namespace detail; namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); /// @brief mockup of stepping state struct SteppingState diff --git a/Tests/Core/Propagator/PropagatorTests.cpp b/Tests/Core/Propagator/PropagatorTests.cpp index a9b1d6f4e1425395d7b8b19dd2b070ff127c7049..94623bab7036f9b09baabb2a0164f2046186fc14 100644 --- a/Tests/Core/Propagator/PropagatorTests.cpp +++ b/Tests/Core/Propagator/PropagatorTests.cpp @@ -38,8 +38,8 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); using cstep = detail::ConstrainedStep; diff --git a/Tests/Core/Propagator/StepperTests.cpp b/Tests/Core/Propagator/StepperTests.cpp index a5e7c3333d50fd695185148d72913a08cc88a324..8627994362ccc04bc7b25b1c03e540fa6be6c0a3 100644 --- a/Tests/Core/Propagator/StepperTests.cpp +++ b/Tests/Core/Propagator/StepperTests.cpp @@ -39,8 +39,8 @@ namespace Test { using cstep = detail::ConstrainedStep; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); /// @brief Aborter for the case that a particle leaves the detector or reaches /// a custom made threshold. @@ -142,7 +142,8 @@ namespace Test { return cvb.trackingVolume(inner, vb); }); TrackingGeometryBuilder tgb(tgbCfg); - std::shared_ptr<const TrackingGeometry> vacuum = tgb.trackingGeometry(); + std::shared_ptr<const TrackingGeometry> vacuum + = tgb.trackingGeometry(tgContext); // Build navigator Navigator naviVac(vacuum); @@ -263,7 +264,8 @@ namespace Test { return cvb.trackingVolume(inner, vb); }); TrackingGeometryBuilder tgb(tgbCfg); - std::shared_ptr<const TrackingGeometry> material = tgb.trackingGeometry(); + std::shared_ptr<const TrackingGeometry> material + = tgb.trackingGeometry(tgContext); // Build navigator Navigator naviMat(material); @@ -447,7 +449,8 @@ namespace Test { return cvb.trackingVolume(inner, vb); }); TrackingGeometryBuilder tgb(tgbCfg); - std::shared_ptr<const TrackingGeometry> det = tgb.trackingGeometry(); + std::shared_ptr<const TrackingGeometry> det + = tgb.trackingGeometry(tgContext); // Build navigator Navigator naviDet(det); diff --git a/Tests/Core/Surfaces/ConeSurfaceTests.cpp b/Tests/Core/Surfaces/ConeSurfaceTests.cpp index e5a05ca74b4e6b6153b0855920dad773c1395680..97cf558bf532c28f8c127e4df639e2d89ada8197 100644 --- a/Tests/Core/Surfaces/ConeSurfaceTests.cpp +++ b/Tests/Core/Surfaces/ConeSurfaceTests.cpp @@ -30,7 +30,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_SUITE(ConeSurfaces) /// Unit test for creating compliant/non-compliant ConeSurface object diff --git a/Tests/Core/Surfaces/CylinderSurfaceTests.cpp b/Tests/Core/Surfaces/CylinderSurfaceTests.cpp index 4e7a5e97c969c0afa00c4d9bf4efdf028e0d7798..251435c82c20cf75b2e345e8c14fe8be64021d10 100644 --- a/Tests/Core/Surfaces/CylinderSurfaceTests.cpp +++ b/Tests/Core/Surfaces/CylinderSurfaceTests.cpp @@ -31,7 +31,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext testContext = DefaultGeometryContext(); + GeometryContext testContext = GeometryContext(); BOOST_AUTO_TEST_SUITE(CylinderSurfaces) /// Unit test for creating compliant/non-compliant CylinderSurface object diff --git a/Tests/Core/Surfaces/DiscSurfaceTests.cpp b/Tests/Core/Surfaces/DiscSurfaceTests.cpp index 8155abd32f776cd0d6eaa5e3faa660b325dc4325..c692f9d996860b70ccd5e3e5014b1da3b851cb46 100644 --- a/Tests/Core/Surfaces/DiscSurfaceTests.cpp +++ b/Tests/Core/Surfaces/DiscSurfaceTests.cpp @@ -32,7 +32,7 @@ namespace Acts { namespace Test { // using boost::test_tools::output_test_stream; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_SUITE(Surfaces) /// Unit tests for creating DiscSurface object diff --git a/Tests/Core/Surfaces/LineSurfaceTests.cpp b/Tests/Core/Surfaces/LineSurfaceTests.cpp index 35ad9bce3bb211e41894cae8d80dc97b2a7f3d1b..7c94db0bc52758b97ab801c537e893c22d478e84 100644 --- a/Tests/Core/Surfaces/LineSurfaceTests.cpp +++ b/Tests/Core/Surfaces/LineSurfaceTests.cpp @@ -30,7 +30,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); // using boost::test_tools::output_test_stream; diff --git a/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp b/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp index a5efe17c74e85ebac04254c197dc425621c3b17f..971dae900269b8e688cfc58f4bd9f2ec7c7b7fb9 100644 --- a/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp +++ b/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp @@ -32,7 +32,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_SUITE(PerigeeSurfaces) /// Unit test for creating compliant/non-compliant PerigeeSurface object diff --git a/Tests/Core/Surfaces/PlaneSurfaceTests.cpp b/Tests/Core/Surfaces/PlaneSurfaceTests.cpp index 86457760bb5db7d6427796880b5d666300de49f0..8e49141fe7d873048382ab8ba0aaebaa02229ce5 100644 --- a/Tests/Core/Surfaces/PlaneSurfaceTests.cpp +++ b/Tests/Core/Surfaces/PlaneSurfaceTests.cpp @@ -32,7 +32,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_SUITE(PlaneSurfaces) /// Unit test for creating compliant/non-compliant PlaneSurface object diff --git a/Tests/Core/Surfaces/StrawSurfaceTests.cpp b/Tests/Core/Surfaces/StrawSurfaceTests.cpp index cbee6f9cfd29d193d088e72ce7d889f7d4583cc8..e68970836b685e89862d03d74932cc4249b14652 100644 --- a/Tests/Core/Surfaces/StrawSurfaceTests.cpp +++ b/Tests/Core/Surfaces/StrawSurfaceTests.cpp @@ -34,7 +34,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_SUITE(StrawSurfaces) /// Unit test for creating compliant/non-compliant StrawSurface object diff --git a/Tests/Core/Surfaces/SurfaceArrayTests.cpp b/Tests/Core/Surfaces/SurfaceArrayTests.cpp index ffe564b9db676d1b4680708b9f2278069de23070..d7d20179ad233085f8126ef14b6f48d3b8157d68 100644 --- a/Tests/Core/Surfaces/SurfaceArrayTests.cpp +++ b/Tests/Core/Surfaces/SurfaceArrayTests.cpp @@ -40,7 +40,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); using SrfVec = std::vector<std::shared_ptr<const Surface>>; struct SurfaceArrayFixture @@ -207,7 +207,7 @@ namespace Test { BOOST_FIXTURE_TEST_CASE(SurfaceArray_create, SurfaceArrayFixture) { - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); SrfVec brl = makeBarrel(30, 7, 2, 1); std::vector<const Surface*> brlRaw = unpack_shared_vector(brl); diff --git a/Tests/Core/Surfaces/SurfaceTests.cpp b/Tests/Core/Surfaces/SurfaceTests.cpp index 9b94a95b0cf4e92c44facee82469137a08cb6685..292da223aea5c0412523b1301d103bfa7936083e 100644 --- a/Tests/Core/Surfaces/SurfaceTests.cpp +++ b/Tests/Core/Surfaces/SurfaceTests.cpp @@ -60,7 +60,7 @@ private: namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); BOOST_AUTO_TEST_SUITE(Surfaces) diff --git a/Tests/Core/Tools/CuboidVolumeBuilderTests.cpp b/Tests/Core/Tools/CuboidVolumeBuilderTests.cpp index a40fbdab5db8b0750a0d0b4185d481ed40ffa9da..3c05e344d542b6154ead98d05b8191803ee03398 100644 --- a/Tests/Core/Tools/CuboidVolumeBuilderTests.cpp +++ b/Tests/Core/Tools/CuboidVolumeBuilderTests.cpp @@ -38,7 +38,7 @@ namespace Test { CuboidVolumeBuilder cvb; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); // Create configurations for surfaces std::vector<CuboidVolumeBuilder::SurfaceConfig> surfaceConfig; @@ -83,7 +83,8 @@ namespace Test { // Test that 4 surfaces can be built for (const auto& cfg : surfaceConfig) { - std::shared_ptr<const PlaneSurface> pSur = cvb.buildSurface(cfg); + std::shared_ptr<const PlaneSurface> pSur + = cvb.buildSurface(tgContext, cfg); BOOST_CHECK_NE(pSur, nullptr); CHECK_CLOSE_ABS(pSur->center(tgContext), cfg.position, 1e-9); BOOST_CHECK_NE(pSur->associatedMaterial(), nullptr); @@ -104,7 +105,7 @@ namespace Test { // Test that 4 layers with surfaces can be built for (auto& cfg : layerConfig) { - LayerPtr layer = cvb.buildLayer(cfg); + LayerPtr layer = cvb.buildLayer(tgContext, cfg); BOOST_CHECK_NE(layer, nullptr); BOOST_CHECK_NE(cfg.surface, nullptr); BOOST_CHECK_EQUAL(layer->surfaceArray()->surfaces().size(), 1); @@ -125,7 +126,8 @@ namespace Test { Material(352.8, 407., 9.012, 4., 1.848e-3)); // Test the building - std::shared_ptr<TrackingVolume> trVol = cvb.buildVolume(volumeConfig); + std::shared_ptr<TrackingVolume> trVol + = cvb.buildVolume(tgContext, volumeConfig); BOOST_CHECK_EQUAL(volumeConfig.layers.size(), 4); BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(), volumeConfig.layers.size() * 2 @@ -135,7 +137,7 @@ namespace Test { // Test the building volumeConfig.layers.clear(); - trVol = cvb.buildVolume(volumeConfig); + trVol = cvb.buildVolume(tgContext, volumeConfig); BOOST_CHECK_EQUAL(volumeConfig.layers.size(), 4); BOOST_CHECK_EQUAL(trVol->confinedLayers()->arrayObjects().size(), volumeConfig.layers.size() * 2 @@ -147,7 +149,7 @@ namespace Test { lay.surface = nullptr; lay.active = true; } - trVol = cvb.buildVolume(volumeConfig); + trVol = cvb.buildVolume(tgContext, volumeConfig); BOOST_CHECK_EQUAL(volumeConfig.layers.size(), 4); for (auto& lay : volumeConfig.layers) { BOOST_CHECK_EQUAL(lay->layerType(), LayerType::active); @@ -157,7 +159,7 @@ namespace Test { for (auto& lay : volumeConfig.layerCfg) { lay.active = true; } - trVol = cvb.buildVolume(volumeConfig); + trVol = cvb.buildVolume(tgContext, volumeConfig); BOOST_CHECK_EQUAL(volumeConfig.layers.size(), 4); for (auto& lay : volumeConfig.layers) { BOOST_CHECK_EQUAL(lay->layerType(), LayerType::active); @@ -222,7 +224,8 @@ namespace Test { }); TrackingGeometryBuilder tgb(tgbCfg); - std::unique_ptr<const TrackingGeometry> detector = tgb.trackingGeometry(); + std::unique_ptr<const TrackingGeometry> detector + = tgb.trackingGeometry(tgContext); BOOST_CHECK_EQUAL( detector->trackingVolume(tgContext, Vector3D(1., 0., 0.))->volumeName(), volumeConfig.name); diff --git a/Tests/Core/Tools/LayerCreatorTests.cpp b/Tests/Core/Tools/LayerCreatorTests.cpp index 492438d31ad7805a9bf1425791c8ae3d64a6c962..70d3ad0ea1bf06e47ed8df6b59174c7476809294 100644 --- a/Tests/Core/Tools/LayerCreatorTests.cpp +++ b/Tests/Core/Tools/LayerCreatorTests.cpp @@ -39,7 +39,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); #define CHECK_ROTATION_ANGLE(t, a, tolerance) \ { \ @@ -283,7 +283,7 @@ namespace Test { pl.envZ = {envZ, envZ}; std::shared_ptr<CylinderLayer> layer = std::dynamic_pointer_cast<CylinderLayer>( - p_LC->cylinderLayer(srf, equidistant, equidistant, pl)); + p_LC->cylinderLayer(tgContext, srf, equidistant, equidistant, pl)); double rMax = 10.6071, rMin = 9.59111; // empirical CHECK_CLOSE_REL(layer->thickness(), (rMax - rMin) + 2 * envR, 1e-3); @@ -291,7 +291,7 @@ namespace Test { const CylinderBounds* bounds = &layer->bounds(); CHECK_CLOSE_REL(bounds->r(), (rMax + rMin) / 2., 1e-3); CHECK_CLOSE_REL(bounds->halflengthZ(), 14 + envZ, 1e-3); - BOOST_CHECK(checkBinning(*layer->surfaceArray())); + BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray())); auto axes = layer->surfaceArray()->getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30); BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 7); @@ -306,12 +306,12 @@ namespace Test { pl2.envR = {envR, envR}; pl2.envZ = {envZ, envZ}; layer = std::dynamic_pointer_cast<CylinderLayer>( - p_LC->cylinderLayer(srf, 30, 7, pl2)); + p_LC->cylinderLayer(tgContext, srf, 30, 7, pl2)); CHECK_CLOSE_REL(layer->thickness(), (rMax - rMin) + 2 * envR, 1e-3); bounds = &layer->bounds(); CHECK_CLOSE_REL(bounds->r(), (rMax + rMin) / 2., 1e-3); CHECK_CLOSE_REL(bounds->halflengthZ(), 14 + envZ, 1e-3); - BOOST_CHECK(checkBinning(*layer->surfaceArray())); + BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray())); axes = layer->surfaceArray()->getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30); BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 7); @@ -321,14 +321,14 @@ namespace Test { CHECK_CLOSE_REL(axes.at(1)->getMax(), 14, 1e-3); layer = std::dynamic_pointer_cast<CylinderLayer>( - p_LC->cylinderLayer(srf, 13, 3, pl2)); + p_LC->cylinderLayer(tgContext, srf, 13, 3, pl2)); CHECK_CLOSE_REL(layer->thickness(), (rMax - rMin) + 2 * envR, 1e-3); bounds = &layer->bounds(); CHECK_CLOSE_REL(bounds->r(), (rMax + rMin) / 2., 1e-3); CHECK_CLOSE_REL(bounds->halflengthZ(), 14 + envZ, 1e-3); // this succeeds despite sub-optimal binning // since we now have multientry bins - BOOST_CHECK(checkBinning(*layer->surfaceArray())); + BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray())); axes = layer->surfaceArray()->getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 13); BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 3); @@ -344,7 +344,7 @@ namespace Test { pl3.minZ = -25; pl3.maxZ = 25; layer = std::dynamic_pointer_cast<CylinderLayer>( - p_LC->cylinderLayer(srf, equidistant, equidistant, pl3)); + p_LC->cylinderLayer(tgContext, srf, equidistant, equidistant, pl3)); CHECK_CLOSE_REL(layer->thickness(), 19, 1e-3); bounds = &layer->bounds(); CHECK_CLOSE_REL(bounds->r(), 10.5, 1e-3); @@ -353,7 +353,7 @@ namespace Test { // this should fail, b/c it's a completely inconvenient binning // but it succeeds despite sub-optimal binning // since we now have multientry bins - BOOST_CHECK(checkBinning(*layer->surfaceArray())); + BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray())); axes = layer->surfaceArray()->getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30); @@ -381,13 +381,13 @@ namespace Test { pl.minR = 5; pl.maxR = 25; std::shared_ptr<DiscLayer> layer = std::dynamic_pointer_cast<DiscLayer>( - p_LC->discLayer(surfaces, equidistant, equidistant, pl)); + p_LC->discLayer(tgContext, surfaces, equidistant, equidistant, pl)); CHECK_CLOSE_REL(layer->thickness(), 20, 1e-3); const RadialBounds* bounds = dynamic_cast<const RadialBounds*>(&layer->bounds()); CHECK_CLOSE_REL(bounds->rMin(), 5, 1e-3); CHECK_CLOSE_REL(bounds->rMax(), 25, 1e-3); - BOOST_CHECK(checkBinning(*layer->surfaceArray())); + BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray())); auto axes = layer->surfaceArray()->getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 3); BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 30); @@ -409,14 +409,14 @@ namespace Test { pl2.envR = {envMinR, envMaxR}; pl2.envZ = {envZ, envZ}; layer = std::dynamic_pointer_cast<DiscLayer>( - p_LC->discLayer(surfaces, nBinsR, nBinsPhi, pl2)); + p_LC->discLayer(tgContext, surfaces, nBinsR, nBinsPhi, pl2)); double rMin = 8, rMax = 22.0227; CHECK_CLOSE_REL(layer->thickness(), 0.4 + 2 * envZ, 1e-3); bounds = dynamic_cast<const RadialBounds*>(&layer->bounds()); CHECK_CLOSE_REL(bounds->rMin(), rMin - envMinR, 1e-3); CHECK_CLOSE_REL(bounds->rMax(), rMax + envMaxR, 1e-3); - BOOST_CHECK(checkBinning(*layer->surfaceArray())); + BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray())); axes = layer->surfaceArray()->getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), nBinsR); BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), nBinsPhi); @@ -433,12 +433,12 @@ namespace Test { // CHECK_CLOSE_REL(actAngle, expAngle, 1e-3); layer = std::dynamic_pointer_cast<DiscLayer>( - p_LC->discLayer(surfaces, equidistant, equidistant, pl2)); + p_LC->discLayer(tgContext, surfaces, equidistant, equidistant, pl2)); CHECK_CLOSE_REL(layer->thickness(), 0.4 + 2 * envZ, 1e-3); bounds = dynamic_cast<const RadialBounds*>(&layer->bounds()); CHECK_CLOSE_REL(bounds->rMin(), rMin - envMinR, 1e-3); CHECK_CLOSE_REL(bounds->rMax(), rMax + envMaxR, 1e-3); - BOOST_CHECK(checkBinning(*layer->surfaceArray())); + BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray())); axes = layer->surfaceArray()->getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), nBinsR); BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), nBinsPhi); @@ -468,7 +468,7 @@ namespace Test { pl.envZ = {envZ, envZ}; std::shared_ptr<CylinderLayer> layer = std::dynamic_pointer_cast<CylinderLayer>( - p_LC->cylinderLayer(brl, equidistant, equidistant, pl)); + p_LC->cylinderLayer(tgContext, brl, equidistant, equidistant, pl)); auto axes = layer->surfaceArray()->getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30); @@ -498,7 +498,7 @@ namespace Test { } // checkBinning should also report everything is fine - checkBinning(*layer->surfaceArray()); + checkBinning(tgContext, *layer->surfaceArray()); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Tests/Core/Tools/SimpleGeometryTests.cpp b/Tests/Core/Tools/SimpleGeometryTests.cpp index f1e52bfd11216bd45dca45a70837cfb43affcd61..efcaf38224aa817c4ce2222f4348db711b07f0d1 100644 --- a/Tests/Core/Tools/SimpleGeometryTests.cpp +++ b/Tests/Core/Tools/SimpleGeometryTests.cpp @@ -24,6 +24,9 @@ namespace Acts { namespace Test { + // Create a test context + GeometryContext tgContext = GeometryContext(); + /// @brief Unit test for a three layer detector parameters /// Testing the Tool chain in the geometry building process /// @@ -116,7 +119,7 @@ namespace Test { tgbConfig.trackingVolumeHelper = cylinderVolumeHelper; TrackingGeometryBuilder tgBuilder(tgbConfig); - auto tGeometry = tgBuilder.trackingGeometry(); + auto tGeometry = tgBuilder.trackingGeometry(tgContext); BOOST_CHECK(tGeometry != nullptr); } diff --git a/Tests/Core/Tools/SurfaceArrayCreatorTests.cpp b/Tests/Core/Tools/SurfaceArrayCreatorTests.cpp index da160c452574b2fbce59fb464032eea91c2a174b..e28f4350bbd1674ebcf9bac280c62fe41b7bd225 100644 --- a/Tests/Core/Tools/SurfaceArrayCreatorTests.cpp +++ b/Tests/Core/Tools/SurfaceArrayCreatorTests.cpp @@ -36,7 +36,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); #define CHECK_ROTATION_ANGLE(t, a, tolerance) \ { \ @@ -300,9 +300,9 @@ namespace Test { std::vector<const Surface*> emptyRaw; ProtoLayer pl(tgContext, emptyRaw); auto tr = Transform3D::Identity(); - BOOST_CHECK_THROW( - createEquidistantAxis(emptyRaw, BinningValue::binPhi, pl, tr), - std::logic_error); + BOOST_CHECK_THROW(createEquidistantAxis( + tgContext, emptyRaw, BinningValue::binPhi, pl, tr), + std::logic_error); std::vector<float> bdExp = { -3.14159, -2.93215, -2.72271, -2.51327, -2.30383, -2.0944, -1.88496, @@ -321,10 +321,10 @@ namespace Test { double angleShift = step / 2.; auto surfaces = fullPhiTestSurfacesEC(30, angleShift, z); std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(tgContext, surfacesRaw); - tr = Transform3D::Identity(); - auto axis - = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); + pl = ProtoLayer(tgContext, surfacesRaw); + tr = Transform3D::Identity(); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); BOOST_CHECK_EQUAL(axis.nBins, 30); CHECK_CLOSE_REL(axis.max, M_PI, 1e-6); @@ -338,7 +338,8 @@ namespace Test { surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_2.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); @@ -353,7 +354,8 @@ namespace Test { surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_3.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); @@ -369,7 +371,8 @@ namespace Test { pl = ProtoLayer(tgContext, surfaces); surfacesRaw = unpack_shared_vector(surfaces); tr = Transform3D::Identity(); - axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); surfacesRaw = unpack_shared_vector(surfaces); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_4.obj"); @@ -388,8 +391,8 @@ namespace Test { auto surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - auto axis - = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_1.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); @@ -404,7 +407,8 @@ namespace Test { surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_2.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); @@ -420,7 +424,8 @@ namespace Test { surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_3.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); @@ -436,7 +441,8 @@ namespace Test { surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); - axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_BRL_4.obj"); BOOST_CHECK_EQUAL(axis.nBins, 30); @@ -455,10 +461,10 @@ namespace Test { draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_Single.obj"); - pl = ProtoLayer(tgContext, surfacesRaw); - tr = Transform3D::Identity(); - auto axis - = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); + pl = ProtoLayer(tgContext, surfacesRaw); + tr = Transform3D::Identity(); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binPhi, pl, tr); BOOST_CHECK_EQUAL(axis.nBins, 1); CHECK_CLOSE_ABS(axis.max, phi(Vector3D(8, 1, 0)), 1e-3); @@ -475,7 +481,8 @@ namespace Test { auto surfacesRaw = unpack_shared_vector(surfaces); ProtoLayer pl = ProtoLayer(tgContext, surfacesRaw); auto trf = Transform3D::Identity(); - auto axis = createEquidistantAxis(surfacesRaw, BinningValue::binZ, pl, trf); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binZ, pl, trf); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_Z_1.obj"); BOOST_CHECK_EQUAL(axis.nBins, 1); @@ -490,7 +497,8 @@ namespace Test { surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3D::Identity(); - axis = createEquidistantAxis(surfacesRaw, BinningValue::binZ, pl, trf); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binZ, pl, trf); draw_surfaces( surfaces, (boost::format( @@ -510,7 +518,8 @@ namespace Test { surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3D::Identity(); - axis = createEquidistantAxis(surfacesRaw, BinningValue::binZ, pl, trf); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binZ, pl, trf); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_Z_3.obj"); BOOST_CHECK_EQUAL(axis.nBins, 10); @@ -528,9 +537,10 @@ namespace Test { auto surfacesRaw = unpack_shared_vector(surfaces); draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_R_1.obj"); - auto trf = Transform3D::Identity(); - ProtoLayer pl = ProtoLayer(tgContext, surfacesRaw); - auto axis = createEquidistantAxis(surfacesRaw, BinningValue::binR, pl, trf); + auto trf = Transform3D::Identity(); + ProtoLayer pl = ProtoLayer(tgContext, surfacesRaw); + auto axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binR, pl, trf); BOOST_CHECK_EQUAL(axis.nBins, 1); CHECK_CLOSE_ABS(axis.max, perp(Vector3D(17, 1, 0)), 1e-3); CHECK_CLOSE_ABS(axis.min, 13, 1e-3); @@ -550,7 +560,8 @@ namespace Test { surfacesRaw = unpack_shared_vector(surfaces); pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3D::Identity(); - axis = createEquidistantAxis(surfacesRaw, BinningValue::binR, pl, trf); + axis = createEquidistantAxis( + tgContext, surfacesRaw, BinningValue::binR, pl, trf); BOOST_CHECK_EQUAL(axis.nBins, 3); CHECK_CLOSE_REL(axis.max, perp(Vector3D(20 + 2, 1, 0)), 1e-3); @@ -576,8 +587,8 @@ namespace Test { std::copy(ringC.begin(), ringC.end(), std::back_inserter(surfaces)); draw_surfaces(surfaces, "SurfaceArrayCreator_dependentBinCounts.obj"); - std::unique_ptr<SurfaceArray> sArray - = m_SAC.surfaceArrayOnDisc(surfaces, equidistant, equidistant); + std::unique_ptr<SurfaceArray> sArray = m_SAC.surfaceArrayOnDisc( + tgContext, surfaces, equidistant, equidistant); auto axes = sArray->getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 3); BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 10); @@ -638,8 +649,10 @@ namespace Test { // EQUIDISTANT Transform3D tr = Transform3D::Identity(); - auto pAxisPhi = createEquidistantAxis(brlRaw, BinningValue::binPhi, pl, tr); - auto pAxisZ = createEquidistantAxis(brlRaw, BinningValue::binZ, pl, tr); + auto pAxisPhi = createEquidistantAxis( + tgContext, brlRaw, BinningValue::binPhi, pl, tr); + auto pAxisZ + = createEquidistantAxis(tgContext, brlRaw, BinningValue::binZ, pl, tr); double R = 10.; Transform3D itr = tr.inverse(); @@ -686,8 +699,9 @@ namespace Test { tr = Transform3D::Identity(); auto pAxisPhiVar - = createVariableAxis(brlRaw, BinningValue::binPhi, pl, tr); - auto pAxisZVar = createVariableAxis(brlRaw, BinningValue::binZ, pl, tr); + = createVariableAxis(tgContext, brlRaw, BinningValue::binPhi, pl, tr); + auto pAxisZVar + = createVariableAxis(tgContext, brlRaw, BinningValue::binZ, pl, tr); itr = tr.inverse(); diff --git a/Tests/Core/Vertexing/FullBilloirVertexFitterTests.cpp b/Tests/Core/Vertexing/FullBilloirVertexFitterTests.cpp index 5f69fe1923feb64e67a8c631e248a89d03f2f053..508688ec39eb7dd2cb46faefd40ea8773e089f21 100644 --- a/Tests/Core/Vertexing/FullBilloirVertexFitterTests.cpp +++ b/Tests/Core/Vertexing/FullBilloirVertexFitterTests.cpp @@ -32,8 +32,8 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); /// @brief Unit test for FullBilloirVertexFitter /// diff --git a/Tests/Core/Vertexing/LinearizedTrackFactoryTests.cpp b/Tests/Core/Vertexing/LinearizedTrackFactoryTests.cpp index d16408c03b6b2f7576d0d2452aa826ee950d9e7b..f45c1c858d4af4d12232b20a76e51a87f0ee89d0 100644 --- a/Tests/Core/Vertexing/LinearizedTrackFactoryTests.cpp +++ b/Tests/Core/Vertexing/LinearizedTrackFactoryTests.cpp @@ -30,8 +30,8 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); // Vertex x/y position distribution std::uniform_real_distribution<> vXYDist(-0.1 * units::_mm, 0.1 * units::_mm); diff --git a/Tests/Core/Volumes/CylinderVolumeBoundsTests.cpp b/Tests/Core/Volumes/CylinderVolumeBoundsTests.cpp index 4a2994d89dd7fe76b9610cd74f4409b9bb81feee..f79f1fdbb62ab4dea6a4d940f5f47759ca3a83d8 100644 --- a/Tests/Core/Volumes/CylinderVolumeBoundsTests.cpp +++ b/Tests/Core/Volumes/CylinderVolumeBoundsTests.cpp @@ -45,7 +45,7 @@ namespace Test { (void)index; // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); // position of volume const Vector3D pos(posX, posY, posZ); diff --git a/Tests/Integration/PropagationTestHelper.hpp b/Tests/Integration/PropagationTestHelper.hpp index 96b250e13bd9c3394137ef18e7be31f388606211..b882f9ef1859691758e875dfa840323e1bbd0c37 100644 --- a/Tests/Integration/PropagationTestHelper.hpp +++ b/Tests/Integration/PropagationTestHelper.hpp @@ -25,8 +25,8 @@ using units::Nat2SI; namespace IntegrationTest { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); - MagneticFieldContext mfContext = DefaultMagneticFieldContext(); + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); /// Helper method to create a transform for a plane /// to mimic detector situations, the plane is roughly diff --git a/Tests/Integration/PropagationTests.cpp b/Tests/Integration/PropagationTests.cpp index c26b90603266988905e3427e91b8e7386b328d39..b75d80f92c9a06ee44e8f312c88ad446f4050c16 100644 --- a/Tests/Integration/PropagationTests.cpp +++ b/Tests/Integration/PropagationTests.cpp @@ -88,8 +88,9 @@ namespace IntegrationTest { return cvb.trackingVolume(inner, nullptr); }); TrackingGeometryBuilder tgb(tgbCfg); - std::shared_ptr<const TrackingGeometry> detector = tgb.trackingGeometry(); - Navigator navi(detector); + std::shared_ptr<const TrackingGeometry> detector + = tgb.trackingGeometry(tgContext); + Navigator navi(detector); return DensePropagatorType(dstepper, std::move(navi)); } diff --git a/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp b/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp index 87a0af696ff4a93ef8c2a67ce54f939c54531820..3942d13aaa478aea3ae24bd6f5a8bf793426a558 100644 --- a/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp +++ b/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp @@ -27,7 +27,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); /// Unit test for testing the main functions of DoubleHitSpacePointBuilder /// 1) A pair of hits gets added and resolved. diff --git a/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp b/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp index 654be392e71ff42c6c159e14709fc17113d594e8..984bf5682df0408fd9325f80d8f6432b9c35ae88 100644 --- a/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp +++ b/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp @@ -27,7 +27,7 @@ namespace Acts { namespace Test { // Create a test context - GeometryContext tgContext = DefaultGeometryContext(); + GeometryContext tgContext = GeometryContext(); /// Unit test for testing the main functions of OneHitSpacePointBuilder /// 1) A resolved dummy hit gets created and added.