|
|
|||
File indexing completed on 2026-11-25 09:24:43
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/Definitions/Algebra.hpp" 0012 #include "Acts/Definitions/Units.hpp" 0013 #include "Acts/SpacePointFormation/SpacePointFormationError.hpp" 0014 #include "Acts/Utilities/Result.hpp" 0015 0016 #include <optional> 0017 0018 namespace Acts { 0019 0020 class GeometryContext; 0021 class Surface; 0022 0023 namespace StripSpacePointBuilder { 0024 0025 /// @brief Collection of cluster pairing options 0026 struct ClusterPairingOptions final { 0027 /// vertex position 0028 Vector3 vertex = Vector3::Zero(); 0029 /// Accepted distance between two clusters 0030 double maxDistance = 100 * UnitConstants::mm; 0031 /// Accepted absolute difference in theta for two clusters 0032 double maxAngleTheta = 1 * UnitConstants::rad; 0033 /// Accepted absolute difference in phi for two clusters 0034 double maxAnglePhi = 1 * UnitConstants::rad; 0035 }; 0036 0037 /// @brief Collection of cosmic space point options 0038 struct CosmicOptions final { 0039 /// Minimum squared sine of the angle between the two strips. Pairs below this 0040 /// are too close to parallel for the closest approach to be well defined. 0041 double tolerance = 1e-6; 0042 /// Tolerance scaling factor on the strip detector element length 0043 double stripLengthTolerance = 0.01; 0044 }; 0045 0046 /// @brief Collection of constrained space point options 0047 struct ConstrainedOptions final { 0048 /// Position of the vertex 0049 Vector3 vertex = Vector3::Zero(); 0050 /// Tolerance scaling factor on the strip detector element length 0051 double stripLengthTolerance = 0.01; 0052 /// Tolerance scaling factor of the gap between strip detector elements 0053 double stripLengthGapTolerance = 0.01; 0054 }; 0055 0056 /// @brief Strip cluster details 0057 struct StripEnds final { 0058 /// Top end of the strip cluster 0059 Vector3 top = Vector3::Zero(); 0060 /// Bottom end of the strip cluster 0061 Vector3 bottom = Vector3::Zero(); 0062 }; 0063 0064 /// @brief Calculates (Delta theta)^2 + (Delta phi)^2 between two measurements 0065 /// 0066 /// @param globalCluster1 Global position of the measurements on the first strip 0067 /// @param globalCluster2 Global position of the measurements on the second strip 0068 /// @param options Pairing options 0069 /// 0070 /// @return If available, squared sum within configuration parameters 0071 Result<double> computeClusterPairDistance(const Vector3& globalCluster1, 0072 const Vector3& globalCluster2, 0073 const ClusterPairingOptions& options); 0074 0075 /// @brief Calculates the space point from the closest approach of two strips 0076 /// 0077 /// Rejects the pair if the closest approach does not lie on both strips. 0078 /// 0079 /// @param stripEnds1 The ends of first strip 0080 /// @param stripEnds2 The ends of second strip 0081 /// @param options The cosmic options 0082 /// 0083 /// @return If available, the calculated space point 0084 Result<Vector3> computeCosmicSpacePoint(const StripEnds& stripEnds1, 0085 const StripEnds& stripEnds2, 0086 const CosmicOptions& options); 0087 0088 /// @brief Per-strip cache for the constrained space point formation 0089 /// 0090 /// Depends on one strip only, so it can be filled once per strip and reused 0091 /// for every candidate partner on the opposite side. 0092 struct ConstrainedStripCache final { 0093 /// Vector pointing from the bottom to the top end of the strip 0094 Vector3 btmToTop = Vector3::Zero(); 0095 /// Twice the vector pointing from the vertex to the midpoint of the strip 0096 Vector3 vtxToMid2 = Vector3::Zero(); 0097 /// Normal of the plane spanned by the strip and the trajectory, 0098 /// `btmToTop x vtxToMid2` 0099 Vector3 normal = Vector3::Zero(); 0100 /// Midpoint of the strip 0101 Vector3 mid = Vector3::Zero(); 0102 /// Inverse of the strip length 0103 double invLength = 0; 0104 }; 0105 0106 /// @brief Precompute the per-strip quantities of the constrained formation 0107 /// 0108 /// @param stripEnds The ends of the strip 0109 /// @param options The constrained options; only the vertex is used 0110 /// 0111 /// @return The cache to hand to computeConstrainedSpacePoint 0112 ConstrainedStripCache makeConstrainedStripCache( 0113 const StripEnds& stripEnds, const ConstrainedOptions& options); 0114 0115 /// @param stripEnds1 The ends of first strip 0116 /// @param stripEnds2 The ends of second strip 0117 /// @param options The constrained options 0118 /// 0119 /// @return If available, the calculated space point 0120 Result<Vector3> computeConstrainedSpacePoint(const StripEnds& stripEnds1, 0121 const StripEnds& stripEnds2, 0122 const ConstrainedOptions& options); 0123 0124 /// @brief Space point of a strip pair, from precomputed per-strip caches 0125 /// 0126 /// Lets the caller hoist the per-strip work out of the loop over candidate 0127 /// pairs. Both caches must have been filled with the same options; 0128 /// `options.vertex` is not read again here, it is already encoded in them. 0129 /// 0130 /// @param cache1 The cache of the first strip 0131 /// @param cache2 The cache of the second strip 0132 /// @param options The constrained options 0133 /// @param spacePoint Set to the calculated space point, untouched on failure 0134 /// 0135 /// @return Why the pair was rejected, or nullopt if a space point was formed 0136 std::optional<SpacePointFormationError> computeConstrainedSpacePoint( 0137 const ConstrainedStripCache& cache1, const ConstrainedStripCache& cache2, 0138 const ConstrainedOptions& options, Vector3& spacePoint); 0139 0140 /// @brief Space point of a strip pair, from precomputed per-strip caches 0141 /// 0142 /// As above, packed into a Result. 0143 /// 0144 /// @param cache1 The cache of the first strip 0145 /// @param cache2 The cache of the second strip 0146 /// @param options The constrained options 0147 /// 0148 /// @return If available, the calculated space point 0149 Result<Vector3> computeConstrainedSpacePoint( 0150 const ConstrainedStripCache& cache1, const ConstrainedStripCache& cache2, 0151 const ConstrainedOptions& options); 0152 0153 /// @brief Transform the crossing covariance of a strip pair to z and r 0154 /// 0155 /// See Acts::PixelSpacePointBuilder::computeCovarianceZR for the requirement 0156 /// on the reference frame 0157 /// 0158 /// @param rotLocalToGlobal The reference frame of the first strip's surface 0159 /// @param spacePoint The space point 0160 /// @param localCov1 Local covariance of the first strip 0161 /// @param localCov2 Local covariance of the second strip 0162 /// @param theta The angle between the two strips 0163 /// 0164 /// @return The (z, r) covariance 0165 SquareMatrix2 computeCovarianceZR(const RotationMatrix3& rotLocalToGlobal, 0166 const Vector3& spacePoint, double localCov1, 0167 double localCov2, double theta); 0168 0169 /// @brief Calculate the z and r covariance from the front and back SourceLink in the strip SP formation 0170 /// 0171 /// @param gctx The current geometry context object, e.g. alignment 0172 /// @param surface1 The surface of the first strip 0173 /// @param spacePoint The space point 0174 /// @param localCov1 Local covariance of the first strip 0175 /// @param localCov2 Local covariance of the second strip 0176 /// @param theta The angle between the two strips 0177 /// 0178 /// @return (z, r) components of the global covariance 0179 /// @deprecated Use computeCovarianceZR with a reference frame from 0180 /// Surface::referenceFrame 0181 [[deprecated( 0182 "Use computeCovarianceZR with a reference frame from " 0183 "Surface::referenceFrame")]] 0184 Vector2 computeVarianceZR(const GeometryContext& gctx, const Surface& surface1, 0185 const Vector3& spacePoint, double localCov1, 0186 double localCov2, double theta); 0187 0188 } // namespace StripSpacePointBuilder 0189 0190 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|