Skip to content

Commit

Permalink
fix: fix proto layer range for straw surfaces (#3443)
Browse files Browse the repository at this point in the history
This PR fixes the problem when obtaining the extent of a layer with straw surfaces. When the `lseg` of a straw surface is 1, the number of vertices of the polyhedron representation is 3, which makes the `detail::VerticesHelper::onHyperPlane` [here](https://github.com/acts-project/acts/blob/main/Core/src/Geometry/Polyhedron.cpp#L52) and the `detail::VerticesHelper::isInsidePolygon` [here](https://github.com/acts-project/acts/blob/main/Core/src/Geometry/Polyhedron.cpp#L62) return `true` and further set the  rMin of the extent to zero ([here](https://github.com/acts-project/acts/blob/main/Core/src/Geometry/Polyhedron.cpp#L63)), which is problematic for straw layers.
  • Loading branch information
XiaocongAi authored Jul 29, 2024
1 parent b2fb7fd commit 6423d1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Core/src/Geometry/ProtoLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ std::ostream& ProtoLayer::toStream(std::ostream& sl) const {
void ProtoLayer::measure(const GeometryContext& gctx,
const std::vector<const Surface*>& surfaces) {
for (const auto& sf : surfaces) {
auto sfPolyhedron = sf->polyhedronRepresentation(gctx, 1);
// To prevent problematic isInsidePolygon check for straw surfaces with only
// one lseg
int lseg = (sf->type() != Surface::Straw) ? 1 : 2;
auto sfPolyhedron = sf->polyhedronRepresentation(gctx, lseg);
const DetectorElementBase* element = sf->associatedDetectorElement();
const auto* regSurface = dynamic_cast<const RegularSurface*>(sf);
if (element != nullptr && regSurface != nullptr) {
Expand Down
5 changes: 4 additions & 1 deletion Core/src/Geometry/ProtoLayerHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ std::vector<Acts::ProtoLayer> Acts::ProtoLayerHelper::protoLayers(

// Loop over surfaces and sort into clusters
for (auto& sf : surfaces) {
auto sfExtent = sf->polyhedronRepresentation(gctx, 1).extent();
// To prevent problematic isInsidePolygon check for straw surfaces with only
// one lseg
int lseg = (sf->type() != Surface::Straw) ? 1 : 2;
auto sfExtent = sf->polyhedronRepresentation(gctx, lseg).extent();
sfExtent.envelope()[sorting.first] = {sorting.second, sorting.second};
auto& sfCluster = findCluster(sfExtent);
sfCluster.first.extend(sfExtent);
Expand Down

0 comments on commit 6423d1c

Please sign in to comment.