CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AbsFFTJetScaleCalculator.h
Go to the documentation of this file.
1 #ifndef JetMETCorrections_FFTJetObjects_AbsFFTJetScaleCalculator_h
2 #define JetMETCorrections_FFTJetObjects_AbsFFTJetScaleCalculator_h
3 
5 
6 #include <memory>
7 #include <vector>
8 
9 template <class Jet, class Adjustable>
11 public:
12  typedef Jet jet_type;
13  typedef Adjustable adjustable_type;
14 
15  inline explicit AbsFFTJetScaleCalculator(std::shared_ptr<npstat::AbsMultivariateFunctor> f)
16  : functor(f), buffer_(f->minDim()) {}
17  AbsFFTJetScaleCalculator() = delete;
18 
19  inline virtual ~AbsFFTJetScaleCalculator() {}
20 
21  inline double scale(const Jet& jet, const Adjustable& current) const {
22  const unsigned dim = buffer_.size();
23  double* buf = dim ? &buffer_[0] : static_cast<double*>(nullptr);
24  this->map(jet, current, buf, dim);
25  return (*functor)(buf, dim);
26  }
27 
28 private:
29  virtual void map(const Jet& jet, const Adjustable& current, double* buf, unsigned dim) const = 0;
30 
31  std::shared_ptr<npstat::AbsMultivariateFunctor> functor;
32  mutable std::vector<double> buffer_;
33 };
34 
35 #endif // JetMETCorrections_FFTJetObjects_AbsFFTJetScaleCalculator_h
std::shared_ptr< npstat::AbsMultivariateFunctor > functor
double scale(const Jet &jet, const Adjustable &current) const
virtual void map(const Jet &jet, const Adjustable &current, double *buf, unsigned dim) const =0
AbsFFTJetScaleCalculator(std::shared_ptr< npstat::AbsMultivariateFunctor > f)
constexpr char Jet[]
Definition: modules.cc:9
Interface definition for multidimensional functors.