CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
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)
 
- 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<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 24 of file NewMatcher.h.

Member Typedef Documentation

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.

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.

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

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

Definition at line 57 of file NewMatcher.h.

57  :
58  srcToken_(consumes<C1>(cfg.template getParameter<edm::InputTag>("src"))),
59  matchedToken_(consumes<C2>(cfg.template getParameter<edm::InputTag>("matched"))),
60  distMin_(cfg.template getParameter<double>("distMin")),
61  select_(reco::modules::make<S>(cfg)),
62  distance_(reco::modules::make<D>(cfg)) {
63  produces<MatchMap>();
64  }
edm::EDGetTokenT< C1 > srcToken_
Definition: NewMatcher.h:33
edm::EDGetTokenT< C2 > matchedToken_
Definition: NewMatcher.h:34
template<typename C1 , typename C2 , typename S , typename D >
reco::modulesNew::Matcher< C1, C2, S, D >::~Matcher ( )

Definition at line 67 of file NewMatcher.h.

67 { }

Member Function Documentation

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.

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

36  {
37  return distance_(c1, c2);
38  }
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 70 of file NewMatcher.h.

References assert(), EnergyCorrector::c, edm::helper::Filler< Map >::fill(), plotBeamSpotDB::first, helper::MasterCollection< C1 >::get(), edm::Event::getByToken(), customizeTrackingMonitorSeedNumber::idx, helper::MasterCollection< C1 >::index(), edm::helper::Filler< Map >::insert(), visualization-live-secondInstance_cfg::m, autoMagneticFieldProducer_cfi::master, match(), edm::Event::put(), benchmark_cfg::select, helper::MasterCollection< C1 >::size(), findQualityFiles::size, and findQualityFiles::v.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

70  {
71  using namespace edm;
72  using namespace std;
73  Handle<C2> matched;
74  evt.getByToken(matchedToken_, matched);
75  Handle<C1> cands;
76  evt.getByToken(srcToken_, cands);
77  auto_ptr<MatchMap> matchMap(new MatchMap(matched));
78  size_t size = cands->size();
79  if( size != 0 ) {
80  typename MatchMap::Filler filler(*matchMap);
82  std::vector<int> indices(master.size(), -1);
83  for(size_t c = 0; c != size; ++ c) {
84  const T1 & cand = (*cands)[c];
85  vector<helper::MatchPair> v;
86  for(size_t m = 0; m != matched->size(); ++m) {
87  const T2 & match = (* matched)[m];
88  if (select(cand, match)) {
89  double dist = matchDistance(cand, match);
90  if (dist < distMin_) v.push_back(make_pair(m, dist));
91  }
92  }
93  if(v.size() > 0) {
94  size_t idx = master.index(c);
95  assert(idx < indices.size());
96  indices[idx] = min_element(v.begin(), v.end(), helper::SortBySecond())->first;
97  }
98  }
99  filler.insert(master.get(), indices.begin(), indices.end());
100  filler.fill();
101  }
102  evt.put(matchMap);
103  }
edm::EDGetTokenT< C1 > srcToken_
Definition: NewMatcher.h:33
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
edm::Association< C2 > MatchMap
Definition: NewMatcher.h:31
assert(m_qm.get())
edm::EDGetTokenT< C2 > matchedToken_
Definition: NewMatcher.h:34
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
bool select(const T1 &c1, const T2 &c2) const
Definition: NewMatcher.h:39
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:170
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
double matchDistance(const T1 &c1, const T2 &c2) const
Definition: NewMatcher.h:36
tuple size
Write out results.
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

Member Data Documentation

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
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.

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.

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 42 of file NewMatcher.h.

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

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.