CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ElectronMatchedCandidateProducer Class Reference

#include <ElectronMatchedCandidateProducer.h>

Inheritance diagram for ElectronMatchedCandidateProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronMatchedCandidateProducer (const edm::ParameterSet &)
 
 ~ElectronMatchedCandidateProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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

double delRMatchingCut_
 
edm::InputTag electronCollection_
 
edm::InputTag scCollection_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 16 of file ElectronMatchedCandidateProducer.h.

Constructor & Destructor Documentation

ElectronMatchedCandidateProducer::ElectronMatchedCandidateProducer ( const edm::ParameterSet params)
explicit

Definition at line 9 of file ElectronMatchedCandidateProducer.cc.

References delRMatchingCut_, electronCollection_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), and scCollection_.

10 {
11 
12  const edm::InputTag allelectrons("gsfElectrons");
14  params.getUntrackedParameter<edm::InputTag>("ReferenceElectronCollection",
15  allelectrons);
16  scCollection_ =
17  params.getParameter<edm::InputTag>("src");
18 
19  delRMatchingCut_ = params.getUntrackedParameter<double>("deltaR",
20  0.30);
21 
22  produces< edm::PtrVector<reco::Candidate> >();
23  produces< edm::RefToBaseVector<reco::Candidate> >();
24 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ElectronMatchedCandidateProducer::~ElectronMatchedCandidateProducer ( )

Definition at line 29 of file ElectronMatchedCandidateProducer.cc.

30 {
31 
32 }

Member Function Documentation

void ElectronMatchedCandidateProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 99 of file ElectronMatchedCandidateProducer.cc.

99 {}
void ElectronMatchedCandidateProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 103 of file ElectronMatchedCandidateProducer.cc.

103 {}
void ElectronMatchedCandidateProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 42 of file ElectronMatchedCandidateProducer.cc.

References delRMatchingCut_, reco::deltaR(), electronCollection_, HI_PhotonSkim_cff::electrons, and scCollection_.

44 {
45  // Create the output collection
46  std::auto_ptr< edm::RefToBaseVector<reco::Candidate> >
48  std::auto_ptr< edm::PtrVector<reco::Candidate> >
49  outColPtr( new edm::PtrVector<reco::Candidate> );
50 
51 
52  // Read electrons
54  event.getByLabel(electronCollection_, electrons);
55 
56 
57 
58  //Read candidates
60  event.getByLabel( scCollection_ , recoCandColl);
61 
62 
63  const edm::PtrVector<reco::Candidate>& ptrVect = recoCandColl->ptrVector();
64  const edm::RefToBaseVector<reco::Candidate>& refs = recoCandColl->refVector();
65  unsigned int counter=0;
66 
67  // Loop over candidates
68  for(edm::View<reco::Candidate>::const_iterator scIt = recoCandColl->begin();
69  scIt != recoCandColl->end(); ++scIt, ++counter){
70  // Now loop over electrons
71  for(edm::View<reco::GsfElectron>::const_iterator elec = electrons->begin();
72  elec != electrons->end(); ++elec) {
73 
74  reco::SuperClusterRef eSC = elec->superCluster();
75 
76  double dRval = reco::deltaR((float)eSC->eta(), (float)eSC->phi(),
77  scIt->eta(), scIt->phi());
78 
79  if( dRval < delRMatchingCut_ ) {
80  //outCol->push_back( *scIt );
81  outColRef->push_back( refs[counter] );
82  outColPtr->push_back( ptrVect[counter] );
83  } // end if loop
84  } // end electron loop
85 
86  } // end candidate loop
87 
88  event.put(outColRef);
89  event.put(outColPtr);
90 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30

Member Data Documentation

double ElectronMatchedCandidateProducer::delRMatchingCut_
private

Definition at line 31 of file ElectronMatchedCandidateProducer.h.

Referenced by ElectronMatchedCandidateProducer(), and produce().

edm::InputTag ElectronMatchedCandidateProducer::electronCollection_
private

Definition at line 29 of file ElectronMatchedCandidateProducer.h.

Referenced by ElectronMatchedCandidateProducer(), and produce().

edm::InputTag ElectronMatchedCandidateProducer::scCollection_
private

Definition at line 30 of file ElectronMatchedCandidateProducer.h.

Referenced by ElectronMatchedCandidateProducer(), and produce().