7 #include <unordered_map>
13 #include "vdt/vdtMath.h"
23 caloGeom.
get(geohandle);
52 constexpr double preshowerStartEta = 1.653;
54 if( !cluster.
seed() ) {
56 <<
" Found a cluster with no seed: " << cluster;
59 double cl_energy_float = 0;
61 double cl_timeweight=0.0;
63 double clusterT0 = 0.0;
69 const double rh_fraction = rhf.fraction();
70 const double rh_rawenergy = refhit->energy();
71 const double rh_energy = rh_rawenergy * rh_fraction;
72 const double rh_energyf = ((float)rh_rawenergy) * ((float) rh_fraction);
75 <<
"rechit " << refhit->detId() <<
" has non-finite energy... "
76 <<
"The input of the particle flow clustering seems to be corrupted.";
78 cl_energy += rh_energy;
79 cl_energy_float += rh_energyf;
83 cl_time += rh_fraction*refhit->time()/res2;
84 cl_timeweight += rh_fraction/res2;
87 const double rh_rawenergy2 = rh_rawenergy*rh_rawenergy;
88 cl_timeweight+=rh_rawenergy2*rh_fraction;
89 cl_time += rh_rawenergy2*rh_fraction*refhit->time();
91 if( rh_energy > max_e ) {
93 max_e_layer = rhf.recHitRef()->layer();
98 cluster.
setTime(cl_time/cl_timeweight);
113 <<
"ECAL Position Calc only accepts ECAL_BARREL or ECAL_ENDCAP";
119 const double actreta =
std::abs(ctreta);
121 if( actreta > preshowerStartEta && actreta < preshowerEndEta ) {
129 const double logETot_inv = -vdt::fast_log(cl_energy_float);
130 double position_norm = 0.0;
131 double x(0.0),
y(0.0),
z(0.0);
135 const double rh_energy = ((float)refhit->energy()) * ((
float)rhf.fraction());
137 vdt::fast_log(rh_energy) +
144 x += weight*pos.
x() ;
145 y += weight*pos.
y() ;
146 z += weight*pos.
z() ;
152 if (position_norm == 0.) {
156 const double rh_energy = ((float)refhit->energy()) * ((
float)rhf.fraction());
157 if( rh_energy > 0.0 )
158 weight = rh_energy/cluster.
energy();
164 x += weight*pos.
x() ;
165 y += weight*pos.
y() ;
166 z += weight*pos.
z() ;
174 <<
"PFCluster too far from seeding cell: set position to (0,0,0).";
177 const double norm_inverse = 1.0/position_norm;
void setLayer(PFLayer::Layer layer)
set layer
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
void setPosition(const math::XYZPoint &p)
const double _param_T0_EB
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalc
void setEnergy(double energy)
void calculateAndSetPositionActual(reco::PFCluster &) const
const double _param_T0_ES
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const double _param_T0_EE
void calculateAndSetPositions(reco::PFClusterCollection &)
void setTime(double time)
void calculatePositionREP()
computes posrep_ once and for all
void get(HolderT &iHolder) const
const double _minAllowedNorm
Abs< T >::type abs(const T &t)
double energy() const
cluster energy
DetId seed() const
return DetId of seed
XYZPointD XYZPoint
point in space with cartesian internal representation
const CaloSubdetectorGeometry * _ebGeom
const CaloSubdetectorGeometry * _esGeom
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
const CaloSubdetectorGeometry * _eeGeom
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void update(const edm::EventSetup &es)
void calculateAndSetPosition(reco::PFCluster &)