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<>

Classes

struct  binningEntryType
 

Public Member Functions

 PFCandMETcorrInputProducer (const edm::ParameterSet &)
 
 ~PFCandMETcorrInputProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

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

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
 

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  token_ = consumes<edm::View<reco::Candidate> >(cfg.getParameter<edm::InputTag>("src"));
8 
9  if (cfg.exists("binning")) {
10  typedef std::vector<edm::ParameterSet> vParameterSet;
11  vParameterSet cfgBinning = cfg.getParameter<vParameterSet>("binning");
12  for (vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin(); cfgBinningEntry != cfgBinning.end();
13  ++cfgBinningEntry) {
14  binning_.emplace_back(new binningEntryType(*cfgBinningEntry));
15  }
16  } else {
17  binning_.emplace_back(new binningEntryType());
18  }
19 
20  for (auto binningEntry = binning_.begin(); binningEntry != binning_.end(); ++binningEntry) {
21  produces<CorrMETData>((*binningEntry)->binLabel_);
22  }
23 }
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 ( )
override

Definition at line 25 of file PFCandMETcorrInputProducer.cc.

25 {}

Member Function Documentation

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

Definition at line 27 of file PFCandMETcorrInputProducer.cc.

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

27  {
28  for (auto binningEntry = binning_.begin(); binningEntry != binning_.end(); ++binningEntry) {
29  (*binningEntry)->binUnclEnergySum_ = CorrMETData();
30  }
31 
34  evt.getByToken(token_, cands);
35 
36  for (edm::View<reco::Candidate>::const_iterator cand = cands->begin(); cand != cands->end(); ++cand) {
37  for (auto binningEntry = binning_.begin(); binningEntry != binning_.end(); ++binningEntry) {
38  if (!(*binningEntry)->binSelection_ || (*(*binningEntry)->binSelection_)(cand->p4())) {
39  (*binningEntry)->binUnclEnergySum_.mex += cand->px();
40  (*binningEntry)->binUnclEnergySum_.mey += cand->py();
41  (*binningEntry)->binUnclEnergySum_.sumet += cand->et();
42  }
43  }
44  }
45 
46  //--- add momentum sum of PFCandidates not within jets ("unclustered energy") to the event
47  for (auto binningEntry = binning_.cbegin(); binningEntry != binning_.cend(); ++binningEntry) {
48  evt.put(std::unique_ptr<CorrMETData>(new CorrMETData((*binningEntry)->binUnclEnergySum_)),
49  (*binningEntry)->binLabel_);
50  }
51 }
edm::EDGetTokenT< edm::View< reco::Candidate > > token_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
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 53 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 40 of file PFCandMETcorrInputProducer.h.

Referenced by PFCandMETcorrInputProducer(), and produce().