File indexing completed on 2025-01-18 10:10:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef ROOT_Minuit2_ABSum
0011 #define ROOT_Minuit2_ABSum
0012
0013 #include "Minuit2/ABObj.h"
0014
0015 namespace ROOT {
0016
0017 namespace Minuit2 {
0018
0019 template <class M1, class M2>
0020 class ABSum {
0021
0022 private:
0023 ABSum() : fA(M1()), fB(M2()) {}
0024
0025 ABSum &operator=(const ABSum &) { return *this; }
0026
0027 template <class MI1, class MI2>
0028 ABSum &operator=(const ABSum<MI1, MI2> &)
0029 {
0030 return *this;
0031 }
0032
0033 public:
0034 ABSum(const M1 &a, const M2 &b) : fA(a), fB(b) {}
0035
0036 ~ABSum() {}
0037
0038 ABSum(const ABSum &sum) : fA(sum.fA), fB(sum.fB) {}
0039
0040 template <class MI1, class MI2>
0041 ABSum(const ABSum<MI1, MI2> &sum) : fA(M1(sum.A())), fB(M2(sum.B()))
0042 {
0043 }
0044
0045 const M1 &A() const { return fA; }
0046 const M2 &B() const { return fB; }
0047
0048 private:
0049 M1 fA;
0050 M2 fB;
0051 };
0052
0053
0054 template <class atype, class A, class btype, class B, class T>
0055 inline ABObj<typename AlgebraicSumType<atype, btype>::Type, ABSum<ABObj<atype, A, T>, ABObj<btype, B, T>>, T>
0056 operator+(const ABObj<atype, A, T> &a, const ABObj<btype, B, T> &b)
0057 {
0058
0059 return ABObj<typename AlgebraicSumType<atype, btype>::Type, ABSum<ABObj<atype, A, T>, ABObj<btype, B, T>>, T>(
0060 ABSum<ABObj<atype, A, T>, ABObj<btype, B, T>>(a, b));
0061 }
0062
0063
0064 template <class atype, class A, class btype, class B, class T>
0065 inline ABObj<typename AlgebraicSumType<atype, btype>::Type, ABSum<ABObj<atype, A, T>, ABObj<btype, B, T>>, T>
0066 operator-(const ABObj<atype, A, T> &a, const ABObj<btype, B, T> &b)
0067 {
0068
0069 return ABObj<typename AlgebraicSumType<atype, btype>::Type, ABSum<ABObj<atype, A, T>, ABObj<btype, B, T>>, T>(
0070 ABSum<ABObj<atype, A, T>, ABObj<btype, B, T>>(a, ABObj<btype, B, T>(b.Obj(), T(-1.) * b.f())));
0071 }
0072
0073 }
0074
0075 }
0076
0077 #endif