Skip to content

Commit

Permalink
Merge branch 'main' into refactor/examples-util
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger authored Feb 10, 2023
2 parents b332b2f + aa3dea8 commit b7486a6
Show file tree
Hide file tree
Showing 48 changed files with 389 additions and 246 deletions.
4 changes: 2 additions & 2 deletions Core/include/Acts/EventData/Track.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ struct TrackAccessorBase {
/// @return mutable reference to the column behind the key
template <typename track_proxy_t, bool RO = ReadOnly,
typename = std::enable_if_t<!RO>>
T& operator()(track_proxy_t track) {
T& operator()(track_proxy_t track) const {
static_assert(!track_proxy_t::ReadOnly,
"Cannot get mutable ref for const track proxy");
return track.template component<T>(key);
Expand All @@ -691,7 +691,7 @@ struct TrackAccessorBase {
/// @return const reference to the column behind the key
template <typename track_proxy_t, bool RO = ReadOnly,
typename = std::enable_if_t<RO>>
const T& operator()(track_proxy_t track) {
const T& operator()(track_proxy_t track) const {
if constexpr (track_proxy_t::ReadOnly) {
return track.template component<T>(key);
} else {
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Geometry/Detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "Acts/Definitions/Common.hpp"
#include "Acts/Geometry/DetectorVolume.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Utilities/Delegate.hpp"

#include <memory>
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Geometry/DetectorVolume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include "Acts/Definitions/Common.hpp"
#include "Acts/Geometry/Extent.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/NavigationDelegates.hpp"
#include "Acts/Geometry/NavigationState.hpp"
#include "Acts/Geometry/VolumeBounds.hpp"
#include "Acts/Material/IVolumeMaterial.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Utilities/BoundingBox.hpp"
#include "Acts/Utilities/Delegate.hpp"
Expand Down
9 changes: 8 additions & 1 deletion Core/include/Acts/Geometry/Extent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,20 @@ class Extent {
/// @param bValue the binning identification
ActsScalar max(BinningValue bValue) const { return m_range[bValue].max(); }

/// Access the maximum parameter
/// Access the midpoint
///
/// @param bValue the binning identification
ActsScalar medium(BinningValue bValue) const {
return 0.5 * (m_range[bValue].min() + m_range[bValue].max());
}

/// Access the parameter internval
///
/// @param bValue the binning identification
ActsScalar interval(BinningValue bValue) const {
return m_range[bValue].size();
}

/// Contains check
///
/// @param rhs the extent that is check if it is contained
Expand Down
5 changes: 3 additions & 2 deletions Core/include/Acts/Geometry/KDTreeTrackingGeometryBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#pragma once

#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Geometry/ProtoDetector.hpp"
#include "Acts/Geometry/TrackingGeometryBuilder.hpp"
#include "Acts/Utilities/KDTree.hpp"
Expand Down Expand Up @@ -43,8 +44,8 @@ class KDTreeTrackingGeometryBuilder : public ITrackingGeometryBuilder {
/// The proto tracking geometry description
ProtoDetector protoDetector;
/// Optional geometry identfier hook to be used during closure
/// @note Will be @b copied when calling the geometry building
GeometryIdentifierHook geometryIdentifierHook;
std::shared_ptr<const GeometryIdentifierHook> geometryIdentifierHook =
std::make_shared<GeometryIdentifierHook>();
/// For screen output
std::string hierarchyIndent = " ";
};
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Geometry/Portal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "Acts/Definitions/Common.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/GeometryIdentifier.hpp"
#include "Acts/Geometry/NavigationDelegates.hpp"
#include "Acts/Geometry/NavigationState.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Surfaces/BoundaryCheck.hpp"
#include "Acts/Surfaces/Surface.hpp"

Expand Down
27 changes: 25 additions & 2 deletions Core/include/Acts/Geometry/ProtoDetector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,32 @@
#include "Acts/Surfaces/Surface.hpp"
#include "Acts/Utilities/BinningData.hpp"

#include <functional>
#include <map>
#include <optional>
#include <string>
#include <vector>

namespace Acts {

struct ProtoVolume;

namespace Experimental {
class DetectorVolume;
class Portal;

/// Current volumes (connected)
using DetectorVolumes = std::vector<std::shared_ptr<DetectorVolume>>;
/// Current shell (i.e. outside portals)
using ProtoContainer = std::map<unsigned int, std::shared_ptr<Portal>>;
/// Current block (volumes and shell)
using DetectorBlock = std::tuple<DetectorVolumes, ProtoContainer>;

/// The detector builder function
using DetectorBlockBuilder = std::function<void(
DetectorBlock&, const GeometryContext&, Acts::Logging::Level)>;
} // namespace Experimental

/// A proto volume description being used to define an overall
/// structure of either a TrackingVolume or Experimental::DetectorVolume
struct ProtoVolume {
Expand All @@ -45,12 +65,15 @@ struct ProtoVolume {
/// The extent of this volume
Extent extent;

/// Information about internal structure
/// Information about internal structure - legacy building
std::optional<InternalStructure> internal = std::nullopt;

/// Information about container structure
/// Information about container structure - legacy building
std::optional<ContainerStructure> container = std::nullopt;

/// An attached Detector volume Builder - new detector schema
Experimental::DetectorBlockBuilder blockBuilder;

/// Define an operator==
///
/// @param ptVolume the proto volume to be checked
Expand Down
7 changes: 1 addition & 6 deletions Core/include/Acts/Geometry/TrackingGeometryBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class TrackingGeometryBuilder : public ITrackingGeometryBuilder {

/// Get configuration method
/// @return the current configuration
Config getConfiguration() const;
const Config& getConfiguration() const;

/// set logging instance
/// @param newLogger the new logging instance
Expand All @@ -99,9 +99,4 @@ class TrackingGeometryBuilder : public ITrackingGeometryBuilder {
std::unique_ptr<const Logger> m_logger;
};

inline TrackingGeometryBuilder::Config
TrackingGeometryBuilder::getConfiguration() const {
return m_cfg;
}

} // namespace Acts
2 changes: 1 addition & 1 deletion Core/include/Acts/Geometry/detail/PortalGenerators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/Portal.hpp"
#include "Acts/Geometry/VolumeBounds.hpp"
#include "Acts/Geometry/detail/DetectorVolumeUpdators.hpp"
#include "Acts/Navigation/DetectorVolumeUpdators.hpp"
#include "Acts/Utilities/Helpers.hpp"

#include <exception>
Expand Down
56 changes: 55 additions & 1 deletion Core/include/Acts/Geometry/detail/PortalHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,60 @@ defaultPortalAndSubPortalGenerator() {
return pGenerator;
}

/// Definition of a portal replacement when building proto containers
/// It consists of the new portal, the index, the direction, the parameters
/// gathered from the sub volumes, the binning description
using PortalReplacement =
std::tuple<std::shared_ptr<Experimental::Portal>, unsigned int,
NavigationDirection, std::vector<ActsScalar>, BinningValue>;

/// @brief Create and attach the multi link updator
///
/// @param gctx the geometry context
/// @param volumes are the volumes that are pointed to
/// @param pReplacements are the portal replacements that are newly connected
///
///
void attachDetectorVolumeUpdators(
const GeometryContext& gctx,
const std::vector<std::shared_ptr<DetectorVolume>>& volumes,
std::vector<PortalReplacement>& pReplacements) {
// Unpack to navigation bare points
auto cVolumes = unpack_shared_const_vector(volumes);
// Set to the contructed portals (p), at index (i), in direction (d)
// using boundaries and binning
for (auto& [p, i, dir, boundaries, binning] : pReplacements) {
// Check if the boundaries need a transform
const auto pTransform = p->surface().transform(gctx);
// Creating a link to the mother
auto volumes1D = std::make_unique<const BoundVolumesGrid1Impl>(
boundaries, binning, cVolumes, pTransform.inverse());
DetectorVolumeUpdator dVolumeUpdator;
dVolumeUpdator.connect<&BoundVolumesGrid1Impl::update>(
std::move(volumes1D));
p->assignDetectorVolumeUpdator(dir, std::move(dVolumeUpdator), volumes);
}
}

/// @brief Method that strips out attached volumes from portals
///
/// @note it throws an exception if both sides are already taken
///
/// @param portal the portal to be resolved
///
/// @return a vector of attached volumes
std::vector<std::shared_ptr<DetectorVolume>> attachedDetectorVolumes(
Portal& portal) noexcept(false) {
auto& attachedVolumes = portal.attachedDetectorVolumes();
if (not attachedVolumes[0u].empty() and not attachedVolumes[1u].empty()) {
throw std::invalid_argument(
"PortalHelper: trying to get attachedVolumes from already populated "
"portal.");
}
unsigned int iu = attachedVolumes[0u].empty() ? 1u : 0u;
return attachedVolumes[iu];
}

} // namespace detail
} // namespace Experimental
} // namespace Acts
} // namespace Acts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the Acts project.
//
// Copyright (C) 2022 CERN for the benefit of the Acts project
// Copyright (C) 2022-2023 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -11,9 +11,9 @@
#include "Acts/Geometry/Detector.hpp"
#include "Acts/Geometry/DetectorVolume.hpp"
#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/NavigationDelegates.hpp"
#include "Acts/Geometry/NavigationState.hpp"
#include "Acts/Geometry/detail/NavigationStateUpdators.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Navigation/NavigationStateUpdators.hpp"
#include "Acts/Utilities/detail/Axis.hpp"
#include "Acts/Utilities/detail/Grid.hpp"

Expand All @@ -22,8 +22,6 @@
namespace Acts {
namespace Experimental {

namespace detail {

/// @brief The end of world sets the volume pointer of the
/// navigation state to nullptr, usually indicates the end of
/// the known world, hence the name
Expand Down Expand Up @@ -93,6 +91,5 @@ using IndexedDetectorVolumeImpl =
IndexedUpdatorImpl<grid_type, IndexedDetectorVolumeExtractor,
DetectorVolumeFiller>;

} // namespace detail
} // namespace Experimental
} // namespace Acts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of the Acts project.
//
// Copyright (C) 2022 CERN for the benefit of the Acts project
// Copyright (C) 2022-2023 CERN for the benefit of the Acts project
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -9,9 +9,9 @@
#pragma once

#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/NavigationDelegates.hpp"
#include "Acts/Geometry/NavigationState.hpp"
#include "Acts/Geometry/detail/NavigationStateUpdators.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Navigation/NavigationStateUpdators.hpp"
#include "Acts/Utilities/detail/Axis.hpp"
#include "Acts/Utilities/detail/Grid.hpp"

Expand All @@ -22,8 +22,6 @@ namespace Experimental {

class DetectorVolume;

namespace detail {

/// @brief The end of world sets the volume pointer of the
/// navigation state to nullptr, usually indicates the end of
/// the known world, hence the name
Expand Down Expand Up @@ -111,7 +109,7 @@ struct BoundVolumesGrid1Impl : public INavigationDelegate {
/// @param gBoundaries the grid boundaries
/// @param bValue the binning value
/// @param cVolumes the contained volumes
/// @param bTransfrom is the optional transform
/// @param bTransform is the optional transform
BoundVolumesGrid1Impl(
const std::vector<ActsScalar>& gBoundaries, BinningValue bValue,
const std::vector<const DetectorVolume*>& cVolumes,
Expand Down Expand Up @@ -143,6 +141,5 @@ struct BoundVolumesGrid1Impl : public INavigationDelegate {
}
};

} // namespace detail
} // namespace Experimental
} // namespace Acts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once

#include "Acts/Geometry/GeometryContext.hpp"
#include "Acts/Geometry/NavigationState.hpp"
#include "Acts/Navigation/NavigationState.hpp"
#include "Acts/Utilities/Delegate.hpp"

namespace Acts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include <any>
#include <vector>

/// @note this is foreseen for the 'Geometry' module

namespace Acts {

class Surface;
Expand All @@ -29,13 +27,14 @@ class Portal;
class Detector;
class DetectorVolume;

/// @brief A navigation state struct that is
/// holding the current navigation information
/// about volume, surfaces, and portals
/// @brief A navigation state struct that is holding the current navigation information
///
/// It relies on Surfaces and Portals, all navigation entities have to be
/// described in these terms.
struct NavigationState {
/// @brief A surface candidate and its intersection
///
/// candidates can either be surfaces or portals (which contain a surface)
/// A candidates can either be a surface or a portal (which contain a surface)
struct SurfaceCandidate {
/// A candidate intersection, in Surface view
ObjectIntersection<Surface> objectIntersection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Common.hpp"
#include "Acts/Geometry/NavigationDelegates.hpp"
#include "Acts/Navigation/NavigationDelegates.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/Helpers.hpp"

Expand All @@ -19,7 +19,6 @@

namespace Acts {
namespace Experimental {
namespace detail {

/// @brief This sets a single object, e.g. single surface or single volume
/// @tparam object_type the type of the object to be filled
Expand Down Expand Up @@ -173,6 +172,5 @@ class ChainedUpdatorImpl : public INavigationDelegate {
std::tuple<updators_t...> updators;
};

} // namespace detail
} // namespace Experimental
} // namespace Acts
Loading

0 comments on commit b7486a6

Please sign in to comment.