// @(#)root/minuit2:$Id$ // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005 /********************************************************************** * * * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT * * * **********************************************************************/ #ifndef ROOT_Minuit2_ABSum #define ROOT_Minuit2_ABSum #include "Minuit2/ABObj.h" namespace ROOT { namespace Minuit2 { template class ABSum { private: ABSum() : fA(M1()), fB(M2()) {} ABSum &operator=(const ABSum &) { return *this; } template ABSum &operator=(const ABSum &) { return *this; } public: ABSum(const M1 &a, const M2 &b) : fA(a), fB(b) {} ~ABSum() {} ABSum(const ABSum &sum) : fA(sum.fA), fB(sum.fB) {} template ABSum(const ABSum &sum) : fA(M1(sum.A())), fB(M2(sum.B())) { } const M1 &A() const { return fA; } const M2 &B() const { return fB; } private: M1 fA; M2 fB; }; // ABObj + ABObj template inline ABObj::Type, ABSum, ABObj>, T> operator+(const ABObj &a, const ABObj &b) { return ABObj::Type, ABSum, ABObj>, T>( ABSum, ABObj>(a, b)); } // ABObj - ABObj template inline ABObj::Type, ABSum, ABObj>, T> operator-(const ABObj &a, const ABObj &b) { return ABObj::Type, ABSum, ABObj>, T>( ABSum, ABObj>(a, ABObj(b.Obj(), T(-1.) * b.f()))); } } // namespace Minuit2 } // namespace ROOT #endif // ROOT_Minuit2_ABSum