7 #include <unordered_map>
9 #include "vdt/vdtMath.h"
18 #include "TPrincipal.h"
25 pca_(new TPrincipal(3,
"D")) {}
34 std::unique_ptr<TPrincipal>
pca_;
44 pca_ = std::make_unique<TPrincipal>(3,
"D");
50 pca_ = std::make_unique<TPrincipal>(3,
"D");
56 if (!cluster.
seed()) {
57 throw cms::Exception(
"ClusterWithNoSeed") <<
" Found a cluster with no seed: " << cluster;
61 double avg_time = 0.0;
62 double time_norm = 0.0;
69 double rh_energy = refhit->energy();
70 double rh_time = refhit->time();
71 cl_energy += rh_energy * rhf.fraction();
76 avg_time += (rh_time - 1.0);
79 if (rh_energy > max_e) {
81 max_e_layer = rhf.recHitRef()->layer();
83 if (refhit->detId() == cluster.
seed())
85 const double rh_fraction = rhf.fraction();
86 rh_energy = refhit->energy() * rh_fraction;
90 edm::LogWarning(
"PFClusterAlgo") <<
"rechit " << refhit->detId() <<
" has a NaN energy... "
91 <<
"The input of the particle flow clustering seems to be corrupted.";
94 pcavars[0] = refhit->position().x();
95 pcavars[1] = refhit->position().y();
96 pcavars[2] = refhit->position().z();
97 int nhit =
int(rh_energy * 100);
99 for (
int i = 0;
i < nhit; ++
i) {
100 pca_->AddRow(pcavars);
107 pca_->MakePrincipals();
108 const TVectorD& means = *(
pca_->GetMeanValues());
109 const TMatrixD& eigens = *(
pca_->GetEigenVectors());
114 if (time_norm > 0.0) {
115 avg_time = avg_time / time_norm;
120 if (axis.z() * barycenter.z() < 0.0) {