13 #pragma implementation 
   16 #include "CLHEP/Vector/LorentzRotation.h" 
   26 HepLorentzRotation & HepLorentzRotation::set
 
   27                                 (
double bx, 
double by, 
double bz) {
 
   28   double bp2 = bx*bx + by*by + bz*bz;
 
   34   double gamma = 1.0 / std::sqrt(1.0 - bp2);
 
   35   double bgamma = gamma * gamma / (1.0 + gamma);
 
   36   mxx = 1.0 + bgamma * bx * bx;
 
   37   myy = 1.0 + bgamma * by * by;
 
   38   mzz = 1.0 + bgamma * bz * bz;
 
   39   mxy = myx = bgamma * bx * by;
 
   40   mxz = mzx = bgamma * bx * bz;
 
   41   myz = mzy = bgamma * by * bz;
 
   42   mxt = mtx = gamma * bx;
 
   43   myt = mty = gamma * by;
 
   44   mzt = mtz = gamma * bz;
 
   49 HepLorentzRotation & HepLorentzRotation::set 
 
   50                 (
const HepBoost & 
B, 
const HepRotation & R) {
 
   52   *
this = matrixMultiplication ( R.rep4x4() );
 
   56 HepLorentzRotation & HepLorentzRotation::set 
 
   57                 (
const HepRotation & R, 
const HepBoost & B) {
 
   59   *
this = matrixMultiplication ( B.rep4x4() );
 
   67 double HepLorentzRotation::operator () (
int i, 
int j)
 const {
 
   69     if (j == 0) { 
return xx(); }
 
   70     if (j == 1) { 
return xy(); }
 
   71     if (j == 2) { 
return xz(); } 
 
   72     if (j == 3) { 
return xt(); } 
 
   74     if (j == 0) { 
return yx(); }
 
   75     if (j == 1) { 
return yy(); }
 
   76     if (j == 2) { 
return yz(); } 
 
   77     if (j == 3) { 
return yt(); } 
 
   79     if (j == 0) { 
return zx(); }
 
   80     if (j == 1) { 
return zy(); }
 
   81     if (j == 2) { 
return zz(); } 
 
   82     if (j == 3) { 
return zt(); } 
 
   84     if (j == 0) { 
return tx(); }
 
   85     if (j == 1) { 
return ty(); }
 
   86     if (j == 2) { 
return tz(); } 
 
   87     if (j == 3) { 
return tt(); } 
 
   89   std::cerr << 
"HepLorentzRotation subscripting: bad indeces " 
   90             << 
"(" << i << 
"," << j << 
")\n";
 
   99 int HepLorentzRotation::compare( 
const HepLorentzRotation & m1  )
 const {
 
  100        if (mtt<m1.mtt) 
return -1; 
else if (mtt>m1.mtt) 
return 1;
 
  101   else if (mtz<m1.mtz) 
return -1; 
else if (mtz>m1.mtz) 
return 1;
 
  102   else if (mty<m1.mty) 
return -1; 
else if (mty>m1.mty) 
return 1;
 
  103   else if (mtx<m1.mtx) 
return -1; 
else if (mtx>m1.mtx) 
return 1;
 
  105   else if (mzt<m1.mzt) 
return -1; 
else if (mzt>m1.mzt) 
return 1;
 
  106   else if (mzz<m1.mzz) 
return -1; 
else if (mzz>m1.mzz) 
return 1;
 
  107   else if (mzy<m1.mzy) 
return -1; 
else if (mzy>m1.mzy) 
return 1;
 
  108   else if (mzx<m1.mzx) 
return -1; 
else if (mzx>m1.mzx) 
return 1;
 
  110   else if (myt<m1.myt) 
return -1; 
else if (myt>m1.myt) 
return 1;
 
  111   else if (myz<m1.myz) 
return -1; 
else if (myz>m1.myz) 
return 1;
 
  112   else if (myy<m1.myy) 
return -1; 
else if (myy>m1.myy) 
return 1;
 
  113   else if (myx<m1.myx) 
return -1; 
else if (myx>m1.myx) 
return 1;
 
  115   else if (mxt<m1.mxt) 
return -1; 
else if (mxt>m1.mxt) 
return 1;
 
  116   else if (mxz<m1.mxz) 
return -1; 
else if (mxz>m1.mxz) 
return 1;
 
  117   else if (mxy<m1.mxy) 
return -1; 
else if (mxy>m1.mxy) 
return 1;
 
  118   else if (mxx<m1.mxx) 
return -1; 
else if (mxx>m1.mxx) 
return 1;
 
  127 HepLorentzRotation::matrixMultiplication(
const HepRep4x4 & m1)
 const {
 
  128   return HepLorentzRotation(
 
  129     mxx*m1.xx_ + mxy*m1.yx_ + mxz*m1.zx_ + mxt*m1.tx_,
 
  130     mxx*m1.xy_ + mxy*m1.yy_ + mxz*m1.zy_ + mxt*m1.ty_,
 
  131     mxx*m1.xz_ + mxy*m1.yz_ + mxz*m1.zz_ + mxt*m1.tz_,
 
  132     mxx*m1.xt_ + mxy*m1.yt_ + mxz*m1.zt_ + mxt*m1.tt_,
 
  134     myx*m1.xx_ + myy*m1.yx_ + myz*m1.zx_ + myt*m1.tx_,
 
  135     myx*m1.xy_ + myy*m1.yy_ + myz*m1.zy_ + myt*m1.ty_,
 
  136     myx*m1.xz_ + myy*m1.yz_ + myz*m1.zz_ + myt*m1.tz_,
 
  137     myx*m1.xt_ + myy*m1.yt_ + myz*m1.zt_ + myt*m1.tt_,
 
  139     mzx*m1.xx_ + mzy*m1.yx_ + mzz*m1.zx_ + mzt*m1.tx_,
 
  140     mzx*m1.xy_ + mzy*m1.yy_ + mzz*m1.zy_ + mzt*m1.ty_,
 
  141     mzx*m1.xz_ + mzy*m1.yz_ + mzz*m1.zz_ + mzt*m1.tz_,
 
  142     mzx*m1.xt_ + mzy*m1.yt_ + mzz*m1.zt_ + mzt*m1.tt_,
 
  144     mtx*m1.xx_ + mty*m1.yx_ + mtz*m1.zx_ + mtt*m1.tx_,
 
  145     mtx*m1.xy_ + mty*m1.yy_ + mtz*m1.zy_ + mtt*m1.ty_,
 
  146     mtx*m1.xz_ + mty*m1.yz_ + mtz*m1.zz_ + mtt*m1.tz_,
 
  147     mtx*m1.xt_ + mty*m1.yt_ + mtz*m1.zt_ + mtt*m1.tt_ );
 
  150 HepLorentzRotation & HepLorentzRotation::rotateX(
double delta) {
 
  151   double c1 = std::cos (delta);
 
  152   double s1 = std::sin (delta);
 
  153   HepLorentzVector rowy = row2();
 
  154   HepLorentzVector rowz = row3();
 
  155   HepLorentzVector r2 = c1 * rowy - s1 * rowz;
 
  156   HepLorentzVector r3 = s1 * rowy + c1 * rowz;
 
  157   myx = r2.x();   myy = r2.y();   myz = r2.z();   myt = r2.t(); 
 
  158   mzx = r3.x();   mzy = r3.y();   mzz = r3.z();   mzt = r3.t(); 
 
  162 HepLorentzRotation & HepLorentzRotation::rotateY(
double delta) {
 
  163   double c1 = std::cos (delta);
 
  164   double s1 = std::sin (delta);
 
  165   HepLorentzVector rowx = row1();
 
  166   HepLorentzVector rowz = row3();
 
  167   HepLorentzVector r1 =  c1 * rowx + s1 * rowz;
 
  168   HepLorentzVector r3 = -s1 * rowx + c1 * rowz;
 
  169   mxx = r1.x();   mxy = r1.y();   mxz = r1.z();   mxt = r1.t(); 
 
  170   mzx = r3.x();   mzy = r3.y();   mzz = r3.z();   mzt = r3.t(); 
 
  174 HepLorentzRotation & HepLorentzRotation::rotateZ(
double delta) {
 
  175   double c1 = std::cos (delta);
 
  176   double s1 = std::sin (delta);
 
  177   HepLorentzVector rowx = row1();
 
  178   HepLorentzVector rowy = row2();
 
  179   HepLorentzVector r1 = c1 * rowx - s1 * rowy;
 
  180   HepLorentzVector r2 = s1 * rowx + c1 * rowy;
 
  181   mxx = r1.x();   mxy = r1.y();   mxz = r1.z();   mxt = r1.t();
 
  182   myx = r2.x();   myy = r2.y();   myz = r2.z();   myt = r2.t();
 
  186 HepLorentzRotation & HepLorentzRotation::boostX(
double beta) {
 
  187   double b2 = beta*beta;
 
  193   double g1  = 1.0/std::sqrt(1.0-b2);
 
  195   HepLorentzVector rowx = row1();
 
  196   HepLorentzVector rowt = row4();
 
  197   HepLorentzVector r1 =  g1 * rowx + bg * rowt;
 
  198   HepLorentzVector r4 = bg * rowx +  g1 * rowt;
 
  199   mxx = r1.x();   mxy = r1.y();   mxz = r1.z();   mxt = r1.t(); 
 
  200   mtx = r4.x();   mty = r4.y();   mtz = r4.z();   mtt = r4.t(); 
 
  204 HepLorentzRotation & HepLorentzRotation::boostY(
double beta) {
 
  205   double b2 = beta*beta;
 
  211   double g1  = 1.0/std::sqrt(1.0-b2);
 
  213   HepLorentzVector rowy = row2();
 
  214   HepLorentzVector rowt = row4();
 
  215   HepLorentzVector r2 =  g1 * rowy + bg * rowt;
 
  216   HepLorentzVector r4 = bg * rowy +  g1 * rowt;
 
  217   myx = r2.x();   myy = r2.y();   myz = r2.z();   myt = r2.t(); 
 
  218   mtx = r4.x();   mty = r4.y();   mtz = r4.z();   mtt = r4.t(); 
 
  222 HepLorentzRotation & HepLorentzRotation::boostZ(
double beta) {
 
  223   double b2 = beta*beta;
 
  229   double g1  = 1.0/std::sqrt(1.0-b2);
 
  231   HepLorentzVector rowz = row3();
 
  232   HepLorentzVector rowt = row4();
 
  233   HepLorentzVector r3 =  g1 * rowz + bg * rowt;
 
  234   HepLorentzVector r4 = bg * rowz +  g1 * rowt;
 
  235   mtx = r4.x();   mty = r4.y();   mtz = r4.z();   mtt = r4.t(); 
 
  236   mzx = r3.x();   mzy = r3.y();   mzz = r3.z();   mzt = r3.t(); 
 
  242         std::setw(11) << std::setprecision(6) << xx() << 
"   " <<
 
  243         std::setw(11) << std::setprecision(6) << xy() << 
"   " <<
 
  244         std::setw(11) << std::setprecision(6) << xz() << 
"   " <<
 
  245         std::setw(11) << std::setprecision(6) << xt() << 
")\n" 
  247         std::setw(11) << std::setprecision(6) << yx() << 
"   " <<
 
  248         std::setw(11) << std::setprecision(6) << yy() << 
"   " <<
 
  249         std::setw(11) << std::setprecision(6) << yz() << 
"   " <<
 
  250         std::setw(11) << std::setprecision(6) << yt() << 
")\n" 
  252         std::setw(11) << std::setprecision(6) << zx() << 
"   " <<
 
  253         std::setw(11) << std::setprecision(6) << zy() << 
"   " <<
 
  254         std::setw(11) << std::setprecision(6) << zz() << 
"   " <<
 
  255         std::setw(11) << std::setprecision(6) << zt() << 
")\n" 
  257         std::setw(11) << std::setprecision(6) << tx() << 
"   " <<
 
  258         std::setw(11) << std::setprecision(6) << ty() << 
"   " <<
 
  259         std::setw(11) << std::setprecision(6) << tz() << 
"   " <<
 
  260         std::setw(11) << std::setprecision(6) << tt() << 
") ]\n";
 
  265                                const HepLorentzRotation & lt) {
 
  268   return HepLorentzRotation( HepRep4x4(
 
  269          r.xx()*lt.xx() + r.xy()*lt.yx() + r.xz()*lt.zx() + r.xt()*lt.tx(),
 
  270          r.xx()*lt.xy() + r.xy()*lt.yy() + r.xz()*lt.zy() + r.xt()*lt.ty(),
 
  271          r.xx()*lt.xz() + r.xy()*lt.yz() + r.xz()*lt.zz() + r.xt()*lt.tz(),
 
  272          r.xx()*lt.xt() + r.xy()*lt.yt() + r.xz()*lt.zt() + r.xt()*lt.tt(),
 
  274          r.yx()*lt.xx() + r.yy()*lt.yx() + r.yz()*lt.zx() + r.yt()*lt.tx(),
 
  275          r.yx()*lt.xy() + r.yy()*lt.yy() + r.yz()*lt.zy() + r.yt()*lt.ty(),
 
  276          r.yx()*lt.xz() + r.yy()*lt.yz() + r.yz()*lt.zz() + r.yt()*lt.tz(),
 
  277          r.yx()*lt.xt() + r.yy()*lt.yt() + r.yz()*lt.zt() + r.yt()*lt.tt(),
 
  279          r.zx()*lt.xx() + r.zy()*lt.yx() + r.zz()*lt.zx() + r.zt()*lt.tx(),
 
  280          r.zx()*lt.xy() + r.zy()*lt.yy() + r.zz()*lt.zy() + r.zt()*lt.ty(),
 
  281          r.zx()*lt.xz() + r.zy()*lt.yz() + r.zz()*lt.zz() + r.zt()*lt.tz(),
 
  282          r.zx()*lt.xt() + r.zy()*lt.yt() + r.zz()*lt.zt() + r.zt()*lt.tt(),
 
  284          r.tx()*lt.xx() + r.ty()*lt.yx() + r.tz()*lt.zx() + r.tt()*lt.tx(),
 
  285          r.tx()*lt.xy() + r.ty()*lt.yy() + r.tz()*lt.zy() + r.tt()*lt.ty(),
 
  286          r.tx()*lt.xz() + r.ty()*lt.yz() + r.tz()*lt.zz() + r.tt()*lt.tz(),
 
  287          r.tx()*lt.xt() + r.ty()*lt.yt() + r.tz()*lt.zt() + r.tt()*lt.tt() ) );
 
  291 const HepLorentzRotation HepLorentzRotation::IDENTITY;
 
HepLorentzRotation operator*(const HepRotation &r, const HepLorentzRotation <)
 
double B(double temperature)
 
void print(G4double elem)