130 bool isPixel = !
m_s2->spacepoint->clusterList().second;
132 auto extractCoordinates =
135 std::array<float, 4> coordinates {
sp.x(),
sp.y(),
sp.z(),
sp.radius()};
139 auto extractQuantities =
140 [] (
const std::array<float, 4>&
sp,
141 const std::array<float, 4>& spM,
142 bool isBottom) -> std::array<float, 5>
144 const auto& [xM, yM, zM, rM] = spM;
145 const auto& [xO, yO, zO, rO] =
sp;
147 float cosPhiM = xM / rM;
148 float sinPhiM = yM / rM;
149 float deltaX = xO - xM;
150 float deltaY = yO - yM;
151 float deltaZ = zO - zM;
152 float x = deltaX * cosPhiM + deltaY * sinPhiM;
153 float y = deltaY * cosPhiM - deltaX * sinPhiM;
154 float iDeltaR2 = 1. / (deltaX * deltaX + deltaY * deltaY);
155 float iDeltaR = std::sqrt(iDeltaR2);
157 float cot_theta = deltaZ * iDeltaR * bottomFactor;
160 std::array<float, 5> params =
172 auto coo_b = extractCoordinates(bottom);
173 auto coo_m = extractCoordinates(medium);
174 auto coo_t = extractCoordinates(
top);
177 auto [cotThetaB, Zob, iDeltaRB, Ub, Vb] = extractQuantities(coo_b, coo_m,
true);
178 auto [cotThetaT, Zot, iDeltaRT, Ut, Vt] = extractQuantities(coo_t, coo_m,
false);
180 float squarediDeltaR2B = iDeltaRB*iDeltaRB;
181 float squarediDeltaR2T = iDeltaRB*iDeltaRT;
182 float squarediDeltaR = std::min(squarediDeltaR2B, squarediDeltaR2T);
184 auto& [xB, yB, zB, rB] = coo_b;
185 auto& [xM, yM, zM, rM] = coo_m;
186 auto& [xT, yT, zT, rT] = coo_t;
194 float xb = dxb * ax + dyb *ay;
195 float yb = dyb * ax - dxb * ay;
196 float dxyb = xb * xb + yb * yb;
197 float drb = std::sqrt( xb*xb + yb*yb + dzb*dzb );
202 float xt = dxt * ax + dyt *ay;
203 float yt = dyt * ax - dxt * ay;
205 float drt = std::sqrt(
xt*
xt +
yt*
yt + dzt*dzt );
207 float tzb = dzb * std::sqrt( 1.f/dxyb );
208 float tzt = dzt * std::sqrt( 1.f/dxyt );
210 float sTzb2 = std::sqrt(1.f + tzb*tzb);
217 float A = (Vt - Vb) / dU;
218 float S2 = 1.f +
A *
A;
219 float B = Vb -
A * Ub;
225 float dzdr_b = (zM - zB) / (rM - rB);
226 float dzdr_t = (zT - zM) / (rT - rM);
229 float meanOneOverTanThetaSquare = isPixel ? (cotThetaB * cotThetaT) :
230 std::pow((cotThetaB + cotThetaT) / 2.f,2);
231 if (meanOneOverTanThetaSquare <= 0) {
234 float theta = std::atan(1.f / std::sqrt(meanOneOverTanThetaSquare));
237 float eta = -std::log(std::tan(0.5f *
theta));
240 float pt = pTPerHelixRadius*std::sqrt(
S2 / B2);
243 float d0 = std::abs((
A - B * rM) * rM);
248 top.setScorePenalty( std::abs((tzb - tzt) / (squarediDeltaR * sTzb2)) );