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 &)
 
 ~ShiftedPFCandidateProducerForNoPileUpPFMEt () 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

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<>
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.

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";
75  } else {
76  jetCorrPayloadName_ = cfg.getParameter<std::string>("jetCorrPayloadName");
77  }
78 
79  minJetPt_ = cfg.getParameter<double>("minJetPt");
80 
81  shiftBy_ = cfg.getParameter<double>("shiftBy");
82 
83  unclEnUncertainty_ = cfg.getParameter<double>("unclEnUncertainty");
84 
85  produces<reco::PFCandidateCollection>();
86 }

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

◆ ~ShiftedPFCandidateProducerForNoPileUpPFMEt()

ShiftedPFCandidateProducerForNoPileUpPFMEt::~ShiftedPFCandidateProducerForNoPileUpPFMEt ( )
override

Definition at line 88 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

88  {
89  // nothing to be done yet...
90 }

Member Function Documentation

◆ produce()

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

Definition at line 92 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

92  {
93  edm::Handle<reco::PFCandidateCollection> originalPFCandidates;
94  evt.getByToken(srcPFCandidatesToken_, originalPFCandidates);
95 
98 
99  std::vector<const reco::PFJet*> selectedJets;
100  for (reco::PFJetCollection::const_iterator jet = jets->begin(); jet != jets->end(); ++jet) {
101  if (jet->pt() > minJetPt_)
102  selectedJets.push_back(&(*jet));
103  }
104 
105  if (!jetCorrPayloadName_.empty()) {
107  es.get<JetCorrectionsRecord>().get(jetCorrPayloadName_, jetCorrParameterSet);
108  const JetCorrectorParameters& jetCorrParameters = (*jetCorrParameterSet)[jetCorrUncertaintyTag_];
109  delete jecUncertainty_;
110  jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters);
111  }
112 
113  auto shiftedPFCandidates = std::make_unique<reco::PFCandidateCollection>();
114  for (reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin();
115  originalPFCandidate != originalPFCandidates->end();
116  ++originalPFCandidate) {
117  const reco::PFJet* jet_matched = nullptr;
118  for (std::vector<const reco::PFJet*>::iterator jet = selectedJets.begin(); jet != selectedJets.end(); ++jet) {
119  std::vector<reco::PFCandidatePtr> jetConstituents = (*jet)->getPFConstituents();
120  for (std::vector<reco::PFCandidatePtr>::const_iterator jetConstituent = jetConstituents.begin();
121  jetConstituent != jetConstituents.end() && !jet_matched;
122  ++jetConstituent) {
123  if (deltaR(originalPFCandidate->p4(), (*jetConstituent)->p4()) < 1.e-2)
124  jet_matched = (*jet);
125  }
126  }
127 
128  double shift = 0.;
129  if (jet_matched) {
130  jecUncertainty_->setJetEta(jet_matched->eta());
131  jecUncertainty_->setJetPt(jet_matched->pt());
132 
134  } else {
136  }
137 
138  shift *= shiftBy_;
139 
140  reco::Candidate::LorentzVector shiftedPFCandidateP4 = originalPFCandidate->p4();
141  shiftedPFCandidateP4 *= (1. + shift);
142 
143  reco::PFCandidate shiftedPFCandidate(*originalPFCandidate);
144  shiftedPFCandidate.setP4(shiftedPFCandidateP4);
145 
146  shiftedPFCandidates->push_back(shiftedPFCandidate);
147  }
148 
149  evt.put(std::move(shiftedPFCandidates));
150 }

References PbPb_ZMuSkimMuonDPG_cff::deltaR, MillePedeFileConverter_cfg::e, reco::LeafCandidate::eta(), edm::EventSetup::get(), get, edm::Event::getByToken(), reco::PFJet::getPFConstituents(), JetCorrectionUncertainty::getUncertainty(), jecUncertainty_, metsig::jet, jetCorrPayloadName_, jetCorrUncertaintyTag_, singleTopDQM_cfi::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_.

Member Data Documentation

◆ jecUncertainty_

JetCorrectionUncertainty* ShiftedPFCandidateProducerForNoPileUpPFMEt::jecUncertainty_
private

◆ jetCorrInputFileName_

edm::FileInPath ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrInputFileName_
private

◆ jetCorrParameters_

JetCorrectorParameters* ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrParameters_
private

◆ jetCorrPayloadName_

std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrPayloadName_
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 49 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

Referenced by produce().

◆ srcPFCandidatesToken_

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

Definition at line 48 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.

Referenced by produce().

◆ unclEnUncertainty_

double ShiftedPFCandidateProducerForNoPileUpPFMEt::unclEnUncertainty_
private
reco::PFJet::getPFConstituents
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:41
ShiftedPFCandidateProducerForNoPileUpPFMEt::minJetPt_
double minJetPt_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:57
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
edm::Handle
Definition: AssociativeIterator.h:50
JetCorrectionUncertainty::setJetEta
void setJetEta(float fEta)
Definition: JetCorrectionUncertainty.cc:204
edm::FileInPath
Definition: FileInPath.h:61
ShiftedPFCandidateProducerForNoPileUpPFMEt::jecUncertainty_
JetCorrectionUncertainty * jecUncertainty_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:55
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
ShiftedPFCandidateProducerForNoPileUpPFMEt::shiftBy_
double shiftBy_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:59
edm::ESHandle
Definition: DTSurvey.h:22
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
JetCorrectionsRecord
Definition: JetCorrectionsRecord.h:11
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
JetCorrectionUncertainty::setJetPt
void setJetPt(float fPt)
Definition: JetCorrectionUncertainty.cc:209
edm::FileInPath::location
LocationCode location() const
Where was the file found?
Definition: FileInPath.cc:159
ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrPayloadName_
std::string jetCorrPayloadName_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:52
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrInputFileName_
edm::FileInPath jetCorrInputFileName_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:51
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
ShiftedPFCandidateProducerForNoPileUpPFMEt::srcPFCandidatesToken_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidatesToken_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:48
get
#define get
JetCorrectionUncertainty
Definition: JetCorrectionUncertainty.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper.cfg
cfg
Definition: looper.py:296
ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrUncertaintyTag_
std::string jetCorrUncertaintyTag_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:53
JetCorrectionUncertainty::getUncertainty
float getUncertainty(bool fDirection)
Definition: JetCorrectionUncertainty.cc:83
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::FileInPath::Unknown
Definition: FileInPath.h:63
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
metsig::jet
Definition: SignAlgoResolutions.h:47
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
JetCorrectorParameters
Definition: JetCorrectorParameters.h:25
ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrParameters_
JetCorrectorParameters * jetCorrParameters_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:54
ShiftedPFCandidateProducerForNoPileUpPFMEt::unclEnUncertainty_
double unclEnUncertainty_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:61
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
objectSelection_cff.selectedJets
selectedJets
Definition: objectSelection_cff.py:99
cms::Exception
Definition: Exception.h:70
ShiftedPFCandidateProducerForNoPileUpPFMEt::srcJetsToken_
edm::EDGetTokenT< reco::PFJetCollection > srcJetsToken_
Definition: ShiftedPFCandidateProducerForNoPileUpPFMEt.cc:49
reco::Candidate::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
edm::InputTag
Definition: InputTag.h:15
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37