CMS 3D CMS Logo

pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType > Class Template Reference

More...

#include "PhysicsTools/PatAlgos/plugins/PATTriggerMatchEmbedder.cc"

Inheritance diagram for pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >:

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

List of all members.

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::InputTagmatches_
edm::InputTag src_


Detailed Description

template<class PATObjectType, class RecoObjectType>
class pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >

Author:
Volker Adler
Version:
Id
PATTriggerMatchEmbedder.cc,v 1.1.2.2 2009/04/20 12:33:27 vadler Exp

Definition at line 41 of file PATTriggerMatchEmbedder.cc.


Constructor & Destructor Documentation

template<class PATObjectType, class RecoObjectType>
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 }

template<class PATObjectType, class RecoObjectType>
pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::~PATTriggerMatchEmbedder (  )  [inline]

Definition at line 49 of file PATTriggerMatchEmbedder.cc.

00049 {};


Member Function Documentation

template<class PATObjectType, class RecoObjectType>
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 }


Member Data Documentation

template<class PATObjectType, class RecoObjectType>
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().

template<class PATObjectType, class RecoObjectType>
edm::InputTag pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::src_ [private]

Definition at line 43 of file PATTriggerMatchEmbedder.cc.

Referenced by pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::produce().


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