|
||||
File indexing completed on 2025-01-18 09:11:12
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/TrackParametrization.hpp" 0013 #include "Acts/EventData/SourceLink.hpp" 0014 #include "Acts/Geometry/GeometryContext.hpp" 0015 #include "Acts/Geometry/GeometryIdentifier.hpp" 0016 #include "Acts/Geometry/TrackingGeometry.hpp" 0017 #include "Acts/SpacePointFormation/SpacePointBuilderConfig.hpp" 0018 #include "Acts/SpacePointFormation/SpacePointBuilderOptions.hpp" 0019 #include "Acts/Utilities/Result.hpp" 0020 0021 #include <array> 0022 #include <cstddef> 0023 #include <functional> 0024 #include <iostream> 0025 #include <memory> 0026 #include <system_error> 0027 #include <utility> 0028 #include <vector> 0029 0030 namespace Acts { 0031 class SourceLink; 0032 0033 /// @brief Storage container for variables related to the calculation of space 0034 /// points 0035 struct SpacePointParameters { 0036 /// Vector pointing from bottom to top end of first SDE 0037 Vector3 firstBtmToTop; 0038 /// Vector pointing from bottom to top end of second SDE 0039 Vector3 secondBtmToTop; 0040 /// Twice the vector pointing from vertex to to midpoint of first SDE 0041 Vector3 vtxToFirstMid2; 0042 /// Twice the vector pointing from vertex to to midpoint of second SDE 0043 Vector3 vtxToSecondMid2; 0044 /// Cross product between firstBtmToTop and vtxToFirstMid2 0045 Vector3 firstBtmToTopXvtxToFirstMid2; 0046 /// Cross product between secondBtmToTop and vtxToSecondMid2 0047 Vector3 secondBtmToTopXvtxToSecondMid2; 0048 /// Magnitude of SpacePointParameters::firstBtmToTop 0049 double mag_firstBtmToTop = 0.; 0050 /// Parameter that determines the hit position on the first SDE 0051 double m = 0.; 0052 /// Parameter that determines the hit position on the second SDE 0053 double n = 0.; 0054 /// Regular limit of the absolute values of SpacePointParameters::m and 0055 /// SpacePointParameters::n 0056 double limit = 1.; 0057 /// Limit of SpacePointParameters::m and SpacePointParameters::n in case of 0058 /// variable vertex 0059 double limitExtended = 0.; 0060 }; 0061 0062 /// @class SpacePointUtility 0063 /// 0064 class SpacePointUtility { 0065 public: 0066 /// Constructor 0067 SpacePointUtility(SpacePointBuilderConfig cfg) : m_config(std::move(cfg)) {} 0068 0069 /// @brief Getter method for the global coordinates of a SourceLink 0070 /// 0071 /// @param gctx The current geometry context object, e.g. alignment 0072 /// @param slink SourceLink that holds the necessary 0073 /// information 0074 /// @param surfaceAccessor function to extract surface from SourceLink 0075 /// @param par local position 0076 /// @param cov local covariance 0077 /// @return vectors of the global coordinates and covariance of the SourceLink 0078 std::tuple<Vector3, std::optional<double>, Vector2, std::optional<double>> 0079 globalCoords(const GeometryContext& gctx, const SourceLink& slink, 0080 const SourceLinkSurfaceAccessor& surfaceAccessor, 0081 const BoundVector& par, const BoundSquareMatrix& cov) const; 0082 0083 /// @brief Get rho and z covariance from the local position and covariance 0084 /// @param gctx The current geometry context object, e.g. alignment 0085 /// @param surface The surface associated 0086 /// @param globalPos The global position 0087 /// @param localCov The local covariance matrix 0088 /// @return (rho, z) components of the global covariance 0089 Vector2 rhoZCovariance(const GeometryContext& gctx, const Surface& surface, 0090 const Vector3& globalPos, 0091 const SquareMatrix2& localCov) const; 0092 0093 /// @brief Calculate the rho and z covariance from the front and back SourceLink in the strip SP formation 0094 /// @param gctx The current geometry context object, e.g. alignment 0095 /// @param slinkFront The SourceLink on the front layer 0096 /// @param slinkBack The SourceLink on the back layer 0097 /// @param paramCovAccessor function to extract local position and covariance from SourceLink 0098 /// @param surfaceAccessor function to extract surface from SourceLink 0099 /// @param globalPos global position 0100 /// @param theta The angle between the two strips 0101 /// @return (rho, z) components of the global covariance 0102 Vector2 calcRhoZVars(const GeometryContext& gctx, 0103 const SourceLink& slinkFront, 0104 const SourceLink& slinkBack, 0105 const SourceLinkSurfaceAccessor& surfaceAccessor, 0106 const ParamCovAccessor& paramCovAccessor, 0107 const Vector3& globalPos, const double theta) const; 0108 0109 /// @brief This function performs a straight forward calculation of a space 0110 /// point and returns whether it was successful or not. 0111 /// 0112 /// @param [in] stripEnds1 Top and bottom end of the first strip 0113 /// @param [in] stripEnds2 Top and bottom end of the second strip 0114 /// @param [in] posVertex Position of the vertex 0115 /// @param [in, out] spParams Data container of the calculations 0116 /// @param [in] stripLengthTolerance Tolerance scaling factor on the strip 0117 /// detector element length 0118 /// 0119 /// @return Result whether the space point calculation was successful 0120 Result<void> calculateStripSPPosition( 0121 const std::pair<Vector3, Vector3>& stripEnds1, 0122 const std::pair<Vector3, Vector3>& stripEnds2, const Vector3& posVertex, 0123 SpacePointParameters& spParams, const double stripLengthTolerance) const; 0124 0125 /// @brief This function tests if a space point can be estimated by a more 0126 /// tolerant treatment of construction. In fact, this function indirectly 0127 /// allows shifts of the vertex. 0128 /// 0129 /// @param [in] spParams container that stores geometric parameters and rules of 0130 /// the space point formation 0131 /// @param [in] stripLengthGapTolerance Tolerance scaling factor of the gap 0132 /// between strip detector elements 0133 /// 0134 /// @return indicator if the test was successful 0135 Result<void> recoverSpacePoint(SpacePointParameters& spParams, 0136 double stripLengthGapTolerance) const; 0137 0138 /// @brief Calculates (Delta theta)^2 + (Delta phi)^2 between two SourceLinks 0139 /// 0140 /// @param [in] pos1 position of the first SourceLink 0141 /// @param [in] pos2 position the second SourceLink 0142 /// @param [in] posVertex Position of the vertex 0143 /// @param [in] maxDistance Maximum distance between two SourceLinks 0144 /// @param [in] maxAngleTheta2 Maximum squared theta angle between two 0145 /// SourceLinks 0146 /// @param [in] maxAnglePhi2 Maximum squared phi angle between two SourceLinks 0147 /// 0148 /// @return Result with the squared sum within configuration parameters. 0149 Result<double> differenceOfMeasurementsChecked( 0150 const Vector3& pos1, const Vector3& pos2, const Vector3& posVertex, 0151 const double maxDistance, const double maxAngleTheta2, 0152 const double maxAnglePhi2) const; 0153 0154 /// @brief Calculates a space point without using the vertex 0155 /// @note This is mostly to resolve space points from cosmic data 0156 /// @param stripEnds1 The ends of one strip 0157 /// @param stripEnds2 The ends of another strip 0158 /// @param spParams SpacePointParamaters for the SP 0159 /// @return parameter that indicates the location of the space point; returns 0160 /// 1. if it failed 0161 /// @note The meaning of the parameter is explained in more detail in the 0162 /// function body 0163 Result<double> calcPerpendicularProjection( 0164 const std::pair<Vector3, Vector3>& stripEnds1, 0165 const std::pair<Vector3, Vector3>& stripEnds2, 0166 SpacePointParameters& spParams) const; 0167 0168 private: 0169 SpacePointBuilderConfig m_config; 0170 std::error_code m_error; 0171 }; 0172 0173 } // 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 |