test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 {
9  inline virtual ~FFTSimpleScalingAdjuster() {}
10 
11  virtual void adjust(const MyJet& /* jet */, const Adjustable& in,
12  const double* factors, const unsigned lenFactors,
13  Adjustable* out) const
14  {
15  if (lenFactors != 1U)
16  throw cms::Exception("FFTJetBadConfig")
17  << "In FFTSimpleScalingAdjuster::adjust: wrong number of "
18  << "scales (expected 1, got " << lenFactors << ")\n";
19  assert(factors);
20  assert(out);
21  *out = in;
22  *out *= factors[0];
23  }
24 };
25 
26 template<class MyJet, class Adjustable>
27 struct FFTUncertaintyAdjuster : public AbsFFTJetAdjuster<MyJet, Adjustable>
28 {
29  inline virtual ~FFTUncertaintyAdjuster() {}
30 
31  virtual void adjust(const MyJet& /* jet */, const Adjustable& in,
32  const double* factors, const unsigned lenFactors,
33  Adjustable* out) const
34  {
35  if (lenFactors != 1U)
36  throw cms::Exception("FFTJetBadConfig")
37  << "In FFTUncertaintyAdjuster::adjust: wrong number of "
38  << "scales (expected 1, got " << lenFactors << ")\n";
39  assert(factors);
40  assert(out);
41  *out = in;
42  const double s = factors[0];
43  out->setVariance(in.variance() + s*s);
44  }
45 };
46 
47 template<class MyJet, class Adjustable>
49  public AbsFFTJetAdjuster<MyJet, Adjustable>
50 {
52 
53  virtual void adjust(const MyJet& /* jet */, const Adjustable& in,
54  const double* factors, const unsigned lenFactors,
55  Adjustable* out) const
56  {
57  if (lenFactors != 2U)
58  throw cms::Exception("FFTJetBadConfig")
59  << "In FFTScalingAdjusterWithUncertainty::adjust: wrong "
60  << "number of scales (expected 2, got " << lenFactors << ")\n";
61  assert(factors);
62  assert(out);
63  *out = in;
64  *out *= factors[0];
65  const double s = factors[1];
66  out->setVariance(in.variance() + s*s);
67  }
68 };
virtual void adjust(const MyJet &, const Adjustable &in, const double *factors, const unsigned lenFactors, Adjustable *out) const
virtual void adjust(const MyJet &, const Adjustable &in, const double *factors, const unsigned lenFactors, Adjustable *out) const
assert(m_qm.get())
virtual ~FFTUncertaintyAdjuster()
virtual void adjust(const MyJet &, const Adjustable &in, const double *factors, const unsigned lenFactors, Adjustable *out) const
virtual ~FFTSimpleScalingAdjuster()