CMS 3D CMS Logo

FFTJetScaleCalculators.h
Go to the documentation of this file.
1 #ifndef JetMETCorrections_FFTJetObjects_FFTJetScaleCalculators_h
2 #define JetMETCorrections_FFTJetObjects_FFTJetScaleCalculators_h
3 
4 #include <cassert>
5 #include <cmath>
6 
10 
11 template <class MyJet, class Adjustable>
12 class FFTEtaLogPtConeRadiusMapper : public AbsFFTJetScaleCalculator<MyJet, Adjustable> {
13 public:
14  inline explicit FFTEtaLogPtConeRadiusMapper(std::shared_ptr<npstat::AbsMultivariateFunctor> f)
15  : AbsFFTJetScaleCalculator<MyJet, Adjustable>(f) {}
16 
17 private:
18  inline void map(const MyJet& jet, const Adjustable& current, double* buf, const unsigned dim) const override {
19  assert(buf);
20  if (dim != 3)
21  throw cms::Exception("FFTJetBadConfig") << "In FFTEtaLogPtConeRadiusMapper::map: "
22  << "invalid table dimensionality: " << dim << std::endl;
23  buf[0] = current.vec().eta();
24  buf[1] = log(current.vec().pt());
25  buf[2] = jet.getFFTSpecific().f_recoScale();
26  }
27 };
28 
29 template <class MyJet, class Adjustable>
30 class FFTSpecificScaleCalculator : public AbsFFTJetScaleCalculator<MyJet, Adjustable> {
31 public:
32  //
33  // This class will assume the ownership of the
34  // AbsFFTSpecificScaleCalculator object provided
35  // in the constructor
36  //
37  inline FFTSpecificScaleCalculator(std::shared_ptr<npstat::AbsMultivariateFunctor> f,
39  : AbsFFTJetScaleCalculator<MyJet, Adjustable>(f), calc_(p) {
40  assert(p);
41  }
42 
43  inline ~FFTSpecificScaleCalculator() override { delete calc_; }
44 
45 private:
46  inline void map(const MyJet& jet, const Adjustable& current, double* buf, const unsigned dim) const override {
47  return calc_->mapFFTJet(jet, jet.getFFTSpecific(), current.vec(), buf, dim);
48  }
49 
51 };
52 
53 #endif // JetMETCorrections_FFTJetObjects_FFTJetScaleCalculators_h
FFTSpecificScaleCalculator(std::shared_ptr< npstat::AbsMultivariateFunctor > f, const AbsFFTSpecificScaleCalculator *p)
void map(const MyJet &jet, const Adjustable &current, double *buf, const unsigned dim) const override
assert(be >=bs)
virtual void mapFFTJet(const reco::Jet &jet, const reco::FFTJet< float > &fftJet, const math::XYZTLorentzVector &current, double *buf, unsigned dim) const =0
FFTEtaLogPtConeRadiusMapper(std::shared_ptr< npstat::AbsMultivariateFunctor > f)
double f[11][100]
void map(const MyJet &jet, const Adjustable &current, double *buf, const unsigned dim) const override
const AbsFFTSpecificScaleCalculator * calc_