CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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

Public Member Functions

 MCTruthCompositeMatcher (const edm::ParameterSet &)
 
 ~MCTruthCompositeMatcher ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 

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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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.

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

Definition at line 36 of file MCTruthCompositeMatcher.h.

36  {
37 }

Member Function Documentation

template<typename C1 , typename C2 >
void MCTruthCompositeMatcher< C1, C2 >::produce ( edm::Event evt,
const edm::EventSetup  
)
privatevirtual

Implements edm::EDProducer.

Definition at line 40 of file MCTruthCompositeMatcher.h.

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

40  {
41  typedef typename CandMatcher<C1, C2>::reference_type reference_type;
42  Handle<C1> cands;
43  evt.getByLabel(src_, cands);
44 
45  size_t nMaps = matchMaps_.size();
46  std::vector<const map_type *> maps;
47  maps.reserve( nMaps );
48  for( size_t i = 0; i != nMaps; ++ i ) {
49  Handle<map_type> matchMap;
50  evt.getByLabel( matchMaps_[i], matchMap );
51  maps.push_back( & * matchMap );
52  }
53  MCCandMatcher<C1, C2> match( maps );
54  auto_ptr<map_type> matchMap( new map_type );
55  for( size_t i = 0; i != cands->size(); ++ i ) {
56  const typename C1::value_type & cand = ( * cands )[ i ];
57  reference_type mc(match( cand ));
58  if ( mc.isNonnull() ) {
59  matchMap->insert( reference_type( cands, i ), mc );
60  }
61  }
62 
63  evt.put( matchMap );
64 }
int i
Definition: DBlmapReader.cc:9
std::vector< edm::InputTag > matchMaps_
CandMatcher< C1, C2 >::map_type map_type
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
Container::value_type value_type
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
map_type::key_type reference_type
concrete candidate reference type
Definition: CandMatcher.h:27

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.