CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ShiftedPFCandidateProducerForNoPileUpPFMEt Class Reference

#include <ShiftedPFCandidateProducerForNoPileUpPFMEt.h>

Inheritance diagram for ShiftedPFCandidateProducerForNoPileUpPFMEt:
edm::stream::EDProducer<>

Public Member Functions

 ShiftedPFCandidateProducerForNoPileUpPFMEt (const edm::ParameterSet &)
 
 ~ShiftedPFCandidateProducerForNoPileUpPFMEt () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Member Functions

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

Private Attributes

JetCorrectionUncertaintyjecUncertainty_
 
edm::FileInPath jetCorrInputFileName_
 
JetCorrectorParametersjetCorrParameters_
 
std::string jetCorrPayloadName_
 
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<>
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

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 42 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.

Constructor & Destructor Documentation

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

Definition at line 8 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

References edm::ParameterSet::exists(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), jecUncertainty_, jetCorrInputFileName_, jetCorrParameters_, jetCorrPayloadName_, jetCorrUncertaintyTag_, edm::FileInPath::location(), minJetPt_, shiftBy_, AlCaHLTBitMon_QueryRunRegistry::string, unclEnUncertainty_, and edm::FileInPath::Unknown.

9  : srcPFCandidatesToken_(consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates")))
10  , srcJetsToken_(consumes<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJets")))
11 {
12 
13  jetCorrUncertaintyTag_ = cfg.getParameter<std::string>("jetCorrUncertaintyTag");
14  if ( cfg.exists("jetCorrInputFileName") ) {
15  jetCorrInputFileName_ = cfg.getParameter<edm::FileInPath>("jetCorrInputFileName");
16  if ( jetCorrInputFileName_.location() == edm::FileInPath::Unknown) throw cms::Exception("ShiftedJetProducerT")
17  << " Failed to find JEC parameter file = " << jetCorrInputFileName_ << " !!\n";
20  } else {
21  jetCorrPayloadName_ = cfg.getParameter<std::string>("jetCorrPayloadName");
22  }
23 
24  minJetPt_ = cfg.getParameter<double>("minJetPt");
25 
26  shiftBy_ = cfg.getParameter<double>("shiftBy");
27 
28  unclEnUncertainty_ = cfg.getParameter<double>("unclEnUncertainty");
29 
30  produces<reco::PFCandidateCollection>();
31 }
T getParameter(std::string const &) const
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:191
std::string fullPath() const
Definition: FileInPath.cc:197
ShiftedPFCandidateProducerForNoPileUpPFMEt::~ShiftedPFCandidateProducerForNoPileUpPFMEt ( )
override

Definition at line 33 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

34 {
35 // nothing to be done yet...
36 }

Member Function Documentation

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

Definition at line 38 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

References DEFINE_FWK_MODULE, deltaR(), MillePedeFileConverter_cfg::e, reco::LeafCandidate::eta(), edm::EventSetup::get(), edm::Event::getByToken(), reco::PFJet::getPFConstituents(), JetCorrectionUncertainty::getUncertainty(), jecUncertainty_, metsig::jet, jetCorrPayloadName_, jetCorrUncertaintyTag_, fwrapper::jets, minJetPt_, eostools::move(), reco::LeafCandidate::pt(), edm::Event::put(), objectSelection_cff::selectedJets, JetCorrectionUncertainty::setJetEta(), JetCorrectionUncertainty::setJetPt(), reco::LeafCandidate::setP4(), edm::shift, shiftBy_, srcJetsToken_, srcPFCandidatesToken_, and unclEnUncertainty_.

39 {
40  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
41  evt.getByToken(srcPFCandidatesToken_, originalPFCandidates);
42 
44  evt.getByToken(srcJetsToken_, jets);
45 
46  std::vector<const reco::PFJet*> selectedJets;
47  for ( reco::PFJetCollection::const_iterator jet = jets->begin();
48  jet != jets->end(); ++jet ) {
49  if ( jet->pt() > minJetPt_ ) selectedJets.push_back(&(*jet));
50  }
51 
52  if ( jetCorrPayloadName_ != "" ) {
54  es.get<JetCorrectionsRecord>().get(jetCorrPayloadName_, jetCorrParameterSet);
55  const JetCorrectorParameters& jetCorrParameters = (*jetCorrParameterSet)[jetCorrUncertaintyTag_];
56  delete jecUncertainty_;
57  jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters);
58  }
59 
60  auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
61  for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
62  originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) {
63 
64  const reco::PFJet* jet_matched = nullptr;
65  for ( std::vector<const reco::PFJet*>::iterator jet = selectedJets.begin();
66  jet != selectedJets.end(); ++jet ) {
67  std::vector<reco::PFCandidatePtr> jetConstituents = (*jet)->getPFConstituents();
68  for ( std::vector<reco::PFCandidatePtr>::const_iterator jetConstituent = jetConstituents.begin();
69  jetConstituent != jetConstituents.end() && !jet_matched; ++jetConstituent ) {
70  if ( deltaR(originalPFCandidate->p4(), (*jetConstituent)->p4()) < 1.e-2 ) jet_matched = (*jet);
71  }
72  }
73 
74  double shift = 0.;
75  if ( jet_matched ) {
76  jecUncertainty_->setJetEta(jet_matched->eta());
77  jecUncertainty_->setJetPt(jet_matched->pt());
78 
79  shift = jecUncertainty_->getUncertainty(true);
80  } else {
81  shift = unclEnUncertainty_;
82  }
83 
84  shift *= shiftBy_;
85 
86  reco::Candidate::LorentzVector shiftedPFCandidateP4 = originalPFCandidate->p4();
87  shiftedPFCandidateP4 *= (1. + shift);
88 
89  reco::PFCandidate shiftedPFCandidate(*originalPFCandidate);
90  shiftedPFCandidate.setP4(shiftedPFCandidateP4);
91 
92  shiftedPFCandidates->push_back(shiftedPFCandidate);
93  }
94 
95  evt.put(std::move(shiftedPFCandidates));
96 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
double pt() const final
transverse momentum
Jets made from PFObjects.
Definition: PFJet.h:21
vector< PseudoJet > jets
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
T get() const
Definition: EventSetup.h:63
static unsigned int const shift
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:52
float getUncertainty(bool fDirection)
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

JetCorrectionUncertainty* ShiftedPFCandidateProducerForNoPileUpPFMEt::jecUncertainty_
private
edm::FileInPath ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrInputFileName_
private
JetCorrectorParameters* ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrParameters_
private
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrPayloadName_
private
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrUncertaintyTag_
private
double ShiftedPFCandidateProducerForNoPileUpPFMEt::minJetPt_
private
double ShiftedPFCandidateProducerForNoPileUpPFMEt::shiftBy_
private
edm::EDGetTokenT<reco::PFJetCollection> ShiftedPFCandidateProducerForNoPileUpPFMEt::srcJetsToken_
private

Definition at line 54 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.

Referenced by produce().

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

Definition at line 53 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.

Referenced by produce().

double ShiftedPFCandidateProducerForNoPileUpPFMEt::unclEnUncertainty_
private