Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:24

0001 ////////////////////////////////////////////////////////////////////////////////
0002 //
0003 // L1FastjetCorrector
0004 // ------------------
0005 //
0006 //            08/09/2009 Philipp Schieferdecker <philipp.schieferdecker@cern.ch>
0007 ////////////////////////////////////////////////////////////////////////////////
0008 
0009 #include "JetMETCorrections/Algorithms/interface/L1FastjetCorrector.h"
0010 
0011 #include "FWCore/Utilities/interface/Exception.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 
0014 using namespace std;
0015 
0016 ////////////////////////////////////////////////////////////////////////////////
0017 // construction / destruction
0018 ////////////////////////////////////////////////////////////////////////////////
0019 
0020 //______________________________________________________________________________
0021 L1FastjetCorrector::L1FastjetCorrector(const JetCorrectorParameters& fParam, const edm::ParameterSet& fConfig)
0022     : srcRho_(fConfig.getParameter<edm::InputTag>("srcRho")) {
0023   if (fParam.definitions().level() != "L1FastJet")
0024     throw cms::Exception("L1FastjetCorrector")
0025         << " correction level: " << fParam.definitions().level() << " is not L1FastJet";
0026   vector<JetCorrectorParameters> vParam;
0027   vParam.push_back(fParam);
0028   mCorrector = new FactorizedJetCorrectorCalculator(vParam);
0029 }
0030 
0031 //______________________________________________________________________________
0032 L1FastjetCorrector::~L1FastjetCorrector() { delete mCorrector; }
0033 
0034 ////////////////////////////////////////////////////////////////////////////////
0035 // implementation of member functions
0036 ////////////////////////////////////////////////////////////////////////////////
0037 
0038 //______________________________________________________________________________
0039 double L1FastjetCorrector::correction(const LorentzVector& fJet) const {
0040   throw cms::Exception("EventRequired") << "Wrong interface correction(LorentzVector), event required!";
0041   return 1.0;
0042 }
0043 
0044 //______________________________________________________________________________
0045 double L1FastjetCorrector::correction(const reco::Jet& fJet) const {
0046   throw cms::Exception("EventRequired") << "Wrong interface correction(reco::Jet), event required!";
0047   return 1.0;
0048 }
0049 
0050 //______________________________________________________________________________
0051 double L1FastjetCorrector::correction(const reco::Jet& fJet,
0052                                       const edm::Event& fEvent,
0053                                       const edm::EventSetup& fSetup) const {
0054   edm::Handle<double> rho;
0055   fEvent.getByLabel(srcRho_, rho);
0056   double result(1.0);
0057   FactorizedJetCorrectorCalculator::VariableValues values;
0058   values.setJetEta(fJet.eta());
0059   values.setJetPt(fJet.pt());
0060   values.setJetE(fJet.energy());
0061   values.setJetA(fJet.jetArea());
0062   values.setRho(*rho);
0063   result = mCorrector->getCorrection(values);
0064   return result;
0065 }