CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ShiftedPFCandidateProducerForNoPileUpPFMEt Class Reference
Inheritance diagram for ShiftedPFCandidateProducerForNoPileUpPFMEt:
edm::stream::EDProducer<>

Public Member Functions

 ShiftedPFCandidateProducerForNoPileUpPFMEt (const edm::ParameterSet &)
 
- 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::unique_ptr< JetCorrectionUncertaintyjecUncertainty_
 
edm::FileInPath jetCorrInputFileName_
 
std::unique_ptr< JetCorrectorParametersjetCorrParameters_
 
std::string jetCorrPayloadName_
 
edm::ESGetToken< JetCorrectorParametersCollection, JetCorrectionsRecordjetCorrPayloadToken_
 
std::string jetCorrUncertaintyTag_
 
double minJetPt_
 
double shiftBy_
 
edm::EDGetTokenT< reco::PFJetCollectionsrcJetsToken_
 
edm::EDGetTokenT< reco::PFCandidateCollectionsrcPFCandidatesToken_
 
double unclEnUncertainty_
 

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

Vary energy of PFCandidates which are (are not) within jets of Pt > 10 GeV by jet energy uncertainty (by 10% "unclustered" energy uncertainty)

NOTE: Auxiliary class specific to estimating systematic uncertainty on PFMET reconstructed by no-PU MET reconstruction algorithm (implemented in JetMETCorrections/Type1MET/src/NoPileUpPFMETProducer.cc)

In case all PFCandidates not within jets of Pt > 30 GeV would be varied by the 10% "unclustered" energy uncertainty, the systematic uncertainty on the reconstructed no-PU MET would be overestimated significantly !!

Author
Christian Veelken, LLR

Definition at line 40 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

Constructor & Destructor Documentation

◆ ShiftedPFCandidateProducerForNoPileUpPFMEt()

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

Definition at line 64 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

References looper::cfg, deDxTools::esConsumes(), edm::FileInPath::fullPath(), jecUncertainty_, jetCorrInputFileName_, jetCorrParameters_, jetCorrPayloadName_, jetCorrPayloadToken_, jetCorrUncertaintyTag_, edm::FileInPath::location(), minJetPt_, shiftBy_, AlCaHLTBitMon_QueryRunRegistry::string, unclEnUncertainty_, and edm::FileInPath::Unknown.

65  : srcPFCandidatesToken_(consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates"))),
66  srcJetsToken_(consumes<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJets"))) {
67  jetCorrUncertaintyTag_ = cfg.getParameter<std::string>("jetCorrUncertaintyTag");
68  if (cfg.exists("jetCorrInputFileName")) {
69  jetCorrInputFileName_ = cfg.getParameter<edm::FileInPath>("jetCorrInputFileName");
71  throw cms::Exception("ShiftedJetProducerT")
72  << " Failed to find JEC parameter file = " << jetCorrInputFileName_ << " !!\n";
74  std::make_unique<JetCorrectorParameters>(jetCorrInputFileName_.fullPath(), jetCorrUncertaintyTag_);
75  jecUncertainty_ = std::make_unique<JetCorrectionUncertainty>(*jetCorrParameters_);
76  } else {
77  jetCorrPayloadName_ = cfg.getParameter<std::string>("jetCorrPayloadName");
79  }
80 
81  minJetPt_ = cfg.getParameter<double>("minJetPt");
82 
83  shiftBy_ = cfg.getParameter<double>("shiftBy");
84 
85  unclEnUncertainty_ = cfg.getParameter<double>("unclEnUncertainty");
86 
87  produces<reco::PFCandidateCollection>();
88 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESGetToken< JetCorrectorParametersCollection, JetCorrectionsRecord > jetCorrPayloadToken_
std::string fullPath() const
Definition: FileInPath.cc:161
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:159

Member Function Documentation

◆ produce()

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

Definition at line 90 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

References PbPb_ZMuSkimMuonDPG_cff::deltaR, MillePedeFileConverter_cfg::e, reco::LeafCandidate::eta(), edm::Event::getByToken(), edm::EventSetup::getData(), reco::PFJet::getPFConstituents(), jecUncertainty_, metsig::jet, jetCorrPayloadName_, jetCorrPayloadToken_, jetCorrUncertaintyTag_, PDWG_EXODelayedJetMET_cff::jets, minJetPt_, eostools::move(), reco::LeafCandidate::pt(), edm::Event::put(), objectSelection_cff::selectedJets, reco::LeafCandidate::setP4(), edm::shift, shiftBy_, srcJetsToken_, srcPFCandidatesToken_, and unclEnUncertainty_.

90  {
91  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
92  evt.getByToken(srcPFCandidatesToken_, originalPFCandidates);
93 
96 
97  std::vector<const reco::PFJet*> selectedJets;
98  for (reco::PFJetCollection::const_iterator jet = jets->begin(); jet != jets->end(); ++jet) {
99  if (jet->pt() > minJetPt_)
100  selectedJets.push_back(&(*jet));
101  }
102 
103  if (!jetCorrPayloadName_.empty()) {
104  const JetCorrectorParametersCollection& jetCorrParameterSet = es.getData(jetCorrPayloadToken_);
105  const JetCorrectorParameters& jetCorrParameters = (jetCorrParameterSet)[jetCorrUncertaintyTag_];
106  jecUncertainty_ = std::make_unique<JetCorrectionUncertainty>(jetCorrParameters);
107  }
108 
109  auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
110  for (reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
111  originalPFCandidate != originalPFCandidates->end();
112  ++originalPFCandidate) {
113  const reco::PFJet* jet_matched = nullptr;
114  for (std::vector<const reco::PFJet*>::iterator jet = selectedJets.begin(); jet != selectedJets.end(); ++jet) {
115  std::vector<reco::PFCandidatePtr> jetConstituents = (*jet)->getPFConstituents();
116  for (std::vector<reco::PFCandidatePtr>::const_iterator jetConstituent = jetConstituents.begin();
117  jetConstituent != jetConstituents.end() && !jet_matched;
118  ++jetConstituent) {
119  if (deltaR(originalPFCandidate->p4(), (*jetConstituent)->p4()) < 1.e-2)
120  jet_matched = (*jet);
121  }
122  }
123 
124  double shift = 0.;
125  if (jet_matched) {
126  jecUncertainty_->setJetEta(jet_matched->eta());
127  jecUncertainty_->setJetPt(jet_matched->pt());
128 
129  shift = jecUncertainty_->getUncertainty(true);
130  } else {
132  }
133 
134  shift *= shiftBy_;
135 
136  reco::Candidate::LorentzVector shiftedPFCandidateP4 = originalPFCandidate->p4();
137  shiftedPFCandidateP4 *= (1. + shift);
138 
139  reco::PFCandidate shiftedPFCandidate(*originalPFCandidate);
140  shiftedPFCandidate.setP4(shiftedPFCandidateP4);
141 
142  shiftedPFCandidates->push_back(shiftedPFCandidate);
143  }
144 
145  evt.put(std::move(shiftedPFCandidates));
146 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
double pt() const final
transverse momentum
edm::ESGetToken< JetCorrectorParametersCollection, JetCorrectionsRecord > jetCorrPayloadToken_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
Jets made from PFObjects.
Definition: PFJet.h:20
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:41
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
static unsigned int const shift
def move(src, dest)
Definition: eostools.py:511
double eta() const final
momentum pseudorapidity

Member Data Documentation

◆ jecUncertainty_

std::unique_ptr<JetCorrectionUncertainty> ShiftedPFCandidateProducerForNoPileUpPFMEt::jecUncertainty_
private

◆ jetCorrInputFileName_

edm::FileInPath ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrInputFileName_
private

◆ jetCorrParameters_

std::unique_ptr<JetCorrectorParameters> ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrParameters_
private

◆ jetCorrPayloadName_

std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrPayloadName_
private

◆ jetCorrPayloadToken_

edm::ESGetToken<JetCorrectorParametersCollection, JetCorrectionsRecord> ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrPayloadToken_
private

◆ jetCorrUncertaintyTag_

std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrUncertaintyTag_
private

◆ minJetPt_

double ShiftedPFCandidateProducerForNoPileUpPFMEt::minJetPt_
private

◆ shiftBy_

double ShiftedPFCandidateProducerForNoPileUpPFMEt::shiftBy_
private

◆ srcJetsToken_

edm::EDGetTokenT<reco::PFJetCollection> ShiftedPFCandidateProducerForNoPileUpPFMEt::srcJetsToken_
private

Definition at line 48 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

Referenced by produce().

◆ srcPFCandidatesToken_

edm::EDGetTokenT<reco::PFCandidateCollection> ShiftedPFCandidateProducerForNoPileUpPFMEt::srcPFCandidatesToken_
private

Definition at line 47 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

Referenced by produce().

◆ unclEnUncertainty_

double ShiftedPFCandidateProducerForNoPileUpPFMEt::unclEnUncertainty_
private