CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::InputTag matched_
 
edm::InputTag src_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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

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.

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.

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

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

Definition at line 76 of file Matcher.h.

76  :
77  src_( cfg.template getParameter<edm::InputTag>( "src" ) ),
78  matched_( cfg.template getParameter<edm::InputTag>( "matched" ) ),
79  distMin_( cfg.template getParameter<double>( "distMin" ) ) {
80  produces<MatchMap>();
81  }
edm::InputTag matched_
Definition: Matcher.h:34
edm::InputTag src_
Definition: Matcher.h:33
template<typename C1 , typename C2 , typename M >
reco::modules::MatcherBase< C1, C2, M >::~MatcherBase ( )

Definition at line 84 of file Matcher.h.

84 { }

Member Function Documentation

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
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 87 of file Matcher.h.

References trackerHits::c, first, edm::Event::getByLabel(), edm::getRef(), m, match(), edm::Event::put(), benchmark_cfg::select, and findQualityFiles::v.

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

87  {
88  using namespace edm;
89  using namespace std;
90  Handle<C2> matched;
91  evt.getByLabel( matched_, matched );
92  Handle<C1> cands;
93  evt.getByLabel( src_, cands );
94  typedef typename MatchMap::ref_type ref_type;
95  typedef typename ref_type::key_type key_ref_type;
96  typedef typename ref_type::value_type value_ref_type;
97  auto_ptr<MatchMap> matchMap( new MatchMap( ref_type( key_ref_type( cands ),
98  value_ref_type( matched ) ) ) );
99  for( size_t c = 0; c != cands->size(); ++ c ) {
100  const T1 & cand = (*cands)[ c ];
101  vector<helper::MatchPair> v;
102  for( size_t m = 0; m != matched->size(); ++ m ) {
103  const T2 & match = ( * matched )[ m ];
104  if ( select( cand, match ) ) {
105  double dist = matchDistance( cand, match );
106  if ( dist < distMin_ ) v.push_back( make_pair( m, dist ) );
107  }
108  }
109  if ( v.size() > 0 ) {
110  size_t mMin = min_element( v.begin(), v.end(), helper::SortBySecond() )->first;
111  typedef typename MatchMap::key_type key_type;
112  typedef typename MatchMap::data_type data_type;
113  matchMap->insert( edm::getRef( cands, c ), edm::getRef( matched, mMin ) );
114  }
115  }
116  evt.put( matchMap );
117  }
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
Definition: getRef.h:28
virtual bool select(const T1 &, const T2 &) const =0
edm::InputTag matched_
Definition: Matcher.h:34
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
virtual double matchDistance(const T1 &, const T2 &) const =0
bool first
Definition: L1TdeRCT.cc:94
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
C1::value_type T1
Definition: Matcher.h:27
C2::value_type T2
Definition: Matcher.h:28
edm::InputTag src_
Definition: Matcher.h:33
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
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

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.

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

Definition at line 34 of file Matcher.h.

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

Definition at line 33 of file Matcher.h.