60 if( !cluster.
seed() ) {
62 <<
" Found a cluster with no seed: " << cluster;
66 double avg_time = 0.0;
67 double time_norm = 0.0;
74 double rh_energy = refhit->energy();
75 double rh_time = refhit->time();
76 cl_energy += rh_energy * rhf.fraction();
81 avg_time += (rh_time - 1.0);
84 if( rh_energy > max_e ) {
86 max_e_layer = rhf.recHitRef()->layer();
88 if( refhit->detId() == cluster.
seed() ) refseed = refhit;
89 const double rh_fraction = rhf.fraction();
90 rh_energy = refhit->energy()*rh_fraction;
95 <<
"rechit " << refhit->detId() <<
" has a NaN energy... " 96 <<
"The input of the particle flow clustering seems to be corrupted.";
99 pcavars[0] = refhit->position().x();
100 pcavars[1] = refhit->position().y();
101 pcavars[2] = refhit->position().z();
102 int nhit =
int( rh_energy*100 );
104 for(
int i = 0;
i < nhit; ++
i ) {
105 pca_->AddRow(pcavars);
113 pca_->MakePrincipals();
114 const TVectorD& means = *(
pca_->GetMeanValues());
115 const TMatrixD& eigens = *(
pca_->GetEigenVectors());
120 if( time_norm > 0.0 ) {
121 avg_time = avg_time/time_norm;
126 if( axis.z()*barycenter.z() < 0.0 ) {
void setLayer(PFLayer::Layer layer)
set layer
constexpr bool isNotFinite(T x)
void setPosition(const math::XYZPoint &p)
void setTime(float time, float timeError=0)
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
void setEnergy(double energy)
void calculatePositionREP()
computes posrep_ once and for all
DetId seed() const
return DetId of seed
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
std::unique_ptr< TPrincipal > pca_
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions