00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TEveVector.h"
00013 #include "TVector3.h"
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 ClassImp(TEveVectorT<Float_t>);
00026 ClassImp(TEveVectorT<Double_t>);
00027
00028
00029 template<typename TT> void TEveVectorT<TT>::Dump() const
00030 {
00031
00032
00033 printf("(%f, %f, %f)\n", fX, fY, fZ);
00034 }
00035
00036
00037 template<typename TT> void TEveVectorT<TT>::Set(const TVector3& v)
00038 {
00039
00040
00041 fX = v.x(); fY = v.y(); fZ = v.z();
00042 }
00043
00044
00045 template<typename TT> TT TEveVectorT<TT>::Eta() const
00046 {
00047
00048
00049 TT cosTheta = CosTheta();
00050 if (cosTheta*cosTheta < 1) return -0.5* TMath::Log( (1.0-cosTheta)/(1.0+cosTheta) );
00051 Warning("Eta","transverse momentum = 0, returning +/- 1e10");
00052 return (fZ >= 0) ? 1e10 : -1e10;
00053 }
00054
00055
00056 template<typename TT> TT TEveVectorT<TT>::Normalize(TT length)
00057 {
00058
00059
00060
00061 TT m = Mag();
00062 if (m != 0)
00063 {
00064 length /= m;
00065 fX *= length; fY *= length; fZ *= length;
00066 }
00067 return m;
00068 }
00069
00070
00071 template<typename TT> TEveVectorT<TT> TEveVectorT<TT>::Orthogonal() const
00072 {
00073
00074
00075 Float_t xx = fX < 0 ? -fX : fX;
00076 Float_t yy = fY < 0 ? -fY : fY;
00077 Float_t zz = fZ < 0 ? -fZ : fZ;
00078 if (xx < yy) {
00079 return xx < zz ? TEveVectorT<TT>(0,fZ,-fY) : TEveVectorT<TT>(fY,-fX,0);
00080 } else {
00081 return yy < zz ? TEveVectorT<TT>(-fZ,0,fX) : TEveVectorT<TT>(fY,-fX,0);
00082 }
00083 }
00084
00085
00086 template<typename TT> void TEveVectorT<TT>::OrthoNormBase(TEveVectorT<TT>& a, TEveVectorT<TT>& b) const
00087 {
00088
00089
00090
00091 a = Orthogonal();
00092 TMath::Cross(this->Arr(), a.Arr(), b.Arr());
00093 a.Normalize();
00094 b.Normalize();
00095 }
00096
00097 template class TEveVectorT<Float_t>;
00098 template class TEveVectorT<Double_t>;
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 ClassImp(TEveVector4T<Float_t>);
00112 ClassImp(TEveVector4T<Double_t>);
00113
00114
00115 template<typename TT> void TEveVector4T<TT>::Dump() const
00116 {
00117
00118
00119 printf("(%f, %f, %f; %f)\n", TP::fX, TP::fY, TP::fZ, fT);
00120 }
00121
00122 template class TEveVector4T<Float_t>;
00123 template class TEveVector4T<Double_t>;
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 ClassImp(TEveVector2T<Float_t>);
00137 ClassImp(TEveVector2T<Double_t>);
00138
00139
00140 template<typename TT> void TEveVector2T<TT>::Normalize(TT length)
00141 {
00142
00143
00144 Float_t m = Mag();
00145 if (m != 0)
00146 {
00147 m = length / m;
00148 fX *= m; fY *= m;
00149 }
00150 }
00151
00152
00153 template<typename TT> void TEveVector2T<TT>::Dump() const
00154 {
00155
00156
00157 printf("(%f, %f)\n", fX, fY);
00158 }
00159
00160 template class TEveVector2T<Float_t>;
00161 template class TEveVector2T<Double_t>;