Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:24

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2023 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Alignment.hpp"
0013 #include "Acts/Definitions/TrackParametrization.hpp"
0014 #include "Acts/Geometry/DetectorElementBase.hpp"
0015 #include "Acts/Geometry/GeometryContext.hpp"
0016 #include "Acts/Material/ISurfaceMaterial.hpp"
0017 #include "Acts/Surfaces/BoundaryCheck.hpp"
0018 #include "Acts/Surfaces/Surface.hpp"
0019 #include "Acts/Surfaces/SurfaceBounds.hpp"
0020 #include "Acts/Utilities/Result.hpp"
0021 
0022 #if defined(__cpp_concepts)
0023 #include <concepts>
0024 
0025 namespace Acts {
0026 
0027 template <typename S>
0028 concept SurfaceConcept = requires(S s, const S cs, S s2, const S cs2,
0029                                   GeometryContext gctx) {
0030   { cs == s2 } -> std::same_as<bool>;
0031 
0032   { cs.type() } -> std::same_as<Surface::SurfaceType>;
0033   { cs.transform(gctx) } -> std::same_as<const Transform3&>;
0034   { cs.center(gctx) } -> std::same_as<Vector3>;
0035   { cs.normal(gctx, Vector3{}, Vector3{}) } -> std::same_as<Vector3>;
0036   { cs.bounds() } -> std::convertible_to<const SurfaceBounds&>;
0037   {
0038     cs.associatedDetectorElement()
0039     } -> std::same_as<const DetectorElementBase*>;
0040 
0041   { cs.associatedLayer() } -> std::same_as<const Layer*>;
0042   { s.associateLayer(std::declval<const Layer&>()) } -> std::same_as<void>;
0043 
0044   { cs.surfaceMaterial() } -> std::same_as<const ISurfaceMaterial*>;
0045   {
0046     cs.surfaceMaterialSharedPtr()
0047     } -> std::same_as<const std::shared_ptr<const ISurfaceMaterial>&>;
0048   {
0049     s.assignSurfaceMaterial(
0050         std::declval<std::shared_ptr<const ISurfaceMaterial>>())
0051     } -> std::same_as<void>;
0052   {
0053     cs.isOnSurface(gctx, Vector3{}, Vector3{},
0054                    std::declval<const BoundaryCheck&>())
0055     } -> std::same_as<bool>;
0056   {
0057     cs.insideBounds(Vector2{}, std::declval<const BoundaryCheck&>())
0058     } -> std::same_as<bool>;
0059 
0060   { cs.localToGlobal(gctx, Vector2{}, Vector3{}) } -> std::same_as<Vector3>;
0061 
0062   {
0063     cs.globalToLocal(gctx, Vector3{}, Vector3{}, double{5})
0064     } -> std::same_as<Result<Vector2>>;
0065 
0066   {
0067     cs.referenceFrame(gctx, Vector3{}, Vector3{})
0068     } -> std::same_as<RotationMatrix3>;
0069 
0070   {
0071     cs.boundToFreeJacobian(gctx, Vector3{}, Vector3{})
0072     } -> std::same_as<BoundToFreeMatrix>;
0073 
0074   {
0075     cs.freeToBoundJacobian(gctx, Vector3{}, Vector3{})
0076     } -> std::same_as<FreeToBoundMatrix>;
0077 
0078   {
0079     cs.freeToPathDerivative(gctx, Vector3{}, Vector3{})
0080     } -> std::same_as<FreeToPathMatrix>;
0081 
0082   { cs.pathCorrection(gctx, Vector3{}, Vector3{}) } -> std::same_as<double>;
0083 
0084   {
0085     cs.intersect(gctx, Vector3{}, Vector3{},
0086                  std::declval<const BoundaryCheck&>(), std::declval<double>())
0087     } -> std::same_as<SurfaceMultiIntersection>;
0088 
0089   {
0090     cs.toStream(gctx, std::declval<std::ostream&>())
0091     } -> std::same_as<std::ostream&>;
0092 
0093   { cs.toString(gctx) } -> std::same_as<std::string>;
0094 
0095   { cs.name() } -> std::same_as<std::string>;
0096 
0097   {
0098     cs.polyhedronRepresentation(gctx, std::declval<std::size_t>())
0099     } -> std::same_as<Polyhedron>;
0100 
0101   {
0102     cs.alignmentToBoundDerivative(gctx, Vector3{}, Vector3{}, FreeVector{})
0103     } -> std::same_as<AlignmentToBoundMatrix>;
0104 
0105   {
0106     cs.alignmentToPathDerivative(gctx, Vector3{}, Vector3{})
0107     } -> std::same_as<AlignmentToPathMatrix>;
0108 
0109   {
0110     cs.localCartesianToBoundLocalDerivative(gctx, Vector3{})
0111     } -> std::same_as<ActsMatrix<2, 3>>;
0112 };
0113 
0114 template <typename S>
0115 concept RegularSurfaceConcept = SurfaceConcept<S> &&
0116     requires(S s, const S cs, GeometryContext gctx) {
0117   { cs.normal(gctx, Vector2{}) } -> std::same_as<Vector3>;
0118 
0119   { cs.normal(gctx, Vector3{}) } -> std::same_as<Vector3>;
0120 
0121   {
0122     cs.globalToLocal(gctx, Vector3{}, Vector3{}, std::declval<double>())
0123     } -> std::same_as<Result<Vector2>>;
0124 
0125   { cs.localToGlobal(gctx, Vector2{}) } -> std::same_as<Vector3>;
0126 };
0127 }  // namespace Acts
0128 
0129 #endif