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
PFIsolationFiller Class Reference

#include <PFIsolationFiller.h>

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

Public Member Functions

 PFIsolationFiller (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~PFIsolationFiller ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
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 ()
 
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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

unsigned nDeps_
 
std::string outputCollectionLabel_
 
edm::EDGetTokenT
< reco::GsfElectronCollection
previousGsfElectrons_
 
std::vector< edm::EDGetTokenT
< edm::ValueMap< double > > > 
tokenElectronIsoVals_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::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 15 of file PFIsolationFiller.h.

Constructor & Destructor Documentation

PFIsolationFiller::PFIsolationFiller ( const edm::ParameterSet cfg)
explicit

Definition at line 16 of file PFIsolationFiller.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

17  {
18  previousGsfElectrons_ = consumes<reco::GsfElectronCollection>(cfg.getParameter<edm::InputTag>("previousGsfElectronsTag"));
19  outputCollectionLabel_ = cfg.getParameter<std::string>("outputCollectionLabel");
20  edm::ParameterSet pfIsoVals(cfg.getParameter<edm::ParameterSet> ("pfIsolationValues"));
21 
22  tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(pfIsoVals.getParameter<edm::InputTag>("pfSumChargedHadronPt")));
23  tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(pfIsoVals.getParameter<edm::InputTag>("pfSumPhotonEt")));
24  tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(pfIsoVals.getParameter<edm::InputTag>("pfSumNeutralHadronEt")));
25  tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(pfIsoVals.getParameter<edm::InputTag>("pfSumPUPt")));
26 // std::vector<std::string> isoNames = pfIsoVals.getParameterNamesForType<edm::InputTag>();
27 // for(const std::string& name : isoNames) {
28 // edm::InputTag tag =
29 // pfIsoVals.getParameter<edm::InputTag>(name);
30 // tokenElectronIsoVals_.push_back(consumes<edm::ValueMap<double> >(tag));
31 // }
32 
34 
35  produces<reco::GsfElectronCollection> (outputCollectionLabel_);
36 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::string outputCollectionLabel_
edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > tokenElectronIsoVals_
PFIsolationFiller::~PFIsolationFiller ( )

Definition at line 38 of file PFIsolationFiller.cc.

39  {}

Member Function Documentation

void PFIsolationFiller::produce ( edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::EDProducer.

Definition at line 42 of file PFIsolationFiller.cc.

References i, reco::GsfElectron::setPfIsolationVariables(), reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, and reco::GsfElectron::PflowIsolationVariables::sumPUPt.

43  {
44 
45  // Output collection
46  std::auto_ptr<reco::GsfElectronCollection> outputElectrons_p(new reco::GsfElectronCollection);
47 
48  // read input collections
49  // electrons
51  event.getByToken(previousGsfElectrons_,gedElectronHandle);
52 
53  // value maps
54 
55  std::vector< edm::Handle< edm::ValueMap<double> > > isolationValueMaps(nDeps_);
56 
57  for(unsigned i=0; i < nDeps_ ; ++i) {
58  event.getByToken(tokenElectronIsoVals_[i],isolationValueMaps[i]);
59  }
60 
61  // Now loop on the electrons
62  unsigned nele=gedElectronHandle->size();
63  for(unsigned iele=0; iele<nele;++iele) {
64  reco::GsfElectronRef myElectronRef(gedElectronHandle,iele);
65 
66  reco::GsfElectron newElectron(*myElectronRef);
68  isoVariables.sumChargedHadronPt = (*(isolationValueMaps)[0])[myElectronRef];
69  isoVariables.sumPhotonEt = (*(isolationValueMaps)[1])[myElectronRef];
70  isoVariables.sumNeutralHadronEt = (*(isolationValueMaps)[2])[myElectronRef];
71  isoVariables.sumPUPt = (*(isolationValueMaps)[3])[myElectronRef];
72  newElectron.setPfIsolationVariables(isoVariables);
73 
74  outputElectrons_p->push_back(newElectron);
75  }
76 
77  event.put(outputElectrons_p,outputCollectionLabel_);
78  }
int i
Definition: DBlmapReader.cc:9
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:532
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:527
std::string outputCollectionLabel_
edm::EDGetTokenT< reco::GsfElectronCollection > previousGsfElectrons_
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:526
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > tokenElectronIsoVals_
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:525

Member Data Documentation

unsigned PFIsolationFiller::nDeps_
private

Definition at line 27 of file PFIsolationFiller.h.

std::string PFIsolationFiller::outputCollectionLabel_
private

Definition at line 25 of file PFIsolationFiller.h.

edm::EDGetTokenT<reco::GsfElectronCollection> PFIsolationFiller::previousGsfElectrons_
private

Definition at line 24 of file PFIsolationFiller.h.

std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > PFIsolationFiller::tokenElectronIsoVals_
private

Definition at line 26 of file PFIsolationFiller.h.