1 #ifndef PhysicsTools_PatUtils_ShiftedJetProducerT_h
2 #define PhysicsTools_PatUtils_ShiftedJetProducerT_h
36 template <
typename T,
typename Textractor>
49 if (cfg.
exists(
"jecUncertaintyValue")) {
53 if (cfg.
exists(
"jetCorrInputFileName")) {
60 jecUncertainty_ = std::make_unique<JetCorrectionUncertainty>(*jetCorrParameters_);
68 if (cfg.
exists(
"jetCorrLabelUpToL3")) {
82 produces<JetCollection>();
88 std::cout <<
"<ShiftedJetProducerT::produce>:" << std::endl;
101 auto shiftedJets = std::make_unique<JetCollection>();
106 jecUncertainty_ = std::make_unique<JetCorrectionUncertainty>(jetCorrParameters);
109 for (
typename JetCollection::const_iterator originalJet = originalJets->begin(); originalJet != originalJets->end();
113 std::cout <<
"originalJet: Pt = " << originalJetP4.pt() <<
", eta = " << originalJetP4.eta()
114 <<
", phi = " << originalJetP4.phi() << std::endl;
127 std::cout <<
"shift = " << shift << std::endl;
133 if (rawJetP4.E() > 1.e-1) {
142 if (corrJetP4upToL3.E() > 1.e-1 && corrJetP4upToL3Res.E() > 1.e-1) {
143 double residualJES = (corrJetP4upToL3Res.E() / corrJetP4upToL3.E()) - 1.;
144 shift =
sqrt(shift * shift + residualJES * residualJES);
151 std::cout <<
"shift*shiftBy = " << shift << std::endl;
154 T shiftedJet(*originalJet);
155 shiftedJet.setP4((1. + shift) * originalJetP4);
157 std::cout <<
"shiftedJet: Pt = " << shiftedJet.pt() <<
", eta = " << shiftedJet.eta()
158 <<
", phi = " << shiftedJet.phi() << std::endl;
161 shiftedJets->push_back(shiftedJet);
edm::EDGetTokenT< reco::JetCorrector > jetCorrTokenUpToL3_
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
edm::ESGetToken< JetCorrectorParametersCollection, JetCorrectionsRecord > jetCorrPayloadToken_
std::string jetCorrUncertaintyTag_
std::unique_ptr< JetCorrectionUncertainty > jecUncertainty_
bool getData(T &iHolder) const
ShiftedJetProducerT(const edm::ParameterSet &cfg)
edm::EDGetTokenT< reco::JetCorrector > jetCorrTokenUpToL3Res_
LocationCode location() const
Where was the file found?
T const * product() const
T getParameter(std::string const &) const
std::unique_ptr< JetCorrectorParameters > jetCorrParameters_
void produce(edm::Event &evt, const edm::EventSetup &es) override
Textractor jetCorrExtractor_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
static unsigned int const shift
std::string fullPath() const
edm::FileInPath jetCorrInputFileName_
std::vector< T > JetCollection
std::string jetCorrPayloadName_
edm::EDGetTokenT< JetCollection > srcToken_