CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
pat::PATTriggerMatchEmbedder< PATObjectType > Class Template Reference

More...

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

Inheritance diagram for pat::PATTriggerMatchEmbedder< PATObjectType >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 PATTriggerMatchEmbedder (const edm::ParameterSet &iConfig)
 
 ~PATTriggerMatchEmbedder ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 

Private Attributes

std::vector< edm::InputTagmatches_
 
edm::InputTag src_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

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

Author
Volker Adler
Version
Id:
PATTriggerMatchEmbedder.cc,v 1.7 2010/09/01 18:56:48 vadler Exp

Definition at line 41 of file PATTriggerMatchEmbedder.cc.

Constructor & Destructor Documentation

template<class PATObjectType >
PATTriggerMatchEmbedder::PATTriggerMatchEmbedder ( const edm::ParameterSet iConfig)
explicit

Definition at line 71 of file PATTriggerMatchEmbedder.cc.

71  :
72  src_( iConfig.getParameter< edm::InputTag >( "src" ) ),
73  matches_( iConfig.getParameter< std::vector< edm::InputTag > >( "matches" ) )
74 {
75  produces< std::vector< PATObjectType > >();
76 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > matches_
template<class PATObjectType >
pat::PATTriggerMatchEmbedder< PATObjectType >::~PATTriggerMatchEmbedder ( )
inline

Definition at line 49 of file PATTriggerMatchEmbedder.cc.

49 {};

Member Function Documentation

template<class PATObjectType >
void PATTriggerMatchEmbedder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 79 of file PATTriggerMatchEmbedder.cc.

References edm::Event::getByLabel(), getHLTprescales::index, edm::HandleBase::isValid(), match(), convertSQLitetoXML_cfg::output, and edm::Event::put().

80 {
81  std::auto_ptr< std::vector< PATObjectType > > output( new std::vector< PATObjectType >() );
82 
84  iEvent.getByLabel( src_, candidates );
85  if ( ! candidates.isValid() ) {
86  edm::LogError( "missingInputSource" ) << "Input source with InputTag " << src_.encode() << " not in event.";
87  return;
88  }
89 
90  for ( typename edm::View< PATObjectType >::const_iterator iCand = candidates->begin(); iCand != candidates->end(); ++iCand ) {
91  const unsigned index( iCand - candidates->begin() );
92  PATObjectType cand( candidates->at( index ) );
93  std::set< TriggerObjectStandAloneRef > cachedRefs;
94  for ( size_t iMatch = 0; iMatch < matches_.size(); ++iMatch ) {
96  iEvent.getByLabel( matches_.at( iMatch ), match );
97  if ( ! match.isValid() ) {
98  edm::LogError( "missingInputMatch" ) << "Input match with InputTag " << matches_.at( iMatch ).encode() << " not in event.";
99  continue;
100  }
101  const TriggerObjectStandAloneRef trigRef( ( *match )[ candidates->refAt( index ) ] );
102  if ( trigRef.isNonnull() && trigRef.isAvailable() ) {
103  if ( cachedRefs.insert( trigRef ).second ) { // protection from multiple entries of the same trigger objects
104  cand.addTriggerObjectMatch( *trigRef );
105  }
106  }
107  }
108  output->push_back( cand );
109  }
110 
111  iEvent.put( output );
112 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
std::vector< edm::InputTag > matches_
std::string encode() const
Definition: InputTag.cc:72
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6

Member Data Documentation

template<class PATObjectType >
std::vector< edm::InputTag > pat::PATTriggerMatchEmbedder< PATObjectType >::matches_
private

Definition at line 44 of file PATTriggerMatchEmbedder.cc.

template<class PATObjectType >
edm::InputTag pat::PATTriggerMatchEmbedder< PATObjectType >::src_
private

Definition at line 43 of file PATTriggerMatchEmbedder.cc.