10#include <analysis/ContinuumSuppression/SphericityEigenvalues.h>
11#include <framework/logging/Logger.h>
13#include <Eigen/Eigenvalues>
21 Eigen::Matrix3f sphericityTensor;
32 double elements[9] = {0.};
39 B2WARNING(
"The particle list has less than 2 elements. The sphericity matrix will not be calculated");
44 elements[0] += p.X() * p.X();
45 elements[1] += p.X() * p.Y();
46 elements[2] += p.X() * p.Z();
48 elements[3] += p.Y() * p.X();
49 elements[4] += p.Y() * p.Y();
50 elements[5] += p.Y() * p.Z();
52 elements[6] += p.Z() * p.X();
53 elements[7] += p.Z() * p.Y();
54 elements[8] += p.Z() * p.Z();
58 for (
short i = 0; i < 3; i++) {
59 for (
short j = 0; j < 3; j++) {
60 sphericityTensor(i, j) = elements[i * 3 + j] / norm;
64 auto eigenVals = sphericityTensor.eigenvalues();
65 Eigen::ComplexEigenSolver<Eigen::MatrixXcf> ces(sphericityTensor);
71 short order[3] = {0, 1, 2};
73 std::vector<float> tmpLambda;
74 for (
short i = 0; i < 3; i++) {
75 tmpLambda.push_back(eigenVals[i].real());
79 order[0] = std::distance(tmpLambda.begin(), std::max_element(tmpLambda.begin(), tmpLambda.end()));
81 order[2] = std::distance(tmpLambda.begin(), std::min_element(tmpLambda.begin(), tmpLambda.end()));
83 order[1] = (short)(3.1 - (order[0] + order[2]));
85 for (
short i = 0; i < 3; i++) {
88 auto eigenVector = ces.eigenvectors().col(n);
std::vector< ROOT::Math::XYZVector > m_momenta
The particles' momenta.
void calculateEigenvalues()
Calculates eigenvalues and eigenvectors.
ROOT::Math::XYZVector m_eVector[3]
The eigenvectors.
double m_lambda[3]
The eigenvalues.
Abstract base class for different kinds of events.