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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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

◆ PATTriggerMatchEmbedder()

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

Definition at line 67 of file PATTriggerMatchEmbedder.cc.

References makeGlobalPositionRcd_cfg::tag.

68  : src_(iConfig.getParameter<edm::InputTag>("src")),
70  matches_(iConfig.getParameter<std::vector<edm::InputTag>>("matches")),
72  matches_, [this](edm::InputTag const& tag) { return consumes<TriggerObjectStandAloneMatch>(tag); })) {
73  produces<std::vector<PATObjectType>>();
74 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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
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_

◆ ~PATTriggerMatchEmbedder()

template<class PATObjectType >
pat::PATTriggerMatchEmbedder< PATObjectType >::~PATTriggerMatchEmbedder ( )
inlineoverride

Definition at line 49 of file PATTriggerMatchEmbedder.cc.

49 {};

Member Function Documentation

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 77 of file PATTriggerMatchEmbedder.cc.

References HLT_2022v14_cff::candidates, iEvent, match(), eostools::move(), and convertSQLitetoXML_cfg::output.

79  {
80  auto output = std::make_unique<std::vector<PATObjectType>>();
81 
83  iEvent.getByToken(srcToken_, candidates);
84  if (!candidates.isValid()) {
85  edm::LogError("missingInputSource") << "Input source with InputTag " << src_.encode() << " not in event.";
86  return;
87  }
88 
89  for (typename edm::View<PATObjectType>::const_iterator iCand = candidates->begin(); iCand != candidates->end();
90  ++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 < matchesTokens_.size(); ++iMatch) {
96  iEvent.getByToken(matchesTokens_.at(iMatch), match);
97  if (!match.isValid()) {
98  edm::LogError("missingInputMatch")
99  << "Input match with InputTag " << matches_.at(iMatch).encode() << " not in event.";
100  continue;
101  }
102  const TriggerObjectStandAloneRef trigRef((*match)[candidates->refAt(index)]);
103  if (trigRef.isNonnull() && trigRef.isAvailable()) {
104  if (cachedRefs.insert(trigRef).second) { // protection from multiple entries of the same trigger objects
105  cand.addTriggerObjectMatch(*trigRef);
106  }
107  }
108  }
109  output->push_back(cand);
110  }
111 
112  iEvent.put(std::move(output));
113 }
std::string encode() const
Definition: InputTag.cc:159
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< edm::View< PATObjectType > > srcToken_
const std::vector< edm::InputTag > matches_
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

◆ matches_

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

Definition at line 44 of file PATTriggerMatchEmbedder.cc.

◆ matchesTokens_

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

Definition at line 45 of file PATTriggerMatchEmbedder.cc.

◆ src_

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

Definition at line 42 of file PATTriggerMatchEmbedder.cc.

◆ srcToken_

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

Definition at line 43 of file PATTriggerMatchEmbedder.cc.