1 #ifndef PhysicsTools_PatUtils_ShiftedJetProducerT_h
2 #define PhysicsTools_PatUtils_ShiftedJetProducerT_h
36 template <
typename T,
typename Textractor>
52 if ( cfg.
exists(
"jecUncertaintyValue") ) {
56 if ( cfg.
exists(
"jetCorrInputFileName") ) {
66 <<
" from DB/SQLlite file." << std::endl;
72 if ( cfg.
exists(
"jetCorrLabelUpToL3") ) {
88 produces<JetCollection>();
101 std::cout <<
"<ShiftedJetProducerT::produce>:" << std::endl;
124 for (
typename JetCollection::const_iterator originalJet = originalJets->begin();
125 originalJet != originalJets->end(); ++originalJet ) {
128 std::cout <<
"originalJet: Pt = " << originalJetP4.pt() <<
", eta = " << originalJetP4.eta() <<
", phi = " << originalJetP4.phi() << std::endl;
141 std::cout <<
"shift = " << shift << std::endl;
147 if ( rawJetP4.E() > 1.e-1 ) {
156 if ( corrJetP4upToL3.E() > 1.e-1 && corrJetP4upToL3Res.E() > 1.e-1 ) {
157 double residualJES = (corrJetP4upToL3Res.E()/corrJetP4upToL3.E()) - 1.;
158 shift =
sqrt(shift*shift + residualJES*residualJES);
165 std::cout <<
"shift*shiftBy = " << shift << std::endl;
168 T shiftedJet(*originalJet);
169 shiftedJet.setP4((1. + shift)*originalJetP4);
171 std::cout <<
"shiftedJet: Pt = " << shiftedJet.pt() <<
", eta = " << shiftedJet.eta() <<
", phi = " << shiftedJet.phi() << std::endl;
174 shiftedJets->push_back(shiftedJet);
177 evt.
put(shiftedJets);
JetCorrectorParameters * jetCorrParameters_
edm::EDGetTokenT< reco::JetCorrector > jetCorrTokenUpToL3_
T getParameter(std::string const &) const
void produce(edm::Event &evt, const edm::EventSetup &es)
edm::InputTag jetCorrLabelUpToL3Res_
double jecUncertaintyValue_
edm::InputTag jetCorrLabelUpToL3_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::string jetCorrUncertaintyTag_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ShiftedJetProducerT(const edm::ParameterSet &cfg)
edm::EDGetTokenT< reco::JetCorrector > jetCorrTokenUpToL3Res_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
JetCorrectionUncertainty * jecUncertainty_
T const * product() const
LocationCode location() const
Where was the file found?
void setJetEta(float fEta)
Textractor jetCorrExtractor_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
static unsigned int const shift
edm::FileInPath jetCorrInputFileName_
float getUncertainty(bool fDirection)
std::string fullPath() const
std::vector< T > JetCollection
std::string jetCorrPayloadName_
edm::EDGetTokenT< JetCollection > srcToken_