ABSum.h

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: ABSum.h 23970 2008-05-22 13:37:25Z moneta $
00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 #ifndef ROOT_Minuit2_ABSum
00011 #define ROOT_Minuit2_ABSum
00012 
00013 #include "Minuit2/ABObj.h"
00014 
00015 namespace ROOT {
00016 
00017    namespace Minuit2 {
00018 
00019 
00020 template<class M1, class M2>
00021 class ABSum {
00022 
00023 private:
00024 
00025   ABSum() : fA(M1()), fB(M2()) {}
00026 
00027   ABSum& operator=(const ABSum&) {return *this;}
00028 
00029   template<class MI1, class MI2>
00030   ABSum& operator=(const ABSum<MI1,MI2>&) {return *this;}
00031 
00032 public:
00033 
00034   ABSum(const M1& a, const M2& b): fA(a), fB(b) {}
00035 
00036   ~ABSum() {}
00037 
00038   ABSum(const ABSum& sum) : fA(sum.fA), fB(sum.fB) {}
00039 
00040   template<class MI1, class MI2>
00041   ABSum(const ABSum<MI1,MI2>& sum) : fA(M1(sum.A() )), fB(M2(sum.B() )) {}
00042 
00043   const M1& A() const {return fA;}
00044   const M2& B() const {return fB;}
00045 
00046 private:
00047 
00048   M1 fA;
00049   M2 fB;
00050 };
00051 
00052 // ABObj + ABObj
00053 template<class atype, class A, class btype, class B, class T>
00054 inline ABObj<typename AlgebraicSumType<atype, btype>::Type, ABSum<ABObj<atype,A,T>, ABObj<btype,B,T> >,T> operator+(const ABObj<atype,A,T>& a, const ABObj<btype,B,T>& b) {
00055 
00056   return ABObj<typename AlgebraicSumType<atype,btype>::Type, ABSum<ABObj<atype,A,T>, ABObj<btype,B,T> >,T>(ABSum<ABObj<atype,A,T>, ABObj<btype,B,T> >(a, b));
00057 }
00058 
00059 // ABObj - ABObj
00060 template<class atype, class A, class btype, class B, class T>
00061 inline ABObj<typename AlgebraicSumType<atype, btype>::Type, ABSum<ABObj<atype,A,T>, ABObj<btype,B,T> >,T> operator-(const ABObj<atype,A,T>& a, const ABObj<btype,B,T>& b) {
00062 
00063   return ABObj<typename AlgebraicSumType<atype,btype>::Type, ABSum<ABObj<atype,A,T>, ABObj<btype,B,T> >,T>(ABSum<ABObj<atype,A,T>, ABObj<btype,B,T> >(a, ABObj<btype,B,T>(b.Obj(), T(-1.)*b.f())));
00064 }
00065 
00066   }  // namespace Minuit2
00067 
00068 }  // namespace ROOT
00069 
00070 #endif  // ROOT_Minuit2_ABSum

Generated on Tue Jul 5 14:25:40 2011 for ROOT_528-00b_version by  doxygen 1.5.1