CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
MatchedProbeMaker< T > Class Template Reference

#include <MatchedProbeMaker.h>

Inheritance diagram for MatchedProbeMaker< T >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< Tcollection
 
- 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
 

Public Member Functions

 MatchedProbeMaker (const edm::ParameterSet &iConfig)
 
 ~MatchedProbeMaker () 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::vector< ModuleDescription const * > &modules, 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 beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::InputTag m_candidateSource
 
edm::InputTag m_referenceSource
 
edm::InputTag m_resMatchMapSource
 
bool matched_
 

Additional Inherited Members

- 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

template<typename T>
class MatchedProbeMaker< T >

Definition at line 30 of file MatchedProbeMaker.h.

Member Typedef Documentation

◆ collection

template<typename T >
typedef std::vector<T> MatchedProbeMaker< T >::collection

Definition at line 32 of file MatchedProbeMaker.h.

Constructor & Destructor Documentation

◆ MatchedProbeMaker()

template<typename T >
MatchedProbeMaker< T >::MatchedProbeMaker ( const edm::ParameterSet iConfig)
explicit

Definition at line 52 of file MatchedProbeMaker.h.

53  : m_candidateSource(iConfig.getUntrackedParameter<edm::InputTag>("CandidateSource")),
54  m_referenceSource(iConfig.getUntrackedParameter<edm::InputTag>("ReferenceSource")),
55  m_resMatchMapSource(iConfig.getUntrackedParameter<edm::InputTag>("ResMatchMapSource", edm::InputTag("Dummy"))),
56  matched_(iConfig.getUntrackedParameter<bool>("Matched", true)) {
57  //register your products
58  produces<edm::RefVector<collection> >();
59 }

◆ ~MatchedProbeMaker()

template<typename T >
MatchedProbeMaker< T >::~MatchedProbeMaker ( )
override

Definition at line 62 of file MatchedProbeMaker.h.

62 {}

Member Function Documentation

◆ beginJob()

template<typename T >
void MatchedProbeMaker< T >::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 133 of file MatchedProbeMaker.h.

133 {}

◆ endJob()

template<typename T >
void MatchedProbeMaker< T >::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 137 of file MatchedProbeMaker.h.

137 {}

◆ produce()

template<typename T >
void MatchedProbeMaker< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 65 of file MatchedProbeMaker.h.

65  {
66  LogDebug("MatchedProbeMaker");
67 
68  using namespace edm;
69  using namespace reco;
70 
71  std::unique_ptr<edm::RefVector<collection> > outputCollection_matched(new edm::RefVector<collection>);
72  std::unique_ptr<edm::RefVector<collection> > outputCollection_unmatched(new edm::RefVector<collection>);
73 
74  // Get the candidates from the event
76  iEvent.getByLabel(m_candidateSource, Cands);
77 
79  iEvent.getByLabel(m_referenceSource, Refs);
80 
81  // Get the resolution matching map from the event
83 
84  if (iEvent.getByLabel(m_resMatchMapSource, ResMatchMap)) {
85  // Loop over the candidates looking for a match
86  for (unsigned i = 0; i < Cands->size(); i++) {
87  const edm::Ref<collection> CandRef = (*Cands)[i];
88  reco::CandidateBaseRef candBaseRef(CandRef);
89 
90  // Loop over match map
91  reco::CandViewMatchMap::const_iterator f = ResMatchMap->find(candBaseRef);
92  if (f != ResMatchMap->end()) {
93  outputCollection_matched->push_back(CandRef);
94  } else {
95  outputCollection_unmatched->push_back(CandRef);
96  }
97  }
98  } else {
100 
101  // Loop over the candidates looking for a match
102  for (unsigned i = 0; i < Cands->size(); i++) {
103  const edm::Ref<collection> CandRef = (*Cands)[i];
104  //RefToBase<Candidate> CandRef(Cands, i);
105  reco::CandidateBaseRef candBaseRef(CandRef);
106 
107  bool ppass = false;
108 
109  for (unsigned j = 0; j < Refs->size(); j++) {
110  //const edm::Ref< collection > RefRef = (*Refs)[j];
111  RefToBase<Candidate> RefRef(Refs, j);
112 
113  if (overlap(*CandRef, *RefRef)) {
114  ppass = true;
115  }
116  }
117 
118  if (ppass)
119  outputCollection_matched->push_back(CandRef);
120  else
121  outputCollection_unmatched->push_back(CandRef);
122  }
123  }
124 
125  if (matched_)
126  iEvent.put(std::move(outputCollection_matched));
127  else
128  iEvent.put(std::move(outputCollection_unmatched));
129 }

References edm::AssociationMap< Tag >::end(), f, edm::AssociationMap< Tag >::find(), mps_fire::i, iEvent, dqmiolumiharvest::j, LogDebug, eostools::move(), goodZToMuMu_cfi::overlap, and edm::View< T >::size().

Member Data Documentation

◆ m_candidateSource

template<typename T >
edm::InputTag MatchedProbeMaker< T >::m_candidateSource
private

Definition at line 44 of file MatchedProbeMaker.h.

◆ m_referenceSource

template<typename T >
edm::InputTag MatchedProbeMaker< T >::m_referenceSource
private

Definition at line 45 of file MatchedProbeMaker.h.

◆ m_resMatchMapSource

template<typename T >
edm::InputTag MatchedProbeMaker< T >::m_resMatchMapSource
private

Definition at line 46 of file MatchedProbeMaker.h.

◆ matched_

template<typename T >
bool MatchedProbeMaker< T >::matched_
private

Definition at line 48 of file MatchedProbeMaker.h.

MatchedProbeMaker::matched_
bool matched_
Definition: MatchedProbeMaker.h:48
OverlapChecker
Definition: OverlapChecker.h:17
edm::AssociationMap::find
const_iterator find(const key_type &k) const
find element with specified reference key
Definition: AssociationMap.h:173
mps_fire.i
i
Definition: mps_fire.py:428
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
MatchedProbeMaker::m_referenceSource
edm::InputTag m_referenceSource
Definition: MatchedProbeMaker.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
MatchedProbeMaker::m_resMatchMapSource
edm::InputTag m_resMatchMapSource
Definition: MatchedProbeMaker.h:46
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::RefVector
Definition: EDProductfwd.h:27
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
edm::View::size
size_type size() const
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
iEvent
int iEvent
Definition: GenABIO.cc:224
goodZToMuMu_cfi.overlap
overlap
Definition: goodZToMuMu_cfi.py:108
MatchedProbeMaker::m_candidateSource
edm::InputTag m_candidateSource
Definition: MatchedProbeMaker.h:44
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::RefToBase< Candidate >
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::AssociationMap::const_iterator
const iterator
Definition: AssociationMap.h:76
edm::InputTag
Definition: InputTag.h:15