10 #include <Math/Vector2D.h> 11 #include <Math/Vector3D.h> 12 #include <Math/Rotation3D.h> 13 #include <Math/VectorUtil.h> 39 template <
class Vector1,
class Vector2>
42 float v1_r2 = v1.X() * v1.X() + v1.Y() * v1.Y();
43 float v2_r2 = v2.X() * v2.X() + v2.Y() * v2.Y();
44 float ptot2 = v1_r2 * v2_r2;
48 float pdot = v1.X() * v2.X() + v1.Y() * v2.Y();
58 template <
class Vector1,
class Vector2>
59 inline float Angle2D(
const Vector1& v1,
const Vector2& v2) {
60 return static_cast<float>(std::acos(
CosTheta2D(v1, v2)));
64 using ROOT::Math::XYVectorF;
66 using ROOT::Math::VectorUtil::Angle;
70 ROOT::Math::Rotation3D
rot(xs, xs.Cross(pca_seed_cmsFrame).Unit(), pca_seed_cmsFrame);
74 float explVar_denominator = std::accumulate(
76 float explVarRatio = 0.;
77 if (explVar_denominator != 0.) {
78 explVarRatio = ts_toCluster.
eigenvalues()[0] / explVar_denominator;
81 <<
"Sum of eigenvalues was zero for trackster. Could not compute explained variance ratio.";
94 static_cast<float>(Angle(pca_cand_cmsFrame, pca_seed_cmsFrame)),
95 Angle2D(XYVectorF(pca_cand_seedFrame.x(), pca_cand_seedFrame.z()), XYVectorF(0, 1)),
96 Angle2D(XYVectorF(pca_cand_seedFrame.y(), pca_cand_seedFrame.z()), XYVectorF(0, 1)),
97 Angle2D(XYVectorF(pca_cand_cmsFrame.x(), pca_cand_cmsFrame.y()),
98 XYVectorF(pca_seed_cmsFrame.x(), pca_seed_cmsFrame.y())),
99 Angle2D(XYVectorF(pca_cand_cmsFrame.y(), pca_cand_cmsFrame.z()),
100 XYVectorF(pca_seed_cmsFrame.y(), pca_seed_cmsFrame.z())),
101 Angle2D(XYVectorF(pca_cand_cmsFrame.x(), pca_cand_cmsFrame.z()),
102 XYVectorF(pca_seed_cmsFrame.x(), pca_seed_cmsFrame.z())),
109 if (dnnInputVersion ==
"v1")
110 return std::make_unique<SuperclusteringDNNInputV1>();
111 else if (dnnInputVersion ==
"v2")
112 return std::make_unique<SuperclusteringDNNInputV2>();
Sin< T >::type sin(const T &t)
const Vector & barycenter() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
const std::array< Vector, 3 > & eigenvectors() const
const float raw_energy() const
Abs< T >::type abs(const T &t)
std::unique_ptr< AbstractSuperclusteringDNNInput > makeSuperclusteringDNNInputFromString(std::string dnnVersion)
Log< level::Warning, false > LogWarning
float CosTheta2D(const Vector1 &v1, const Vector2 &v2)
const std::array< float, 3 > & eigenvalues() const
float Angle2D(const Vector1 &v1, const Vector2 &v2)