Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:44

0001 
0002 #include "DataFormats/JetReco/interface/PFClusterJet.h"
0003 
0004 reco::PFClusterJet::PFClusterJet() : reco::Jet() {}
0005 
0006 reco::PFClusterJet::PFClusterJet(const LorentzVector& fP4, const Point& fVertex) : reco::Jet(fP4, fVertex) {}
0007 
0008 reco::PFClusterJet::PFClusterJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents)
0009     : reco::Jet(fP4, fVertex, fConstituents) {}
0010 
0011 reco::PFClusterJet* reco::PFClusterJet::clone() const { return new reco::PFClusterJet(*this); }
0012 
0013 reco::PFClusterRef reco::PFClusterJet::pfCluster(size_t i) const {
0014   Constituent dau = daughterPtr(i);
0015   // check the daughter to be ok
0016   if (dau.isNonnull() && dau.isAvailable()) {
0017     // convert to concrete candidate type
0018     const RecoPFClusterRefCandidate* pfClusterCand = dynamic_cast<const RecoPFClusterRefCandidate*>(dau.get());
0019     // check the candidate is of the right type
0020     if (pfClusterCand) {
0021       return pfClusterCand->pfCluster();
0022     } else {
0023       throw cms::Exception("Invalid Constituent")
0024           << "PFClusterJet constituent is not of RecoPFClusterRefCandidate type";
0025     }
0026     // otherwise return empty ptr
0027   } else {
0028     return reco::PFClusterRef();
0029   }
0030 }
0031 
0032 bool reco::PFClusterJet::overlap(const Candidate& dummy) const { return false; }
0033 
0034 std::string reco::PFClusterJet::print() const {
0035   std::ostringstream out;
0036   out << Jet::print() << std::endl;
0037   out << "    Constituents: " << std::endl;
0038   for (size_t i = 0; i < numberOfDaughters(); ++i) {
0039     out << *(pfCluster(i)) << std::endl;
0040   }
0041   return out.str();
0042 }