CMS 3D CMS Logo

CandOneToManyDeltaRMatcher Class Reference

Inheritance diagram for CandOneToManyDeltaRMatcher:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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_


Detailed Description

Definition at line 18 of file CandOneToManyDeltaRMatcher.cc.


Constructor & Destructor Documentation

CandOneToManyDeltaRMatcher::CandOneToManyDeltaRMatcher ( const edm::ParameterSet cfg  ) 

Definition at line 65 of file CandOneToManyDeltaRMatcher.cc.

00065                                                                                  :
00066   source_( cfg.getParameter<InputTag>( "src" ) ),
00067   matched_( cfg.getParameter<InputTag>( "matched" ) ),
00068   printdebug_( cfg.getUntrackedParameter<bool>("printDebug", false) ) {
00069   produces<CandMatchMapMany>();
00070 }

CandOneToManyDeltaRMatcher::~CandOneToManyDeltaRMatcher (  ) 

Definition at line 72 of file CandOneToManyDeltaRMatcher.cc.

00072                                                         {
00073 }


Member Function Documentation

void CandOneToManyDeltaRMatcher::produce ( edm::Event evt,
const edm::EventSetup es 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 75 of file CandOneToManyDeltaRMatcher.cc.

References c, GenMuonPlsPt100GeV_cfg::cout, dist(), lat::endl(), reco::Particle::et(), reco::Particle::eta(), first, edm::Event::getByLabel(), m, edm::match(), matched_, reco::Particle::p4(), reco::Particle::phi(), printdebug_, edm::Event::put(), edm::second(), python::multivaluedict::sort(), source, source_, HLT_VtxMuL3::src, and v.

00075                                                                            {
00076   
00077   Handle<CandidateCollection> source;  
00078   Handle<CandidateCollection> matched;  
00079   evt.getByLabel( source_, source ) ;
00080   evt.getByLabel( matched_, matched ) ;
00081  
00082   if (printdebug_) {
00083     for( CandidateCollection::const_iterator c = source->begin(); c != source->end(); ++c ) {
00084       cout << "[CandOneToManyDeltaRMatcher] Et source  " << c->et() << endl;
00085     }    
00086     for( CandidateCollection::const_iterator c = matched->begin(); c != matched->end(); ++c ) {
00087       cout << "[CandOneToManyDeltaRMatcher] Et matched " << c->et() << endl;
00088     } 
00089   }
00090  
00091 
00092   auto_ptr<CandMatchMapMany> matchMap( new CandMatchMapMany( CandMatchMapMany::ref_type( CandidateRefProd( source  ),
00093                                                                                          CandidateRefProd( matched )
00094                                                                                          ) ) );
00095   for( size_t c = 0; c != source->size(); ++ c ) {
00096     const Candidate & src = (*source)[ c ];
00097     if (printdebug_) cout << "[CandOneToManyDeltaRMatcher] source (Et,Eta,Phi) =(" << src.et() << "," << 
00098                                                                                       src.eta() << "," << 
00099                                                                                       src.phi() << ")" << endl;
00100     vector<reco::helper::MatchPair> v;
00101     for( size_t m = 0; m != matched->size(); ++ m ) {
00102       const Candidate & match = ( * matched )[ m ];
00103       double dist = DeltaR( src.p4() , match.p4() );
00104       v.push_back( make_pair( m, dist ) );      
00105     }
00106     if ( v.size() > 0 ) {
00107       sort( v.begin(), v.end(), reco::helper::SortBySecond() );
00108       for( size_t m = 0; m != v.size(); ++ m ) {
00109         if (printdebug_) cout << "[CandOneToManyDeltaRMatcher]       match (Et,Eta,Phi) =(" << ( * matched )[ v[m].first ].et() << "," << 
00110                                                                                                ( * matched )[ v[m].first ].eta() << "," << 
00111                                                                                                ( * matched )[ v[m].first ].phi() << ") DeltaR=" << 
00112                                                                                                v[m].second  << endl;
00113         matchMap->insert( CandidateRef( source, c ), make_pair( CandidateRef( matched, v[m].first ), v[m].second  )  );
00114       }    
00115     } 
00116   }
00117   
00118   evt.put( matchMap );
00119 
00120 }


Member Data Documentation

edm::InputTag CandOneToManyDeltaRMatcher::matched_ [private]

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().

edm::InputTag CandOneToManyDeltaRMatcher::source_ [private]

Definition at line 25 of file CandOneToManyDeltaRMatcher.cc.

Referenced by produce().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:16:08 2009 for CMSSW by  doxygen 1.5.4