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 () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 40 of file PATTriggerMatchEmbedder.cc.

Constructor & Destructor Documentation

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

Definition at line 66 of file PATTriggerMatchEmbedder.cc.

References GlobalPosition_Frontier_DevDB_cff::tag.

67  : src_(iConfig.getParameter<edm::InputTag>("src")),
69  matches_(iConfig.getParameter<std::vector<edm::InputTag>>("matches")),
71  matches_, [this](edm::InputTag const& tag) { return consumes<TriggerObjectStandAloneMatch>(tag); })) {
72  produces<std::vector<PATObjectType>>();
73 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< edm::View< PATObjectType > > srcToken_
const std::vector< edm::InputTag > matches_
const std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > matchesTokens_
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
template<class PATObjectType >
pat::PATTriggerMatchEmbedder< PATObjectType >::~PATTriggerMatchEmbedder ( )
inlineoverride

Member Function Documentation

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

Definition at line 76 of file PATTriggerMatchEmbedder.cc.

References HLT_2018_cff::candidates, DEFINE_FWK_MODULE, edm::InputTag::encode(), edm::Event::getByToken(), 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().

78  {
79  auto output = std::make_unique<std::vector<PATObjectType>>();
80 
82  iEvent.getByToken(srcToken_, candidates);
83  if (!candidates.isValid()) {
84  edm::LogError("missingInputSource") << "Input source with InputTag " << src_.encode() << " not in event.";
85  return;
86  }
87 
88  for (typename edm::View<PATObjectType>::const_iterator iCand = candidates->begin(); iCand != candidates->end();
89  ++iCand) {
90  const unsigned index(iCand - candidates->begin());
91  PATObjectType cand(candidates->at(index));
92  std::set<TriggerObjectStandAloneRef> cachedRefs;
93  for (size_t iMatch = 0; iMatch < matchesTokens_.size(); ++iMatch) {
95  iEvent.getByToken(matchesTokens_.at(iMatch), match);
96  if (!match.isValid()) {
97  edm::LogError("missingInputMatch")
98  << "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(std::move(output));
112 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::string encode() const
Definition: InputTag.cc:159
const edm::EDGetTokenT< edm::View< PATObjectType > > srcToken_
const std::vector< edm::InputTag > matches_
bool isValid() const
Definition: HandleBase.h:70
const std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > matchesTokens_
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:511

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