CMS 3D CMS Logo

ZSPJPTJetCorrector.cc
Go to the documentation of this file.
1 //
2 // Original Author: Olga Kodolova, September 2007
3 //
4 // ZSPJPT Jet Corrector
5 //
6 #include "ZSPJPTJetCorrector.h"
8 //#include "CondFormats/JetMETObjects/interface/SimpleL1OffsetCorrector.h"
9 
15 
16 using namespace std;
17 
18 
20 
21  iPU = fConfig.getParameter<int>("PU");
22  fixedPU = fConfig.getParameter<int>("FixedPU");
23 
24  if( iPU >= 0 || fixedPU > 0 ) {
25  theFilesL1Offset = fConfig.getParameter <vector<string> > ("tagNameOffset");
26  for(vector<string>::iterator it=theFilesL1Offset.begin(); it != theFilesL1Offset.end(); it++) {
27  std::string file="CondFormats/JetMETObjects/data/"+(*it)+".txt";
28  edm::FileInPath f2(file);
29  mSimpleCorrectorOffset.push_back(new SimpleZSPJPTJetCorrector (f2.fullPath()));
30  }
31  }
32 
33  theFilesZSP = fConfig.getParameter <vector<string> > ("tagName");
34  for(vector<string>::iterator it=theFilesZSP.begin(); it != theFilesZSP.end(); it++) {
35  std::string file="CondFormats/JetMETObjects/data/"+(*it)+".txt";
36  edm::FileInPath f1(file);
37  mSimpleCorrector.push_back(new SimpleZSPJPTJetCorrector (f1.fullPath()));
38  }
39 // cout<<" Size of correctors "<<mSimpleCorrector.size()<<" "<<mSimpleCorrectorOffset.size()<<endl;
40 }
41 
43 }
44 
45 double ZSPJPTJetCorrector::correction( const reco::Jet& fJet, const edm::Event& iEvent, const edm::EventSetup& iSetup) const
46 {
47  double b=1.;
48  int nPU = 0;
49  if(iPU > 0) {
50 // Look for the Lumi section
51 // LuminosityBlock lbID = iEvent.getLuminosityBlock();
52 // cout<<" Not implemented yet "<<iEvent.run()<<endl;
53  nPU=setPU();
54  } else { if(iPU==0) nPU=setPU(); }
55 
56  double a = mSimpleCorrector[nPU]->correctionPtEtaPhiE (fJet.p4().Pt(), fJet.p4().Eta(), fJet.p4().Phi(),fJet.p4().E());
57 
58  if(iPU >= 0) {
59  if(!mSimpleCorrectorOffset.empty()) {
60  b = mSimpleCorrectorOffset[nPU]->correctionPUEtEtaPhiP (fJet.p4().Pt(), fJet.p4().Eta(), fJet.p4().Phi(),fJet.p4().E());
61  }
62  }
63  double c = a * b;
64  return c;
65 }
66 
T getParameter(std::string const &) const
Base class for all types of Jets.
Definition: Jet.h:20
virtual double correction(const reco::Jet &, const edm::Event &, const edm::EventSetup &) const
apply correction using Event information
int iEvent
Definition: GenABIO.cc:224
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
ZSPJPTJetCorrector(const edm::ParameterSet &fParameters)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
std::string fullPath() const
Definition: FileInPath.cc:163