CMS 3D CMS Logo

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

#include <PFCandMETcorrInputProducer.h>

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

Classes

struct  binningEntryType
 

Public Member Functions

 PFCandMETcorrInputProducer (const edm::ParameterSet &)
 
 ~PFCandMETcorrInputProducer ()
 
- 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

void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

std::vector< binningEntryType * > binning_
 
std::string moduleLabel_
 
edm::InputTag src_
 

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

Sum PFCandidates not within jets ("unclustered energy"), needed as input for Type 2 MET corrections

Authors
Michael Schmitt, Richard Cavanaugh, The University of Florida Florent Lacroix, University of Illinois at Chicago Christian Veelken, LLR
Version
Revision:
1.2
Id:
PFCandMETcorrInputProducer.h,v 1.2 2011/10/14 10:14:35 veelken Exp

Definition at line 32 of file PFCandMETcorrInputProducer.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file PFCandMETcorrInputProducer.cc.

References binning_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), and src_.

6  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
7 {
8  src_ = cfg.getParameter<edm::InputTag>("src");
9 
10  if ( cfg.exists("binning") ) {
11  typedef std::vector<edm::ParameterSet> vParameterSet;
12  vParameterSet cfgBinning = cfg.getParameter<vParameterSet>("binning");
13  for ( vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin();
14  cfgBinningEntry != cfgBinning.end(); ++cfgBinningEntry ) {
15  binning_.push_back(new binningEntryType(*cfgBinningEntry));
16  }
17  } else {
18  binning_.push_back(new binningEntryType());
19  }
20 
21  for ( std::vector<binningEntryType*>::const_iterator binningEntry = binning_.begin();
22  binningEntry != binning_.end(); ++binningEntry ) {
23  produces<CorrMETData>((*binningEntry)->binLabel_);
24  }
25 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< binningEntryType * > binning_
PFCandMETcorrInputProducer::~PFCandMETcorrInputProducer ( )

Definition at line 27 of file PFCandMETcorrInputProducer.cc.

References binning_.

28 {
29  for ( std::vector<binningEntryType*>::const_iterator it = binning_.begin();
30  it != binning_.end(); ++it ) {
31  delete (*it);
32  }
33 }
std::vector< binningEntryType * > binning_

Member Function Documentation

void PFCandMETcorrInputProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 35 of file PFCandMETcorrInputProducer.cc.

References binning_, edm::Event::getByLabel(), edm::Event::put(), and src_.

36 {
37  for ( std::vector<binningEntryType*>::iterator binningEntry = binning_.begin();
38  binningEntry != binning_.end(); ++binningEntry ) {
39  (*binningEntry)->binUnclEnergySum_ = CorrMETData();
40  }
41 
44  evt.getByLabel(src_, cands);
45 
46  for ( edm::View<reco::Candidate>::const_iterator cand = cands->begin();
47  cand != cands->end(); ++cand ) {
48  for ( std::vector<binningEntryType*>::iterator binningEntry = binning_.begin();
49  binningEntry != binning_.end(); ++binningEntry ) {
50  if ( !(*binningEntry)->binSelection_ || (*(*binningEntry)->binSelection_)(cand->p4()) ) {
51  (*binningEntry)->binUnclEnergySum_.mex += cand->px();
52  (*binningEntry)->binUnclEnergySum_.mey += cand->py();
53  (*binningEntry)->binUnclEnergySum_.sumet += cand->et();
54  }
55  }
56  }
57 
58 //--- add momentum sum of PFCandidates not within jets ("unclustered energy") to the event
59  for ( std::vector<binningEntryType*>::const_iterator binningEntry = binning_.begin();
60  binningEntry != binning_.end(); ++binningEntry ) {
61  evt.put(std::auto_ptr<CorrMETData>(new CorrMETData((*binningEntry)->binUnclEnergySum_)), (*binningEntry)->binLabel_);
62  }
63 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
std::vector< binningEntryType * > binning_
a MET correction term
Definition: CorrMETData.h:15
edm::View< Candidate > CandidateView
view of a collection containing candidates
Definition: CandidateFwd.h:23

Member Data Documentation

std::vector<binningEntryType*> PFCandMETcorrInputProducer::binning_
private
std::string PFCandMETcorrInputProducer::moduleLabel_
private
edm::InputTag PFCandMETcorrInputProducer::src_
private

Definition at line 45 of file PFCandMETcorrInputProducer.h.

Referenced by PFCandMETcorrInputProducer(), and produce().