Skip to content

Commit

Permalink
Merge branch 'main' into fix/geodigi-thickness
Browse files Browse the repository at this point in the history
  • Loading branch information
asalzburger authored Nov 13, 2023
2 parents e2d36bd + 85a0fea commit 7acfdf9
Show file tree
Hide file tree
Showing 151 changed files with 1,696 additions and 1,240 deletions.
12 changes: 7 additions & 5 deletions Core/include/Acts/Detector/Portal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/RegularSurface.hpp"
#include "Acts/Surfaces/Surface.hpp"

#include <array>
Expand Down Expand Up @@ -45,7 +46,7 @@ class Portal : public std::enable_shared_from_this<Portal> {
/// Constructor from surface w/o portal links
///
/// @param surface is the representing surface
Portal(std::shared_ptr<Surface> surface);
Portal(std::shared_ptr<RegularSurface> surface);

public:
/// The volume links forward/backward with respect to the surface normal
Expand All @@ -60,7 +61,8 @@ class Portal : public std::enable_shared_from_this<Portal> {
friend class DetectorVolume;

/// Factory for producing memory managed instances of Portal.
static std::shared_ptr<Portal> makeShared(std::shared_ptr<Surface> surface);
static std::shared_ptr<Portal> makeShared(
std::shared_ptr<RegularSurface> surface);

/// Retrieve a @c std::shared_ptr for this surface (non-const version)
///
Expand Down Expand Up @@ -88,10 +90,10 @@ class Portal : public std::enable_shared_from_this<Portal> {
virtual ~Portal() = default;

/// Const access to the surface representation
const Surface& surface() const;
const RegularSurface& surface() const;

/// Non-const access to the surface reference
Surface& surface();
RegularSurface& surface();

/// Update the current volume
///
Expand Down Expand Up @@ -147,7 +149,7 @@ class Portal : public std::enable_shared_from_this<Portal> {

private:
/// The surface representation of this portal
std::shared_ptr<Surface> m_surface;
std::shared_ptr<RegularSurface> m_surface;

/// The portal targets along/opposite the normal vector
DetectorVolumeUpdators m_volumeUpdators = {unconnectedUpdator(),
Expand Down
21 changes: 15 additions & 6 deletions Core/include/Acts/Detector/detail/CylindricalDetectorHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,14 @@ DetectorComponent::PortalContainer wrapInZR(
///
/// @param gctx the geometry context of the call
/// @param volumes the volumes at input
/// @param precision the precision to be used for (optionally)
/// @param logLevel is the screen logging level
///
/// @return extracted boundary values
template <typename volume_container_t>
std::array<std::vector<ActsScalar>, 3u> rzphiBoundaries(
const GeometryContext& gctx, const volume_container_t& volumes,
double precision = 0.,
Acts::Logging::Level logLevel = Acts::Logging::INFO) {
// The local logger
ACTS_LOCAL_LOGGER(getDefaultLogger("CylindricalDetectorHelper", logLevel));
Expand All @@ -187,6 +189,13 @@ std::array<std::vector<ActsScalar>, 3u> rzphiBoundaries(

// The return boundaries
std::array<std::set<ActsScalar>, 3u> uniqueBoundaries;
auto insertWithPrecision = [&](std::size_t is, ActsScalar value) -> void {
if (precision == 0.) {
uniqueBoundaries[is].insert(value);
return;
}
uniqueBoundaries[is].insert(std::round(value / precision) * precision);
};

// Loop over the volumes and collect boundaries
for (const auto& v : volumes) {
Expand All @@ -207,12 +216,12 @@ std::array<std::vector<ActsScalar>, 3u> rzphiBoundaries(
ActsScalar phiMin = phiCenter - phiSector;
ActsScalar phiMax = phiCenter + phiSector;
// Fill the sets
uniqueBoundaries[0].insert(rMin);
uniqueBoundaries[0].insert(rMax);
uniqueBoundaries[1].insert(zMin);
uniqueBoundaries[1].insert(zMax);
uniqueBoundaries[2].insert(phiMin);
uniqueBoundaries[2].insert(phiMax);
insertWithPrecision(0u, rMin);
insertWithPrecision(0u, rMax);
insertWithPrecision(1u, zMin);
insertWithPrecision(1u, zMax);
insertWithPrecision(2u, phiMin);
insertWithPrecision(2u, phiMax);
}
}

Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Digitization/DigitizationModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Digitization/DigitizationCell.hpp"
#include "Acts/Digitization/Segmentation.hpp"
#include "Acts/Surfaces/RegularSurface.hpp"

#include <memory>
#include <vector>
Expand All @@ -18,7 +19,7 @@ namespace Acts {

class Surface;

using SurfacePtr = std::shared_ptr<const Surface>;
using SurfacePtr = std::shared_ptr<const RegularSurface>;
using SurfacePtrVector = std::vector<SurfacePtr>;

/// @class DigitizationModule
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Digitization/Segmentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Digitization/DigitizationCell.hpp"
#include "Acts/Surfaces/RegularSurface.hpp"

#include <memory>
#include <vector>
Expand All @@ -18,7 +19,7 @@ namespace Acts {
class SurfaceBounds;
class Surface;
class BinUtility;
using SurfacePtr = std::shared_ptr<const Surface>;
using SurfacePtr = std::shared_ptr<const RegularSurface>;
using SurfacePtrVector = std::vector<SurfacePtr>;

/// @brief Segmentation Base class
Expand Down
15 changes: 8 additions & 7 deletions Core/include/Acts/Geometry/BoundarySurfaceT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Acts/Geometry/BoundarySurfaceFace.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/Volume.hpp"
#include "Acts/Surfaces/RegularSurface.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinnedArray.hpp"

Expand Down Expand Up @@ -57,7 +58,7 @@ class BoundarySurfaceT {
/// @param surface The unique surface the boundary represents
/// @param inside The inside volume the boundary surface points to
/// @param outside The outside volume the boundary surface points to
BoundarySurfaceT(std::shared_ptr<const Surface> surface,
BoundarySurfaceT(std::shared_ptr<const RegularSurface> surface,
const volume_t* inside, const volume_t* outside)
: m_surface(std::move(surface)),
m_oppositeVolume(inside),
Expand All @@ -71,8 +72,8 @@ class BoundarySurfaceT {
/// @param surface The unique surface the boundary represents
/// @param inside The inside volume the boundary surface points to
/// @param outside The outside volume the boundary surface points to
BoundarySurfaceT(std::shared_ptr<const Surface> surface, VolumePtr inside,
VolumePtr outside)
BoundarySurfaceT(std::shared_ptr<const RegularSurface> surface,
VolumePtr inside, VolumePtr outside)
: m_surface(std::move(surface)),
m_oppositeVolume(inside.get()),
m_alongVolume(outside.get()),
Expand All @@ -86,7 +87,7 @@ class BoundarySurfaceT {
/// @param insideArray The inside volume array the boundary surface points to
/// @param outsideArray The outside volume array the boundary surface
/// points to
BoundarySurfaceT(std::shared_ptr<const Surface> surface,
BoundarySurfaceT(std::shared_ptr<const RegularSurface> surface,
std::shared_ptr<const VolumeArray> insideArray,
std::shared_ptr<const VolumeArray> outsideArray)
: m_surface(std::move(surface)),
Expand Down Expand Up @@ -122,7 +123,7 @@ class BoundarySurfaceT {
}

/// The Surface Representation of this
virtual const Surface& surfaceRepresentation() const;
virtual const RegularSurface& surfaceRepresentation() const;

/// Helper method: attach a Volume to this BoundarySurfaceT
/// this is done during the geometry construction.
Expand All @@ -141,7 +142,7 @@ class BoundarySurfaceT {

protected:
/// the represented surface by this
std::shared_ptr<const Surface> m_surface;
std::shared_ptr<const RegularSurface> m_surface;
/// the inside (w.r.t. normal vector) volume to point to if only one exists
const volume_t* m_oppositeVolume;
/// the outside (w.r.t. normal vector) volume to point to if only one exists
Expand All @@ -153,7 +154,7 @@ class BoundarySurfaceT {
};

template <class volume_t>
inline const Surface& BoundarySurfaceT<volume_t>::surfaceRepresentation()
inline const RegularSurface& BoundarySurfaceT<volume_t>::surfaceRepresentation()
const {
return (*(m_surface.get()));
}
Expand Down
3 changes: 2 additions & 1 deletion Core/include/Acts/Geometry/VolumeBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Direction.hpp"
#include "Acts/Geometry/Volume.hpp"
#include "Acts/Surfaces/RegularSurface.hpp"
#include "Acts/Utilities/BinningType.hpp"

#include <cmath>
Expand All @@ -27,7 +28,7 @@ class Direction;

using VolumeBoundsPtr = std::shared_ptr<const VolumeBounds>;

using OrientedSurface = std::pair<std::shared_ptr<Surface>, Direction>;
using OrientedSurface = std::pair<std::shared_ptr<RegularSurface>, Direction>;
using OrientedSurfaces = std::vector<OrientedSurface>;

// Planar definitions to help construct the boundary surfaces
Expand Down
22 changes: 10 additions & 12 deletions Core/include/Acts/Surfaces/ConeSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "Acts/Geometry/Polyhedron.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/ConeBounds.hpp"
#include "Acts/Surfaces/RegularSurface.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Result.hpp"
Expand All @@ -39,10 +40,8 @@ namespace Acts {
/// Propagations to a cone surface will be returned in
/// curvilinear coordinates.

class ConeSurface : public Surface {
#ifndef DOXYGEN
friend Surface;
#endif
class ConeSurface : public RegularSurface {
friend class Surface;

protected:
/// Constructor form HepTransform and an opening angle
Expand Down Expand Up @@ -134,9 +133,6 @@ class ConeSurface : public Surface {
Vector3 normal(const GeometryContext& gctx,
const Vector3& position) const final;

/// Normal vector return without argument
using Surface::normal;

// Return method for the rotational symmetry axis
///
/// @param gctx The current geometry context object, e.g. alignment
Expand All @@ -151,24 +147,26 @@ class ConeSurface : public Surface {
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lposition is the local position to be transformed
/// @param direction is the global momentum direction (ignored in this operation)
///
/// @return The global position by value
Vector3 localToGlobal(const GeometryContext& gctx, const Vector2& lposition,
const Vector3& direction) const final;
Vector3 localToGlobal(const GeometryContext& gctx,
const Vector2& lposition) const final;

// Use overloads from `RegularSurface`
using RegularSurface::globalToLocal;
using RegularSurface::localToGlobal;
using RegularSurface::normal;

/// Global to local transformation
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position is the global position to be transformed
/// @param direction is the global momentum direction (ignored in this operation)
/// @param tolerance optional tolerance within which a point is considered
/// valid on surface
///
/// @return a Result<Vector2> which can be !ok() if the operation fails
Result<Vector2> globalToLocal(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction,
double tolerance = s_onSurfaceTolerance) const final;

/// Straight line intersection schema from position/direction
Expand Down
20 changes: 9 additions & 11 deletions Core/include/Acts/Surfaces/CylinderSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "Acts/Geometry/Polyhedron.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/CylinderBounds.hpp"
#include "Acts/Surfaces/RegularSurface.hpp"
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Result.hpp"
Expand All @@ -40,10 +41,8 @@ class DetectorElementBase;
///
/// @image html CylinderSurface.png

class CylinderSurface : public Surface {
#ifndef DOXYGEN
friend Surface;
#endif
class CylinderSurface : public RegularSurface {
friend class Surface;

protected:
/// Constructor from Transform3 and CylinderBounds
Expand Down Expand Up @@ -144,8 +143,10 @@ class CylinderSurface : public Surface {
Vector3 normal(const GeometryContext& gctx,
const Vector3& position) const final;

/// Normal vector return without argument
using Surface::normal;
// Use overloads from `RegularSurface`
using RegularSurface::globalToLocal;
using RegularSurface::localToGlobal;
using RegularSurface::normal;

/// Return method for the rotational symmetry axis
///
Expand All @@ -161,24 +162,21 @@ class CylinderSurface : public Surface {
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lposition is the local position to be transformed
/// @param direction is the global momentum direction (ignored in this operation)
///
/// @return The global position by value
Vector3 localToGlobal(const GeometryContext& gctx, const Vector2& lposition,
const Vector3& direction) const final;
Vector3 localToGlobal(const GeometryContext& gctx,
const Vector2& lposition) const final;

/// Global to local transformation
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param position is the global position to be transformed
/// @param direction is the global momentum direction (ignored in this operation)
/// @param tolerance optional tolerance within which a point is considered
/// valid on surface
///
/// @return a Result<Vector2> which can be !ok() if the operation fails
Result<Vector2> globalToLocal(
const GeometryContext& gctx, const Vector3& position,
const Vector3& direction,
double tolerance = s_onSurfaceTolerance) const final;

/// Straight line intersection schema from position/direction
Expand Down
Loading

0 comments on commit 7acfdf9

Please sign in to comment.