7 #include <unordered_map>
9 #include "vdt/vdtMath.h"
17 #include "TPrincipal.h"
24 pca_(new TPrincipal(3,
"D")) {}
33 std::unique_ptr<TPrincipal>
pca_;
43 pca_ = std::make_unique<TPrincipal>(3,
"D");
49 pca_ = std::make_unique<TPrincipal>(3,
"D");
55 if (!cluster.
seed()) {
56 throw cms::Exception(
"ClusterWithNoSeed") <<
" Found a cluster with no seed: " << cluster;
60 double avg_time = 0.0;
61 double time_norm = 0.0;
68 double rh_energy = refhit->energy();
69 double rh_time = refhit->time();
70 cl_energy += rh_energy * rhf.fraction();
75 avg_time += (rh_time - 1.0);
78 if (rh_energy > max_e) {
80 max_e_layer = rhf.recHitRef()->layer();
82 if (refhit->detId() == cluster.
seed())
84 const double rh_fraction = rhf.fraction();
85 rh_energy = refhit->energy() * rh_fraction;
89 edm::LogWarning(
"PFClusterAlgo") <<
"rechit " << refhit->detId() <<
" has a NaN energy... "
90 <<
"The input of the particle flow clustering seems to be corrupted.";
93 pcavars[0] = refhit->position().x();
94 pcavars[1] = refhit->position().y();
95 pcavars[2] = refhit->position().z();
96 int nhit =
int(rh_energy * 100);
98 for (
int i = 0;
i < nhit; ++
i) {
99 pca_->AddRow(pcavars);
106 pca_->MakePrincipals();
107 const TVectorD& means = *(
pca_->GetMeanValues());
108 const TMatrixD& eigens = *(
pca_->GetEigenVectors());
113 if (time_norm > 0.0) {
114 avg_time = avg_time / time_norm;
119 if (axis.z() * barycenter.z() < 0.0) {