13 std::vector< double> recHitEnergy;
14 std::vector< PFRecHitRef> recHitRef;
15 double superClusterEnergy = 0.0;
17 double maxHitEnergy = 0.0;
20 double maxClusterEnergy = 0.0;
21 int maxClusterColor=2;
23 for (
unsigned short ic=0; ic<clusters.
size();++ic) {
26 const std::vector< reco::PFRecHitFraction >& pfhitsandfracs = clusters[ic]->recHitFractions();
27 double clusterEnergy = clusters[ic]->energy();
28 superClusterEnergy+=clusterEnergy;
29 if (clusterEnergy>=maxClusterEnergy) {
30 maxClusterLayer=clusters[ic]->layer();
31 maxClusterColor=clusters[ic]->color();
32 maxClusterCaloId=clusters[ic]->caloID();
33 maxClusterEnergy=clusterEnergy;
35 for (
unsigned ihandf=0; ihandf<pfhitsandfracs.size(); ihandf++) {
37 double hitEnergy = pfhitsandfracs[ihandf].fraction()*clusterEnergy;
40 recHitRef.push_back(pfhitsandfracs[ihandf].recHitRef());
41 if(hitEnergy>=maxHitEnergy) {
43 maxHitEnergy=hitEnergy;
49 for (
unsigned short ir=0; ir<recHitEnergy.size();++ir) {
51 if( superClusterEnergy >0.0) {
52 fraction = recHitEnergy[ir]/superClusterEnergy;
65 supercluster.
setLayer( maxClusterLayer );
66 supercluster.
setEnergy( superClusterEnergy );
67 supercluster.
setCaloId( maxClusterCaloId );
68 supercluster.
setSeed( maxHitEnergy );
70 supercluster.
setColor( maxClusterColor );
72 double numeratorEta = 0.0;
73 double numeratorPhi = 0.0;
74 double numeratorRho = 0.0;
80 if (superClusterEnergy>0.0 && supercluster.
recHitFractions().size()>0) {
81 const std::vector <reco::PFRecHitFraction >& pfhitsandfracs = supercluster.
recHitFractions();
82 for (std::vector<reco::PFRecHitFraction>::const_iterator it = pfhitsandfracs.begin(); it != pfhitsandfracs.end(); ++it) {
84 double hitEta = rechit->positionREP().Eta();
85 double hitPhi = rechit->positionREP().Phi();
88 double hitRho = rechit->positionREP().Rho();
89 double hitEnergy = rechit->energy();
90 const double w =
std::max(0.0, w0_ +
log(hitEnergy / superClusterEnergy));
92 numeratorEta += w*hitEta;
93 numeratorPhi += w*hitPhi;
94 numeratorRho += w*hitRho;
103 math::XYZPoint superClusterPosition(posEtaPhiRho.X(),posEtaPhiRho.Y(),posEtaPhiRho.Z());
void setLayer(PFLayer::Layer layer)
set layer
size_type size() const
Size of the RefVector.
void setColor(int color)
set cluster color (for the PFRootEventManager display)
void push_back(Ptr< T > const &iPtr)
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< Double32_t > > REPPoint
void setPosition(const math::XYZPoint &p)
Fraction of a PFRecHit (rechits can be shared between several PFCluster's)
void setEnergy(double energy)
void setSeed(const DetId &id)
void setCaloId(const CaloID &id)
const T & max(const T &a, const T &b)
void calculatePositionREP()
computes posrep_ once and for all
XYZPointD XYZPoint
point in space with cartesian internal representation
void setAlgoId(const AlgoId &id)
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions