CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< JetCorrectionUncertainty
jecUncertainty_
 
edm::FileInPath jetCorrInputFileName_
 
std::unique_ptr
< JetCorrectorParameters
jetCorrParameters_
 
std::string jetCorrPayloadName_
 
edm::ESGetToken
< JetCorrectorParametersCollection,
JetCorrectionsRecord
jetCorrPayloadToken_
 
std::string jetCorrUncertaintyTag_
 
double minJetPt_
 
double shiftBy_
 
edm::EDGetTokenT
< reco::PFJetCollection
srcJetsToken_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
srcPFCandidatesToken_
 
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 ( const edm::ParameterSet cfg)
explicit

Definition at line 64 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

References DeDxTools::esConsumes(), edm::ParameterSet::exists(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), 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 }
edm::ESGetToken< JetCorrectorParametersCollection, JetCorrectionsRecord > jetCorrPayloadToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:159
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string fullPath() const
Definition: FileInPath.cc:161
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283

Member Function Documentation

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

Definition at line 90 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

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

90  {
91  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
92  evt.getByToken(srcPFCandidatesToken_, originalPFCandidates);
93 
95  evt.getByToken(srcJetsToken_, jets);
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 {
131  shift = unclEnUncertainty_;
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
double pt() const final
transverse momentum
edm::ESGetToken< JetCorrectorParametersCollection, JetCorrectionsRecord > jetCorrPayloadToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
Jets made from PFObjects.
Definition: PFJet.h:20
bool getData(T &iHolder) const
Definition: EventSetup.h:122
vector< PseudoJet > jets
def move
Definition: eostools.py:511
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
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:41
double eta() const final
momentum pseudorapidity

Member Data Documentation

std::unique_ptr<JetCorrectionUncertainty> ShiftedPFCandidateProducerForNoPileUpPFMEt::jecUncertainty_
private
edm::FileInPath ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrInputFileName_
private
std::unique_ptr<JetCorrectorParameters> ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrParameters_
private
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrPayloadName_
private
edm::ESGetToken<JetCorrectorParametersCollection, JetCorrectionsRecord> ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrPayloadToken_
private
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrUncertaintyTag_
private
double ShiftedPFCandidateProducerForNoPileUpPFMEt::minJetPt_
private
double ShiftedPFCandidateProducerForNoPileUpPFMEt::shiftBy_
private
edm::EDGetTokenT<reco::PFJetCollection> ShiftedPFCandidateProducerForNoPileUpPFMEt::srcJetsToken_
private

Definition at line 48 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

Referenced by produce().

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

Definition at line 47 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

Referenced by produce().

double ShiftedPFCandidateProducerForNoPileUpPFMEt::unclEnUncertainty_
private