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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 21 of file MCTruthCompositeMatcherNew.cc.

Constructor & Destructor Documentation

◆ MCTruthCompositeMatcher()

reco::modulesNew::MCTruthCompositeMatcher::MCTruthCompositeMatcher ( const edm::ParameterSet cfg)
explicit

Definition at line 33 of file MCTruthCompositeMatcherNew.cc.

34  : srcToken_(consumes<CandidateView>(cfg.getParameter<edm::InputTag>("src"))),
36  cfg.template getParameter<std::vector<edm::InputTag> >("matchMaps"),
37  [this](edm::InputTag const &tag) { return consumes<reco::GenParticleMatch>(tag); })),
38  pdgId_(cfg.getParameter<std::vector<int> >("matchPDGId")) {
39  produces<reco::GenParticleMatch>();
40  }

References GlobalPosition_Frontier_DevDB_cff::tag.

◆ ~MCTruthCompositeMatcher()

reco::modulesNew::MCTruthCompositeMatcher::~MCTruthCompositeMatcher ( )
override

Definition at line 42 of file MCTruthCompositeMatcherNew.cc.

42 {}

Member Function Documentation

◆ produce()

void reco::modulesNew::MCTruthCompositeMatcher::produce ( edm::Event evt,
const edm::EventSetup  
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 44 of file MCTruthCompositeMatcherNew.cc.

44  {
45  using namespace edm;
46  using namespace std;
49  size_t nMaps = matchMapTokens_.size();
50  std::vector<const GenParticleMatch *> maps;
51  maps.reserve(nMaps);
52  for (size_t i = 0; i != nMaps; ++i) {
54  evt.getByToken(matchMapTokens_[i], matchMap);
55  maps.push_back(&*matchMap);
56  }
57  utilsNew::CandMatcher<GenParticleCollection> match(maps);
58  auto matchMap = std::make_unique<GenParticleMatch>(match.ref());
59  int size = cands->size();
60  vector<int>::const_iterator begin = pdgId_.begin(), end = pdgId_.end();
61  if (size != 0) {
63  vector<int> indices(size);
64  for (int i = 0; i != size; ++i) {
65  const Candidate &cand = (*cands)[i];
67  if (mc.isNull()) {
68  indices[i] = -1;
69  } else {
70  bool found = true;
71  if (begin != end)
72  found = find(begin, end, std::abs(mc->pdgId())) != end;
73  indices[i] = found ? int(mc.key()) : -1;
74  }
75  }
77  filler.insert(ref, indices.begin(), indices.end());
78  filler.fill();
79  }
80  evt.put(std::move(matchMap));
81  }

References funct::abs(), HLT_FULL_cff::cands, mps_fire::end, trigObjTnPSource_cfi::filler, spr::find(), newFWLiteAna::found, edm::Event::getByToken(), mps_fire::i, bTagCombinedSVVariables_cff::indices, createfilelist::int, edm::makeRefToBaseProdFrom(), match(), matchMapTokens_, CaloTowersParam_cfi::mc, eostools::move(), pdgId_, edm::Event::put(), findQualityFiles::size, and srcToken_.

Member Data Documentation

◆ matchMapTokens_

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

Definition at line 28 of file MCTruthCompositeMatcherNew.cc.

Referenced by produce().

◆ pdgId_

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

Definition at line 29 of file MCTruthCompositeMatcherNew.cc.

Referenced by produce().

◆ srcToken_

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

Definition at line 27 of file MCTruthCompositeMatcherNew.cc.

Referenced by produce().

bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
mps_fire.i
i
Definition: mps_fire.py:428
configurableAnalysis::Candidate
char Candidate[]
Definition: modules.cc:20
CaloTowersParam_cfi.mc
mc
Definition: CaloTowersParam_cfi.py:8
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::modulesNew::MCTruthCompositeMatcher::matchMapTokens_
std::vector< edm::EDGetTokenT< reco::GenParticleMatch > > matchMapTokens_
Definition: MCTruthCompositeMatcherNew.cc:28
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
reco::modulesNew::MCTruthCompositeMatcher::pdgId_
std::vector< int > pdgId_
Definition: MCTruthCompositeMatcherNew.cc:29
reco::CandidateBaseRefProd
edm::RefToBaseProd< Candidate > CandidateBaseRefProd
vector of references to objects in the same collection of Candidate objects via base type
Definition: CandidateFwd.h:39
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
mps_fire.end
end
Definition: mps_fire.py:242
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
edm::vector_transform
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
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15146
edm::makeRefToBaseProdFrom
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
Definition: makeRefToBaseProdFrom.h:34
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
cand
Definition: decayParser.h:32
createfilelist.int
int
Definition: createfilelist.py:10
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::ValueMap< int >::Filler
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:168
looper.cfg
cfg
Definition: looper.py:297
reco::modulesNew::MCTruthCompositeMatcher::srcToken_
edm::EDGetTokenT< CandidateView > srcToken_
Definition: MCTruthCompositeMatcherNew.cc:27
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::InputTag
Definition: InputTag.h:15
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443