00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifdef GNUPRAGMA
00011 #pragma implementation
00012 #endif
00013
00014 #include "CLHEP/Vector/LorentzRotation.h"
00015 #include "CLHEP/Vector/LorentzVector.h"
00016
00017 #include <cmath>
00018
00019 namespace CLHEP {
00020
00021
00022
00023 HepLorentzRotation & HepLorentzRotation::set (const HepLorentzVector & ccol1,
00024 const HepLorentzVector & ccol2,
00025 const HepLorentzVector & ccol3,
00026 const HepLorentzVector & ccol4) {
00027
00028
00029
00030 ZMpvMetric_t savedMetric = HepLorentzVector::setMetric (TimePositive);
00031
00032 if ( ccol4.getT() < 0 ) {
00033 std::cerr << "HepLorentzRotation::set() - "
00034 << "column 4 supplied to define transformation has negative T component"
00035 << std::endl;
00036 *this = HepLorentzRotation();
00037 return *this;
00038 }
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 HepLorentzVector a, b, c, d;
00112 bool isLorentzTransformation = true;
00113 double norm;
00114
00115 d = ccol4;
00116 norm = d.dot(d);
00117 if (norm <= 0.0) {
00118 isLorentzTransformation = false;
00119 if (norm == 0.0) {
00120 d = T_HAT4;
00121 norm = 1.0;
00122 }
00123 }
00124 d /= norm;
00125
00126 c = ccol3 - ccol3.dot(d) * d;
00127 norm = -c.dot(c);
00128 if (norm <= 0.0) {
00129 isLorentzTransformation = false;
00130 if (norm == 0.0) {
00131 c = Z_HAT4;
00132 norm = 1.0;
00133 }
00134 }
00135 c /= norm;
00136
00137 b = ccol2 + ccol2.dot(c) * c - ccol2.dot(d) * d;
00138 norm = -b.dot(b);
00139 if (norm <= 0.0) {
00140 isLorentzTransformation = false;
00141 if (norm == 0.0) {
00142 b = Y_HAT4;
00143 norm = 1.0;
00144 }
00145 }
00146 b /= norm;
00147
00148 a = ccol1 + ccol1.dot(b) * b + ccol1.dot(c) * c - ccol1.dot(d) * d;
00149 norm = -a.dot(a);
00150 if (norm <= 0.0) {
00151 isLorentzTransformation = false;
00152 if (norm == 0.0) {
00153 a = X_HAT4;
00154 norm = 1.0;
00155 }
00156 }
00157 a /= norm;
00158
00159 if ( !isLorentzTransformation ) {
00160 std::cerr << "HepLorentzRotation::set() - "
00161 << "cols 1-4 supplied to define transformation form either \n"
00162 << " a boosted reflection or a tachyonic transformation -- \n"
00163 << " transformation will be set to Identity " << std::endl;
00164
00165 *this = HepLorentzRotation();
00166 }
00167
00168 if ( isLorentzTransformation ) {
00169 mxx = a.x(); myx = a.y(); mzx = a.z(); mtx = a.t();
00170 mxy = b.x(); myy = b.y(); mzy = b.z(); mty = b.t();
00171 mxz = c.x(); myz = c.y(); mzz = c.z(); mtz = c.t();
00172 mxt = d.x(); myt = d.y(); mzt = d.z(); mtt = d.t();
00173 }
00174
00175 HepLorentzVector::setMetric (savedMetric);
00176 return *this;
00177
00178 }
00179
00180 HepLorentzRotation & HepLorentzRotation::setRows
00181 (const HepLorentzVector & rrow1,
00182 const HepLorentzVector & rrow2,
00183 const HepLorentzVector & rrow3,
00184 const HepLorentzVector & rrow4) {
00185
00186 set (rrow1, rrow2, rrow3, rrow4);
00187
00188 register double q1, q2, q3;
00189 q1 = mxy; q2 = mxz; q3 = mxt;
00190 mxy = myx; mxz = mzx; mxt = mtx;
00191 myx = q1; mzx = q2; mtx = q3;
00192 q1 = myz; q2 = myt; q3 = mzt;
00193 myz = mzy; myt = mty; mzt = mtz;
00194 mzy = q1; mty = q2; mtz = q3;
00195 return *this;
00196 }
00197
00198 HepLorentzRotation::HepLorentzRotation ( const HepLorentzVector & ccol1,
00199 const HepLorentzVector & ccol2,
00200 const HepLorentzVector & ccol3,
00201 const HepLorentzVector & ccol4 )
00202 {
00203 set ( ccol1, ccol2, ccol3, ccol4 );
00204 }
00205
00206 }
00207