File indexing completed on 2026-07-26 08:22:01
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010
0011 #include "traccc/definitions/math.hpp"
0012 #include "traccc/edm/spacepoint_collection.hpp"
0013 #include "traccc/seeding/detail/doublet.hpp"
0014 #include "traccc/seeding/detail/lin_circle.hpp"
0015 #include "traccc/seeding/detail/triplet.hpp"
0016
0017 namespace traccc {
0018
0019
0020 struct triplet_finding_helper {
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 template <typename T>
0035 static inline TRACCC_HOST_DEVICE bool isCompatible(
0036 const edm::spacepoint<T>& spM, const lin_circle& lb, const lin_circle& lt,
0037 const seedfinder_config& config, const scalar& iSinTheta2,
0038 const scalar& scatteringInRegion2, scalar& curvature,
0039 scalar& impact_parameter);
0040 };
0041
0042 template <typename T>
0043 bool TRACCC_HOST_DEVICE triplet_finding_helper::isCompatible(
0044 const edm::spacepoint<T>& spM, const lin_circle& lb, const lin_circle& lt,
0045 const seedfinder_config& config, const scalar& iSinTheta2,
0046 const scalar& scatteringInRegion2, scalar& curvature,
0047 scalar& impact_parameter) {
0048
0049
0050 scalar error2 = lt.Er() + lb.Er() +
0051 static_cast<scalar>(2.f) *
0052 (lb.cotTheta() * lt.cotTheta() * spM.radius_variance() +
0053 spM.z_variance()) *
0054 lb.iDeltaR() * lt.iDeltaR();
0055
0056 scalar deltaCotTheta = lb.cotTheta() - lt.cotTheta();
0057 scalar deltaCotTheta2 = deltaCotTheta * deltaCotTheta;
0058 scalar error{0.f};
0059 scalar dCotThetaMinusError2{0.f};
0060
0061
0062
0063 if (deltaCotTheta2 - error2 > 0) {
0064 deltaCotTheta = math::fabs(deltaCotTheta);
0065
0066 error = std::sqrt(error2);
0067 dCotThetaMinusError2 = deltaCotTheta2 + error2 -
0068 static_cast<scalar>(2.) * deltaCotTheta * error;
0069
0070
0071
0072
0073 if (dCotThetaMinusError2 > scatteringInRegion2) {
0074 return false;
0075 }
0076 }
0077
0078
0079 scalar dU = lt.U() - lb.U();
0080 if (dU == static_cast<scalar>(0.)) {
0081 return false;
0082 }
0083
0084
0085
0086 scalar A = (lt.V() - lb.V()) / dU;
0087 scalar S2 = static_cast<scalar>(1.) + A * A;
0088 scalar B = lb.V() - A * lb.U();
0089 scalar B2 = B * B;
0090
0091
0092 if (S2 < B2 * config.minHelixDiameter2) {
0093 return false;
0094 }
0095
0096
0097 scalar iHelixDiameter2 = B2 / S2;
0098
0099 scalar pT2scatter =
0100 static_cast<scalar>(4.) * iHelixDiameter2 * config.pT2perRadius;
0101
0102
0103 scalar pT =
0104 config.pTPerHelixRadius * std::sqrt(S2 / B2) / static_cast<scalar>(2.);
0105 if (pT > config.maxPtScattering) {
0106 scalar pTscatter = config.highland / config.maxPtScattering;
0107 pT2scatter = pTscatter * pTscatter;
0108 }
0109
0110
0111 scalar p2scatter = pT2scatter * iSinTheta2;
0112
0113 if ((deltaCotTheta2 - error2 > static_cast<scalar>(0.)) &&
0114 (dCotThetaMinusError2 >
0115 p2scatter * config.sigmaScattering * config.sigmaScattering)) {
0116 return false;
0117 }
0118
0119
0120 curvature = B / std::sqrt(S2);
0121
0122
0123
0124
0125 impact_parameter = math::fabs((A - B * spM.radius()) * spM.radius());
0126
0127 if (impact_parameter > config.impactMax) {
0128 return false;
0129 }
0130
0131 return true;
0132 }
0133
0134 }