CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Attributes
reco::utilsNew::CandMatcher< C > Class Template Reference

#include <CandMatcherNew.h>

Public Types

typedef edm::Association< C > map_type
 map type More...
 
typedef edm::Association< C > map_type
 map type More...
 
typedef std::vector< const
map_type * > 
map_vector
 
typedef std::vector< const
map_type * > 
map_vector
 
typedef edm::Association< C >
::reference_type 
reference_type
 ref type More...
 
typedef edm::Association< C >
::reference_type 
reference_type
 ref type More...
 

Public Member Functions

 CandMatcher (const map_vector &maps)
 constructor More...
 
 CandMatcher (const map_vector &maps)
 constructor More...
 
 CandMatcher (const map_type &map)
 constructor More...
 
 CandMatcher (const map_type &map)
 constructor More...
 
reference_type operator[] (const reco::Candidate &) const
 get match from transient reference More...
 
reference_type operator[] (const reco::Candidate &) const
 get match from transient reference More...
 
map_type::refprod_type ref () const
 reference to matched collection More...
 
map_type::refprod_type ref () const
 reference to matched collection More...
 
virtual ~CandMatcher ()
 destructor More...
 
virtual ~CandMatcher ()
 destructor More...
 

Protected Attributes

map_type map_
 match map at leaf level More...
 

Detailed Description

template<typename C>
class reco::utilsNew::CandMatcher< C >

Definition at line 19 of file CandMatcherNew.h.

Member Typedef Documentation

template<typename C>
typedef edm::Association<C> reco::utilsNew::CandMatcher< C >::map_type

map type

Definition at line 22 of file CandMatcherNew.h.

template<typename C>
typedef edm::Association<C> reco::utilsNew::CandMatcher< C >::map_type

map type

Definition at line 22 of file CandMatcherNew.h.

template<typename C>
typedef std::vector<const map_type *> reco::utilsNew::CandMatcher< C >::map_vector

Definition at line 25 of file CandMatcherNew.h.

template<typename C>
typedef std::vector<const map_type *> reco::utilsNew::CandMatcher< C >::map_vector

Definition at line 25 of file CandMatcherNew.h.

ref type

Definition at line 24 of file CandMatcherNew.h.

ref type

Definition at line 24 of file CandMatcherNew.h.

Constructor & Destructor Documentation

template<typename C>
reco::utilsNew::CandMatcher< C >::CandMatcher ( const map_vector maps)
explicit

constructor

template<typename C>
reco::utilsNew::CandMatcher< C >::CandMatcher ( const map_type map)
explicit

constructor

template<typename C >
CandMatcher< C >::~CandMatcher ( )
virtual

destructor

Definition at line 56 of file CandMatcherNew.h.

56  {
57  }
template<typename C>
reco::utilsNew::CandMatcher< C >::CandMatcher ( const map_vector maps)
explicit

constructor

template<typename C>
reco::utilsNew::CandMatcher< C >::CandMatcher ( const map_type map)
explicit

constructor

template<typename C>
virtual reco::utilsNew::CandMatcher< C >::~CandMatcher ( )
virtual

destructor

Member Function Documentation

template<typename C >
CandMatcher< C >::reference_type CandMatcher< C >::operator[] ( const reco::Candidate c) const

get match from transient reference

Definition at line 60 of file CandMatcherNew.h.

References ztail::d, reco::Candidate::daughter(), reco::Candidate::hasMasterClone(), i, customizeTrackingMonitorSeedNumber::idx, edm::Ref< C, T, F >::isNull(), edm::Ref< C, T, F >::key(), visualization-live-secondInstance_cfg::m, map_, autoMagneticFieldProducer_cfi::master, reco::Candidate::masterClone(), reco::Candidate::numberOfDaughters(), dt_dqm_sourceclient_common_cff::reco, reco::swap(), and tmp.

60  {
61  using namespace reco;
62  using namespace std;
63  if (c.hasMasterClone()) {
65  return master->numberOfDaughters() == 0 ? map_[master] : (*this)[*master];
66  }
67  size_t nDau = c.numberOfDaughters();
68  if(nDau == 0) return reference_type();
69  set<size_t> momIdx, common, tmp;
70  for(size_t i = 0; i < nDau; ++ i) {
71  const Candidate & d = * c.daughter(i);
72  reference_type m = (*this)[d];
73  if (m.isNull()) return reference_type();
74  momIdx.clear();
75  while(m->numberOfMothers() == 1) {
76  m = m->motherRef();
77  momIdx.insert(m.key());
78  }
79  if(momIdx.size() == 0) return reference_type();
80  if (common.size() == 0) common = momIdx;
81  else {
82  tmp.clear();
83  set_intersection(common.begin(), common.end(),
84  momIdx.begin(), momIdx.end(),
85  inserter(tmp, tmp.begin()));
86  swap(common, tmp);
87  }
88  if (common.size() == 0) return reference_type();
89  }
90  size_t idx = * max_element(common.begin(), common.end());
91  return reference_type(map_.ref(), idx);
92  }
int i
Definition: DBlmapReader.cc:9
refprod_type ref() const
Definition: Association.h:66
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
tuple d
Definition: ztail.py:151
virtual size_type numberOfDaughters() const =0
number of daughters
virtual bool hasMasterClone() const =0
map_type map_
match map at leaf level
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::Association< C >::reference_type reference_type
ref type
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void swap(reco::ClusterRemovalInfo &cri1, reco::ClusterRemovalInfo &cri2)
virtual const CandidateBaseRef & masterClone() const =0
template<typename C>
reference_type reco::utilsNew::CandMatcher< C >::operator[] ( const reco::Candidate ) const

get match from transient reference

template<typename C>
map_type::refprod_type reco::utilsNew::CandMatcher< C >::ref ( ) const
inline

reference to matched collection

Definition at line 35 of file CandMatcherNew.h.

References reco::utilsNew::CandMatcher< C >::map_, and edm::Association< C >::ref().

35 { return map_.ref(); }
refprod_type ref() const
Definition: Association.h:66
map_type map_
match map at leaf level
template<typename C>
map_type::refprod_type reco::utilsNew::CandMatcher< C >::ref ( ) const
inline

reference to matched collection

Definition at line 35 of file CandMatcherNew.h.

References reco::utilsNew::CandMatcher< C >::map_, and edm::Association< C >::ref().

Referenced by reco::modulesNew::MCTruthCompositeMatcher::produce().

35 { return map_.ref(); }
refprod_type ref() const
Definition: Association.h:66
map_type map_
match map at leaf level

Member Data Documentation

template<typename C>
map_type CandMatcher< C1, C2 >::map_
protected

match map at leaf level

Definition at line 38 of file CandMatcherNew.h.

Referenced by reco::utilsNew::CandMatcher< C >::ref().