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_
 
edm::EDGetTokenT< edm::ValueMap< float > > weightsToken_
 

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 31 of file PFCandMETcorrInputProducer.h.

Constructor & Destructor Documentation

◆ PFCandMETcorrInputProducer()

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

Definition at line 5 of file PFCandMETcorrInputProducer.cc.

6  : moduleLabel_(cfg.getParameter<std::string>("@module_label")) {
7  token_ = consumes<edm::View<reco::Candidate>>(cfg.getParameter<edm::InputTag>("src"));
8  edm::InputTag srcWeights = cfg.getParameter<edm::InputTag>("srcWeights");
9  if (!srcWeights.label().empty())
11 
12  if (cfg.exists("binning")) {
13  typedef std::vector<edm::ParameterSet> vParameterSet;
14  vParameterSet cfgBinning = cfg.getParameter<vParameterSet>("binning");
15  for (vParameterSet::const_iterator cfgBinningEntry = cfgBinning.begin(); cfgBinningEntry != cfgBinning.end();
16  ++cfgBinningEntry) {
17  binning_.emplace_back(new binningEntryType(*cfgBinningEntry));
18  }
19  } else {
20  binning_.emplace_back(new binningEntryType());
21  }
22 
23  for (auto binningEntry = binning_.begin(); binningEntry != binning_.end(); ++binningEntry) {
24  produces<CorrMETData>((*binningEntry)->binLabel_);
25  }
26 }

References binning_, looper::cfg, HLT_2018_cff::srcWeights, token_, and weightsToken_.

◆ ~PFCandMETcorrInputProducer()

PFCandMETcorrInputProducer::~PFCandMETcorrInputProducer ( )
override

Definition at line 28 of file PFCandMETcorrInputProducer.cc.

28 {}

Member Function Documentation

◆ produce()

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

Definition at line 30 of file PFCandMETcorrInputProducer.cc.

30  {
31  for (auto binningEntry = binning_.begin(); binningEntry != binning_.end(); ++binningEntry) {
32  (*binningEntry)->binUnclEnergySum_ = CorrMETData();
33  }
34 
37  evt.getByToken(token_, cands);
38 
42 
43  for (edm::View<reco::Candidate>::const_iterator cand = cands->begin(); cand != cands->end(); ++cand) {
44  float weight = (!weightsToken_.isUninitialized()) ? (*weights)[cands->ptrAt(cand - cands->begin())] : 1.0;
45  for (auto binningEntry = binning_.begin(); binningEntry != binning_.end(); ++binningEntry) {
46  if (!(*binningEntry)->binSelection_ || (*(*binningEntry)->binSelection_)(cand->p4() * weight)) {
47  (*binningEntry)->binUnclEnergySum_.mex += cand->px() * weight;
48  (*binningEntry)->binUnclEnergySum_.mey += cand->py() * weight;
49  (*binningEntry)->binUnclEnergySum_.sumet += cand->et() * weight;
50  }
51  }
52  }
53 
54  //--- add momentum sum of PFCandidates not within jets ("unclustered energy") to the event
55  for (auto binningEntry = binning_.cbegin(); binningEntry != binning_.cend(); ++binningEntry) {
56  evt.put(std::unique_ptr<CorrMETData>(new CorrMETData((*binningEntry)->binUnclEnergySum_)),
57  (*binningEntry)->binLabel_);
58  }
59 }

References binning_, HLT_2018_cff::cands, edm::Event::getByToken(), edm::EDGetTokenT< T >::isUninitialized(), edm::Event::put(), token_, mps_merge::weight, HLT_2018_cff::weights, and weightsToken_.

Member Data Documentation

◆ binning_

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

Definition at line 55 of file PFCandMETcorrInputProducer.h.

Referenced by PFCandMETcorrInputProducer(), and produce().

◆ moduleLabel_

std::string PFCandMETcorrInputProducer::moduleLabel_
private

◆ token_

edm::EDGetTokenT<edm::View<reco::Candidate> > PFCandMETcorrInputProducer::token_
private

Definition at line 41 of file PFCandMETcorrInputProducer.h.

Referenced by PFCandMETcorrInputProducer(), and produce().

◆ weightsToken_

edm::EDGetTokenT<edm::ValueMap<float> > PFCandMETcorrInputProducer::weightsToken_
private

Definition at line 42 of file PFCandMETcorrInputProducer.h.

Referenced by PFCandMETcorrInputProducer(), and produce().

reco::CandidateView
edm::View< Candidate > CandidateView
view of a collection containing candidates
Definition: CandidateFwd.h:23
HLT_2018_cff.weights
weights
Definition: HLT_2018_cff.py:87167
PFCandMETcorrInputProducer::token_
edm::EDGetTokenT< edm::View< reco::Candidate > > token_
Definition: PFCandMETcorrInputProducer.h:41
mps_merge.weight
weight
Definition: mps_merge.py:88
edm::Handle
Definition: AssociativeIterator.h:50
PFCandMETcorrInputProducer::moduleLabel_
std::string moduleLabel_
Definition: PFCandMETcorrInputProducer.h:39
PFCandMETcorrInputProducer::binning_
std::vector< std::unique_ptr< binningEntryType > > binning_
Definition: PFCandMETcorrInputProducer.h:55
edm::EDGetTokenT::isUninitialized
bool isUninitialized() const
Definition: EDGetToken.h:70
CorrMETData
a MET correction term
Definition: CorrMETData.h:14
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
HLT_2018_cff.srcWeights
srcWeights
Definition: HLT_2018_cff.py:7335
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
cand
Definition: decayParser.h:34
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
looper.cfg
cfg
Definition: looper.py:297
edm::ValueMap< float >
HLT_2018_cff.cands
cands
Definition: HLT_2018_cff.py:13762
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::InputTag
Definition: InputTag.h:15
weight
Definition: weight.py:1
PFCandMETcorrInputProducer::weightsToken_
edm::EDGetTokenT< edm::ValueMap< float > > weightsToken_
Definition: PFCandMETcorrInputProducer.h:42