CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/JetMETCorrections/FFTJetObjects/interface/L2AbsScaleCalculator.h

Go to the documentation of this file.
00001 #ifndef JetMETCorrections_FFTJetObjects_L2AbsScaleCalculator_h
00002 #define JetMETCorrections_FFTJetObjects_L2AbsScaleCalculator_h
00003 
00004 #include <cmath>
00005 #include <cassert>
00006 
00007 #include "JetMETCorrections/FFTJetObjects/interface/AbsFFTSpecificScaleCalculator.h"
00008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00009 #include "FWCore/Utilities/interface/Exception.h"
00010 
00011 class L2AbsScaleCalculator : public AbsFFTSpecificScaleCalculator
00012 {
00013 public:
00014     inline explicit L2AbsScaleCalculator(const edm::ParameterSet& ps) 
00015         : m_radiusFactor(ps.getParameter<double>("radiusFactor")),
00016           m_zeroPtLog(ps.getParameter<double>("zeroPtLog")),
00017           m_takePtLog(ps.getParameter<bool>("takePtLog")) {}
00018 
00019     inline virtual ~L2AbsScaleCalculator() {}
00020 
00021     inline virtual void mapFFTJet(const reco::Jet& /* jet */,
00022                                   const reco::FFTJet<float>& fftJet,
00023                                   const math::XYZTLorentzVector& current,
00024                                   double* buf, const unsigned dim) const
00025     {
00026         if (dim != 2)
00027             throw cms::Exception("FFTJetBadConfig")
00028                 << "In L2AbsScaleCalculator::mapFFTJet: "
00029                 << "invalid table dimensionality: "
00030                 << dim << std::endl;
00031         assert(buf);
00032         const double radius = fftJet.f_recoScale();
00033         const double pt = current.pt();
00034         buf[0] = radius*m_radiusFactor;
00035         if (m_takePtLog)
00036         {
00037             if (pt > 0.0)
00038                 buf[1] = log(pt);
00039             else
00040                 buf[1] = m_zeroPtLog;
00041         }
00042         else
00043             buf[1] = pt;
00044     }
00045 
00046 private:
00047     double m_radiusFactor;
00048     double m_zeroPtLog;
00049     bool m_takePtLog;
00050 };
00051 
00052 #endif // JetMETCorrections_FFTJetObjects_L2AbsScaleCalculator_h