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 
4 #include <vector>
5 #include "Alignment/Geners/interface/CPP11_shared_ptr.hh"
7 
8 template<class Jet, class Adjustable>
10 {
11 public:
12  typedef Jet jet_type;
13  typedef Adjustable adjustable_type;
14 
15  inline explicit AbsFFTJetScaleCalculator(
16  CPP11_shared_ptr<npstat::AbsMultivariateFunctor> f)
17  : functor(f), buffer_(f->minDim()) {}
18 
19  inline virtual ~AbsFFTJetScaleCalculator() {}
20 
21  inline double scale(const Jet& jet, const Adjustable& current) const
22  {
23  const unsigned dim = buffer_.size();
24  double* buf = dim ? &buffer_[0] : static_cast<double*>(nullptr);
25  this->map(jet, current, buf, dim);
26  return (*functor)(buf, dim);
27  }
28 
29 private:
30  AbsFFTJetScaleCalculator() = delete;
31 
32  virtual void map(const Jet& jet,
33  const Adjustable& current,
34  double* buf, unsigned dim) const = 0;
35 
36  CPP11_shared_ptr<npstat::AbsMultivariateFunctor> functor;
37  mutable std::vector<double> buffer_;
38 };
39 
40 #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.