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 Attributes
PFElectronMaker Class Reference

#include <PFElectronMaker.h>

Public Member Functions

 PFElectronMaker (const edm::ParameterSet &, edm::ConsumesCollector)
 
void SetVars (HWW &, const edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::EDGetTokenT
< edm::ValueMap
< reco::PFCandidatePtr > > 
PFElectrons_
 

Detailed Description

Definition at line 10 of file PFElectronMaker.h.

Constructor & Destructor Documentation

PFElectronMaker::PFElectronMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector  iCollector 
)

Definition at line 11 of file PFElectronMaker.cc.

References edm::ConsumesCollector::consumes(), and edm::ParameterSet::getParameter().

11  {
12 
13  PFElectrons_ = iCollector.consumes<edm::ValueMap<reco::PFCandidatePtr> >(iConfig.getParameter<edm::InputTag>("pfElectronsTag"));
14 
15 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::ValueMap< reco::PFCandidatePtr > > PFElectrons_

Member Function Documentation

void PFElectronMaker::SetVars ( HWW hww,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 17 of file PFElectronMaker.cc.

References edm::ValueMap< T >::begin(), edm::Event::getByToken(), i, edm::Ptr< T >::isNull(), HWW::Load_pfels_p4(), reco::tau::pfCandidates(), HWW::pfels_p4(), edm::Handle< T >::product(), and edm::ValueMap< T >::const_iterator::size().

Referenced by HWWAnalyzer::analyze().

17  {
18 
19  hww.Load_pfels_p4();
20 
21  bool validToken;
22 
23  Handle<PFCandMap > pfCandidatesHandle;
24  validToken = iEvent.getByToken( PFElectrons_, pfCandidatesHandle );
25  if(!validToken) return;
26  const ValueMap<reco::PFCandidatePtr> *pfCandidates = pfCandidatesHandle.product();
27 
28  PFCandMap::const_iterator pf_pit = pfCandidates->begin();
29  unsigned int nC = pf_pit.size();
30  for( unsigned int iC = 0; iC < nC; ++iC ) {
31 
32  const PFCandidatePtr& pf_it = pf_pit[iC];
33  if ( pf_it.isNull() ) continue;
34  int pfflags = 0;
35 
36  for( unsigned int i = 0; i < 17; i++ ) {
37  if(pf_it->flag((PFCandidate::Flags)i)) pfflags |= (1<<i);
38  }
39 
40  hww.pfels_p4() .push_back(LorentzVector(pf_it->px(), pf_it->py(), pf_it->pz(), pf_it->p()) );
41 
42  }
43 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
void Load_pfels_p4()
Definition: HWW.cc:1352
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
std::vector< LorentzVector > & pfels_p4()
Definition: HWW.cc:753
bool isNull() const
Checks for null.
Definition: Ptr.h:148
T const * product() const
Definition: Handle.h:81
const_iterator begin() const
Definition: ValueMap.h:209
edm::EDGetTokenT< edm::ValueMap< reco::PFCandidatePtr > > PFElectrons_
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

edm::EDGetTokenT<edm::ValueMap<reco::PFCandidatePtr> > PFElectronMaker::PFElectrons_
private

Definition at line 19 of file PFElectronMaker.h.