CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
PFCandMETcorrInputProducer Class Reference

#include <PFCandMETcorrInputProducer.h>

Inheritance diagram for PFCandMETcorrInputProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  binningEntryType
 

Public Member Functions

 PFCandMETcorrInputProducer (const edm::ParameterSet &)
 
 ~PFCandMETcorrInputProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

std::vector< std::unique_ptr< binningEntryType > > binning_
 
std::string moduleLabel_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > token_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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

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

Definition at line 30 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 token_.

6  : moduleLabel_(cfg.getParameter<std::string>("@module_label"))
7 {
8  token_ = consumes<edm::View<reco::Candidate> >(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_.emplace_back(new binningEntryType(*cfgBinningEntry));
16  }
17  } else {
18  binning_.emplace_back(new binningEntryType());
19  }
20 
21  for ( auto binningEntry = binning_.begin();
22  binningEntry != binning_.end(); ++binningEntry ) {
23  produces<CorrMETData>((*binningEntry)->binLabel_);
24  }
25 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > token_
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< std::unique_ptr< binningEntryType > > binning_
PFCandMETcorrInputProducer::~PFCandMETcorrInputProducer ( )

Definition at line 27 of file PFCandMETcorrInputProducer.cc.

28 {
29 }

Member Function Documentation

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

Definition at line 31 of file PFCandMETcorrInputProducer.cc.

References binning_, DEFINE_FWK_MODULE, edm::Event::getByToken(), edm::Event::put(), and token_.

32 {
33  for ( auto binningEntry = binning_.begin();
34  binningEntry != binning_.end(); ++binningEntry ) {
35  (*binningEntry)->binUnclEnergySum_ = CorrMETData();
36  }
37 
40  evt.getByToken(token_, cands);
41 
42  for ( edm::View<reco::Candidate>::const_iterator cand = cands->begin();
43  cand != cands->end(); ++cand ) {
44  for ( auto binningEntry = binning_.begin();
45  binningEntry != binning_.end(); ++binningEntry ) {
46  if ( !(*binningEntry)->binSelection_ || (*(*binningEntry)->binSelection_)(cand->p4()) ) {
47  (*binningEntry)->binUnclEnergySum_.mex += cand->px();
48  (*binningEntry)->binUnclEnergySum_.mey += cand->py();
49  (*binningEntry)->binUnclEnergySum_.sumet += cand->et();
50  }
51  }
52  }
53 
54 //--- add momentum sum of PFCandidates not within jets ("unclustered energy") to the event
55  for ( auto binningEntry = binning_.cbegin();
56  binningEntry != binning_.cend(); ++binningEntry ) {
57  evt.put(std::unique_ptr<CorrMETData>(new CorrMETData((*binningEntry)->binUnclEnergySum_)), (*binningEntry)->binLabel_);
58  }
59 }
edm::EDGetTokenT< edm::View< reco::Candidate > > token_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::vector< std::unique_ptr< binningEntryType > > binning_
a MET correction term
Definition: CorrMETData.h:14
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::View< Candidate > CandidateView
view of a collection containing candidates
Definition: CandidateFwd.h:23

Member Data Documentation

std::vector<std::unique_ptr<binningEntryType> > PFCandMETcorrInputProducer::binning_
private

Definition at line 62 of file PFCandMETcorrInputProducer.h.

Referenced by PFCandMETcorrInputProducer(), and produce().

std::string PFCandMETcorrInputProducer::moduleLabel_
private
edm::EDGetTokenT<edm::View<reco::Candidate> > PFCandMETcorrInputProducer::token_
private

Definition at line 43 of file PFCandMETcorrInputProducer.h.

Referenced by PFCandMETcorrInputProducer(), and produce().