#include "PhysicsTools/PatAlgos/plugins/PATTriggerMatchEmbedder.cc"
Public Member Functions | |
PATTriggerMatchEmbedder (const edm::ParameterSet &iConfig) | |
~PATTriggerMatchEmbedder () | |
Private Member Functions | |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
Private Attributes | |
std::vector< edm::InputTag > | matches_ |
edm::InputTag | src_ |
Definition at line 41 of file PATTriggerMatchEmbedder.cc.
PATTriggerMatchEmbedder::PATTriggerMatchEmbedder | ( | const edm::ParameterSet & | iConfig | ) | [inline, explicit] |
Definition at line 70 of file PATTriggerMatchEmbedder.cc.
00070 : 00071 src_( iConfig.getParameter< edm::InputTag >( "src" ) ), 00072 matches_( iConfig.getParameter< std::vector< edm::InputTag > >( "matches" ) ) 00073 { 00074 produces< std::vector< PATObjectType > >(); 00075 }
pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::~PATTriggerMatchEmbedder | ( | ) | [inline] |
void PATTriggerMatchEmbedder::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [inline, private, virtual] |
Implements edm::EDProducer.
Definition at line 78 of file PATTriggerMatchEmbedder.cc.
References edm::InputTag::encode(), edm::Event::getByLabel(), index, edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNonnull(), edm::Handle< T >::isValid(), edm::match(), pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::matches_, output(), edm::Event::put(), and pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::src_.
00079 { 00080 std::auto_ptr< std::vector< PATObjectType > > output( new std::vector< PATObjectType >() ); 00081 00082 edm::Handle< edm::View< PATObjectType > > candidates; 00083 iEvent.getByLabel( src_, candidates ); 00084 if ( ! candidates.isValid() ) { 00085 edm::LogError( "missingInputSource" ) << "Input source with InputTag " << src_.encode() << " not in event."; 00086 return; 00087 } 00088 00089 for ( typename edm::View< PATObjectType >::const_iterator iCand = candidates->begin(); iCand != candidates->end(); ++iCand ) { 00090 const unsigned index( iCand - candidates->begin() ); 00091 const edm::RefToBase< RecoObjectType > candRef( candidates->refAt( index ) ); 00092 PATObjectType cand( candRef ); 00093 for ( size_t iMatch = 0; iMatch < matches_.size(); ++iMatch ) { 00094 edm::Handle< TriggerObjectStandAloneMatch > match; 00095 iEvent.getByLabel( matches_.at( iMatch ), match ); 00096 if ( ! match.isValid() ) { 00097 edm::LogError( "missingInputMatch" ) << "Input match with InputTag " << matches_.at( iMatch ).encode() << " not in event."; 00098 continue; 00099 } 00100 const TriggerObjectStandAloneRef trigRef( ( *match )[ candRef ] ); 00101 if ( trigRef.isNonnull() && trigRef.isAvailable() ) { 00102 cand.addTriggerObjectMatch( *trigRef ); 00103 } 00104 } 00105 output->push_back( cand ); 00106 } 00107 00108 iEvent.put( output ); 00109 }
std::vector< edm::InputTag > pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::matches_ [private] |
Definition at line 44 of file PATTriggerMatchEmbedder.cc.
Referenced by pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::produce().
edm::InputTag pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::src_ [private] |
Definition at line 43 of file PATTriggerMatchEmbedder.cc.
Referenced by pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::produce().