Skip to content

Commit

Permalink
Merge branch 'main' into feat/composite-delayed-grid
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 11, 2024
2 parents f8f6042 + cf50c3c commit c64751b
Show file tree
Hide file tree
Showing 15 changed files with 288 additions and 141 deletions.
22 changes: 6 additions & 16 deletions Core/include/Acts/Geometry/CylinderVolumeStack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,12 @@ class CylinderVolumeStack : public Volume {
/// construction.
/// @param volbounds is the new bounds
/// @param transform is the new transform
/// @pre The volume bounds need to be of type
/// @c CylinderVolumeBounds.
void update(std::shared_ptr<VolumeBounds> volbounds,
std::optional<Transform3> transform = std::nullopt) override;

/// Update the volume bounds and transform. This
/// will update the bounds of all volumes in the stack
/// to accommodate the new bounds and optionally create
/// gap volumes according to the resize strategy set during
/// construction.
/// @param newBounds is the new bounds
/// @param transform is the new transform
/// @param logger is the logger
/// @pre The volume bounds need to be of type
/// @c CylinderVolumeBounds.
void update(std::shared_ptr<CylinderVolumeBounds> newBounds,
std::optional<Transform3> transform, const Logger& logger);
void update(std::shared_ptr<VolumeBounds> volbounds,
std::optional<Transform3> transform = std::nullopt,
const Logger& logger = getDummyLogger()) override;

/// Access the gap volume that were created during attachment or resizing.
/// @return the vector of gap volumes
Expand Down Expand Up @@ -133,11 +122,12 @@ class CylinderVolumeStack : public Volume {
Acts::Logging::Level lvl);

/// Helper function that prints output helping in debugging overlaps
/// @param direction is the overlap check direction
/// @param a is the first volume
/// @param b is the second volume
/// @param logger is the logger
static void overlapPrint(const VolumeTuple& a, const VolumeTuple& b,
const Logger& logger);
static void overlapPrint(BinningValue direction, const VolumeTuple& a,
const VolumeTuple& b, const Logger& logger);

/// Helper function that checks if volumes are properly aligned
/// for attachment.
Expand Down
5 changes: 4 additions & 1 deletion Core/include/Acts/Geometry/Volume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "Acts/Geometry/GeometryObject.hpp"
#include "Acts/Utilities/BinningType.hpp"
#include "Acts/Utilities/BoundingBox.hpp"
#include "Acts/Utilities/Logger.hpp"

#include <iosfwd>
#include <memory>
Expand Down Expand Up @@ -83,8 +84,10 @@ class Volume : public GeometryObject {
/// Set the volume bounds and optionally also update the volume transform
/// @param volbounds The volume bounds to be assigned
/// @param transform The transform to be assigned, can be optional
/// @param logger A logger object to log messages
virtual void update(std::shared_ptr<VolumeBounds> volbounds,
std::optional<Transform3> transform = std::nullopt);
std::optional<Transform3> transform = std::nullopt,
const Logger& logger = Acts::getDummyLogger());

/// Construct bounding box for this shape
/// @param envelope Optional envelope to add / subtract from min/max
Expand Down
10 changes: 10 additions & 0 deletions Core/include/Acts/Seeding/SeedFinder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ class SeedFinder {
const Acts::Range1D<float>& rMiddleSPRange) const;

private:
/// Given a middle space point candidate, get the proper radius validity range
/// In case the radius range changes according to the z-bin we need to
/// retrieve the proper range. We can do this computation only once, since
/// all the middle space point candidates belong to the same z-bin
/// @param spM space point candidate to be used as middle SP in a seed
/// @param rMiddleSPRange range object containing the minimum and maximum r for middle SP for a certain z bin.
std::pair<float, float> retrieveRadiusRangeForMiddle(
const external_spacepoint_t& spM,
const Acts::Range1D<float>& rMiddleSPRange) const;

/// Iterates over dublets and tests the compatibility between them by applying
/// a series of cuts that can be tested with only two SPs
/// @param options frequently changing configuration (like beam position)
Expand Down
61 changes: 31 additions & 30 deletions Core/include/Acts/Seeding/SeedFinder.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -104,40 +104,20 @@ void SeedFinder<external_spacepoint_t, grid_t, platform_t>::createSeedsForGroup(
return;
}

// we compute this here since all middle space point candidates belong to the
// same z-bin
auto [minRadiusRangeForMiddle, maxRadiusRangeForMiddle] =
retrieveRadiusRangeForMiddle(*middleSPs.front(), rMiddleSPRange);
for (const external_spacepoint_t* spM : middleSPs) {
const float rM = spM->radius();

// check if spM is outside our radial region of interest
if (m_config.useVariableMiddleSPRange) {
if (rM < rMiddleSPRange.min()) {
continue;
}
if (rM > rMiddleSPRange.max()) {
// break because SPs are sorted in r
break;
}
} else if (!m_config.rRangeMiddleSP.empty()) {
/// get zBin position of the middle SP
auto pVal = std::lower_bound(m_config.zBinEdges.begin(),
m_config.zBinEdges.end(), spM->z());
int zBin = std::distance(m_config.zBinEdges.begin(), pVal);
/// protects against zM at the limit of zBinEdges
zBin == 0 ? zBin : --zBin;
if (rM < m_config.rRangeMiddleSP[zBin][0]) {
continue;
}
if (rM > m_config.rRangeMiddleSP[zBin][1]) {
// break because SPs are sorted in r
break;
}
} else {
if (rM < m_config.rMinMiddle) {
continue;
}
if (rM > m_config.rMaxMiddle) {
// break because SPs are sorted in r
break;
}
if (rM < minRadiusRangeForMiddle) {
continue;
}
if (rM > maxRadiusRangeForMiddle) {
// break because SPs are sorted in r
break;
}

const float zM = spM->z();
Expand Down Expand Up @@ -827,4 +807,25 @@ SeedFinder<external_spacepoint_t, grid_t, platform_t>::filterCandidates(
} // loop on bottoms
}

template <typename external_spacepoint_t, typename grid_t, typename platform_t>
std::pair<float, float> SeedFinder<external_spacepoint_t, grid_t, platform_t>::
retrieveRadiusRangeForMiddle(
const external_spacepoint_t& spM,
const Acts::Range1D<float>& rMiddleSPRange) const {
if (m_config.useVariableMiddleSPRange) {
return std::make_pair(rMiddleSPRange.min(), rMiddleSPRange.max());
}
if (!m_config.rRangeMiddleSP.empty()) {
/// get zBin position of the middle SP
auto pVal = std::lower_bound(m_config.zBinEdges.begin(),
m_config.zBinEdges.end(), spM.z());
int zBin = std::distance(m_config.zBinEdges.begin(), pVal);
/// protects against zM at the limit of zBinEdges
zBin == 0 ? zBin : --zBin;
return std::make_pair(m_config.rRangeMiddleSP[zBin][0],
m_config.rRangeMiddleSP[zBin][1]);
}
return std::make_pair(m_config.rMinMiddle, m_config.rMaxMiddle);
}

} // namespace Acts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ template <typename external_spacepoint_t>
using CylindricalSpacePointGrid = Acts::Grid<
std::vector<const external_spacepoint_t*>,
Acts::Axis<Acts::AxisType::Equidistant, Acts::AxisBoundaryType::Closed>,
Acts::Axis<Acts::AxisType::Variable, Acts::AxisBoundaryType::Bound>,
Acts::Axis<Acts::AxisType::Variable, Acts::AxisBoundaryType::Bound>>;
Acts::Axis<Acts::AxisType::Variable, Acts::AxisBoundaryType::Open>,
Acts::Axis<Acts::AxisType::Variable, Acts::AxisBoundaryType::Open>>;

/// Cylindrical Binned Group
template <typename external_spacepoint_t>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ Acts::CylindricalSpacePointGridCreator::createGrid(
config.rBinEdges.end());
}

Axis<AxisType::Variable, AxisBoundaryType::Bound> zAxis(std::move(zValues));
Axis<AxisType::Variable, AxisBoundaryType::Bound> rAxis(std::move(rValues));
Axis<AxisType::Variable, AxisBoundaryType::Open> zAxis(std::move(zValues));
Axis<AxisType::Variable, AxisBoundaryType::Open> rAxis(std::move(rValues));
return Acts::CylindricalSpacePointGrid<external_spacepoint_t>(
std::make_tuple(std::move(phiAxis), std::move(zAxis), std::move(rAxis)));
}
Expand Down
Loading

0 comments on commit c64751b

Please sign in to comment.