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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MCTruthCompositeMatcher (const edm::ParameterSet &)
 
 ~MCTruthCompositeMatcher ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef CandMatcher< C1, C2 >
::map_type 
map_type
 

Private Member Functions

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

Private Attributes

std::vector< edm::EDGetTokenT
< map_type > > 
matchMapTokens_
 
edm::EDGetTokenT< C1 > srcToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 30 of file MCTruthCompositeMatcher.h.

References GlobalPosition_Frontier_DevDB_cff::tag.

30  :
31  srcToken_( consumes<C1>(cfg.template getParameter<edm::InputTag>( "src" ) ) ),
32  matchMapTokens_( edm::vector_transform(cfg.template getParameter<std::vector<edm::InputTag> >( "matchMaps" ), [this](edm::InputTag const & tag){return consumes<map_type>(tag);} ) ) {
std::vector< edm::EDGetTokenT< map_type > > matchMapTokens_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
edm::EDGetTokenT< C1 > srcToken_
template<typename C1 , typename C2 >
MCTruthCompositeMatcher< C1, C2 >::~MCTruthCompositeMatcher ( )

Definition at line 37 of file MCTruthCompositeMatcher.h.

37  {
38 }

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 41 of file MCTruthCompositeMatcher.h.

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

41  {
42  typedef typename CandMatcher<C1, C2>::reference_type reference_type;
43  Handle<C1> cands;
44  evt.getByToken(srcToken_, cands);
45 
46  size_t nMaps = matchMaps_.size();
47  std::vector<const map_type *> maps;
48  maps.reserve( nMaps );
49  for( size_t i = 0; i != nMaps; ++ i ) {
50  Handle<map_type> matchMap;
51  evt.getByToken( matchMapTokens_[i], matchMap );
52  maps.push_back( & * matchMap );
53  }
54  MCCandMatcher<C1, C2> match( maps );
55  auto_ptr<map_type> matchMap( new map_type );
56  for( size_t i = 0; i != cands->size(); ++ i ) {
57  const typename C1::value_type & cand = ( * cands )[ i ];
58  reference_type mc(match( cand ));
59  if ( mc.isNonnull() ) {
60  matchMap->insert( reference_type( cands, i ), mc );
61  }
62  }
63 
64  evt.put( matchMap );
65 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::vector< edm::EDGetTokenT< map_type > > matchMapTokens_
CandMatcher< C1, C2 >::map_type map_type
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
edm::EDGetTokenT< C1 > srcToken_
Container::value_type value_type
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::EDGetTokenT<map_type> > MCTruthCompositeMatcher< C1, C2 >::matchMapTokens_
private

Definition at line 20 of file MCTruthCompositeMatcher.h.

template<typename C1 , typename C2 = C1>
edm::EDGetTokenT<C1> MCTruthCompositeMatcher< C1, C2 >::srcToken_
private

Definition at line 19 of file MCTruthCompositeMatcher.h.