#include <GenJetClosestMatchSelectorDefinition.h>
Public Types | |
typedef reco::GenJetCollection | collection |
typedef container::const_iterator | const_iterator |
typedef std::vector < reco::GenJet * > | container |
typedef edm::Handle< collection > | HandleToCollection |
Public Member Functions | |
const_iterator | begin () const |
const_iterator | end () const |
GenJetClosestMatchSelectorDefinition (const edm::ParameterSet &cfg) | |
void | select (const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s) |
size_t | size () const |
Private Attributes | |
edm::InputTag | matchTo_ |
container | selected_ |
Definition at line 10 of file GenJetClosestMatchSelectorDefinition.h.
Definition at line 13 of file GenJetClosestMatchSelectorDefinition.h.
typedef container::const_iterator GenJetClosestMatchSelectorDefinition::const_iterator |
Definition at line 16 of file GenJetClosestMatchSelectorDefinition.h.
typedef std::vector< reco::GenJet *> GenJetClosestMatchSelectorDefinition::container |
Definition at line 15 of file GenJetClosestMatchSelectorDefinition.h.
Definition at line 14 of file GenJetClosestMatchSelectorDefinition.h.
GenJetClosestMatchSelectorDefinition::GenJetClosestMatchSelectorDefinition | ( | const edm::ParameterSet & | cfg | ) | [inline] |
Definition at line 18 of file GenJetClosestMatchSelectorDefinition.h.
References edm::ParameterSet::getParameter(), and matchTo_.
{ matchTo_ = cfg.getParameter< edm::InputTag >( "MatchTo" ); }
const_iterator GenJetClosestMatchSelectorDefinition::begin | ( | void | ) | const [inline] |
Definition at line 23 of file GenJetClosestMatchSelectorDefinition.h.
References selected_.
{ return selected_.begin(); }
const_iterator GenJetClosestMatchSelectorDefinition::end | ( | void | ) | const [inline] |
Definition at line 25 of file GenJetClosestMatchSelectorDefinition.h.
References selected_.
{ return selected_.end(); }
void GenJetClosestMatchSelectorDefinition::select | ( | const HandleToCollection & | hc, |
const edm::Event & | e, | ||
const edm::EventSetup & | s | ||
) | [inline] |
Definition at line 27 of file GenJetClosestMatchSelectorDefinition.h.
References Geom::deltaR2(), edm::Event::getByLabel(), combine::key, matchTo_, and selected_.
{ selected_.clear(); edm::Handle< edm::View<reco::Candidate> > matchCandidates; e.getByLabel( matchTo_, matchCandidates); unsigned key=0; // std::cout<<"number of candidates "<<matchCandidates->size()<<std::endl; typedef edm::View<reco::Candidate>::const_iterator IC; for( IC ic = matchCandidates->begin(); ic!= matchCandidates->end(); ++ic ) { double eta2 = ic->eta(); double phi2 = ic->phi(); // std::cout<<"cand "<<eta2<<" "<<phi2<<std::endl; // look for the closest gen jet double deltaR2Min = 9999; collection::const_iterator closest = hc->end(); for( collection::const_iterator genjet = hc->begin(); genjet != hc->end(); ++genjet, ++key) { reco::GenJetRef genJetRef(hc, key); // is it matched? double eta1 = genjet->eta(); double phi1 = genjet->phi(); double deltaR2 = reco::deltaR2(eta1, phi1, eta2, phi2); // std::cout<<" genjet "<<eta1<<" "<<phi1<<" "<<deltaR2<<std::endl; // cut should be a parameter if( deltaR2<deltaR2Min ) { deltaR2Min = deltaR2; closest = genjet; } } if(deltaR2Min<0.01 ) { // std::cout<<deltaR2Min<<std::endl; selected_.push_back( new reco::GenJet(*closest) ); } } // end collection iteration // std::cout<<selected_.size()<<std::endl; } // end select()
size_t GenJetClosestMatchSelectorDefinition::size | ( | void | ) | const [inline] |
Definition at line 87 of file GenJetClosestMatchSelectorDefinition.h.
References selected_.
{ return selected_.size(); }
Definition at line 91 of file GenJetClosestMatchSelectorDefinition.h.
Referenced by GenJetClosestMatchSelectorDefinition(), and select().