CMS 3D CMS Logo

Public Types | Public Member Functions | Protected Attributes

reco::utilsNew::CandMatcher< C > Class Template Reference

#include <CandMatcherNew.h>

List of all members.

Public Types

typedef edm::Association< C > map_type
 map type
typedef edm::Association< C > map_type
 map type
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
typedef edm::Association< C >
::reference_type 
reference_type
 ref type

Public Member Functions

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

Protected Attributes

map_type map_
 match map at leaf level

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.

                                 {
    }
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 reco::Candidate::daughter(), reco::Candidate::hasMasterClone(), i, UserOptions_cff::idx, edm::Ref< C, T, F >::isNull(), edm::Ref< C, T, F >::key(), m, funct::master(), reco::Candidate::masterClone(), reco::Candidate::numberOfDaughters(), dt_dqm_sourceclient_common_cff::reco, reco::swap(), and tmp.

                                                                                                  {
      using namespace reco;
      using namespace std;
      if (c.hasMasterClone()) {
        CandidateBaseRef master = c.masterClone();
        return master->numberOfDaughters() == 0 ? map_[master] : (*this)[*master];
      }
      size_t nDau = c.numberOfDaughters();
      if(nDau == 0) return reference_type();
      set<size_t> momIdx, common, tmp;
      for(size_t i = 0; i < nDau; ++ i) {
        const Candidate & d = * c.daughter(i);
        reference_type m = (*this)[d];
        if (m.isNull()) return reference_type();
        momIdx.clear();
        while(m->numberOfMothers() == 1) {
          m = m->motherRef();
          momIdx.insert(m.key());
        } 
        if(momIdx.size() == 0) return reference_type();
        if (common.size() == 0) common = momIdx;
        else {
          tmp.clear();
          set_intersection(common.begin(), common.end(),
                           momIdx.begin(), momIdx.end(),
                           inserter(tmp, tmp.begin()));
          swap(common, tmp);
        }
        if (common.size() == 0) return reference_type();
      }
      size_t idx = * max_element(common.begin(), common.end());
      return reference_type(map_.ref(), idx);
    }
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().

{ return map_.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.

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

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

{ return map_.ref(); }

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