#include <ShiftedJetProducerT.h>
Public Member Functions | |
ShiftedJetProducerT (const edm::ParameterSet &cfg) | |
~ShiftedJetProducerT () | |
Private Types | |
typedef std::vector< T > | JetCollection |
Private Member Functions | |
void | produce (edm::Event &evt, const edm::EventSetup &es) |
Private Attributes | |
bool | addResidualJES_ |
JetCorrectionUncertainty * | jecUncertainty_ |
double | jecUncertaintyValue_ |
double | jetCorrEtaMax_ |
Textractor | jetCorrExtractor_ |
edm::FileInPath | jetCorrInputFileName_ |
std::string | jetCorrLabelUpToL3_ |
std::string | jetCorrLabelUpToL3Res_ |
JetCorrectorParameters * | jetCorrParameters_ |
std::string | jetCorrPayloadName_ |
std::string | jetCorrUncertaintyTag_ |
std::string | moduleLabel_ |
double | shiftBy_ |
edm::InputTag | src_ |
int | verbosity_ |
Vary energy of jets by +/- 1 standard deviation, in order to estimate resulting uncertainty on MET
NOTE: energy scale uncertainties are taken from the Database
Definition at line 40 of file ShiftedJetProducerT.h.
typedef std::vector<T> ShiftedJetProducerT< T, Textractor >::JetCollection [private] |
Definition at line 42 of file ShiftedJetProducerT.h.
ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT | ( | const edm::ParameterSet & | cfg | ) | [inline, explicit] |
Definition at line 46 of file ShiftedJetProducerT.h.
References ShiftedJetProducerT< T, Textractor >::addResidualJES_, gather_cfg::cout, edm::ParameterSet::exists(), edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), ShiftedJetProducerT< T, Textractor >::jecUncertainty_, ShiftedJetProducerT< T, Textractor >::jecUncertaintyValue_, ShiftedJetProducerT< T, Textractor >::jetCorrEtaMax_, ShiftedJetProducerT< T, Textractor >::jetCorrInputFileName_, ShiftedJetProducerT< T, Textractor >::jetCorrLabelUpToL3_, ShiftedJetProducerT< T, Textractor >::jetCorrLabelUpToL3Res_, ShiftedJetProducerT< T, Textractor >::jetCorrParameters_, ShiftedJetProducerT< T, Textractor >::jetCorrPayloadName_, ShiftedJetProducerT< T, Textractor >::jetCorrUncertaintyTag_, edm::FileInPath::location(), ShiftedJetProducerT< T, Textractor >::shiftBy_, AlCaHLTBitMon_QueryRunRegistry::string, Unknown, and ShiftedJetProducerT< T, Textractor >::verbosity_.
: moduleLabel_(cfg.getParameter<std::string>("@module_label")), src_(cfg.getParameter<edm::InputTag>("src")), jetCorrPayloadName_(""), jetCorrParameters_(0), jecUncertainty_(0), jecUncertaintyValue_(-1.) { if ( cfg.exists("jecUncertaintyValue") ) { jecUncertaintyValue_ = cfg.getParameter<double>("jecUncertaintyValue"); } else { jetCorrUncertaintyTag_ = cfg.getParameter<std::string>("jetCorrUncertaintyTag"); if ( cfg.exists("jetCorrInputFileName") ) { jetCorrInputFileName_ = cfg.getParameter<edm::FileInPath>("jetCorrInputFileName"); if ( jetCorrInputFileName_.location() == edm::FileInPath::Unknown) 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"); } } addResidualJES_ = cfg.getParameter<bool>("addResidualJES"); jetCorrLabelUpToL3_ = ( cfg.exists("jetCorrLabelUpToL3") ) ? cfg.getParameter<std::string>("jetCorrLabelUpToL3") : ""; jetCorrLabelUpToL3Res_ = ( cfg.exists("jetCorrLabelUpToL3Res") ) ? cfg.getParameter<std::string>("jetCorrLabelUpToL3Res") : ""; jetCorrEtaMax_ = ( cfg.exists("jetCorrEtaMax") ) ? cfg.getParameter<double>("jetCorrEtaMax") : 9.9; shiftBy_ = cfg.getParameter<double>("shiftBy"); verbosity_ = ( cfg.exists("verbosity") ) ? cfg.getParameter<int>("verbosity") : 0; produces<JetCollection>(); }
ShiftedJetProducerT< T, Textractor >::~ShiftedJetProducerT | ( | ) | [inline] |
Definition at line 88 of file ShiftedJetProducerT.h.
References ShiftedJetProducerT< T, Textractor >::jecUncertainty_, and ShiftedJetProducerT< T, Textractor >::jetCorrParameters_.
{ delete jetCorrParameters_; delete jecUncertainty_; }
void ShiftedJetProducerT< T, Textractor >::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [inline, private, virtual] |
Implements edm::EDProducer.
Definition at line 96 of file ShiftedJetProducerT.h.
References ShiftedJetProducerT< T, Textractor >::addResidualJES_, gather_cfg::cout, edm::EventSetup::get(), edm::Event::getByLabel(), JetCorrectionUncertainty::getUncertainty(), ShiftedJetProducerT< T, Textractor >::jecUncertainty_, ShiftedJetProducerT< T, Textractor >::jecUncertaintyValue_, ShiftedJetProducerT< T, Textractor >::jetCorrEtaMax_, ShiftedJetProducerT< T, Textractor >::jetCorrExtractor_, ShiftedJetProducerT< T, Textractor >::jetCorrLabelUpToL3_, ShiftedJetProducerT< T, Textractor >::jetCorrLabelUpToL3Res_, ShiftedJetProducerT< T, Textractor >::jetCorrPayloadName_, ShiftedJetProducerT< T, Textractor >::jetCorrUncertaintyTag_, edm::InputTag::label(), ShiftedJetProducerT< T, Textractor >::moduleLabel_, edm::Event::put(), JetCorrectionUncertainty::setJetEta(), JetCorrectionUncertainty::setJetPt(), edm::shift, ShiftedJetProducerT< T, Textractor >::shiftBy_, ShiftedJetProducerT< T, Textractor >::src_, and ShiftedJetProducerT< T, Textractor >::verbosity_.
{ if ( verbosity_ ) { std::cout << "<ShiftedJetProducerT::produce>:" << std::endl; std::cout << " moduleLabel = " << moduleLabel_ << std::endl; std::cout << " src = " << src_.label() << std::endl; } edm::Handle<JetCollection> originalJets; evt.getByLabel(src_, originalJets); std::auto_ptr<JetCollection> shiftedJets(new JetCollection); if ( jetCorrPayloadName_ != "" ) { edm::ESHandle<JetCorrectorParametersCollection> jetCorrParameterSet; es.get<JetCorrectionsRecord>().get(jetCorrPayloadName_, jetCorrParameterSet); const JetCorrectorParameters& jetCorrParameters = (*jetCorrParameterSet)[jetCorrUncertaintyTag_]; delete jecUncertainty_; jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters); } for ( typename JetCollection::const_iterator originalJet = originalJets->begin(); originalJet != originalJets->end(); ++originalJet ) { reco::Candidate::LorentzVector originalJetP4 = originalJet->p4(); if ( verbosity_ ) { std::cout << "originalJet: Pt = " << originalJetP4.pt() << ", eta = " << originalJetP4.eta() << ", phi = " << originalJetP4.phi() << std::endl; } double shift = 0.; if ( jecUncertaintyValue_ != -1. ) { shift = jecUncertaintyValue_; } else { jecUncertainty_->setJetEta(originalJetP4.eta()); jecUncertainty_->setJetPt(originalJetP4.pt()); shift = jecUncertainty_->getUncertainty(true); } if ( verbosity_ ) { std::cout << "shift = " << shift << std::endl; } if ( addResidualJES_ ) { static SmearedJetProducer_namespace::RawJetExtractorT<T> rawJetExtractor; reco::Candidate::LorentzVector rawJetP4 = rawJetExtractor(*originalJet); if ( rawJetP4.E() > 1.e-1 ) { reco::Candidate::LorentzVector corrJetP4upToL3 = jetCorrExtractor_(*originalJet, jetCorrLabelUpToL3_, &evt, &es, jetCorrEtaMax_, &rawJetP4); reco::Candidate::LorentzVector corrJetP4upToL3Res = jetCorrExtractor_(*originalJet, jetCorrLabelUpToL3Res_, &evt, &es, jetCorrEtaMax_, &rawJetP4); if ( corrJetP4upToL3.E() > 1.e-1 && corrJetP4upToL3Res.E() > 1.e-1 ) { double residualJES = (corrJetP4upToL3Res.E()/corrJetP4upToL3.E()) - 1.; shift = TMath::Sqrt(shift*shift + residualJES*residualJES); } } } shift *= shiftBy_; if ( verbosity_ ) { std::cout << "shift*shiftBy = " << shift << std::endl; } T shiftedJet(*originalJet); shiftedJet.setP4((1. + shift)*originalJetP4); if ( verbosity_ ) { std::cout << "shiftedJet: Pt = " << shiftedJet.pt() << ", eta = " << shiftedJet.eta() << ", phi = " << shiftedJet.phi() << std::endl; } shiftedJets->push_back(shiftedJet); } evt.put(shiftedJets); }
bool ShiftedJetProducerT< T, Textractor >::addResidualJES_ [private] |
Definition at line 179 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), and ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().
JetCorrectionUncertainty* ShiftedJetProducerT< T, Textractor >::jecUncertainty_ [private] |
Definition at line 177 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT(), and ShiftedJetProducerT< T, Textractor >::~ShiftedJetProducerT().
double ShiftedJetProducerT< T, Textractor >::jecUncertaintyValue_ [private] |
Definition at line 189 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), and ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().
double ShiftedJetProducerT< T, Textractor >::jetCorrEtaMax_ [private] |
Definition at line 182 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), and ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().
Textractor ShiftedJetProducerT< T, Textractor >::jetCorrExtractor_ [private] |
Definition at line 187 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce().
edm::FileInPath ShiftedJetProducerT< T, Textractor >::jetCorrInputFileName_ [private] |
Definition at line 173 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().
std::string ShiftedJetProducerT< T, Textractor >::jetCorrLabelUpToL3_ [private] |
Definition at line 180 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), and ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().
std::string ShiftedJetProducerT< T, Textractor >::jetCorrLabelUpToL3Res_ [private] |
Definition at line 181 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), and ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().
JetCorrectorParameters* ShiftedJetProducerT< T, Textractor >::jetCorrParameters_ [private] |
Definition at line 176 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT(), and ShiftedJetProducerT< T, Textractor >::~ShiftedJetProducerT().
std::string ShiftedJetProducerT< T, Textractor >::jetCorrPayloadName_ [private] |
Definition at line 174 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), and ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().
std::string ShiftedJetProducerT< T, Textractor >::jetCorrUncertaintyTag_ [private] |
Definition at line 175 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), and ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().
std::string ShiftedJetProducerT< T, Textractor >::moduleLabel_ [private] |
Definition at line 169 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce().
double ShiftedJetProducerT< T, Textractor >::shiftBy_ [private] |
Definition at line 191 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), and ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().
edm::InputTag ShiftedJetProducerT< T, Textractor >::src_ [private] |
Definition at line 171 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce().
int ShiftedJetProducerT< T, Textractor >::verbosity_ [private] |
Definition at line 193 of file ShiftedJetProducerT.h.
Referenced by ShiftedJetProducerT< T, Textractor >::produce(), and ShiftedJetProducerT< T, Textractor >::ShiftedJetProducerT().