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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 7 of file PFCandMETcorrInputProducer.cc.

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

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

◆ ~PFCandMETcorrInputProducer()

PFCandMETcorrInputProducer::~PFCandMETcorrInputProducer ( )
override

Definition at line 30 of file PFCandMETcorrInputProducer.cc.

30 {}

Member Function Documentation

◆ produce()

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

Definition at line 32 of file PFCandMETcorrInputProducer.cc.

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

References binning_, HLT_FULL_cff::cands, edm::Event::getByToken(), edm::EDGetTokenT< T >::isUninitialized(), edm::Event::put(), token_, mps_merge::weight, HLT_FULL_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
PFCandMETcorrInputProducer::token_
edm::EDGetTokenT< edm::View< reco::Candidate > > token_
Definition: PFCandMETcorrInputProducer.h:41
mps_merge.weight
weight
Definition: mps_merge.py:88
edm::EDGetTokenT::isUninitialized
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
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
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99207
CorrMETData
a MET correction term
Definition: CorrMETData.h:14
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::View
Definition: CaloClusterFwd.h:14
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15161
cand
Definition: decayParser.h:32
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_FULL_cff.srcWeights
srcWeights
Definition: HLT_FULL_cff.py:8709
looper.cfg
cfg
Definition: looper.py:296
edm::ValueMap< float >
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