CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
reco::modulesNew::Matcher< C1, C2, S, D > Class Template Reference

#include <NewMatcher.h>

Inheritance diagram for reco::modulesNew::Matcher< C1, C2, S, D >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper reco::modulesNew::CandMatcher< S, C1, C2, D >

Public Member Functions

 Matcher (const edm::ParameterSet &cfg)
 
 ~Matcher () 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef edm::Association< C2 > MatchMap
 
typedef C1::value_type T1
 
typedef C2::value_type T2
 

Private Member Functions

double matchDistance (const T1 &c1, const T2 &c2) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 
bool select (const T1 &c1, const T2 &c2) const
 

Private Attributes

distance_
 
double distMin_
 
edm::EDGetTokenT< C2 > matchedToken_
 
S select_
 
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 S, typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
class reco::modulesNew::Matcher< C1, C2, S, D >

Definition at line 23 of file NewMatcher.h.

Member Typedef Documentation

◆ MatchMap

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
typedef edm::Association<C2> reco::modulesNew::Matcher< C1, C2, S, D >::MatchMap
private

Definition at line 31 of file NewMatcher.h.

◆ T1

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
typedef C1::value_type reco::modulesNew::Matcher< C1, C2, S, D >::T1
private

Definition at line 29 of file NewMatcher.h.

◆ T2

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
typedef C2::value_type reco::modulesNew::Matcher< C1, C2, S, D >::T2
private

Definition at line 30 of file NewMatcher.h.

Constructor & Destructor Documentation

◆ Matcher()

template<typename C1 , typename C2 , typename S , typename D >
reco::modulesNew::Matcher< C1, C2, S, D >::Matcher ( const edm::ParameterSet cfg)

Definition at line 51 of file NewMatcher.h.

52  : srcToken_(consumes<C1>(cfg.template getParameter<edm::InputTag>("src"))),
53  matchedToken_(consumes<C2>(cfg.template getParameter<edm::InputTag>("matched"))),
54  distMin_(cfg.template getParameter<double>("distMin")),
55  select_(reco::modules::make<S>(cfg)),
56  distance_(reco::modules::make<D>(cfg)) {
57  produces<MatchMap>();
58  }

◆ ~Matcher()

template<typename C1 , typename C2 , typename S , typename D >
reco::modulesNew::Matcher< C1, C2, S, D >::~Matcher ( )
override

Definition at line 61 of file NewMatcher.h.

61 {}

Member Function Documentation

◆ matchDistance()

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
double reco::modulesNew::Matcher< C1, C2, S, D >::matchDistance ( const T1 c1,
const T2 c2 
) const
inlineprivate

Definition at line 36 of file NewMatcher.h.

36 { return distance_(c1, c2); }

References alignmentValidation::c1, and reco::modulesNew::Matcher< C1, C2, S, D >::distance_.

◆ produce()

