forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add helper and fusing infrastructure for cuboidal detectors (ac…
…ts-project#2754) This PR adds a new `detail/CuboidalDetectorHelper.h/cpp` for creating cuboid shape detectors. Since it reuses some code from the cylindrical infrastructure, this is encapsulated into sub helpers to not be duplicated. ![CuboidalDetector00](https://github.com/acts-project/acts/assets/26623879/19fc7cb9-7189-4535-ada9-aa2fef33f7d4) Blocked by: - acts-project#2753 (merged) This relaxes the Portal fusing to allow for two portals with same direction filled to be fused (necessary for box-2-box)
- Loading branch information
1 parent
cf0ad59
commit 4487c7c
Showing
13 changed files
with
1,035 additions
and
126 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
Core/include/Acts/Detector/detail/CuboidalDetectorHelper.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 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 | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/Definitions/Algebra.hpp" | ||
#include "Acts/Definitions/Common.hpp" | ||
#include "Acts/Detector/DetectorComponents.hpp" | ||
#include "Acts/Detector/Portal.hpp" | ||
#include "Acts/Geometry/GeometryContext.hpp" | ||
#include "Acts/Utilities/BinningData.hpp" | ||
#include "Acts/Utilities/Logger.hpp" | ||
|
||
#include <array> | ||
#include <limits> | ||
#include <map> | ||
#include <memory> | ||
#include <vector> | ||
|
||
namespace Acts { | ||
|
||
namespace Experimental { | ||
|
||
class DetectorVolume; | ||
class Portal; | ||
|
||
namespace detail { | ||
namespace CuboidalDetectorHelper { | ||
|
||
/// @brief Connect detector volumes given a binning value | ||
/// | ||
/// @param gctx The geometry context | ||
/// @param volumes the volumes | ||
/// @param bValue the binning value (allowed are binX, binY, binZ) | ||
/// @param selectedOnly switch only selected boundaries | ||
/// @param logLevel is the screen logging level | ||
/// | ||
/// @note a fair amount of consistency checking is done, | ||
/// and exceptions are thrown if any of the tests fail | ||
/// | ||
/// @return a proto container with the outside portals | ||
DetectorComponent::PortalContainer connect( | ||
const GeometryContext& gctx, | ||
std::vector<std::shared_ptr<DetectorVolume>>& volumes, BinningValue bValue, | ||
const std::vector<unsigned int>& selectedOnly = {}, | ||
Acts::Logging::Level logLevel = Acts::Logging::INFO); | ||
|
||
/// @brief Connect containers given a binning value | ||
/// | ||
/// @param gctx The geometry context | ||
/// @param containers the containers | ||
/// @param bValue the binning value (allowed are binX, binY, binZ) | ||
/// @param selectedOnly switch only selected boundaries | ||
/// @param logLevel is the screen logging level | ||
/// | ||
/// @note not much checking is done anymore, as the DetectorComponent::PortalContainer | ||
/// are assumed to come properly formed from the prior methods | ||
/// | ||
/// @return a proto container with the outside portals | ||
DetectorComponent::PortalContainer connect( | ||
const GeometryContext& gctx, | ||
const std::vector<DetectorComponent::PortalContainer>& containers, | ||
BinningValue bValue, const std::vector<unsigned int>& selectedOnly = {}, | ||
Acts::Logging::Level logLevel = Acts::Logging::INFO); | ||
|
||
/// @brief Helper method to extract r,z,phi boundaries for | ||
/// eventual grid volume search | ||
/// | ||
/// @param gctx the geometry context of the call | ||
/// @param volumes the volumes at input | ||
/// @param logLevel is the screen logging level | ||
/// | ||
/// @return extracted boundary values | ||
std::array<std::vector<ActsScalar>, 3u> xyzBoundaries( | ||
const GeometryContext& gctx, | ||
const std::vector<const DetectorVolume*>& volumes, | ||
Acts::Logging::Level logLevel = Acts::Logging::INFO); | ||
|
||
} // namespace CuboidalDetectorHelper | ||
} // namespace detail | ||
} // namespace Experimental | ||
} // namespace Acts |
58 changes: 58 additions & 0 deletions
58
Core/include/Acts/Detector/detail/DetectorVolumeConsistency.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 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 | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/Definitions/Common.hpp" | ||
#include "Acts/Geometry/GeometryContext.hpp" | ||
#include "Acts/Utilities/BinningData.hpp" | ||
|
||
#include <memory> | ||
#include <vector> | ||
|
||
namespace Acts { | ||
namespace Experimental { | ||
|
||
class DetectorVolume; | ||
|
||
namespace detail { | ||
namespace DetectorVolumeConsistency { | ||
|
||
/// @brief Helper method to check alignment of the volumes, this method checks | ||
/// if the rotational part of the transform is identical | ||
/// | ||
/// @param gctx the geometry context | ||
/// @param volumes the input volumes to be checked | ||
/// | ||
/// @note this is a strict matching that requires the rotation to be identical | ||
/// | ||
/// @note throws exception if any of checks fails | ||
void checkRotationAlignment( | ||
const GeometryContext& gctx, | ||
const std::vector<std::shared_ptr<Experimental::DetectorVolume>>& volumes); | ||
|
||
/// @brief Helper method to check whether a set of volumes is lined up on | ||
/// a given common axis definition | ||
/// | ||
/// @param gctx the geometry context | ||
/// @param volumes the input volumes to be checked | ||
/// @param axisValue the alignment axist | ||
/// | ||
/// @note this will call checkRotationAlignment first | ||
/// @note throws exception if the volumes are not ordered | ||
/// | ||
/// @return a vector with position differences (ordered) | ||
std::vector<ActsScalar> checkCenterAlignment( | ||
const GeometryContext& gctx, | ||
const std::vector<std::shared_ptr<Experimental::DetectorVolume>>& volumes, | ||
BinningValue axisValue); | ||
|
||
} // namespace DetectorVolumeConsistency | ||
} // namespace detail | ||
} // namespace Experimental | ||
} // namespace Acts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.