Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:53

0001 #include "DataFormats/ParticleFlowReco/interface/PFSuperCluster.h"
0002 #include "DataFormats/GeometryVector/interface/Pi.h"
0003 #include "DataFormats/Common/interface/PtrVector.h"
0004 
0005 using namespace std;
0006 using namespace reco;
0007 
0008 PFSuperCluster::PFSuperCluster(const edm::PtrVector<reco::PFCluster>& clusters) : clusters_(clusters) {}
0009 
0010 void PFSuperCluster::reset() {
0011   PFCluster::reset();
0012   clusters_.clear();
0013 }
0014 
0015 PFSuperCluster& PFSuperCluster::operator=(const PFSuperCluster& other) {
0016   PFCluster::operator=((PFCluster)other);
0017   clusters_ = other.clusters_;
0018 
0019   return *this;
0020 }
0021 
0022 std::ostream& reco::operator<<(std::ostream& out, const PFSuperCluster& cluster) {
0023   if (!out)
0024     return out;
0025 
0026   const math::XYZPoint& pos = cluster.position();
0027   const PFCluster::REPPoint& posrep = cluster.positionREP();
0028   const std::vector<reco::PFRecHitFraction>& fracs = cluster.recHitFractions();
0029 
0030   out << "PFSuperCluster "
0031       << ", clusters: " << cluster.clusters().size() << ", layer: " << cluster.layer() << "\tE = " << cluster.energy()
0032       << "\tXYZ: " << pos.X() << "," << pos.Y() << "," << pos.Z() << " | "
0033       << "\tREP: " << posrep.Rho() << "," << posrep.Eta() << "," << posrep.Phi() << " | " << fracs.size() << " rechits";
0034 
0035   for (unsigned i = 0; i < fracs.size(); i++) {
0036     // PFRecHit is not available, print the detID
0037     if (!fracs[i].recHitRef().isAvailable())
0038       out << cluster.printHitAndFraction(i) << ", ";
0039     else
0040       out << fracs[i] << ", ";
0041   }
0042 
0043   return out;
0044 }