CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SignPFSpecificAlgo.cc
Go to the documentation of this file.
1 /*
2  class: SignPFSpecificAlgo.cc
3  description: add the infrastructure to compute the jet-based significance for MET computed with particle flow
4  authors: A. Khukhunaishvili (Cornell), L. Gibbons (Cornell)
5  date: 11/11/10
6  */
7 
9 
11 resolutions_(0),
12 algo_()
13 {clusteredParticlePtrs_.clear();}
14 
16 
17 void
19  resolutions_ = resolutions;
20 }
21 
22 
23 void
25  std::vector<metsig::SigInputObj> vobj;
26  for(edm::View<reco::PFJet>::const_iterator jet = PFJets->begin(); jet != PFJets->end(); ++jet){
27  vobj.push_back(resolutions_->evalPFJet(&(*jet)));
28  std::vector<reco::PFCandidatePtr> pfs = jet->getPFConstituents();
29  for(std::vector<reco::PFCandidatePtr>::const_iterator it=pfs.begin(); it!=pfs.end(); ++it){
30  reco::CandidatePtr ptr(*it);
31  clusteredParticlePtrs_.insert(ptr);
32  }
33  }
34  algo_.addObjects(vobj);
35 }
36 
37 void
39  std::set<reco::CandidatePtr>::const_iterator it=clusteredParticlePtrs_.begin();
40  reco::CandidatePtr ptr(*it);
41  if(ptr.id()==productID) return; //If the first element is from the right product, return
42 
43  std::set<reco::CandidatePtr> temp;
44  for(; it!=clusteredParticlePtrs_.end(); ++it){
45  reco::CandidatePtr ptr(*it);
46  while(ptr.id()!=productID){
47  ptr = ptr->sourceCandidatePtr(0);
48  if(ptr.isNull()) return; //if it does not get to the correct product, return
49  }
50  temp.insert(ptr);
51  }
52  clusteredParticlePtrs_.clear();
53  clusteredParticlePtrs_ = temp;
54 }
55 
56 void
58  if(clusteredParticlePtrs_.find(pf) != clusteredParticlePtrs_.end()) {
59  return; //pf candidate already added in jet collection
60  }
61  std::vector<metsig::SigInputObj> vobj;
62  vobj.push_back(resolutions_->evalPF(&(*pf)));
63  algo_.addObjects(vobj);
64 }
65 
void addPFCandidate(reco::PFCandidatePtr pf)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:164
void useOriginalPtrs(const edm::ProductID &productID)
bool isNull() const
Checks for null.
Definition: Ptr.h:148
void setResolutions(metsig::SignAlgoResolutions *resolutions)
void addPFJets(edm::Handle< edm::View< reco::PFJet > > PFJets)
std::set< reco::CandidatePtr > clusteredParticlePtrs_