CMS 3D CMS Logo

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 std::vector< const map_type * > map_vector
 
typedef edm::Association< C >::reference_type reference_type
 ref type More...
 

Public Member Functions

 CandMatcher (const map_type &map)
 constructor More...
 
 CandMatcher (const map_vector &maps)
 constructor 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...
 
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

◆ map_type

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

map type

Definition at line 22 of file CandMatcherNew.h.

◆ map_vector

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

Definition at line 25 of file CandMatcherNew.h.

◆ reference_type

ref type

Definition at line 24 of file CandMatcherNew.h.

Constructor & Destructor Documentation

◆ CandMatcher() [1/2]

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

constructor

◆ CandMatcher() [2/2]

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

constructor

◆ ~CandMatcher()

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

destructor

Definition at line 54 of file CandMatcherNew.h.

54 {}

Member Function Documentation

◆ operator[]()

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

get match from transient reference

Definition at line 57 of file CandMatcherNew.h.

57  {
58  using namespace reco;
59  using namespace std;
60  if (c.hasMasterClone()) {
61  const CandidateBaseRef &master = c.masterClone();
62  return master->numberOfDaughters() == 0 ? map_[master] : (*this)[*master];
63  }
64  size_t nDau = c.numberOfDaughters();
65  if (nDau == 0)
66  return reference_type();
67  set<size_t> momIdx, common, tmp;
68  for (size_t i = 0; i < nDau; ++i) {
69  const Candidate &d = *c.daughter(i);
70  reference_type m = (*this)[d];
71  if (m.isNull())
72  return reference_type();
73  momIdx.clear();
74  while (m->numberOfMothers() == 1) {
75  m = m->motherRef();
76  momIdx.insert(m.key());
77  }
78  if (momIdx.empty())
79  return reference_type();
80  if (common.empty())
81  common = momIdx;
82  else {
83  tmp.clear();
84  set_intersection(common.begin(), common.end(), momIdx.begin(), momIdx.end(), inserter(tmp, tmp.begin()));
85  swap(common, tmp);
86  }
87  if (common.empty())
88  return reference_type();
89  }
90  size_t idx = *max_element(common.begin(), common.end());
91  return reference_type(map_.ref(), idx);
92  }

References HltBtagPostValidation_cff::c, trackingPlots::common, ztail::d, mps_fire::i, charmTagsComputerCvsB_cfi::idx, visualization-live-secondInstance_cfg::m, volumeBasedMagneticField_160812_cfi::master, reco::swap(), and createJobs::tmp.

◆ ref()

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.

35 { return map_.ref(); }

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

Member Data Documentation

◆ map_

template<typename C>
map_type reco::utilsNew::CandMatcher< C >::map_
protected

match map at leaf level

Definition at line 39 of file CandMatcherNew.h.

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

mps_fire.i
i
Definition: mps_fire.py:355
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
reco::utilsNew::CandMatcher::map_
map_type map_
match map at leaf level
Definition: CandMatcherNew.h:39
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::Association::ref
refprod_type ref() const
Definition: Association.h:67
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
reco::Candidate
Definition: Candidate.h:27
std
Definition: JetResolutionObject.h:76
reco::utilsNew::CandMatcher::reference_type
edm::Association< C >::reference_type reference_type
ref type
Definition: CandMatcherNew.h:24
edm::RefToBase< Candidate >
reco::swap
void swap(reco::ClusterRemovalInfo &cri1, reco::ClusterRemovalInfo &cri2)
Definition: ClusterRemovalInfo.cc:12
ztail.d
d
Definition: ztail.py:151
volumeBasedMagneticField_160812_cfi.master
master
Definition: volumeBasedMagneticField_160812_cfi.py:60
trackingPlots.common
common
Definition: trackingPlots.py:205
common
Definition: common.py:1