CMS 3D CMS Logo

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 ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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);} ) ) {
33  produces<map_type>();
34 }
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  
)
overrideprivate

Definition at line 41 of file MCTruthCompositeMatcher.h.

References egammaForCoreTracking_cff::cands, edm::Event::getByToken(), mps_fire::i, match(), MCTruthCompositeMatcher< C1, C2 >::matchMapTokens_, CaloTowersParam_cfi::mc, eostools::move(), edm::Event::put(), and MCTruthCompositeMatcher< C1, C2 >::srcToken_.

41  {
42  typedef typename CandMatcher<C1, C2>::reference_type reference_type;
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 matchMap = std::make_unique<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(std::move(matchMap) );
65 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::vector< edm::EDGetTokenT< map_type > > matchMapTokens_
edm::EDGetTokenT< C1 > srcToken_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
map_type::key_type reference_type
concrete candidate reference type
Definition: CandMatcher.h:27
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

template<typename C1 , typename C2 = C1>
std::vector<edm::EDGetTokenT<map_type> > MCTruthCompositeMatcher< C1, C2 >::matchMapTokens_
private
template<typename C1 , typename C2 = C1>
edm::EDGetTokenT<C1> MCTruthCompositeMatcher< C1, C2 >::srcToken_
private