Warning, file /include/Acts/Seeding/SeedFinderUtils.ipp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009 namespace Acts {
0010 template <typename external_spacepoint_t>
0011 inline LinCircle transformCoordinates(
0012 const InternalSpacePoint<external_spacepoint_t>& sp,
0013 const InternalSpacePoint<external_spacepoint_t>& spM, bool bottom) {
0014 auto extractFunction =
0015 [](const InternalSpacePoint<external_spacepoint_t>& obj)
0016 -> std::array<float, 6> {
0017 std::array<float, 6> output{obj.x(), obj.y(), obj.z(),
0018 obj.radius(), obj.varianceR(), obj.varianceZ()};
0019 return output;
0020 };
0021
0022 return transformCoordinates<InternalSpacePoint<external_spacepoint_t>>(
0023 sp, spM, bottom, std::move(extractFunction));
0024 }
0025
0026 template <typename external_spacepoint_t, typename callable_t>
0027 inline LinCircle transformCoordinates(const external_spacepoint_t& sp,
0028 const external_spacepoint_t& spM,
0029 bool bottom,
0030 callable_t&& extractFunction) {
0031
0032
0033
0034
0035
0036 auto [xM, yM, zM, rM, varianceRM, varianceZM] = extractFunction(spM);
0037 auto [xSP, ySP, zSP, rSP, varianceRSP, varianceZSP] = extractFunction(sp);
0038
0039 float cosPhiM = xM / rM;
0040 float sinPhiM = yM / rM;
0041 float deltaX = xSP - xM;
0042 float deltaY = ySP - yM;
0043 float deltaZ = zSP - zM;
0044 float xNewFrame = deltaX * cosPhiM + deltaY * sinPhiM;
0045 float yNewFrame = deltaY * cosPhiM - deltaX * sinPhiM;
0046 float deltaR2 = (xNewFrame * xNewFrame + yNewFrame * yNewFrame);
0047 float iDeltaR2 = 1. / (deltaX * deltaX + deltaY * deltaY);
0048 float iDeltaR = std::sqrt(iDeltaR2);
0049 int bottomFactor = bottom ? -1 : 1;
0050 float cotTheta = deltaZ * iDeltaR * bottomFactor;
0051
0052
0053
0054
0055
0056 const float U = xNewFrame * iDeltaR2;
0057 const float V = yNewFrame * iDeltaR2;
0058
0059
0060 const float Er = ((varianceZM + varianceZSP) +
0061 (cotTheta * cotTheta) * (varianceRM + varianceRSP)) *
0062 iDeltaR2;
0063
0064 sp.setDeltaR(std::sqrt(deltaR2 + (deltaZ * deltaZ)));
0065 return LinCircle(cotTheta, iDeltaR, Er, U, V, xNewFrame, yNewFrame);
0066 }
0067
0068 template <typename external_spacepoint_t>
0069 inline void transformCoordinates(
0070 Acts::SpacePointData& spacePointData,
0071 const std::vector<InternalSpacePoint<external_spacepoint_t>*>& vec,
0072 const InternalSpacePoint<external_spacepoint_t>& spM, bool bottom,
0073 std::vector<LinCircle>& linCircleVec) {
0074 auto extractFunction =
0075 [](const InternalSpacePoint<external_spacepoint_t>& obj)
0076 -> std::array<float, 6> {
0077 std::array<float, 6> output{obj.x(), obj.y(), obj.z(),
0078 obj.radius(), obj.varianceR(), obj.varianceZ()};
0079 return output;
0080 };
0081
0082 transformCoordinates<InternalSpacePoint<external_spacepoint_t>>(
0083 spacePointData, vec, spM, bottom, linCircleVec,
0084 std::move(extractFunction));
0085 }
0086
0087 template <typename external_spacepoint_t, typename callable_t>
0088 inline void transformCoordinates(Acts::SpacePointData& spacePointData,
0089 const std::vector<external_spacepoint_t*>& vec,
0090 const external_spacepoint_t& spM, bool bottom,
0091 std::vector<LinCircle>& linCircleVec,
0092 callable_t&& extractFunction) {
0093 auto [xM, yM, zM, rM, varianceRM, varianceZM] = extractFunction(spM);
0094
0095
0096 linCircleVec.resize(vec.size());
0097
0098 float cosPhiM = xM / rM;
0099 float sinPhiM = yM / rM;
0100
0101 int bottomFactor = bottom ? -1 : 1;
0102
0103 for (std::size_t idx(0); idx < vec.size(); ++idx) {
0104 auto& sp = vec[idx];
0105 auto [xSP, ySP, zSP, rSP, varianceRSP, varianceZSP] = extractFunction(*sp);
0106
0107 float deltaX = xSP - xM;
0108 float deltaY = ySP - yM;
0109 float deltaZ = zSP - zM;
0110
0111
0112
0113
0114 float xNewFrame = deltaX * cosPhiM + deltaY * sinPhiM;
0115 float yNewFrame = deltaY * cosPhiM - deltaX * sinPhiM;
0116
0117 float deltaR2 = (xNewFrame * xNewFrame + yNewFrame * yNewFrame);
0118 float iDeltaR2 = 1. / deltaR2;
0119 float iDeltaR = std::sqrt(iDeltaR2);
0120
0121
0122 float cotTheta = deltaZ * iDeltaR * bottomFactor;
0123
0124
0125
0126
0127
0128
0129 float U = xNewFrame * iDeltaR2;
0130 float V = yNewFrame * iDeltaR2;
0131
0132 float Er = ((varianceZM + varianceZSP) +
0133 (cotTheta * cotTheta) * (varianceRM + varianceRSP)) *
0134 iDeltaR2;
0135
0136
0137 linCircleVec[idx].cotTheta = cotTheta;
0138 linCircleVec[idx].iDeltaR = iDeltaR;
0139 linCircleVec[idx].Er = Er;
0140 linCircleVec[idx].U = U;
0141 linCircleVec[idx].V = V;
0142 linCircleVec[idx].x = xNewFrame;
0143 linCircleVec[idx].y = yNewFrame;
0144
0145 spacePointData.setDeltaR(sp->index(),
0146 std::sqrt(deltaR2 + (deltaZ * deltaZ)));
0147 }
0148 }
0149
0150 template <typename external_spacepoint_t>
0151 inline bool xyzCoordinateCheck(
0152 Acts::SpacePointData& spacePointData,
0153 const Acts::SeedFinderConfig<external_spacepoint_t>& m_config,
0154 const Acts::InternalSpacePoint<external_spacepoint_t>& sp,
0155 const double* spacepointPosition, double* outputCoordinates) {
0156
0157
0158 bool hasValueStored = spacePointData.hasDynamicVariable();
0159 if (!hasValueStored) {
0160 return false;
0161 }
0162
0163 std::size_t index = sp.index();
0164
0165
0166 const Acts::Vector3& topStripVector = spacePointData.getTopStripVector(index);
0167 const Acts::Vector3& bottomStripVector =
0168 spacePointData.getBottomStripVector(index);
0169 const Acts::Vector3& stripCenterDistance =
0170 spacePointData.getStripCenterDistance(index);
0171
0172 const double xTopStripVector = topStripVector[0];
0173 const double yTopStripVector = topStripVector[1];
0174 const double zTopStripVector = topStripVector[2];
0175 const double xBottomStripVector = bottomStripVector[0];
0176 const double yBottomStripVector = bottomStripVector[1];
0177 const double zBottomStripVector = bottomStripVector[2];
0178
0179
0180 double d1[3] = {yTopStripVector * spacepointPosition[2] -
0181 zTopStripVector * spacepointPosition[1],
0182 zTopStripVector * spacepointPosition[0] -
0183 xTopStripVector * spacepointPosition[2],
0184 xTopStripVector * spacepointPosition[1] -
0185 yTopStripVector * spacepointPosition[0]};
0186
0187
0188 double bd1 = xBottomStripVector * d1[0] + yBottomStripVector * d1[1] +
0189 zBottomStripVector * d1[2];
0190
0191
0192
0193 double s1 = (stripCenterDistance[0] * d1[0] + stripCenterDistance[1] * d1[1] +
0194 stripCenterDistance[2] * d1[2]);
0195 if (std::abs(s1) > std::abs(bd1) * m_config.toleranceParam) {
0196 return false;
0197 }
0198
0199
0200 double d0[3] = {yBottomStripVector * spacepointPosition[2] -
0201 zBottomStripVector * spacepointPosition[1],
0202 zBottomStripVector * spacepointPosition[0] -
0203 xBottomStripVector * spacepointPosition[2],
0204 xBottomStripVector * spacepointPosition[1] -
0205 yBottomStripVector * spacepointPosition[0]};
0206
0207
0208
0209 double s0 = (stripCenterDistance[0] * d0[0] + stripCenterDistance[1] * d0[1] +
0210 stripCenterDistance[2] * d0[2]);
0211 if (std::abs(s0) > std::abs(bd1) * m_config.toleranceParam) {
0212 return false;
0213 }
0214
0215
0216
0217
0218 const Acts::Vector3& topStripCenterPosition =
0219 spacePointData.getTopStripCenterPosition(index);
0220
0221
0222
0223 s0 = s0 / bd1;
0224 outputCoordinates[0] = topStripCenterPosition[0] + xTopStripVector * s0;
0225 outputCoordinates[1] = topStripCenterPosition[1] + yTopStripVector * s0;
0226 outputCoordinates[2] = topStripCenterPosition[2] + zTopStripVector * s0;
0227 return true;
0228 }
0229 }