CMS 3D CMS Logo

Ratio.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_Utilities_Ratio_h
2 #define PhysicsTools_Utilities_Ratio_h
3 #include <boost/static_assert.hpp>
4 
5 namespace funct {
6  template<typename A, typename B>
7  struct RatioStruct {
8  RatioStruct(const A & a, const B & b) : _1(a), _2(b) { }
9  double operator()() const {
10  return _1() / _2();
11  }
12  operator double() const {
13  return _1() / _2();
14  }
15  double operator()(double x) const {
16  return _1(x) / _2(x);
17  }
18  double operator()(double x, double y) const {
19  return _1(x, y) / _2(x, y);
20  }
21  A _1;
22  B _2;
23  };
24 
25  template<typename A, typename B>
26  struct Ratio{
28  static type combine(const A& a, const B& b) {
29  return type(a, b);
30  }
31  };
32 
33  template<typename A, typename B>
34  inline typename Ratio<A, B>::type operator/(const A& a, const B& b) {
35  return Ratio<A, B>::combine(a, b);
36  }
37 
38 }
39 
40 #endif
RatioStruct(const A &a, const B &b)
Definition: Ratio.h:8
Definition: Abs.h:5
Ratio< A, B >::type operator/(const A &a, const B &b)
Definition: Ratio.h:34
double operator()() const
Definition: Ratio.h:9
RatioStruct< A, B > type
Definition: Ratio.h:27
double b
Definition: hdecay.h:120
double operator()(double x, double y) const
Definition: Ratio.h:18
arg type
Definition: Factorize.h:37
double operator()(double x) const
Definition: Ratio.h:15
double a
Definition: hdecay.h:121
static type combine(const A &a, const B &b)
Definition: Ratio.h:28