00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef ROOT_Minuit2_ABObj
00011 #define ROOT_Minuit2_ABObj
00012
00013 #include "Minuit2/ABTypes.h"
00014
00015 namespace ROOT {
00016
00017 namespace Minuit2 {
00018
00019
00020 template<class mtype, class M, class T>
00021 class ABObj {
00022
00023 public:
00024
00025 typedef mtype Type;
00026
00027 private:
00028
00029 ABObj() : fObject(M()), fFactor(T(0.)) {}
00030
00031 ABObj& operator=(const ABObj&) {return *this;}
00032
00033 template<class a, class b, class c>
00034 ABObj(const ABObj<a,b,c>&) : fObject(M()), fFactor(T(0.)) {}
00035
00036 template<class a, class b, class c>
00037 ABObj& operator=(const ABObj<a,b,c>&) {return *this;}
00038
00039 public:
00040
00041 ABObj(const M& obj) : fObject(obj), fFactor(T(1.)) {}
00042
00043 ABObj(const M& obj, T factor) : fObject(obj), fFactor(factor) {}
00044
00045 ~ABObj() {}
00046
00047 ABObj(const ABObj& obj) :
00048 fObject(obj.fObject), fFactor(obj.fFactor) {}
00049
00050 template<class b, class c>
00051 ABObj(const ABObj<mtype,b,c>& obj) :
00052 fObject(M(obj.Obj() )), fFactor(T(obj.f() )) {}
00053
00054 const M& Obj() const {return fObject;}
00055
00056 T f() const {return fFactor;}
00057
00058 private:
00059
00060 M fObject;
00061 T fFactor;
00062 };
00063
00064 class LAVector;
00065 template <> class ABObj<vec, LAVector, double> {
00066
00067 public:
00068
00069 typedef vec Type;
00070
00071 private:
00072
00073 ABObj& operator=(const ABObj&) {return *this;}
00074
00075 public:
00076
00077 ABObj(const LAVector& obj) : fObject(obj), fFactor(double(1.)) {}
00078
00079 ABObj(const LAVector& obj, double factor) : fObject(obj), fFactor(factor) {}
00080
00081 ~ABObj() {}
00082
00083
00084
00085
00086
00087
00088 template<class c>
00089 ABObj(const ABObj<vec,LAVector,c>& obj) :
00090 fObject(obj.fObject), fFactor(double(obj.fFactor)) {}
00091
00092 const LAVector& Obj() const {return fObject;}
00093
00094 double f() const {return fFactor;}
00095
00096 private:
00097
00098 const LAVector& fObject;
00099 double fFactor;
00100 };
00101
00102 class LASymMatrix;
00103 template <> class ABObj<sym, LASymMatrix, double> {
00104
00105 public:
00106
00107 typedef sym Type;
00108
00109 private:
00110
00111 ABObj& operator=(const ABObj&) {return *this;}
00112
00113 public:
00114
00115 ABObj(const LASymMatrix& obj) : fObject(obj), fFactor(double(1.)) {}
00116
00117 ABObj(const LASymMatrix& obj, double factor) : fObject(obj), fFactor(factor) {}
00118
00119 ~ABObj() {}
00120
00121 ABObj(const ABObj& obj) :
00122 fObject(obj.fObject), fFactor(obj.fFactor) {}
00123
00124 template<class c>
00125 ABObj(const ABObj<vec,LASymMatrix,c>& obj) :
00126 fObject(obj.fObject), fFactor(double(obj.fFactor)) {}
00127
00128 const LASymMatrix& Obj() const {return fObject;}
00129
00130 double f() const {return fFactor;}
00131
00132 private:
00133
00134 const LASymMatrix& fObject;
00135 double fFactor;
00136 };
00137
00138
00139 template<class mt, class M, class T>
00140 inline ABObj<mt, M, T> operator*(T f, const M& obj) {
00141 return ABObj<mt, M, T>(obj, f);
00142 }
00143
00144
00145 template<class mt, class M, class T>
00146 inline ABObj<mt, M, T> operator/(const M& obj, T f) {
00147 return ABObj<mt, M, T>(obj, T(1.)/f);
00148 }
00149
00150
00151 template<class mt, class M, class T>
00152 inline ABObj<mt,M,T> operator-(const M& obj) {
00153 return ABObj<mt,M,T>(obj, T(-1.));
00154 }
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 }
00173
00174 }
00175
00176 #endif // ROOT_Minuit2_ABObj