diff --git a/Core/include/Acts/Detector/TrackingGeometry.hpp b/Core/include/Acts/Detector/TrackingGeometry.hpp index 257bcebd1e55eacb38f3d06be81da88e34906727..b97d1928bf44f3c49081a368ccece430f7f6b773 100644 --- a/Core/include/Acts/Detector/TrackingGeometry.hpp +++ b/Core/include/Acts/Detector/TrackingGeometry.hpp @@ -11,8 +11,8 @@ /////////////////////////////////////////////////////////////////// #pragma once -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometrySignature.hpp" #include <functional> @@ -60,12 +60,12 @@ public: /// return the lowest tracking Volume /// - /// @param ctx is the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param gp is the global position of the call /// /// @return plain pointer to the lowest TrackingVolume const TrackingVolume* - trackingVolume(Context ctx, const Vector3D& gp) const; + trackingVolume(const GeometryContext& gctx, const Vector3D& gp) const; /// return the lowest tracking Volume /// @@ -77,12 +77,12 @@ public: /// Forward the associated Layer information /// - /// @paramn ctx is the context for this request (e.g. alignment) + /// @paramn gctx is the context for this request (e.g. alignment) /// @param gp is the global position of the call /// /// @return plain pointer to assocaiated layer const Layer* - associatedLayer(Context ctx, const Vector3D& gp) const; + associatedLayer(const GeometryContext& gctx, const Vector3D& gp) const; /// Register the beam tube /// diff --git a/Core/include/Acts/Detector/TrackingVolume.hpp b/Core/include/Acts/Detector/TrackingVolume.hpp index 3723f78465c70475c12e6ceb9650d393d44c466b..6042e8326f6f2429ea17dc0c1819195266160fcc 100644 --- a/Core/include/Acts/Detector/TrackingVolume.hpp +++ b/Core/include/Acts/Detector/TrackingVolume.hpp @@ -19,8 +19,8 @@ #include "Acts/Surfaces/BoundaryCheck.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/BinnedArray.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometrySignature.hpp" #include "Acts/Volumes/BoundarySurfaceT.hpp" #include "Acts/Volumes/Volume.hpp" @@ -132,12 +132,12 @@ public: /// Return the associated Layer to the global position /// - /// @param ctx is the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param gp is the associated global position /// /// @return plain pointer to layer object const Layer* - associatedLayer(Context ctx, const Vector3D& gp) const; + associatedLayer(const GeometryContext& gctx, const Vector3D& gp) const; /// @brief Resolves the volume into (compatible) Layers /// @@ -145,7 +145,7 @@ public: /// @tparam options_t Type of navigation options object for decomposition /// @tparam corrector_t Type of (optional) corrector for surface intersection /// - /// @param ctx is the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param position Position for the search /// @param direction Direction for the search /// @param options The templated navigation options @@ -155,11 +155,11 @@ public: template <typename options_t, typename corrector_t = VoidIntersectionCorrector> std::vector<LayerIntersection> - compatibleLayers(Context ctx, - const Vector3D& position, - const Vector3D& direction, - const options_t& options, - const corrector_t& corrfnc = corrector_t()) const; + compatibleLayers(const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc = corrector_t()) const; /// @brief Resolves the volume into (compatible) Layers /// @@ -168,7 +168,7 @@ public: /// @tparam options_t Type of navigation options object for decomposition /// @tparam corrector_t Type of (optional) corrector for surface intersection /// - /// @param ctx is the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param parameters The templated parameters for searching /// @param options The templated navigation options /// @param corrfnc is the corrector struct / function @@ -178,10 +178,10 @@ public: typename options_t, typename corrector_t = VoidIntersectionCorrector> std::vector<LayerIntersection> - compatibleLayers(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc = corrector_t()) const; + compatibleLayers(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc = corrector_t()) const; /// @brief Returns all boundary surfaces sorted by the user. /// @@ -189,7 +189,7 @@ public: /// @tparam corrector_t Type of (optional) corrector for surface intersection /// @tparam sorter_t Type of the boundary surface sorter /// - /// @param ctx is the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param position The position for searching /// @param direction The direction for searching /// @param options The templated navigation options @@ -201,12 +201,12 @@ public: typename corrector_t = VoidIntersectionCorrector, typename sorter_t = DefaultBoundaryIntersectionSorter> std::vector<BoundaryIntersection> - compatibleBoundaries(Context ctx, - const Vector3D& position, - const Vector3D& direction, - const options_t& options, - const corrector_t& corrfnc = corrector_t(), - const sorter_t& sorter = sorter_t()) const; + compatibleBoundaries(const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc = corrector_t(), + const sorter_t& sorter = sorter_t()) const; /// @brief Returns all boundary surfaces sorted by the user. /// @@ -215,7 +215,7 @@ public: /// @tparam corrector_t Type of (optional) corrector for surface intersection /// @tparam sorter_t Type of the boundary surface sorter /// - /// @param ctx is the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param parameters The templated parameters for searching /// @param options The templated navigation options /// @param corrfnc is the corrector struct / function @@ -227,20 +227,20 @@ public: typename corrector_t = VoidIntersectionCorrector, typename sorter_t = DefaultBoundaryIntersectionSorter> std::vector<BoundaryIntersection> - compatibleBoundaries(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc = corrector_t(), - const sorter_t& sorter = sorter_t()) const; + compatibleBoundaries(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc = corrector_t(), + const sorter_t& sorter = sorter_t()) const; /// Return the associated sub Volume, returns THIS if no subVolume exists /// - /// @param ctx is the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param gp is the global position associated with that search /// /// @return plain pointer to associated with the position const TrackingVolume* - trackingVolume(Context ctx, const Vector3D& gp) const; + trackingVolume(const GeometryContext& gctx, const Vector3D& gp) const; /// Return the confined static layer array - if it exists /// @return the BinnedArray of static layers if exists diff --git a/Core/include/Acts/Detector/detail/BoundaryIntersectionSorter.hpp b/Core/include/Acts/Detector/detail/BoundaryIntersectionSorter.hpp index abcc8e6d9fdeb5829b34188be77b0dd0fb7a72c7..77b9d1c170299e1c3db6b807c0d3784294c80183 100644 --- a/Core/include/Acts/Detector/detail/BoundaryIntersectionSorter.hpp +++ b/Core/include/Acts/Detector/detail/BoundaryIntersectionSorter.hpp @@ -42,7 +42,7 @@ struct DefaultBoundaryIntersectionSorter /// @tparam options_t Type of navigation options object for decomposition /// @tparam corrector_t Type of (optional) corrector for surface intersection /// - /// @param ctx the Context object for this call + /// @param gctx The current geometry context object, e.g. alignment /// @param boundaries Vector of boundaries of the volume /// @param position The position for searching /// @param direction The direction for searching @@ -53,7 +53,7 @@ struct DefaultBoundaryIntersectionSorter /// intersection probability template <typename options_t, typename corrector_t> std::vector<BoundaryIntersection> - operator()(Context ctx, + operator()(const GeometryContext& gctx, std::vector<const BoundarySurfaceT<TrackingVolume>*>& boundaries, const Vector3D& position, const Vector3D& direction, @@ -66,7 +66,7 @@ struct DefaultBoundaryIntersectionSorter // intersect the surface SurfaceIntersection bsIntersection = bSurfaceRep.surfaceIntersectionEstimate( - ctx, position, direction, options, corrfnc); + gctx, position, direction, options, corrfnc); // check if the intersection is valid, but exlude the on-surface case // when requested -- move to intersectionestimate if (bsIntersection) { @@ -115,7 +115,7 @@ struct BoundaryIntersectionSorter /// @tparam options_t Type of navigation options object for decomposition /// @tparam corrector_t Type of (optional) corrector for surface intersection /// - /// @param ctx The context for this call, e.g. alignment + /// @param gctx The current geometry context object, e.g. alignment /// @param boundaries Vector of boundaries of the volume /// @param position The position for searching /// @param direction The direction for searching @@ -126,7 +126,7 @@ struct BoundaryIntersectionSorter /// intersection probability template <typename options_t, typename corrector_t> std::vector<BoundaryIntersection> - operator()(Context ctx, + operator()(const GeometryContext& gctx, std::vector<const BoundarySurfaceT<TrackingVolume>*>& boundaries, const Vector3D& position, const Vector3D& direction, @@ -154,7 +154,7 @@ struct BoundaryIntersectionSorter // Collect intersections for (const auto& boundary : boundaries) { bIntersections.push_back( - intersect(ctx, boundary, position, direction, options, corrfnc)); + intersect(gctx, boundary, position, direction, options, corrfnc)); } // Fast exit for that case return bIntersections; @@ -166,12 +166,12 @@ struct BoundaryIntersectionSorter // If the intersection is valid it is pushed to the final vector otherwise // to a tmp storage BoundaryIntersection intersection - = intersect(ctx, boundary, position, direction, options, corrfnc); + = intersect(gctx, boundary, position, direction, options, corrfnc); if (intersection) { bIntersections.push_back(std::move(intersection)); } else { bIntersectionsOtherNavDir.push_back(intersect( - ctx, boundary, position, direction, optionsOtherNavDir, corrfnc)); + gctx, boundary, position, direction, optionsOtherNavDir, corrfnc)); } } @@ -205,7 +205,7 @@ private: /// @tparam options_t Type of navigation options object for decomposition /// @tparam corrector_t Type of (optional) corrector for surface intersection /// - /// @param ctx the context obejct for this call, e.g. alignment + /// @param gctx The current geometry context object, e.g. alignment /// @param boundary Boundary of the volume /// @param position The position for searching /// @param direction The direction for searching @@ -215,7 +215,7 @@ private: /// @return Intersection object of the boundary surface template <typename options_t, typename corrector_t> BoundaryIntersection - intersect(Context ctx, + intersect(const GeometryContext& gctx, const BoundarySurfaceT<TrackingVolume>* boundary, const Vector3D& position, const Vector3D& direction, @@ -225,7 +225,7 @@ private: const Surface* surface = &(boundary->surfaceRepresentation()); // intersect the surface SurfaceIntersection bsIntersection = surface->surfaceIntersectionEstimate( - ctx, position, direction, options, corrfnc); + gctx, position, direction, options, corrfnc); return BoundaryIntersection( bsIntersection.intersection, boundary, surface, options.navDir); } diff --git a/Core/include/Acts/Detector/detail/DefaultDetectorElementBase.hpp b/Core/include/Acts/Detector/detail/DefaultDetectorElementBase.hpp index a12742df7de4e71da3e41ad7e6d873620a719e8e..e6d7fcf6522cb177ae56c1f0ae1d0962fe665c7d 100644 --- a/Core/include/Acts/Detector/detail/DefaultDetectorElementBase.hpp +++ b/Core/include/Acts/Detector/detail/DefaultDetectorElementBase.hpp @@ -14,8 +14,8 @@ #include <memory> #include <vector> -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -39,10 +39,9 @@ public: /// Return the transform for the Element proxy mechanism /// - /// @param ctx is the Context object that is forwarded to the - /// the connected geometry to transport the event/thread context + /// @param gctx The current geometry context object, e.g. alignment virtual const Transform3D& - transform(Context ctx) const = 0; + transform(const GeometryContext& gctx) const = 0; /// Return surface association virtual const Surface& diff --git a/Core/include/Acts/Detector/detail/TrackingVolume.ipp b/Core/include/Acts/Detector/detail/TrackingVolume.ipp index a78b395ba303c12cff13d28869d6989afc59b7c6..798ebc8d693bbe821dfd3a55d361d83bb2928950 100644 --- a/Core/include/Acts/Detector/detail/TrackingVolume.ipp +++ b/Core/include/Acts/Detector/detail/TrackingVolume.ipp @@ -11,7 +11,8 @@ /////////////////////////////////////////////////////////////////// inline const Acts::Layer* -TrackingVolume::associatedLayer(Context /*ctx*/, const Vector3D& gp) const +TrackingVolume::associatedLayer(const GeometryContext& /*gctx*/, + const Vector3D& gp) const { // confined static layers - highest hierarchy if (m_confinedLayers) { @@ -24,11 +25,11 @@ TrackingVolume::associatedLayer(Context /*ctx*/, const Vector3D& gp) const template <typename options_t, typename corrector_t> std::vector<LayerIntersection> -TrackingVolume::compatibleLayers(Context ctx, - const Vector3D& position, - const Vector3D& direction, - const options_t& options, - const corrector_t& corrfnc) const +TrackingVolume::compatibleLayers(const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc) const { // the layer intersections which are valid @@ -38,7 +39,7 @@ TrackingVolume::compatibleLayers(Context ctx, if (m_confinedLayers) { // start layer given or not - test layer const Layer* tLayer = options.startObject ? options.startObject - : associatedLayer(ctx, position); + : associatedLayer(gctx, position); while (tLayer != nullptr) { // check if the layer needs resolving // - resolveSensitive -> always take layer if it has a surface array @@ -49,7 +50,7 @@ TrackingVolume::compatibleLayers(Context ctx, // if it's a resolveable start layer, you are by definition on it // layer on approach intersection auto atIntersection = tLayer->surfaceOnApproach( - ctx, position, direction, options, corrfnc); + gctx, position, direction, options, corrfnc); auto path = atIntersection.intersection.pathLength; bool withinLimit = (path * path <= options.pathLimit * options.pathLimit); @@ -64,7 +65,7 @@ TrackingVolume::compatibleLayers(Context ctx, // move to next one or break because you reached the end layer tLayer = (tLayer == options.endObject) ? nullptr - : tLayer->nextLayer(ctx, position, options.navDir * direction); + : tLayer->nextLayer(gctx, position, options.navDir * direction); } // sort them accordingly to the navigation direction if (options.navDir == forward) { @@ -79,24 +80,24 @@ TrackingVolume::compatibleLayers(Context ctx, template <typename parameters_t, typename options_t, typename corrector_t> std::vector<LayerIntersection> -TrackingVolume::compatibleLayers(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc) const +TrackingVolume::compatibleLayers(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc) const { return compatibleLayers( - ctx, parameters.position(), parameters.direction(), options, corrfnc); + gctx, parameters.position(), parameters.direction(), options, corrfnc); } // Returns the boundary surfaces ordered in probability to hit them based on template <typename options_t, typename corrector_t, typename sorter_t> std::vector<BoundaryIntersection> -TrackingVolume::compatibleBoundaries(Context ctx, - const Vector3D& position, - const Vector3D& direction, - const options_t& options, - const corrector_t& corrfnc, - const sorter_t& sorter) const +TrackingVolume::compatibleBoundaries(const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc, + const sorter_t& sorter) const { // Loop over boundarySurfaces and calculate the intersection auto excludeObject = options.startObject; @@ -114,7 +115,7 @@ TrackingVolume::compatibleBoundaries(Context ctx, nonExcludedBoundaries.push_back(bSurface); } return sorter( - ctx, nonExcludedBoundaries, position, direction, options, corrfnc); + gctx, nonExcludedBoundaries, position, direction, options, corrfnc); } // Returns the boundary surfaces ordered in probability to hit them based on @@ -124,13 +125,13 @@ template <typename parameters_t, typename corrector_t, typename sorter_t> std::vector<BoundaryIntersection> -TrackingVolume::compatibleBoundaries(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc, - const sorter_t& sorter) const +TrackingVolume::compatibleBoundaries(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc, + const sorter_t& sorter) const { - return compatibleBoundaries(ctx, + return compatibleBoundaries(gctx, parameters.position(), parameters.direction(), options, diff --git a/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp b/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp index ae1176a180ba049e3841cf5023f4aefccd5e47fa..5565d5a9845202d771f0757eb29fb174b669318b 100644 --- a/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp +++ b/Core/include/Acts/EventData/SingleBoundTrackParameters.hpp @@ -9,7 +9,7 @@ #pragma once #include "Acts/EventData/SingleTrackParameters.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -36,7 +36,7 @@ public: /// /// The transformations declared in the coordinate_transformation /// yield the global parameters and momentum representation - /// @param[in] ctx is the Context object that is forwarded to the surface + /// @param[in] gctx is the Context object that is forwarded to the surface /// for local to global coordinate transformation /// @param[in] cov The covaraniance matrix (optional, can be nullptr) /// it is given in the measurement frame @@ -44,7 +44,7 @@ public: /// @param[in] surface The reference surface the parameters are bound to template <typename T = ChargePolicy, std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> - SingleBoundTrackParameters(Context ctx, + SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov, const ParVector_t& parValues, std::shared_ptr<const Surface> surface) @@ -52,7 +52,7 @@ public: std::move(cov), parValues, detail::coordinate_transformation::parameters2globalPosition( - ctx, + gctx, parValues, *surface), detail::coordinate_transformation::parameters2globalMomentum( @@ -69,7 +69,7 @@ public: /// The transformations declared in the coordinate_transformation /// yield the local parameters /// - /// @param[in] ctx is the Context object that is forwarded to the surface + /// @param[in] gctx is the Context object that is forwarded to the surface /// for local to global coordinate transformation /// @param[in] cov The covaraniance matrix (optional, can be nullptr) /// it is given in the curvilinear frame @@ -79,7 +79,7 @@ public: /// @param[in] surface The reference surface the parameters are bound to template <typename T = ChargePolicy, std::enable_if_t<std::is_same<T, ChargedPolicy>::value, int> = 0> - SingleBoundTrackParameters(Context ctx, + SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov, const ActsVectorD<3>& position, const ActsVectorD<3>& momentum, @@ -87,7 +87,7 @@ public: std::shared_ptr<const Surface> surface) : SingleTrackParameters<ChargePolicy>( std::move(cov), - detail::coordinate_transformation::global2parameters(ctx, + detail::coordinate_transformation::global2parameters(gctx, position, momentum, dCharge, @@ -106,7 +106,7 @@ public: /// The transformations declared in the coordinate_transformation /// yield the global parameters and momentum representation /// - /// @param[in] ctx is the Context object that is forwarded to the surface + /// @param[in] gctx is the Context object that is forwarded to the surface /// for local to global coordinate transformation /// @param[in] cov The covaraniance matrix (optional, can be nullptr) /// it is given in the measurement frame @@ -114,7 +114,7 @@ public: /// @param[in] surface The reference surface the parameters are bound to template <typename T = ChargePolicy, std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> - SingleBoundTrackParameters(Context ctx, + SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov, const ParVector_t& parValues, std::shared_ptr<const Surface> surface) @@ -122,7 +122,7 @@ public: std::move(cov), parValues, detail::coordinate_transformation::parameters2globalPosition( - ctx, + gctx, parValues, *surface), detail::coordinate_transformation::parameters2globalMomentum( @@ -140,7 +140,7 @@ public: /// yield the local parameters /// /// - /// @param[in] ctx is the Context object that is forwarded to the surface + /// @param[in] gctx is the Context object that is forwarded to the surface /// for local to global coordinate transformation /// @param[in] cov The covaraniance matrix (optional, can be nullptr) /// it is given in the curvilinear frame @@ -150,14 +150,14 @@ public: /// @param[in] surface The reference surface the parameters are bound to template <typename T = ChargePolicy, std::enable_if_t<std::is_same<T, NeutralPolicy>::value, int> = 0> - SingleBoundTrackParameters(Context ctx, + SingleBoundTrackParameters(const GeometryContext& gctx, CovPtr_t cov, const ActsVectorD<3>& position, const ActsVectorD<3>& momentum, std::shared_ptr<const Surface> surface) : SingleTrackParameters<ChargePolicy>( std::move(cov), - detail::coordinate_transformation::global2parameters(ctx, + detail::coordinate_transformation::global2parameters(gctx, position, momentum, 0, @@ -226,14 +226,14 @@ public: /// @brief set method for parameter updates /// obviously only allowed on non-const objects // - /// @param[in] ctx is the Context object that is forwarded to the surface + /// @param[in] gctx is the Context object that is forwarded to the surface /// for local to global coordinate transformation template <ParID_t par> void - set(Context ctx, ParValue_t newValue) + set(const GeometryContext& gctx, ParValue_t newValue) { this->getParameterSet().template setParameter<par>(newValue); - this->updateGlobalCoordinates(ctx, typename par_type<par>::type()); + this->updateGlobalCoordinates(gctx, typename par_type<par>::type()); } /// @brief access method to the reference surface @@ -247,7 +247,7 @@ public: /// respect to the global coordinate system, in which the local error /// is described. /// - /// @param[in] ctx is the Context object that is forwarded to the surface + /// @param[in] gctx is the Context object that is forwarded to the surface /// for local to global coordinate transformation /// /// For planar surface, this is identical to the rotation matrix of the @@ -255,10 +255,10 @@ public: /// constructed by the point of clostest approach to the line, for /// cylindrical surfaces this is (by convention) the tangential plane. RotationMatrix3D - referenceFrame(Context ctx) const final + referenceFrame(const GeometryContext& gctx) const final { return std::move( - m_pSurface->referenceFrame(ctx, this->position(), this->momentum())); + m_pSurface->referenceFrame(gctx, this->position(), this->momentum())); } private: diff --git a/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp b/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp index 63cabcf124ff512b432926cb9b63e0c2dc93df7f..eec50cf446f53ab2ee8de5255b62266025efdb1d 100644 --- a/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp +++ b/Core/include/Acts/EventData/SingleCurvilinearTrackParameters.hpp @@ -10,7 +10,7 @@ #include <memory> #include "Acts/EventData/SingleTrackParameters.hpp" #include "Acts/Surfaces/PlaneSurface.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -139,8 +139,7 @@ public: /// /// @tparam ParID_t The parameter type /// - /// @param ctx is the Context object, @note is it ignored for Curvilinear - /// parameters + /// @param gctx The current geometry context object, e.g. alignment /// @param newValue The new updaed value /// /// For curvilinear parameters the local parameters are forced to be @@ -150,11 +149,11 @@ public: local_parameter>::value, int> = 0> void - set(Context ctx, ParValue_t newValue) + set(const GeometryContext& gctx, ParValue_t newValue) { // set the parameter & update the new global position this->getParameterSet().template setParameter<par>(newValue); - this->updateGlobalCoordinates(ctx, typename par_type<par>::type()); + this->updateGlobalCoordinates(gctx, typename par_type<par>::type()); // recreate the surface m_upSurface = Surface::makeShared<PlaneSurface>( this->position(), this->momentum().normalized()); @@ -167,8 +166,7 @@ public: /// enable for parameters that are not local parameters /// @tparam ParID_t The parameter type /// - /// @param ctx is the Context object, @note is it ignored for Curvilinear - /// parameters + /// @param gctx The current geometry context object, e.g. alignment /// @param newValue The new updaed value /// /// For curvilinear parameters the directional change of parameters @@ -178,10 +176,10 @@ public: local_parameter>::value, int> = 0> void - set(Context ctx, ParValue_t newValue) + set(const GeometryContext& gctx, ParValue_t newValue) { this->getParameterSet().template setParameter<par>(newValue); - this->updateGlobalCoordinates(ctx, typename par_type<par>::type()); + this->updateGlobalCoordinates(gctx, typename par_type<par>::type()); // recreate the surface m_upSurface = Surface::makeShared<PlaneSurface>( this->position(), this->momentum().normalized()); @@ -198,16 +196,15 @@ public: /// respect to the global coordinate system, in which the local error /// is described. /// - /// @param ctx is the Context object, @note is it ignored for Curvilinear - /// parameters, it's defaulted here because curvilinear parameters can not - /// have any ohter context as their own + /// @param gctx The current geometry context object, e.g. alignment /// - /// For a curvilinear track parameterisation this is identical to the - /// rotation matrix of the intrinsic planar surface. + /// @note For a curvilinear track parameterisation this is identical to + /// the rotation matrix of the intrinsic planar surface. RotationMatrix3D - referenceFrame(Context ctx = DefaultContext()) const final + referenceFrame(const GeometryContext& gctx + = DefaultGeometryContext()) const final { - return m_upSurface->transform(ctx).linear(); + return m_upSurface->transform(gctx).linear(); } private: diff --git a/Core/include/Acts/EventData/SingleTrackParameters.hpp b/Core/include/Acts/EventData/SingleTrackParameters.hpp index 08074b2f0d61c88a2f2ff373b1f3f241d0998e7d..8c47d46425105876987d0f6e94e414d1baa61336 100644 --- a/Core/include/Acts/EventData/SingleTrackParameters.hpp +++ b/Core/include/Acts/EventData/SingleTrackParameters.hpp @@ -10,8 +10,8 @@ #include <type_traits> #include "Acts/EventData/TrackParametersBase.hpp" #include "Acts/EventData/detail/coordinate_transformations.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -196,14 +196,14 @@ protected: /// @brief update global momentum from current parameter values /// /// - /// @param[in] ctx is the Context object that is forwarded to the surface + /// @param[in] gctx is the Context object that is forwarded to the surface /// for local to global coordinate transformation /// /// @note This function is triggered when called with an argument of a type /// different from Acts::local_parameter template <typename T> void - updateGlobalCoordinates(Context /*ctx*/, const T& /*unused*/) + updateGlobalCoordinates(const GeometryContext& /*gctx*/, const T& /*unused*/) { m_vMomentum = detail::coordinate_transformation::parameters2globalMomentum( getParameterSet().getParameters()); @@ -214,10 +214,11 @@ protected: /// @note This function is triggered when called with an argument of a type /// Acts::local_parameter void - updateGlobalCoordinates(Context ctx, const local_parameter& /*unused*/) + updateGlobalCoordinates(const GeometryContext& gctx, + const local_parameter& /*unused*/) { m_vPosition = detail::coordinate_transformation::parameters2globalPosition( - ctx, getParameterSet().getParameters(), this->referenceSurface()); + gctx, getParameterSet().getParameters(), this->referenceSurface()); } ChargePolicy m_oChargePolicy; ///< charge policy object distinguishing diff --git a/Core/include/Acts/EventData/TrackParametersBase.hpp b/Core/include/Acts/EventData/TrackParametersBase.hpp index fd1eb76b9b1fba88fdc8dcc32ffdbc830c1a3641..aa7bd78c39897a9b26ffb87c6f43f3c52b87cc9d 100644 --- a/Core/include/Acts/EventData/TrackParametersBase.hpp +++ b/Core/include/Acts/EventData/TrackParametersBase.hpp @@ -14,7 +14,7 @@ // Acts includes #include "Acts/EventData/ChargePolicy.hpp" #include "Acts/EventData/ParameterSet.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/ParameterDefinitions.hpp" @@ -157,7 +157,7 @@ public: /// is described. /// /// - /// @param[in] ctx is the Context object that is forwarded to the surface + /// @param[in] gctx is the Context object that is forwarded to the surface /// for local to global coordinate transformation /// /// For planar surface, this is identical to the rotation matrix of the @@ -165,7 +165,7 @@ public: /// constructed by the point of clostest approach to the line, for /// cylindrical surfaces this is (by convention) the tangential plane. virtual RotationMatrix3D - referenceFrame(Context ctx) const = 0; + referenceFrame(const GeometryContext& gctx) const = 0; /// @brief output stream operator /// diff --git a/Core/include/Acts/EventData/detail/coordinate_transformations.hpp b/Core/include/Acts/EventData/detail/coordinate_transformations.hpp index 182945be2844881c98b806477582159e049a319c..92219dfcb821cfd06f96b0fe00cd42a0410b7b75 100644 --- a/Core/include/Acts/EventData/detail/coordinate_transformations.hpp +++ b/Core/include/Acts/EventData/detail/coordinate_transformations.hpp @@ -10,7 +10,7 @@ #include <cmath> #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/ParameterDefinitions.hpp" #ifdef ACTS_COORDINATE_TRANSFORM_PLUGIN @@ -36,18 +36,18 @@ namespace detail { /// object to guarantee the local to global transformation is done /// within the right (alginment/conditions) context /// - /// @param ctx The context object mentioned above + /// @param gctx The current geometry context object, e.g. alignment /// @param pars the parameter vector /// @param s the surface for the local to global transform /// /// @return position in the global frame static ActsVectorD<3> - parameters2globalPosition(Context ctx, - const ParVector_t& pars, - const Surface& s) + parameters2globalPosition(const GeometryContext& gctx, + const ParVector_t& pars, + const Surface& s) { ActsVectorD<3> globalPosition; - s.localToGlobal(ctx, + s.localToGlobal(gctx, ActsVectorD<2>(pars(Acts::eLOC_0), pars(Acts::eLOC_1)), parameters2globalMomentum(pars), globalPosition); @@ -108,7 +108,7 @@ namespace detail { /// object to guarantee the local to global transformation is done /// within the right (alginment/conditions) context /// - /// @param ctx The context object mentioned above + /// @param gctx The current geometry context object, e.g. alignment /// @param pos position of the parameterisation in global /// @param mom position of the parameterisation in global /// @param charge of the particle/track @@ -116,16 +116,16 @@ namespace detail { /// /// @return the track parameterisation static ParVector_t - global2parameters(Context ctx, - const ActsVectorD<3>& pos, - const ActsVectorD<3>& mom, - double charge, - const Surface& s) + global2parameters(const GeometryContext& gctx, + const ActsVectorD<3>& pos, + const ActsVectorD<3>& mom, + double charge, + const Surface& s) { using VectorHelpers::phi; using VectorHelpers::theta; ActsVectorD<2> localPosition; - s.globalToLocal(ctx, pos, mom, localPosition); + s.globalToLocal(gctx, pos, mom, localPosition); ParVector_t result; result << localPosition(0), localPosition(1), phi(mom), theta(mom), ((std::abs(charge) < 1e-4) ? 1. : charge) / mom.norm(); diff --git a/Core/include/Acts/Extrapolator/MaterialInteractor.hpp b/Core/include/Acts/Extrapolator/MaterialInteractor.hpp index 5b9eec042b453a061be1e5bf6359a6e75cc13e01..9426e94bb0fe0988a9f3c74b885d97851cade2d3 100644 --- a/Core/include/Acts/Extrapolator/MaterialInteractor.hpp +++ b/Core/include/Acts/Extrapolator/MaterialInteractor.hpp @@ -164,7 +164,7 @@ struct MaterialInteractor // Calculate the path correction double pCorrection = state.navigation.currentSurface->pathCorrection( - state.context, + state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping)); diff --git a/Core/include/Acts/Extrapolator/Navigator.hpp b/Core/include/Acts/Extrapolator/Navigator.hpp index 571425f6352b7eda484d903ec274ae5deba80dd2..e77d37a562685cfb8b07ee8c5e60c91192ceeb60 100644 --- a/Core/include/Acts/Extrapolator/Navigator.hpp +++ b/Core/include/Acts/Extrapolator/Navigator.hpp @@ -324,7 +324,7 @@ public: // get the attached volume information auto boundary = state.navigation.navBoundaryIter->object; state.navigation.currentVolume - = boundary->attachedVolume(state.context, + = boundary->attachedVolume(state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), state.stepping.navDir); @@ -490,10 +490,10 @@ private: return dstream.str(); }); state.navigation.startVolume = trackingGeometry->trackingVolume( - state.context, stepper.position(state.stepping)); + state.geoContext, stepper.position(state.stepping)); state.navigation.startLayer = state.navigation.startVolume ? state.navigation.startVolume->associatedLayer( - state.context, stepper.position(state.stepping)) + state.geoContext, stepper.position(state.stepping)) : nullptr; // Set the start volume as current volume state.navigation.currentVolume = state.navigation.startVolume; @@ -646,7 +646,7 @@ private: }); // Now intersect (should exclude punch-through) auto surfaceIntersect = surface->surfaceIntersectionEstimate( - state.context, + state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), navOpts, @@ -748,7 +748,7 @@ private: // Otherwise try to step towards it NavigationOptions<Surface> navOpts(state.stepping.navDir, true); auto layerIntersect = layerSurface->surfaceIntersectionEstimate( - state.context, + state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), navOpts, @@ -861,7 +861,7 @@ private: // Evaluate the boundary surfaces state.navigation.navBoundaries = state.navigation.currentVolume->compatibleBoundaries( - state.context, + state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), navOpts, @@ -888,7 +888,7 @@ private: auto boundarySurface = state.navigation.navBoundaryIter->representation; // Step towards the boundary surface auto boundaryIntersect = boundarySurface->surfaceIntersectionEstimate( - state.context, + state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), navOpts, @@ -987,7 +987,7 @@ private: // take the target intersection auto targetIntersection = state.navigation.targetSurface->surfaceIntersectionEstimate( - state.context, + state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), navOpts, @@ -1003,9 +1003,9 @@ private: /// get the target volume from the intersection auto tPosition = targetIntersection.intersection.position; state.navigation.targetVolume - = trackingGeometry->trackingVolume(state.context, tPosition); + = trackingGeometry->trackingVolume(state.geoContext, tPosition); state.navigation.targetLayer = state.navigation.targetVolume - ? state.navigation.targetVolume->associatedLayer(state.context, + ? state.navigation.targetVolume->associatedLayer(state.geoContext, tPosition) : nullptr; if (state.navigation.targetVolume) { @@ -1058,7 +1058,7 @@ private: navOpts.pathLimit = state.stepping.stepSize.value(Cstep::aborter); // get the surfaces state.navigation.navSurfaces - = navLayer->compatibleSurfaces(state.context, + = navLayer->compatibleSurfaces(state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), navOpts, @@ -1138,7 +1138,7 @@ private: // Request the compatible layers state.navigation.navLayers = state.navigation.currentVolume->compatibleLayers( - state.context, + state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), navOpts, diff --git a/Core/include/Acts/Fitter/GainMatrixSmoother.hpp b/Core/include/Acts/Fitter/GainMatrixSmoother.hpp index 4d15c88a7e7d43f59bb38da7c4c7139689a4c110..bf255ea99c1c97fe09642e9ba25cd3bffc265311 100644 --- a/Core/include/Acts/Fitter/GainMatrixSmoother.hpp +++ b/Core/include/Acts/Fitter/GainMatrixSmoother.hpp @@ -30,7 +30,7 @@ public: template <typename track_states_t> boost::optional<parameters_t> - operator()(Context ctx, track_states_t& filteredStates) const + operator()(const GeometryContext& gctx, track_states_t& filteredStates) const { using namespace boost::adaptors; @@ -85,7 +85,7 @@ public: // Create smoothed track parameters ts.parameter.smoothed - = parameters_t(ctx, + = parameters_t(gctx, std::make_unique<CovMatrix_t>(std::move(smoothedCov)), smoothedPars, ts.referenceSurface().getSharedPtr()); diff --git a/Core/include/Acts/Fitter/GainMatrixUpdator.hpp b/Core/include/Acts/Fitter/GainMatrixUpdator.hpp index 9389c538d16ea8dfaf87b28c6d4d89cb7b3ffbf3..3f75fc4ffb3f4afad441d64665e7c49b983a2e03 100644 --- a/Core/include/Acts/Fitter/GainMatrixUpdator.hpp +++ b/Core/include/Acts/Fitter/GainMatrixUpdator.hpp @@ -45,7 +45,7 @@ public: /// /// @tparam track_state_t Type of the track state for the update /// - /// @param ctx the context of this call, e.g. alignment + /// @param gctx The current geometry context object, e.g. alignment /// @param trackState the measured track state /// /// @return Bool indicating whether this update was 'successful' @@ -53,7 +53,7 @@ public: /// which need to be treated differently in calling code. template <typename track_state_t> bool - operator()(Context ctx, track_state_t& trackState) const + operator()(const GeometryContext& gctx, track_state_t& trackState) const { using CovMatrix_t = typename parameters_t::CovMatrix_t; using ParVector_t = typename parameters_t::ParVector_t; @@ -117,7 +117,7 @@ public: // Create new filtered parameters and covariance parameters_t filtered( - ctx, + gctx, std::make_unique<const CovMatrix_t>(std::move(filtered_covariance)), filtered_parameters, predicted.referenceSurface().getSharedPtr()); diff --git a/Core/include/Acts/Fitter/KalmanFitter.hpp b/Core/include/Acts/Fitter/KalmanFitter.hpp index 2b847f137f78578b90056f90929873f78065bd52..12d8fe8a7bf48dfe160e8a1e52f1eab46786cfd8 100644 --- a/Core/include/Acts/Fitter/KalmanFitter.hpp +++ b/Core/include/Acts/Fitter/KalmanFitter.hpp @@ -19,8 +19,8 @@ #include "Acts/Propagator/Propagator.hpp" #include "Acts/Propagator/detail/ConstrainedStep.hpp" #include "Acts/Propagator/detail/StandardAborters.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -101,10 +101,10 @@ public: typename parameters_t, typename surface_t> auto - fit(Context ctx, - input_measurements_t measurements, - const parameters_t& sParameters, - const surface_t* rSurface = nullptr) const + fit(const GeometryContext& gctx, + input_measurements_t measurements, + const parameters_t& sParameters, + const surface_t* rSurface = nullptr) const { // Bring the measurements into Acts style auto trackStates = m_inputConverter(measurements); @@ -116,7 +116,7 @@ public: using Aborters = AbortList<>; // Create relevant options for the propagation options - PropagatorOptions<Actors, Aborters> kalmanOptions; + PropagatorOptions<Actors, Aborters> kalmanOptions(gctx); // Catch the actor and set the measurements auto& kalmanActor = kalmanOptions.actionList.template get<KalmanActor>(); kalmanActor.trackStates = std::move(trackStates); @@ -124,7 +124,7 @@ public: // Run the fitter const auto& result - = m_propagator.template propagate(ctx, sParameters, kalmanOptions); + = m_propagator.template propagate(sParameters, kalmanOptions); /// Get the result of the fit auto kalmanResult = result.template get<KalmanResult>(); @@ -254,7 +254,7 @@ private: if (result.smoothed and targetReached(state, stepper, *targetSurface)) { // Transport & bind the parameter to the final surface auto fittedState = stepper.boundState( - state.context, state.stepping, *targetSurface, true); + state.geoContext, state.stepping, *targetSurface, true); // Assign the fitted parameters result.fittedParameters = std::get<BoundParameters>(fittedState); // Break the navigation for stopping the Propagation @@ -299,7 +299,7 @@ private: if (layer == nullptr) { // Find the intersection to allocate the layer auto surfaceIntersection - = surface.intersectionEstimate(state.context, + = surface.intersectionEstimate(state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), state.stepping.navDir, @@ -308,9 +308,9 @@ private: if (surfaceIntersection and state.navigation.worldVolume) { auto intersection = surfaceIntersection.position; auto layerVolume = state.navigation.worldVolume->trackingVolume( - state.context, intersection); + state.geoContext, intersection); layer = layerVolume - ? layerVolume->associatedLayer(state.context, intersection) + ? layerVolume->associatedLayer(state.geoContext, intersection) : nullptr; } } @@ -370,15 +370,15 @@ private: std::tuple<BoundParameters, typename TrackState::Parameters::CovMatrix_t, double> - boundState - = stepper.boundState(state.context, state.stepping, *surface, true); + boundState = stepper.boundState( + state.geoContext, state.stepping, *surface, true); trackState.parameter.predicted = std::get<0>(boundState); trackState.parameter.jacobian = std::get<1>(boundState); trackState.parameter.pathLength = std::get<2>(boundState); // If the update is successful, set covariance and - if (m_updator(state.context, trackState)) { + if (m_updator(state.geoContext, trackState)) { // Update the stepping state debugLog(state, [&] { std::stringstream dstream; @@ -428,7 +428,8 @@ private: return dstream.str(); }); // Smooth the track states and obtain the last smoothed track parameters - const auto& smoothedPars = m_smoother(state.context, result.fittedStates); + const auto& smoothedPars + = m_smoother(state.geoContext, result.fittedStates); // Update the stepping parameters - in order to progress to destination if (smoothedPars) { // Update the stepping state diff --git a/Core/include/Acts/Layers/ApproachDescriptor.hpp b/Core/include/Acts/Layers/ApproachDescriptor.hpp index 7a80e4296b9a3b5547c99d52b8075c4da1cc4a1d..d9e7aaabd5f43f60a39e69fed867f0e528d90d78 100644 --- a/Core/include/Acts/Layers/ApproachDescriptor.hpp +++ b/Core/include/Acts/Layers/ApproachDescriptor.hpp @@ -13,8 +13,8 @@ #pragma once #include <vector> -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Intersection.hpp" namespace Acts { @@ -55,7 +55,7 @@ public: /// @tparam options_t Type of the Navigation options for the search /// @tparam corrector_t Type of the Corrector for the approach search /// - /// @param ctx the context object for the approach request + /// @param gctx The current geometry context object, e.g. alignment /// @param parameters The actual parameters object /// @param options are the steering options for the search /// @param corrfnc The actual Corrector object @@ -63,14 +63,14 @@ public: typename options_t, typename corrector_t = VoidIntersectionCorrector> ObjectIntersection<Surface> - approachSurface(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc = corrector_t()) const; + approachSurface(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc = corrector_t()) const; /// @brief Get the surface on approach /// - /// @param ctx the context object for the approach request + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the position from start of the search /// @param gdir is the direction at the start of the search /// @param bcheck is the boundary check directive @@ -78,12 +78,12 @@ public: /// /// @return is a surface intersection virtual ObjectIntersection<Surface> - approachSurface(Context ctx, - const Vector3D& pos, - const Vector3D& gdir, - NavigationDirection navDir, - const BoundaryCheck& bcheck, - CorrFnc correct = nullptr) const = 0; + approachSurface(const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, + CorrFnc correct = nullptr) const = 0; /// Tet to all the contained surfaces /// @return all contained surfaces of this approach descriptor @@ -98,13 +98,13 @@ public: template <typename parameters_t, typename options_t, typename corrector_t> ObjectIntersection<Surface> -ApproachDescriptor::approachSurface(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc) const +ApproachDescriptor::approachSurface(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc) const { // calculate the actual intersection - return approachSurface(ctx, + return approachSurface(gctx, parameters.position(), parameters.direction(), options.navDir, diff --git a/Core/include/Acts/Layers/CylinderLayer.hpp b/Core/include/Acts/Layers/CylinderLayer.hpp index 62c30d1ee6f10460d048b112c9d050523c7b6001..86a5cf9ecc8288a2a22220591290cdfd62765025 100644 --- a/Core/include/Acts/Layers/CylinderLayer.hpp +++ b/Core/include/Acts/Layers/CylinderLayer.hpp @@ -14,8 +14,8 @@ #include <algorithm> #include "Acts/Layers/Layer.hpp" #include "Acts/Surfaces/CylinderSurface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/ThrowAssert.hpp" #include "Acts/Volumes/CylinderVolumeBounds.hpp" diff --git a/Core/include/Acts/Layers/DiscLayer.hpp b/Core/include/Acts/Layers/DiscLayer.hpp index 708226603050ef03b9d62ffed601e4b953558c38..01980bc5070babd0fc4240dc1456576ab8a12181 100644 --- a/Core/include/Acts/Layers/DiscLayer.hpp +++ b/Core/include/Acts/Layers/DiscLayer.hpp @@ -15,8 +15,8 @@ #include <algorithm> #include "Acts/Layers/Layer.hpp" #include "Acts/Surfaces/DiscSurface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { diff --git a/Core/include/Acts/Layers/GenericApproachDescriptor.hpp b/Core/include/Acts/Layers/GenericApproachDescriptor.hpp index f53527a7fe667af764c57baf013b885470820c26..4e8bb3dd56a9c9e24b35b1a1d83e7db82ef95992 100644 --- a/Core/include/Acts/Layers/GenericApproachDescriptor.hpp +++ b/Core/include/Acts/Layers/GenericApproachDescriptor.hpp @@ -14,7 +14,7 @@ #include <algorithm> #include "Acts/Layers/ApproachDescriptor.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Volumes/BoundarySurfaceT.hpp" @@ -54,7 +54,7 @@ public: /// get the compatible surfaces /// - /// @param ctx the context object for the approach request + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global position to start the approach from /// @param gdir is the momentum vector /// @param bcheck is the boundary check prescription @@ -62,12 +62,12 @@ public: /// /// @return : a boolean indicating if an actual intersection had been tried ObjectIntersection<Surface> - approachSurface(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir, - const BoundaryCheck& bcheck, - CorrFnc corrfnc = nullptr) const override; + approachSurface(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, + CorrFnc corrfnc = nullptr) const override; /// return all contained surfaces of this approach descriptor const std::vector<const Surface*>& diff --git a/Core/include/Acts/Layers/Layer.hpp b/Core/include/Acts/Layers/Layer.hpp index 8f67b8f99ab95f049c9551624d5cc221f135b1f9..4933fc8458a1c62397fbdb31c7a84587a9bd9563 100644 --- a/Core/include/Acts/Layers/Layer.hpp +++ b/Core/include/Acts/Layers/Layer.hpp @@ -19,8 +19,8 @@ #include "Acts/Layers/ApproachDescriptor.hpp" #include "Acts/Surfaces/SurfaceArray.hpp" #include "Acts/Utilities/BinnedArray.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometryObject.hpp" #include "Acts/Utilities/GeometryStatics.hpp" #include "Acts/Utilities/Intersection.hpp" @@ -128,30 +128,30 @@ public: /// templated onLayer() method /// - /// @param ctx the context (e.g. alignment) under which this is asked + /// @param gctx The current geometry context object, e.g. alignment /// @param pars are the templated (charged/neutral) on layer check /// @param bcheck is the boundary check directive /// /// @return boolean that indicates success of the operation template <typename parameters_t> bool - onLayer(Context ctx, - const parameters_t& pars, - const BoundaryCheck& bcheck = true) const; + onLayer(const GeometryContext& gctx, + const parameters_t& pars, + const BoundaryCheck& bcheck = true) const; /// geometrical isOnLayer() method /// /// @note using isOnSurface() with Layer specific tolerance /// - /// @param ctx the context (e.g. alignment) under which this is asked + /// @param gctx The current geometry context object, e.g. alignment /// @param gp is the gobal position to be checked /// @param bcheck is the boundary check directive /// /// @return boolean that indicates success of the operation virtual bool - isOnLayer(Context ctx, - const Vector3D& gp, - const BoundaryCheck& bcheck = true) const; + isOnLayer(const GeometryContext& gctx, + const Vector3D& gp, + const BoundaryCheck& bcheck = true) const; /// Return method for the approach descriptor, can be nullptr const ApproachDescriptor* @@ -192,7 +192,7 @@ public: /// @tparam options_t The navigation options type /// @tparam corrector_t is an (optional) intersection corrector type /// - /// @param ctx the context (e.g. alignment) for this call + /// @param gctx The current geometry context object, e.g. alignment /// @param position Position parameter for searching /// @param momentum Momentum parameter for searching /// @param options The templated naivation options @@ -202,11 +202,11 @@ public: template <typename options_t, typename corrector_t = VoidIntersectionCorrector> std::vector<SurfaceIntersection> - compatibleSurfaces(Context ctx, - const Vector3D& position, - const Vector3D& momentum, - const options_t& options, - const corrector_t& corrfnc = corrector_t()) const; + compatibleSurfaces(const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& momentum, + const options_t& options, + const corrector_t& corrfnc = corrector_t()) const; /// @brief Decompose Layer into (compatible) surfaces /// @@ -214,7 +214,7 @@ public: /// @tparam options_t The navigation options type /// @tparam corrector_t is an (optional) intersection corrector type /// - /// @param ctx the context (e.g. alignment) for this call + /// @param gctx The current geometry context object, e.g. alignment /// @param parameters The templated parameters for searching /// @param options The templated navigation options /// @tparam corrector_t is an (optional) intersection corrector @@ -224,10 +224,10 @@ public: typename options_t, typename corrector_t = VoidIntersectionCorrector> std::vector<SurfaceIntersection> - compatibleSurfaces(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc = corrector_t()) const; + compatibleSurfaces(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc = corrector_t()) const; /// Surface seen on approach /// @@ -238,7 +238,7 @@ public: /// for layers without sub structure, this is the surfaceRepresentation /// for layers with sub structure, this is the approachSurface /// - /// @param ctx the context (e.g. alignment) for this call + /// @param gctx The current geometry context object, e.g. alignment /// @param parameters The templated parameters for searching /// @param options The templated naivation options /// @tparam corrector_t is an (optional) intersection corrector @@ -248,10 +248,10 @@ public: typename options_t, typename corrector_t = VoidIntersectionCorrector> const SurfaceIntersection - surfaceOnApproach(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc = corrector_t()) const; + surfaceOnApproach(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc = corrector_t()) const; /// Surface seen on approach /// @@ -261,7 +261,7 @@ public: /// for layers without sub structure, this is the surfaceRepresentation /// for layers with sub structure, this is the approachSurface /// - /// @param ctx the context (e.g. alignment) for this call + /// @param gctx The current geometry context object, e.g. alignment /// @param position Position for searching /// @param direction Direction for searching /// @param options The templated naivation options @@ -271,21 +271,23 @@ public: template <typename options_t, typename corrector_t = VoidIntersectionCorrector> const SurfaceIntersection - surfaceOnApproach(Context ctx, - const Vector3D& position, - const Vector3D& direction, - const options_t& options, - const corrector_t& corrfnc = corrector_t()) const; + surfaceOnApproach(const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc = corrector_t()) const; /// Fast navigation to next layer /// - /// @param ctx the context (e.g. alignment) for this call + /// @param gctx The current geometry context object, e.g. alignment /// @param gp is the start position for the search /// @param mom is the direction for the search /// /// @return the pointer to the next layer const Layer* - nextLayer(Context ctx, const Vector3D& gp, const Vector3D& mom) const; + nextLayer(const GeometryContext& gctx, + const Vector3D& gp, + const Vector3D& mom) const; /// get the confining TrackingVolume /// diff --git a/Core/include/Acts/Layers/NavigationLayer.hpp b/Core/include/Acts/Layers/NavigationLayer.hpp index c788ea58cbc9ae636c280ff88a7bb1b3564bbc9c..a92956ccb117d463a134a2e04d9030e5568f8a00 100644 --- a/Core/include/Acts/Layers/NavigationLayer.hpp +++ b/Core/include/Acts/Layers/NavigationLayer.hpp @@ -14,8 +14,8 @@ #include "Acts/Layers/Layer.hpp" #include "Acts/Utilities/BinnedArray.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometryStatics.hpp" namespace Acts { @@ -48,13 +48,13 @@ public: /// The binning position method /// - /// @param ctx is the context (e.g. alignment) for this request + /// @param gctx The current geometry context object, e.g. alignment /// @param bValue is the value for which the binning position is requested /// - as default the center is given, but may be overloaded /// /// @return The return vector can be used for binning in a TrackingVolume const Vector3D - binningPosition(Context ctx, BinningValue bValue) const final; + binningPosition(const GeometryContext& gctx, BinningValue bValue) const final; /// Default Constructor - deleted NavigationLayer() = delete; @@ -79,15 +79,15 @@ public: /// Geometric isOnLayer() method /// using isOnSurface() with Layer specific tolerance /// - /// @param ctx is the context (e.g. alignment) for this request + /// @param gctx The current geometry context object, e.g. alignment /// @param gp is the global position for the check /// @param bcheck is the boundary check directive /// /// @return boolean that indicates if the position is on surface bool - isOnLayer(Context ctx, - const Vector3D& gp, - const BoundaryCheck& bcheck = true) const final; + isOnLayer(const GeometryContext& gctx, + const Vector3D& gp, + const BoundaryCheck& bcheck = true) const final; /// Accept layer according to the following colelction directives /// @@ -134,17 +134,18 @@ NavigationLayer::surfaceRepresentation() } inline const Vector3D -NavigationLayer::binningPosition(Context ctx, BinningValue bValue) const +NavigationLayer::binningPosition(const GeometryContext& gctx, + BinningValue bValue) const { - return m_surfaceRepresentation->binningPosition(ctx, bValue); + return m_surfaceRepresentation->binningPosition(gctx, bValue); } inline bool -NavigationLayer::isOnLayer(Context ctx, - const Vector3D& gp, - const BoundaryCheck& bcheck) const +NavigationLayer::isOnLayer(const GeometryContext& gctx, + const Vector3D& gp, + const BoundaryCheck& bcheck) const { - return m_surfaceRepresentation->isOnSurface(ctx, gp, s_origin, bcheck); + return m_surfaceRepresentation->isOnSurface(gctx, gp, s_origin, bcheck); } inline bool diff --git a/Core/include/Acts/Layers/ProtoLayer.hpp b/Core/include/Acts/Layers/ProtoLayer.hpp index e7444e6d332ed50b0cbcd4dd60be0714fa873307..c3a38e025f4bab5b9ccbec80a397f3e4faad0f9e 100644 --- a/Core/include/Acts/Layers/ProtoLayer.hpp +++ b/Core/include/Acts/Layers/ProtoLayer.hpp @@ -10,8 +10,8 @@ #include <iostream> #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -51,9 +51,10 @@ public: /// min/max values in one go. Also takes into account the thickness /// of an associated DetectorElement, if it exists. /// - /// @param ctx the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param surfaces The vector of surfaces to consider - ProtoLayer(Context ctx, const std::vector<const Surface*>& surfaces); + ProtoLayer(const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces); /// Constructor /// @@ -61,9 +62,9 @@ public: /// min/max values in one go. Also takes into account the thickness /// of an associated DetectorElement, if it exists. /// - /// @param ctx the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param surfaces The vector of surfaces to consider - ProtoLayer(Context ctx, + ProtoLayer(const GeometryContext& gctx, const std::vector<std::shared_ptr<const Surface>>& surfaces); // normal empty constructor @@ -84,9 +85,10 @@ public: private: /// Helper method which performs the actual min/max calculation /// - /// @param ctx the context for this request (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param surfaces The surfaces to build this protolayer out of void - measure(Context ctx, const std::vector<const Surface*>& surfaces); + measure(const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces); }; } // namespace Acts \ No newline at end of file diff --git a/Core/include/Acts/Layers/detail/Layer.ipp b/Core/include/Acts/Layers/detail/Layer.ipp index 9f98e6bd23967f09463211a68d053fd69f38e8fb..caa2f497824d2014dcb2d3faba66552559f60037 100644 --- a/Core/include/Acts/Layers/detail/Layer.ipp +++ b/Core/include/Acts/Layers/detail/Layer.ipp @@ -53,7 +53,9 @@ Layer::representingVolume() const } inline const Layer* -Layer::nextLayer(Context /*ctx*/, const Vector3D& gp, const Vector3D& mom) const +Layer::nextLayer(const GeometryContext& /*gctx*/, + const Vector3D& gp, + const Vector3D& mom) const { // no binutility -> no chance to find out the direction if (m_nextLayerUtility == nullptr) { @@ -84,20 +86,20 @@ Layer::resolve(bool resolveSensitive, template <typename parameters_t> bool -Layer::onLayer(Context ctx, - const parameters_t& pars, - const BoundaryCheck& bcheck) const +Layer::onLayer(const GeometryContext& gctx, + const parameters_t& pars, + const BoundaryCheck& bcheck) const { - return isOnLayer(ctx, pars.position(), bcheck); + return isOnLayer(gctx, pars.position(), bcheck); } template <typename options_t, typename corrector_t> std::vector<SurfaceIntersection> -Layer::compatibleSurfaces(Context ctx, - const Vector3D& position, - const Vector3D& momentum, - const options_t& options, - const corrector_t& corrfnc) const +Layer::compatibleSurfaces(const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& momentum, + const options_t& options, + const corrector_t& corrfnc) const { // the list of valid intersection std::vector<SurfaceIntersection> sIntersections; @@ -121,7 +123,7 @@ Layer::compatibleSurfaces(Context ctx, // - it is the final one don't use the bounday check at all SurfaceIntersection endInter = options.endObject->template surfaceIntersectionEstimate( - ctx, position, momentum, options, corrfnc); + gctx, position, momentum, options, corrfnc); // non-valid intersection with the end surface provided at this layer // indicates wrong direction or faulty setup // -> do not return compatible surfaces since they may lead you on a wrong @@ -138,7 +140,7 @@ Layer::compatibleSurfaces(Context ctx, // path correction, we take a safety factor of 1.5 // -> this avoids punch through for cylinders double pCorrection - = surfaceRepresentation().pathCorrection(ctx, position, momentum); + = surfaceRepresentation().pathCorrection(gctx, position, momentum); maxPath = 1.5 * thickness() * pCorrection * options.navDir; } @@ -174,7 +176,7 @@ Layer::compatibleSurfaces(Context ctx, } // the surface intersection SurfaceIntersection sfi = sf.surfaceIntersectionEstimate( - ctx, position, momentum, options, corrfnc); + gctx, position, momentum, options, corrfnc); // check if intersection is valid and pathLimit has not been exceeded double sifPath = sfi.intersection.pathLength; // check the maximum path length @@ -237,22 +239,22 @@ Layer::compatibleSurfaces(Context ctx, template <typename parameters_t, typename options_t, typename corrector_t> std::vector<SurfaceIntersection> -Layer::compatibleSurfaces(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc) const +Layer::compatibleSurfaces(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc) const { return compatibleSurfaces( - ctx, parameters.position(), parameters.momentum(), options, corrfnc); + gctx, parameters.position(), parameters.momentum(), options, corrfnc); } template <typename options_t, typename corrector_t> const SurfaceIntersection -Layer::surfaceOnApproach(Context ctx, - const Vector3D& position, - const Vector3D& direction, - const options_t& options, - const corrector_t& corrfnc) const +Layer::surfaceOnApproach(const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, + const corrector_t& corrfnc) const { // resolve directive based by options // - options.resolvePassive is on -> always @@ -278,7 +280,7 @@ Layer::surfaceOnApproach(Context ctx, // that's the collect trigger for always collecting // let's find the most suitable approach surface SurfaceIntersection aSurface - = m_approachDescriptor->approachSurface(ctx, + = m_approachDescriptor->approachSurface(gctx, position, direction, options.navDir, @@ -292,36 +294,36 @@ Layer::surfaceOnApproach(Context ctx, const Surface& rSurface = surfaceRepresentation(); // if we have no approach descriptor - we have no sensitive surfaces - if (rSurface.isOnSurface(ctx, position, direction, options.boundaryCheck)) { + if (rSurface.isOnSurface(gctx, position, direction, options.boundaryCheck)) { Intersection nIntersection(position, 0., true); return SurfaceIntersection(nIntersection, &rSurface, options.navDir); } // create the intersection with the surface representation return rSurface.surfaceIntersectionEstimate( - ctx, position, direction, options, corrfnc); + gctx, position, direction, options, corrfnc); } template <typename parameters_t, typename options_t, typename corrector_t> const SurfaceIntersection -Layer::surfaceOnApproach(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& corrfnc) const +Layer::surfaceOnApproach(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& corrfnc) const { return surfaceOnApproach( - ctx, parameters.position(), parameters.direction(), options, corrfnc); + gctx, parameters.position(), parameters.direction(), options, corrfnc); } inline bool -Layer::isOnLayer(Context ctx, - const Vector3D& gp, - const BoundaryCheck& bcheck) const +Layer::isOnLayer(const GeometryContext& gctx, + const Vector3D& gp, + const BoundaryCheck& bcheck) const { if (m_representingVolume != nullptr) { return m_representingVolume->inside(gp); } - return (surfaceRepresentation()).isOnSurface(ctx, gp, s_origin, bcheck); + return (surfaceRepresentation()).isOnSurface(gctx, gp, s_origin, bcheck); } } // namespace Acts diff --git a/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp b/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp index 22cfc331add671ed83948382a8d2728bf46834fe..01203a134e851779d11a59f2d5795d7c5acbd7cf 100644 --- a/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp +++ b/Core/include/Acts/Propagator/DenseEnvironmentExtension.hpp @@ -455,6 +455,17 @@ template <typename action_list_t = ActionList<>, struct DenseStepperPropagatorOptions : public PropagatorOptions<action_list_t, aborter_list_t> { + + /// Delete Default contructor + + /// Constructor with GeometryContext + /// + /// @param gctx The current geometry context object, e.g. alignment + DenseStepperPropagatorOptions(const GeometryContext& gctx) + : PropagatorOptions<action_list_t, aborter_list_t>(gctx) + { + } + /// Toggle between mean and mode evaluation of energy loss bool meanEnergyLoss = true; @@ -474,7 +485,7 @@ struct DenseStepperPropagatorOptions extend(extended_aborter_list_t aborters) const { DenseStepperPropagatorOptions<action_list_t, extended_aborter_list_t> - eoptions; + eoptions(eoptions.geoContext); // Copy the options over eoptions.direction = this->direction; eoptions.absPdgCode = this->absPdgCode; diff --git a/Core/include/Acts/Propagator/EigenStepper.hpp b/Core/include/Acts/Propagator/EigenStepper.hpp index b6b9f1e2abbbc099fdcd6a8a3398516fe205b2ac..076cad3acecf6bd2a514bc330fb7d440d152bb78 100644 --- a/Core/include/Acts/Propagator/EigenStepper.hpp +++ b/Core/include/Acts/Propagator/EigenStepper.hpp @@ -73,16 +73,16 @@ public: /// Constructor from the initial track parameters /// - /// @param [in] ctx is the context object, ingored + /// @param [in] gctx is the context object, ingored /// @param[in] par The track parameters at start /// @param[in] ndir The navigation direciton w.r.t momentum /// @param[in] ssize is the maximum step size /// /// @note the covariance matrix is copied when needed template <typename parameters_t> - explicit State(Context ctx, - const parameters_t& par, - NavigationDirection ndir = forward, + explicit State(const GeometryContext& gctx, + const parameters_t& par, + NavigationDirection ndir = forward, double ssize = std::numeric_limits<double>::max()) : pos(par.position()) , dir(par.momentum().normalized()) @@ -102,7 +102,7 @@ public: covTransport = true; cov = ActsSymMatrixD<5>(*par.covariance()); surface.initJacobianToGlobal( - ctx, jacToGlobal, pos, dir, par.parameters()); + gctx, jacToGlobal, pos, dir, par.parameters()); } } @@ -246,7 +246,7 @@ public: /// if the transported state is at the surface, this needs to /// be guaranteed by the propagator /// - /// @param [in] ctx the context of this call + /// @param [in] gctx the context of this call /// @param [in] state State that will be presented as @c BoundState /// @param [in] surface The surface to which we bind the state /// @param [in] reinitialize Boolean flag whether reinitialization is needed, @@ -257,19 +257,19 @@ public: /// - the stepwise jacobian towards it (from last bound) /// - and the path length (from start - for ordering) BoundState - boundState(Context ctx, - State& state, - const Surface& surface, - bool reinitialize = true) const + boundState(const GeometryContext& gctx, + State& state, + const Surface& surface, + bool reinitialize = true) const { // Transport the covariance to here std::unique_ptr<const Covariance> covPtr = nullptr; if (state.covTransport) { - covarianceTransport(ctx, state, surface, reinitialize); + covarianceTransport(gctx, state, surface, reinitialize); covPtr = std::make_unique<const Covariance>(state.cov); } // Create the bound parameters - BoundParameters parameters(ctx, + BoundParameters parameters(gctx, std::move(covPtr), state.pos, state.p * state.dir, @@ -449,14 +449,14 @@ public: /// /// @tparam surface_t the Surface type /// - /// @param [in] ctx the context of this call + /// @param [in] gctx the context of this call /// @param [in,out] state State of the stepper /// @param [in] surface is the surface to which the covariance is forwarded to /// @param [in] reinitialize is a flag to steer whether the state should be /// reinitialized at the new position /// @note no check is done if the position is actually on the surface void - covarianceTransport(Context ctx, + covarianceTransport(const GeometryContext& gctx, State& state, const Surface& surface, bool reinitialize = true) const @@ -467,12 +467,12 @@ public: ActsMatrixD<5, 7> jacToLocal = ActsMatrixD<5, 7>::Zero(); // initalize the jacobian to local, returns the transposed ref frame auto rframeT - = surface.initJacobianToLocal(ctx, jacToLocal, state.pos, state.dir); + = surface.initJacobianToLocal(gctx, jacToLocal, state.pos, state.dir); // Update the jacobian with the transport from the steps state.jacToGlobal = state.jacTransport * state.jacToGlobal; // calculate the form factors for the derivatives const ActsRowVectorD<5> sVec = surface.derivativeFactors( - ctx, state.pos, state.dir, rframeT, state.jacToGlobal); + gctx, state.pos, state.dir, rframeT, state.jacToGlobal); // the full jacobian is ([to local] jacobian) * ([transport] jacobian) const ActsMatrixD<5, 5> jacFull = jacToLocal * (state.jacToGlobal - state.derivative * sVec); @@ -488,12 +488,12 @@ public: state.derivative = ActsVectorD<7>::Zero(); // fill the jacobian to global for next transport Vector2D loc{0., 0.}; - surface.globalToLocal(ctx, state.pos, state.dir, loc); + surface.globalToLocal(gctx, state.pos, state.dir, loc); ActsVectorD<5> pars; pars << loc[eLOC_0], loc[eLOC_1], phi(state.dir), theta(state.dir), state.q / state.p; surface.initJacobianToGlobal( - ctx, state.jacToGlobal, state.pos, state.dir, pars); + gctx, state.jacToGlobal, state.pos, state.dir, pars); } // Store The global and bound jacobian (duplication for the moment) state.jacobian = jacFull * state.jacobian; diff --git a/Core/include/Acts/Propagator/Propagator.hpp b/Core/include/Acts/Propagator/Propagator.hpp index 8df12f1429f5230d992a87ed7a4e1b670413081c..def36dffadcede0c1a7efd54fdd4a7c319e5daad 100644 --- a/Core/include/Acts/Propagator/Propagator.hpp +++ b/Core/include/Acts/Propagator/Propagator.hpp @@ -22,8 +22,8 @@ #include "Acts/Propagator/detail/LoopProtection.hpp" #include "Acts/Propagator/detail/StandardAborters.hpp" #include "Acts/Propagator/detail/VoidPropagatorComponents.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Units.hpp" BOOST_TTI_HAS_TYPE(state_type) @@ -115,6 +115,12 @@ template <typename action_list_t = ActionList<>, struct PropagatorOptions { + /// Delete default contructor + PropagatorOptions() = delete; + + /// PropagatorOptions with context + PropagatorOptions(const GeometryContext& gctx) : geoContext(gctx) {} + /// @brief Expand the Options with extended aborters /// /// @tparam extended_aborter_list_t Type of the new aborter list @@ -124,7 +130,8 @@ struct PropagatorOptions PropagatorOptions<action_list_t, extended_aborter_list_t> extend(extended_aborter_list_t aborters) const { - PropagatorOptions<action_list_t, extended_aborter_list_t> eoptions; + PropagatorOptions<action_list_t, extended_aborter_list_t> eoptions( + geoContext); // Copy the options over eoptions.direction = direction; eoptions.absPdgCode = absPdgCode; @@ -141,7 +148,7 @@ struct PropagatorOptions eoptions.debugPfxWidth = debugPfxWidth; eoptions.debugMsgWidth = debugMsgWidth; // Action / abort list - eoptions.actionList = actionList; + eoptions.actionList = std::move(actionList); eoptions.abortList = std::move(aborters); // And return the options return eoptions; @@ -184,6 +191,7 @@ struct PropagatorOptions // Configurations for Stepper /// Tolerance for the error of the integration double tolerance = 1e-4; + /// Cut-off value for the step size double stepSizeCutOff = 0.; @@ -192,6 +200,9 @@ struct PropagatorOptions /// List of abort conditions aborter_list_t abortList; + + /// The context object for the geometry + const GeometryContext& geoContext; }; /// @brief Propagator for particles (optionally in a magnetic field) @@ -371,24 +382,18 @@ public: /// @tparam parameters_t the type of the start parameters /// @tparam propagator_options_t the type of the propagator options /// - /// @param ctx The context of this propagation, e.g. detector alignment /// @param start The start parameters, used to initialize stepping state /// @param topts The options handed over by the propagate call template <typename parameters_t> - State(Context ctx, - const parameters_t& start, - const propagator_options_t& topts) - : context(ctx) - , options(topts) - , stepping(ctx, start, options.direction, options.maxStepSize) + State(const parameters_t& start, const propagator_options_t& topts) + : options(topts) + , stepping(topts.geoContext, start, topts.direction, topts.maxStepSize) + , geoContext(topts.geoContext) { // Setting the start surface navigation.startSurface = &start.referenceSurface(); } - /// Context object - ContextType context; - /// These are the options - provided for each propagation step propagator_options_t options; @@ -397,6 +402,9 @@ public: /// Navigation state - internal state of the Navigator NavigatorState navigation; + + /// Context object for the geometry + const GeometryContext& geoContext; }; private: @@ -526,7 +534,6 @@ public: /// @tparam aborter_list_t Type list of abort conditions, type AbortList<> /// @tparam propagator_options_t Type of the propagator options /// - /// @param [in] ctx context of this call, e.g. alignment /// @param [in] start initial track parameters to propagate /// @param [in] options Propagation options, type Options<,> /// @@ -542,7 +549,6 @@ public: typename stepper_t::template return_parameter_type<parameters_t>, action_list_t> propagate( - Context ctx, const parameters_t& start, const propagator_options_t<action_list_t, aborter_list_t>& options) const { @@ -570,7 +576,7 @@ public: using OptionsType = decltype(eOptions); // Initialize the internal propagator state using StateType = State<OptionsType>; - StateType state(ctx, start, eOptions); + StateType state(start, eOptions); static_assert( has_member_function_step<const stepper_t, @@ -620,7 +626,6 @@ public: /// @tparam aborter_list_t Type list of abort conditions /// @tparam propagator_options_t Type of the propagator options /// - /// @param [in] ctx context of this call, e.g. alignment /// @param [in] start Initial track parameters to propagate /// @param [in] target Target surface of to propagate to /// @param [in] options Propagation options @@ -639,7 +644,6 @@ public: surface_t>, action_list_t> propagate( - Context ctx, const parameters_t& start, const surface_t& target, const propagator_options_t<action_list_t, aborter_list_t>& options) const @@ -671,7 +675,7 @@ public: // Initialize the internal propagator state using StateType = State<OptionsType>; - StateType state(ctx, start, eOptions); + StateType state(start, eOptions); state.navigation.targetSurface = ⌖ static_assert( @@ -690,7 +694,7 @@ public: result.status = PropagatorStatus::FAILURE; } else { // Compute the final results and mark the propagation as successful - auto bs = m_stepper.boundState(state.context, state.stepping, target, true); + auto bs = m_stepper.boundState(state.geoContext, state.stepping, target, true); auto& boundParameters = std::get<BoundParameters>(bs); // Fill the end parameters result.endParameters diff --git a/Core/include/Acts/Propagator/StraightLineStepper.hpp b/Core/include/Acts/Propagator/StraightLineStepper.hpp index b8d22f7ce3784f68ff64b8add0bef8cc34cc7fde..eaa207039be0796d46920ff10e37321fab77b5dd 100644 --- a/Core/include/Acts/Propagator/StraightLineStepper.hpp +++ b/Core/include/Acts/Propagator/StraightLineStepper.hpp @@ -12,8 +12,8 @@ #include "Acts/MagneticField/concept/AnyFieldLookup.hpp" #include "Acts/Propagator/detail/ConstrainedStep.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Units.hpp" @@ -54,16 +54,19 @@ public: struct State { + /// Delete the default constructor + State() = delete; + /// Constructor from the initial track parameters /// /// @tparam parameters_t the Type of the track parameters /// - /// @param [in] ctx is the context object, ingored + /// @param [in] gctx is the context object, ingored /// @param [in] par The track parameters at start /// @param [in] dir is the navigation direction /// @param [in] ssize is the (absolute) maximum step size template <typename parameters_t> - explicit State(Context /*ctx*/, + explicit State(const GeometryContext& /*gctx*/, const parameters_t& par, NavigationDirection ndir = forward, double ssize = std::numeric_limits<double>::max()) @@ -276,7 +279,7 @@ public: /// /// @tparam surface_t the surface type - ignored here /// - /// @param [in] ctx The context for thsi call - ingnored here + /// @param [in] gctx The context for thsi call - ingnored here /// @param [in,out] state The stepper state /// @param [in] surface is the surface to which the covariance is /// forwarded to @@ -287,7 +290,7 @@ public: /// /// @return the full transport jacobian static const ActsMatrixD<5, 5> - covarianceTransport(Context /*ctx*/, + covarianceTransport(const GeometryContext& /*gctx*/, State& /*unused*/, const Surface& /*surface*/, bool /*reinitialize = false*/) diff --git a/Core/include/Acts/Propagator/detail/StandardAborters.hpp b/Core/include/Acts/Propagator/detail/StandardAborters.hpp index e5b1989297c2ab6ed40307b9db04af229115600b..ce9973f32bdd9d601e29ff426558aeee5a497487 100644 --- a/Core/include/Acts/Propagator/detail/StandardAborters.hpp +++ b/Core/include/Acts/Propagator/detail/StandardAborters.hpp @@ -197,7 +197,7 @@ namespace detail { // Calculate the distance to the surface const double tolerance = state.options.targetTolerance; const auto intersection = targetSurface.intersectionEstimate( - state.context, + state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), anyDirection); diff --git a/Core/include/Acts/Surfaces/ConeSurface.hpp b/Core/include/Acts/Surfaces/ConeSurface.hpp index c1a2655029f94486ed0d85fda88c662538da8369..42f4fd7d007656f67e05f5a536eeac8e33c2fe42 100644 --- a/Core/include/Acts/Surfaces/ConeSurface.hpp +++ b/Core/include/Acts/Surfaces/ConeSurface.hpp @@ -14,8 +14,8 @@ #include "Acts/Surfaces/ConeBounds.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/ParameterDefinitions.hpp" #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" @@ -75,11 +75,12 @@ protected: /// Copy constructor - with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - ConeSurface(Context ctx, const ConeSurface& other, const Transform3D& transf); + ConeSurface(const GeometryContext& gctx, + const ConeSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -92,21 +93,19 @@ public: operator=(const ConeSurface& other); /// Clone method into a concrete type of ConeSurface with shift - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface std::shared_ptr<ConeSurface> - clone(Context ctx, const Transform3D& shift) const; + clone(const GeometryContext& gctx, const Transform3D& shift) const; /// The binning position method - is overloaded for r-type binning /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param bValue defines the type of binning applied in the global frame /// /// @return The return type is a vector for positioning in the global frame const Vector3D - binningPosition(Context ctx, BinningValue bValue) const final; + binningPosition(const GeometryContext& gctx, BinningValue bValue) const final; /// Return the surface type SurfaceType @@ -116,48 +115,45 @@ public: /// for StraightLine and Perigee Surface /// - the default implementation is the the RotationMatrix3D of the transform /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param pos is the global position where the measurement frame is /// constructed /// @param mom is the momentum used for the measurement frame construction /// @return matrix that indicates the measurement frame const RotationMatrix3D - referenceFrame(Context ctx, - const Vector3D& pos, - const Vector3D& mom) const final; + referenceFrame(const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const final; /// Return method for surface normal information /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lp is the local position on the cone for which the normal vector /// is requested /// @return Vector3D normal vector in global frame const Vector3D - normal(Context ctx, const Vector2D& lp) const final; + normal(const GeometryContext& gctx, const Vector2D& lp) const final; /// Return method for surface normal information /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global position on the cone for which the normal vector /// is requested /// @return Vector3D normal vector in global frame const Vector3D - normal(Context ctx, const Vector3D& gpos) const final; + normal(const GeometryContext& gctx, const Vector3D& gpos) const final; /// Normal vector return without argument using Surface::normal; // Return method for the rotational symmetry axis /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + /// // @return This returns the local z axis virtual const Vector3D - rotSymmetryAxis(Context ctx) const; + rotSymmetryAxis(const GeometryContext& gctx) const; /// This method returns the ConeBounds by reference const ConeBounds& @@ -165,36 +161,33 @@ public: /// Local to global transformation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos is the local position to be transformed /// @param mom is the global momentum (ignored in this operation) /// @param gpos is the global position shich is filled void - localToGlobal(Context ctx, - const Vector2D& lpos, - const Vector3D& mom, - Vector3D& gpos) const final; + localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const final; /// Global to local transfomration /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global position to be transformed /// @param mom is the global momentum (ignored in this operation) /// @param lpos is hte local position to be filled /// @return is a boolean indicating if the transformation succeeded bool - globalToLocal(Context ctx, - const Vector3D& gpos, - const Vector3D& mom, - Vector2D& lpos) const final; + globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const final; /// @brief Straight line intersection schema - provides closest intersection /// and (signed) path length /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos The start position for the intersection /// @param gmom The start momentum for the intersection (will be normalized) /// @param navDir The navigation direction with respect to the momentum @@ -235,24 +228,23 @@ public: /// /// @return is the Intersection object Intersection - intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gmom, - NavigationDirection navDir, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + NavigationDirection navDir, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// the pathCorrection for derived classes with thickness /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global potion at the correction point /// @param mom is the momentum at the correction point /// @return is the path correction due to incident angle double - pathCorrection(Context ctx, - const Vector3D& gpos, - const Vector3D& mom) const final; + pathCorrection(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const final; /// Return properly formatted class name for screen output std::string @@ -264,11 +256,11 @@ protected: private: /// Clone method implementation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface ConeSurface* - clone_impl(Context ctx, const Transform3D& shift) const override; + clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const override; }; #include "Acts/Surfaces/detail/ConeSurface.ipp" diff --git a/Core/include/Acts/Surfaces/CylinderSurface.hpp b/Core/include/Acts/Surfaces/CylinderSurface.hpp index ee33bf7266e5cc38bb81864242fd06011e115adb..a0c70ab05e5124665e44a2caf4f8f47d027ebf8c 100644 --- a/Core/include/Acts/Surfaces/CylinderSurface.hpp +++ b/Core/include/Acts/Surfaces/CylinderSurface.hpp @@ -17,8 +17,8 @@ #include "Acts/Surfaces/CylinderBounds.hpp" #include "Acts/Surfaces/PolyhedronRepresentation.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometryStatics.hpp" #include "Acts/Utilities/detail/RealQuadraticEquation.hpp" @@ -88,11 +88,10 @@ protected: /// Copy constructor - with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - CylinderSurface(Context ctx, + CylinderSurface(const GeometryContext& gctx, const CylinderSurface& other, const Transform3D& transf); @@ -108,35 +107,32 @@ public: /// Clone method into a concrete type of CylinderSurface with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface std::shared_ptr<CylinderSurface> - clone(Context ctx, const Transform3D& shift) const; + clone(const GeometryContext& gctx, const Transform3D& shift) const; /// The binning position method - is overloaded for r-type binning /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param bValue is the type of global binning to be done /// /// @return is the global position to be used for binning const Vector3D - binningPosition(Context ctx, BinningValue bValue) const final; + binningPosition(const GeometryContext& gctx, BinningValue bValue) const final; /// Return the measurement frame - this is needed for alignment, in particular /// The measurement frame of a cylinder is the tangential plane at a given /// position /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the position where the measurement frame is defined /// @param mom is the momentum vector (ignored) /// @return rotation matrix that defines the measurement frame const RotationMatrix3D - referenceFrame(Context ctx, - const Vector3D& gpos, - const Vector3D& mom) const final; + referenceFrame(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const final; /// Return the surface type SurfaceType @@ -146,35 +142,33 @@ public: /// @note for a Cylinder a local position is always required for the normal /// vector /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos is the local postion for which the normal vector is requested /// @return normal vector at the local position const Vector3D - normal(Context ctx, const Vector2D& lpos) const final; + normal(const GeometryContext& gctx, const Vector2D& lpos) const final; /// Return method for surface normal information /// @note for a Cylinder a local position is always required for the normal /// vector /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global postion for which the normal vector is requested /// @return normal vector at the global position const Vector3D - normal(Context ctx, const Vector3D& gpos) const final; + normal(const GeometryContext& gctx, const Vector3D& gpos) const final; /// Normal vector return without argument using Surface::normal; /// Return method for the rotational symmetry axis /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + /// /// @return the z-Axis of transform virtual const Vector3D - rotSymmetryAxis(Context ctx) const; + rotSymmetryAxis(const GeometryContext& gctx) const; /// This method returns the CylinderBounds by reference const CylinderBounds& @@ -182,37 +176,34 @@ public: /// Local to global transformation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos is the local position to be transformed /// @param mom is the global momentum (ignored in this operation) /// @param gpos is the global position shich is filled void - localToGlobal(Context ctx, - const Vector2D& lpos, - const Vector3D& mom, - Vector3D& gpos) const final; + localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const final; /// Global to local transfomration /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global position to be transformed /// @param mom is the global momentum (ignored in this operation) /// @param lpos is hte local position to be filled /// /// @return is a boolean indicating if the transformation succeeded bool - globalToLocal(Context ctx, - const Vector3D& gpos, - const Vector3D& mom, - Vector2D& lpos) const final; + globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const final; /// Straight line intersection schema - provides closest intersection /// and (signed) path length /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global position as a starting point /// @param gdir is the global direction at the starting point, expected to /// be normalized @@ -253,25 +244,24 @@ public: /// /// @return is the intersection object Intersection - intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir = forward, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// Path correction due to incident of the track /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global position as a starting point /// @param mom is the global momentum at the starting point /// /// @return is the correction factor due to incident double - pathCorrection(Context ctx, - const Vector3D& gpos, - const Vector3D& mom) const final; + pathCorrection(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const final; /// Return method for properly formatted output string std::string @@ -279,14 +269,13 @@ public: /// Return a PolyhedronRepresentation for this object /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param l0div Number of divisions along l0 (phi) /// @param l1div Number of divisions along l1 (z) virtual PolyhedronRepresentation - polyhedronRepresentation(Context ctx, - size_t l0div = 10, - size_t l1div = 1) const; + polyhedronRepresentation(const GeometryContext& gctx, + size_t l0div = 10, + size_t l1div = 1) const; protected: std::shared_ptr<const CylinderBounds> m_bounds; //!< bounds (shared) @@ -294,11 +283,11 @@ protected: private: /// Clone method implementation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface CylinderSurface* - clone_impl(Context ctx, const Transform3D& shift) const override; + clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const override; }; #include "Acts/Surfaces/detail/CylinderSurface.ipp" diff --git a/Core/include/Acts/Surfaces/DiscSurface.hpp b/Core/include/Acts/Surfaces/DiscSurface.hpp index 40b530c74bda5afec4381b1c3b819c7985ee634e..7702899daebe83eaf5d03d1e226fb124c4fad6a1 100644 --- a/Core/include/Acts/Surfaces/DiscSurface.hpp +++ b/Core/include/Acts/Surfaces/DiscSurface.hpp @@ -16,8 +16,8 @@ #include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/PolyhedronRepresentation.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometryStatics.hpp" namespace Acts { @@ -107,11 +107,12 @@ protected: /// Copy constructor - with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - DiscSurface(Context ctx, const DiscSurface& other, const Transform3D& transf); + DiscSurface(const GeometryContext& gctx, + const DiscSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -125,11 +126,10 @@ public: /// Clone method into a concrete type of DiscSurface with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface std::shared_ptr<DiscSurface> - clone(Context ctx, const Transform3D& shift) const; + clone(const GeometryContext& gctx, const Transform3D& shift) const; /// Return the surface type SurfaceType @@ -137,13 +137,12 @@ public: /// Normal vector return /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos The local position is ignored /// /// @return a Vector3D by value const Vector3D - normal(Context ctx, const Vector2D& lpos) const final; + normal(const GeometryContext& gctx, const Vector2D& lpos) const final; /// Normal vector return without argument using Surface::normal; @@ -151,13 +150,12 @@ public: /// The binning position The position calcualted /// for a certain binning type /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param bValue The binning type to be used /// /// @return position that can beused for this binning const Vector3D - binningPosition(Context ctx, BinningValue bValue) const final; + binningPosition(const GeometryContext& gctx, BinningValue bValue) const final; /// This method returns the bounds by reference const SurfaceBounds& @@ -167,8 +165,7 @@ public: /// For planar surfaces the momentum is ignroed in the local to global /// transformation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos local 2D posittion in specialized surface frame /// @param mom global 3D momentum representation (optionally ignored) /// @param gpos global 3D position to be filled (given by reference for method @@ -176,16 +173,15 @@ public: /// /// @note the momentum is ignored for Disc surfaces in this calculateion void - localToGlobal(Context ctx, - const Vector2D& lpos, - const Vector3D& mom, - Vector3D& gpos) const final; + localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const final; /// Global to local transformation /// @note the momentum is ignored for Disc surfaces in this calculateion /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos global 3D position - considered to be on surface but not /// inside bounds (check is done) /// @param mom global 3D momentum representation (optionally ignored) @@ -195,10 +191,10 @@ public: /// @return boolean indication if operation was successful (fail means global /// position was not on surface) bool - globalToLocal(Context ctx, - const Vector3D& gpos, - const Vector3D& mom, - Vector2D& lpos) const final; + globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const final; /// Special method for DiscSurface : local<->local transformations polar <-> /// cartesian @@ -221,8 +217,7 @@ public: /// Special method for DiscSurface : local<->local transformations polar <-> /// cartesian /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param locpol is a local position in polar coordinates /// /// @return values is local 2D position in cartesian coordinates @@ -232,41 +227,39 @@ public: /// Special method for DiscSurface : local<->global transformation when /// provided cartesian coordinates /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos is local 2D position in cartesian coordinates /// /// @return value is a global cartesian 3D position const Vector3D - localCartesianToGlobal(Context ctx, const Vector2D& lpos) const; + localCartesianToGlobal(const GeometryContext& gctx, + const Vector2D& lpos) const; /// Special method for DiscSurface : global<->local from cartesian coordinates /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is a global cartesian 3D position /// @param tol The absoltue tolerance parameter /// /// @return value is a local polar const Vector2D - globalToLocalCartesian(Context ctx, - const Vector3D& gpos, - double tol = 0.) const; + globalToLocalCartesian(const GeometryContext& gctx, + const Vector3D& gpos, + double tol = 0.) const; /// Initialize the jacobian from local to global /// the surface knows best, hence the calculation is done here. /// The jacobian is assumed to be initialised, so only the /// relevant entries are filled /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param jacobian The jacobian to be initialized /// @param gpos The global position of the parameters /// @param dir The direction at of the parameters /// /// @param pars The paranmeters vector void - initJacobianToGlobal(Context ctx, + initJacobianToGlobal(const GeometryContext& gctx, ActsMatrixD<7, 5>& jacobian, const Vector3D& gpos, const Vector3D& dir, @@ -277,37 +270,34 @@ public: /// The jacobian is assumed to be initialised, so only the /// relevant entries are filled /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param jacobian The jacobian to be initialized /// @param gpos The global position of the parameters /// @param dir The direction at of the parameters /// /// @return the transposed reference frame (avoids recalculation) const RotationMatrix3D - initJacobianToLocal(Context ctx, + initJacobianToLocal(const GeometryContext& gctx, ActsMatrixD<5, 7>& jacobian, const Vector3D& gpos, const Vector3D& dir) const final; /// Path correction due to incident of the track /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos The global position as a starting point /// @param mom The global momentum at the starting point /// @return The correction factor due to incident double - pathCorrection(Context ctx, - const Vector3D& gpos, - const Vector3D& mom) const final; + pathCorrection(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const final; /// @brief Straight line intersection schema /// /// navDir=anyDirection is to provide the closest solution /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos The global position as a starting point /// @param gdir The global direction at the starting point /// @note expected to be normalized (no checking) @@ -333,26 +323,25 @@ public: /// /// @return is the surface intersection object Intersection - intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir = forward, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// Return properly formatted class name for screen output std::string name() const override; /// Return a PolyhedronRepresentation for this object - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param l0div Number of divisions along l0 (phi) /// @param l1div Number of divisions along l1 (r) virtual PolyhedronRepresentation - polyhedronRepresentation(Context ctx, - size_t l0div = 10, - size_t l1div = 1) const; + polyhedronRepresentation(const GeometryContext& gctx, + size_t l0div = 10, + size_t l1div = 1) const; protected: std::shared_ptr<const DiscBounds> m_bounds; ///< bounds (shared) @@ -360,11 +349,11 @@ protected: private: /// Clone method implementation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface DiscSurface* - clone_impl(Context ctx, const Transform3D& shift) const override; + clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const override; }; #include "Acts/Surfaces/detail/DiscSurface.ipp" diff --git a/Core/include/Acts/Surfaces/LineSurface.hpp b/Core/include/Acts/Surfaces/LineSurface.hpp index f8b75d31208ec18d14f4c40c1fa26bc2a7d7f2eb..c570eacfa30fdf30e7e45091a7cf3497937dff42 100644 --- a/Core/include/Acts/Surfaces/LineSurface.hpp +++ b/Core/include/Acts/Surfaces/LineSurface.hpp @@ -14,8 +14,8 @@ #include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/LineBounds.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometryStatics.hpp" namespace Acts { @@ -69,11 +69,12 @@ protected: /// Copy constructor - with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - LineSurface(Context ctx, const LineSurface& other, const Transform3D& transf); + LineSurface(const GeometryContext& gctx, + const LineSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -87,13 +88,12 @@ public: /// Normal vector return /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos is the local position is ignored /// /// @return a Vector3D by value const Vector3D - normal(Context ctx, const Vector2D& lpos) const final; + normal(const GeometryContext& gctx, const Vector2D& lpos) const final; /// Normal vector return without argument using Surface::normal; @@ -101,45 +101,42 @@ public: /// The binning position is the position calcualted /// for a certain binning type /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param bValue is the binning type to be used /// /// @return position that can beused for this binning const Vector3D - binningPosition(Context ctx, BinningValue bValue) const final; + binningPosition(const GeometryContext& gctx, BinningValue bValue) const final; /// Return the measurement frame - this is needed for alignment, in particular /// /// for StraightLine and Perigee Surface /// - the default implementation is the the RotationMatrix3D of the transform /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the global position where the measurement frame is /// constructed /// @param mom is the momentum used for the measurement frame construction /// /// @return is a rotation matrix that indicates the measurement frame const RotationMatrix3D - referenceFrame(Context ctx, - const Vector3D& gpos, - const Vector3D& mom) const final; + referenceFrame(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const final; /// Initialize the jacobian from local to global /// the surface knows best, hence the calculation is done here. /// The jacobian is assumed to be initialised, so only the /// relevant entries are filled /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param jacobian is the jacobian to be initialized /// @param gpos is the global position of the parameters /// @param dir is the direction at of the parameters /// /// @param pars is the paranmeters vector void - initJacobianToGlobal(Context ctx, + initJacobianToGlobal(const GeometryContext& gctx, ActsMatrixD<7, 5>& jacobian, const Vector3D& gpos, const Vector3D& dir, @@ -149,8 +146,7 @@ public: /// the calculation is identical for all surfaces where the /// reference frame does not depend on the direction /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param pos is the position of the paramters in global /// @param dir is the direction of the track /// @param rft is the transposed reference frame (avoids recalculation) @@ -158,7 +154,7 @@ public: /// /// @return a five-dim vector const ActsRowVectorD<5> - derivativeFactors(Context ctx, + derivativeFactors(const GeometryContext& gctx, const Vector3D& pos, const Vector3D& dir, const RotationMatrix3D& rft, @@ -168,17 +164,16 @@ public: /// for line surfaces the momentum is used in order to interpret the drift /// radius /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos is the local position to be transformed /// @param mom is the global momentum (used to sign the closest approach) /// /// @param gpos is the global position shich is filled void - localToGlobal(Context ctx, - const Vector2D& lpos, - const Vector3D& mom, - Vector3D& gpos) const final; + localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const final; /// Specified for LineSurface: global to local method without dynamic /// memory allocation @@ -208,8 +203,7 @@ public: /// /// \image html SignOfDriftCircleD0.gif /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos global 3D position - considered to be on surface but not /// inside bounds (check is done) /// @param mom global 3D momentum representation (optionally ignored) @@ -219,15 +213,14 @@ public: /// @return boolean indication if operation was successful (fail means global /// position was not on surface) bool - globalToLocal(Context ctx, - const Vector3D& gpos, - const Vector3D& mom, - Vector2D& lpos) const final; + globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const final; /// @brief Straight line intersection schema /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos The global position as a starting point /// @param gdir The global direction at the starting point /// @note exptected to be normalized @@ -264,12 +257,12 @@ public: /// /// @return is the intersection object Intersection - intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir = forward, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// the pathCorrection for derived classes with thickness /// is by definition 1 for LineSurfaces @@ -277,9 +270,9 @@ public: /// @note input parameters are ignored /// @note there's no material associated to the line surface double - pathCorrection(Context ctx, - const Vector3D& pos, - const Vector3D& mom) const override; + pathCorrection(const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const override; /// This method returns the bounds of the Surface by reference */ const SurfaceBounds& @@ -295,16 +288,15 @@ protected: private: /// helper function to apply the globalToLocal with out transform /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param pos is the global position /// @param mom is the momentum /// @param lpos is the local position to be filled bool - globalToLocalPlain(Context ctx, - const Vector3D& pos, - const Vector3D& mom, - Vector2D& lpos) const; + globalToLocalPlain(const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom, + Vector2D& lpos) const; }; #include "Acts/Surfaces/detail/LineSurface.ipp" diff --git a/Core/include/Acts/Surfaces/PerigeeSurface.hpp b/Core/include/Acts/Surfaces/PerigeeSurface.hpp index 14dd8b18188bb0a1141c96b37caaad2fbe492e90..442d40e62e0926e59924da3a177a336334addb13 100644 --- a/Core/include/Acts/Surfaces/PerigeeSurface.hpp +++ b/Core/include/Acts/Surfaces/PerigeeSurface.hpp @@ -49,13 +49,12 @@ protected: /// Copy constructor - with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - PerigeeSurface(Context ctx, - const PerigeeSurface& other, - const Transform3D& transf); + PerigeeSurface(const GeometryContext& gctx, + const PerigeeSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -63,11 +62,10 @@ public: /// Clone method into a concrete type of PerigeeSurface with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface std::shared_ptr<PerigeeSurface> - clone(Context ctx, const Transform3D& shift) const; + clone(const GeometryContext& gctx, const Transform3D& shift) const; /// Assignment operator /// @@ -85,22 +83,21 @@ public: /// Output Method for std::ostream /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param sl is the ostream to be dumped into /// /// @return ostreamn obect which was streamed into std::ostream& - toStream(Context ctx, std::ostream& sl) const final; + toStream(const GeometryContext& gctx, std::ostream& sl) const final; private: /// Clone method implementation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface PerigeeSurface* - clone_impl(Context ctx, const Transform3D& shift) const override; + clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const override; }; } // namespace Acts diff --git a/Core/include/Acts/Surfaces/PlaneSurface.hpp b/Core/include/Acts/Surfaces/PlaneSurface.hpp index e9e3c893d77e1dc9f71ced33eea2521f990ac5f7..8dad4a0b074cacd64c16de802af19ba33dd94c84 100644 --- a/Core/include/Acts/Surfaces/PlaneSurface.hpp +++ b/Core/include/Acts/Surfaces/PlaneSurface.hpp @@ -16,8 +16,8 @@ #include "Acts/Surfaces/InfiniteBounds.hpp" #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometryStatics.hpp" namespace Acts { @@ -48,13 +48,12 @@ protected: /// Copy constructor - with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - PlaneSurface(Context ctx, - const PlaneSurface& other, - const Transform3D& transf); + PlaneSurface(const GeometryContext& gctx, + const PlaneSurface& other, + const Transform3D& transf); /// Dedicated Constructor with normal vector /// This is for curvilinear surfaces which are by definition boundless @@ -89,21 +88,19 @@ public: /// Clone method into a concrete type of PlaneSurface with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface std::shared_ptr<PlaneSurface> - clone(Context ctx, const Transform3D& shift) const; + clone(const GeometryContext& gctx, const Transform3D& shift) const; /// Normal vector return /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos is the local position is ignored /// /// return a Vector3D by value const Vector3D - normal(Context ctx, const Vector2D& lpos) const final; + normal(const GeometryContext& gctx, const Vector2D& lpos) const final; /// Normal vector return without argument using Surface::normal; @@ -111,13 +108,12 @@ public: /// The binning position is the position calcualted /// for a certain binning type /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param bValue is the binning type to be used /// /// @return position that can beused for this binning const Vector3D - binningPosition(Context ctx, BinningValue bValue) const final; + binningPosition(const GeometryContext& gctx, BinningValue bValue) const final; /// Return the surface type SurfaceType @@ -131,24 +127,22 @@ public: /// For planar surfaces the momentum is ignroed in the local to global /// transformation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos local 2D posittion in specialized surface frame /// @param mom global 3D momentum representation (optionally ignored) /// @param gpos global 3D position to be filled (given by reference for method /// symmetry) void - localToGlobal(Context ctx, - const Vector2D& lpos, - const Vector3D& mom, - Vector3D& gpos) const override; + localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const override; /// Global to local transformation /// For planar surfaces the momentum is ignroed in the global to local /// transformation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos global 3D position - considered to be on surface but not /// inside bounds (check is done) /// @param mom global 3D momentum representation (optionally ignored) @@ -158,10 +152,10 @@ public: /// @return boolean indication if operation was successful (fail means global /// position was not on surface) bool - globalToLocal(Context ctx, - const Vector3D& gpos, - const Vector3D& mom, - Vector2D& lpos) const override; + globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const override; /// Method that calculates the correction due to incident angle /// @@ -173,14 +167,13 @@ public: /// /// @return a double representing the scaling factor double - pathCorrection(Context ctx, - const Vector3D& pos, - const Vector3D& mom) const final; + pathCorrection(const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const final; /// @brief Straight line intersection schema /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos The start position of the intersection attempt /// @param gdir The direction of the interesection attempt, /// @note expected to be normalized @@ -207,12 +200,12 @@ public: /// /// @return the Intersection object Intersection - intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir = forward, - const BoundaryCheck& bcheck = false, - CorrFnc correct = nullptr) const final; + intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, + CorrFnc correct = nullptr) const final; /// Return properly formatted class name for screen output std::string @@ -225,11 +218,11 @@ protected: private: /// Clone method implementation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface PlaneSurface* - clone_impl(Context ctx, const Transform3D& shift) const override; + clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const override; }; #include "Acts/Surfaces/detail/PlaneSurface.ipp" diff --git a/Core/include/Acts/Surfaces/StrawSurface.hpp b/Core/include/Acts/Surfaces/StrawSurface.hpp index eabc06935c6e389e271afb99f2e354e7cbd65d5e..c531d2186a5a4ac9e7aa0c7ee869fac2c2757b23 100644 --- a/Core/include/Acts/Surfaces/StrawSurface.hpp +++ b/Core/include/Acts/Surfaces/StrawSurface.hpp @@ -14,8 +14,8 @@ #include "Acts/Surfaces/LineBounds.hpp" #include "Acts/Surfaces/LineSurface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -71,13 +71,12 @@ protected: /// Copy constructor - with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param other is the source cone surface /// @param transf is the additional transfrom applied after copying - StrawSurface(Context ctx, - const StrawSurface& other, - const Transform3D& transf); + StrawSurface(const GeometryContext& gctx, + const StrawSurface& other, + const Transform3D& transf); public: /// Destructor - defaulted @@ -91,11 +90,10 @@ public: /// Clone method into a concrete type of StrawSurface with shift /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface std::shared_ptr<StrawSurface> - clone(Context ctx, const Transform3D& shift) const; + clone(const GeometryContext& gctx, const Transform3D& shift) const; /// Return the surface type SurfaceType @@ -106,23 +104,22 @@ public: name() const final; /// Return a PolyhedronRepresentation for this object - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param l0div Number of divisions along l0 (phi) /// @param l1div Number of divisions along l1 (z) virtual PolyhedronRepresentation - polyhedronRepresentation(Context ctx, - size_t l0div = 10, - size_t l1div = 1) const; + polyhedronRepresentation(const GeometryContext& gctx, + size_t l0div = 10, + size_t l1div = 1) const; private: /// Clone method implementation /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface StrawSurface* - clone_impl(Context ctx, const Transform3D& shift) const override; + clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const override; }; inline Surface::SurfaceType diff --git a/Core/include/Acts/Surfaces/Surface.hpp b/Core/include/Acts/Surfaces/Surface.hpp index 983d77e7616fb0fe008e346ef9a5d30d4e3d4829..79a3ebdbdf1f8d2180052e7f4cbedfc87b994886 100644 --- a/Core/include/Acts/Surfaces/Surface.hpp +++ b/Core/include/Acts/Surfaces/Surface.hpp @@ -17,13 +17,13 @@ #include "Acts/Surfaces/SurfaceBounds.hpp" #include "Acts/Utilities/BinnedArray.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometryObject.hpp" #include "Acts/Utilities/GeometryStatics.hpp" #include "Acts/Utilities/Intersection.hpp" -#include <any> +#include <memory> namespace Acts { @@ -90,11 +90,12 @@ protected: /// @note copy construction invalidates the association /// to detector element or any other attachment /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param other Source surface for copy /// @param shift Additional transform applied after copying from the source - Surface(Context ctx, const Surface& other, const Transform3D& shift); + Surface(const GeometryContext& gctx, + const Surface& other, + const Transform3D& shift); public: /// Destructor @@ -161,13 +162,12 @@ public: /// Clone method with shift - cloning without shift is not sensible /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface std::shared_ptr<Surface> - clone(Context ctx, const Transform3D& shift) const + clone(const GeometryContext& gctx, const Transform3D& shift) const { - return std::shared_ptr<Surface>(this->clone_impl(ctx, shift)); + return std::shared_ptr<Surface>(this->clone_impl(gctx, shift)); } private: @@ -175,11 +175,10 @@ private: /// wrapped into a shared pointer by ::clone(). This is needed for /// covariant overload of this method. /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param shift applied to the surface virtual Surface* - clone_impl(Context ctx, const Transform3D& shift) const = 0; + clone_impl(const GeometryContext& gctx, const Transform3D& shift) const = 0; public: /// Return method for the Surface type to avoid dynamic casts @@ -191,57 +190,56 @@ public: /// is just forwarded to the detector element in order to keep the /// (mis-)alignment cache cetrally handled /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + virtual const Transform3D& - transform(Context ctx) const; + transform(const GeometryContext& gctx) const; /// Return method for the surface center by reference /// @note the center is always recalculated in order to not keep a cache /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + /// /// @return center position by value virtual const Vector3D - center(Context ctx) const; + center(const GeometryContext& gctx) const; /// Return method for the normal vector of the surface /// The normal vector can only be generally defined at a given local position /// It requires a local position to be given (in general) /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos is the local position where the normal verctor is constructed /// /// @return normal vector by value virtual const Vector3D - normal(Context ctx, const Vector2D& lpos) const = 0; + normal(const GeometryContext& gctx, const Vector2D& lpos) const = 0; /// Return method for the normal vector of the surface /// The normal vector can only be generally defined at a given local position /// It requires a local position to be given (in general) /// /// @param pos is the global position where the normal vector is constructed - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + /// /// @return normal vector by value virtual const Vector3D - normal(Context ctx, const Vector3D& pos) const; + normal(const GeometryContext& gctx, const Vector3D& pos) const; /// Return method for the normal vector of the surface /// /// It will return a normal vector at the center() position /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + // /// @return normal vector by value virtual const Vector3D - normal(Context ctx) const + normal(const GeometryContext& gctx) const { - return normal(ctx, center(ctx)); + return normal(gctx, center(gctx)); } /// Return method for SurfaceBounds @@ -288,34 +286,32 @@ public: /// /// @tparam parameters_t The parameters type /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param pars TrackParameters to be checked /// @param bcheck BoundaryCheck directive for this onSurface check /// /// @return boolean indication if operation was successful template <typename parameters_t> bool - isOnSurface(Context ctx, - const parameters_t& pars, - const BoundaryCheck& bcheck = true) const; + isOnSurface(const GeometryContext& gctx, + const parameters_t& pars, + const BoundaryCheck& bcheck = true) const; /// The geometric onSurface method /// /// Geometrical check whether position is on Surface /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos global position to be evaludated /// @param gmom global momentum (required for line-type surfaces) /// @param bcheck BoundaryCheck directive for this onSurface check /// /// @return boolean indication if operation was successful bool - isOnSurface(Context ctx, - const Vector3D& gpos, - const Vector3D& gmom, - const BoundaryCheck& bcheck = true) const; + isOnSurface(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + const BoundaryCheck& bcheck = true) const; /// The insideBounds method for local positions /// @@ -331,25 +327,23 @@ public: /// some surface types need the global momentum/direction to resolve sign /// ambiguity this is also provided /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param lpos local 2D posittion in specialized surface frame /// @param gmom global 3D momentum representation (optionally ignored) /// @param gpos global 3D position to be filled (given by reference for method /// symmetry) virtual void - localToGlobal(Context ctx, - const Vector2D& lpos, - const Vector3D& gmom, - Vector3D& gpos) const = 0; + localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& gmom, + Vector3D& gpos) const = 0; /// Global to local transformation /// Generalized global to local transformation for the surface types. Since /// some surface types need the global momentum/direction to resolve sign /// ambiguity this is also provided /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos global 3D position - considered to be on surface but not /// inside bounds (check is done) /// @param gmom global 3D momentum representation (optionally ignored) @@ -359,17 +353,16 @@ public: /// @return boolean indication if operation was successful (fail means global /// position was not on surface) virtual bool - globalToLocal(Context ctx, - const Vector3D& gpos, - const Vector3D& gmom, - Vector2D& lpos) const = 0; + globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + Vector2D& lpos) const = 0; /// Return mehtod for the reference frame /// This is the frame in which the covariance matrix is defined (specialized /// by all surfaces) /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos global 3D position - considered to be on surface but not /// inside bounds (check is done) /// @param gmom global 3D momentum representation (optionally ignored) @@ -377,7 +370,9 @@ public: /// @return RotationMatrix3D which defines the three axes of the measurement /// frame virtual const Acts::RotationMatrix3D - referenceFrame(Context ctx, const Vector3D& gpos, const Vector3D& gmom) const; + referenceFrame(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom) const; /// Initialize the jacobian from local to global /// the surface knows best, hence the calculation is done here. @@ -388,14 +383,13 @@ public: /// should move to : /// "Acts/EventData/detail/coordinate_transformations.hpp" /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param jacobian is the jacobian to be initialized /// @param gpos is the global position of the parameters /// @param dir is the direction at of the parameters /// @param pars is the parameter vector virtual void - initJacobianToGlobal(Context ctx, + initJacobianToGlobal(const GeometryContext& gctx, ActsMatrixD<7, 5>& jacobian, const Vector3D& gpos, const Vector3D& dir, @@ -413,12 +407,12 @@ public: /// @param jacobian is the jacobian to be initialized /// @param gpos is the global position of the parameters /// @param dir is the direction at of the parameters - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + /// /// @return the transposed reference frame (avoids recalculation) virtual const RotationMatrix3D - initJacobianToLocal(Context ctx, + initJacobianToLocal(const GeometryContext& gctx, ActsMatrixD<5, 7>& jacobian, const Vector3D& gpos, const Vector3D& dir) const; @@ -432,8 +426,7 @@ public: /// should move to : /// "Acts/EventData/detail/coordinate_transformations.hpp" /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos is the position of the paramters in global /// @param dir is the direction of the track /// @param rft is the transposed reference frame (avoids recalculation) @@ -441,7 +434,7 @@ public: /// /// @return a five-dim vector virtual const ActsRowVectorD<5> - derivativeFactors(Context ctx, + derivativeFactors(const GeometryContext& gctx, const Vector3D& gpos, const Vector3D& dir, const RotationMatrix3D& rft, @@ -449,17 +442,16 @@ public: /// Calucation of the path correction for incident /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos global 3D position - considered to be on surface but not /// inside bounds (check is done) /// @param gmom global 3D momentum representation /// /// @return Path correction with respect to the nominal incident. virtual double - pathCorrection(Context ctx, - const Vector3D& gpos, - const Vector3D& gmom) const = 0; + pathCorrection(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom) const = 0; /// Straight line intersection schema from position/direction /// @@ -467,8 +459,7 @@ public: /// @tparam options_t Type of the navigation options /// @tparam corrector_t is the type of the corrector struct foer the direction /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param position The position to start from /// @param position The direction to start from /// @param options Options object that holds additional navigation info @@ -478,15 +469,15 @@ public: template <typename options_t, typename corrector_t = VoidIntersectionCorrector> SurfaceIntersection - surfaceIntersectionEstimate(Context ctx, - const Vector3D& position, - const Vector3D& direction, - const options_t& options, + surfaceIntersectionEstimate(const GeometryContext& gctx, + const Vector3D& position, + const Vector3D& direction, + const options_t& options, const corrector_t& correct = corrector_t()) const { // get the intersection with the surface - auto sIntersection = intersectionEstimate(ctx, + auto sIntersection = intersectionEstimate(gctx, position, direction, options.navDir, @@ -503,8 +494,7 @@ public: /// @tparam options_t Type of the navigation options /// @tparam corrector_t is the type of the corrector struct foer the direction /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param parameters The parameters to start from /// @param options Options object that holds additional navigation info /// @param correct Corrector struct that can be used to refine the solution @@ -514,19 +504,18 @@ public: typename options_t, typename corrector_t = VoidIntersectionCorrector> SurfaceIntersection - surfaceIntersectionEstimate(Context ctx, - const parameters_t& parameters, - const options_t& options, - const corrector_t& correct = corrector_t()) const + surfaceIntersectionEstimate(const GeometryContext& gctx, + const parameters_t& parameters, + const options_t& options, + const corrector_t& correct = corrector_t()) const { return surfaceIntersectionEstimate( - ctx, parameters.position(), parameters.direction(), options, correct); + gctx, parameters.position(), parameters.direction(), options, correct); } /// Straight line intersection from position and momentum /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param gpos global 3D position - considered to be on surface but not /// inside bounds (check is done) /// @param 3D direction representation - expected to be normalized (no check @@ -539,21 +528,20 @@ public: /// /// @return Intersection object virtual Intersection - intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gidr, - NavigationDirection navDir = forward, - const BoundaryCheck& bcheck = false, - CorrFnc corr = nullptr) const = 0; + intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gidr, + NavigationDirection navDir = forward, + const BoundaryCheck& bcheck = false, + CorrFnc corr = nullptr) const = 0; /// clang-format on /// Output Method for std::ostream, to be overloaded by child classes /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param sl is the ostream to be dumped into virtual std::ostream& - toStream(Context ctx, std::ostream& sl) const; + toStream(const GeometryContext& gctx, std::ostream& sl) const; /// Return properly formatted class name virtual std::string diff --git a/Core/include/Acts/Surfaces/SurfaceArray.hpp b/Core/include/Acts/Surfaces/SurfaceArray.hpp index fa702e2d863fd55c54be405ebd8cde271baffba7..0589e2082c244317a56e892797d8dec432f02ba6 100644 --- a/Core/include/Acts/Surfaces/SurfaceArray.hpp +++ b/Core/include/Acts/Surfaces/SurfaceArray.hpp @@ -12,8 +12,8 @@ #include <vector> #include "Acts/Surfaces/Surface.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/IAxis.hpp" #include "Acts/Utilities/detail/Axis.hpp" #include "Acts/Utilities/detail/Grid.hpp" @@ -34,7 +34,7 @@ class SurfaceArray friend std::ostream& operator<<(std::ostream& sl, const SurfaceArray& sa) { - return sa.toStream(DefaultContext(), sl); + return sa.toStream(DefaultGeometryContext(), sl); } public: @@ -42,22 +42,22 @@ public: struct ISurfaceGridLookup { /// @brief Fill provided surfaces into the contained @c Grid. - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + /// @param surfaces Input surface pointers virtual void - fill(Context ctx, const SurfaceVector& surfaces) + fill(const GeometryContext& gctx, const SurfaceVector& surfaces) = 0; /// @brief Attempts to fix sub-optimal binning by filling closest /// Surfaces into empty bin /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + /// @param surfaces The surface pointers to fill /// @return number of bins that were filled virtual size_t - completeBinning(Context ctx, const SurfaceVector& surfaces) + completeBinning(const GeometryContext& gctx, const SurfaceVector& surfaces) = 0; /// @brief Performs lookup at @c pos and returns bin content as reference @@ -172,14 +172,14 @@ public: /// all bins around a given one. /// /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + /// @param surfaces Input surface pointers void - fill(Context ctx, const SurfaceVector& surfaces) override + fill(const GeometryContext& gctx, const SurfaceVector& surfaces) override { for (const auto& srf : surfaces) { - Vector3D pos = srf->binningPosition(ctx, binR); + Vector3D pos = srf->binningPosition(gctx, binR); lookup(pos).push_back(srf); } @@ -190,12 +190,13 @@ public: /// Surfaces into empty bins /// @note This does not always do what you want. /// - /// @param ctx Is the payload/context object to be used for - /// delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment + /// @param surfaces The surface pointers to fill /// @return number of bins that were filled size_t - completeBinning(Context ctx, const SurfaceVector& surfaces) override + completeBinning(const GeometryContext& gctx, + const SurfaceVector& surfaces) override { size_t binCompleted = 0; size_t nBins = size(); @@ -215,7 +216,7 @@ public: Vector3D binCtr = getBinCenter(b); minPath = std::numeric_limits<double>::max(); for (const auto& srf : surfaces) { - curPath = (binCtr - srf->binningPosition(ctx, binR)).norm(); + curPath = (binCtr - srf->binningPosition(gctx, binR)).norm(); if (curPath < minPath) { minPath = curPath; @@ -482,14 +483,16 @@ public: /// @brief Comply with concept and provide fill method /// @note Does nothing void - fill(Context /*ctx*/, const SurfaceVector& /*surfaces*/) override + fill(const GeometryContext& /*gctx*/, + const SurfaceVector& /*surfaces*/) override { } /// @brief Comply with concept and provide completeBinning method /// @note Does nothing size_t - completeBinning(Context /*ctx*/, const SurfaceVector& /*surfaces*/) override + completeBinning(const GeometryContext& /*gctx*/, + const SurfaceVector& /*surfaces*/) override { return 0; } @@ -634,12 +637,11 @@ public: } /// @brief String representation of this @c SurfaceArray - /// @param ctx Is the payload/context ojbect to be used for - /// for delegating the event or thread context + /// @param gctx The current geometry context object, e.g. alignment /// @param sl Output stream to write to /// @return the output stream given as @p sl std::ostream& - toStream(Context ctx, std::ostream& sl) const; + toStream(const GeometryContext& gctx, std::ostream& sl) const; private: std::unique_ptr<ISurfaceGridLookup> p_gridLookup; diff --git a/Core/include/Acts/Surfaces/detail/ConeSurface.ipp b/Core/include/Acts/Surfaces/detail/ConeSurface.ipp index bd7ae0032afce5e306ce8ad1759a7633492b19b8..dce42c79e0149122ef886bdd9496ea33f3829bd8 100644 --- a/Core/include/Acts/Surfaces/detail/ConeSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/ConeSurface.ipp @@ -11,12 +11,12 @@ /////////////////////////////////////////////////////////////////// inline Intersection -ConeSurface::intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gmom, - NavigationDirection navDir, - const BoundaryCheck& bcheck, - CorrFnc correct) const +ConeSurface::intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + NavigationDirection navDir, + const BoundaryCheck& bcheck, + CorrFnc correct) const { // check if you need @@ -39,7 +39,7 @@ ConeSurface::intersectionEstimate(Context ctx, do { if (needsTransform) { - Transform3D invTrans = transform(ctx).inverse(); + Transform3D invTrans = transform(gctx).inverse(); point1 = invTrans * gpos; direction = invTrans.linear() * direction; } @@ -116,10 +116,10 @@ ConeSurface::intersectionEstimate(Context ctx, // transform back if needed if (m_transform) { - solution = transform(ctx) * solution; + solution = transform(gctx) * solution; } // check validity - valid = bcheck ? (valid && isOnSurface(ctx, solution, gmom, bcheck)) : valid; + valid = bcheck ? (valid && isOnSurface(gctx, solution, gmom, bcheck)) : valid; // set the result navigation direction return Intersection(solution, path, valid); } diff --git a/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp b/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp index 16992e5349df04379e6315f3381b5d7a110a98eb..e95afe624e77c655b1cba1f9bf27cc66f0c04817 100644 --- a/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/CylinderSurface.ipp @@ -11,26 +11,26 @@ /////////////////////////////////////////////////////////////////// inline const Vector3D -CylinderSurface::rotSymmetryAxis(Context ctx) const +CylinderSurface::rotSymmetryAxis(const GeometryContext& gctx) const { // fast access via tranform matrix (and not rotation()) - return transform(ctx).matrix().block<3, 1>(0, 2); + return transform(gctx).matrix().block<3, 1>(0, 2); } inline Intersection -CylinderSurface::intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir, - const BoundaryCheck& bcheck, - CorrFnc correct) const +CylinderSurface::intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, + CorrFnc correct) const { // create line parameters Vector3D lpos = gpos; Vector3D ldir = gdir; // minimize the call to transform() - const auto& tMatrix = transform(ctx).matrix(); + const auto& tMatrix = transform(gctx).matrix(); Vector3D caxis = tMatrix.block<3, 1>(0, 2).transpose(); Vector3D ccenter = tMatrix.block<3, 1>(0, 3).transpose(); // what you need at the and @@ -72,7 +72,7 @@ CylinderSurface::intersectionEstimate(Context ctx, } // update for inside if requested : // @todo fix this : fast inside bounds check needed - valid = bcheck ? (valid && isOnSurface(ctx, solution, gdir, bcheck)) : valid; + valid = bcheck ? (valid && isOnSurface(gctx, solution, gdir, bcheck)) : valid; // now return return Intersection(solution, path, valid); } diff --git a/Core/include/Acts/Surfaces/detail/DiscSurface.ipp b/Core/include/Acts/Surfaces/detail/DiscSurface.ipp index 9bd157a031507a93a50e0972ff5f88a98f8d1741..aa13e8b37ee0d88d4f934776908c3a93a3203ecf 100644 --- a/Core/include/Acts/Surfaces/detail/DiscSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/DiscSurface.ipp @@ -26,7 +26,7 @@ DiscSurface::localCartesianToPolar(const Vector2D& lcart) const } inline void -DiscSurface::initJacobianToGlobal(Context ctx, +DiscSurface::initJacobianToGlobal(const GeometryContext& gctx, ActsMatrixD<7, 5>& jacobian, const Vector3D& gpos, const Vector3D& dir, @@ -49,7 +49,7 @@ DiscSurface::initJacobianToGlobal(Context ctx, const double cos_phi = x * inv_sin_theta; const double sin_phi = y * inv_sin_theta; // retrieve the reference frame - const auto rframe = referenceFrame(ctx, gpos, dir); + const auto rframe = referenceFrame(gctx, gpos, dir); // special polar coordinates for the Disc double lrad = pars[eLOC_0]; @@ -72,7 +72,7 @@ DiscSurface::initJacobianToGlobal(Context ctx, } inline const RotationMatrix3D -DiscSurface::initJacobianToLocal(Context ctx, +DiscSurface::initJacobianToLocal(const GeometryContext& gctx, ActsMatrixD<5, 7>& jacobian, const Vector3D& gpos, const Vector3D& dir) const @@ -88,9 +88,9 @@ DiscSurface::initJacobianToLocal(Context ctx, const double sin_phi_over_sin_theta = y * inv_sin_theta_2; const double inv_sin_theta = sqrt(inv_sin_theta_2); // The measurement frame of the surface - RotationMatrix3D rframeT = referenceFrame(ctx, gpos, dir).transpose(); + RotationMatrix3D rframeT = referenceFrame(gctx, gpos, dir).transpose(); // calculate the transformation to local coorinates - const Vector3D pos_loc = transform(ctx).inverse() * gpos; + const Vector3D pos_loc = transform(gctx).inverse() * gpos; const double lr = perp(pos_loc); const double lphi = phi(pos_loc); const double lcphi = cos(lphi); @@ -110,15 +110,15 @@ DiscSurface::initJacobianToLocal(Context ctx, } inline Intersection -DiscSurface::intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir, - const BoundaryCheck& bcheck, - CorrFnc correct) const +DiscSurface::intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, + CorrFnc correct) const { // minimize the call to transform() - const auto& tMatrix = transform(ctx).matrix(); + const auto& tMatrix = transform(gctx).matrix(); const Vector3D pnormal = tMatrix.block<3, 1>(0, 2).transpose(); const Vector3D pcenter = tMatrix.block<3, 1>(0, 3).transpose(); // return solution and path @@ -149,30 +149,32 @@ DiscSurface::intersectionEstimate(Context ctx, // evaluate (if necessary in terms of boundaries) // @todo: speed up isOnSurface - we know that it is on surface // all we need is to check if it's inside bounds in 3D space - valid = bcheck ? (valid && isOnSurface(ctx, solution, gdir, bcheck)) : valid; + valid = bcheck ? (valid && isOnSurface(gctx, solution, gdir, bcheck)) : valid; // return the result return Intersection(solution, path, valid); } inline const Vector3D -DiscSurface::normal(Context ctx, const Vector2D& /*unused*/) const +DiscSurface::normal(const GeometryContext& gctx, + const Vector2D& /*unused*/) const { // fast access via tranform matrix (and not rotation()) - const auto& tMatrix = transform(ctx).matrix(); + const auto& tMatrix = transform(gctx).matrix(); return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); } inline const Vector3D -DiscSurface::binningPosition(Context ctx, BinningValue /*unused*/) const +DiscSurface::binningPosition(const GeometryContext& gctx, + BinningValue /*unused*/) const { - return center(ctx); + return center(gctx); } inline double -DiscSurface::pathCorrection(Context ctx, - const Vector3D& pos, - const Vector3D& mom) const +DiscSurface::pathCorrection(const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const { /// we can ignore the global position here - return 1. / std::abs(Surface::normal(ctx, pos).dot(mom.normalized())); + return 1. / std::abs(Surface::normal(gctx, pos).dot(mom.normalized())); } diff --git a/Core/include/Acts/Surfaces/detail/LineSurface.ipp b/Core/include/Acts/Surfaces/detail/LineSurface.ipp index 8d0a1e10edd2baacc9aee7c8889314a8f72d66e1..cea550f9de80427a930419fc147d70094c7d21a6 100644 --- a/Core/include/Acts/Surfaces/detail/LineSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/LineSurface.ipp @@ -11,13 +11,13 @@ /////////////////////////////////////////////////////////////////// inline void -LineSurface::localToGlobal(Context ctx, - const Vector2D& lpos, - const Vector3D& mom, - Vector3D& gpos) const +LineSurface::localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, + const Vector3D& mom, + Vector3D& gpos) const { - const auto& sTransform = transform(ctx); + const auto& sTransform = transform(gctx); const auto& tMatrix = sTransform.matrix(); Vector3D lineDirection(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); @@ -29,14 +29,14 @@ LineSurface::localToGlobal(Context ctx, } inline bool -LineSurface::globalToLocal(Context ctx, - const Vector3D& gpos, - const Vector3D& mom, - Vector2D& lpos) const +LineSurface::globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom, + Vector2D& lpos) const { using VectorHelpers::perp; - const auto& sTransform = transform(ctx); + const auto& sTransform = transform(gctx); const auto& tMatrix = sTransform.matrix(); Vector3D lineDirection(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); // Bring the global position into the local frame @@ -58,12 +58,12 @@ LineSurface::name() const } inline const RotationMatrix3D -LineSurface::referenceFrame(Context ctx, +LineSurface::referenceFrame(const GeometryContext& gctx, const Vector3D& /*unused*/, const Vector3D& mom) const { RotationMatrix3D mFrame; - const auto& tMatrix = transform(ctx).matrix(); + const auto& tMatrix = transform(gctx).matrix(); Vector3D measY(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); Vector3D measX(measY.cross(mom).normalized()); Vector3D measDepth(measX.cross(measY)); @@ -76,7 +76,7 @@ LineSurface::referenceFrame(Context ctx, } inline double -LineSurface::pathCorrection(Context /*unused*/, +LineSurface::pathCorrection(const GeometryContext& /*unused*/, const Vector3D& /*pos*/, const Vector3D& /*mom*/) const { @@ -84,15 +84,16 @@ LineSurface::pathCorrection(Context /*unused*/, } inline const Vector3D -LineSurface::binningPosition(Context ctx, BinningValue /*bValue*/) const +LineSurface::binningPosition(const GeometryContext& gctx, + BinningValue /*bValue*/) const { - return center(ctx); + return center(gctx); } inline const Vector3D -LineSurface::normal(Context ctx, const Vector2D& /*lpos*/) const +LineSurface::normal(const GeometryContext& gctx, const Vector2D& /*lpos*/) const { - const auto& tMatrix = transform(ctx).matrix(); + const auto& tMatrix = transform(gctx).matrix(); return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); } @@ -106,19 +107,19 @@ LineSurface::bounds() const } inline Intersection -LineSurface::intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir, - const BoundaryCheck& bcheck, - CorrFnc correct) const +LineSurface::intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, + CorrFnc correct) const { // following nominclature found in header file and doxygen documentation // line one is the straight track Vector3D ma = gpos; Vector3D ea = gdir; // line two is the line surface - const auto& tMatrix = transform(ctx).matrix(); + const auto& tMatrix = transform(gctx).matrix(); Vector3D mb = tMatrix.block<3, 1>(0, 3).transpose(); Vector3D eb = tMatrix.block<3, 1>(0, 2).transpose(); // now go ahead and solve for the closest approach @@ -149,7 +150,7 @@ LineSurface::intersectionEstimate(Context ctx, } // it just needs to be a insideBounds() check // @todo there should be a faster check possible - valid = bcheck ? (valid && isOnSurface(ctx, result, gdir, bcheck)) : valid; + valid = bcheck ? (valid && isOnSurface(gctx, result, gdir, bcheck)) : valid; // return the result with validity return Intersection(result, u, valid); } @@ -158,7 +159,7 @@ LineSurface::intersectionEstimate(Context ctx, } inline void -LineSurface::initJacobianToGlobal(Context ctx, +LineSurface::initJacobianToGlobal(const GeometryContext& gctx, ActsMatrixD<7, 5>& jacobian, const Vector3D& gpos, const Vector3D& dir, @@ -181,7 +182,7 @@ LineSurface::initJacobianToGlobal(Context ctx, const double cos_phi = x * inv_sin_theta; const double sin_phi = y * inv_sin_theta; // retrieve the reference frame - const auto rframe = referenceFrame(ctx, gpos, dir); + const auto rframe = referenceFrame(gctx, gpos, dir); // the local error components - given by the reference frame jacobian.topLeftCorner<3, 2>() = rframe.topLeftCorner<3, 2>(); // the momentum components @@ -209,14 +210,14 @@ LineSurface::initJacobianToGlobal(Context ctx, } inline const ActsRowVectorD<5> -LineSurface::derivativeFactors(Context ctx, +LineSurface::derivativeFactors(const GeometryContext& gctx, const Vector3D& pos, const Vector3D& dir, const RotationMatrix3D& rft, const ActsMatrixD<7, 5>& jac) const { // the vector between position and center - ActsRowVectorD<3> pc = (pos - center(ctx)).transpose(); + ActsRowVectorD<3> pc = (pos - center(gctx)).transpose(); // the longitudinal component vector (alogn local z) ActsRowVectorD<3> locz = rft.block<1, 3>(1, 0); // build the norm vector comonent by subtracting the longitudinal one diff --git a/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp b/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp index cac2b27909f74af2b0530b7597592486d2bba482..9109f836fe5c8d4bf8b1e2b0c4e6c81f928fa9ef 100644 --- a/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp +++ b/Core/include/Acts/Surfaces/detail/PlaneSurface.ipp @@ -11,38 +11,40 @@ /////////////////////////////////////////////////////////////////// inline const Vector3D -PlaneSurface::normal(Context ctx, const Vector2D& /*lpos*/) const +PlaneSurface::normal(const GeometryContext& gctx, + const Vector2D& /*lpos*/) const { // fast access via tranform matrix (and not rotation()) - const auto& tMatrix = transform(ctx).matrix(); + const auto& tMatrix = transform(gctx).matrix(); return Vector3D(tMatrix(0, 2), tMatrix(1, 2), tMatrix(2, 2)); } inline const Vector3D -PlaneSurface::binningPosition(Context ctx, BinningValue /*bValue*/) const +PlaneSurface::binningPosition(const GeometryContext& gctx, + BinningValue /*bValue*/) const { - return center(ctx); + return center(gctx); } inline double -PlaneSurface::pathCorrection(Context ctx, - const Vector3D& pos, - const Vector3D& mom) const +PlaneSurface::pathCorrection(const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom) const { /// we can ignore the global position here - return 1. / std::abs(Surface::normal(ctx, pos).dot(mom.normalized())); + return 1. / std::abs(Surface::normal(gctx, pos).dot(mom.normalized())); } inline Intersection -PlaneSurface::intersectionEstimate(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir, - const BoundaryCheck& bcheck, - CorrFnc correct) const +PlaneSurface::intersectionEstimate(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, + CorrFnc correct) const { // minimize the call to transform() - const auto& tMatrix = transform(ctx).matrix(); + const auto& tMatrix = transform(gctx).matrix(); const Vector3D pnormal = tMatrix.block<3, 1>(0, 2).transpose(); const Vector3D pcenter = tMatrix.block<3, 1>(0, 3).transpose(); // return solution and path @@ -73,7 +75,7 @@ PlaneSurface::intersectionEstimate(Context ctx, // evaluate (if necessary in terms of boundaries) // @todo: speed up isOnSurface - we know that it is on surface // all we need is to check if it's inside bounds - valid = bcheck ? (valid && isOnSurface(ctx, solution, gdir, bcheck)) : valid; + valid = bcheck ? (valid && isOnSurface(gctx, solution, gdir, bcheck)) : valid; // return the result return Intersection(solution, path, valid); } diff --git a/Core/include/Acts/Surfaces/detail/Surface.ipp b/Core/include/Acts/Surfaces/detail/Surface.ipp index 53a74d9924f84a7f766c1811bb9c7dc6612293fd..6f382d26b9d23d064db93646e127b068bd8287b1 100644 --- a/Core/include/Acts/Surfaces/detail/Surface.ipp +++ b/Core/include/Acts/Surfaces/detail/Surface.ipp @@ -11,27 +11,27 @@ /////////////////////////////////////////////////////////////////// inline const Vector3D -Surface::center(Context ctx) const +Surface::center(const GeometryContext& gctx) const { // fast access via tranform matrix (and not translation()) - auto tMatrix = transform(ctx).matrix(); + auto tMatrix = transform(gctx).matrix(); return Vector3D(tMatrix(0, 3), tMatrix(1, 3), tMatrix(2, 3)); } inline const Acts::Vector3D -Surface::normal(Context ctx, const Vector3D& /*unused*/) const +Surface::normal(const GeometryContext& gctx, const Vector3D& /*unused*/) const { - return normal(ctx, s_origin2D); + return normal(gctx, s_origin2D); } inline const Transform3D& -Surface::transform(Context ctx) const +Surface::transform(const GeometryContext& gctx) const { if (m_transform != nullptr) { return (*(m_transform.get())); } if (m_associatedDetElement != nullptr) { - return m_associatedDetElement->transform(ctx); + return m_associatedDetElement->transform(gctx); } return s_idTransform; } @@ -43,15 +43,15 @@ Surface::insideBounds(const Vector2D& locpos, const BoundaryCheck& bcheck) const } inline const RotationMatrix3D -Surface::referenceFrame(Context ctx, +Surface::referenceFrame(const GeometryContext& gctx, const Vector3D& /*unused*/, const Vector3D& /*unused*/) const { - return transform(ctx).matrix().block<3, 3>(0, 0); + return transform(gctx).matrix().block<3, 3>(0, 0); } inline void -Surface::initJacobianToGlobal(Context ctx, +Surface::initJacobianToGlobal(const GeometryContext& gctx, ActsMatrixD<7, 5>& jacobian, const Vector3D& gpos, const Vector3D& dir, @@ -74,7 +74,7 @@ Surface::initJacobianToGlobal(Context ctx, const double cos_phi = x * inv_sin_theta; const double sin_phi = y * inv_sin_theta; // retrieve the reference frame - const auto rframe = referenceFrame(ctx, gpos, dir); + const auto rframe = referenceFrame(gctx, gpos, dir); // the local error components - given by reference frame jacobian.topLeftCorner<3, 2>() = rframe.topLeftCorner<3, 2>(); // the momentum components @@ -87,7 +87,7 @@ Surface::initJacobianToGlobal(Context ctx, } inline const RotationMatrix3D -Surface::initJacobianToLocal(Context ctx, +Surface::initJacobianToLocal(const GeometryContext& gctx, ActsMatrixD<5, 7>& jacobian, const Vector3D& gpos, const Vector3D& dir) const @@ -101,7 +101,7 @@ Surface::initJacobianToLocal(Context ctx, const double sin_phi_over_sin_theta = y * inv_sin_theta_2; const double inv_sin_theta = sqrt(inv_sin_theta_2); // The measurement frame of the surface - RotationMatrix3D rframeT = referenceFrame(ctx, gpos, dir).transpose(); + RotationMatrix3D rframeT = referenceFrame(gctx, gpos, dir).transpose(); // given by the refernece frame jacobian.block<2, 3>(0, 0) = rframeT.block<2, 3>(0, 0); // Directional and momentum elements for reference frame surface @@ -114,7 +114,7 @@ Surface::initJacobianToLocal(Context ctx, } inline const ActsRowVectorD<5> -Surface::derivativeFactors(Context /*unused*/, +Surface::derivativeFactors(const GeometryContext& /*unused*/, const Vector3D& /*unused*/, const Vector3D& dir, const RotationMatrix3D& rft, @@ -129,15 +129,15 @@ Surface::derivativeFactors(Context /*unused*/, template <typename parameters_t> bool -Surface::isOnSurface(Context ctx, - const parameters_t& pars, - const BoundaryCheck& bcheck) const +Surface::isOnSurface(const GeometryContext& gctx, + const parameters_t& pars, + const BoundaryCheck& bcheck) const { // surface pointer comparison as a first fast check (w/o transform) // @todo check if we can find a fast way that works for stepper state and // parameters // if ((&pars.referenceSurface() == this) && !bcheck) return true; - return isOnSurface(ctx, pars.position(), pars.momentum(), bcheck); + return isOnSurface(gctx, pars.position(), pars.momentum(), bcheck); } inline const DetectorElementBase* diff --git a/Core/include/Acts/Tools/CuboidVolumeBuilder.hpp b/Core/include/Acts/Tools/CuboidVolumeBuilder.hpp index 4be6becb2100691d796c7de1bac339510a1e3054..5344ca73a828c1a15223d30930c4d98b56c34953 100644 --- a/Core/include/Acts/Tools/CuboidVolumeBuilder.hpp +++ b/Core/include/Acts/Tools/CuboidVolumeBuilder.hpp @@ -12,8 +12,8 @@ #include <memory> #include <vector> #include "Acts/Tools/ITrackingVolumeBuilder.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -100,7 +100,7 @@ public: std::vector<VolumeConfig> volumeCfg = {}; /// The building context - ContextType buildContext = DefaultContext(); + GeometryContext buildContext = DefaultGeometryContext(); }; /// @brief Default constructor without a configuration diff --git a/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp b/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp index a2a3bc968f605257ca1386dbe23cc6c97fe6ce38..6e01264c49b8a5242bbf0448289a77bdb2733c6a 100644 --- a/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp +++ b/Core/include/Acts/Tools/CylinderVolumeBuilder.hpp @@ -18,7 +18,7 @@ #include "Acts/Tools/ITrackingVolumeBuilder.hpp" #include "Acts/Tools/ITrackingVolumeHelper.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Units.hpp" @@ -521,7 +521,7 @@ public: double layerEnvelopeZ = 10. * Acts::units::_mm; /// The building context - ContextType buildContext = DefaultContext(); + GeometryContext buildContext = DefaultGeometryContext(); /// the volume signature int volumeSignature = -1; diff --git a/Core/include/Acts/Tools/CylinderVolumeHelper.hpp b/Core/include/Acts/Tools/CylinderVolumeHelper.hpp index 18aa37de90ba10a00f1abe46602707d2177edde6..7850a1f42dacfb55f58db3d3b0bcf69210f061f5 100644 --- a/Core/include/Acts/Tools/CylinderVolumeHelper.hpp +++ b/Core/include/Acts/Tools/CylinderVolumeHelper.hpp @@ -26,7 +26,7 @@ #include "Acts/Tools/ILayerArrayCreator.hpp" #include "Acts/Tools/ITrackingVolumeArrayCreator.hpp" #include "Acts/Tools/ITrackingVolumeHelper.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Volumes/BoundarySurfaceFace.hpp" @@ -62,7 +62,7 @@ public: /// bins in r/z for the passive layer int passiveLayerRzBins = 100; /// The building context - ContextType buildContext = DefaultContext(); + GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor diff --git a/Core/include/Acts/Tools/LayerArrayCreator.hpp b/Core/include/Acts/Tools/LayerArrayCreator.hpp index da9c1299696e20221b18db5483e04c66ff13af5c..237753d4ffacbe055023c5a850ba0c18ec6aecc9 100644 --- a/Core/include/Acts/Tools/LayerArrayCreator.hpp +++ b/Core/include/Acts/Tools/LayerArrayCreator.hpp @@ -22,8 +22,8 @@ #include <algorithm> #include "Acts/Tools/ILayerArrayCreator.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" namespace Acts { @@ -48,7 +48,7 @@ public: struct Config { /// The building context - ContextType buildContext = DefaultContext(); + GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor diff --git a/Core/include/Acts/Tools/LayerCreator.hpp b/Core/include/Acts/Tools/LayerCreator.hpp index 6ba9353bfd4d3ae9d8422a49f484f15ea25b9e55..7c0da640397d62c5cd7b375befc0bdb9f0195e1c 100644 --- a/Core/include/Acts/Tools/LayerCreator.hpp +++ b/Core/include/Acts/Tools/LayerCreator.hpp @@ -16,8 +16,8 @@ #include "Acts/Layers/ApproachDescriptor.hpp" #include "Acts/Tools/SurfaceArrayCreator.hpp" #include "Acts/Utilities/BinUtility.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" #ifndef ACTS_LAYERCREATOR_TAKESMALLERBIGGER @@ -59,7 +59,7 @@ public: /// cylinder module phi tolerance : it counts at same phi, if ... double cylinderPhiTolerance{0.1}; /// The context for geometry building - ContextType buildContext = DefaultContext(); + GeometryContext buildContext = DefaultGeometryContext(); /// standard constructor Config() = default; }; diff --git a/Core/include/Acts/Tools/PassiveLayerBuilder.hpp b/Core/include/Acts/Tools/PassiveLayerBuilder.hpp index 74aa98a097d135f3e3a81eac7c26e7e6ae8562ea..d23ad8478f47f30d6a724420f3451feea511aa45 100644 --- a/Core/include/Acts/Tools/PassiveLayerBuilder.hpp +++ b/Core/include/Acts/Tools/PassiveLayerBuilder.hpp @@ -15,7 +15,7 @@ #include "Acts/Layers/Layer.hpp" #include "Acts/Material/MaterialProperties.hpp" #include "Acts/Tools/ILayerBuilder.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" namespace Acts { @@ -52,7 +52,7 @@ public: posnegLayerMaterial; ///< p/n layer specs /// The building context - ContextType buildContext = DefaultContext(); + GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor diff --git a/Core/include/Acts/Tools/SurfaceArrayCreator.hpp b/Core/include/Acts/Tools/SurfaceArrayCreator.hpp index b404f030023540e8ba989c3c7f60af69b283f072..3ecced73cab240f5cc5a7a30b6b0b3308a8df11b 100644 --- a/Core/include/Acts/Tools/SurfaceArrayCreator.hpp +++ b/Core/include/Acts/Tools/SurfaceArrayCreator.hpp @@ -17,8 +17,8 @@ #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/Surface.hpp" #include "Acts/Surfaces/SurfaceArray.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Units.hpp" @@ -28,8 +28,10 @@ namespace Test { struct SurfaceArrayCreatorFixture; } -using SurfaceMatcher = std:: - function<bool(Context ctx, BinningValue, const Surface*, const Surface*)>; +using SurfaceMatcher = std::function<bool(const GeometryContext& gctx, + BinningValue, + const Surface*, + const Surface*)>; using SurfaceVector = std::vector<const Surface*>; using SurfaceMatrix = std::vector<SurfaceVector>; @@ -86,7 +88,7 @@ public: bool doPhiBinningOptimization = true; /// The building context - ContextType buildContext = DefaultContext(); + GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor with default config @@ -239,17 +241,17 @@ public: = nullptr) const; static bool - isSurfaceEquivalent(Context ctx, - BinningValue bValue, - const Surface* a, - const Surface* b) + isSurfaceEquivalent(const GeometryContext& gctx, + BinningValue bValue, + const Surface* a, + const Surface* b) { using Acts::VectorHelpers::perp; if (bValue == Acts::binPhi) { // Take the two binning positions - auto pos1 = a->binningPosition(ctx, binR), - pos2 = b->binningPosition(ctx, binR); + auto pos1 = a->binningPosition(gctx, binR), + pos2 = b->binningPosition(gctx, binR); // Project them on the (x, y) plane, where Phi angles are calculated auto proj1 = pos1.head<2>(), proj2 = pos2.head<2>(); @@ -265,14 +267,14 @@ public: } if (bValue == Acts::binZ) { - return (std::abs(a->binningPosition(ctx, binR).z() - - b->binningPosition(ctx, binR).z()) + return (std::abs(a->binningPosition(gctx, binR).z() + - b->binningPosition(gctx, binR).z()) < Acts::units::_um); } if (bValue == Acts::binR) { - return (std::abs(perp(a->binningPosition(ctx, binR)) - - perp(b->binningPosition(ctx, binR))) + return (std::abs(perp(a->binningPosition(gctx, binR)) + - perp(b->binningPosition(gctx, binR))) < Acts::units::_um); } diff --git a/Core/include/Acts/Tools/TrackingGeometryBuilder.hpp b/Core/include/Acts/Tools/TrackingGeometryBuilder.hpp index a35465f3e56f2d98619c17f900477f13b13c4bb6..743c5b63fc37b2518896897855322ce704f016ab 100644 --- a/Core/include/Acts/Tools/TrackingGeometryBuilder.hpp +++ b/Core/include/Acts/Tools/TrackingGeometryBuilder.hpp @@ -17,8 +17,8 @@ #include "Acts/Tools/ITrackingGeometryBuilder.hpp" #include "Acts/Tools/ITrackingVolumeBuilder.hpp" #include "Acts/Tools/ITrackingVolumeHelper.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" namespace Acts { @@ -54,7 +54,7 @@ public: std::shared_ptr<const ITrackingVolumeHelper> trackingVolumeHelper = nullptr; /// The building context - ContextType buildContext = DefaultContext(); + GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor diff --git a/Core/include/Acts/Tools/TrackingVolumeArrayCreator.hpp b/Core/include/Acts/Tools/TrackingVolumeArrayCreator.hpp index bbddbe9e51f7c0ccd60160a1b6ce1bbb379fabd0..3982cb71349b7729d51379d3057e681ce75ef0bb 100644 --- a/Core/include/Acts/Tools/TrackingVolumeArrayCreator.hpp +++ b/Core/include/Acts/Tools/TrackingVolumeArrayCreator.hpp @@ -14,8 +14,8 @@ #include <algorithm> #include "Acts/Tools/ITrackingVolumeArrayCreator.hpp" #include "Acts/Utilities/BinnedArray.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" namespace Acts { @@ -38,7 +38,7 @@ public: struct Config { /// The building context - ContextType buildContext = DefaultContext(); + GeometryContext buildContext = DefaultGeometryContext(); }; /// Constructor diff --git a/Core/include/Acts/Utilities/Context.hpp b/Core/include/Acts/Utilities/GeometryContext.hpp similarity index 81% rename from Core/include/Acts/Utilities/Context.hpp rename to Core/include/Acts/Utilities/GeometryContext.hpp index ba4a32f69603cf3c21543c68e8d9dd45d627ca1d..4a4673059f23d9f045b0681954df796a07f49da7 100644 --- a/Core/include/Acts/Utilities/Context.hpp +++ b/Core/include/Acts/Utilities/GeometryContext.hpp @@ -16,8 +16,7 @@ namespace Acts { /// payload object that is propagated through the code /// to allow for event/thread context -using ContextType = boost::any; -using Context = const ContextType&; -using DefaultContext = ContextType; +using GeometryContext = boost::any; +using DefaultGeometryContext = GeometryContext; } // namespace Acts diff --git a/Core/include/Acts/Utilities/GeometryObject.hpp b/Core/include/Acts/Utilities/GeometryObject.hpp index e7691537e5f441259c52411de5ee5cd0d84aa98f..cc85da72e1108596c2f01e88d832acc56090824c 100644 --- a/Core/include/Acts/Utilities/GeometryObject.hpp +++ b/Core/include/Acts/Utilities/GeometryObject.hpp @@ -12,8 +12,8 @@ #pragma once #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometryID.hpp" namespace Acts { @@ -61,23 +61,21 @@ public: /// Force a binning position method /// - /// @param ctx is the Context object to for resolving the - /// relevent event/thread context of the geometry + /// @param gctx The current geometry context object, e.g. alignment /// @param bValue is the value in which you want to bin /// /// @return vector 3D used for the binning schema virtual const Vector3D - binningPosition(Context ctx, BinningValue bValue) const = 0; + binningPosition(const GeometryContext& gctx, BinningValue bValue) const = 0; /// Implement the binningValue /// - /// @param ctx is the Context object to for resolving the - /// relevent event/thread context of the geometry + /// @param gctx The current geometry context object, e.g. alignment /// @param bValue is the dobule in which you want to bin /// /// @return float to be used for the binning schema double - binningPositionValue(Context ctx, BinningValue bValue) const; + binningPositionValue(const GeometryContext& gctx, BinningValue bValue) const; /// Set the value /// @@ -102,26 +100,27 @@ GeometryObject::assignGeoID(const GeometryID& geoID) } inline double -GeometryObject::binningPositionValue(Context ctx, BinningValue bValue) const +GeometryObject::binningPositionValue(const GeometryContext& gctx, + BinningValue bValue) const { using VectorHelpers::perp; // now switch switch (bValue) { // case x case Acts::binX: { - return binningPosition(ctx, bValue).x(); + return binningPosition(gctx, bValue).x(); } break; // case y case Acts::binY: { - return binningPosition(ctx, bValue).y(); + return binningPosition(gctx, bValue).y(); } break; // case z case Acts::binZ: { - return binningPosition(ctx, bValue).z(); + return binningPosition(gctx, bValue).z(); } break; // case case Acts::binR: { - return perp(binningPosition(ctx, bValue)); + return perp(binningPosition(gctx, bValue)); } break; // do nothing for the default default: diff --git a/Core/include/Acts/Utilities/GeometryObjectSorter.hpp b/Core/include/Acts/Utilities/GeometryObjectSorter.hpp index a8f88aa01f5ec4e5afcec08f28d7fd3a8584f1a8..c3e96b0bacb72c28100fc3c2a9d199445a5ae1a1 100644 --- a/Core/include/Acts/Utilities/GeometryObjectSorter.hpp +++ b/Core/include/Acts/Utilities/GeometryObjectSorter.hpp @@ -181,10 +181,10 @@ public: /// /// @param bValue is the value in which the binning is done /// @param transform is an optional transform to be performed - GeometryObjectSorterT(Context ctx, + GeometryObjectSorterT(const GeometryContext& gctx, BinningValue bValue, std::shared_ptr<const Transform3D> transform = nullptr) - : m_context(ctx), m_objectSorter(bValue), m_transform(std::move(transform)) + : m_context(gctx), m_objectSorter(bValue), m_transform(std::move(transform)) { } @@ -211,7 +211,7 @@ public: } protected: - ContextType m_context; + GeometryContext m_context; ObjectSorterT<Vector3D> m_objectSorter; std::shared_ptr<const Transform3D> m_transform; }; diff --git a/Core/include/Acts/Volumes/BoundarySurfaceT.hpp b/Core/include/Acts/Volumes/BoundarySurfaceT.hpp index f7bb83ad004756427e60863c1e0681ddf9bed234..dd119f24e81cbf672febeaa2b79d6164e7e3f8f4 100644 --- a/Core/include/Acts/Volumes/BoundarySurfaceT.hpp +++ b/Core/include/Acts/Volumes/BoundarySurfaceT.hpp @@ -13,8 +13,8 @@ #pragma once #include <memory> #include "Acts/Utilities/BinnedArray.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Volumes/BoundarySurfaceFace.hpp" #include "Acts/Volumes/Volume.hpp" @@ -59,9 +59,9 @@ public: /// Constructor for a Boundary with exact two Volumes attached to it /// - usually used in a volume constructor /// - /// @param surface is the unqiue surface the boundary represents - /// @param inside is the inside volume the bounday surface points to - /// @param outside is the outside volume the boundary surface points to + /// @param surface The unqiue surface the boundary represents + /// @param inside The inside volume the bounday surface points to + /// @param outside The outside volume the boundary surface points to BoundarySurfaceT(std::shared_ptr<const Surface> surface, const T* inside, const T* outside) @@ -76,9 +76,9 @@ public: /// Constructor for a Boundary with exact two Volumes attached to it /// - usually used in a volume constructor /// - /// @param surface is the unqiue surface the boundary represents - /// @param inside is the inside volume the bounday surface points to - /// @param outside is the outside volume the boundary surface points to + /// @param surface The unqiue surface the boundary represents + /// @param inside The inside volume the bounday surface points to + /// @param outside The outside volume the boundary surface points to BoundarySurfaceT(std::shared_ptr<const Surface> surface, VolumePtr inside, VolumePtr outside) @@ -93,10 +93,9 @@ public: /// Constructor for a Boundary with exact multiple Volumes attached to it /// - usually used in a volume constructor /// - /// @param surface is the unqiue surface the boundary represents - /// @param insideArray is the inside volume array the bounday surface points - /// to - /// @param outsideArray is the outside volume array the boundary surface + /// @param surface The unqiue surface the boundary represents + /// @param insideArray The inside volume array the bounday surface points to + /// @param outsideArray The outside volume array the boundary surface /// points to BoundarySurfaceT(std::shared_ptr<const Surface> surface, std::shared_ptr<const VolumeArray> insideArray, @@ -112,29 +111,29 @@ public: /// Get the next Volume depending on GlobalPosition, GlobalMomentum, dir on /// the TrackParameters and the requested direction /// - /// @param ctx is the context for this call (e.g. alingment) - /// @param pos is the global position on surface - /// @param mom is the direction on the surface + /// @param gctx The current geometry context object, e.g. alignment + /// @param pos The global position on surface + /// @param mom The direction on the surface /// @param dir is an aditional direction corrective /// - /// @return is the attached volume at that position + /// @return The attached volume at that position virtual const T* - attachedVolume(Context ctx, - const Vector3D& pos, - const Vector3D& mom, - NavigationDirection pdir) const; + attachedVolume(const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom, + NavigationDirection pdir) const; /// templated onBoundary method /// /// @tparam pars are the parameters to be checked /// - /// @param ctx The context for this call (e.g. alignment) + /// @param gctx The current geometry context object, e.g. alignment /// @param pars The parameters used for this call template <class P> bool - onBoundary(Context ctx, const P& pars) const + onBoundary(const GeometryContext& gctx, const P& pars) const { - return surfaceRepresentation().isOnSurface(ctx, pars); + return surfaceRepresentation().isOnSurface(gctx, pars); } /// The Surface Representation of this @@ -149,9 +148,9 @@ protected: /// this si done during the geometry construction and only called by /// the friend templated volume /// - /// @param ctx The context for this call (e.g. alignment) - /// @param volume is the volume to be attached - /// @param inout is the boundary orientation @todo update to along/opposite + /// @param gctx The current geometry context object, e.g. alignment + /// @param volume The volume to be attached + /// @param inout The boundary orientation @todo update to along/opposite void attachVolume(VolumePtr volume, BoundaryOrientation inout); @@ -159,8 +158,8 @@ protected: /// this si done during the geometry construction and only called by /// the friend templated volume /// - /// @param volumes is the volume array to be attached - /// @param inout is the boundary orientation @todo update to along/opposite + /// @param volumes The volume array to be attached + /// @param inout The boundary orientation @todo update to along/opposite void attachVolumeArray(std::shared_ptr<const VolumeArray> volumes, BoundaryOrientation inout); @@ -210,14 +209,14 @@ BoundarySurfaceT<T>::attachVolumeArray( template <class T> const T* -BoundarySurfaceT<T>::attachedVolume(Context ctx, - const Vector3D& pos, - const Vector3D& mom, - NavigationDirection pdir) const +BoundarySurfaceT<T>::attachedVolume(const GeometryContext& gctx, + const Vector3D& pos, + const Vector3D& mom, + NavigationDirection pdir) const { const T* attVolume = nullptr; // dot product with normal vector to distinguish inside/outside - if ((surfaceRepresentation().normal(ctx, pos)).dot(pdir * mom) > 0.) { + if ((surfaceRepresentation().normal(gctx, pos)).dot(pdir * mom) > 0.) { attVolume = m_outsideVolumeArray ? m_outsideVolumeArray->object(pos).get() : m_outsideVolume; } else { diff --git a/Core/include/Acts/Volumes/Volume.hpp b/Core/include/Acts/Volumes/Volume.hpp index 1dd5787b22be49521e9200a9f1be9517ba8547d3..d9cfae64ff55314318bdece1c49bf646083df75f 100644 --- a/Core/include/Acts/Volumes/Volume.hpp +++ b/Core/include/Acts/Volumes/Volume.hpp @@ -11,8 +11,8 @@ /////////////////////////////////////////////////////////////////// #pragma once #include <memory> -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/GeometryObject.hpp" #include "Acts/Utilities/GeometryStatics.hpp" @@ -85,12 +85,13 @@ public: /// The binning position method /// - as default the center is given, but may be overloaded /// - /// @param ctx is the context under which this is asked + /// @param gctx The current geometry context object, e.g. alignment /// @param bValue is the binning value schema /// /// @return vector 3D that can be used for the binning const Vector3D - binningPosition(Context ctx, BinningValue bValue) const override; + binningPosition(const GeometryContext& gctx, + BinningValue bValue) const override; protected: std::shared_ptr<const Transform3D> m_transform; diff --git a/Core/src/Detector/TrackingGeometry.cpp b/Core/src/Detector/TrackingGeometry.cpp index 1b9401c6a163b2583b9bbb15e7b7fd5f867676e4..e89f52e635487ce095daf1b7aae43002e8ca84ef 100644 --- a/Core/src/Detector/TrackingGeometry.cpp +++ b/Core/src/Detector/TrackingGeometry.cpp @@ -31,14 +31,14 @@ Acts::TrackingGeometry::TrackingGeometry( Acts::TrackingGeometry::~TrackingGeometry() = default; const Acts::TrackingVolume* -Acts::TrackingGeometry::trackingVolume(Context ctx, - const Acts::Vector3D& gp) const +Acts::TrackingGeometry::trackingVolume(const GeometryContext& gctx, + const Acts::Vector3D& gp) const { const TrackingVolume* searchVolume = m_world.get(); const TrackingVolume* currentVolume = nullptr; while (currentVolume != searchVolume && (searchVolume != nullptr)) { currentVolume = searchVolume; - searchVolume = searchVolume->trackingVolume(ctx, gp); + searchVolume = searchVolume->trackingVolume(gctx, gp); } return currentVolume; } @@ -68,11 +68,11 @@ Acts::TrackingGeometry::trackingVolume(const std::string& name) const } const Acts::Layer* -Acts::TrackingGeometry::associatedLayer(Context ctx, - const Acts::Vector3D& gp) const +Acts::TrackingGeometry::associatedLayer(const GeometryContext& gctx, + const Acts::Vector3D& gp) const { - const TrackingVolume* lowestVol = (trackingVolume(ctx, gp)); - return lowestVol->associatedLayer(ctx, gp); + const TrackingVolume* lowestVol = (trackingVolume(gctx, gp)); + return lowestVol->associatedLayer(gctx, gp); } void diff --git a/Core/src/Detector/TrackingVolume.cpp b/Core/src/Detector/TrackingVolume.cpp index 57c01a9f3766ac967e13ff6016ab967a26fd0e60..5c163cb124f1b5f8680c9b75a58deccbda192237 100644 --- a/Core/src/Detector/TrackingVolume.cpp +++ b/Core/src/Detector/TrackingVolume.cpp @@ -70,7 +70,8 @@ Acts::TrackingVolume::~TrackingVolume() } const Acts::TrackingVolume* -Acts::TrackingVolume::trackingVolume(Context /*ctx*/, const Vector3D& gp) const +Acts::TrackingVolume::trackingVolume(const GeometryContext& /*gctx*/, + const Vector3D& gp) const { // confined static volumes - highest hierarchy if (m_confinedVolumes) { @@ -143,16 +144,16 @@ Acts::TrackingVolume::glueTrackingVolume( // find the connection of the two tracking volumes : binR returns the center // except for cylindrical volumes - Vector3D bPosition(binningPosition(DefaultContext(), binR)); - Vector3D distance - = Vector3D(neighbor->binningPosition(DefaultContext(), binR) - bPosition); + Vector3D bPosition(binningPosition(DefaultGeometryContext(), binR)); + Vector3D distance = Vector3D( + neighbor->binningPosition(DefaultGeometryContext(), 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( - DefaultContext(), bPosition); + DefaultGeometryContext(), bPosition); // estimate the orientation BoundaryOrientation bOrientation = (normal.dot(distance) > 0.) ? outsideVolume : insideVolume; @@ -181,16 +182,16 @@ Acts::TrackingVolume::glueTrackingVolumes( std::shared_ptr<const TrackingVolume> nRefVolume = neighbors->arrayObjects().at(0); // get the distance - Vector3D bPosition(binningPosition(DefaultContext(), binR)); + Vector3D bPosition(binningPosition(DefaultGeometryContext(), binR)); Vector3D distance = Vector3D( - nRefVolume->binningPosition(DefaultContext(), binR) - bPosition); + nRefVolume->binningPosition(DefaultGeometryContext(), 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( - DefaultContext(), bPosition); + DefaultGeometryContext(), bPosition); // estimate the orientation BoundaryOrientation bOrientation = (normal.dot(distance) > 0.) ? outsideVolume : insideVolume; diff --git a/Core/src/Layers/GenericApproachDescriptor.cpp b/Core/src/Layers/GenericApproachDescriptor.cpp index 21510f232a169390b7400c7dbbeaf159e1773a92..8d370ef5e4531469121c2f1ed8a368a1fe9a22ce 100644 --- a/Core/src/Layers/GenericApproachDescriptor.cpp +++ b/Core/src/Layers/GenericApproachDescriptor.cpp @@ -21,11 +21,11 @@ Acts::GenericApproachDescriptor::registerLayer(const Layer& lay) } Acts::ObjectIntersection<Acts::Surface> -Acts::GenericApproachDescriptor::approachSurface(Context ctx, - const Vector3D& gpos, - const Vector3D& gdir, - NavigationDirection navDir, - const BoundaryCheck& bcheck, +Acts::GenericApproachDescriptor::approachSurface(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gdir, + NavigationDirection navDir, + const BoundaryCheck& bcheck, CorrFnc corrfnc) const { // the intersection estimates @@ -34,7 +34,7 @@ Acts::GenericApproachDescriptor::approachSurface(Context ctx, for (auto& sf : m_surfaceCache) { // intersect auto intersection - = sf->intersectionEstimate(ctx, gpos, gdir, navDir, bcheck, corrfnc); + = sf->intersectionEstimate(gctx, gpos, gdir, navDir, bcheck, corrfnc); sIntersections.push_back( ObjectIntersection<Surface>(intersection, sf, navDir)); } diff --git a/Core/src/Layers/PlaneLayer.cpp b/Core/src/Layers/PlaneLayer.cpp index 6a6bcdd5047e26b582c789dc63ea1ed387ea57b2..ae4bce274ce2ab6f0f3811d1ac366df0c67e1026 100644 --- a/Core/src/Layers/PlaneLayer.cpp +++ b/Core/src/Layers/PlaneLayer.cpp @@ -63,10 +63,11 @@ Acts::PlaneLayer::buildApproachDescriptor() // get the appropriate transform, the center and the normal vector //@todo fix with representing volume - const Transform3D& lTransform = PlaneSurface::transform(DefaultContext()); - RotationMatrix3D lRotation = lTransform.rotation(); - const Vector3D& lCenter = PlaneSurface::center(DefaultContext()); - const Vector3D& lVector = Surface::normal(DefaultContext(), lCenter); + const Transform3D& lTransform + = PlaneSurface::transform(DefaultGeometryContext()); + RotationMatrix3D lRotation = lTransform.rotation(); + const Vector3D& lCenter = PlaneSurface::center(DefaultGeometryContext()); + const Vector3D& lVector = Surface::normal(DefaultGeometryContext(), lCenter); // create new surfaces const Transform3D* apnTransform = new Transform3D( Translation3D(lCenter - 0.5 * Layer::m_layerThickness * lVector) diff --git a/Core/src/Layers/ProtoLayer.cpp b/Core/src/Layers/ProtoLayer.cpp index 13d72b6616a7e4d738a86645d521b365be0efc96..80fb77eb31fcc86a43722ed47391085c8d3af513 100644 --- a/Core/src/Layers/ProtoLayer.cpp +++ b/Core/src/Layers/ProtoLayer.cpp @@ -20,16 +20,17 @@ using Acts::VectorHelpers::perp; namespace Acts { -ProtoLayer::ProtoLayer(Context ctx, const std::vector<const Surface*>& surfaces) +ProtoLayer::ProtoLayer(const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces) { - measure(ctx, surfaces); + measure(gctx, surfaces); } ProtoLayer::ProtoLayer( - Context ctx, + const GeometryContext& gctx, const std::vector<std::shared_ptr<const Surface>>& surfaces) { - measure(ctx, unpack_shared_vector(surfaces)); + measure(gctx, unpack_shared_vector(surfaces)); } double @@ -73,7 +74,8 @@ ProtoLayer::toStream(std::ostream& sl) const } void -ProtoLayer::measure(Context ctx, const std::vector<const Surface*>& surfaces) +ProtoLayer::measure(const GeometryContext& gctx, + const std::vector<const Surface*>& surfaces) { minR = std::numeric_limits<double>::max(); maxR = std::numeric_limits<double>::lowest(); @@ -103,7 +105,7 @@ ProtoLayer::measure(Context ctx, const std::vector<const Surface*>& surfaces) = dynamic_cast<const CylinderSurface*>(sf); if (pBounds != nullptr) { - const auto& sTransform = sf->transform(ctx); + const auto& sTransform = sf->transform(gctx); // get the vertices std::vector<Vector2D> vertices = pBounds->vertices(); @@ -147,7 +149,7 @@ ProtoLayer::measure(Context ctx, const std::vector<const Surface*>& surfaces) // makes it into the Surface base class // The envelopes might need special treatments though - PolyhedronRepresentation ph = cylSurface->polyhedronRepresentation(ctx); + PolyhedronRepresentation ph = cylSurface->polyhedronRepresentation(gctx); // evaluate at all vertices for (const auto& vtx : ph.vertices) { maxX = std::max(maxX, vtx.x()); @@ -183,7 +185,7 @@ ProtoLayer::measure(Context ctx, const std::vector<const Surface*>& surfaces) envR = {env, env}; // evaluate impact of r shift on phi - double cylPosR = perp(cylSurface->center(ctx)); + double cylPosR = perp(cylSurface->center(gctx)); double dPhi = std::atan((cylBoundsR + env) / cylPosR) - std::atan(cylBoundsR / cylPosR); @@ -197,7 +199,7 @@ ProtoLayer::measure(Context ctx, const std::vector<const Surface*>& surfaces) if (cBounds != nullptr) { double r = cBounds->r(); - double z = sf->center(ctx).z(); + double z = sf->center(gctx).z(); double hZ = cBounds->halflengthZ(); double phi = cBounds->averagePhi(); double hPhi = cBounds->halfPhiSector(); diff --git a/Core/src/Surfaces/ConeSurface.cpp b/Core/src/Surfaces/ConeSurface.cpp index 6b6387b6df9e36151d1d4efee85c8f0111ed6adc..b5fae513fb806430d5268b39f6e8a2cbf67850c1 100644 --- a/Core/src/Surfaces/ConeSurface.cpp +++ b/Core/src/Surfaces/ConeSurface.cpp @@ -29,10 +29,10 @@ Acts::ConeSurface::ConeSurface(const ConeSurface& other) { } -Acts::ConeSurface::ConeSurface(Context ctx, - const ConeSurface& other, - const Transform3D& transf) - : GeometryObject(), Surface(ctx, other, transf), m_bounds(other.m_bounds) +Acts::ConeSurface::ConeSurface(const GeometryContext& gctx, + const ConeSurface& other, + const Transform3D& transf) + : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) { } @@ -64,10 +64,11 @@ Acts::ConeSurface::ConeSurface(std::shared_ptr<const Transform3D> htrans, } const Acts::Vector3D -Acts::ConeSurface::binningPosition(Context ctx, Acts::BinningValue bValue) const +Acts::ConeSurface::binningPosition(const GeometryContext& gctx, + Acts::BinningValue bValue) const { - const Vector3D& sfCenter = center(ctx); + const Vector3D& sfCenter = center(gctx); // special binning type for R-type methods if (bValue == Acts::binR || bValue == Acts::binRPhi) { @@ -96,20 +97,20 @@ Acts::ConeSurface::operator=(const ConeSurface& other) } const Acts::Vector3D -Acts::ConeSurface::rotSymmetryAxis(Context ctx) const +Acts::ConeSurface::rotSymmetryAxis(const GeometryContext& gctx) const { - return std::move(transform(ctx).matrix().block<3, 1>(0, 2)); + return std::move(transform(gctx).matrix().block<3, 1>(0, 2)); } const Acts::RotationMatrix3D -Acts::ConeSurface::referenceFrame(Context ctx, - const Vector3D& pos, +Acts::ConeSurface::referenceFrame(const GeometryContext& gctx, + const Vector3D& pos, const Vector3D& /*unused*/) const { RotationMatrix3D mFrame; // construct the measurement frame // measured Y is the local z axis - Vector3D measY = rotSymmetryAxis(ctx); + Vector3D measY = rotSymmetryAxis(gctx); // measured z is the position transverse normalized Vector3D measDepth = Vector3D(pos.x(), pos.y(), 0.).normalized(); // measured X is what comoes out of it @@ -125,8 +126,8 @@ Acts::ConeSurface::referenceFrame(Context ctx, } void -Acts::ConeSurface::localToGlobal(Context ctx, - const Vector2D& lpos, +Acts::ConeSurface::localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, const Vector3D& /*unused*/, Vector3D& gpos) const { @@ -136,17 +137,17 @@ Acts::ConeSurface::localToGlobal(Context ctx, Vector3D loc3Dframe(r * cos(phi), r * sin(phi), lpos[Acts::eLOC_Z]); // transport it to the globalframe if (m_transform) { - gpos = transform(ctx) * loc3Dframe; + gpos = transform(gctx) * loc3Dframe; } } bool -Acts::ConeSurface::globalToLocal(Context ctx, - const Vector3D& gpos, +Acts::ConeSurface::globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, const Vector3D& /*unused*/, Vector2D& lpos) const { - Vector3D loc3Dframe = m_transform ? (transform(ctx).inverse() * gpos) : gpos; + Vector3D loc3Dframe = m_transform ? (transform(gctx).inverse() * gpos) : gpos; double r = loc3Dframe.z() * bounds().tanAlpha(); lpos = Vector2D(r * atan2(loc3Dframe.y(), loc3Dframe.x()), loc3Dframe.z()); // now decide on the quility of the transformation @@ -156,19 +157,19 @@ Acts::ConeSurface::globalToLocal(Context ctx, } double -Acts::ConeSurface::pathCorrection(Context ctx, - const Vector3D& gpos, - const Vector3D& mom) const +Acts::ConeSurface::pathCorrection(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& mom) const { // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha) - Vector3D posLocal = m_transform ? transform(ctx).inverse() * gpos : gpos; + Vector3D posLocal = m_transform ? transform(gctx).inverse() * gpos : gpos; double phi = VectorHelpers::phi(posLocal); double sgn = posLocal.z() > 0. ? -1. : +1.; Vector3D normalC(cos(phi) * bounds().cosAlpha(), sin(phi) * bounds().cosAlpha(), sgn * bounds().sinAlpha()); if (m_transform) { - normalC = transform(ctx) * normalC; + normalC = transform(gctx) * normalC; } // back in global frame double cAlpha = normalC.dot(mom.normalized()); @@ -182,19 +183,22 @@ Acts::ConeSurface::name() const } std::shared_ptr<Acts::ConeSurface> -Acts::ConeSurface::clone(Context ctx, const Transform3D& shift) const +Acts::ConeSurface::clone(const GeometryContext& gctx, + const Transform3D& shift) const { - return std::shared_ptr<ConeSurface>(this->clone_impl(ctx, shift)); + return std::shared_ptr<ConeSurface>(this->clone_impl(gctx, shift)); } Acts::ConeSurface* -Acts::ConeSurface::clone_impl(Context ctx, const Transform3D& shift) const +Acts::ConeSurface::clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const { - return new ConeSurface(ctx, *this, shift); + return new ConeSurface(gctx, *this, shift); } const Acts::Vector3D -Acts::ConeSurface::normal(Context ctx, const Acts::Vector2D& lp) const +Acts::ConeSurface::normal(const GeometryContext& gctx, + const Acts::Vector2D& lp) const { // (cos phi cos alpha, sin phi cos alpha, sgn z sin alpha) double phi = lp[Acts::eLOC_RPHI] / (bounds().r(lp[Acts::eLOC_Z])), @@ -202,18 +206,19 @@ Acts::ConeSurface::normal(Context ctx, const Acts::Vector2D& lp) const Vector3D localNormal(cos(phi) * bounds().cosAlpha(), sin(phi) * bounds().cosAlpha(), sgn * bounds().sinAlpha()); - return m_transform ? Vector3D(transform(ctx).linear() * localNormal) + return m_transform ? Vector3D(transform(gctx).linear() * localNormal) : localNormal; } const Acts::Vector3D -Acts::ConeSurface::normal(Context ctx, const Acts::Vector3D& gpos) const +Acts::ConeSurface::normal(const GeometryContext& gctx, + const Acts::Vector3D& gpos) const { // get it into the cylinder frame if needed // @todo respect opening angle Vector3D pos3D = gpos; if (m_transform || (m_associatedDetElement != nullptr)) { - pos3D = transform(ctx).inverse() * gpos; + pos3D = transform(gctx).inverse() * gpos; pos3D.z() = 0; } return pos3D.normalized(); diff --git a/Core/src/Surfaces/CylinderSurface.cpp b/Core/src/Surfaces/CylinderSurface.cpp index 9c8cdaf7dd440d89d396193f8400b7a320d03ea3..a2ae49a6dff0b58f71c422b3e12364a819ebaa90 100644 --- a/Core/src/Surfaces/CylinderSurface.cpp +++ b/Core/src/Surfaces/CylinderSurface.cpp @@ -29,10 +29,10 @@ Acts::CylinderSurface::CylinderSurface(const CylinderSurface& other) { } -Acts::CylinderSurface::CylinderSurface(Context ctx, +Acts::CylinderSurface::CylinderSurface(const GeometryContext& gctx, const CylinderSurface& other, const Transform3D& transf) - : GeometryObject(), Surface(ctx, other, transf), m_bounds(other.m_bounds) + : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) { } @@ -86,10 +86,11 @@ Acts::CylinderSurface::operator=(const CylinderSurface& other) // return the binning position for ordering in the BinnedArray const Acts::Vector3D -Acts::CylinderSurface::binningPosition(Context ctx, BinningValue bValue) const +Acts::CylinderSurface::binningPosition(const GeometryContext& gctx, + BinningValue bValue) const { - const Acts::Vector3D& sfCenter = center(ctx); + const Acts::Vector3D& sfCenter = center(gctx); // special binning type for R-type methods if (bValue == Acts::binR || bValue == Acts::binRPhi) { double R = bounds().r(); @@ -104,16 +105,16 @@ Acts::CylinderSurface::binningPosition(Context ctx, BinningValue bValue) const // return the measurement frame: it's the tangential plane const Acts::RotationMatrix3D -Acts::CylinderSurface::referenceFrame(Context ctx, - const Vector3D& gpos, +Acts::CylinderSurface::referenceFrame(const GeometryContext& gctx, + const Vector3D& gpos, const Vector3D& /*unused*/) const { RotationMatrix3D mFrame; // construct the measurement frame // measured Y is the z axis - Vector3D measY = rotSymmetryAxis(ctx); + Vector3D measY = rotSymmetryAxis(gctx); // measured z is the position normalized transverse (in local) - Vector3D measDepth = normal(ctx, gpos); + Vector3D measDepth = normal(gctx, gpos); // measured X is what comoes out of it Vector3D measX(measY.cross(measDepth).normalized()); // assign the columnes @@ -131,8 +132,8 @@ Acts::CylinderSurface::type() const } void -Acts::CylinderSurface::localToGlobal(Context ctx, - const Vector2D& lpos, +Acts::CylinderSurface::localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, const Vector3D& /*unused*/, Vector3D& gpos) const { @@ -140,12 +141,12 @@ Acts::CylinderSurface::localToGlobal(Context ctx, double r = bounds().r(); double phi = lpos[Acts::eLOC_RPHI] / r; gpos = Vector3D(r * cos(phi), r * sin(phi), lpos[Acts::eLOC_Z]); - gpos = transform(ctx) * gpos; + gpos = transform(gctx) * gpos; } bool -Acts::CylinderSurface::globalToLocal(Context ctx, - const Vector3D& gpos, +Acts::CylinderSurface::globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, const Vector3D& /*unused*/, Vector2D& lpos) const { @@ -159,7 +160,7 @@ Acts::CylinderSurface::globalToLocal(Context ctx, inttol = 0.01; } - const Transform3D& sfTransform = transform(ctx); + const Transform3D& sfTransform = transform(gctx); Transform3D inverseTrans(sfTransform.inverse()); Vector3D loc3Dframe(inverseTrans * gpos); lpos = Vector2D(bounds().r() * phi(loc3Dframe), loc3Dframe.z()); @@ -175,29 +176,33 @@ Acts::CylinderSurface::name() const } std::shared_ptr<Acts::CylinderSurface> -Acts::CylinderSurface::clone(Context ctx, const Transform3D& shift) const +Acts::CylinderSurface::clone(const GeometryContext& gctx, + const Transform3D& shift) const { - return std::shared_ptr<CylinderSurface>(this->clone_impl(ctx, shift)); + return std::shared_ptr<CylinderSurface>(this->clone_impl(gctx, shift)); } Acts::CylinderSurface* -Acts::CylinderSurface::clone_impl(Context ctx, const Transform3D& shift) const +Acts::CylinderSurface::clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const { - return new CylinderSurface(ctx, *this, shift); + return new CylinderSurface(gctx, *this, shift); } const Acts::Vector3D -Acts::CylinderSurface::normal(Context ctx, const Acts::Vector2D& lpos) const +Acts::CylinderSurface::normal(const GeometryContext& gctx, + const Acts::Vector2D& lpos) const { double phi = lpos[Acts::eLOC_RPHI] / m_bounds->r(); Vector3D localNormal(cos(phi), sin(phi), 0.); - return Vector3D(transform(ctx).matrix().block<3, 3>(0, 0) * localNormal); + return Vector3D(transform(gctx).matrix().block<3, 3>(0, 0) * localNormal); } const Acts::Vector3D -Acts::CylinderSurface::normal(Context ctx, const Acts::Vector3D& gpos) const +Acts::CylinderSurface::normal(const GeometryContext& gctx, + const Acts::Vector3D& gpos) const { - const Transform3D& sfTransform = transform(ctx); + const Transform3D& sfTransform = transform(gctx); // get it into the cylinder frame Vector3D pos3D = sfTransform.inverse() * gpos; // set the z coordinate to 0 @@ -207,11 +212,11 @@ Acts::CylinderSurface::normal(Context ctx, const Acts::Vector3D& gpos) const } double -Acts::CylinderSurface::pathCorrection(Context ctx, - const Acts::Vector3D& gpos, - const Acts::Vector3D& mom) const +Acts::CylinderSurface::pathCorrection(const GeometryContext& gctx, + const Acts::Vector3D& gpos, + const Acts::Vector3D& mom) const { - Vector3D normalT = normal(ctx, gpos); + Vector3D normalT = normal(gctx, gpos); double cosAlpha = normalT.dot(mom.normalized()); return std::fabs(1. / cosAlpha); } @@ -223,8 +228,8 @@ Acts::CylinderSurface::bounds() const } Acts::PolyhedronRepresentation -Acts::CylinderSurface::polyhedronRepresentation(Context ctx, - size_t l0div, +Acts::CylinderSurface::polyhedronRepresentation(const GeometryContext& gctx, + size_t l0div, size_t /*unused*/) const { std::vector<Vector3D> vertices; @@ -242,7 +247,7 @@ Acts::CylinderSurface::polyhedronRepresentation(Context ctx, Vector3D left(r, 0, -hlZ); Vector3D right(r, 0, hlZ); - const Transform3D& sfTransform = transform(ctx); + const Transform3D& sfTransform = transform(gctx); for (size_t i = 0; i < l0div; i++) { Transform3D rot(AngleAxis3D(i * phistep, Vector3D::UnitZ())); diff --git a/Core/src/Surfaces/DiscSurface.cpp b/Core/src/Surfaces/DiscSurface.cpp index 220257051b525e76444edec38a953f8a52c11b23..c4db89acc24c5c7e1e7821006dba4554941e0269 100644 --- a/Core/src/Surfaces/DiscSurface.cpp +++ b/Core/src/Surfaces/DiscSurface.cpp @@ -32,10 +32,10 @@ Acts::DiscSurface::DiscSurface(const DiscSurface& other) { } -Acts::DiscSurface::DiscSurface(Context ctx, - const DiscSurface& other, - const Transform3D& transf) - : GeometryObject(), Surface(ctx, other, transf), m_bounds(other.m_bounds) +Acts::DiscSurface::DiscSurface(const GeometryContext& gctx, + const DiscSurface& other, + const Transform3D& transf) + : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) { } @@ -97,8 +97,8 @@ Acts::DiscSurface::type() const } void -Acts::DiscSurface::localToGlobal(Context ctx, - const Vector2D& lpos, +Acts::DiscSurface::localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, const Vector3D& /*gmom*/, Vector3D& gpos) const { @@ -107,17 +107,17 @@ Acts::DiscSurface::localToGlobal(Context ctx, lpos[Acts::eLOC_R] * sin(lpos[Acts::eLOC_PHI]), 0.); // transport it to the globalframe (very unlikely that this is not needed) - gpos = transform(ctx) * loc3Dframe; + gpos = transform(gctx) * loc3Dframe; } bool -Acts::DiscSurface::globalToLocal(Context ctx, - const Vector3D& gpos, +Acts::DiscSurface::globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, const Vector3D& /*gmom*/, Vector2D& lpos) const { // transport it to the globalframe (very unlikely that this is not needed) - Vector3D loc3Dframe = (transform(ctx).inverse()) * gpos; + Vector3D loc3Dframe = (transform(gctx).inverse()) * gpos; lpos = Acts::Vector2D(perp(loc3Dframe), phi(loc3Dframe)); return ((std::abs(loc3Dframe.z()) > s_onSurfaceTolerance) ? false : true); } @@ -146,19 +146,19 @@ Acts::DiscSurface::localPolarToLocalCartesian(const Vector2D& locpol) const } const Acts::Vector3D -Acts::DiscSurface::localCartesianToGlobal(Context ctx, - const Vector2D& lpos) const +Acts::DiscSurface::localCartesianToGlobal(const GeometryContext& gctx, + const Vector2D& lpos) const { Vector3D loc3Dframe(lpos[Acts::eLOC_X], lpos[Acts::eLOC_Y], 0.); - return Vector3D(transform(ctx) * loc3Dframe); + return Vector3D(transform(gctx) * loc3Dframe); } const Acts::Vector2D -Acts::DiscSurface::globalToLocalCartesian(Context ctx, - const Vector3D& gpos, +Acts::DiscSurface::globalToLocalCartesian(const GeometryContext& gctx, + const Vector3D& gpos, double /*unused*/) const { - Vector3D loc3Dframe = (transform(ctx).inverse()) * gpos; + Vector3D loc3Dframe = (transform(gctx).inverse()) * gpos; return Vector2D(loc3Dframe.x(), loc3Dframe.y()); } @@ -169,15 +169,17 @@ Acts::DiscSurface::name() const } std::shared_ptr<Acts::DiscSurface> -Acts::DiscSurface::clone(Context ctx, const Transform3D& shift) const +Acts::DiscSurface::clone(const GeometryContext& gctx, + const Transform3D& shift) const { - return std::shared_ptr<DiscSurface>(this->clone_impl(ctx, shift)); + return std::shared_ptr<DiscSurface>(this->clone_impl(gctx, shift)); } Acts::DiscSurface* -Acts::DiscSurface::clone_impl(Context ctx, const Transform3D& shift) const +Acts::DiscSurface::clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const { - return new DiscSurface(ctx, *this, shift); + return new DiscSurface(gctx, *this, shift); } const Acts::SurfaceBounds& @@ -190,8 +192,8 @@ Acts::DiscSurface::bounds() const } Acts::PolyhedronRepresentation -Acts::DiscSurface::polyhedronRepresentation(Context ctx, - size_t l0div, +Acts::DiscSurface::polyhedronRepresentation(const GeometryContext& gctx, + size_t l0div, size_t /*unused*/) const { std::vector<Vector3D> vertices; @@ -214,7 +216,7 @@ Acts::DiscSurface::polyhedronRepresentation(Context ctx, Vector3D inner(rMin, 0, 0); Vector3D outer(rMax, 0, 0); - const Transform3D& sfTransform = transform(ctx); + const Transform3D& sfTransform = transform(gctx); for (size_t i = 0; i < l0div; i++) { Transform3D rot(AngleAxis3D(i * phistep, Vector3D::UnitZ())); diff --git a/Core/src/Surfaces/LineSurface.cpp b/Core/src/Surfaces/LineSurface.cpp index ce8860adaaf530c4b848429bb73fa9783b5c5c92..76660bfdb5c09da629013f320755d75302c45639 100644 --- a/Core/src/Surfaces/LineSurface.cpp +++ b/Core/src/Surfaces/LineSurface.cpp @@ -46,10 +46,10 @@ Acts::LineSurface::LineSurface(const LineSurface& other) { } -Acts::LineSurface::LineSurface(Context ctx, - const LineSurface& other, - const Transform3D& transf) - : GeometryObject(), Surface(ctx, other, transf), m_bounds(other.m_bounds) +Acts::LineSurface::LineSurface(const GeometryContext& gctx, + const LineSurface& other, + const Transform3D& transf) + : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) { } diff --git a/Core/src/Surfaces/PerigeeSurface.cpp b/Core/src/Surfaces/PerigeeSurface.cpp index 0d8cc8caaf5ef2d87042cb5cfeea0c54556e0ebe..038a3a358a202a78b1b478a2ef0ffba82da12ecc 100644 --- a/Core/src/Surfaces/PerigeeSurface.cpp +++ b/Core/src/Surfaces/PerigeeSurface.cpp @@ -34,10 +34,10 @@ Acts::PerigeeSurface::PerigeeSurface(const PerigeeSurface& other) { } -Acts::PerigeeSurface::PerigeeSurface(Context ctx, - const PerigeeSurface& other, - const Transform3D& transf) - : GeometryObject(), LineSurface(ctx, other, transf) +Acts::PerigeeSurface::PerigeeSurface(const GeometryContext& gctx, + const PerigeeSurface& other, + const Transform3D& transf) + : GeometryObject(), LineSurface(gctx, other, transf) { } @@ -52,15 +52,17 @@ Acts::PerigeeSurface::operator=(const PerigeeSurface& other) } std::shared_ptr<Acts::PerigeeSurface> -Acts::PerigeeSurface::clone(Context ctx, const Transform3D& shift) const +Acts::PerigeeSurface::clone(const GeometryContext& gctx, + const Transform3D& shift) const { - return std::shared_ptr<PerigeeSurface>(this->clone_impl(ctx, shift)); + return std::shared_ptr<PerigeeSurface>(this->clone_impl(gctx, shift)); } Acts::PerigeeSurface* -Acts::PerigeeSurface::clone_impl(Context ctx, const Transform3D& shift) const +Acts::PerigeeSurface::clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const { - return new PerigeeSurface(ctx, *this, shift); + return new PerigeeSurface(gctx, *this, shift); } Acts::Surface::SurfaceType @@ -76,12 +78,13 @@ Acts::PerigeeSurface::name() const } std::ostream& -Acts::PerigeeSurface::toStream(Context ctx, std::ostream& sl) const +Acts::PerigeeSurface::toStream(const GeometryContext& gctx, + std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(7); sl << "Acts::PerigeeSurface:" << std::endl; - const Vector3D& sfCenter = center(ctx); + const Vector3D& sfCenter = center(gctx); sl << " Center position (x, y, z) = (" << sfCenter.x() << ", " << sfCenter.y() << ", " << sfCenter.z() << ")"; sl << std::setprecision(-1); diff --git a/Core/src/Surfaces/PlaneSurface.cpp b/Core/src/Surfaces/PlaneSurface.cpp index 3e8ecee9fa811333c9db5db2e3d51f59c599e58f..dad2e30d736f4ec4aa3eb64be45aa064835b1b13 100644 --- a/Core/src/Surfaces/PlaneSurface.cpp +++ b/Core/src/Surfaces/PlaneSurface.cpp @@ -25,10 +25,10 @@ Acts::PlaneSurface::PlaneSurface(const PlaneSurface& other) { } -Acts::PlaneSurface::PlaneSurface(Context ctx, - const PlaneSurface& other, - const Transform3D& transf) - : GeometryObject(), Surface(ctx, other, transf), m_bounds(other.m_bounds) +Acts::PlaneSurface::PlaneSurface(const GeometryContext& gctx, + const PlaneSurface& other, + const Transform3D& transf) + : GeometryObject(), Surface(gctx, other, transf), m_bounds(other.m_bounds) { } @@ -87,24 +87,24 @@ Acts::PlaneSurface::type() const } void -Acts::PlaneSurface::localToGlobal(Context ctx, - const Vector2D& lpos, +Acts::PlaneSurface::localToGlobal(const GeometryContext& gctx, + const Vector2D& lpos, const Vector3D& /*gmom*/, Vector3D& gpos) const { Vector3D loc3Dframe(lpos[Acts::eLOC_X], lpos[Acts::eLOC_Y], 0.); /// the chance that there is no transform is almost 0, let's apply it - gpos = transform(ctx) * loc3Dframe; + gpos = transform(gctx) * loc3Dframe; } bool -Acts::PlaneSurface::globalToLocal(Context ctx, - const Vector3D& gpos, +Acts::PlaneSurface::globalToLocal(const GeometryContext& gctx, + const Vector3D& gpos, const Vector3D& /*gmom*/, Acts::Vector2D& lpos) const { /// the chance that there is no transform is almost 0, let's apply it - Vector3D loc3Dframe = (transform(ctx).inverse()) * gpos; + Vector3D loc3Dframe = (transform(gctx).inverse()) * gpos; lpos = Vector2D(loc3Dframe.x(), loc3Dframe.y()); return ((loc3Dframe.z() * loc3Dframe.z() > s_onSurfaceTolerance * s_onSurfaceTolerance) @@ -119,15 +119,17 @@ Acts::PlaneSurface::name() const } std::shared_ptr<Acts::PlaneSurface> -Acts::PlaneSurface::clone(Context ctx, const Transform3D& shift) const +Acts::PlaneSurface::clone(const GeometryContext& gctx, + const Transform3D& shift) const { - return std::shared_ptr<PlaneSurface>(this->clone_impl(ctx, shift)); + return std::shared_ptr<PlaneSurface>(this->clone_impl(gctx, shift)); } Acts::PlaneSurface* -Acts::PlaneSurface::clone_impl(Context ctx, const Transform3D& shift) const +Acts::PlaneSurface::clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const { - return new PlaneSurface(ctx, *this, shift); + return new PlaneSurface(gctx, *this, shift); } const Acts::SurfaceBounds& diff --git a/Core/src/Surfaces/StrawSurface.cpp b/Core/src/Surfaces/StrawSurface.cpp index 85e38b66122022007228003b14adb40fa234f85c..db8401577b75e98c82e49367172a0f4b904c5496 100644 --- a/Core/src/Surfaces/StrawSurface.cpp +++ b/Core/src/Surfaces/StrawSurface.cpp @@ -44,10 +44,10 @@ Acts::StrawSurface::StrawSurface(const Acts::StrawSurface& other) { } -Acts::StrawSurface::StrawSurface(Context ctx, - const StrawSurface& other, - const Transform3D& transf) - : GeometryObject(), LineSurface(ctx, other, transf) +Acts::StrawSurface::StrawSurface(const GeometryContext& gctx, + const StrawSurface& other, + const Transform3D& transf) + : GeometryObject(), LineSurface(gctx, other, transf) { } @@ -62,20 +62,22 @@ Acts::StrawSurface::operator=(const StrawSurface& other) } std::shared_ptr<Acts::StrawSurface> -Acts::StrawSurface::clone(Context ctx, const Transform3D& shift) const +Acts::StrawSurface::clone(const GeometryContext& gctx, + const Transform3D& shift) const { - return std::shared_ptr<StrawSurface>(this->clone_impl(ctx, shift)); + return std::shared_ptr<StrawSurface>(this->clone_impl(gctx, shift)); } Acts::StrawSurface* -Acts::StrawSurface::clone_impl(Context ctx, const Transform3D& shift) const +Acts::StrawSurface::clone_impl(const GeometryContext& gctx, + const Transform3D& shift) const { - return new StrawSurface(ctx, *this, shift); + return new StrawSurface(gctx, *this, shift); } Acts::PolyhedronRepresentation -Acts::StrawSurface::polyhedronRepresentation(Context ctx, - size_t l0div, +Acts::StrawSurface::polyhedronRepresentation(const GeometryContext& gctx, + size_t l0div, size_t /*l1div*/) const { std::vector<Vector3D> vertices; @@ -92,7 +94,7 @@ Acts::StrawSurface::polyhedronRepresentation(Context ctx, Vector3D left(r, 0, -hlZ); Vector3D right(r, 0, hlZ); - const Transform3D& sfTransform = transform(ctx); + const Transform3D& sfTransform = transform(gctx); for (size_t i = 0; i < l0div; i++) { Transform3D rot(AngleAxis3D(i * phistep, Vector3D::UnitZ())); diff --git a/Core/src/Surfaces/Surface.cpp b/Core/src/Surfaces/Surface.cpp index 643e1a409cd021cb3b9660ff840da18e217ba1ca..4e225c3362125b4c0e7d7781db11798a18655a2c 100644 --- a/Core/src/Surfaces/Surface.cpp +++ b/Core/src/Surfaces/Surface.cpp @@ -34,12 +34,12 @@ Acts::Surface::Surface(const Surface& other) { } -Acts::Surface::Surface(Context ctx, - const Surface& other, - const Transform3D& shift) +Acts::Surface::Surface(const GeometryContext& gctx, + const Surface& other, + const Transform3D& shift) : GeometryObject() , m_transform(std::make_shared<const Transform3D>( - Transform3D(shift * other.transform(ctx)))) + Transform3D(shift * other.transform(gctx)))) , m_associatedLayer(nullptr) , m_associatedMaterial(other.m_associatedMaterial) { @@ -48,15 +48,15 @@ Acts::Surface::Surface(Context ctx, Acts::Surface::~Surface() = default; bool -Acts::Surface::isOnSurface(Context ctx, - const Vector3D& gpos, - const Vector3D& gmom, - const BoundaryCheck& bcheck) const +Acts::Surface::isOnSurface(const GeometryContext& gctx, + const Vector3D& gpos, + const Vector3D& gmom, + const BoundaryCheck& bcheck) const { // create the local position Vector2D lpos; // global to local transformation - bool gtlSuccess = globalToLocal(ctx, gpos, gmom, lpos); + bool gtlSuccess = globalToLocal(gctx, gpos, gmom, lpos); if (gtlSuccess) { return bcheck ? bounds().inside(lpos, bcheck) : true; } @@ -109,11 +109,7 @@ Acts::Surface::operator==(const Surface& other) const if (m_associatedDetElement != other.m_associatedDetElement) { return false; } - // (e1) compare transform pointers - if (m_transform != other.m_transform) { - return false; - } - // (e2) compare transform values + // (e) compare transform values if (m_transform != nullptr && other.m_transform != nullptr) { if (!m_transform->isApprox(*other.m_transform, 1e-9)) { return false; @@ -130,15 +126,15 @@ Acts::Surface::operator==(const Surface& other) const // overload dump for stream operator std::ostream& -Acts::Surface::toStream(Context ctx, std::ostream& sl) const +Acts::Surface::toStream(const GeometryContext& gctx, std::ostream& sl) const { sl << std::setiosflags(std::ios::fixed); sl << std::setprecision(4); sl << name() << std::endl; - const Vector3D& sfcenter = center(ctx); + const Vector3D& sfcenter = center(gctx); sl << " Center position (x, y, z) = (" << sfcenter.x() << ", " << sfcenter.y() << ", " << sfcenter.z() << ")" << std::endl; - Acts::RotationMatrix3D rot(transform(ctx).matrix().block<3, 3>(0, 0)); + Acts::RotationMatrix3D rot(transform(gctx).matrix().block<3, 3>(0, 0)); Acts::Vector3D rotX(rot.col(0)); Acts::Vector3D rotY(rot.col(1)); Acts::Vector3D rotZ(rot.col(2)); @@ -158,7 +154,7 @@ Acts::Surface::toStream(Context ctx, std::ostream& sl) const std::ostream& Acts::operator<<(std::ostream& sl, const Acts::Surface& sf) { - return sf.toStream(DefaultContext(), sl); + return sf.toStream(DefaultGeometryContext(), sl); } bool diff --git a/Core/src/Surfaces/SurfaceArray.cpp b/Core/src/Surfaces/SurfaceArray.cpp index 2b19a14d46e219f040b083b3ff31abea77cc7a94..bd5e9cce7aa79706fd8f5daaabff914f64d17ec5 100644 --- a/Core/src/Surfaces/SurfaceArray.cpp +++ b/Core/src/Surfaces/SurfaceArray.cpp @@ -36,7 +36,8 @@ Acts::SurfaceArray::SurfaceArray(std::shared_ptr<const Surface> srf) } std::ostream& -Acts::SurfaceArray::toStream(Context /*ctx*/, std::ostream& sl) const +Acts::SurfaceArray::toStream(const GeometryContext& /*gctx*/, + std::ostream& sl) const { sl << std::fixed << std::setprecision(4); sl << "SurfaceArray:" << std::endl; diff --git a/Core/src/Tools/CylinderVolumeBuilder.cpp b/Core/src/Tools/CylinderVolumeBuilder.cpp index eba2e1740bd05d45ac3dc17d5dad458445b805d0..c0225f783943452247833d7d00af5812feb0927a 100644 --- a/Core/src/Tools/CylinderVolumeBuilder.cpp +++ b/Core/src/Tools/CylinderVolumeBuilder.cpp @@ -347,7 +347,7 @@ Acts::CylinderVolumeBuilder::analyzeLayers(const LayerVector& lVector) const double thickness = layer->thickness(); // get the center of the layer const Vector3D& center - = layer->surfaceRepresentation().center(DefaultContext()); + = layer->surfaceRepresentation().center(DefaultGeometryContext()); // 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 5de412ccb62edfe7baa35625f6c44c22c03039c5..9625e640fe457680a634842ba200102096c2e34a 100644 --- a/Core/src/Tools/CylinderVolumeHelper.cpp +++ b/Core/src/Tools/CylinderVolumeHelper.cpp @@ -493,8 +493,9 @@ Acts::CylinderVolumeHelper::estimateAndCheckDimension( radial = true; // get the raw data double currentR = cylBounds->r(); - double centerZ - = (layerIter->surfaceRepresentation()).center(DefaultContext()).z(); + double centerZ = (layerIter->surfaceRepresentation()) + .center(DefaultGeometryContext()) + .z(); // check for min/max in the cylinder bounds case currentRmin = currentR - (0.5 * (layerIter)->thickness()); currentRmax = currentR + (0.5 * (layerIter)->thickness()); diff --git a/Core/src/Volumes/Volume.cpp b/Core/src/Volumes/Volume.cpp index b218f43b9bfb5a19bb6d8c91e1d7f5602a8fba0f..5361fbb881f3165a89a87380499defa057a8215c 100644 --- a/Core/src/Volumes/Volume.cpp +++ b/Core/src/Volumes/Volume.cpp @@ -52,7 +52,8 @@ Acts::Volume::Volume(const Volume& vol, const Transform3D* shift) Acts::Volume::~Volume() = default; const Acts::Vector3D -Acts::Volume::binningPosition(Context /*ctx*/, Acts::BinningValue bValue) const +Acts::Volume::binningPosition(const GeometryContext& /*gctx*/, + Acts::BinningValue bValue) const { // for most of the binning types it is actually the center, // just for R-binning types the diff --git a/Legacy/include/Acts/Propagator/AtlasStepper.hpp b/Legacy/include/Acts/Propagator/AtlasStepper.hpp index 9c6b1d3a12421f22febaaf46616bb3acfa96d1dc..fb58ced27c367fd28f5c2d6b985158a735778c91 100644 --- a/Legacy/include/Acts/Propagator/AtlasStepper.hpp +++ b/Legacy/include/Acts/Propagator/AtlasStepper.hpp @@ -14,8 +14,8 @@ #include "Acts/MagneticField/concept/AnyFieldLookup.hpp" #include "Acts/Propagator/detail/ConstrainedStep.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Units.hpp" @@ -57,15 +57,15 @@ public: /// /// @tparams Type of TrackParameters /// - /// @param[in] ctx The context of this call + /// @param[in] gctx The context of this call /// @param[in] pars Input parameters /// @param[in] ndir The navigation direction w.r.t. parameters /// @param[in] ssize the steps size limitation template <typename Parameters> - State(Context ctx, - const Parameters& pars, - NavigationDirection ndir = forward, - double ssize = std::numeric_limits<double>::max()) + State(const GeometryContext& gctx, + const Parameters& pars, + NavigationDirection ndir = forward, + double ssize = std::numeric_limits<double>::max()) : state_ready(false) , navDir(ndir) , useJacobian(false) @@ -111,7 +111,7 @@ public: covariance = new ActsSymMatrixD<NGlobalPars>(*pars.covariance()); covTransport = true; useJacobian = true; - const auto transform = pars.referenceFrame(ctx); + const auto transform = pars.referenceFrame(gctx); pVector[7] = transform(0, eLOC_0); pVector[14] = transform(0, eLOC_1); @@ -399,11 +399,11 @@ public: /// The state update method /// - /// @param [in] ctx The context of this call + /// @param [in] gctx The context of this call /// @param [in,out] state The stepper state for /// @param [in] pars The new track parameters at start void - update(Context ctx, State& state, const Parameters& pars) const + update(const GeometryContext& gctx, State& state, const Parameters& pars) const { // state is ready - noting to do if (state.state_ready) { @@ -439,7 +439,7 @@ public: state.covariance = new ActsSymMatrixD<NGlobalPars>(*pars.covariance()); state.covTransport = true; state.useJacobian = true; - const auto transform = pars.referenceFrame(ctx); + const auto transform = pars.referenceFrame(gctx); state.pVector[7] = transform(0, eLOC_0); state.pVector[14] = transform(0, eLOC_1); state.pVector[21] = 0.; @@ -748,7 +748,7 @@ public: state.pVector[39] *= p; state.pVector[40] *= p; - const auto fFrame = surface.referenceFrame(gp, mom); + const auto fFrame = surface.referenceFrame(gctx, gp, mom); double Ax[3] = {fFrame(0, 0), fFrame(1, 0), fFrame(2, 0)}; double Ay[3] = {fFrame(0, 1), fFrame(1, 1), fFrame(2, 1)}; diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp index 18760d62410ae44574d5bffacf64c087131fc9b8..c2484e4ec073bb3dbd8b72b2020dcb9fb0047b76 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepLayerBuilder.hpp @@ -74,7 +74,7 @@ public: /// touching or overlapping with the next layer can happen. double defaultThickness = 10e-10 * Acts::units::_mm; /// Context for building of the geometry - ContextType buildingContext = DefaultContext(); + GeometryContext buildingContext = DefaultGeometryContext(); }; /// Constructor diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/CartesianSegmentation.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/CartesianSegmentation.hpp index 0d56de4aa59f215b5d0aee219d16a430413501de..fb793fbb6422a3e200bd47c9a48b25d458502702 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/CartesianSegmentation.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/CartesianSegmentation.hpp @@ -58,8 +58,7 @@ public: /// optimisation /// /// @note if both RectangleBounds and BinUtility are provided, no check is - /// done - /// for consitency + /// done for consitency CartesianSegmentation(std::shared_ptr<const BinUtility> bUtility, std::shared_ptr<const PlanarBounds> mBounds = nullptr); diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationModule.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationModule.hpp index df6b39cc9f21b037ec9300bbad4c1542aa1bb244..933631476272378067dc463b5b4b72f67b84ea25 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationModule.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/DigitizationModule.hpp @@ -48,6 +48,7 @@ class DigitizationModule public: /// Constructor from a Segmentation descriptor /// + /// @param gctx The current geometry context object, e.g. alignment /// @param moduleSegmentation is the segmentation descriptions /// @param halfThickness is the half thickness of the module /// @param readoutDirection is the readout drift direction @@ -65,6 +66,7 @@ public: /// Return the internal test segmentation surfaces to test between entry /// and exit given by their cell id's - the boundaries are not given /// + /// @param gctx The current geometry context object, e.g. alignment /// @param entryCids are the entry digitisation cell ids /// @param exitCids are the exit digitisation cell ids /// @@ -111,7 +113,10 @@ public: stepSurfaces(const Vector3D& start, const Vector3D& end) const; /// Fill the associated digitsation cell from this start and end position, - // correct for lorentz effect if needed + /// correct for lorentz effect if needed + /// + /// @param start is the start position of the step + /// @param end is the end position of the step const DigitizationStep digitizationStep(const Vector3D& start, const Vector3D& end) const; diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/DoubleHitSpacePointBuilder.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/DoubleHitSpacePointBuilder.hpp index 6bed17a23b5f20a29e230fc278c53b5e3613b44a..4ebc12ae16973c3da62ecb34604ee6c2455dcb82 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/DoubleHitSpacePointBuilder.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/DoubleHitSpacePointBuilder.hpp @@ -87,8 +87,9 @@ public: SpacePointBuilder(DoubleHitSpacePointConfig cfg); /// @brief Searches possible combinations of two clusters on different - /// surfaces - /// that may come from the same particles + /// surfaces that may come from the same particles + /// + /// @param gctx The current geometry context object, e.g. alignment /// @param clustersFront vector of clusters on a surface /// @param clustersBack vector of clusters on another surface /// @param clusterPairs storage of the cluster pairs @@ -96,6 +97,7 @@ public: /// clusters[Independent clusters on a single surface] void makeClusterPairs( + const GeometryContext& gctx, const std::vector<const PlanarModuleCluster*>& clustersFront, const std::vector<const PlanarModuleCluster*>& clustersBack, std::vector<std::pair<const PlanarModuleCluster*, @@ -103,11 +105,14 @@ public: /// @brief Calculates the space points out of a given collection of clusters /// on several strip detectors and stores the data + /// + /// @param gctx The current geometry context object, e.g. alignment /// @param clusterPairs pairs of clusters that are space point candidates /// @param spacePoints storage of the results /// @note If no configuration is set, the default values will be used void calculateSpacePoints( + const GeometryContext& gctx, const std::vector<std::pair<const PlanarModuleCluster*, const PlanarModuleCluster*>>& clusterPairs, std::vector<DoubleHitSpacePoint>& spacePoints) const; @@ -161,7 +166,8 @@ private: /// information /// @return vector of the global coordinates of the cluster Vector3D - globalCoords(const PlanarModuleCluster& cluster) const; + globalCoords(const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const; /// @brief Calculates (Delta theta)^2 + (Delta phi)^2 between two clusters /// @param pos1 position of the first cluster @@ -175,7 +181,8 @@ private: /// @param cluster object that stores the information about the hit /// @return vectors to the top and bottom end of the SDE std::pair<Vector3D, Vector3D> - endsOfStrip(const PlanarModuleCluster& cluster) const; + endsOfStrip(const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const; /// @brief Calculates a space point whithout using the vertex /// @note This is mostly to resolve space points from cosmic data diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleStepper.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleStepper.hpp index 460f4c1617e2e5133419a381d6e54bd7e1b6c43c..094ea45d328d872b90c0fb154a7ec028de2dd148 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleStepper.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/PlanarModuleStepper.hpp @@ -11,6 +11,7 @@ #include <vector> #include "Acts/Plugins/Digitization/DigitizationCell.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" namespace Acts { @@ -38,25 +39,29 @@ public: /// Calculate the steps caused by this track - full simulation interface /// + /// @param gctx The current geometry context object, e.g. alignment /// @param dmodule is the digitization module /// @param startPoint is the starting position of the stepping /// @param endPoint is the end postion of the stepping /// /// @return is the vector of digitization steps std::vector<DigitizationStep> - cellSteps(const DigitizationModule& dmodule, + cellSteps(const GeometryContext& gctx, + const DigitizationModule& dmodule, const Vector3D& startPoint, const Vector3D& endPoint) const; /// Calculate the steps caused by this track - fast simulation interface /// + /// @param gctx The current geometry context object, e.g. alignment /// @param dmodule is the digitization module /// @param moduleIntersection is the 2d intersection at the module surface /// @param trackDirection is the track direction at the instersection /// /// @return is the vector of digitization steps std::vector<DigitizationStep> - cellSteps(const DigitizationModule& dmodule, + cellSteps(const GeometryContext& gctx, + const DigitizationModule& dmodule, const Vector2D& moduleIntersection, const Vector3D& trackDirection) const; diff --git a/Plugins/Digitization/include/Acts/Plugins/Digitization/SingleHitSpacePointBuilder.hpp b/Plugins/Digitization/include/Acts/Plugins/Digitization/SingleHitSpacePointBuilder.hpp index f19f0a45facbe8581469fc0e20072f32e2ab1c9a..b291f1d87c66812b571047489b97184760d118c7 100644 --- a/Plugins/Digitization/include/Acts/Plugins/Digitization/SingleHitSpacePointBuilder.hpp +++ b/Plugins/Digitization/include/Acts/Plugins/Digitization/SingleHitSpacePointBuilder.hpp @@ -10,6 +10,7 @@ #include "Acts/Plugins/Digitization/CartesianSegmentation.hpp" #include "Acts/Plugins/Digitization/SpacePointBuilder.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -62,16 +63,20 @@ public: /// @brief Calculates the space points out of a given collection of clusters /// and stores the results + /// + /// @param gctx The current geometry context object, e.g. alignment /// @param cluster vector of clusters /// @param spacePointStorage storage of the results void calculateSpacePoints( + const GeometryContext& gctx, const std::vector<const PlanarModuleCluster*>& clusters, std::vector<SingleHitSpacePoint>& spacePointStorage) const; protected: /// @brief Getter method for the local coordinates of a cluster /// on its corresponding surface + /// /// @param cluster object related to the cluster that holds the necessary /// information /// @return vector of the local coordinates of the cluster on the surface @@ -79,11 +84,14 @@ protected: localCoords(const PlanarModuleCluster& cluster) const; /// @brief Getter method for the global coordinates of a cluster + /// + /// @param gctx The current geometry context object, e.g. alignment /// @param cluster object related to the cluster that holds the necessary /// information /// @return vector of the global coordinates of the cluster Vector3D - globalCoords(const PlanarModuleCluster& cluster) const; + globalCoords(const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const; }; } // namespace Acts diff --git a/Plugins/Digitization/src/DoubleHitSpacePointBuilder.cpp b/Plugins/Digitization/src/DoubleHitSpacePointBuilder.cpp index ab8d5b7dec9401c823ac0196512c6868e1e54f89..7f8e606de4ef9aa470e1bad6df34e30f1e1bbcb0 100644 --- a/Plugins/Digitization/src/DoubleHitSpacePointBuilder.cpp +++ b/Plugins/Digitization/src/DoubleHitSpacePointBuilder.cpp @@ -23,8 +23,8 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::SpacePointBuilder( double Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::differenceOfClustersChecked( - const Acts::Vector3D& pos1, - const Acts::Vector3D& pos2) const + const Vector3D& pos1, + const Vector3D& pos2) const { // Check if measurements are close enough to each other if ((pos1 - pos2).norm() > m_cfg.diffDist) { @@ -56,7 +56,7 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::differenceOfClustersChecked( Acts::Vector2D Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::localCoords( - const Acts::PlanarModuleCluster& cluster) const + const PlanarModuleCluster& cluster) const { // Local position information auto par = cluster.parameters(); @@ -66,25 +66,26 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::localCoords( Acts::Vector3D Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::globalCoords( - const Acts::PlanarModuleCluster& cluster) const + const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const { // Receive corresponding surface auto& clusterSurface = cluster.referenceSurface(); // Transform local into global position information Acts::Vector3D pos, mom; - clusterSurface.localToGlobal(localCoords(cluster), mom, pos); + clusterSurface.localToGlobal(gctx, localCoords(cluster), mom, pos); return pos; } void Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::makeClusterPairs( + const GeometryContext& gctx, const std::vector<const PlanarModuleCluster*>& clustersFront, const std::vector<const PlanarModuleCluster*>& clustersBack, - std::vector<std::pair<const Acts::PlanarModuleCluster*, - const Acts::PlanarModuleCluster*>>& clusterPairs) - const + std::vector<std::pair<const PlanarModuleCluster*, + const PlanarModuleCluster*>>& clusterPairs) const { // Return if no clusters are given in a vector if (clustersFront.empty() || clustersBack.empty()) { @@ -107,8 +108,8 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::makeClusterPairs( iClustersBack++) { // Calculate the distances between the hits currentDiff = differenceOfClustersChecked( - globalCoords(*(clustersFront[iClustersFront])), - globalCoords(*(clustersBack[iClustersBack]))); + globalCoords(gctx, *(clustersFront[iClustersFront])), + globalCoords(gctx, *(clustersBack[iClustersBack]))); // Store the closest clusters (distance and index) calculated so far if (currentDiff < diffMin && currentDiff >= 0.) { diffMin = currentDiff; @@ -130,6 +131,7 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::makeClusterPairs( std::pair<Acts::Vector3D, Acts::Vector3D> Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::endsOfStrip( + const GeometryContext& gctx, const Acts::PlanarModuleCluster& cluster) const { // Calculate the local coordinates of the cluster @@ -166,8 +168,8 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::endsOfStrip( // Calculate the global coordinates of the top and bottom end of the strip Acts::Vector3D topGlobal, bottomGlobal, mom; // mom is a dummy variable const auto* sur = &cluster.referenceSurface(); - sur->localToGlobal(topLocal, mom, topGlobal); - sur->localToGlobal(bottomLocal, mom, bottomGlobal); + sur->localToGlobal(gctx, topLocal, mom, topGlobal); + sur->localToGlobal(gctx, bottomLocal, mom, bottomGlobal); // Return the top and bottom end of the strip in global coordinates return std::make_pair(topGlobal, bottomGlobal); @@ -287,6 +289,7 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::recoverSpacePoint( void Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::calculateSpacePoints( + const GeometryContext& gctx, const std::vector<std::pair<const Acts::PlanarModuleCluster*, const Acts::PlanarModuleCluster*>>& clusterPairs, @@ -301,8 +304,8 @@ Acts::SpacePointBuilder<Acts::DoubleHitSpacePoint>::calculateSpacePoints( for (const auto& cp : clusterPairs) { // Calculate the ends of the SDEs - const auto& ends1 = endsOfStrip(*(cp.first)); - const auto& ends2 = endsOfStrip(*(cp.second)); + const auto& ends1 = endsOfStrip(gctx, *(cp.first)); + const auto& ends2 = endsOfStrip(gctx, *(cp.second)); /// The following algorithm is meant for finding the position on the first /// strip if there is a corresponding cluster on the second strip. The diff --git a/Plugins/Digitization/src/PlanarModuleStepper.cpp b/Plugins/Digitization/src/PlanarModuleStepper.cpp index 23d0f7cae25e7ef2e95ab3490b51401ea97e7d8f..5e3a3c7634f1c8a3e6194b08f3ebe1cf932969ee 100644 --- a/Plugins/Digitization/src/PlanarModuleStepper.cpp +++ b/Plugins/Digitization/src/PlanarModuleStepper.cpp @@ -23,7 +23,8 @@ Acts::PlanarModuleStepper::PlanarModuleStepper( } std::vector<Acts::DigitizationStep> -Acts::PlanarModuleStepper::cellSteps(const DigitizationModule& dmodule, +Acts::PlanarModuleStepper::cellSteps(const GeometryContext& gctx, + const DigitizationModule& dmodule, const Vector3D& startPoint, const Vector3D& endPoint) const { @@ -44,7 +45,7 @@ Acts::PlanarModuleStepper::cellSteps(const DigitizationModule& dmodule, for (auto& sSurface : stepSurfaces) { // try it out by intersecting, but do not force the direction Acts::Intersection sIntersection = sSurface->intersectionEstimate( - startPoint, trackDirection, forward, true); + gctx, startPoint, trackDirection, forward, true); if (sIntersection.valid) { // now record stepIntersections.push_back(sIntersection); @@ -76,7 +77,8 @@ Acts::PlanarModuleStepper::cellSteps(const DigitizationModule& dmodule, // calculate the steps caused by this track - fast simulation interface std::vector<Acts::DigitizationStep> -Acts::PlanarModuleStepper::cellSteps(const Acts::DigitizationModule& dmodule, +Acts::PlanarModuleStepper::cellSteps(const GeometryContext& gctx, + const Acts::DigitizationModule& dmodule, const Vector2D& moduleIntersection, const Vector3D& trackDirection) const { @@ -94,7 +96,7 @@ Acts::PlanarModuleStepper::cellSteps(const Acts::DigitizationModule& dmodule, ++attempts; // try it out by intersecting, but do not force the direction Acts::Intersection bIntersection = bSurface->intersectionEstimate( - intersection3D, trackDirection, forward, true); + gctx, intersection3D, trackDirection, forward, true); if (bIntersection.valid) { // now record boundaryIntersections.push_back(bIntersection); @@ -131,7 +133,8 @@ Acts::PlanarModuleStepper::cellSteps(const Acts::DigitizationModule& dmodule, return std::vector<Acts::DigitizationStep>(); } // return - return cellSteps(dmodule, + return cellSteps(gctx, + dmodule, boundaryIntersections[0].position, boundaryIntersections[1].position); } diff --git a/Plugins/Digitization/src/SingleHitSpacePointBuilder.cpp b/Plugins/Digitization/src/SingleHitSpacePointBuilder.cpp index b6339d7074097e9a0b617c897cc4466d8de473bd..33277100db8fa0ad24f23726981503c1f4a9c203 100644 --- a/Plugins/Digitization/src/SingleHitSpacePointBuilder.cpp +++ b/Plugins/Digitization/src/SingleHitSpacePointBuilder.cpp @@ -10,7 +10,7 @@ Acts::Vector2D Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::localCoords( - const Acts::PlanarModuleCluster& cluster) const + const PlanarModuleCluster& cluster) const { // Local position information auto par = cluster.parameters(); @@ -20,27 +20,29 @@ Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::localCoords( Acts::Vector3D Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::globalCoords( - const Acts::PlanarModuleCluster& cluster) const + const GeometryContext& gctx, + const PlanarModuleCluster& cluster) const { // Receive corresponding surface auto& clusterSurface = cluster.referenceSurface(); // Transform local into global position information Acts::Vector3D pos, mom; - clusterSurface.localToGlobal(localCoords(cluster), mom, pos); + clusterSurface.localToGlobal(gctx, localCoords(cluster), mom, pos); return pos; } void Acts::SpacePointBuilder<Acts::SingleHitSpacePoint>::calculateSpacePoints( + const GeometryContext& gctx, const std::vector<const Acts::PlanarModuleCluster*>& clusters, std::vector<Acts::SingleHitSpacePoint>& spacePointStorage) const { // Set the space point for all stored hits for (const auto& c : clusters) { Acts::SingleHitSpacePoint spacePoint; - spacePoint.spacePoint = globalCoords(*c); + spacePoint.spacePoint = globalCoords(gctx, *c); spacePoint.clusterModule = c; spacePointStorage.push_back(std::move(spacePoint)); } diff --git a/Plugins/MaterialMapping/include/Acts/Plugins/MaterialMapping/SurfaceMaterialMapper.hpp b/Plugins/MaterialMapping/include/Acts/Plugins/MaterialMapping/SurfaceMaterialMapper.hpp index ba932251c04aae4d9e51eaa2de916084f7deba90..447bec47e351298cf5b233ed00341ed8594610ed 100644 --- a/Plugins/MaterialMapping/include/Acts/Plugins/MaterialMapping/SurfaceMaterialMapper.hpp +++ b/Plugins/MaterialMapping/include/Acts/Plugins/MaterialMapping/SurfaceMaterialMapper.hpp @@ -123,7 +123,7 @@ public: surfaceMaterial; /// The context for the mapping - ContextType mappingContext = DefaultContext(); + GeometryContext mappingContext = DefaultGeometryContext(); }; /// Delete the Default constructor diff --git a/Plugins/MaterialMapping/src/SurfaceMaterialMapper.cpp b/Plugins/MaterialMapping/src/SurfaceMaterialMapper.cpp index d9acd440e98b68ea5fcabd84ac2517c664ac234c..ec6fed410fedf074826d49f2e36c98d463228761 100644 --- a/Plugins/MaterialMapping/src/SurfaceMaterialMapper.cpp +++ b/Plugins/MaterialMapping/src/SurfaceMaterialMapper.cpp @@ -143,14 +143,13 @@ Acts::SurfaceMaterialMapper::mapMaterialTrack( using ActionList = ActionList<MaterialSurfaceCollector, DebugOutput>; using AbortList = AbortList<detail::EndOfWorldReached>; - PropagatorOptions<ActionList, AbortList> options; + PropagatorOptions<ActionList, AbortList> options(mState.mappingContext); options.debug = m_cfg.mapperDebugOutput; // Now collect the material layers by using the straight line propagator - const auto& result - = m_propagator.propagate(mState.mappingContext, start, options); - auto mcResult = result.get<MaterialSurfaceCollector::result_type>(); - auto mappingSurfaces = mcResult.collected; + const auto& result = m_propagator.propagate(start, options); + auto mcResult = result.get<MaterialSurfaceCollector::result_type>(); + auto mappingSurfaces = mcResult.collected; // Retrieve the recorded material const auto& rMaterial = mTrack.recordedMaterialProperties(); diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp index 66869a028ece8339a808888d62a1f9ca3c7dde4f..e9fe0feee0a942852e7cb5919f9a719663a14f2b 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoDetectorElement.hpp @@ -14,7 +14,7 @@ #include <iostream> #include "Acts/Plugins/Identification/IdentifiedDetectorElement.hpp" #include "Acts/Plugins/Identification/Identifier.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "TGeoManager.h" namespace Acts { @@ -134,9 +134,9 @@ public: /// Return local to global transform associated with this identifier /// - /// @param ctx is the context for the call to the transform, e.g. alignment + /// @param gctx The current geometry context object, e.g. alignment const Transform3D& - transform(Context ctx) const final; + transform(const GeometryContext& gctx) const final; /// Return surface associated with this identifier, which should come from the const Surface& @@ -177,7 +177,8 @@ TGeoDetectorElement::identifier() const return m_identifier; } -inline const Transform3D& TGeoDetectorElement::transform(Context /*ctx*/) const +inline const Transform3D& +TGeoDetectorElement::transform(const GeometryContext& /*gctx*/) const { return (*m_transform); } diff --git a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp index 6cdc3f99d33033f845a155f276b21e30153a826a..a07eaa9f634fffcd6295e8937b2cd8344ee91678 100644 --- a/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp +++ b/Plugins/TGeo/include/Acts/Plugins/TGeo/TGeoLayerBuilder.hpp @@ -13,8 +13,8 @@ #pragma once #include "Acts/Tools/ILayerBuilder.hpp" #include "Acts/Tools/LayerCreator.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" class TGeoMatrix; @@ -72,7 +72,7 @@ public: // layer creator std::shared_ptr<const LayerCreator> layerCreator = nullptr; // The building context - ContextType buildingContext = DefaultContext(); + GeometryContext buildingContext = DefaultGeometryContext(); // configurations std::vector<LayerConfig> negativeLayerConfigs; std::vector<LayerConfig> centralLayerConfigs; diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp index ce5577f50d022422ba507dd6c7a9d48d81134102..465823d6b4e9526b99fccd927290795839e1e226 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/CylindricalTrackingGeometry.hpp @@ -26,8 +26,8 @@ #include "Acts/Tools/PassiveLayerBuilder.hpp" #include "Acts/Tools/SurfaceArrayCreator.hpp" #include "Acts/Tools/TrackingVolumeArrayCreator.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Units.hpp" #include "Acts/Volumes/CylinderVolumeBounds.hpp" @@ -223,7 +223,7 @@ namespace Test { detectorStore.push_back(std::move(detElement)); } // create the layer and store it - ProtoLayer protoLayer(DefaultContext(), layerModules); + ProtoLayer protoLayer(DefaultGeometryContext(), layerModules); protoLayer.envR = {0.5, 0.5}; auto pLayer = layerCreator->cylinderLayer(std::move(layerModules), pLayerBinning[ilp].first, diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/DetectorElementStub.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/DetectorElementStub.hpp index 68ae0073bfad43335fc989cba93f979946fdde3c..a16f659f4a06e7f395a5e9409dd94ad08f5075cb 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/DetectorElementStub.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/DetectorElementStub.hpp @@ -91,11 +91,11 @@ namespace Test { /// Return local to global transform associated with this identifier /// - /// @param ctx is the context of this request + /// @param gctx The current geometry context object, e.g. alignment /// /// @note this is called from the surface().transform() in the PROXY mode const Transform3D& - transform(Context ctx) const override; + transform(const GeometryContext& gctx) const override; /// Return surface associated with this detector element const Surface& @@ -115,7 +115,7 @@ namespace Test { }; inline const Transform3D& - DetectorElementStub::transform(Context /*ctx*/) const + DetectorElementStub::transform(const GeometryContext& /*gctx*/) const { return *m_elementTransform; } diff --git a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp index 6f712a8dd332f90ada07acf527ba14c4a1a65c02..fb531cd3fccb7974aa24e72218adc46ce0024f4e 100644 --- a/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp +++ b/Tests/Core/CommonHelpers/include/Acts/Tests/CommonHelpers/LineSurfaceStub.hpp @@ -46,15 +46,15 @@ namespace Test { { /* nop */ } // - LineSurfaceStub(Context ctx, + LineSurfaceStub(const GeometryContext& gctx, const LineSurfaceStub& ls, const Transform3D& t) - : GeometryObject(), LineSurface(ctx, ls, t) + : GeometryObject(), LineSurface(gctx, ls, t) { /* nop */ } /// pure virtual functions of baseclass implemented here std::shared_ptr<LineSurfaceStub> - clone(Context /*ctx*/, const Transform3D& /*unused*/) const + clone(const GeometryContext& /*gctx*/, const Transform3D& /*unused*/) const { return nullptr; } @@ -77,7 +77,8 @@ namespace Test { private: Surface* - clone_impl(Context /*ctx*/, const Transform3D& /*unused*/) const + clone_impl(const GeometryContext& /*gctx*/, + const Transform3D& /*unused*/) const { return nullptr; } diff --git a/Tests/Core/Detector/TrackingGeometryClosureTests.cpp b/Tests/Core/Detector/TrackingGeometryClosureTests.cpp index 8f7667793f7fa304084bbe01507623e5c9bee4c9..f57ab640d3bdf1f146eb7917c937b06d76f37511 100644 --- a/Tests/Core/Detector/TrackingGeometryClosureTests.cpp +++ b/Tests/Core/Detector/TrackingGeometryClosureTests.cpp @@ -11,7 +11,8 @@ #define BOOST_TEST_DYN_LINK #include <boost/test/unit_test.hpp> -#include "Acts/Utilities/Context.hpp" + +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/Units.hpp" #include "TrackingVolumeCreation.hpp" @@ -21,7 +22,7 @@ namespace Acts { namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); /// we test a two-level hierarchy /// every deeper level hierarchy is a a derivate of this @@ -50,7 +51,7 @@ namespace Test { + layerEnvelope + volumeEnvelope; /// inner inner volume - auto iiVolume = constructCylinderVolume(testContext, + auto iiVolume = constructCylinderVolume(tgContext, surfaceHalfLengthZ, iiv_surfaceRadius, surfaceRstagger, @@ -61,7 +62,7 @@ namespace Test { iiv_volumeRadius, "InnerInnerVolume"); /// inner outer volume - auto ioVolume = constructCylinderVolume(testContext, + auto ioVolume = constructCylinderVolume(tgContext, surfaceHalfLengthZ, iov_surfaceRadius, surfaceRstagger, @@ -76,7 +77,7 @@ namespace Test { double volumeHalfZ = (4 * surfaceHalfLengthZ - surfaceZoverlap) + volumeEnvelope; /// the inner volume - auto iVolume = constructContainerVolume(testContext, + auto iVolume = constructContainerVolume(tgContext, iiVolume, ioVolume, iov_volumeRadius, @@ -89,7 +90,7 @@ namespace Test { + layerEnvelope + volumeEnvelope; /// inner outer volume - auto oVolume = constructCylinderVolume(testContext, + auto oVolume = constructCylinderVolume(tgContext, surfaceHalfLengthZ, ov_surfaceRadius, surfaceRstagger, @@ -100,7 +101,7 @@ namespace Test { ov_volumeRadius, "OuterVolume"); /// the inner volume - auto volume = constructContainerVolume(testContext, + auto volume = constructContainerVolume(tgContext, iVolume, oVolume, ov_volumeRadius, diff --git a/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp b/Tests/Core/Detector/TrackingGeometryGeoIDTests.cpp index e0bcb738e8a0524a5eb383983247f7a4cceab7d2..0aa1e983d98185d7fe9341bf89e52b6a29e1e2c3 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); /// create three cylinder surfaces /// the surface radius (will also be the layer radius) @@ -44,7 +44,7 @@ namespace Test { + oVlayerEnvelope + oVvolumeEnvelope; /// inner volume - auto iVolume = constructCylinderVolume(testContext, + auto iVolume = constructCylinderVolume(tgContext, iVsurfaceHalfLengthZ, iVsurfaceRadius, iVsurfaceRstagger, @@ -76,7 +76,7 @@ namespace Test { } /// outer volume - auto oVolume = constructCylinderVolume(testContext, + auto oVolume = constructCylinderVolume(tgContext, oVsurfaceHalfLengthZ, oVsurfaceRadius, oVsurfaceRstagger, @@ -110,7 +110,7 @@ namespace Test { double oVvolumeHalfZ = (4 * oVsurfaceHalfLengthZ - oVsurfaceZoverlap) + oVvolumeEnvelope; // now create the container volume - auto hVolume = constructContainerVolume(testContext, + auto hVolume = constructContainerVolume(tgContext, iVolume, oVolume, oVvolumeRadius, diff --git a/Tests/Core/Detector/TrackingVolumeCreation.hpp b/Tests/Core/Detector/TrackingVolumeCreation.hpp index 5bc7f477436a11f6cb838f0bbc2c1c041fae9328..f26a938e086d10356fdfd6d4b166fc8c316a44d0 100644 --- a/Tests/Core/Detector/TrackingVolumeCreation.hpp +++ b/Tests/Core/Detector/TrackingVolumeCreation.hpp @@ -13,24 +13,24 @@ #include "Acts/Surfaces/CylinderSurface.hpp" #include "Acts/Utilities/BinUtility.hpp" #include "Acts/Utilities/BinnedArrayXD.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Volumes/CylinderVolumeBounds.hpp" namespace Acts { /// helper function to create a cylinder TrackingVolumePtr -constructCylinderVolume(Context ctx, - double surfaceHalfLengthZ, - double surfaceRadius, - double surfaceRstagger, - double surfaceZoverlap, - double layerEnvelope, - double volumeEnvelope, - double innerVolumeR, - double outerVolumeR, - const std::string& name) +constructCylinderVolume(const GeometryContext& gctx, + double surfaceHalfLengthZ, + double surfaceRadius, + double surfaceRstagger, + double surfaceZoverlap, + double layerEnvelope, + double volumeEnvelope, + double innerVolumeR, + double outerVolumeR, + const std::string& name) { /// the surface transforms auto sfnPosition @@ -68,7 +68,7 @@ constructCylinderVolume(Context ctx, = [](const std::array<double, 1>& loc) { return Vector3D(0, 0, loc[0]); }; auto sl = std::make_unique<SurfaceArray::SurfaceGridLookup<decltype(axis)>>( g2l, l2g, std::make_tuple(axis)); - sl->fill(ctx, surfaces_only_raw); + sl->fill(gctx, surfaces_only_raw); auto bArray = std::make_unique<SurfaceArray>(std::move(sl), surfaces_only); /// now create the Layer @@ -93,17 +93,17 @@ constructCylinderVolume(Context ctx, /// helper function to create a container MutableTrackingVolumePtr -constructContainerVolume(Context ctx, - TrackingVolumePtr iVolume, - TrackingVolumePtr oVolume, - double hVolumeRadius, - double hVolumeHalflength, - const std::string& name) +constructContainerVolume(const GeometryContext& gctx, + TrackingVolumePtr iVolume, + TrackingVolumePtr oVolume, + double hVolumeRadius, + double hVolumeHalflength, + const std::string& name) { /// create the volume array using VAP = std::pair<TrackingVolumePtr, Vector3D>; - std::vector<VAP> volumes = {{iVolume, iVolume->binningPosition(ctx, binR)}, - {oVolume, oVolume->binningPosition(ctx, binR)}}; + std::vector<VAP> volumes = {{iVolume, iVolume->binningPosition(gctx, binR)}, + {oVolume, oVolume->binningPosition(gctx, binR)}}; /// the bounds for the container auto hVolumeBounds = std::make_shared<const CylinderVolumeBounds>( 0., hVolumeRadius, hVolumeHalflength); diff --git a/Tests/Core/EventData/BoundParametersTests.cpp b/Tests/Core/EventData/BoundParametersTests.cpp index 0073a13c8c14c62794de70c9c545653b55f5cd83..0fd7f002c054a5c24b5f359409632d26a2f53122 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); /// @brief Unit test for parameters at a plane /// @@ -100,19 +100,19 @@ namespace Test { Vector3D pos = center + pars_array[0] * rot.col(0) + pars_array[1] * rot.col(1); // constructor from parameter vector - BoundParameters ataPlane_from_pars(testContext, nullptr, pars, pSurface); + BoundParameters ataPlane_from_pars(tgContext, nullptr, pars, pSurface); consistencyCheck(ataPlane_from_pars, pos, mom, 1., pars_array); // constructor from global parameters BoundParameters ataPlane_from_global( - testContext, nullptr, pos, mom, 1., pSurface); + tgContext, nullptr, pos, mom, 1., pSurface); consistencyCheck(ataPlane_from_global, pos, mom, 1., pars_array); // constructor for neutral parameters NeutralBoundParameters n_ataPlane_from_pars( - testContext, nullptr, pars, pSurface); + tgContext, nullptr, pars, pSurface); consistencyCheck(n_ataPlane_from_pars, pos, mom, 0., pars_array); // constructor for neutral global parameters NeutralBoundParameters n_ataPlane_from_global( - testContext, nullptr, pos, mom, pSurface); + tgContext, nullptr, pos, mom, pSurface); consistencyCheck(n_ataPlane_from_global, pos, mom, 0., pars_array); // check shared ownership of same surface @@ -125,14 +125,14 @@ namespace Test { BOOST_CHECK_EQUAL(pSurface.use_count(), 5); // check that the reference frame is the rotation matrix - CHECK_CLOSE_REL(ataPlane_from_pars.referenceFrame(testContext), rot, 1e-6); + CHECK_CLOSE_REL(ataPlane_from_pars.referenceFrame(tgContext), rot, 1e-6); /// modification test via setter functions double ux = 0.3; double uy = 0.4; - ataPlane_from_pars.set<Acts::eLOC_X>(testContext, ux); - ataPlane_from_pars.set<Acts::eLOC_Y>(testContext, uy); + ataPlane_from_pars.set<Acts::eLOC_X>(tgContext, ux); + ataPlane_from_pars.set<Acts::eLOC_Y>(tgContext, uy); // we should have a new updated position Vector3D lPosition3D(ux, uy, 0.); Vector3D uposition = rot * lPosition3D + center; @@ -142,9 +142,9 @@ namespace Test { double utheta = 0.2; double uqop = 0.025; - ataPlane_from_pars.set<Acts::ePHI>(testContext, uphi); - ataPlane_from_pars.set<Acts::eTHETA>(testContext, utheta); - ataPlane_from_pars.set<Acts::eQOP>(testContext, uqop); + ataPlane_from_pars.set<Acts::ePHI>(tgContext, uphi); + ataPlane_from_pars.set<Acts::eTHETA>(tgContext, utheta); + ataPlane_from_pars.set<Acts::eQOP>(tgContext, uqop); // we should have a new updated momentum Vector3D umomentum = 40. * Vector3D(cos(uphi) * sin(utheta), sin(uphi) * sin(utheta), @@ -213,19 +213,19 @@ namespace Test { Vector3D pos = (pars_array[0] * cos(pars_array[1])) * rot.col(0) + (pars_array[0] * sin(pars_array[1])) * rot.col(1) + center; // constructor from parameter vector - BoundParameters ataDisc_from_pars(testContext, nullptr, pars, dSurface); + BoundParameters ataDisc_from_pars(tgContext, nullptr, pars, dSurface); consistencyCheck(ataDisc_from_pars, pos, mom, 1., pars_array); // constructor from global parameters BoundParameters ataDisc_from_global( - testContext, nullptr, pos, mom, 1., dSurface); + tgContext, nullptr, pos, mom, 1., dSurface); consistencyCheck(ataDisc_from_global, pos, mom, 1., pars_array); // constructor for neutral parameters NeutralBoundParameters n_ataDisc_from_pars( - testContext, nullptr, pars, dSurface); + tgContext, nullptr, pars, dSurface); consistencyCheck(n_ataDisc_from_pars, pos, mom, 0., pars_array); // constructor for neutral global parameters NeutralBoundParameters n_ataDisc_from_global( - testContext, nullptr, pos, mom, dSurface); + tgContext, nullptr, pos, mom, dSurface); consistencyCheck(n_ataDisc_from_global, pos, mom, 0., pars_array); // check shared ownership of same surface @@ -240,9 +240,9 @@ namespace Test { // check that the reference frame is the // rotation matrix of the surface const auto& dRotation - = dSurface->transform(testContext).matrix().block<3, 3>(0, 0); + = dSurface->transform(tgContext).matrix().block<3, 3>(0, 0); CHECK_CLOSE_REL( - ataDisc_from_pars.referenceFrame(testContext), dRotation, 1e-6); + ataDisc_from_pars.referenceFrame(tgContext), dRotation, 1e-6); } /// @brief Unit test for parameters at a cylinder @@ -312,19 +312,19 @@ namespace Test { + center; // constructor from parameter vector - BoundParameters ataCylinder_from_pars(testContext, nullptr, pars, cSurface); + BoundParameters ataCylinder_from_pars(tgContext, nullptr, pars, cSurface); consistencyCheck(ataCylinder_from_pars, pos, mom, 1., pars_array); // constructor from global parameters BoundParameters ataCylinder_from_global( - testContext, nullptr, pos, mom, 1., cSurface); + tgContext, nullptr, pos, mom, 1., cSurface); consistencyCheck(ataCylinder_from_global, pos, mom, 1., pars_array); // constructor for neutral parameters NeutralBoundParameters n_ataCylinder_from_pars( - testContext, nullptr, pars, cSurface); + tgContext, nullptr, pars, cSurface); consistencyCheck(n_ataCylinder_from_pars, pos, mom, 0., pars_array); // constructor for neutral global parameters NeutralBoundParameters n_ataCylinder_from_global( - testContext, nullptr, pos, mom, cSurface); + tgContext, nullptr, pos, mom, cSurface); consistencyCheck(n_ataCylinder_from_global, pos, mom, 0., pars_array); // check shared ownership of same surface @@ -341,7 +341,7 @@ namespace Test { auto pPosition = ataCylinder_from_pars.position(); // the reference frame is // transverse plane to the cylinder at the intersect - Vector3D normal_at_intersect = cSurface->normal(testContext, pPosition); + Vector3D normal_at_intersect = cSurface->normal(tgContext, pPosition); Vector3D transverse_y = rot.col(2); Vector3D transverse_x = transverse_y.cross(normal_at_intersect); RotationMatrix3D refframe; @@ -350,7 +350,7 @@ namespace Test { refframe.col(2) = normal_at_intersect; // check if the manually constructed reference frame is the provided one CHECK_CLOSE_REL( - ataCylinder_from_pars.referenceFrame(testContext), refframe, 1e-6); + ataCylinder_from_pars.referenceFrame(tgContext), refframe, 1e-6); } /// @brief Unit test for parameters at the perigee @@ -401,21 +401,21 @@ namespace Test { pars << pars_array[0], pars_array[1], pars_array[2], pars_array[3], pars_array[4]; - BoundParameters ataPerigee_from_pars(testContext, nullptr, pars, pSurface); + BoundParameters ataPerigee_from_pars(tgContext, nullptr, pars, pSurface); auto pos = ataPerigee_from_pars.position(); auto mom = ataPerigee_from_pars.momentum(); consistencyCheck(ataPerigee_from_pars, pos, mom, 1., pars_array); // constructor from global parameters BoundParameters ataPerigee_from_global( - testContext, nullptr, pos, mom, 1., pSurface); + tgContext, nullptr, pos, mom, 1., pSurface); consistencyCheck(ataPerigee_from_global, pos, mom, 1., pars_array); // constructor for neutral parameters NeutralBoundParameters n_ataPerigee_from_pars( - testContext, nullptr, pars, pSurface); + tgContext, nullptr, pars, pSurface); consistencyCheck(n_ataPerigee_from_pars, pos, mom, 0., pars_array); // constructor for neutral global parameters NeutralBoundParameters n_ataPerigee_from_global( - testContext, nullptr, pos, mom, pSurface); + tgContext, nullptr, pos, mom, pSurface); consistencyCheck(n_ataPerigee_from_global, pos, mom, 0., pars_array); // check shared ownership of same surface @@ -483,21 +483,21 @@ namespace Test { pars_array[4]; // constructor from parameter vector - BoundParameters ataLine_from_pars(testContext, nullptr, pars, sSurface); + BoundParameters ataLine_from_pars(tgContext, nullptr, pars, sSurface); auto pos = ataLine_from_pars.position(); auto mom = ataLine_from_pars.momentum(); consistencyCheck(ataLine_from_pars, pos, mom, 1., pars_array); // constructor from global parameters BoundParameters ataLine_from_global( - testContext, nullptr, pos, mom, 1., sSurface); + tgContext, nullptr, pos, mom, 1., sSurface); consistencyCheck(ataLine_from_global, pos, mom, 1., pars_array); // constructor for neutral parameters NeutralBoundParameters n_ataLine_from_pars( - testContext, nullptr, pars, sSurface); + tgContext, nullptr, pars, sSurface); consistencyCheck(n_ataLine_from_pars, pos, mom, 0., pars_array); // constructor for neutral global parameters NeutralBoundParameters n_ataLine_from_global( - testContext, nullptr, pos, mom, sSurface); + tgContext, nullptr, pos, mom, sSurface); consistencyCheck(n_ataLine_from_global, pos, mom, 0., pars_array); // check shared ownership of same surface diff --git a/Tests/Core/EventData/CurvilinearParametersTests.cpp b/Tests/Core/EventData/CurvilinearParametersTests.cpp index 57a1b8ba94b3c30b122a2f3626ad1e7806a55281..5aa620b0cd3197b3ba67536cbc758348ca91be19 100644 --- a/Tests/Core/EventData/CurvilinearParametersTests.cpp +++ b/Tests/Core/EventData/CurvilinearParametersTests.cpp @@ -30,7 +30,7 @@ namespace Test { { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); // some position and momentum Vector3D pos(1.34, 2.34, 3.45); @@ -57,21 +57,19 @@ namespace Test { // check that the created surface is at the position CHECK_CLOSE_REL( - curvilinear_pos.referenceSurface().center(testContext), pos, 1e-6); + curvilinear_pos.referenceSurface().center(tgContext), pos, 1e-6); CHECK_CLOSE_REL( - curvilinear_neg.referenceSurface().center(testContext), pos, 1e-6); + curvilinear_neg.referenceSurface().center(tgContext), pos, 1e-6); CHECK_CLOSE_REL( - curvilinear_neut.referenceSurface().center(testContext), pos, 1e-6); + curvilinear_neut.referenceSurface().center(tgContext), pos, 1e-6); // check that the z-axis of the created surface is along momentum direction CHECK_CLOSE_REL( - curvilinear_pos.referenceSurface().normal(testContext, pos), dir, 1e-6); + curvilinear_pos.referenceSurface().normal(tgContext, pos), dir, 1e-6); CHECK_CLOSE_REL( - curvilinear_neg.referenceSurface().normal(testContext, pos), dir, 1e-6); + curvilinear_neg.referenceSurface().normal(tgContext, pos), dir, 1e-6); CHECK_CLOSE_REL( - curvilinear_neut.referenceSurface().normal(testContext, pos), - dir, - 1e-6); + curvilinear_neut.referenceSurface().normal(tgContext, pos), dir, 1e-6); // check the reference frame of curvilinear parameters // it is the x-y frame of the created surface @@ -98,19 +96,19 @@ namespace Test { /// modification test with set methods double ux = 0.1; double uy = 0.5; - curvilinear_pos_copy.set<eLOC_0>(testContext, ux); - curvilinear_pos_copy.set<eLOC_1>(testContext, uy); + curvilinear_pos_copy.set<eLOC_0>(tgContext, ux); + curvilinear_pos_copy.set<eLOC_1>(tgContext, uy); // the local parameter should still be (0,0) for Curvilinear BOOST_CHECK_EQUAL(curvilinear_pos_copy.parameters()[eLOC_0], 0); BOOST_CHECK_EQUAL(curvilinear_pos_copy.parameters()[eLOC_1], 0); // the position should be updated though Vector3D uposition - = curvilinear_neg_copy.referenceSurface().transform(testContext) + = curvilinear_neg_copy.referenceSurface().transform(tgContext) * Vector3D(ux, uy, 0.); // the position should be updated CHECK_CLOSE_REL(curvilinear_pos_copy.position(), uposition, 1e-6); // it should be the position of the surface - CHECK_CLOSE_REL(curvilinear_pos_copy.referenceSurface().center(testContext), + CHECK_CLOSE_REL(curvilinear_pos_copy.referenceSurface().center(tgContext), uposition, 1e-6); @@ -118,9 +116,9 @@ namespace Test { double utheta = 0.2; double uqop = 0.025; - curvilinear_pos_copy.set<ePHI>(testContext, uphi); - curvilinear_pos_copy.set<eTHETA>(testContext, utheta); - curvilinear_pos_copy.set<eQOP>(testContext, uqop); + curvilinear_pos_copy.set<ePHI>(tgContext, uphi); + curvilinear_pos_copy.set<eTHETA>(tgContext, utheta); + curvilinear_pos_copy.set<eQOP>(tgContext, uqop); // we should have a new updated momentum Vector3D umomentum = 40. * Vector3D(cos(uphi) * sin(utheta), sin(uphi) * sin(utheta), @@ -129,7 +127,7 @@ namespace Test { // the updated momentum should be the col(2) of the transform CHECK_CLOSE_REL(umomentum.normalized(), curvilinear_pos_copy.referenceSurface() - .transform(testContext) + .transform(tgContext) .rotation() .col(2), 1e-6); diff --git a/Tests/Core/EventData/TrackStateTests.cpp b/Tests/Core/EventData/TrackStateTests.cpp index 3b787f06ec7200f2fd0155e454b826e6ecb8babc..3ec390e54defc914487ed04b98e3779d0cda7fe5 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); using Jacobian = ActsMatrixD<5, 5>; using Identifier = unsigned long int; @@ -89,7 +89,7 @@ namespace Test { pars_array[4]; // constructor from parameter vector: predicted filtered, smoothed - BoundParameters ataPlane(testContext, nullptr, pars, plane); + BoundParameters ataPlane(tgContext, nullptr, pars, plane); // The parameter track state from the parameters BoundTrackState pts(std::move(ataPlane)); @@ -119,9 +119,9 @@ namespace Test { } // Create predicted, filtered and smoothed parameters - BoundParameters ataPlaneUpdt(testContext, nullptr, pars, plane); - BoundParameters ataPlanePred(testContext, nullptr, pars, plane); - BoundParameters ataPlaneSmth(testContext, nullptr, pars, plane); + BoundParameters ataPlaneUpdt(tgContext, nullptr, pars, plane); + BoundParameters ataPlanePred(tgContext, nullptr, pars, plane); + BoundParameters ataPlaneSmth(tgContext, nullptr, pars, plane); // Get the predicted parameters back from the trackState auto& ptsfList = trackStates[2]; @@ -147,11 +147,11 @@ namespace Test { BOOST_CHECK(ataPlanefListPred2D); // Test the sorting helper - BoundParameters ataPlaneAt1(testContext, nullptr, pars, plane); + BoundParameters ataPlaneAt1(tgContext, nullptr, pars, plane); BoundTrackState ataPlaneState1(std::move(ataPlaneAt1)); ataPlaneState1.parameter.pathLength = 1.; - BoundParameters ataPlaneAt2(testContext, nullptr, pars, plane); + BoundParameters ataPlaneAt2(tgContext, nullptr, pars, plane); BoundTrackState ataPlaneState2(std::move(ataPlaneAt2)); ataPlaneState2.parameter.pathLength = 2.; diff --git a/Tests/Core/Extrapolator/ExtrapolatorTests.cpp b/Tests/Core/Extrapolator/ExtrapolatorTests.cpp index be69bf17305ad574ad7f1c29ad19dfefbf2e1752..95f0780adf5db623e052487780e84d59c90c1ccc 100644 --- a/Tests/Core/Extrapolator/ExtrapolatorTests.cpp +++ b/Tests/Core/Extrapolator/ExtrapolatorTests.cpp @@ -38,7 +38,7 @@ namespace Acts { namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); // Global definitions // The path limit abort @@ -123,12 +123,11 @@ namespace Test { auto covPtr = std::make_unique<const ActsSymMatrixD<5>>(cov); CurvilinearParameters start(std::move(covPtr), pos, mom, q); - PropagatorOptions<> options; + PropagatorOptions<> options(tgContext); options.maxStepSize = 10. * units::_cm; options.pathLimit = 25 * units::_cm; - BOOST_CHECK(epropagator.propagate(testContext, start, options).endParameters - != nullptr); + BOOST_CHECK(epropagator.propagate(start, options).endParameters != nullptr); } // This test case checks that no segmentation fault appears @@ -181,17 +180,17 @@ namespace Test { // A PlaneSelector for the SurfaceCollector using PlaneCollector = SurfaceCollector<PlaneSelector>; - PropagatorOptions<ActionList<PlaneCollector>> options; + PropagatorOptions<ActionList<PlaneCollector>> options(tgContext); options.maxStepSize = 10. * units::_cm; options.pathLimit = 25 * units::_cm; options.debug = debugMode; - const auto& result = epropagator.propagate(testContext, start, options); + const auto& result = epropagator.propagate(start, options); auto collector_result = result.get<PlaneCollector::result_type>(); // step through the surfaces and go step by step - PropagatorOptions<> optionsEmpty; + PropagatorOptions<> optionsEmpty(tgContext); optionsEmpty.maxStepSize = 25. * units::_cm; optionsEmpty.debug = true; @@ -205,8 +204,7 @@ namespace Test { } // Extrapolate & check const auto& cresult - = epropagator.propagate(testContext, start, *csurface, optionsEmpty) - .endParameters; + = epropagator.propagate(start, *csurface, optionsEmpty).endParameters; BOOST_CHECK(cresult != nullptr); } } @@ -260,12 +258,13 @@ namespace Test { using DebugOutput = detail::DebugOutputActor; - PropagatorOptions<ActionList<MaterialInteractor, DebugOutput>> options; + PropagatorOptions<ActionList<MaterialInteractor, DebugOutput>> options( + tgContext); options.debug = debugMode; options.maxStepSize = 25. * units::_cm; options.pathLimit = 25 * units::_cm; - const auto& result = epropagator.propagate(testContext, start, options); + const auto& result = epropagator.propagate(start, options); if (result.endParameters) { // test that you actually lost some energy BOOST_CHECK_LT(result.endParameters->momentum().norm(), @@ -328,11 +327,12 @@ namespace Test { // Action list and abort list using DebugOutput = detail::DebugOutputActor; - PropagatorOptions<ActionList<MaterialInteractor, DebugOutput>> options; + PropagatorOptions<ActionList<MaterialInteractor, DebugOutput>> options( + tgContext); options.maxStepSize = 25. * units::_cm; options.pathLimit = 1500. * units::_mm; - const auto& status = epropagator.propagate(testContext, start, options); + const auto& status = epropagator.propagate(start, options); // this test assumes state.options.loopFraction = 0.5 // maximum momentum allowed double pmax = units::SI2Nat<units::MOMENTUM>( diff --git a/Tests/Core/Extrapolator/KalmanExtrapolatorTests.cpp b/Tests/Core/Extrapolator/KalmanExtrapolatorTests.cpp index f69ff3a1aeaae17845567ec7fd873eb8f5e64038..ffc248eab71c196d71c44c3254e55895731e9530 100644 --- a/Tests/Core/Extrapolator/KalmanExtrapolatorTests.cpp +++ b/Tests/Core/Extrapolator/KalmanExtrapolatorTests.cpp @@ -27,7 +27,7 @@ #include "Acts/Tests/CommonHelpers/CubicTrackingGeometry.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/Definitions.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { namespace Test { @@ -35,7 +35,7 @@ namespace Test { using Jacobian = ActsMatrixD<5, 5>; // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); /// /// @brief the bound state propagation @@ -76,8 +76,8 @@ namespace Test { auto surface = state.navigation.currentSurface; if (surface and surface->associatedDetectorElement()) { // Create a bound state and log the jacobian - auto boundState - = stepper.boundState(state.context, state.stepping, *surface, true); + auto boundState = stepper.boundState( + state.geoContext, state.stepping, *surface, true); result.jacobians.push_back(std::move(std::get<Jacobian>(boundState))); result.paths.push_back(std::get<double>(boundState)); } @@ -149,19 +149,19 @@ namespace Test { // Create some options using StepWiseOptions = PropagatorOptions<StepWiseActors, Aborters>; - StepWiseOptions swOptions; + StepWiseOptions swOptions(tgContext); using PlainActors = ActionList<>; using PlainOptions = PropagatorOptions<PlainActors, Aborters>; - PlainOptions pOptions; + PlainOptions pOptions(tgContext); // Run the standard propagation - const auto& pResult = propagator.propagate(testContext, start, pOptions); + const auto& pResult = propagator.propagate(start, pOptions); // Let's get the end parameters and jacobian matrix const auto& pJacobian = *(pResult.transportJacobian); // Run the stepwise propagation - const auto& swResult = propagator.propagate(testContext, start, swOptions); + const auto& swResult = propagator.propagate(start, swOptions); auto swJacobianTest = swResult.template get<StepWiseResult>(); // (1) Path length test diff --git a/Tests/Core/Extrapolator/MaterialCollectionTests.cpp b/Tests/Core/Extrapolator/MaterialCollectionTests.cpp index c851dd061354c03f91c1ca5d063ca3a620b84cea..f4ba516b8affd661b65d20e6c787914ff29d8159 100644 --- a/Tests/Core/Extrapolator/MaterialCollectionTests.cpp +++ b/Tests/Core/Extrapolator/MaterialCollectionTests.cpp @@ -42,7 +42,7 @@ namespace Acts { namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); // Global definitions // The path limit abort @@ -120,7 +120,7 @@ namespace Test { using AbortListType = AbortList<>; using Options = PropagatorOptions<ActionListType, AbortListType>; - Options fwdOptions; + Options fwdOptions(tgContext); fwdOptions.maxStepSize = 25. * units::_cm; fwdOptions.pathLimit = 25 * units::_cm; @@ -137,7 +137,7 @@ namespace Test { std::cout << ">>> Forward Propagation : start." << std::endl; } // forward material test - const auto& fwdResult = prop.propagate(testContext, start, fwdOptions); + const auto& fwdResult = prop.propagate(start, fwdOptions); auto& fwdMaterial = fwdResult.template get<MaterialInteractor::result_type>(); @@ -169,7 +169,7 @@ namespace Test { } // backward material test - Options bwdOptions; + Options bwdOptions(tgContext); bwdOptions.maxStepSize = -25 * units::_cm; bwdOptions.pathLimit = -25 * units::_cm; bwdOptions.direction = backward; @@ -236,7 +236,7 @@ namespace Test { // stepping from one surface to the next // now go from surface to surface and check - Options fwdStepOptions; + Options fwdStepOptions(tgContext); fwdStepOptions.maxStepSize = 25. * units::_cm; fwdStepOptions.pathLimit = 25 * units::_cm; fwdStepOptions.debug = debugModeFwdStep; @@ -273,8 +273,8 @@ namespace Test { } // make a forward step - const auto& fwdStep = prop.propagate( - testContext, *sParameters, (*fwdSteps.surface), fwdStepOptions); + const auto& fwdStep + = prop.propagate(*sParameters, (*fwdSteps.surface), fwdStepOptions); // get the backward output to the screen if (debugModeFwdStep) { const auto& fwdStepOutput @@ -303,7 +303,7 @@ namespace Test { } const auto& fwdStepFinal - = prop.propagate(testContext, *sParameters, dSurface, fwdStepOptions); + = prop.propagate(*sParameters, dSurface, fwdStepOptions); auto& fwdStepMaterial = fwdStepFinal.template get<typename MaterialInteractor::result_type>(); @@ -325,7 +325,7 @@ namespace Test { // stepping from one surface to the next : backwards // now go from surface to surface and check - Options bwdStepOptions; + Options bwdStepOptions(tgContext); bwdStepOptions.maxStepSize = -25 * units::_cm; bwdStepOptions.pathLimit = -25 * units::_cm; @@ -362,8 +362,8 @@ namespace Test { << std::endl; } // make a forward step - const auto& bwdStep = prop.propagate( - testContext, *sParameters, (*bwdSteps.surface), bwdStepOptions); + const auto& bwdStep + = prop.propagate(*sParameters, (*bwdSteps.surface), bwdStepOptions); // get the backward output to the screen if (debugModeBwdStep) { const auto& bwdStepOutput @@ -392,7 +392,7 @@ namespace Test { } const auto& bwdStepFinal - = prop.propagate(testContext, *sParameters, dbSurface, bwdStepOptions); + = prop.propagate(*sParameters, dbSurface, bwdStepOptions); auto& bwdStepMaterial = bwdStepFinal.template get<typename MaterialInteractor::result_type>(); diff --git a/Tests/Core/Extrapolator/NavigatorTests.cpp b/Tests/Core/Extrapolator/NavigatorTests.cpp index 32a3c60b89dcbcad42b83aebf15d673c3df591e5..d948ac7ba6519ec0e31b418d867950eba6865d2e 100644 --- a/Tests/Core/Extrapolator/NavigatorTests.cpp +++ b/Tests/Core/Extrapolator/NavigatorTests.cpp @@ -26,7 +26,7 @@ #include "Acts/Utilities/Definitions.hpp" #include "Acts/Utilities/Intersection.hpp" #include "Acts/Utilities/Units.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace bdata = boost::unit_test::data; namespace tt = boost::test_tools; @@ -144,7 +144,7 @@ namespace Test { Navigator::state_type navigation; // The context cache for this propagation - ContextType context = DefaultContext(); + GeometryContext geoContext = DefaultGeometryContext(); }; template <typename stepper_state_t> diff --git a/Tests/Core/Fitter/GainMatrixTests.cpp b/Tests/Core/Fitter/GainMatrixTests.cpp index 1ccf28cffd5a9dcfe609c60c36ad558227870b35..da23f699b1a603ee3de2c3a3a42e6316b9f83eb2 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); BOOST_AUTO_TEST_CASE(gain_matrix_updator) { @@ -51,7 +51,7 @@ namespace Test { ActsVectorD<Acts::NGlobalPars> parValues; parValues << 0.3, 0.5, 0.5 * M_PI, 0.3 * M_PI, 0.01; BoundParameters pars( - testContext, + tgContext, std::make_unique<const BoundParameters::CovMatrix_t>(std::move(covTrk)), parValues, cylinder); @@ -66,7 +66,7 @@ namespace Test { BOOST_CHECK(!mState.parameter.filtered); BOOST_CHECK(!mState.measurement.calibrated); - BOOST_CHECK(gmu(testContext, mState)); + BOOST_CHECK(gmu(tgContext, mState)); // filtered is set now BOOST_CHECK(!!mState.parameter.filtered); // measurement was calibrated diff --git a/Tests/Core/Fitter/KalmanFitterTests.cpp b/Tests/Core/Fitter/KalmanFitterTests.cpp index d38fa7385b7ac903a9e3a0f83361f468f2329c11..7f38943174315528af5912b19a77451bbe630168 100644 --- a/Tests/Core/Fitter/KalmanFitterTests.cpp +++ b/Tests/Core/Fitter/KalmanFitterTests.cpp @@ -38,7 +38,7 @@ #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Definitions.hpp" #include "Acts/Utilities/GeometryID.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { namespace Test { @@ -64,7 +64,7 @@ namespace Test { bool debugMode = false; // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); /// @brief This struct creates FittableMeasurements on the /// detector surfaces, according to the given smearing xxparameters @@ -106,7 +106,7 @@ namespace Test { if (lResolution != vResolution->second.end()) { // Apply global to local Acts::Vector2D lPos; - surface->globalToLocal(state.context, + surface->globalToLocal(state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), lPos); @@ -255,13 +255,14 @@ namespace Test { detRes[3] = stripVolumeRes; // Set options for propagator - PropagatorOptions<MeasurementActions, MeasurementAborters> mOptions; + PropagatorOptions<MeasurementActions, MeasurementAborters> mOptions( + tgContext); mOptions.debug = debugMode; auto& mCreator = mOptions.actionList.get<MeasurementCreator>(); mCreator.detectorResolution = detRes; // Launch and collect - the measurements - auto mResult = mPropagator.propagate(testContext, mStart, mOptions); + auto mResult = mPropagator.propagate(mStart, mOptions); if (debugMode) { const auto debugString = mResult.template get<DebugOutput::result_type>().debugString; @@ -312,12 +313,12 @@ namespace Test { KalmanFitter kFitter(rPropagator); // Fit the track - auto fittedTrack = kFitter.fit(testContext, measurements, rStart, rSurface); + auto fittedTrack = kFitter.fit(tgContext, measurements, rStart, rSurface); auto fittedParameters = fittedTrack.fittedParameters.get(); // Make sure it is deterministic auto fittedAgainTrack - = kFitter.fit(testContext, measurements, rStart, rSurface); + = kFitter.fit(tgContext, measurements, rStart, rSurface); auto fittedAgainParameters = fittedAgainTrack.fittedParameters.get(); CHECK_CLOSE_REL(fittedParameters.parameters(), @@ -334,7 +335,7 @@ namespace Test { // Make sure it works for shuffled measurements as well auto fittedShuffledTrack - = kFitter.fit(testContext, shuffledMeasurements, rStart, rSurface); + = kFitter.fit(tgContext, shuffledMeasurements, rStart, rSurface); auto fittedShuffledParameters = fittedShuffledTrack.fittedParameters.get(); CHECK_CLOSE_REL(fittedParameters.parameters(), @@ -350,7 +351,7 @@ namespace Test { // Make sure it works for shuffled measurements as well auto fittedWithHoleTrack - = kFitter.fit(testContext, measurementsWithHole, rStart, rSurface); + = kFitter.fit(tgContext, measurementsWithHole, rStart, rSurface); auto fittedWithHoleParameters = fittedWithHoleTrack.fittedParameters.get(); // Count one hole diff --git a/Tests/Core/Layers/CylinderLayerTests.cpp b/Tests/Core/Layers/CylinderLayerTests.cpp index 75b319f711b2ab973089f4cd77d297ae70244910..c656089b30349442aa8e3bdc89bf772f91413520 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); namespace Layers { BOOST_AUTO_TEST_SUITE(Layers) diff --git a/Tests/Core/Layers/DiscLayerTests.cpp b/Tests/Core/Layers/DiscLayerTests.cpp index ca02e51ebb113c509094d6116541dc179578f2e6..8e0eef2de4ebc4fa85f0d5ce4b5cae713bec1875 100644 --- a/Tests/Core/Layers/DiscLayerTests.cpp +++ b/Tests/Core/Layers/DiscLayerTests.cpp @@ -24,7 +24,7 @@ #include "Acts/Tools/SurfaceArrayCreator.hpp" #include "Acts/Volumes/CuboidVolumeBounds.hpp" #include "Acts/Volumes/CylinderVolumeBounds.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "LayerStub.hpp" @@ -36,7 +36,7 @@ namespace Acts { namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); namespace Layers { BOOST_AUTO_TEST_SUITE(Layers) diff --git a/Tests/Core/Layers/GenericApproachDescriptorTests.cpp b/Tests/Core/Layers/GenericApproachDescriptorTests.cpp index 3b1a495f8d1985616727a50f892ac1d091004b59..6ec881c13ebd8f1dff13645ec646428062efbb77 100644 --- a/Tests/Core/Layers/GenericApproachDescriptorTests.cpp +++ b/Tests/Core/Layers/GenericApproachDescriptorTests.cpp @@ -17,7 +17,7 @@ #include "Acts/Layers/GenericApproachDescriptor.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Tools/SurfaceArrayCreator.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "../Surfaces/SurfaceStub.hpp" #include "LayerStub.hpp" @@ -30,7 +30,7 @@ namespace Test { namespace Layers { // Build a default context for testing - Context testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); BOOST_AUTO_TEST_SUITE(Layers) @@ -73,7 +73,7 @@ namespace Test { BOOST_CHECK_NO_THROW(approachDescriptor.registerLayer(aLayer)); // approachSurface SurfaceIntersection surfIntersection = approachDescriptor.approachSurface( - testContext, origin, zDir, forward, bcheck); + tgContext, origin, zDir, forward, bcheck); double expectedIntersection = 20.0; // property of SurfaceStub CHECK_CLOSE_REL( surfIntersection.intersection.pathLength, expectedIntersection, 1e-6); diff --git a/Tests/Core/Layers/LayerTests.cpp b/Tests/Core/Layers/LayerTests.cpp index 1508a0160b9aceb656dac16bd5e4f8dce5ae6a43..b1545cee6592f94738685d26fb3586aba29e1ae9 100644 --- a/Tests/Core/Layers/LayerTests.cpp +++ b/Tests/Core/Layers/LayerTests.cpp @@ -25,7 +25,7 @@ #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Surfaces/RectangleBounds.hpp" #include "Acts/Tools/SurfaceArrayCreator.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Volumes/CuboidVolumeBounds.hpp" #include "LayerStub.hpp" @@ -37,7 +37,7 @@ namespace Acts { namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); namespace Layers { @@ -91,16 +91,16 @@ namespace Test { /// isOnLayer() (delegates to the Surface 'isOnSurface()') const Vector3D pos{0.0, 0.0, 0.0}; const Vector3D pos2{100., 100., std::nan("")}; - BOOST_CHECK(layerStub.isOnLayer(testContext, pos)); + BOOST_CHECK(layerStub.isOnLayer(tgContext, pos)); // this should fail, but does not, but possibly my fault in SurfaceStub // implementation: - BOOST_CHECK(!layerStub.isOnLayer(testContext, pos2)); + BOOST_CHECK(!layerStub.isOnLayer(tgContext, pos2)); /// approachDescriptor(), retrieved as a pointer. BOOST_CHECK_EQUAL(layerStub.approachDescriptor(), adPtr); const Vector3D gpos{0., 0., 1.0}; const Vector3D direction{0., 0., -1.}; /// nextLayer() - BOOST_CHECK(!(layerStub.nextLayer(testContext, gpos, direction))); + BOOST_CHECK(!(layerStub.nextLayer(tgContext, gpos, direction))); /// trackingVolume() BOOST_CHECK(!layerStub.trackingVolume()); // BOOST_TEST_CHECKPOINT("Before ending test"); diff --git a/Tests/Core/Layers/NavigationLayerTests.cpp b/Tests/Core/Layers/NavigationLayerTests.cpp index fbcc30f8a465a852ea6c8a2dee5639ca56ad3d70..4a0d1b9b2e8e3dd5d9a613270f822b7848801f75 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); namespace Layers { BOOST_AUTO_TEST_SUITE(Layers) @@ -65,17 +65,16 @@ namespace Test { BinningValue b{BinningValue::binZ}; Vector3D origin{0., 0., 0.}; // binningPosition(), needs a better test - BOOST_CHECK_EQUAL(pNavigationLayer->binningPosition(testContext, b), + BOOST_CHECK_EQUAL(pNavigationLayer->binningPosition(tgContext, b), origin); // surfaceRepresentation() [looks dangerous] BOOST_CHECK_EQUAL(rawSurfacePtr, &(pNavigationLayer->surfaceRepresentation())); // isOnLayer() - BOOST_CHECK(pNavigationLayer->isOnLayer(testContext, origin, true)); + BOOST_CHECK(pNavigationLayer->isOnLayer(tgContext, origin, true)); // isOnLayer() Vector3D crazyPosition{1000., 10000., std::nan("")}; - BOOST_CHECK( - !pNavigationLayer->isOnLayer(testContext, crazyPosition, true)); + BOOST_CHECK(!pNavigationLayer->isOnLayer(tgContext, crazyPosition, true)); // resolve() BOOST_CHECK(!pNavigationLayer->resolve(true, true, true)); } diff --git a/Tests/Core/Layers/PlaneLayerTests.cpp b/Tests/Core/Layers/PlaneLayerTests.cpp index a1362e84e985e70971d48c409960ab217ea519cf..6ae1210db4b78b365210b2864a3f6f32c4476929 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); namespace Layers { BOOST_AUTO_TEST_SUITE(Layers) diff --git a/Tests/Core/Propagator/AtlasStepperBenchmark.cpp b/Tests/Core/Propagator/AtlasStepperBenchmark.cpp index 5955251aa453519b3538ee1b7e9e9dc5c5299737..36b8d0696e434d0a9ce4c8c374111e65cf0aad45 100644 --- a/Tests/Core/Propagator/AtlasStepperBenchmark.cpp +++ b/Tests/Core/Propagator/AtlasStepperBenchmark.cpp @@ -12,7 +12,7 @@ #include "Acts/MagneticField/ConstantBField.hpp" #include "Acts/Propagator/AtlasStepper.hpp" #include "Acts/Propagator/Propagator.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Units.hpp" @@ -30,7 +30,7 @@ main(int argc, char* argv[]) bool withCov = true; // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); try { po::options_description desc("Allowed options"); @@ -73,7 +73,7 @@ main(int argc, char* argv[]) Stepper_type atlas_stepper(std::move(bField)); Propagator_type propagator(std::move(atlas_stepper)); - PropagatorOptions<> options; + PropagatorOptions<> options(tgContext); options.pathLimit = maxPath * units::_m; Vector3D pos(0, 0, 0); @@ -90,7 +90,7 @@ main(int argc, char* argv[]) double totalPathLength = 0; for (unsigned int i = 0; i < toys; ++i) { - auto r = propagator.propagate(testContext, pars, options); + auto r = propagator.propagate(pars, options); ACTS_DEBUG("reached position (" << r.endParameters->position().x() << ", " << r.endParameters->position().y() << ", " diff --git a/Tests/Core/Propagator/EigenStepperBenchmark.cpp b/Tests/Core/Propagator/EigenStepperBenchmark.cpp index afdff35c7d3b3c9b2149e5406915f9d07b0d51c5..5cc4cfa64b4520d3d1e768e0114eac9ade7a19fb 100644 --- a/Tests/Core/Propagator/EigenStepperBenchmark.cpp +++ b/Tests/Core/Propagator/EigenStepperBenchmark.cpp @@ -12,7 +12,7 @@ #include "Acts/MagneticField/ConstantBField.hpp" #include "Acts/Propagator/EigenStepper.hpp" #include "Acts/Propagator/Propagator.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Logger.hpp" #include "Acts/Utilities/Units.hpp" @@ -30,7 +30,7 @@ main(int argc, char* argv[]) bool withCov = true; // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); try { po::options_description desc("Allowed options"); @@ -73,7 +73,7 @@ main(int argc, char* argv[]) Stepper_type atlas_stepper(std::move(bField)); Propagator_type propagator(std::move(atlas_stepper)); - PropagatorOptions<> options; + PropagatorOptions<> options(tgContext); options.pathLimit = maxPath * units::_m; Vector3D pos(0, 0, 0); @@ -90,7 +90,7 @@ main(int argc, char* argv[]) double totalPathLength = 0; for (unsigned int i = 0; i < toys; ++i) { - auto r = propagator.propagate(testContext, pars, options); + auto r = propagator.propagate(pars, options); ACTS_DEBUG("reached position (" << r.endParameters->position().x() << ", " << r.endParameters->position().y() << ", " diff --git a/Tests/Core/Propagator/IntersectionCorrectorTests.cpp b/Tests/Core/Propagator/IntersectionCorrectorTests.cpp index 9305174700aa763bd58771a5dee237237689ef5e..5b87db19c54eb27c00e788f17ec3371061e00dab 100644 --- a/Tests/Core/Propagator/IntersectionCorrectorTests.cpp +++ b/Tests/Core/Propagator/IntersectionCorrectorTests.cpp @@ -36,7 +36,7 @@ namespace Test { { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); // construct the surface Vector3D pcenter(-4., 4., 0.); @@ -59,9 +59,9 @@ namespace Test { double pathp = 13.; auto intersect - = [&testContext, &position, &direction, &plane]() -> Intersection { + = [&tgContext, &position, &direction, &plane]() -> Intersection { auto pi = plane->intersectionEstimate( - testContext, position, direction, forward, false); + tgContext, position, direction, forward, false); std::cout << "Interseciton it at " << toString(pi.position) << std::endl; return pi; }; diff --git a/Tests/Core/Propagator/JacobianTests.cpp b/Tests/Core/Propagator/JacobianTests.cpp index 5be97ca6cd289edd16670ad07c81de0eecf7b27c..bde6d940a86f150de777817d15e97a9af36ffbac 100644 --- a/Tests/Core/Propagator/JacobianTests.cpp +++ b/Tests/Core/Propagator/JacobianTests.cpp @@ -24,7 +24,7 @@ #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Surfaces/StrawSurface.hpp" #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace bdata = boost::unit_test::data; namespace tt = boost::test_tools; @@ -38,7 +38,7 @@ namespace Test { using AtlasStepperType = AtlasStepper<BFieldType>; // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); /// Helper method to create a transform for a plane /// to mimic detector situations, the plane is roughly @@ -134,9 +134,9 @@ namespace Test { { // Jacobian creation for Propagator/Steppers // a) ATLAS stepper - AtlasStepperType::State astepState(testContext, pars); + AtlasStepperType::State astepState(tgContext, pars); // b) Eigen stepper - EigenStepperType::State estepState(testContext, pars); + EigenStepperType::State estepState(tgContext, pars); // create the matrices auto asMatrix = convertToMatrix(astepState.pVector); @@ -182,7 +182,7 @@ namespace Test { pars << 182.34, -82., 0.134, 0.85, 1. / (100 * units::_GeV); BoundParameters atCylinder( - testContext, std::move(covPtr), std::move(pars), cSurface); + tgContext, std::move(covPtr), std::move(pars), cSurface); // run the test testJacobianToGlobal(atCylinder); @@ -206,7 +206,7 @@ namespace Test { pars << 192.34, 1.823, 0.734, 0.235, 1. / (100 * units::_GeV); BoundParameters atDisc( - testContext, std::move(covPtr), std::move(pars), dSurface); + tgContext, std::move(covPtr), std::move(pars), dSurface); // run the test testJacobianToGlobal(atDisc); @@ -231,7 +231,7 @@ namespace Test { pars << 12.34, -8722., 2.134, 0.85, 1. / (100 * units::_GeV); BoundParameters atPlane( - testContext, std::move(covPtr), std::move(pars), pSurface); + tgContext, std::move(covPtr), std::move(pars), pSurface); // run the test testJacobianToGlobal(atPlane); @@ -253,7 +253,7 @@ namespace Test { pars << -3.34, -822., -0.734, 0.85, 1. / (100 * units::_GeV); BoundParameters perigee( - testContext, std::move(covPtr), std::move(pars), pSurface); + tgContext, std::move(covPtr), std::move(pars), pSurface); // run the test testJacobianToGlobal(perigee); @@ -275,7 +275,7 @@ namespace Test { pars << -8.34, 812., 0.734, 0.25, 1. / (100 * units::_GeV); BoundParameters atStraw( - testContext, std::move(covPtr), std::move(pars), sSurface); + tgContext, std::move(covPtr), std::move(pars), sSurface); // run the test testJacobianToGlobal(atStraw); diff --git a/Tests/Core/Propagator/LoopProtectionTests.cpp b/Tests/Core/Propagator/LoopProtectionTests.cpp index 9d5d416162550805cbec78ecd4d8efdc3ea60556..622d9af0815f22f6663a3b6813cb1452ef831fb8 100644 --- a/Tests/Core/Propagator/LoopProtectionTests.cpp +++ b/Tests/Core/Propagator/LoopProtectionTests.cpp @@ -34,7 +34,7 @@ using namespace detail; namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); /// @brief mockup of stepping state struct SteppingState @@ -209,9 +209,9 @@ namespace Test { Vector3D mom(px, py, pz); CurvilinearParameters start(nullptr, pos, mom, q); - PropagatorOptions<> options; + PropagatorOptions<> options(tgContext); options.maxSteps = 1e6; - const auto& result = epropagator.propagate(testContext, start, options); + const auto& result = epropagator.propagate(start, options); // this test assumes state.options.loopFraction = 0.5 CHECK_CLOSE_REL(px, -result.endParameters->momentum().x(), 1e-2); diff --git a/Tests/Core/Propagator/PropagatorTests.cpp b/Tests/Core/Propagator/PropagatorTests.cpp index 15554bf6a7ffb594f7a34784a0b66a529f5c2b57..1ffbeb61b2525cbb65f330d14231a79714083551 100644 --- a/Tests/Core/Propagator/PropagatorTests.cpp +++ b/Tests/Core/Propagator/PropagatorTests.cpp @@ -25,7 +25,7 @@ #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp" #include "Acts/Utilities/Definitions.hpp" #include "Acts/Utilities/Units.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace bdata = boost::unit_test::data; namespace tt = boost::test_tools; @@ -37,7 +37,7 @@ namespace Acts { namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); using cstep = detail::ConstrainedStep; @@ -103,7 +103,7 @@ namespace Test { // calculate the distance to the surface const double distance = surface - ->intersectionEstimate(state.context, + ->intersectionEstimate(state.geoContext, stepper.position(state.stepping), stepper.direction(state.stepping), forward, @@ -154,7 +154,7 @@ namespace Test { { using null_options_type = PropagatorOptions<>; - null_options_type null_options; + null_options_type null_options(tgContext); // todo write null options test using ActionList_type = ActionList<PerpendicularMeasure>; @@ -163,7 +163,7 @@ namespace Test { using options_type = PropagatorOptions<ActionList_type, AbortConditions_type>; - options_type options; + options_type options(tgContext); } BOOST_DATA_TEST_CASE( @@ -196,7 +196,7 @@ namespace Test { using AbortConditions_type = AbortList<>; // setup propagation options - PropagatorOptions<ActionList_type, AbortConditions_type> options; + PropagatorOptions<ActionList_type, AbortConditions_type> options(tgContext); options.pathLimit = 20 * units::_m; options.maxStepSize = 1 * units::_cm; @@ -218,9 +218,8 @@ namespace Test { Vector3D mom(px, py, pz); CurvilinearParameters start(nullptr, pos, mom, q); // propagate to the cylinder surface - const auto& result - = epropagator.propagate(testContext, start, *cSurface, options); - auto& sor = result.get<so_result>(); + const auto& result = epropagator.propagate(start, *cSurface, options); + auto& sor = result.get<so_result>(); BOOST_CHECK_EQUAL(sor.surfaces_passed, 1); CHECK_CLOSE_ABS(sor.surface_passed_r, 10., 1e-5); @@ -252,7 +251,7 @@ namespace Test { (void)index; // setup propagation options - the tow step options - PropagatorOptions<> options_2s; + PropagatorOptions<> options_2s(tgContext); options_2s.pathLimit = 50 * units::_cm; options_2s.maxStepSize = 1 * units::_cm; @@ -276,18 +275,17 @@ namespace Test { CurvilinearParameters start(std::move(covPtr), pos, mom, q); // propagate to a path length of 100 with two steps of 50 const auto& mid_parameters - = epropagator.propagate(testContext, start, options_2s).endParameters; + = epropagator.propagate(start, options_2s).endParameters; const auto& end_parameters_2s - = epropagator.propagate(testContext, *mid_parameters, options_2s) - .endParameters; + = epropagator.propagate(*mid_parameters, options_2s).endParameters; // setup propagation options - the one step options - PropagatorOptions<> options_1s; + PropagatorOptions<> options_1s(tgContext); options_1s.pathLimit = 100 * units::_cm; options_1s.maxStepSize = 1 * units::_cm; // propagate to a path length of 100 in one step const auto& end_parameters_1s - = epropagator.propagate(testContext, start, options_1s).endParameters; + = epropagator.propagate(start, options_1s).endParameters; // test that the propagation is additive CHECK_CLOSE_REL( @@ -325,7 +323,7 @@ namespace Test { (void)index; // setup propagation options - 2 setp options - PropagatorOptions<> options_2s; + PropagatorOptions<> options_2s(tgContext); options_2s.pathLimit = 10 * units::_m; options_2s.maxStepSize = 1 * units::_cm; @@ -349,22 +347,19 @@ namespace Test { CurvilinearParameters start(std::move(covPtr), pos, mom, q); // propagate to a final surface with one stop in between const auto& mid_parameters - = epropagator.propagate(testContext, start, *mSurface, options_2s) - .endParameters; + = epropagator.propagate(start, *mSurface, options_2s).endParameters; const auto& end_parameters_2s - = epropagator - .propagate(testContext, *mid_parameters, *cSurface, options_2s) + = epropagator.propagate(*mid_parameters, *cSurface, options_2s) .endParameters; // setup propagation options - one step options - PropagatorOptions<> options_1s; + PropagatorOptions<> options_1s(tgContext); options_1s.pathLimit = 10 * units::_m; options_1s.maxStepSize = 1 * units::_cm; // propagate to a final surface in one stop const auto& end_parameters_1s - = epropagator.propagate(testContext, start, *cSurface, options_1s) - .endParameters; + = epropagator.propagate(start, *cSurface, options_1s).endParameters; // test that the propagation is additive CHECK_CLOSE_REL( diff --git a/Tests/Core/Propagator/StepperTests.cpp b/Tests/Core/Propagator/StepperTests.cpp index bccfebeb1f4465803e11132ec3bc93e53756d753..c562a1dd1ea92041cdb8a11f6eacf748cbe41e0a 100644 --- a/Tests/Core/Propagator/StepperTests.cpp +++ b/Tests/Core/Propagator/StepperTests.cpp @@ -37,7 +37,7 @@ namespace Test { using cstep = detail::ConstrainedStep; // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); /// /// @brief Aborter for the case that a particle leaves the detector or reaches /// a custom made threshold. @@ -161,7 +161,7 @@ namespace Test { // Set options for propagator DenseStepperPropagatorOptions<ActionList<StepCollector>, AbortList<EndOfWorld>> - propOpts; + propOpts(tgContext); propOpts.actionList = aList; propOpts.abortList = abortList; propOpts.maxSteps = 100; @@ -184,7 +184,7 @@ namespace Test { prop(es, naviVac); // Launch and collect results - const auto& result = prop.propagate(testContext, sbtp, propOpts); + const auto& result = prop.propagate(sbtp, propOpts); const StepCollector::this_result& stepResult = result.get<typename StepCollector::result_type>(); @@ -204,7 +204,7 @@ namespace Test { // Set options for propagator PropagatorOptions<ActionList<StepCollector>, AbortList<EndOfWorld>> - propOptsDef; + propOptsDef(tgContext); propOptsDef.actionList = aListDef; propOptsDef.abortList = abortList; propOptsDef.maxSteps = 100; @@ -221,7 +221,7 @@ namespace Test { propDef(esDef, naviVac); // Launch and collect results - const auto& resultDef = propDef.propagate(testContext, sbtp, propOptsDef); + const auto& resultDef = propDef.propagate(sbtp, propOptsDef); const StepCollector::this_result& stepResultDef = resultDef.get<typename StepCollector::result_type>(); @@ -282,7 +282,7 @@ namespace Test { // Set options for propagator DenseStepperPropagatorOptions<ActionList<StepCollector>, AbortList<EndOfWorld>> - propOpts; + propOpts(tgContext); propOpts.actionList = aList; propOpts.abortList = abortList; propOpts.maxSteps = 100; @@ -306,7 +306,7 @@ namespace Test { prop(es, naviMat); // Launch and collect results - const auto& result = prop.propagate(testContext, sbtp, propOpts); + const auto& result = prop.propagate(sbtp, propOpts); const StepCollector::this_result& stepResult = result.get<typename StepCollector::result_type>(); @@ -334,7 +334,7 @@ namespace Test { // Set options for propagator DenseStepperPropagatorOptions<ActionList<StepCollector>, AbortList<EndOfWorld>> - propOptsDense; + propOptsDense(tgContext); propOptsDense.actionList = aList; propOptsDense.abortList = abortList; propOptsDense.maxSteps = 100; @@ -353,8 +353,7 @@ namespace Test { propDense(esDense, naviMat); // Launch and collect results - const auto& resultDense - = propDense.propagate(testContext, sbtp, propOptsDense); + const auto& resultDense = propDense.propagate(sbtp, propOptsDense); const StepCollector::this_result& stepResultDense = resultDense.get<typename StepCollector::result_type>(); @@ -390,7 +389,7 @@ namespace Test { Navigator> propB(esB, naviMat); - const auto& resultB = propB.propagate(testContext, sbtp, propOptsDense); + const auto& resultB = propB.propagate(sbtp, propOptsDense); const StepCollector::this_result& stepResultB = resultB.get<typename StepCollector::result_type>(); @@ -468,7 +467,7 @@ namespace Test { // Set options for propagator DenseStepperPropagatorOptions<ActionList<StepCollector>, AbortList<EndOfWorld>> - propOpts; + propOpts(tgContext); propOpts.actionList = aList; propOpts.abortList = abortList; propOpts.maxSteps = 100; @@ -491,7 +490,7 @@ namespace Test { prop(es, naviDet); // Launch and collect results - const auto& result = prop.propagate(testContext, sbtp, propOpts); + const auto& result = prop.propagate(sbtp, propOpts); const StepCollector::this_result& stepResult = result.get<typename StepCollector::result_type>(); @@ -500,29 +499,26 @@ namespace Test { // Collect boundaries std::vector<Surface const*> surs; std::vector<std::shared_ptr<const BoundarySurfaceT<TrackingVolume>>> - boundaries = det->trackingVolume(testContext, {0.5 * units::_m, 0., 0.}) + boundaries = det->trackingVolume(tgContext, {0.5 * units::_m, 0., 0.}) ->boundarySurfaces(); for (auto& b : boundaries) { - if (b->surfaceRepresentation().center(testContext).x() - == 1. * units::_m) { + if (b->surfaceRepresentation().center(tgContext).x() == 1. * units::_m) { surs.push_back(&(b->surfaceRepresentation())); break; } } - boundaries = det->trackingVolume(testContext, {1.5 * units::_m, 0., 0.}) + boundaries = det->trackingVolume(tgContext, {1.5 * units::_m, 0., 0.}) ->boundarySurfaces(); for (auto& b : boundaries) { - if (b->surfaceRepresentation().center(testContext).x() - == 2. * units::_m) { + if (b->surfaceRepresentation().center(tgContext).x() == 2. * units::_m) { surs.push_back(&(b->surfaceRepresentation())); break; } } - boundaries = det->trackingVolume(testContext, {2.5 * units::_m, 0., 0.}) + boundaries = det->trackingVolume(tgContext, {2.5 * units::_m, 0., 0.}) ->boundarySurfaces(); for (auto& b : boundaries) { - if (b->surfaceRepresentation().center(testContext).x() - == 3. * units::_m) { + if (b->surfaceRepresentation().center(tgContext).x() == 3. * units::_m) { surs.push_back(&(b->surfaceRepresentation())); break; } @@ -533,7 +529,7 @@ namespace Test { ActionList<StepCollector> aListDef; PropagatorOptions<ActionList<StepCollector>, AbortList<EndOfWorld>> - propOptsDef; + propOptsDef(tgContext); abortList.get<EndOfWorld>().maxX = 1. * units::_m; propOptsDef.actionList = aListDef; propOptsDef.abortList = abortList; @@ -552,8 +548,7 @@ namespace Test { propDef(esDef, naviDet); // Launch and collect results - const auto& resultDef - = propDef.propagate(testContext, sbtp, *(surs[0]), propOptsDef); + const auto& resultDef = propDef.propagate(sbtp, *(surs[0]), propOptsDef); const StepCollector::this_result& stepResultDef = resultDef.get<typename StepCollector::result_type>(); @@ -590,7 +585,7 @@ namespace Test { // Set options for propagator DenseStepperPropagatorOptions<ActionList<StepCollector>, AbortList<EndOfWorld>> - propOptsDense; + propOptsDense(tgContext); abortList.get<EndOfWorld>().maxX = 2. * units::_m; propOptsDense.actionList = aList; propOptsDense.abortList = abortList; @@ -610,8 +605,8 @@ namespace Test { propDense(esDense, naviDet); // Launch and collect results - const auto& resultDense = propDense.propagate( - testContext, sbtpPiecewise, *(surs[1]), propOptsDense); + const auto& resultDense + = propDense.propagate(sbtpPiecewise, *(surs[1]), propOptsDense); const StepCollector::this_result& stepResultDense = resultDense.get<typename StepCollector::result_type>(); diff --git a/Tests/Core/Surfaces/ConeSurfaceTests.cpp b/Tests/Core/Surfaces/ConeSurfaceTests.cpp index 6edc5ef2c0b0e24f7b0d8560113016b38c2fb2d6..a6c1a1fe9868d06e22f84dacc6988f2924915876 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); BOOST_AUTO_TEST_SUITE(ConeSurfaces) /// Unit test for creating compliant/non-compliant ConeSurface object @@ -80,7 +80,7 @@ namespace Test { // /// Copied and transformed auto copiedTransformedConeSurface = Surface::makeShared<ConeSurface>( - testContext, *coneSurfaceObject, *pTransform); + tgContext, *coneSurfaceObject, *pTransform); BOOST_CHECK_EQUAL(copiedTransformedConeSurface->type(), Surface::Cone); /// Construct with nullptr bounds @@ -102,7 +102,7 @@ namespace Test { = Surface::makeShared<ConeSurface>(pTransform, alpha, symmetric); // auto pClonedConeSurface - = coneSurfaceObject->clone(testContext, Transform3D::Identity()); + = coneSurfaceObject->clone(tgContext, Transform3D::Identity()); BOOST_CHECK_EQUAL(pClonedConeSurface->type(), Surface::Cone); // /// Test type (redundant) @@ -111,7 +111,7 @@ namespace Test { /// Test binningPosition Vector3D binningPosition{0., 1., 2.}; CHECK_CLOSE_ABS( - coneSurfaceObject->binningPosition(testContext, BinningValue::binPhi), + coneSurfaceObject->binningPosition(tgContext, BinningValue::binPhi), binningPosition, 1e-6); // @@ -122,29 +122,31 @@ namespace Test { RotationMatrix3D expectedFrame; expectedFrame << -rootHalf, 0., rootHalf, rootHalf, 0., rootHalf, 0., 1., 0.; - CHECK_CLOSE_OR_SMALL(coneSurfaceObject->referenceFrame( - testContext, globalPosition, momentum), - expectedFrame, - 1e-6, - 1e-9); + CHECK_CLOSE_OR_SMALL( + coneSurfaceObject->referenceFrame(tgContext, globalPosition, momentum), + expectedFrame, + 1e-6, + 1e-9); // /// Test normal, given 3D position Vector3D origin{0., 0., 0.}; Vector3D normal3D = {0., -1., 0.}; CHECK_CLOSE_ABS( - coneSurfaceObject->normal(testContext, origin), normal3D, 1e-6); + coneSurfaceObject->normal(tgContext, origin), normal3D, 1e-6); // /// Test normal given 2D rphi position Vector2D positionPiBy2(1.0, M_PI / 2.); Vector3D normalAtPiBy2{0.0312768, 0.92335, -0.382683}; - CHECK_CLOSE_OR_SMALL( - coneSurfaceObject->normal(positionPiBy2), normalAtPiBy2, 1e-2, 1e-9); + CHECK_CLOSE_OR_SMALL(coneSurfaceObject->normal(tgContext, positionPiBy2), + normalAtPiBy2, + 1e-2, + 1e-9); // /// Test rotational symmetry axis Vector3D symmetryAxis{0., 0., 1.}; CHECK_CLOSE_ABS( - coneSurfaceObject->rotSymmetryAxis(testContext), symmetryAxis, 1e-6); + coneSurfaceObject->rotSymmetryAxis(tgContext), symmetryAxis, 1e-6); // /// Test bounds BOOST_CHECK_EQUAL(coneSurfaceObject->bounds().type(), SurfaceBounds::Cone); @@ -152,7 +154,7 @@ namespace Test { /// Test localToGlobal Vector2D localPosition{1.0, M_PI / 2.0}; coneSurfaceObject->localToGlobal( - testContext, localPosition, momentum, globalPosition); + tgContext, localPosition, momentum, globalPosition); // std::cout<<globalPosition<<std::endl; Vector3D expectedPosition{0.0220268, 1.65027, 3.5708}; @@ -160,7 +162,7 @@ namespace Test { // /// Testing globalToLocal coneSurfaceObject->globalToLocal( - testContext, globalPosition, momentum, localPosition); + tgContext, globalPosition, momentum, localPosition); // std::cout<<localPosition<<std::endl; Vector2D expectedLocalPosition{1.0, M_PI / 2.0}; @@ -169,14 +171,14 @@ namespace Test { /// Test isOnSurface Vector3D offSurface{100, 1, 2}; BOOST_CHECK(coneSurfaceObject->isOnSurface( - testContext, globalPosition, momentum, true)); - BOOST_CHECK(!coneSurfaceObject->isOnSurface( - testContext, offSurface, momentum, true)); + tgContext, globalPosition, momentum, true)); + BOOST_CHECK( + !coneSurfaceObject->isOnSurface(tgContext, offSurface, momentum, true)); // /// intersectionEstimate Vector3D direction{-1., 0, 0}; auto intersect = coneSurfaceObject->intersectionEstimate( - testContext, offSurface, direction, forward, false); + tgContext, offSurface, direction, forward, false); Intersection expectedIntersect{Vector3D{0, 1, 2}, 100., true, 0}; BOOST_CHECK(intersect.valid); CHECK_CLOSE_ABS(intersect.position, expectedIntersect.position, 1e-6); @@ -185,7 +187,7 @@ namespace Test { // /// Test pathCorrection CHECK_CLOSE_REL( - coneSurfaceObject->pathCorrection(testContext, offSurface, momentum), + coneSurfaceObject->pathCorrection(tgContext, offSurface, momentum), 0.40218866453252877, 0.01); // diff --git a/Tests/Core/Surfaces/CylinderSurfaceTests.cpp b/Tests/Core/Surfaces/CylinderSurfaceTests.cpp index bf27eddfb0a8ebe34bfbdb83f582134a915d5593..eada8a2e94a6d34e40fe31e98568f35f7ad1296e 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 - ContextType testContext = DefaultContext(); + GeometryContext testContext = DefaultGeometryContext(); 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 1fecc05ee05afcfaef8a4bc5c186f7a5c512d381..ff648a993adb7778bfa9ea07227e8569f3baa688 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); BOOST_AUTO_TEST_SUITE(Surfaces) /// Unit tests for creating DiscSurface object @@ -67,7 +67,7 @@ namespace Test { // /// Copied and transformed DiscSurface BOOST_CHECK_NO_THROW(Surface::makeShared<DiscSurface>( - testContext, *anotherDiscSurface, *pTransform)); + tgContext, *anotherDiscSurface, *pTransform)); /// Construct with nullptr bounds DetectorElementStub detElem; @@ -90,18 +90,18 @@ namespace Test { // /// Test normal, no local position specified Vector3D zAxis{0, 0, 1}; - BOOST_CHECK_EQUAL(discSurfaceObject->normal(testContext), zAxis); + BOOST_CHECK_EQUAL(discSurfaceObject->normal(tgContext), zAxis); // /// Test normal, local position specified Vector2D lpos(2.0, 0.05); - BOOST_CHECK_EQUAL(discSurfaceObject->normal(testContext, lpos), zAxis); + BOOST_CHECK_EQUAL(discSurfaceObject->normal(tgContext, lpos), zAxis); // /// Test binningPosition // auto binningPosition= // discSurfaceObject.binningPosition(BinningValue::binRPhi ); // std::cout<<binningPosition<<std::endl; BOOST_CHECK_EQUAL( - discSurfaceObject->binningPosition(testContext, BinningValue::binRPhi), + discSurfaceObject->binningPosition(tgContext, BinningValue::binRPhi), origin3D); // /// Test bounds @@ -112,9 +112,9 @@ namespace Test { Vector3D point3DNotInSector{0.0, 1.2, 0}; Vector3D point3DOnSurface{1.2, 0.0, 0}; BOOST_CHECK(!discSurfaceObject->isOnSurface( - testContext, point3DNotInSector, ignoredMomentum, true)); // passes + tgContext, point3DNotInSector, ignoredMomentum, true)); // passes BOOST_CHECK(discSurfaceObject->isOnSurface( - testContext, point3DOnSurface, ignoredMomentum, true)); // passes + tgContext, point3DOnSurface, ignoredMomentum, true)); // passes // /// Test localToGlobal Vector3D returnedPosition{10.9, 8.7, 6.5}; @@ -122,11 +122,11 @@ namespace Test { Vector2D rPhiOnDisc{1.2, 0.0}; Vector2D rPhiNotInSector{1.2, M_PI}; // outside sector at Phi=0, +/- pi/8 discSurfaceObject->localToGlobal( - testContext, rPhiOnDisc, ignoredMomentum, returnedPosition); + tgContext, rPhiOnDisc, ignoredMomentum, returnedPosition); CHECK_CLOSE_ABS(returnedPosition, expectedPosition, 1e-6); // discSurfaceObject->localToGlobal( - testContext, rPhiNotInSector, ignoredMomentum, returnedPosition); + tgContext, rPhiNotInSector, ignoredMomentum, returnedPosition); Vector3D expectedNonPosition{-1.2, 0, 0}; CHECK_CLOSE_ABS(returnedPosition, expectedNonPosition, 1e-6); // @@ -134,21 +134,21 @@ namespace Test { Vector2D returnedLocalPosition{33., 44.}; Vector2D expectedLocalPosition{1.2, 0.0}; BOOST_CHECK( - discSurfaceObject->globalToLocal(testContext, + discSurfaceObject->globalToLocal(tgContext, point3DOnSurface, ignoredMomentum, returnedLocalPosition)); // pass CHECK_CLOSE_ABS(returnedLocalPosition, expectedLocalPosition, 1e-6); // BOOST_CHECK(!discSurfaceObject->globalToLocal( - testContext, + tgContext, point3DNotInSector, ignoredMomentum, returnedLocalPosition)); // test fails // Vector3D pointOutsideRadius{0.0, 100., 0}; BOOST_CHECK( - !discSurfaceObject->globalToLocal(testContext, + !discSurfaceObject->globalToLocal(tgContext, pointOutsideRadius, ignoredMomentum, returnedLocalPosition)); // fails @@ -171,13 +171,13 @@ namespace Test { /// Test localCartesianToGlobal Vector3D cartesian3D1_1{1., 1., 0.}; CHECK_CLOSE_ABS( - discSurfaceObject->localCartesianToGlobal(testContext, cartesian1_1), + discSurfaceObject->localCartesianToGlobal(tgContext, cartesian1_1), cartesian3D1_1, 1e-6); // /// Test globalToLocalCartesian CHECK_CLOSE_REL( - discSurfaceObject->globalToLocalCartesian(testContext, cartesian3D1_1), + discSurfaceObject->globalToLocalCartesian(tgContext, cartesian3D1_1), cartesian1_1, 1e-6); // @@ -186,10 +186,10 @@ namespace Test { Vector3D momentum{ projected3DMomentum, projected3DMomentum, projected3DMomentum}; Vector3D ignoredPosition{1.1, 2.2, 3.3}; - CHECK_CLOSE_REL(discSurfaceObject->pathCorrection( - testContext, ignoredPosition, momentum), - std::sqrt(3), - 0.01); + CHECK_CLOSE_REL( + discSurfaceObject->pathCorrection(tgContext, ignoredPosition, momentum), + std::sqrt(3), + 0.01); // /// intersectionEstimate Vector3D globalPosition{1.2, 0.0, -10.}; @@ -198,7 +198,7 @@ namespace Test { // intersect is a struct of (Vector3D) position, pathLength, distance and // (bool) valid auto intersect = discSurfaceObject->intersectionEstimate( - testContext, globalPosition, direction); + tgContext, globalPosition, direction); Intersection expectedIntersect{Vector3D{1.2, 0., 0.}, 10., true, 0.0}; BOOST_CHECK(intersect.valid); CHECK_CLOSE_ABS(intersect.position, expectedIntersect.position, 1e-9); diff --git a/Tests/Core/Surfaces/LineSurfaceTests.cpp b/Tests/Core/Surfaces/LineSurfaceTests.cpp index 38eeaf8795abb42dc68264aa3aada0487d338f04..d09491340a8ddd0d0fe8914da7f9f47f50d8b996 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); // using boost::test_tools::output_test_stream; @@ -62,7 +62,7 @@ namespace Test { BOOST_CHECK(LineSurfaceStub(lineToCopy).constructedOk()); // Copied and transformed ctor BOOST_CHECK( - LineSurfaceStub(testContext, lineToCopy, transform).constructedOk()); + LineSurfaceStub(tgContext, lineToCopy, transform).constructedOk()); /// Construct with nullptr bounds DetectorElementStub detElem; @@ -82,7 +82,7 @@ namespace Test { LineSurfaceStub line(pTransform, 2.0, 20.); Vector3D referencePosition{0., 1., 2.}; CHECK_CLOSE_ABS( - referencePosition, line.binningPosition(testContext, binX), 1e-6); + referencePosition, line.binningPosition(tgContext, binX), 1e-6); // // bounds() auto pLineBounds = std::make_shared<const LineBounds>(10.0); @@ -95,7 +95,7 @@ namespace Test { Vector3D gpos{0., 1., 0.}; const Vector3D mom{20., 0., 0.}; // needs more realistic parameters Vector2D localPosition; - BOOST_CHECK(line.globalToLocal(testContext, gpos, mom, localPosition)); + BOOST_CHECK(line.globalToLocal(tgContext, gpos, mom, localPosition)); const Vector2D expectedResult{0, -2}; CHECK_CLOSE_ABS(expectedResult, localPosition, 1e-6); // @@ -104,7 +104,7 @@ namespace Test { NavigationDirection navDir = anyDirection; BoundaryCheck bcheck(false); auto intersection = line.intersectionEstimate( - testContext, {0., 0., 0.}, direction.normalized(), navDir, bcheck); + tgContext, {0., 0., 0.}, direction.normalized(), navDir, bcheck); BOOST_CHECK(intersection.valid); Vector3D expectedIntersection(0, 1., 2.); CHECK_CLOSE_ABS(intersection.position, @@ -114,23 +114,23 @@ namespace Test { // isOnSurface const Vector3D insidePosition{0., 2.5, 0.}; BOOST_CHECK(line.isOnSurface( - testContext, insidePosition, mom, false)); // need better test here + tgContext, insidePosition, mom, false)); // need better test here const Vector3D outsidePosition{100., 100., 200.}; - BOOST_CHECK(!line.isOnSurface(testContext, outsidePosition, mom, true)); + BOOST_CHECK(!line.isOnSurface(tgContext, outsidePosition, mom, true)); // // localToGlobal Vector3D returnedGlobalPosition{0., 0., 0.}; // Vector2D localPosition{0., 0.}; const Vector3D momentum{300., 200., 0.}; // find better values! line.localToGlobal( - testContext, localPosition, momentum, returnedGlobalPosition); + tgContext, localPosition, momentum, returnedGlobalPosition); const Vector3D expectedGlobalPosition{0, 1, 0}; CHECK_CLOSE_ABS(returnedGlobalPosition, expectedGlobalPosition, 1e-6); // // referenceFrame Vector3D globalPosition{0., 0., 0.}; auto returnedRotationMatrix - = line.referenceFrame(testContext, globalPosition, momentum); + = line.referenceFrame(tgContext, globalPosition, momentum); double v0 = std::cos(std::atan(2. / 3.)); double v1 = std::sin(std::atan(2. / 3.)); RotationMatrix3D expectedRotationMatrix; @@ -147,12 +147,12 @@ namespace Test { // // normal Vector3D normalVector{0., 0., 1.}; // line direction is same as normal???? - CHECK_CLOSE_ABS(line.normal(testContext), normalVector, 1e-6); + CHECK_CLOSE_ABS(line.normal(tgContext), normalVector, 1e-6); // // pathCorrection auto any3DVector = normalVector; CHECK_CLOSE_REL( - line.pathCorrection(testContext, any3DVector, any3DVector), 1., 1e-6); + line.pathCorrection(tgContext, any3DVector, any3DVector), 1., 1e-6); } /// Unit test for testing LineSurface assignment BOOST_AUTO_TEST_CASE(LineSurface_assignment_test) diff --git a/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp b/Tests/Core/Surfaces/PerigeeSurfaceTests.cpp index 8178ef13406f15c90d4ad6eafa7680c9d70cc7a2..418f80d1556b88769bd7e121be02636ad25801ee 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); BOOST_AUTO_TEST_SUITE(PerigeeSurfaces) /// Unit test for creating compliant/non-compliant PerigeeSurface object @@ -64,7 +64,7 @@ namespace Test { // /// Copied and transformed auto copiedTransformedPerigeeSurface = Surface::makeShared<PerigeeSurface>( - testContext, *perigeeSurfaceObject, *pTransform); + tgContext, *perigeeSurfaceObject, *pTransform); BOOST_CHECK_EQUAL(copiedTransformedPerigeeSurface->type(), Surface::Perigee); } @@ -76,7 +76,7 @@ namespace Test { Vector3D unitXYZ{1., 1., 1.}; auto perigeeSurfaceObject = Surface::makeShared<PerigeeSurface>(unitXYZ); auto pClonedPerigeeSurface - = perigeeSurfaceObject->clone(testContext, Transform3D::Identity()); + = perigeeSurfaceObject->clone(tgContext, Transform3D::Identity()); BOOST_CHECK_EQUAL(pClonedPerigeeSurface->type(), Surface::Perigee); // /// Test type (redundant) @@ -88,7 +88,7 @@ namespace Test { // /// Test dump boost::test_tools::output_test_stream dumpOuput; - perigeeSurfaceObject->toStream(testContext, dumpOuput); + perigeeSurfaceObject->toStream(tgContext, dumpOuput); BOOST_CHECK(dumpOuput.is_equal("Acts::PerigeeSurface:\n\ Center position (x, y, z) = (1.0000000, 1.0000000, 1.0000000)")); } diff --git a/Tests/Core/Surfaces/PlaneSurfaceTests.cpp b/Tests/Core/Surfaces/PlaneSurfaceTests.cpp index a18b30dc31773b43beb80053738ffc68b17b69d9..c963281dae17069763fa45e71849526b858e9456 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); BOOST_AUTO_TEST_SUITE(PlaneSurfaces) /// Unit test for creating compliant/non-compliant PlaneSurface object @@ -64,7 +64,7 @@ namespace Test { // /// Copied and transformed auto copiedTransformedPlaneSurface = Surface::makeShared<PlaneSurface>( - testContext, *planeSurfaceObject, *pTransform); + tgContext, *planeSurfaceObject, *pTransform); BOOST_CHECK_EQUAL(copiedTransformedPlaneSurface->type(), Surface::Plane); /// Construct with nullptr bounds @@ -87,11 +87,11 @@ namespace Test { = Surface::makeShared<PlaneSurface>(pTransform, rBounds); // auto pClonedPlaneSurface - = planeSurfaceObject->clone(testContext, Transform3D::Identity()); + = planeSurfaceObject->clone(tgContext, Transform3D::Identity()); BOOST_CHECK_EQUAL(pClonedPlaneSurface->type(), Surface::Plane); // Test clone method with translation auto pClonedShiftedPlaneSurface - = planeSurfaceObject->clone(testContext, *pTransform.get()); + = planeSurfaceObject->clone(tgContext, *pTransform.get()); // Does it exist at all in a decent state? BOOST_CHECK_EQUAL(pClonedShiftedPlaneSurface->type(), Surface::Plane); // Is it in the right place? @@ -112,7 +112,7 @@ namespace Test { /// Test binningPosition Vector3D binningPosition{0., 1., 2.}; BOOST_CHECK_EQUAL( - planeSurfaceObject->binningPosition(testContext, BinningValue::binX), + planeSurfaceObject->binningPosition(tgContext, BinningValue::binX), binningPosition); // /// Test referenceFrame @@ -121,15 +121,15 @@ namespace Test { RotationMatrix3D expectedFrame; expectedFrame << 1., 0., 0., 0., 1., 0., 0., 0., 1.; - CHECK_CLOSE_OR_SMALL(planeSurfaceObject->referenceFrame( - testContext, globalPosition, momentum), - expectedFrame, - 1e-6, - 1e-9); + CHECK_CLOSE_OR_SMALL( + planeSurfaceObject->referenceFrame(tgContext, globalPosition, momentum), + expectedFrame, + 1e-6, + 1e-9); // /// Test normal, given 3D position Vector3D normal3D(0., 0., 1.); - BOOST_CHECK_EQUAL(planeSurfaceObject->normal(testContext), normal3D); + BOOST_CHECK_EQUAL(planeSurfaceObject->normal(tgContext), normal3D); // /// Test bounds BOOST_CHECK_EQUAL(planeSurfaceObject->bounds().type(), @@ -138,7 +138,7 @@ namespace Test { /// Test localToGlobal Vector2D localPosition{1.5, 1.7}; planeSurfaceObject->localToGlobal( - testContext, localPosition, momentum, globalPosition); + tgContext, localPosition, momentum, globalPosition); // // expected position is the translated one Vector3D expectedPosition{ @@ -148,7 +148,7 @@ namespace Test { // /// Testing globalToLocal planeSurfaceObject->globalToLocal( - testContext, globalPosition, momentum, localPosition); + tgContext, globalPosition, momentum, localPosition); Vector2D expectedLocalPosition{1.5, 1.7}; CHECK_CLOSE_REL(localPosition, expectedLocalPosition, 1e-2); @@ -156,14 +156,14 @@ namespace Test { /// Test isOnSurface Vector3D offSurface{0, 1, -2.}; BOOST_CHECK(planeSurfaceObject->isOnSurface( - testContext, globalPosition, momentum, true)); + tgContext, globalPosition, momentum, true)); BOOST_CHECK(!planeSurfaceObject->isOnSurface( - testContext, offSurface, momentum, true)); + tgContext, offSurface, momentum, true)); // /// intersectionEstimate Vector3D direction{0., 0., 1.}; auto intersect = planeSurfaceObject->intersectionEstimate( - testContext, offSurface, direction, forward, true); + tgContext, offSurface, direction, forward, true); Intersection expectedIntersect{Vector3D{0, 1, 2}, 4., true, 0}; BOOST_CHECK(intersect.valid); BOOST_CHECK_EQUAL(intersect.position, expectedIntersect.position); diff --git a/Tests/Core/Surfaces/StrawSurfaceTests.cpp b/Tests/Core/Surfaces/StrawSurfaceTests.cpp index a0aa2f59ea102f9ed3f2bf37fee948704b590eac..3e69bb7c0dd534d9f02864d6ac0a0bf47e7c2e79 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); BOOST_AUTO_TEST_SUITE(StrawSurfaces) /// Unit test for creating compliant/non-compliant StrawSurface object @@ -79,7 +79,7 @@ namespace Test { // /// Copied and transformed auto copiedTransformedStrawSurface = Surface::makeShared<StrawSurface>( - testContext, *strawSurfaceObject, *pTransform); + tgContext, *strawSurfaceObject, *pTransform); BOOST_CHECK_EQUAL(copiedTransformedStrawSurface->type(), Surface::Straw); } // @@ -95,7 +95,7 @@ namespace Test { = Surface::makeShared<StrawSurface>(pTransform, radius, halfZ); // auto pClonedStrawSurface - = strawSurfaceObject->clone(testContext, Transform3D::Identity()); + = strawSurfaceObject->clone(tgContext, Transform3D::Identity()); BOOST_CHECK_EQUAL(pClonedStrawSurface->type(), Surface::Straw); // /// Test type (redundant) @@ -107,7 +107,7 @@ namespace Test { // /// Test dump boost::test_tools::output_test_stream dumpOuput; - strawSurfaceObject->toStream(testContext, dumpOuput); + strawSurfaceObject->toStream(tgContext, dumpOuput); BOOST_CHECK(dumpOuput.is_equal("Acts::StrawSurface\n\ Center position (x, y, z) = (0.0000, 1.0000, 2.0000)\n\ Rotation: colX = (1.000000, 0.000000, 0.000000)\n\ diff --git a/Tests/Core/Surfaces/SurfaceArrayTests.cpp b/Tests/Core/Surfaces/SurfaceArrayTests.cpp index 7a16498072c3796963acace9f2134007c2fc93d4..ffe564b9db676d1b4680708b9f2278069de23070 100644 --- a/Tests/Core/Surfaces/SurfaceArrayTests.cpp +++ b/Tests/Core/Surfaces/SurfaceArrayTests.cpp @@ -22,8 +22,8 @@ #include "Acts/Tools/LayerCreator.hpp" #include "Acts/Tools/SurfaceArrayCreator.hpp" #include "Acts/Utilities/BinningType.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" #include "Acts/Utilities/Helpers.hpp" #include "Acts/Utilities/detail/Grid.hpp" @@ -40,7 +40,7 @@ namespace Acts { namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); using SrfVec = std::vector<std::shared_ptr<const Surface>>; struct SurfaceArrayFixture @@ -183,8 +183,8 @@ namespace Test { = dynamic_cast<const PlanarBounds*>(&srf->bounds()); for (const auto& vtxloc : bounds->vertices()) { - Vector3D vtx = srf->transform(testContext) - * Vector3D(vtxloc.x(), vtxloc.y(), 0); + Vector3D vtx + = srf->transform(tgContext) * Vector3D(vtxloc.x(), vtxloc.y(), 0); os << "v " << vtx.x() << " " << vtx.y() << " " << vtx.z() << "\n"; } @@ -207,7 +207,7 @@ namespace Test { BOOST_FIXTURE_TEST_CASE(SurfaceArray_create, SurfaceArrayFixture) { - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); SrfVec brl = makeBarrel(30, 7, 2, 1); std::vector<const Surface*> brlRaw = unpack_shared_vector(brl); @@ -236,14 +236,14 @@ namespace Test { transform, itransform, std::make_tuple(std::move(phiAxis), std::move(zAxis))); - sl->fill(testContext, brlRaw); + sl->fill(tgContext, brlRaw); SurfaceArray sa(std::move(sl), brl); // let's see if we can access all surfaces - sa.toStream(testContext, std::cout); + sa.toStream(tgContext, std::cout); for (const auto& srf : brl) { - Vector3D ctr = srf->binningPosition(testContext, binR); + Vector3D ctr = srf->binningPosition(tgContext, binR); std::vector<const Surface*> binContent = sa.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 1); @@ -261,11 +261,11 @@ namespace Test { itransform, std::make_tuple(std::move(phiAxis), std::move(zAxis))); // do NOT fill, only completebinning - sl2->completeBinning(testContext, brlRaw); + sl2->completeBinning(tgContext, brlRaw); SurfaceArray sa2(std::move(sl2), brl); - sa.toStream(testContext, std::cout); + sa.toStream(tgContext, std::cout); for (const auto& srf : brl) { - Vector3D ctr = srf->binningPosition(testContext, binR); + Vector3D ctr = srf->binningPosition(tgContext, binR); std::vector<const Surface*> binContent = sa2.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 1); diff --git a/Tests/Core/Surfaces/SurfaceStub.hpp b/Tests/Core/Surfaces/SurfaceStub.hpp index 1a61c02931d02a049dba0de3e9b991875707678f..13d74306fa3c1f9b20f61a6045743b4044d6a336 100644 --- a/Tests/Core/Surfaces/SurfaceStub.hpp +++ b/Tests/Core/Surfaces/SurfaceStub.hpp @@ -9,8 +9,8 @@ #include "Acts/Surfaces/InfiniteBounds.hpp" //to get s_noBounds #include "Acts/Surfaces/PlanarBounds.hpp" #include "Acts/Surfaces/Surface.hpp" -#include "Acts/Utilities/Context.hpp" #include "Acts/Utilities/Definitions.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { /// Surface derived class stub @@ -21,8 +21,10 @@ public: : GeometryObject(), Surface(htrans) { } - SurfaceStub(Context ctx, const SurfaceStub& sf, const Transform3D& transf) - : GeometryObject(), Surface(ctx, sf, transf) + SurfaceStub(const GeometryContext& gctx, + const SurfaceStub& sf, + const Transform3D& transf) + : GeometryObject(), Surface(gctx, sf, transf) { } SurfaceStub(const DetectorElementBase& detelement) @@ -34,7 +36,8 @@ public: /// Implicit constructor Surface* - clone(Context /*ctx*/, const Transform3D& /*shift = nullptr*/) const + clone(const GeometryContext& /*gctx*/, + const Transform3D& /*shift = nullptr*/) const { return nullptr; } @@ -48,18 +51,19 @@ public: /// Return method for the normal vector of the surface const Vector3D - normal(Context ctx, const Vector2D& /*lpos*/) const final + normal(const GeometryContext& gctx, const Vector2D& /*lpos*/) const final { - return normal(ctx); + return normal(gctx); } const Vector3D - normal(Context ctx, const Vector3D&) const final + normal(const GeometryContext& gctx, const Vector3D&) const final { - return normal(ctx); + return normal(gctx); } - const Vector3D normal(Context /*ctx*/) const final + const Vector3D + normal(const GeometryContext& /*gctx*/) const final { return Vector3D{0., 0., 0.}; } @@ -73,7 +77,7 @@ public: /// Local to global transformation void - localToGlobal(Context /*ctx*/, + localToGlobal(const GeometryContext& /*gctx*/, const Vector2D& /*lpos*/, const Vector3D& /*gmom*/, Vector3D& /*gpos*/) const final @@ -83,7 +87,7 @@ public: /// Global to local transformation bool - globalToLocal(Context /*cxt*/, + globalToLocal(const GeometryContext& /*cxt*/, const Vector3D& /*gpos*/, const Vector3D& /*gmom*/, Vector2D& lpos) const final @@ -94,7 +98,7 @@ public: /// Calculation of the path correction for incident double - pathCorrection(Context /*cxt*/, + pathCorrection(const GeometryContext& /*cxt*/, const Vector3D& /*gpos*/, const Vector3D& /*gmom*/) const final { @@ -103,7 +107,7 @@ public: /// Straight line intersection schema from parameters Intersection - intersectionEstimate(Context /*cxt*/, + intersectionEstimate(const GeometryContext& /*cxt*/, const Vector3D& /*gpos*/, const Vector3D& /*gdir*/, NavigationDirection /*navDir*/, @@ -116,8 +120,9 @@ public: } /// Inherited from GeometryObject base - const Vector3D binningPosition(Context /*txt*/, - BinningValue /*bValue*/) const final + const Vector3D + binningPosition(const GeometryContext& /*txt*/, + BinningValue /*bValue*/) const final { const Vector3D v{0.0, 0.0, 0.0}; return v; @@ -142,7 +147,8 @@ private: std::shared_ptr<const PlanarBounds> m_bounds; SurfaceStub* - clone_impl(Context /*ctx*/, const Transform3D& /* shift */) const override + clone_impl(const GeometryContext& /*gctx*/, + const Transform3D& /* shift */) const override { return nullptr; } diff --git a/Tests/Core/Surfaces/SurfaceTests.cpp b/Tests/Core/Surfaces/SurfaceTests.cpp index 2f06c71209058bb3076464ccfd4e705099830bde..999bed48dc652d580cb6020a255587fc29f07e29 100644 --- a/Tests/Core/Surfaces/SurfaceTests.cpp +++ b/Tests/Core/Surfaces/SurfaceTests.cpp @@ -60,7 +60,7 @@ private: namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); BOOST_AUTO_TEST_SUITE(Surfaces) @@ -76,7 +76,7 @@ namespace Test { Translation3D translation{0., 1., 2.}; Transform3D transform(translation); BOOST_CHECK_EQUAL(Surface::Other, - SurfaceStub(testContext, original, transform).type()); + SurfaceStub(tgContext, original, transform).type()); // need some cruft to make the next one work auto pTransform = std::make_shared<const Transform3D>(translation); std::shared_ptr<const Acts::PlanarBounds> p @@ -109,7 +109,7 @@ namespace Test { // it is set to the detector element surface though BOOST_CHECK_NE(surface.associatedMaterial(), pMaterial.get()); // center() - CHECK_CLOSE_OR_SMALL(reference, surface.center(testContext), 1e-6, 1e-9); + CHECK_CLOSE_OR_SMALL(reference, surface.center(tgContext), 1e-6, 1e-9); // stream insertion operator << output_test_stream output; output << surface; @@ -124,21 +124,21 @@ namespace Test { // name) Vector3D mom{100., 200., 300.}; auto intersectionEstimate = surface.intersectionEstimate( - testContext, reference, mom, forward, false); + tgContext, reference, mom, forward, false); const Intersection ref{Vector3D{1, 1, 1}, 20., true}; BOOST_CHECK_EQUAL(ref.position, intersectionEstimate.position); // isOnSurface - BOOST_CHECK(surface.isOnSurface(testContext, reference, mom, false)); + BOOST_CHECK(surface.isOnSurface(tgContext, reference, mom, false)); BOOST_CHECK(surface.isOnSurface( - testContext, reference, mom, true)); // need to improve bounds() + tgContext, reference, mom, true)); // need to improve bounds() // referenceFrame() RotationMatrix3D unitary; unitary << 1, 0, 0, 0, 1, 0, 0, 0, 1; auto referenceFrame = surface.referenceFrame( - testContext, reference, mom); // need more complex case to test + tgContext, reference, mom); // need more complex case to test BOOST_CHECK_EQUAL(referenceFrame, unitary); // normal() - auto normal = surface.Surface::normal(testContext, + auto normal = surface.Surface::normal(tgContext, reference); // needs more complex // test Vector3D zero{0., 0., 0.}; @@ -152,8 +152,7 @@ namespace Test { BOOST_CHECK_EQUAL(surface.associatedMaterial(), pNewMaterial.get()); // passes ?? // - CHECK_CLOSE_OR_SMALL( - surface.transform(testContext), *pTransform, 1e-6, 1e-9); + CHECK_CLOSE_OR_SMALL(surface.transform(tgContext), *pTransform, 1e-6, 1e-9); // type() is pure virtual } diff --git a/Tests/Core/Tools/CuboidVolumeBuilderTests.cpp b/Tests/Core/Tools/CuboidVolumeBuilderTests.cpp index b4d5c3a835add9d92eb28faa5461ac617643247f..a40fbdab5db8b0750a0d0b4185d481ed40ffa9da 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); // Create configurations for surfaces std::vector<CuboidVolumeBuilder::SurfaceConfig> surfaceConfig; @@ -85,7 +85,7 @@ namespace Test { for (const auto& cfg : surfaceConfig) { std::shared_ptr<const PlaneSurface> pSur = cvb.buildSurface(cfg); BOOST_CHECK_NE(pSur, nullptr); - CHECK_CLOSE_ABS(pSur->center(testContext), cfg.position, 1e-9); + CHECK_CLOSE_ABS(pSur->center(tgContext), cfg.position, 1e-9); BOOST_CHECK_NE(pSur->associatedMaterial(), nullptr); BOOST_CHECK_NE(pSur->associatedDetectorElement(), nullptr); } @@ -224,13 +224,11 @@ namespace Test { std::unique_ptr<const TrackingGeometry> detector = tgb.trackingGeometry(); BOOST_CHECK_EQUAL( - detector->trackingVolume(testContext, Vector3D(1., 0., 0.)) - ->volumeName(), + detector->trackingVolume(tgContext, Vector3D(1., 0., 0.))->volumeName(), volumeConfig.name); - BOOST_CHECK_EQUAL( - detector->trackingVolume(testContext, Vector3D(-1., 0., 0.)) - ->volumeName(), - volumeConfig2.name); + BOOST_CHECK_EQUAL(detector->trackingVolume(tgContext, Vector3D(-1., 0., 0.)) + ->volumeName(), + volumeConfig2.name); } } // namespace Test } // namespace Acts diff --git a/Tests/Core/Tools/LayerCreatorTests.cpp b/Tests/Core/Tools/LayerCreatorTests.cpp index 639d33285ba328f6c2204bc6f19694dbc067c6fd..d15d2663ab5975bfa3dab964c03fbf1e34068ad2 100644 --- a/Tests/Core/Tools/LayerCreatorTests.cpp +++ b/Tests/Core/Tools/LayerCreatorTests.cpp @@ -29,7 +29,7 @@ #include "Acts/Tools/SurfaceArrayCreator.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Definitions.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace bdata = boost::unit_test::data; namespace tt = boost::test_tools; @@ -39,7 +39,7 @@ namespace Acts { namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); #define CHECK_ROTATION_ANGLE(t, a, tolerance) \ { \ @@ -67,7 +67,7 @@ namespace Test { for (const auto& vtxloc : bounds->vertices()) { Vector3D vtx - = srf->transform(testContext) * Vector3D(vtxloc.x(), vtxloc.y(), 0); + = srf->transform(tgContext) * Vector3D(vtxloc.x(), vtxloc.y(), 0); os << "v " << vtx.x() << " " << vtx.y() << " " << vtx.z() << "\n"; } @@ -247,7 +247,7 @@ namespace Test { std::shared_ptr<PlaneSurface> srfA = Surface::makeShared<PlaneSurface>(transAptr, bounds); - Vector3D nrm = srfA->normal(testContext); + Vector3D nrm = srfA->normal(tgContext); Transform3D transB = trans; transB.pretranslate(nrm * 0.1); auto transBptr = std::make_shared<const Transform3D>(transB); @@ -278,7 +278,7 @@ namespace Test { // CASE I double envR = 0.1, envZ = 0.5; - ProtoLayer pl(testContext, srf); + ProtoLayer pl(tgContext, srf); pl.envR = {envR, envR}; pl.envZ = {envZ, envZ}; std::shared_ptr<CylinderLayer> layer @@ -302,7 +302,7 @@ namespace Test { // CASE II - ProtoLayer pl2(testContext, srf); + ProtoLayer pl2(tgContext, srf); pl2.envR = {envR, envR}; pl2.envZ = {envZ, envZ}; layer = std::dynamic_pointer_cast<CylinderLayer>( @@ -375,7 +375,7 @@ namespace Test { surfaces.insert(surfaces.end(), ringc.begin(), ringc.end()); draw_surfaces(surfaces, "LayerCreator_createDiscLayer_EC_1.obj"); - ProtoLayer pl(testContext, surfaces); + ProtoLayer pl(tgContext, surfaces); pl.minZ = -10; pl.maxZ = 10; pl.minR = 5; @@ -405,7 +405,7 @@ namespace Test { double envMinR = 1, envMaxR = 1, envZ = 5; size_t nBinsR = 3, nBinsPhi = 30; - ProtoLayer pl2(testContext, surfaces); + ProtoLayer pl2(tgContext, surfaces); pl2.envR = {envMinR, envMaxR}; pl2.envZ = {envZ, envZ}; layer = std::dynamic_pointer_cast<DiscLayer>( @@ -463,7 +463,7 @@ namespace Test { draw_surfaces(brl, "LayerCreator_barrelStagger.obj"); double envR = 0, envZ = 0; - ProtoLayer pl(testContext, brl); + ProtoLayer pl(tgContext, brl); pl.envR = {envR, envR}; pl.envZ = {envZ, envZ}; std::shared_ptr<CylinderLayer> layer @@ -485,7 +485,7 @@ namespace Test { // std::cout << "dPHi = " << A->center().phi() - B->center().phi() << // std::endl; - Vector3D ctr = A->binningPosition(testContext, binR); + Vector3D ctr = A->binningPosition(tgContext, binR); auto binContent = layer->surfaceArray()->at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 2); std::set<const Surface*> act; diff --git a/Tests/Core/Tools/SurfaceArrayCreatorTests.cpp b/Tests/Core/Tools/SurfaceArrayCreatorTests.cpp index a23eb17c2a2e0292628adfb7be1b94e206404d06..f47d620114b57030dc37090bd3c6baa806d1e70f 100644 --- a/Tests/Core/Tools/SurfaceArrayCreatorTests.cpp +++ b/Tests/Core/Tools/SurfaceArrayCreatorTests.cpp @@ -23,7 +23,7 @@ #include "Acts/Tools/SurfaceArrayCreator.hpp" #include "Acts/Utilities/BinningType.hpp" #include "Acts/Utilities/Definitions.hpp" -#include "Acts/Utilities/Context.hpp" +#include "Acts/Utilities/GeometryContext.hpp" using Acts::VectorHelpers::phi; using Acts::VectorHelpers::perp; @@ -36,7 +36,7 @@ namespace Acts { namespace Test { // Create a test context - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); #define CHECK_ROTATION_ANGLE(t, a, tolerance) \ { \ @@ -236,7 +236,7 @@ namespace Test { std::shared_ptr<Surface> srfA = Surface::makeShared<PlaneSurface>(transAptr, bounds); - Vector3D nrm = srfA->normal(testContext); + Vector3D nrm = srfA->normal(tgContext); Transform3D transB = trans; transB.pretranslate(nrm * 0.1); auto transBptr = std::make_shared<const Transform3D>(transB); @@ -274,7 +274,7 @@ namespace Test { for (const auto& vtxloc : bounds->vertices()) { Vector3D vtx - = srf->transform(testContext) * Vector3D(vtxloc.x(), vtxloc.y(), 0); + = srf->transform(tgContext) * Vector3D(vtxloc.x(), vtxloc.y(), 0); os << "v " << vtx.x() << " " << vtx.y() << " " << vtx.z() << "\n"; } @@ -298,7 +298,7 @@ namespace Test { { // fail on empty srf vector std::vector<const Surface*> emptyRaw; - ProtoLayer pl(testContext, emptyRaw); + ProtoLayer pl(tgContext, emptyRaw); auto tr = Transform3D::Identity(); BOOST_CHECK_THROW( createEquidistantAxis(emptyRaw, BinningValue::binPhi, pl, tr), @@ -321,7 +321,7 @@ namespace Test { double angleShift = step / 2.; auto surfaces = fullPhiTestSurfacesEC(30, angleShift, z); std::vector<const Surface*> surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); auto axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); @@ -336,7 +336,7 @@ namespace Test { angleShift = 0.; surfaces = fullPhiTestSurfacesEC(30, angleShift, z); surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, @@ -351,7 +351,7 @@ namespace Test { angleShift = step / -4.; surfaces = fullPhiTestSurfacesEC(30, angleShift, z); surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, @@ -366,7 +366,7 @@ namespace Test { angleShift = step / 4.; surfaces = fullPhiTestSurfacesEC(30, angleShift, z); surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfaces); + pl = ProtoLayer(tgContext, surfaces); surfacesRaw = unpack_shared_vector(surfaces); tr = Transform3D::Identity(); axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); @@ -386,7 +386,7 @@ namespace Test { double angleShift = step / 2.; auto surfaces = fullPhiTestSurfacesBRL(30, angleShift, z); auto surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); auto axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); @@ -402,7 +402,7 @@ namespace Test { angleShift = 0.; surfaces = fullPhiTestSurfacesBRL(30, angleShift, z); surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, @@ -418,7 +418,7 @@ namespace Test { angleShift = step / -4.; surfaces = fullPhiTestSurfacesBRL(30, angleShift, z); surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, @@ -434,7 +434,7 @@ namespace Test { angleShift = step / 4.; surfaces = fullPhiTestSurfacesBRL(30, angleShift, z); surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); draw_surfaces(surfaces, @@ -455,7 +455,7 @@ namespace Test { draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_EC_Single.obj"); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); tr = Transform3D::Identity(); auto axis = createEquidistantAxis(surfacesRaw, BinningValue::binPhi, pl, tr); @@ -473,7 +473,7 @@ namespace Test { // single element in z auto surfaces = straightLineSurfaces(1); auto surfacesRaw = unpack_shared_vector(surfaces); - ProtoLayer pl = ProtoLayer(testContext, surfacesRaw); + ProtoLayer pl = ProtoLayer(tgContext, surfacesRaw); auto trf = Transform3D::Identity(); auto axis = createEquidistantAxis(surfacesRaw, BinningValue::binZ, pl, trf); draw_surfaces(surfaces, @@ -488,7 +488,7 @@ namespace Test { double z0 = -10 + 1. * i; surfaces = straightLineSurfaces(10, 3, Vector3D(0, 0, z0 + 1.5)); surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3D::Identity(); axis = createEquidistantAxis(surfacesRaw, BinningValue::binZ, pl, trf); draw_surfaces( @@ -508,7 +508,7 @@ namespace Test { tr.rotate(AngleAxis3D(M_PI / 4., Vector3D(0, 0, 1))); surfaces = straightLineSurfaces(10, 3, Vector3D(0, 0, 0 + 1.5), tr); surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3D::Identity(); axis = createEquidistantAxis(surfacesRaw, BinningValue::binZ, pl, trf); draw_surfaces(surfaces, @@ -529,7 +529,7 @@ namespace Test { draw_surfaces(surfaces, "SurfaceArrayCreator_createEquidistantAxis_R_1.obj"); auto trf = Transform3D::Identity(); - ProtoLayer pl = ProtoLayer(testContext, surfacesRaw); + ProtoLayer pl = ProtoLayer(tgContext, surfacesRaw); auto axis = createEquidistantAxis(surfacesRaw, BinningValue::binR, pl, trf); BOOST_CHECK_EQUAL(axis.nBins, 1); CHECK_CLOSE_ABS(axis.max, perp(Vector3D(17, 1, 0)), 1e-3); @@ -548,7 +548,7 @@ namespace Test { "SurfaceArrayCreator_createEquidistantAxis_R_2.obj"); surfacesRaw = unpack_shared_vector(surfaces); - pl = ProtoLayer(testContext, surfacesRaw); + pl = ProtoLayer(tgContext, surfacesRaw); trf = Transform3D::Identity(); axis = createEquidistantAxis(surfacesRaw, BinningValue::binR, pl, trf); @@ -612,12 +612,12 @@ namespace Test { globalToLocal, localToGlobal, std::make_tuple(std::move(phiAxis), std::move(zAxis))); - sl->fill(testContext, brlRaw); + sl->fill(tgContext, brlRaw); SurfaceArray sa(std::move(sl), brl); // actually filled SA for (const auto& srf : brl) { - Vector3D ctr = srf->binningPosition(testContext, binR); + Vector3D ctr = srf->binningPosition(tgContext, binR); auto binContent = sa.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 1); @@ -634,7 +634,7 @@ namespace Test { std::vector<const Surface*> brlRaw = unpack_shared_vector(brl); draw_surfaces(brl, "SurfaceArrayCreator_barrelStagger.obj"); - ProtoLayer pl(testContext, brl); + ProtoLayer pl(tgContext, brl); // EQUIDISTANT Transform3D tr = Transform3D::Identity(); @@ -657,7 +657,7 @@ namespace Test { detail::AxisBoundaryType::Bound>( globalToLocal, localToGlobal, pAxisPhi, pAxisZ); - sl->fill(testContext, brlRaw); + sl->fill(tgContext, brlRaw); SurfaceArray sa(std::move(sl), brl); auto axes = sa.getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30); @@ -668,7 +668,7 @@ namespace Test { auto A = pr.first; auto B = pr.second; - Vector3D ctr = A->binningPosition(testContext, binR); + Vector3D ctr = A->binningPosition(tgContext, binR); auto binContent = sa.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 2); std::set<const Surface*> act; @@ -706,7 +706,7 @@ namespace Test { detail::AxisBoundaryType::Bound>( globalToLocalVar, localToGlobalVar, pAxisPhiVar, pAxisZVar); - sl2->fill(testContext, brlRaw); + sl2->fill(tgContext, brlRaw); SurfaceArray sa2(std::move(sl2), brl); axes = sa2.getAxes(); BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30); @@ -741,7 +741,7 @@ namespace Test { auto A = pr.first; auto B = pr.second; - Vector3D ctr = A->binningPosition(testContext, binR); + Vector3D ctr = A->binningPosition(tgContext, binR); auto binContent = sa2.at(ctr); BOOST_CHECK_EQUAL(binContent.size(), 2); std::set<const Surface*> act; diff --git a/Tests/Core/Volumes/CylinderVolumeBoundsTests.cpp b/Tests/Core/Volumes/CylinderVolumeBoundsTests.cpp index 553d8ea8081e107bbe2be70490fd8ab8c24e86a0..4a2994d89dd7fe76b9610cd74f4409b9bb81feee 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 - ContextType testContext = DefaultContext(); + GeometryContext tgContext = DefaultGeometryContext(); // position of volume const Vector3D pos(posX, posY, posZ); @@ -72,20 +72,20 @@ namespace Test { // Test // check if difference is halfZ - sign and direction independent - CHECK_CLOSE_REL((pos - boundarySurfaces.at(0)->center(testContext)).norm(), + CHECK_CLOSE_REL((pos - boundarySurfaces.at(0)->center(tgContext)).norm(), cylBounds.halflengthZ(), 1e-12); - CHECK_CLOSE_REL((pos - boundarySurfaces.at(1)->center(testContext)).norm(), + CHECK_CLOSE_REL((pos - boundarySurfaces.at(1)->center(tgContext)).norm(), cylBounds.halflengthZ(), 1e-12); // transform to local - double posDiscPosZ = (transformPtr->inverse() - * boundarySurfaces.at(1)->center(testContext)) - .z(); - double centerPosZ = (transformPtr->inverse() * pos).z(); - double negDiscPosZ = (transformPtr->inverse() - * boundarySurfaces.at(0)->center(testContext)) - .z(); + double posDiscPosZ + = (transformPtr->inverse() * boundarySurfaces.at(1)->center(tgContext)) + .z(); + double centerPosZ = (transformPtr->inverse() * pos).z(); + double negDiscPosZ + = (transformPtr->inverse() * boundarySurfaces.at(0)->center(tgContext)) + .z(); // check if center of disc boundaries lies in the middle in z BOOST_CHECK_LT(centerPosZ, posDiscPosZ); BOOST_CHECK_GT(centerPosZ, negDiscPosZ); @@ -97,20 +97,20 @@ namespace Test { // positive disc durface should point in positive direction in the frame of // the volume CHECK_CLOSE_REL( - transformPtr->rotation().col(2).dot(boundarySurfaces.at(1)->normal( - testContext, Acts::Vector2D(0., 0.))), + transformPtr->rotation().col(2).dot( + boundarySurfaces.at(1)->normal(tgContext, Acts::Vector2D(0., 0.))), 1., 1e-12); // negative disc durface should point in negative direction in the frame of // the volume CHECK_CLOSE_REL( - transformPtr->rotation().col(2).dot(boundarySurfaces.at(0)->normal( - testContext, Acts::Vector2D(0., 0.))), + transformPtr->rotation().col(2).dot( + boundarySurfaces.at(0)->normal(tgContext, Acts::Vector2D(0., 0.))), -1., 1e-12); // test in r - CHECK_CLOSE_REL(boundarySurfaces.at(3)->center(testContext), pos, 1e-12); - CHECK_CLOSE_REL(boundarySurfaces.at(2)->center(testContext), pos, 1e-12); + CHECK_CLOSE_REL(boundarySurfaces.at(3)->center(tgContext), pos, 1e-12); + CHECK_CLOSE_REL(boundarySurfaces.at(2)->center(tgContext), pos, 1e-12); } } // namespace Test diff --git a/Tests/Integration/PropagationTestHelper.hpp b/Tests/Integration/PropagationTestHelper.hpp index a0d31a71a988322b190cd1c704505a878c55c12f..9d4ec37518326cbb73ade4995ca2f0a188ce1f66 100644 --- a/Tests/Integration/PropagationTestHelper.hpp +++ b/Tests/Integration/PropagationTestHelper.hpp @@ -22,6 +22,9 @@ using units::Nat2SI; namespace IntegrationTest { + // Create a test context + GeometryContext tgContext = DefaultGeometryContext(); + /// Helper method to create a transform for a plane /// to mimic detector situations, the plane is roughly /// perpendicular to the track @@ -91,7 +94,7 @@ namespace IntegrationTest { namespace VH = VectorHelpers; // setup propagation options - PropagatorOptions<> options; + PropagatorOptions<> options(tgContext); options.pathLimit = 5 * units::_m; options.maxStepSize = 1 * units::_cm; options.debug = debug; @@ -184,12 +187,12 @@ namespace IntegrationTest { using DebugOutput = Acts::detail::DebugOutputActor; using ActionList = Acts::ActionList<DebugOutput>; - PropagatorOptions<ActionList> fwdOptions; + PropagatorOptions<ActionList> fwdOptions(tgContext); fwdOptions.pathLimit = plimit; fwdOptions.maxStepSize = 1 * units::_cm; fwdOptions.debug = debug; - PropagatorOptions<ActionList> bwdOptions; + PropagatorOptions<ActionList> bwdOptions(tgContext); bwdOptions.direction = backward; bwdOptions.pathLimit = -plimit; bwdOptions.maxStepSize = 1 * units::_cm; @@ -256,7 +259,7 @@ namespace IntegrationTest { bool debug = false) { // setup propagation options - PropagatorOptions<> options; + PropagatorOptions<> options(tgContext); // setup propagation options options.maxStepSize = plimit; options.pathLimit = plimit; @@ -321,7 +324,7 @@ namespace IntegrationTest { using DebugOutput = detail::DebugOutputActor; // setup propagation options - PropagatorOptions<ActionList<DebugOutput>> options; + PropagatorOptions<ActionList<DebugOutput>> options(tgContext); // setup propagation options options.maxStepSize = plimit; options.pathLimit = plimit; @@ -402,7 +405,7 @@ namespace IntegrationTest { { covariance_validation_fixture<Propagator_type> fixture(propagator); // setup propagation options - DenseStepperPropagatorOptions<> options; + DenseStepperPropagatorOptions<> options(tgContext); // setup propagation options options.maxStepSize = plimit; options.pathLimit = plimit; @@ -462,7 +465,7 @@ namespace IntegrationTest { { covariance_validation_fixture<Propagator_type> fixture(propagator); // setup propagation options - DenseStepperPropagatorOptions<> options; + DenseStepperPropagatorOptions<> options(tgContext); options.maxStepSize = plimit; options.pathLimit = plimit; options.debug = debug; @@ -508,8 +511,9 @@ namespace IntegrationTest { auto startSurface = Surface::makeShared<StartSurface_type>(ssTransform, nullptr); - BoundParameters start(std::move(covPtr), pos, mom, q, startSurface); - BoundParameters start_wo_c(nullptr, pos, mom, q, startSurface); + BoundParameters start( + tgContext, std::move(covPtr), pos, mom, q, startSurface); + BoundParameters start_wo_c(tgContext, nullptr, pos, mom, q, startSurface); // increase the path limit - to be safe hitting the surface options.pathLimit *= 2; diff --git a/Tests/Integration/covariance_validation_fixture.hpp b/Tests/Integration/covariance_validation_fixture.hpp index 24c63d8bb7577bd3917e3ea8e0e077bb44585008..0c4f5775a2edccd92cafb0d2b957ce6e07a2aa4d 100644 --- a/Tests/Integration/covariance_validation_fixture.hpp +++ b/Tests/Integration/covariance_validation_fixture.hpp @@ -12,6 +12,7 @@ #include "Acts/EventData/TrackParameters.hpp" #include "Acts/Surfaces/PlaneSurface.hpp" #include "Acts/Surfaces/Surface.hpp" +#include "Acts/Utilities/GeometryContext.hpp" namespace Acts { @@ -61,7 +62,8 @@ namespace IntegrationTest { x_derivatives.reserve(h_steps.size()); for (double h : h_steps) { StartParameters tp = startPars; - tp.template set<Acts::eLOC_0>(tp.template get<Acts::eLOC_0>() + h); + tp.template set<Acts::eLOC_0>(options.geoContext, + tp.template get<Acts::eLOC_0>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options); x_derivatives.push_back((r.endParameters->parameters() - nominal) / h); } @@ -71,7 +73,8 @@ namespace IntegrationTest { y_derivatives.reserve(h_steps.size()); for (double h : h_steps) { StartParameters tp = startPars; - tp.template set<Acts::eLOC_1>(tp.template get<Acts::eLOC_1>() + h); + tp.template set<Acts::eLOC_1>(options.geoContext, + tp.template get<Acts::eLOC_1>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options); y_derivatives.push_back((r.endParameters->parameters() - nominal) / h); } @@ -81,7 +84,8 @@ namespace IntegrationTest { phi_derivatives.reserve(h_steps.size()); for (double h : h_steps) { StartParameters tp = startPars; - tp.template set<Acts::ePHI>(tp.template get<Acts::ePHI>() + h); + tp.template set<Acts::ePHI>(options.geoContext, + tp.template get<Acts::ePHI>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options); phi_derivatives.push_back((r.endParameters->parameters() - nominal) / h); @@ -99,7 +103,8 @@ namespace IntegrationTest { if (current_theta + h < 0) { h = -current_theta; } - tp.template set<Acts::eTHETA>(tp.template get<Acts::eTHETA>() + h); + tp.template set<Acts::eTHETA>(options.geoContext, + tp.template get<Acts::eTHETA>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options); theta_derivatives.push_back((r.endParameters->parameters() - nominal) / h); @@ -110,7 +115,8 @@ namespace IntegrationTest { qop_derivatives.reserve(h_steps.size()); for (double h : h_steps) { StartParameters tp = startPars; - tp.template set<Acts::eQOP>(tp.template get<Acts::eQOP>() + h); + tp.template set<Acts::eQOP>(options.geoContext, + tp.template get<Acts::eQOP>() + h); const auto& r = m_propagator.propagate(tp, dest, var_options); qop_derivatives.push_back((r.endParameters->parameters() - nominal) / h); diff --git a/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp b/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp index cd36b4cf676dbb2854ca0d4ffcc4ed1101f4dcfa..87a0af696ff4a93ef8c2a67ce54f939c54531820 100644 --- a/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp +++ b/Tests/Plugins/Digitization/DoubleHitSpacePointBuilderTests.cpp @@ -26,6 +26,9 @@ namespace Acts { namespace Test { + // Create a test context + GeometryContext tgContext = DefaultGeometryContext(); + /// Unit test for testing the main functions of DoubleHitSpacePointBuilder /// 1) A pair of hits gets added and resolved. /// 2) A pair of hits gets added and rejected. @@ -126,7 +129,7 @@ namespace Test { // Combine two PlanarModuleClusters SpacePointBuilder<DoubleHitSpacePoint> dhsp(dhsp_cfg); - dhsp.makeClusterPairs({pmc}, {pmc2}, clusterPairs); + dhsp.makeClusterPairs(tgContext, {pmc}, {pmc2}, clusterPairs); BOOST_CHECK_EQUAL(clusterPairs.size(), 1); BOOST_CHECK_EQUAL(*(clusterPairs[0].first), *pmc); @@ -134,7 +137,7 @@ namespace Test { std::cout << "Calculate space point" << std::endl; - dhsp.calculateSpacePoints(clusterPairs, resultSP); + dhsp.calculateSpacePoints(tgContext, clusterPairs, resultSP); BOOST_CHECK_EQUAL(resultSP.size(), 1); @@ -159,7 +162,7 @@ namespace Test { std::cout << "Try to store hits" << std::endl; // Combine points - dhsp.makeClusterPairs({pmc}, {pmc3}, clusterPairs); + dhsp.makeClusterPairs(tgContext, {pmc}, {pmc3}, clusterPairs); // Test for rejecting unconnected hits BOOST_CHECK_EQUAL(resultSP.size(), 1); diff --git a/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp b/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp index edbab62015cfcacd237132efaab191e892dbdc60..654be392e71ff42c6c159e14709fc17113d594e8 100644 --- a/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp +++ b/Tests/Plugins/Digitization/SingleHitSpacePointBuilderTests.cpp @@ -26,6 +26,9 @@ namespace Acts { namespace Test { + // Create a test context + GeometryContext tgContext = DefaultGeometryContext(); + /// Unit test for testing the main functions of OneHitSpacePointBuilder /// 1) A resolved dummy hit gets created and added. /// 2) A hit gets added and resolved. @@ -87,7 +90,7 @@ namespace Test { std::cout << "Hit added to storage" << std::endl; - shsp.calculateSpacePoints({pmc}, data); + shsp.calculateSpacePoints(tgContext, {pmc}, data); BOOST_CHECK_NE(data[0].spacePoint, Vector3D::Zero(3)); std::cout << "Space point calculated" << std::endl; diff --git a/Tests/Plugins/Json/FromJsonTests.cpp b/Tests/Plugins/Json/FromJsonTests.cpp deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000