#include <ShiftedPFCandidateProducerForNoPileUpPFMEt.h>
Public Member Functions | |
ShiftedPFCandidateProducerForNoPileUpPFMEt (const edm::ParameterSet &) | |
~ShiftedPFCandidateProducerForNoPileUpPFMEt () | |
Private Member Functions | |
void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
JetCorrectionUncertainty * | jecUncertainty_ |
edm::FileInPath | jetCorrInputFileName_ |
JetCorrectorParameters * | jetCorrParameters_ |
std::string | jetCorrPayloadName_ |
std::string | jetCorrUncertaintyTag_ |
double | minJetPt_ |
std::string | moduleLabel_ |
double | shiftBy_ |
edm::InputTag | srcJets_ |
edm::InputTag | srcPFCandidates_ |
double | unclEnUncertainty_ |
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 !!
Definition at line 40 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
ShiftedPFCandidateProducerForNoPileUpPFMEt::ShiftedPFCandidateProducerForNoPileUpPFMEt | ( | const edm::ParameterSet & | cfg | ) | [explicit] |
Definition at line 14 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.
References gather_cfg::cout, edm::ParameterSet::exists(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::FileInPath::isLocal(), jecUncertainty_, jetCorrInputFileName_, jetCorrParameters_, jetCorrPayloadName_, jetCorrUncertaintyTag_, minJetPt_, shiftBy_, srcJets_, srcPFCandidates_, and unclEnUncertainty_.
: moduleLabel_(cfg.getParameter<std::string>("@module_label")) { srcPFCandidates_ = cfg.getParameter<edm::InputTag>("srcPFCandidates"); srcJets_ = cfg.getParameter<edm::InputTag>("srcJets"); jetCorrUncertaintyTag_ = cfg.getParameter<std::string>("jetCorrUncertaintyTag"); if ( cfg.exists("jetCorrInputFileName") ) { jetCorrInputFileName_ = cfg.getParameter<edm::FileInPath>("jetCorrInputFileName"); if ( !jetCorrInputFileName_.isLocal()) throw cms::Exception("ShiftedJetProducerT") << " Failed to find JEC parameter file = " << jetCorrInputFileName_ << " !!\n"; std::cout << "Reading JEC parameters = " << jetCorrUncertaintyTag_ << " from file = " << jetCorrInputFileName_.fullPath() << "." << std::endl; jetCorrParameters_ = new JetCorrectorParameters(jetCorrInputFileName_.fullPath().data(), jetCorrUncertaintyTag_); jecUncertainty_ = new JetCorrectionUncertainty(*jetCorrParameters_); } else { std::cout << "Reading JEC parameters = " << jetCorrUncertaintyTag_ << " from DB/SQLlite file." << std::endl; jetCorrPayloadName_ = cfg.getParameter<std::string>("jetCorrPayloadName"); } minJetPt_ = cfg.getParameter<double>("minJetPt"); shiftBy_ = cfg.getParameter<double>("shiftBy"); unclEnUncertainty_ = cfg.getParameter<double>("unclEnUncertainty"); produces<reco::PFCandidateCollection>(); }
ShiftedPFCandidateProducerForNoPileUpPFMEt::~ShiftedPFCandidateProducerForNoPileUpPFMEt | ( | ) |
Definition at line 44 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.
{
// nothing to be done yet...
}
void ShiftedPFCandidateProducerForNoPileUpPFMEt::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 49 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.cc.
References deltaR(), alignCSCRings::e, reco::LeafCandidate::eta(), edm::EventSetup::get(), edm::Event::getByLabel(), reco::PFJet::getPFConstituents(), JetCorrectionUncertainty::getUncertainty(), jecUncertainty_, metsig::jet, jetCorrPayloadName_, jetCorrUncertaintyTag_, fwrapper::jets, minJetPt_, reco::LeafCandidate::pt(), edm::Event::put(), JetCorrectionUncertainty::setJetEta(), JetCorrectionUncertainty::setJetPt(), reco::LeafCandidate::setP4(), edm::shift, srcJets_, srcPFCandidates_, and unclEnUncertainty_.
{ edm::Handle<reco::PFCandidateCollection> originalPFCandidates; evt.getByLabel(srcPFCandidates_, originalPFCandidates); edm::Handle<reco::PFJetCollection> jets; evt.getByLabel(srcJets_, jets); std::vector<const reco::PFJet*> selectedJets; for ( reco::PFJetCollection::const_iterator jet = jets->begin(); jet != jets->end(); ++jet ) { if ( jet->pt() > minJetPt_ ) selectedJets.push_back(&(*jet)); } if ( jetCorrPayloadName_ != "" ) { edm::ESHandle<JetCorrectorParametersCollection> jetCorrParameterSet; es.get<JetCorrectionsRecord>().get(jetCorrPayloadName_, jetCorrParameterSet); const JetCorrectorParameters& jetCorrParameters = (*jetCorrParameterSet)[jetCorrUncertaintyTag_]; delete jecUncertainty_; jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters); } std::auto_ptr<reco::PFCandidateCollection> shiftedPFCandidates(new reco::PFCandidateCollection); for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin(); originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) { const reco::PFJet* jet_matched = 0; for ( std::vector<const reco::PFJet*>::iterator jet = selectedJets.begin(); jet != selectedJets.end(); ++jet ) { std::vector<reco::PFCandidatePtr> jetConstituents = (*jet)->getPFConstituents(); for ( std::vector<reco::PFCandidatePtr>::const_iterator jetConstituent = jetConstituents.begin(); jetConstituent != jetConstituents.end() && !jet_matched; ++jetConstituent ) { if ( deltaR(originalPFCandidate->p4(), (*jetConstituent)->p4()) < 1.e-2 ) jet_matched = (*jet); } } double shift = 0.; if ( jet_matched ) { jecUncertainty_->setJetEta(jet_matched->eta()); jecUncertainty_->setJetPt(jet_matched->pt()); shift = jecUncertainty_->getUncertainty(true); } else { shift = unclEnUncertainty_; } reco::Candidate::LorentzVector shiftedPFCandidateP4 = originalPFCandidate->p4(); shiftedPFCandidateP4 *= (1. + shift); reco::PFCandidate shiftedPFCandidate(*originalPFCandidate); shiftedPFCandidate.setP4(shiftedPFCandidateP4); shiftedPFCandidates->push_back(shiftedPFCandidate); } evt.put(shiftedPFCandidates); }
Definition at line 60 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by produce(), and ShiftedPFCandidateProducerForNoPileUpPFMEt().
Definition at line 56 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by ShiftedPFCandidateProducerForNoPileUpPFMEt().
Definition at line 59 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by ShiftedPFCandidateProducerForNoPileUpPFMEt().
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrPayloadName_ [private] |
Definition at line 57 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by produce(), and ShiftedPFCandidateProducerForNoPileUpPFMEt().
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::jetCorrUncertaintyTag_ [private] |
Definition at line 58 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by produce(), and ShiftedPFCandidateProducerForNoPileUpPFMEt().
double ShiftedPFCandidateProducerForNoPileUpPFMEt::minJetPt_ [private] |
Definition at line 62 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by produce(), and ShiftedPFCandidateProducerForNoPileUpPFMEt().
std::string ShiftedPFCandidateProducerForNoPileUpPFMEt::moduleLabel_ [private] |
Definition at line 51 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
double ShiftedPFCandidateProducerForNoPileUpPFMEt::shiftBy_ [private] |
Definition at line 64 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by ShiftedPFCandidateProducerForNoPileUpPFMEt().
Definition at line 54 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by produce(), and ShiftedPFCandidateProducerForNoPileUpPFMEt().
Definition at line 53 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by produce(), and ShiftedPFCandidateProducerForNoPileUpPFMEt().
double ShiftedPFCandidateProducerForNoPileUpPFMEt::unclEnUncertainty_ [private] |
Definition at line 66 of file ShiftedPFCandidateProducerForNoPileUpPFMEt.h.
Referenced by produce(), and ShiftedPFCandidateProducerForNoPileUpPFMEt().