Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef JetMETCorrections_FFTJetObjects_L2AbsScaleCalculator_h
0002 #define JetMETCorrections_FFTJetObjects_L2AbsScaleCalculator_h
0003 
0004 #include <cmath>
0005 #include <cassert>
0006 
0007 #include "JetMETCorrections/FFTJetObjects/interface/AbsFFTSpecificScaleCalculator.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/Utilities/interface/Exception.h"
0010 
0011 class L2AbsScaleCalculator : public AbsFFTSpecificScaleCalculator {
0012 public:
0013   inline explicit L2AbsScaleCalculator(const edm::ParameterSet& ps)
0014       : m_radiusFactor(ps.getParameter<double>("radiusFactor")),
0015         m_zeroPtLog(ps.getParameter<double>("zeroPtLog")),
0016         m_takePtLog(ps.getParameter<bool>("takePtLog")) {}
0017 
0018   inline ~L2AbsScaleCalculator() override {}
0019 
0020   inline void mapFFTJet(const reco::Jet& /* jet */,
0021                         const reco::FFTJet<float>& fftJet,
0022                         const math::XYZTLorentzVector& current,
0023                         double* buf,
0024                         const unsigned dim) const override {
0025     if (dim != 2)
0026       throw cms::Exception("FFTJetBadConfig") << "In L2AbsScaleCalculator::mapFFTJet: "
0027                                               << "invalid table dimensionality: " << dim << std::endl;
0028     assert(buf);
0029     const double radius = fftJet.f_recoScale();
0030     const double pt = current.pt();
0031     buf[0] = radius * m_radiusFactor;
0032     if (m_takePtLog) {
0033       if (pt > 0.0)
0034         buf[1] = log(pt);
0035       else
0036         buf[1] = m_zeroPtLog;
0037     } else
0038       buf[1] = pt;
0039   }
0040 
0041 private:
0042   double m_radiusFactor;
0043   double m_zeroPtLog;
0044   bool m_takePtLog;
0045 };
0046 
0047 #endif  // JetMETCorrections_FFTJetObjects_L2AbsScaleCalculator_h