CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

MCTruthCompositeMatcher< C1, C2 > Class Template Reference

#include <MCTruthCompositeMatcher.h>

Inheritance diagram for MCTruthCompositeMatcher< C1, C2 >:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 MCTruthCompositeMatcher (const edm::ParameterSet &)
 ~MCTruthCompositeMatcher ()

Private Types

typedef CandMatcher< C1, C2 >
::map_type 
map_type

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

std::vector< edm::InputTagmatchMaps_
edm::InputTag src_

Detailed Description

template<typename C1, typename C2 = C1>
class MCTruthCompositeMatcher< C1, C2 >

Definition at line 13 of file MCTruthCompositeMatcher.h.


Member Typedef Documentation

template<typename C1 , typename C2 = C1>
typedef CandMatcher<C1, C2>::map_type MCTruthCompositeMatcher< C1, C2 >::map_type [private]

Definition at line 18 of file MCTruthCompositeMatcher.h.


Constructor & Destructor Documentation

template<typename C1 , typename C2 >
MCTruthCompositeMatcher< C1, C2 >::MCTruthCompositeMatcher ( const edm::ParameterSet cfg) [explicit]

Definition at line 29 of file MCTruthCompositeMatcher.h.

                                                                                      :
  src_( cfg.template getParameter<edm::InputTag>( "src" ) ),
  matchMaps_( cfg.template getParameter<std::vector<edm::InputTag> >( "matchMaps" ) ) {
  produces<map_type>();
}
template<typename C1 , typename C2 >
MCTruthCompositeMatcher< C1, C2 >::~MCTruthCompositeMatcher ( )

Definition at line 36 of file MCTruthCompositeMatcher.h.

                                                          {
}

Member Function Documentation

template<typename C1 , typename C2 >
void MCTruthCompositeMatcher< C1, C2 >::produce ( edm::Event evt,
const edm::EventSetup  
) [private, virtual]

Implements edm::EDProducer.

Definition at line 40 of file MCTruthCompositeMatcher.h.

References edm::Event::getByLabel(), i, match(), and edm::Event::put().

                                                                                      {
  typedef typename CandMatcher<C1, C2>::reference_type reference_type;
  Handle<C1> cands;
  evt.getByLabel(src_, cands);
  
  size_t nMaps = matchMaps_.size();
  std::vector<const map_type *> maps;
  maps.reserve( nMaps );
  for( size_t i = 0; i != nMaps; ++ i ) {
    Handle<map_type> matchMap;
    evt.getByLabel( matchMaps_[i], matchMap );
    maps.push_back( & * matchMap );
  } 
  MCCandMatcher<C1, C2> match( maps );
  auto_ptr<map_type> matchMap( new map_type );
  for( size_t i = 0; i != cands->size(); ++ i ) {
    const typename C1::value_type & cand = ( * cands )[ i ];
    reference_type mc(match( cand ));
    if ( mc.isNonnull() ) {
      matchMap->insert( reference_type( cands, i ), mc );      
    }
  }

  evt.put( matchMap );
}

Member Data Documentation

template<typename C1 , typename C2 = C1>
std::vector<edm::InputTag> MCTruthCompositeMatcher< C1, C2 >::matchMaps_ [private]

Definition at line 20 of file MCTruthCompositeMatcher.h.

template<typename C1 , typename C2 = C1>
edm::InputTag MCTruthCompositeMatcher< C1, C2 >::src_ [private]

Definition at line 19 of file MCTruthCompositeMatcher.h.