CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
metsig::SignPFSpecificAlgo Class Reference

#include <SignPFSpecificAlgo.h>

Public Member Functions

void addPFCandidate (reco::PFCandidatePtr pf)
 
void addPFJets (const edm::View< reco::PFJet > *PFJets)
 
reco::METCovMatrix getSignifMatrix () const
 
reco::METCovMatrix mkSignifMatrix (edm::Handle< edm::View< reco::Candidate > > &PFCandidates)
 
void setResolutions (metsig::SignAlgoResolutions *resolutions)
 
 SignPFSpecificAlgo ()
 
void useOriginalPtrs (const edm::ProductID &productID)
 
 ~SignPFSpecificAlgo ()
 

Private Attributes

metsig::significanceAlgo algo_
 
std::set< reco::CandidatePtrclusteredParticlePtrs_
 
metsig::SignAlgoResolutionsresolutions_
 

Detailed Description

Definition at line 30 of file SignPFSpecificAlgo.h.

Constructor & Destructor Documentation

SignPFSpecificAlgo::SignPFSpecificAlgo ( )

Definition at line 17 of file SignPFSpecificAlgo.cc.

References clusteredParticlePtrs_.

17 : resolutions_(nullptr), algo_() { clusteredParticlePtrs_.clear(); }
metsig::significanceAlgo algo_
metsig::SignAlgoResolutions * resolutions_
std::set< reco::CandidatePtr > clusteredParticlePtrs_
metsig::SignPFSpecificAlgo::~SignPFSpecificAlgo ( )
inline

Member Function Documentation

void SignPFSpecificAlgo::addPFCandidate ( reco::PFCandidatePtr  pf)

Definition at line 60 of file SignPFSpecificAlgo.cc.

References metsig::significanceAlgo::addObjects(), algo_, clusteredParticlePtrs_, metsig::SignAlgoResolutions::evalPF(), and resolutions_.

Referenced by mkSignifMatrix(), and ~SignPFSpecificAlgo().

60  {
61  if (clusteredParticlePtrs_.find(pf) != clusteredParticlePtrs_.end()) {
62  return; //pf candidate already added in jet collection
63  }
64  std::vector<metsig::SigInputObj> vobj;
65  vobj.push_back(resolutions_->evalPF(&(*pf)));
66  algo_.addObjects(vobj);
67 }
const void addObjects(const std::vector< metsig::SigInputObj > &EventVec)
metsig::SigInputObj evalPF(const reco::PFCandidate *candidate) const
metsig::significanceAlgo algo_
metsig::SignAlgoResolutions * resolutions_
std::set< reco::CandidatePtr > clusteredParticlePtrs_
void SignPFSpecificAlgo::addPFJets ( const edm::View< reco::PFJet > *  PFJets)

Definition at line 25 of file SignPFSpecificAlgo.cc.

References metsig::significanceAlgo::addObjects(), algo_, edm::View< T >::begin(), clusteredParticlePtrs_, edm::View< T >::end(), metsig::SignAlgoResolutions::evalPFJet(), metsig::jet, and resolutions_.

Referenced by ~SignPFSpecificAlgo().

25  {
26  std::vector<metsig::SigInputObj> vobj;
27  for (edm::View<reco::PFJet>::const_iterator jet = PFJets->begin(); jet != PFJets->end(); ++jet) {
28  vobj.push_back(resolutions_->evalPFJet(&(*jet)));
29  std::vector<reco::PFCandidatePtr> pfs = jet->getPFConstituents();
30  for (std::vector<reco::PFCandidatePtr>::const_iterator it = pfs.begin(); it != pfs.end(); ++it) {
31  reco::CandidatePtr ptr(*it);
32  clusteredParticlePtrs_.insert(ptr);
33  }
34  }
35  algo_.addObjects(vobj);
36 }
const void addObjects(const std::vector< metsig::SigInputObj > &EventVec)
metsig::SigInputObj evalPFJet(const reco::Jet *jet) const
const_iterator begin() const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
const_iterator end() const
metsig::significanceAlgo algo_
metsig::SignAlgoResolutions * resolutions_
std::set< reco::CandidatePtr > clusteredParticlePtrs_
reco::METCovMatrix metsig::SignPFSpecificAlgo::getSignifMatrix ( ) const
inline

