CMS 3D CMS Logo

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 ); } ) )
79 {
80  produces< std::vector< PATObjectType > >();
81 }
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

Member Function Documentation

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

Definition at line 84 of file PATTriggerMatchEmbedder.cc.

References objects.IsoTrackAnalyzer::candidates, DEFINE_FWK_MODULE, edm::InputTag::encode(), edm::Event::getByToken(), diffTreeTool::index, edm::HandleBase::isValid(), match(), pat::PATTriggerMatchEmbedder< PATObjectType >::matches_, pat::PATTriggerMatchEmbedder< PATObjectType >::matchesTokens_, eostools::move(), convertSQLitetoXML_cfg::output, edm::Event::put(), pat::PATTriggerMatchEmbedder< PATObjectType >::src_, and pat::PATTriggerMatchEmbedder< PATObjectType >::srcToken_.

Referenced by pat::PATTriggerMatchEmbedder< PATObjectType >::~PATTriggerMatchEmbedder().

85 {
86  auto output = std::make_unique<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(std::move(output) );
117 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
const std::vector< edm::InputTag > matches_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::string encode() const
Definition: InputTag.cc:165
const std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > matchesTokens_
bool isValid() const
Definition: HandleBase.h:74
const edm::EDGetTokenT< edm::View< PATObjectType > > srcToken_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

template<class PATObjectType >
const std::vector< edm::InputTag > pat::PATTriggerMatchEmbedder< PATObjectType >::matches_
private
template<class PATObjectType >
const std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > pat::PATTriggerMatchEmbedder< PATObjectType >::matchesTokens_
private
template<class PATObjectType >
const edm::InputTag pat::PATTriggerMatchEmbedder< PATObjectType >::src_
private
template<class PATObjectType >
const edm::EDGetTokenT< edm::View< PATObjectType > > pat::PATTriggerMatchEmbedder< PATObjectType >::srcToken_
private