14 #include "vdt/vdtMath.h" 16 using namespace hgcal;
41 float energy=0.f, energyHad=0.f;
44 const auto&
id =
hit.first;
47 switch(
id.subdetId() ) {
60 <<
" Cluster contains hits that are not from HGCal! " << std::endl;
68 <<
" Cluster contains hits that are not from HGCal! " << std::endl;
73 fraction = energyHad/energy;
84 double totweight = 0.;
85 for(
const auto& ptr : clu.
clusters() ) {
86 const double x = ptr->x();
87 const double y = ptr->y();
88 const double point_r2 = (x*x + y*y);
89 const double point_z = ptr->z()-vz;
90 const double point_h =
std::sqrt(point_r2 + point_z*point_z);
91 const double weight = ptr->energy() * ptr->size();
92 assert((y != 0. || x != 0.) &&
"Cluster position somehow in beampipe.");
93 assert(point_z != 0.
f &&
"Layer-cluster position given as reference point.");
94 const double point_r =
std::sqrt(point_r2);
95 acc_rho += point_r *
weight;
96 acc_phi += vdt::fast_atan2(y,x) *
weight;
97 acc_eta += -1. * vdt::fast_log(point_r/(point_z + point_h)) *
weight;
100 const double invweight = 1.0/totweight;
107 for(
const auto& ptr : clu.
clusters() ) {
108 acc += ptr->energy();
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
T x() const
Cartesian x coordinate.
const edm::PtrVector< reco::BasicCluster > & clusters() const
T const * product() const
XYZPointD XYZPoint
point in space with cartesian internal representation
iterator find(key_type k)
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint