Public Member Functions | |
CandOneToManyDeltaRMatcher (const edm::ParameterSet &) | |
~CandOneToManyDeltaRMatcher () | |
Private Member Functions | |
void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
edm::InputTag | matched_ |
bool | printdebug_ |
edm::InputTag | source_ |
Definition at line 18 of file CandOneToManyDeltaRMatcher.cc.
CandOneToManyDeltaRMatcher::CandOneToManyDeltaRMatcher | ( | const edm::ParameterSet & | cfg | ) |
Definition at line 65 of file CandOneToManyDeltaRMatcher.cc.
: source_( cfg.getParameter<InputTag>( "src" ) ), matched_( cfg.getParameter<InputTag>( "matched" ) ), printdebug_( cfg.getUntrackedParameter<bool>("printDebug", false) ) { produces<CandMatchMapMany>(); }
CandOneToManyDeltaRMatcher::~CandOneToManyDeltaRMatcher | ( | ) |
Definition at line 72 of file CandOneToManyDeltaRMatcher.cc.
{ }
void CandOneToManyDeltaRMatcher::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 75 of file CandOneToManyDeltaRMatcher.cc.
References trackerHits::c, gather_cfg::cout, reco::Candidate::et(), reco::Candidate::eta(), first, edm::Event::getByLabel(), m, match(), matched_, reco::Candidate::p4(), reco::Candidate::phi(), printdebug_, edm::Event::put(), edm::second(), python::multivaluedict::sort(), LaserTracksInput_cfi::source, source_, alcazmumu_cfi::src, and findQualityFiles::v.
{ Handle<CandidateCollection> source; Handle<CandidateCollection> matched; evt.getByLabel( source_, source ) ; evt.getByLabel( matched_, matched ) ; if (printdebug_) { for( CandidateCollection::const_iterator c = source->begin(); c != source->end(); ++c ) { cout << "[CandOneToManyDeltaRMatcher] Et source " << c->et() << endl; } for( CandidateCollection::const_iterator c = matched->begin(); c != matched->end(); ++c ) { cout << "[CandOneToManyDeltaRMatcher] Et matched " << c->et() << endl; } } auto_ptr<CandMatchMapMany> matchMap( new CandMatchMapMany( CandMatchMapMany::ref_type( CandidateRefProd( source ), CandidateRefProd( matched ) ) ) ); for( size_t c = 0; c != source->size(); ++ c ) { const Candidate & src = (*source)[ c ]; if (printdebug_) cout << "[CandOneToManyDeltaRMatcher] source (Et,Eta,Phi) =(" << src.et() << "," << src.eta() << "," << src.phi() << ")" << endl; vector<reco::helper::MatchPair> v; for( size_t m = 0; m != matched->size(); ++ m ) { const Candidate & match = ( * matched )[ m ]; double dist = DeltaR( src.p4() , match.p4() ); v.push_back( make_pair( m, dist ) ); } if ( v.size() > 0 ) { sort( v.begin(), v.end(), reco::helper::SortBySecond() ); for( size_t m = 0; m != v.size(); ++ m ) { if (printdebug_) cout << "[CandOneToManyDeltaRMatcher] match (Et,Eta,Phi) =(" << ( * matched )[ v[m].first ].et() << "," << ( * matched )[ v[m].first ].eta() << "," << ( * matched )[ v[m].first ].phi() << ") DeltaR=" << v[m].second << endl; matchMap->insert( CandidateRef( source, c ), make_pair( CandidateRef( matched, v[m].first ), v[m].second ) ); } } } evt.put( matchMap ); }
Definition at line 26 of file CandOneToManyDeltaRMatcher.cc.
Referenced by produce().
bool CandOneToManyDeltaRMatcher::printdebug_ [private] |
Definition at line 27 of file CandOneToManyDeltaRMatcher.cc.
Referenced by produce().
Definition at line 25 of file CandOneToManyDeltaRMatcher.cc.
Referenced by produce().