CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Types | Private Member Functions | Private Attributes
reco::modules::MatcherBase< C1, C2, M > Class Template Referenceabstract

#include <Matcher.h>

Inheritance diagram for reco::modules::MatcherBase< C1, C2, M >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper reco::modules::Matcher< C1, C2, S, D, M >

Public Member Functions

 MatcherBase (const edm::ParameterSet &)
 
 ~MatcherBase () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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)
 

Protected Types

typedef M MatchMap
 
typedef C1::value_type T1
 
typedef C2::value_type T2
 

Private Member Functions

virtual double matchDistance (const T1 &, const T2 &) const =0
 
void produce (edm::Event &, const edm::EventSetup &) override
 
virtual bool select (const T1 &, const T2 &) const =0
 

Private Attributes

double distMin_
 
edm::EDGetTokenT< C2 > matchedToken_
 
edm::EDGetTokenT< C1 > srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

template<typename C1, typename C2, typename M = edm::AssociationMap<edm::OneToOne<C1, C2> >>
class reco::modules::MatcherBase< C1, C2, M >

Definition at line 21 of file Matcher.h.

Member Typedef Documentation

◆ MatchMap

template<typename C1, typename C2, typename M = edm::AssociationMap<edm::OneToOne<C1, C2> >>
typedef M reco::modules::MatcherBase< C1, C2, M >::MatchMap
protected

Definition at line 29 of file Matcher.h.

◆ T1

template<typename C1, typename C2, typename M = edm::AssociationMap<edm::OneToOne<C1, C2> >>
typedef C1::value_type reco::modules::MatcherBase< C1, C2, M >::T1
protected

Definition at line 27 of file Matcher.h.

◆ T2

template<typename C1, typename C2, typename M = edm::AssociationMap<edm::OneToOne<C1, C2> >>
typedef C2::value_type reco::modules::MatcherBase< C1, C2, M >::T2
protected

Definition at line 28 of file Matcher.h.

Constructor & Destructor Documentation

◆ MatcherBase()

template<typename C1 , typename C2 , typename M >
reco::modules::MatcherBase< C1, C2, M >::MatcherBase ( const edm::ParameterSet cfg)

Definition at line 71 of file Matcher.h.

72  : srcToken_(consumes<C1>(cfg.template getParameter<edm::InputTag>("src"))),
73  matchedToken_(consumes<C2>(cfg.template getParameter<edm::InputTag>("matched"))),
74  distMin_(cfg.template getParameter<double>("distMin")) {
75  produces<MatchMap>();
76  }

◆ ~MatcherBase()

template<typename C1 , typename C2 , typename M >
reco::modules::MatcherBase< C1, C2, M >::~MatcherBase ( )
override

Definition at line 79 of file Matcher.h.

79 {}

Member Function Documentation

◆ matchDistance()

template<typename C1, typename C2, typename M = edm::AssociationMap<edm::OneToOne<C1, C2> >>
virtual double reco::modules::MatcherBase< C1, C2, M >::matchDistance ( const T1 ,
const T2  
) const
privatepure virtual

◆ produce()

template<typename C1 , typename C2 , typename M >
void reco::modules::MatcherBase< C1, C2, M >::produce ( edm::Event evt,
const edm::EventSetup  
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 82 of file Matcher.h.

82  {
83  using namespace edm;
84  using namespace std;
89  typedef typename MatchMap::ref_type ref_type;
90  typedef typename ref_type::key_type key_ref_type;
91  typedef typename ref_type::value_type value_ref_type;
92  unique_ptr<MatchMap> matchMap(new MatchMap(ref_type(key_ref_type(cands), value_ref_type(matched))));
93  for (size_t c = 0; c != cands->size(); ++c) {
94  const T1& cand = (*cands)[c];
95  vector<helper::MatchPair> v;
96  for (size_t m = 0; m != matched->size(); ++m) {
97  const T2& match = (*matched)[m];
98  if (select(cand, match)) {
99  double dist = matchDistance(cand, match);
100  if (dist < distMin_)
101  v.push_back(make_pair(m, dist));
102  }
103  }
104  if (!v.empty()) {
105  size_t mMin = min_element(v.begin(), v.end(), helper::SortBySecond())->first;
106  typedef typename MatchMap::key_type key_type;
107  typedef typename MatchMap::data_type data_type;
108  matchMap->insert(edm::getRef(cands, c), edm::getRef(matched, mMin));
109  }
110  }
111  evt.put(std::move(matchMap));
112  }

◆ select()

template<typename C1, typename C2, typename M = edm::AssociationMap<edm::OneToOne<C1, C2> >>
virtual bool reco::modules::MatcherBase< C1, C2, M >::select ( const T1 ,
const T2  
) const
privatepure virtual

Member Data Documentation

◆ distMin_

template<typename C1, typename C2, typename M = edm::AssociationMap<edm::OneToOne<C1, C2> >>
double reco::modules::MatcherBase< C1, C2, M >::distMin_
private

Definition at line 35 of file Matcher.h.

◆ matchedToken_

template<typename C1, typename C2, typename M = edm::AssociationMap<edm::OneToOne<C1, C2> >>
edm::EDGetTokenT<C2> reco::modules::MatcherBase< C1, C2, M >::matchedToken_
private

Definition at line 34 of file Matcher.h.

◆ srcToken_

template<typename C1, typename C2, typename M = edm::AssociationMap<edm::OneToOne<C1, C2> >>
edm::EDGetTokenT<C1> reco::modules::MatcherBase< C1, C2, M >::srcToken_
private

Definition at line 33 of file Matcher.h.

muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::modules::MatcherBase::T1
C1::value_type T1
Definition: Matcher.h:27
findQualityFiles.v
v
Definition: findQualityFiles.py:179
reco::modules::MatcherBase::T2
C2::value_type T2
Definition: Matcher.h:28
edm::Handle
Definition: AssociativeIterator.h:50
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:78
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
reco::modules::MatcherBase::matchDistance
virtual double matchDistance(const T1 &, const T2 &) const =0
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15161
edm::getRef
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
Definition: getRef.h:28
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
cand
Definition: decayParser.h:32
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
ecal::multifit::data_type
::ecal::reco::ComputationScalarType data_type
Definition: EigenMatrixTypes_gpu.h:18
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
looper.cfg
cfg
Definition: looper.py:296
reco::modules::MatcherBase::select
virtual bool select(const T1 &, const T2 &) const =0
reco::modules::MatcherBase::matchedToken_
edm::EDGetTokenT< C2 > matchedToken_
Definition: Matcher.h:34
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
reco::modules::MatcherBase::distMin_
double distMin_
Definition: Matcher.h:35
reco::modules::MatcherBase::srcToken_
edm::EDGetTokenT< C1 > srcToken_
Definition: Matcher.h:33
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
reco::modules::MatcherBase::MatchMap
M MatchMap
Definition: Matcher.h:29