Definition at line 39 of file SignPFSpecificAlgo.h.

References algo_, metsig::significanceAlgo::getSignifMatrix(), mkSignifMatrix(), and jetMETAnalyzer_cfi::PFCandidates.

Referenced by mkSignifMatrix().

39 { return algo_.getSignifMatrix(); }
reco::METCovMatrix getSignifMatrix() const
metsig::significanceAlgo algo_
reco::METCovMatrix SignPFSpecificAlgo::mkSignifMatrix ( edm::Handle< edm::View< reco::Candidate > > &  PFCandidates)

Definition at line 70 of file SignPFSpecificAlgo.cc.

References addPFCandidate(), begin, end, getSignifMatrix(), packedPFCandidateRefMixer_cfi::pf, jetMETAnalyzer_cfi::PFCandidates, and useOriginalPtrs().

Referenced by getSignifMatrix().

70  {
71  useOriginalPtrs(PFCandidates.id());
72  for (edm::View<reco::Candidate>::const_iterator iParticle = (PFCandidates.product())->begin();
73  iParticle != (PFCandidates.product())->end();
74  ++iParticle) {
75  const reco::PFCandidate* pfCandidate = dynamic_cast<const reco::PFCandidate*>(&(*iParticle));
76  if (!pfCandidate)
77  continue;
78  reco::CandidatePtr dau(PFCandidates, iParticle - PFCandidates->begin());
79  if (dau.isNull())
80  continue;
81  if (!dau.isAvailable())
82  continue;
83  reco::PFCandidatePtr pf(dau.id(), pfCandidate, dau.key());
85  }
86  return getSignifMatrix();
87 }
ProductID id() const
Definition: HandleBase.cc:13
reco::METCovMatrix getSignifMatrix() const
#define end
Definition: vmac.h:39
T const * product() const
Definition: Handle.h:69
void addPFCandidate(reco::PFCandidatePtr pf)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
#define begin
Definition: vmac.h:32
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
void useOriginalPtrs(const edm::ProductID &productID)
void SignPFSpecificAlgo::setResolutions ( metsig::SignAlgoResolutions resolutions)

Definition at line 20 of file SignPFSpecificAlgo.cc.

References electronProducer_cfi::resolutions, and resolutions_.

Referenced by ~SignPFSpecificAlgo().

20  {
22 }
metsig::SignAlgoResolutions * resolutions_
void SignPFSpecificAlgo::useOriginalPtrs ( const edm::ProductID productID)

Definition at line 39 of file SignPFSpecificAlgo.cc.

References clusteredParticlePtrs_, edm::Ptr< T >::id(), edm::Ptr< T >::isNull(), and groupFilesInBlocks::temp.

Referenced by mkSignifMatrix(), and ~SignPFSpecificAlgo().

39  {
40  std::set<reco::CandidatePtr>::const_iterator it = clusteredParticlePtrs_.begin();
41  reco::CandidatePtr ptr(*it);
42  if (ptr.id() == productID)
43  return; //If the first element is from the right product, return
44 
45  std::set<reco::CandidatePtr> temp;
46  for (; it != clusteredParticlePtrs_.end(); ++it) {
47  reco::CandidatePtr ptr(*it);
48  while (ptr.id() != productID) {
49  ptr = ptr->sourceCandidatePtr(0);
50  if (ptr.isNull())
51  return; //if it does not get to the correct product, return
52  }
53  temp.insert(ptr);
54  }
55  clusteredParticlePtrs_.clear();
57 }
std::set< reco::CandidatePtr > clusteredParticlePtrs_

Member Data Documentation

metsig::significanceAlgo metsig::SignPFSpecificAlgo::algo_
private

Definition at line 45 of file SignPFSpecificAlgo.h.

Referenced by addPFCandidate(), addPFJets(), and getSignifMatrix().

std::set<reco::CandidatePtr> metsig::SignPFSpecificAlgo::clusteredParticlePtrs_
private
metsig::SignAlgoResolutions* metsig::SignPFSpecificAlgo::resolutions_
private

Definition at line 43 of file SignPFSpecificAlgo.h.

Referenced by addPFCandidate(), addPFJets(), and setResolutions().