File indexing completed on 2024-04-06 12:25:30
0001
0002
0003
0004
0005
0006 #include "ZSPJPTJetCorrector.h"
0007 #include "SimpleZSPJPTJetCorrector.h"
0008
0009
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "FWCore/ParameterSet/interface/FileInPath.h"
0013 #include "DataFormats/JetReco/interface/Jet.h"
0014 #include "DataFormats/Provenance/interface/LuminosityBlockID.h"
0015
0016 using namespace std;
0017
0018 ZSPJPTJetCorrector::ZSPJPTJetCorrector(const edm::ParameterSet& fConfig) {
0019 iPU = fConfig.getParameter<int>("PU");
0020 fixedPU = fConfig.getParameter<int>("FixedPU");
0021
0022 if (iPU >= 0 || fixedPU > 0) {
0023 theFilesL1Offset = fConfig.getParameter<vector<string> >("tagNameOffset");
0024 for (vector<string>::iterator it = theFilesL1Offset.begin(); it != theFilesL1Offset.end(); it++) {
0025 std::string file = "CondFormats/JetMETObjects/data/" + (*it) + ".txt";
0026 edm::FileInPath f2(file);
0027 mSimpleCorrectorOffset.push_back(new SimpleZSPJPTJetCorrector(f2.fullPath()));
0028 }
0029 }
0030
0031 theFilesZSP = fConfig.getParameter<vector<string> >("tagName");
0032 for (vector<string>::iterator it = theFilesZSP.begin(); it != theFilesZSP.end(); it++) {
0033 std::string file = "CondFormats/JetMETObjects/data/" + (*it) + ".txt";
0034 edm::FileInPath f1(file);
0035 mSimpleCorrector.push_back(new SimpleZSPJPTJetCorrector(f1.fullPath()));
0036 }
0037 }
0038
0039 ZSPJPTJetCorrector::~ZSPJPTJetCorrector() {}
0040
0041 double ZSPJPTJetCorrector::correction(const reco::Jet& fJet,
0042 const edm::Event& iEvent,
0043 const edm::EventSetup& iSetup) const {
0044 double b = 1.;
0045 int nPU = 0;
0046 if (iPU > 0) {
0047 nPU = setPU();
0048 } else {
0049 if (iPU == 0)
0050 nPU = setPU();
0051 }
0052
0053 double a =
0054 mSimpleCorrector[nPU]->correctionPtEtaPhiE(fJet.p4().Pt(), fJet.p4().Eta(), fJet.p4().Phi(), fJet.p4().E());
0055
0056 if (iPU >= 0) {
0057 if (!mSimpleCorrectorOffset.empty()) {
0058 b = mSimpleCorrectorOffset[nPU]->correctionPUEtEtaPhiP(
0059 fJet.p4().Pt(), fJet.p4().Eta(), fJet.p4().Phi(), fJet.p4().E());
0060 }
0061 }
0062 double c = a * b;
0063 return c;
0064 }