File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -279,6 +279,27 @@ struct RecoDecay {
279279 return cos;
280280 }
281281
282+ // / Calculates cosine of pointing angle in the {r, z} plane.
283+ // / \param posPV {x, y, z} position of the primary vertex
284+ // / \param posSV {x, y, z} position of the secondary vertex
285+ // / \param mom {x, y, z} momentum array
286+ // / \return cosine of pointing angle in {r, z}
287+ template <std::size_t N, typename T, typename U, typename V>
288+ static double cpaRZ (const T& posPV, const U& posSV, const std::array<V, 3 >& mom)
289+ {
290+ // CPARZ = (r . pz)/(|r| |pz|)
291+ auto lineDecay = std::array{sqrtSumOfSquares (posSV[0 ] - posPV[0 ], posSV[1 ] - posPV[1 ]), posSV[2 ] - posPV[2 ]};
292+ auto momRZ = std::array{sqrtSumOfSquares (mom[0 ], mom[1 ]), mom[2 ]};
293+ auto cos = dotProd (lineDecay, momRZ) / std::sqrt (mag2 (lineDecay) * mag2 (momRZ));
294+ if (cos < -1 .) {
295+ return -1 .;
296+ }
297+ if (cos > 1 .) {
298+ return 1 .;
299+ }
300+ return cos;
301+ }
302+
282303 // / Calculates proper lifetime times c.
283304 // / \note Promotes numbers to double before squaring to avoid precision loss in float multiplication.
284305 // / \param mom 3-momentum array
You can’t perform that action at this time.
0 commit comments