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::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATTriggerMatchEmbedder (const edm::ParameterSet &iConfig)
 
 ~PATTriggerMatchEmbedder ()
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

const std::vector< edm::InputTagmatches_
 
const std::vector
< edm::EDGetTokenT
< TriggerObjectStandAloneMatch > > 
matchesTokens_
 
const edm::InputTag src_
 
const edm::EDGetTokenT
< edm::View< PATObjectType > > 
srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 42 of file PATTriggerMatchEmbedder.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file PATTriggerMatchEmbedder.cc.

References GlobalPosition_Frontier_DevDB_cff::tag.

74  :
75  src_( iConfig.getParameter< edm::InputTag >( "src" ) ),
77  matches_( iConfig.getParameter< std::vector< edm::InputTag > >( "matches" ) ),
78  matchesTokens_( edm::vector_transform( matches_, [this](edm::InputTag const & tag) { return consumes< TriggerObjectStandAloneMatch >( tag ); } ) )
T getParameter(std::string const &) const
const std::vector< edm::InputTag > matches_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
const std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > matchesTokens_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< edm::View< PATObjectType > > srcToken_
template<class PATObjectType >
pat::PATTriggerMatchEmbedder< PATObjectType >::~PATTriggerMatchEmbedder ( )
inline

Definition at line 52 of file PATTriggerMatchEmbedder.cc.

52 {};

Member Function Documentation

template<class PATObjectType >
void PATTriggerMatchEmbedder::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual
Initial value:
{
produces< std::vector< PATObjectType > >()

Implements edm::global::EDProducerBase.

Definition at line 84 of file PATTriggerMatchEmbedder.cc.

References objects.IsoTrackAnalyzer::candidates, edm::Event::getByToken(), cmsHarvester::index, edm::HandleBase::isValid(), match(), convertSQLitetoXML_cfg::output, and edm::Event::put().

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

Member Data Documentation

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

Definition at line 46 of file PATTriggerMatchEmbedder.cc.

template<class PATObjectType >
const std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > pat::PATTriggerMatchEmbedder< PATObjectType >::matchesTokens_
private

Definition at line 47 of file PATTriggerMatchEmbedder.cc.

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

Definition at line 44 of file PATTriggerMatchEmbedder.cc.

template<class PATObjectType >
const edm::EDGetTokenT< edm::View< PATObjectType > > pat::PATTriggerMatchEmbedder< PATObjectType >::srcToken_
private

Definition at line 45 of file PATTriggerMatchEmbedder.cc.