CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 MatchedProbeMaker (const edm::ParameterSet &iConfig)
 
 ~MatchedProbeMaker ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual 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)
 
- 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 T>
class MatchedProbeMaker< T >

Definition at line 30 of file MatchedProbeMaker.h.

Member Typedef Documentation

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

Definition at line 33 of file MatchedProbeMaker.h.

Constructor & Destructor Documentation

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

Definition at line 54 of file MatchedProbeMaker.h.

54  :
55  m_candidateSource(iConfig.getUntrackedParameter<edm::InputTag>("CandidateSource")),
56  m_referenceSource(iConfig.getUntrackedParameter<edm::InputTag>("ReferenceSource")),
57  m_resMatchMapSource(iConfig.getUntrackedParameter<edm::InputTag>("ResMatchMapSource",edm::InputTag("Dummy"))),
58  matched_(iConfig.getUntrackedParameter< bool >("Matched",true))
59 {
60  //register your products
61  produces< edm::RefVector< collection > >();
62 }
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag m_referenceSource
edm::InputTag m_resMatchMapSource
edm::InputTag m_candidateSource
template<typename T >
MatchedProbeMaker< T >::~MatchedProbeMaker ( )

Definition at line 66 of file MatchedProbeMaker.h.

66 {}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 137 of file MatchedProbeMaker.h.

138 {
139 }
template<typename T >
void MatchedProbeMaker< T >::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 143 of file MatchedProbeMaker.h.

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

Implements edm::EDProducer.

Definition at line 70 of file MatchedProbeMaker.h.

References edm::AssociationMap< edm::OneToOneGeneric< reco::CandidateView, reco::CandidateView > >::const_iterator, f, edm::Event::getByLabel(), i, j, LogDebug, muon::overlap(), edm::Event::put(), and dt_dqm_sourceclient_common_cff::reco.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

71 {
72  LogDebug("MatchedProbeMaker");
73 
74  using namespace edm;
75  using namespace reco;
76 
77  std::auto_ptr< edm::RefVector< collection > > outputCollection_matched( new edm::RefVector< collection > );
78  std::auto_ptr< edm::RefVector< collection > > outputCollection_unmatched(new edm::RefVector< collection > );
79 
80  // Get the candidates from the event
82  iEvent.getByLabel(m_candidateSource,Cands);
83 
85  iEvent.getByLabel(m_referenceSource,Refs);
86 
87  // Get the resolution matching map from the event
89 
90  if(iEvent.getByLabel(m_resMatchMapSource,ResMatchMap)){
91  // Loop over the candidates looking for a match
92  for (unsigned i=0; i<Cands->size(); i++) {
93  const edm::Ref< collection > CandRef = (*Cands)[i];
94  reco::CandidateBaseRef candBaseRef( CandRef );
95 
96  // Loop over match map
97  reco::CandViewMatchMap::const_iterator f = ResMatchMap->find( candBaseRef );
98  if( f!=ResMatchMap->end() ) {
99  outputCollection_matched->push_back(CandRef);
100  } else {
101  outputCollection_unmatched->push_back(CandRef);
102  }
103  }
104  } else {
106 
107  // Loop over the candidates looking for a match
108  for (unsigned i=0; i<Cands->size(); i++) {
109  const edm::Ref< collection > CandRef = (*Cands)[i];
110  //RefToBase<Candidate> CandRef(Cands, i);
111  reco::CandidateBaseRef candBaseRef( CandRef );
112 
113  bool ppass = false;
114 
115  for (unsigned j=0; j<Refs->size(); j++) {
116  //const edm::Ref< collection > RefRef = (*Refs)[j];
117  RefToBase<Candidate> RefRef(Refs, j);
118  reco::CandidateBaseRef refBaseRef( RefRef );
119 
120  if(overlap(*CandRef,*RefRef)) {
121  ppass = true;
122  }
123  }
124 
125  if( ppass ) outputCollection_matched->push_back(CandRef);
126  else outputCollection_unmatched->push_back(CandRef);
127  }
128  }
129 
130  if( matched_ ) iEvent.put( outputCollection_matched );
131  else iEvent.put( outputCollection_unmatched );
132 
133 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
edm::InputTag m_referenceSource
edm::InputTag m_resMatchMapSource
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
edm::InputTag m_candidateSource
int j
Definition: DBlmapReader.cc:9
double f[11][100]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420

Member Data Documentation

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

Definition at line 45 of file MatchedProbeMaker.h.

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

Definition at line 46 of file MatchedProbeMaker.h.

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

Definition at line 47 of file MatchedProbeMaker.h.

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

Definition at line 49 of file MatchedProbeMaker.h.