CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FFTJetAdjusters.h
Go to the documentation of this file.
1 #include <cassert>
2 
5 
6 template <class MyJet, class Adjustable>
7 struct FFTSimpleScalingAdjuster : public AbsFFTJetAdjuster<MyJet, Adjustable> {
8  inline ~FFTSimpleScalingAdjuster() override {}
9 
10  void adjust(const MyJet& /* jet */,
11  const Adjustable& in,
12  const double* factors,
13  const unsigned lenFactors,
14  Adjustable* out) const override {
15  if (lenFactors != 1U)
16  throw cms::Exception("FFTJetBadConfig") << "In FFTSimpleScalingAdjuster::adjust: wrong number of "
17  << "scales (expected 1, got " << lenFactors << ")\n";
18  assert(factors);
19  assert(out);
20  *out = in;
21  *out *= factors[0];
22  }
23 };
24 
25 template <class MyJet, class Adjustable>
26 struct FFTUncertaintyAdjuster : public AbsFFTJetAdjuster<MyJet, Adjustable> {
27  inline ~FFTUncertaintyAdjuster() override {}
28 
29  void adjust(const MyJet& /* jet */,
30  const Adjustable& in,
31  const double* factors,
32  const unsigned lenFactors,
33  Adjustable* out) const override {
34  if (lenFactors != 1U)
35  throw cms::Exception("FFTJetBadConfig") << "In FFTUncertaintyAdjuster::adjust: wrong number of "
36  << "scales (expected 1, got " << lenFactors << ")\n";
37  assert(factors);
38  assert(out);
39  *out = in;
40  const double s = factors[0];
41  out->setVariance(in.variance() + s * s);
42  }
43 };
44 
45 template <class MyJet, class Adjustable>
46 struct FFTScalingAdjusterWithUncertainty : public AbsFFTJetAdjuster<MyJet, Adjustable> {
48 
49  void adjust(const MyJet& /* jet */,
50  const Adjustable& in,
51  const double* factors,
52  const unsigned lenFactors,
53  Adjustable* out) const override {
54  if (lenFactors != 2U)
55  throw cms::Exception("FFTJetBadConfig") << "In FFTScalingAdjusterWithUncertainty::adjust: wrong "
56  << "number of scales (expected 2, got " << lenFactors << ")\n";
57  assert(factors);
58  assert(out);
59  *out = in;
60  *out *= factors[0];
61  const double s = factors[1];
62  out->setVariance(in.variance() + s * s);
63  }
64 };
void adjust(const MyJet &, const Adjustable &in, const double *factors, const unsigned lenFactors, Adjustable *out) const override
assert(be >=bs)
void adjust(const MyJet &, const Adjustable &in, const double *factors, const unsigned lenFactors, Adjustable *out) const override
~FFTUncertaintyAdjuster() override
void adjust(const MyJet &, const Adjustable &in, const double *factors, const unsigned lenFactors, Adjustable *out) const override
~FFTSimpleScalingAdjuster() override