CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
reco::modulesNew::MCTruthCompositeMatcher Class Reference
Inheritance diagram for reco::modulesNew::MCTruthCompositeMatcher:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MCTruthCompositeMatcher (const edm::ParameterSet &)
 
 ~MCTruthCompositeMatcher () override
 
- 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 Member Functions

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

Private Attributes

std::vector< edm::EDGetTokenT< reco::GenParticleMatch > > matchMapTokens_
 
std::vector< int > pdgId_
 
edm::EDGetTokenT< CandidateViewsrcToken_
 

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

Definition at line 21 of file MCTruthCompositeMatcherNew.cc.

Constructor & Destructor Documentation

Definition at line 32 of file MCTruthCompositeMatcherNew.cc.

References looper::cfg, pdgId_, and GlobalPosition_Frontier_DevDB_cff::tag.

32  :
33  srcToken_(consumes<CandidateView>(cfg.getParameter<edm::InputTag>("src"))),
34  matchMapTokens_( edm::vector_transform(cfg.template getParameter<std::vector<edm::InputTag> >( "matchMaps" ), [this](edm::InputTag const & tag){return consumes<reco::GenParticleMatch>(tag);} ) ),
35  pdgId_(cfg.getParameter<std::vector<int> >("matchPDGId")) {
36  produces<reco::GenParticleMatch>();
37  }
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< reco::GenParticleMatch > > 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

Definition at line 39 of file MCTruthCompositeMatcherNew.cc.

39  {
40  }

Member Function Documentation

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

Definition at line 42 of file MCTruthCompositeMatcherNew.cc.

References funct::abs(), begin, egammaForCoreTracking_cff::cands, end, edm::helper::Filler< Map >::fill(), objects.autophobj::filler, spr::find(), runEdmFileComparison::found, edm::Event::getByToken(), mps_fire::i, edm::helper::Filler< Map >::insert(), createfilelist::int, edm::Ref< C, T, F >::isNull(), edm::Ref< C, T, F >::key(), edm::makeRefToBaseProdFrom(), match(), matchMapTokens_, CaloTowersParam_cfi::mc, eostools::move(), pdgId_, edm::Event::put(), reco::utilsNew::CandMatcher< C >::ref(), findQualityFiles::size, and srcToken_.

42  {
43  using namespace edm;
44  using namespace std;
46  evt.getByToken(srcToken_, cands);
47  size_t nMaps = matchMapTokens_.size();
48  std::vector<const GenParticleMatch *> maps;
49  maps.reserve( nMaps );
50  for( size_t i = 0; i != nMaps; ++ i ) {
52  evt.getByToken(matchMapTokens_[i], matchMap);
53  maps.push_back(& * matchMap);
54  }
55  utilsNew::CandMatcher<GenParticleCollection> match(maps);
56  auto matchMap = std::make_unique<GenParticleMatch>(match.ref());
57  int size = cands->size();
58  vector<int>::const_iterator begin = pdgId_.begin(), end = pdgId_.end();
59  if(size != 0) {
61  vector<int> indices(size);
62  for(int i = 0; i != size; ++ i) {
63  const Candidate & cand = (* cands)[i];
64  GenParticleRef mc = match[cand];
65  if(mc.isNull()) {
66  indices[i] = -1;
67  } else {
68  bool found = true;
69  if(begin!=end) found = find(begin, end, std::abs(mc->pdgId())) != end;
70  indices[i] = found ? int(mc.key()) : -1;
71  }
72  }
73  CandidateBaseRefProd ref(edm::makeRefToBaseProdFrom(cands->refAt(0), evt));
74  filler.insert(ref, indices.begin(), indices.end());
75  filler.fill();
76  }
77  evt.put(std::move(matchMap));
78  }
size
Write out results.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
std::vector< edm::EDGetTokenT< reco::GenParticleMatch > > matchMapTokens_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
key_type key() const
Accessor for product key.
Definition: Ref.h:265
edm::RefToBaseProd< Candidate > CandidateBaseRefProd
vector of references to objects in the same collection of Candidate objects via base type ...
Definition: CandidateFwd.h:39
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define end
Definition: vmac.h:39
bool isNull() const
Checks for null.
Definition: Ref.h:250
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:169
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
#define begin
Definition: vmac.h:32
HLT enums.
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

std::vector<edm::EDGetTokenT<reco::GenParticleMatch> > reco::modulesNew::MCTruthCompositeMatcher::matchMapTokens_
private

Definition at line 27 of file MCTruthCompositeMatcherNew.cc.

Referenced by produce().

std::vector<int> reco::modulesNew::MCTruthCompositeMatcher::pdgId_
private

Definition at line 28 of file MCTruthCompositeMatcherNew.cc.

Referenced by MCTruthCompositeMatcher(), and produce().

edm::EDGetTokenT<CandidateView> reco::modulesNew::MCTruthCompositeMatcher::srcToken_
private

Definition at line 26 of file MCTruthCompositeMatcherNew.cc.

Referenced by produce().