CMS 3D CMS Logo

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 
18  inline virtual ~AbsFFTJetScaleCalculator() {}
19 
20  inline double scale(const Jet& jet, const Adjustable& current) const {
21  const unsigned dim = buffer_.size();
22  double* buf = dim ? &buffer_[0] : static_cast<double*>(nullptr);
23  this->map(jet, current, buf, dim);
24  return (*functor)(buf, dim);
25  }
26 
27 private:
28  AbsFFTJetScaleCalculator() = delete;
29 
30  virtual void map(const Jet& jet, const Adjustable& current, double* buf, unsigned dim) const = 0;
31 
32  std::shared_ptr<npstat::AbsMultivariateFunctor> functor;
33  mutable std::vector<double> buffer_;
34 };
35 
36 #endif // JetMETCorrections_FFTJetObjects_AbsFFTJetScaleCalculator_h
std::shared_ptr< npstat::AbsMultivariateFunctor > functor
virtual void map(const Jet &jet, const Adjustable &current, double *buf, unsigned dim) const =0
double scale(const Jet &jet, const Adjustable &current) const
Definition: Jet.py:1
double f[11][100]
AbsFFTJetScaleCalculator(std::shared_ptr< npstat::AbsMultivariateFunctor > f)
Interface definition for multidimensional functors.