Skip to content

Commit

Permalink
fix: Add envelope to CuboidVolumeBuilder (#2542)
Browse files Browse the repository at this point in the history
I noticed that the `CuboidVolumeBuilder` is not generating any envelope around the generated layer which results in overlapping surfaces which does not play nicely with navigation.

discovered in #2532
  • Loading branch information
andiwand committed Oct 13, 2023
1 parent 43411f1 commit 98f36a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Core/src/Geometry/CuboidVolumeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ std::shared_ptr<Acts::TrackingVolume> Acts::CuboidVolumeBuilder::buildVolume(

LayerConfig lCfg;
lCfg.surfaceCfg = {sCfg};
lCfg.envelopeX = {0.1 * UnitConstants::mm, 0.1 * UnitConstants::mm};
lCfg.envelopeY = {0.1 * UnitConstants::mm, 0.1 * UnitConstants::mm};
lCfg.envelopeZ = {0.1 * UnitConstants::mm, 0.1 * UnitConstants::mm};

cfg.layerCfg.push_back(lCfg);
}
Expand Down
10 changes: 7 additions & 3 deletions Core/src/Geometry/LayerCreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ Acts::MutableLayerPtr Acts::LayerCreator::cylinderLayer(
// correctly defined using the halflength
Translation3 addTranslation(0., 0., 0.);
if (transform.isApprox(Transform3::Identity())) {
// double shift = -(layerZ + envZShift);
addTranslation = Translation3(0., 0., layerZ);
ACTS_VERBOSE(" - layer z shift = " << -layerZ);
}
Expand Down Expand Up @@ -344,11 +343,14 @@ Acts::MutableLayerPtr Acts::LayerCreator::planeLayer(
layerThickness = (protoLayer.max(binY) - protoLayer.min(binY));
break;
}
default: {
case BinningValue::binZ: {
layerHalf1 = 0.5 * (protoLayer.max(binX) - protoLayer.min(binX));
layerHalf2 = 0.5 * (protoLayer.max(binY) - protoLayer.min(binY));
layerThickness = (protoLayer.max(binZ) - protoLayer.min(binZ));
break;
}
default:
throw std::invalid_argument("Invalid binning value");
}

double centerX = 0.5 * (protoLayer.max(binX) + protoLayer.min(binX));
Expand All @@ -363,13 +365,15 @@ Acts::MutableLayerPtr Acts::LayerCreator::planeLayer(
ACTS_VERBOSE(" - from Y min/max = " << protoLayer.min(binY) << " / "
<< protoLayer.max(binY));
ACTS_VERBOSE(" - with Z thickness = " << layerThickness);
ACTS_VERBOSE(" - incl envelope = " << protoLayer.envelope[bValue][0u]
<< " / "
<< protoLayer.envelope[bValue][1u]);

// create the layer transforms if not given
// we need to transform in case centerX/centerY/centerZ != 0, so that the
// layer will be correctly defined
Translation3 addTranslation(0., 0., 0.);
if (transform.isApprox(Transform3::Identity())) {
// double shift = (layerZ + envZShift);
addTranslation = Translation3(centerX, centerY, centerZ);
ACTS_VERBOSE(" - layer shift = "
<< "(" << centerX << ", " << centerY << ", " << centerZ
Expand Down

0 comments on commit 98f36a0

Please sign in to comment.