File indexing completed on 2025-01-18 09:11:02
0001
0002
0003
0004
0005
0006
0007
0008
0009 namespace Acts {
0010 template <typename external_spacepoint_t, typename callable_t>
0011 inline LinCircle transformCoordinates(Acts::SpacePointMutableData& mutableData,
0012 const external_spacepoint_t& sp,
0013 const external_spacepoint_t& spM,
0014 bool bottom,
0015 callable_t&& extractFunction) {
0016
0017
0018
0019
0020
0021 auto [xM, yM, zM, rM, varianceRM, varianceZM] = extractFunction(spM);
0022 auto [xSP, ySP, zSP, rSP, varianceRSP, varianceZSP] = extractFunction(sp);
0023
0024 float cosPhiM = xM / rM;
0025 float sinPhiM = yM / rM;
0026 float deltaX = xSP - xM;
0027 float deltaY = ySP - yM;
0028 float deltaZ = zSP - zM;
0029 float xNewFrame = deltaX * cosPhiM + deltaY * sinPhiM;
0030 float yNewFrame = deltaY * cosPhiM - deltaX * sinPhiM;
0031 float deltaR2 = (xNewFrame * xNewFrame + yNewFrame * yNewFrame);
0032 float iDeltaR2 = 1. / (deltaX * deltaX + deltaY * deltaY);
0033 float iDeltaR = std::sqrt(iDeltaR2);
0034 int bottomFactor = bottom ? -1 : 1;
0035 float cotTheta = deltaZ * iDeltaR * bottomFactor;
0036
0037
0038
0039
0040
0041 const float U = xNewFrame * iDeltaR2;
0042 const float V = yNewFrame * iDeltaR2;
0043
0044
0045 const float Er = ((varianceZM + varianceZSP) +
0046 (cotTheta * cotTheta) * (varianceRM + varianceRSP)) *
0047 iDeltaR2;
0048
0049 mutableData.setDeltaR(sp.index(), std::sqrt(deltaR2 + (deltaZ * deltaZ)));
0050 return LinCircle(cotTheta, iDeltaR, Er, U, V, xNewFrame, yNewFrame);
0051 }
0052
0053 template <typename external_spacepoint_t>
0054 inline void transformCoordinates(
0055 Acts::SpacePointMutableData& mutableData,
0056 const std::vector<const external_spacepoint_t*>& vec,
0057 const external_spacepoint_t& spM, bool bottom,
0058 std::vector<LinCircle>& linCircleVec) {
0059 const float xM = spM.x();
0060 const float yM = spM.y();
0061 const float zM = spM.z();
0062 const float rM = spM.radius();
0063 const float varianceRM = spM.varianceR();
0064 const float varianceZM = spM.varianceZ();
0065
0066
0067 linCircleVec.resize(vec.size());
0068
0069 float cosPhiM = xM / rM;
0070 float sinPhiM = yM / rM;
0071
0072 int bottomFactor = bottom ? -1 : 1;
0073
0074 for (std::size_t idx(0); idx < vec.size(); ++idx) {
0075 const external_spacepoint_t* sp = vec[idx];
0076
0077 const float xSP = sp->x();
0078 const float ySP = sp->y();
0079 const float zSP = sp->z();
0080 const float varianceRSP = sp->varianceR();
0081 const float varianceZSP = sp->varianceZ();
0082
0083 const float deltaX = xSP - xM;
0084 const float deltaY = ySP - yM;
0085 const float deltaZ = zSP - zM;
0086
0087
0088
0089
0090 const float xNewFrame = deltaX * cosPhiM + deltaY * sinPhiM;
0091 const float yNewFrame = deltaY * cosPhiM - deltaX * sinPhiM;
0092
0093 const float deltaR2 = (xNewFrame * xNewFrame + yNewFrame * yNewFrame);
0094 const float iDeltaR2 = 1. / deltaR2;
0095 const float iDeltaR = std::sqrt(iDeltaR2);
0096
0097
0098 const float cotTheta = deltaZ * iDeltaR * bottomFactor;
0099
0100
0101
0102
0103
0104
0105 const float U = xNewFrame * iDeltaR2;
0106 const float V = yNewFrame * iDeltaR2;
0107
0108 const float Er = ((varianceZM + varianceZSP) +
0109 (cotTheta * cotTheta) * (varianceRM + varianceRSP)) *
0110 iDeltaR2;
0111
0112
0113 linCircleVec[idx].cotTheta = cotTheta;
0114 linCircleVec[idx].iDeltaR = iDeltaR;
0115 linCircleVec[idx].Er = Er;
0116 linCircleVec[idx].U = U;
0117 linCircleVec[idx].V = V;
0118 linCircleVec[idx].x = xNewFrame;
0119 linCircleVec[idx].y = yNewFrame;
0120 mutableData.setDeltaR(sp->index(), std::sqrt(deltaR2 + (deltaZ * deltaZ)));
0121 }
0122 }
0123
0124 template <typename external_spacepoint_t>
0125 inline bool xyzCoordinateCheck(
0126 const Acts::SeedFinderConfig<external_spacepoint_t>& m_config,
0127 const external_spacepoint_t& sp, const double* spacepointPosition,
0128 double* outputCoordinates) {
0129
0130
0131
0132 using namespace Acts::HashedStringLiteral;
0133 const Acts::Vector3& topStripVector = sp.topStripVector();
0134 const Acts::Vector3& bottomStripVector = sp.bottomStripVector();
0135 const Acts::Vector3& stripCenterDistance = sp.stripCenterDistance();
0136
0137 const double xTopStripVector = topStripVector[0];
0138 const double yTopStripVector = topStripVector[1];
0139 const double zTopStripVector = topStripVector[2];
0140 const double xBottomStripVector = bottomStripVector[0];
0141 const double yBottomStripVector = bottomStripVector[1];
0142 const double zBottomStripVector = bottomStripVector[2];
0143
0144
0145 double d1[3] = {yTopStripVector * spacepointPosition[2] -
0146 zTopStripVector * spacepointPosition[1],
0147 zTopStripVector * spacepointPosition[0] -
0148 xTopStripVector * spacepointPosition[2],
0149 xTopStripVector * spacepointPosition[1] -
0150 yTopStripVector * spacepointPosition[0]};
0151
0152
0153 double bd1 = xBottomStripVector * d1[0] + yBottomStripVector * d1[1] +
0154 zBottomStripVector * d1[2];
0155
0156
0157
0158 double s1 = (stripCenterDistance[0] * d1[0] + stripCenterDistance[1] * d1[1] +
0159 stripCenterDistance[2] * d1[2]);
0160 if (std::abs(s1) > std::abs(bd1) * m_config.toleranceParam) {
0161 return false;
0162 }
0163
0164
0165 double d0[3] = {yBottomStripVector * spacepointPosition[2] -
0166 zBottomStripVector * spacepointPosition[1],
0167 zBottomStripVector * spacepointPosition[0] -
0168 xBottomStripVector * spacepointPosition[2],
0169 xBottomStripVector * spacepointPosition[1] -
0170 yBottomStripVector * spacepointPosition[0]};
0171
0172
0173
0174 double s0 = (stripCenterDistance[0] * d0[0] + stripCenterDistance[1] * d0[1] +
0175 stripCenterDistance[2] * d0[2]);
0176 if (std::abs(s0) > std::abs(bd1) * m_config.toleranceParam) {
0177 return false;
0178 }
0179
0180
0181
0182
0183 const Acts::Vector3& topStripCenterPosition = sp.topStripCenterPosition();
0184
0185
0186
0187 s0 = s0 / bd1;
0188 outputCoordinates[0] = topStripCenterPosition[0] + xTopStripVector * s0;
0189 outputCoordinates[1] = topStripCenterPosition[1] + yTopStripVector * s0;
0190 outputCoordinates[2] = topStripCenterPosition[2] + zTopStripVector * s0;
0191 return true;
0192 }
0193 }