1 #ifndef PhysicsTools_PatUtils_ShiftedJetProducerT_h
2 #define PhysicsTools_PatUtils_ShiftedJetProducerT_h
37 template <
typename T,
typename Textractor>
46 src_(cfg.getParameter<edm::InputTag>(
"src")),
53 if ( cfg.
exists(
"jecUncertaintyValue") ) {
57 if ( cfg.
exists(
"jetCorrInputFileName") ) {
67 <<
" from DB/SQLlite file." << std::endl;
85 produces<JetCollection>();
98 std::cout <<
"<ShiftedJetProducerT::produce>:" << std::endl;
116 for (
typename JetCollection::const_iterator originalJet = originalJets->begin();
117 originalJet != originalJets->end(); ++originalJet ) {
120 std::cout <<
"originalJet: Pt = " << originalJetP4.pt() <<
", eta = " << originalJetP4.eta() <<
", phi = " << originalJetP4.phi() << std::endl;
133 std::cout <<
"shift = " << shift << std::endl;
139 if ( rawJetP4.E() > 1.e-1 ) {
144 if ( corrJetP4upToL3.E() > 1.e-1 && corrJetP4upToL3Res.E() > 1.e-1 ) {
145 double residualJES = (corrJetP4upToL3Res.E()/corrJetP4upToL3.E()) - 1.;
146 shift = TMath::Sqrt(shift*shift + residualJES*residualJES);
153 std::cout <<
"shift*shiftBy = " << shift << std::endl;
156 T shiftedJet(*originalJet);
157 shiftedJet.setP4((1. + shift)*originalJetP4);
159 std::cout <<
"shiftedJet: Pt = " << shiftedJet.pt() <<
", eta = " << shiftedJet.eta() <<
", phi = " << shiftedJet.phi() << std::endl;
162 shiftedJets->push_back(shiftedJet);
165 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 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)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
JetCorrectionUncertainty * jecUncertainty_
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_
edm::EDGetTokenT< JetCollection > srcToken_