1 #ifndef PhysicsTools_PatUtils_ShiftedJetProducerT_h 2 #define PhysicsTools_PatUtils_ShiftedJetProducerT_h 36 template <
typename T,
typename Textractor>
45 src_(cfg.getParameter<
edm::InputTag>(
"src")),
52 if ( cfg.
exists(
"jecUncertaintyValue") ) {
56 if ( cfg.
exists(
"jetCorrInputFileName") ) {
68 if ( cfg.
exists(
"jetCorrLabelUpToL3") ) {
84 produces<JetCollection>();
97 std::cout <<
"<ShiftedJetProducerT::produce>:" << std::endl;
110 auto shiftedJets = std::make_unique<JetCollection>();
120 for (
typename JetCollection::const_iterator originalJet = originalJets->begin();
121 originalJet != originalJets->end(); ++originalJet ) {
124 std::cout <<
"originalJet: Pt = " << originalJetP4.pt() <<
", eta = " << originalJetP4.eta() <<
", phi = " << originalJetP4.phi() << std::endl;
137 std::cout <<
"shift = " << shift << std::endl;
143 if ( rawJetP4.E() > 1.e-1 ) {
152 if ( corrJetP4upToL3.E() > 1.e-1 && corrJetP4upToL3Res.E() > 1.e-1 ) {
153 double residualJES = (corrJetP4upToL3Res.E()/corrJetP4upToL3.E()) - 1.;
154 shift =
sqrt(shift*shift + residualJES*residualJES);
161 std::cout <<
"shift*shiftBy = " << shift << std::endl;
164 T shiftedJet(*originalJet);
165 shiftedJet.setP4((1. + shift)*originalJetP4);
167 std::cout <<
"shiftedJet: Pt = " << shiftedJet.pt() <<
", eta = " << shiftedJet.eta() <<
", phi = " << shiftedJet.phi() << std::endl;
170 shiftedJets->push_back(shiftedJet);
JetCorrectorParameters * jetCorrParameters_
edm::EDGetTokenT< reco::JetCorrector > jetCorrTokenUpToL3_
T getParameter(std::string const &) const
void produce(edm::Event &evt, const edm::EventSetup &es)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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_
JetCorrectionUncertainty * jecUncertainty_
LocationCode location() const
Where was the file found?
T const * product() const
void setJetEta(float fEta)
Textractor jetCorrExtractor_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
static unsigned int const shift
std::string fullPath() const
edm::FileInPath jetCorrInputFileName_
float getUncertainty(bool fDirection)
std::vector< T > JetCollection
std::string jetCorrPayloadName_
edm::EDGetTokenT< JetCollection > srcToken_