%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                 %
%  GEANT manual in LaTeX form                              %
%                                                                 %
%  Michel Goossens (for translation into LaTeX)                   %
%  Version 1.00                                                   %
%  Last Mod. Jan 24 1991  1300   MG + IB                          %
%                                                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Origin{M. Hansroul}
\Version{Geant 3.16}\Routid{PHYS410}
\Submitted{01.09.76}    \Revised{16.12.93}
\Makehead{Rotations and Lorentz transformation}
\section{Subroutines}
\Shubr{GLOREN}{(BETA,PA,PB*)}
{\tt GLOREN} transforms the momentum and the energy from one 
Lorentz frame (A) to another (B). It uses the following input and output:
 
\begin{DLtt}{MMMMMMMM}
\item[BETA(4)] ({\tt REAL}) velocity components in light units
of frame B in frame A,
{\tt BETA(1$\ldots$3) $ = \vec{\beta}$, BETA(4)$=(1-\beta^2)^{-1/2} = 
\gamma$};
\item[PA(4)] ({\tt REAL}) momentum components in the frame (A);
\item[PB(4)] ({\tt REAL}) momentum components in the frame (B).
\end{DLtt}

{\tt GLOREN} is called from the routine {\tt GDECAY}.
The momentum $\vec{p}_A$ and energy $E_A$  in reference frame A are
transformed into the momentum $\vec{p}_B$ and energy $E_B$ in reference
frame B which translates with velocity $\vec{\beta}$ with respect
to A:
\begin{eqnarray*}
E_B        & = &\gamma (E_A - \vec{\beta}\cdot \vec{p}_A)\\
\vec{p}_B & = & \vec{p}_A +
\gamma \vec{\beta} \left(\frac{ \gamma \vec{\beta} \cdot \vec{p}_A}
{\gamma+1} - E_A \right)
\end{eqnarray*}

\Shubr{GDROT}{(P*,COSTH,SINTH,COSPH,SINPH)}
{\tt GDROT} rotates a vector from one reference system to another.

\begin{DLtt}{MMMMMMMM}
\item[P(3)] ({\tt REAL}) vector to rotate, overwritten on output;
\item[COSTH] ({\tt REAL}) cosine of the polar angle;
\item[SINTH] ({\tt REAL}) sine of the polar angle;
\item[COSPH] ({\tt REAL}) cosine of the azimuthal angle;
\item[SINPH] ({\tt REAL}) sine of the azimuthal angle;
\end{DLtt}

{\tt GDROT} is called from several routines to rotate a particle from
in the center-of-mass system to the {\tt GEANT} (laboratory) system.
The following rotation matrix is used:
\[ \left( \begin{array}{ccc}
\cos \theta \cos \phi & -\sin \phi   & \sin \theta \cos \phi \\
\cos \theta \sin \phi & \cos \phi    & \sin \theta \sin \phi \\
- \sin \theta         &  0           & \cos \theta     
\end{array}  \right )
=
\underbrace{
\left( \begin{array}{ccc}
\cos \phi & -\sin \phi & 0 \\
\sin \phi & \cos \phi  & 0 \\
0         &      0     & 1
\end{array}  \right )}_{\Dstm R_\phi}
\underbrace{
\left( \begin{array}{ccc}
\cos \theta  & 0 & \sin \theta \\
0            & 1 & 0           \\
-\sin \theta & 0 & \cos \theta
\end{array}  \right )}_{\Dstm R_\theta} \]
$R_\theta$ is a counterclockwise rotation around axis $y$ by an angle $\theta$, 
and $R_\phi$ is a counterclockwise rotation around axis $z'$ (rotated by an 
angle $\theta$ from the initial position) by an angle $\phi$.

\Shubr{GFANG}{(P,COSTH*,SINTH*,COSPH*,SINPH*,ROTATE*)}
\begin{DLtt}{MMMMMMMM}
\item[P(3)] ({\tt REAL}) input direction;
\item[COSTH] ({\tt REAL}) cosine of the polar angle;
\item[SINTH] ({\tt REAL}) sine of the polar angle;
\item[COSPH] ({\tt REAL}) cosine of the azimuthal angle;
\item[SINPH] ({\tt REAL}) sine of the azimuthal angle;
\item[ROTATE] ({\tt LOGICAL}) rotation flag, the rotation matrix is the unit
matrix if {\tt ROTATE=.FALSE.}, i.e. no rotation is needed;
\end{DLtt}

Find the sine and cosine of the polar and azimuthal angle of the direction
defined by the vector {\tt P}. If {\tt P} is along the $z$ axis, 
{\tt ROTATE=.FALSE.}.

\Shubr{GVROT}{(DCOSIN,PART*)}
\begin{DLtt}{MMMMMMMM}
\item[PART(3)] ({\tt REAL}) direction to be rotated, overwritten on output;
\item[DCOSIN(3)] ({\tt REAL}) direction of the new $z$ axis;
\end{DLtt}

Given the direction {\tt PART} in a system of reference $O$, it returns the
same direction in the system of reference where the $z$ axis of $O$ is
along {\tt DCOSIN}. This routine is very useful when the $\theta$
angle of a secondary particle is sampled in a reference frame where the
parent particle moves along the $z$ axis. Then the direction of the
secondary product in the {\tt MRS} is returned by \Rind{GVROT} if
{\tt DCOSIN} is the direction of the parent particle.

A call to \Rind{GVROT} is equivalent to the following code:
\begin{verbatim}
      DIMENSION PART(3), DCOSIN(3)
      LOGICAL ROTATE
      .
      .
      .
      CALL GFANG(DCOSIN,COSTH,SINTH,COSPH,SINPH,ROTATE)
      IF(ROTATE) CALL GDROT(PART,COSTH,SINTH,COSPH,SINPH)
\end{verbatim}

with the advantage that inside \Rind{GVROT} all calculations are performed
in double precision.
