CMS 3D CMS Logo

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

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 pat::PATTriggerMatchEmbedder< PATObjectType >

Author:
Volker Adler
Version:
Id:
PATTriggerMatchEmbedder.cc,v 1.6 2010/09/02 17:52:47 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.

                                                                                                   :
  src_( iConfig.getParameter< edm::InputTag >( "src" ) ),
  matches_( iConfig.getParameter< std::vector< edm::InputTag > >( "matches" ) )
{
  produces< std::vector< PATObjectType > >();
}
template<class PATObjectType >
pat::PATTriggerMatchEmbedder< PATObjectType >::~PATTriggerMatchEmbedder ( ) [inline]

Definition at line 49 of file PATTriggerMatchEmbedder.cc.

{};

Member Function Documentation

template<class PATObjectType >
void PATTriggerMatchEmbedder::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

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

{
  std::auto_ptr< std::vector< PATObjectType > > output( new std::vector< PATObjectType >() );

  edm::Handle< edm::View< PATObjectType > > candidates;
  iEvent.getByLabel( src_, candidates );
  if ( ! candidates.isValid() ) {
    edm::LogError( "missingInputSource" ) << "Input source with InputTag " << src_.encode() << " not in event.";
    return;
  }

  for ( typename edm::View< PATObjectType >::const_iterator iCand = candidates->begin(); iCand != candidates->end(); ++iCand ) {
    const unsigned index( iCand - candidates->begin() );
    PATObjectType cand( candidates->at( index ) );
    std::set< TriggerObjectStandAloneRef > cachedRefs;
    for ( size_t iMatch = 0; iMatch < matches_.size(); ++iMatch ) {
      edm::Handle< TriggerObjectStandAloneMatch > match;
      iEvent.getByLabel( matches_.at( iMatch ), match );
      if ( ! match.isValid() ) {
        edm::LogError( "missingInputMatch" ) << "Input match with InputTag " << matches_.at( iMatch ).encode() << " not in event.";
        continue;
      }
      const TriggerObjectStandAloneRef trigRef( ( *match )[ candidates->refAt( index ) ] );
      if ( trigRef.isNonnull() && trigRef.isAvailable() ) {
        if ( cachedRefs.insert( trigRef ).second ) { // protection from multiple entries of the same trigger objects
          cand.addTriggerObjectMatch( *trigRef );
        }
      }
    }
    output->push_back( cand );
  }

  iEvent.put( output );
}

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.