1 #ifndef PhysicsTools_PatUtils_ShiftedJetProducerT_h
2 #define PhysicsTools_PatUtils_ShiftedJetProducerT_h
39 template <
typename T,
typename Textractor>
48 src_(cfg.getParameter<edm::InputTag>(
"src")),
54 if ( cfg.
exists(
"jecUncertaintyValue") ) {
58 if ( cfg.
exists(
"jetCorrInputFileName") ) {
68 <<
" from DB/SQLlite file." << std::endl;
86 produces<JetCollection>();
99 std::cout <<
"<ShiftedJetProducerT::produce>:" << std::endl;
117 for (
typename JetCollection::const_iterator originalJet = originalJets->begin();
118 originalJet != originalJets->end(); ++originalJet ) {
121 std::cout <<
"originalJet: Pt = " << originalJetP4.pt() <<
", eta = " << originalJetP4.eta() <<
", phi = " << originalJetP4.phi() << std::endl;
134 std::cout <<
"shift = " << shift << std::endl;
140 if ( rawJetP4.E() > 1.e-1 ) {
145 if ( corrJetP4upToL3.E() > 1.e-1 && corrJetP4upToL3Res.E() > 1.e-1 ) {
146 double residualJES = (corrJetP4upToL3Res.E()/corrJetP4upToL3.E()) - 1.;
147 shift = TMath::Sqrt(shift*shift + residualJES*residualJES);
154 std::cout <<
"shift*shiftBy = " << shift << std::endl;
157 T shiftedJet(*originalJet);
158 shiftedJet.setP4((1. + shift)*originalJetP4);
160 std::cout <<
"shiftedJet: Pt = " << shiftedJet.pt() <<
", eta = " << shiftedJet.eta() <<
", phi = " << shiftedJet.phi() << std::endl;
163 shiftedJets->push_back(shiftedJet);
166 evt.
put(shiftedJets);
JetCorrectorParameters * jetCorrParameters_
T getParameter(std::string const &) const
std::string jetCorrLabelUpToL3_
void produce(edm::Event &evt, const edm::EventSetup &es)
double jecUncertaintyValue_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::string jetCorrUncertaintyTag_
ShiftedJetProducerT(const edm::ParameterSet &cfg)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
JetCorrectionUncertainty * jecUncertainty_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
LocationCode location() const
Where was the file found?
std::string jetCorrLabelUpToL3Res_
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_