14 using namespace hgcal;
39 float energy=0.f, energyHad=0.f;
41 for(
const auto&
hit : hits ) {
42 const auto&
id =
hit.first;
45 switch(
id.subdetId() ) {
58 <<
" Cluster contains hits that are not from HGCal! " << std::endl;
66 <<
" Cluster contains hits that are not from HGCal! " << std::endl;
71 fraction = energyHad/
energy;
82 double totweight = 0.;
83 for(
const auto& ptr : clu.
clusters() ) {
84 const double x = ptr->x();
85 const double y = ptr->y();
86 const float point_r =
std::sqrt(x*x + y*y);
87 const double point_z = ptr->z()-vz;
88 const double weight = ptr->energy() * ptr->size();
89 assert((y != 0. || x != 0.) &&
"Cluster position somehow in beampipe.");
90 assert(point_z != 0. &&
"Layer-cluster position given as reference point.");
91 acc_rho += point_r *
weight;
92 acc_phi += std::atan2(y,x) *
weight;
96 const double invweight = 1.0/totweight;
103 for(
const auto& ptr : clu.
clusters() ) {
104 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
Tan< T >::type tan(const T &t)
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