template<typename C1 , typename C2 , typename S , typename D >
void reco::modulesNew::Matcher< C1, C2, S, D >::produce ( edm::Event evt,
const edm::EventSetup  
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 64 of file NewMatcher.h.

64  {
65  using namespace edm;
66  using namespace std;
71  unique_ptr<MatchMap> matchMap(new MatchMap(matched));
72  size_t size = cands->size();
73  if (size != 0) {
74  typename MatchMap::Filler filler(*matchMap);
75  ::helper::MasterCollection<C1> master(cands, evt);
76  std::vector<int> indices(master.size(), -1);
77  for (size_t c = 0; c != size; ++c) {
78  const T1& cand = (*cands)[c];
79  vector<helper::MatchPair> v;
80  for (size_t m = 0; m != matched->size(); ++m) {
81  const T2& match = (*matched)[m];
82  if (select(cand, match)) {
83  double dist = matchDistance(cand, match);
84  if (dist < distMin_)
85  v.push_back(make_pair(m, dist));
86  }
87  }
88  if (!v.empty()) {
89  size_t idx = master.index(c);
90  assert(idx < indices.size());
91  indices[idx] = min_element(v.begin(), v.end(), helper::SortBySecond())->first;
92  }
93  }
94  filler.insert(master.get(), indices.begin(), indices.end());
95  filler.fill();
96  }
97  evt.put(std::move(matchMap));
98  }

References cms::cuda::assert(), c, HLT_FULL_cff::cands, trigObjTnPSource_cfi::filler, first, edm::Event::getByToken(), heavyIonCSV_trainingSettings::idx, bTagCombinedSVVariables_cff::indices, visualization-live-secondInstance_cfg::m, volumeBasedMagneticField_160812_cfi::master, match(), muonTagProbeFilters_cff::matched, eostools::move(), edm::Event::put(), singleTopDQM_cfi::select, findQualityFiles::size, and findQualityFiles::v.

◆ select()

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
bool reco::modulesNew::Matcher< C1, C2, S, D >::select ( const T1 c1,
const T2 c2 
) const
inlineprivate

Definition at line 37 of file NewMatcher.h.

37 { return select_(c1, c2); }

References alignmentValidation::c1, and reco::modulesNew::Matcher< C1, C2, S, D >::select_.

Member Data Documentation

◆ distance_

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
D reco::modulesNew::Matcher< C1, C2, S, D >::distance_
private

◆ distMin_

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
double reco::modulesNew::Matcher< C1, C2, S, D >::distMin_
private

Definition at line 35 of file NewMatcher.h.

◆ matchedToken_

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
edm::EDGetTokenT<C2> reco::modulesNew::Matcher< C1, C2, S, D >::matchedToken_
private

Definition at line 34 of file NewMatcher.h.

◆ select_

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
S reco::modulesNew::Matcher< C1, C2, S, D >::select_
private

Definition at line 38 of file NewMatcher.h.

Referenced by reco::modulesNew::Matcher< C1, C2, S, D >::select().

◆ srcToken_

template<typename C1 , typename C2 , typename S , typename D = DeltaR<typename C1::value_type, typename C2::value_type>>
edm::EDGetTokenT<C1> reco::modulesNew::Matcher< C1, C2, S, D >::srcToken_
private

Definition at line 33 of file NewMatcher.h.

muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
reco::modulesNew::Matcher::srcToken_
edm::EDGetTokenT< C1 > srcToken_
Definition: NewMatcher.h:33
reco::modulesNew::Matcher::MatchMap
edm::Association< C2 > MatchMap
Definition: NewMatcher.h:31
reco::modulesNew::Matcher::select_
S select_
Definition: NewMatcher.h:38
edm
HLT enums.
Definition: AlignableModifier.h:19
cms::cuda::assert
assert(be >=bs)
reco::modulesNew::Matcher::matchedToken_
edm::EDGetTokenT< C2 > matchedToken_
Definition: NewMatcher.h:34
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::Handle
Definition: AssociativeIterator.h:50
reco::modulesNew::Matcher::T2
C2::value_type T2
Definition: NewMatcher.h:30
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
reco::modulesNew::Matcher::distMin_
double distMin_
Definition: NewMatcher.h:35
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15146
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
reco::modulesNew::Matcher::distance_
D distance_
Definition: NewMatcher.h:39
cand
Definition: decayParser.h:32
reco::modulesNew::Matcher::T1
C1::value_type T1
Definition: NewMatcher.h:29
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::ValueMap< int >::Filler
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:168
reco::modulesNew::Matcher::matchDistance
double matchDistance(const T1 &c1, const T2 &c2) const
Definition: NewMatcher.h:36
looper.cfg
cfg
Definition: looper.py:297
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
reco::modulesNew::Matcher::select
bool select(const T1 &c1, const T2 &c2) const
Definition: NewMatcher.h:37
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
volumeBasedMagneticField_160812_cfi.master
master
Definition: volumeBasedMagneticField_160812_cfi.py:60
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443