View Javadoc

1   package org.lcsim.recon.tracking.spacegeom;
2   
3   /**
4    *
5    * @author Norman A. Graf
6    *
7    * @version $Id: SphericalPointTensor.java,v 1.1 2011/07/06 17:22:35 ngraf Exp $
8    */
9   public class SphericalPointTensor extends SpacePointTensor
10  {
11  // Construct a spherical tensor from space point and direction.
12  
13      public SphericalPointTensor(SpacePoint spt,
14              double trr, double trt, double trp,
15              double ttr, double ttt, double ttp,
16              double tpr, double tpt, double tpp)
17      {
18          super(spt);
19          double c_phi = cosPhi();
20          double s_phi = sinPhi();
21          double c_th = cosTheta();
22          double s_th = sinTheta();
23          double arx = trr * s_th * c_phi + trt * c_th * c_phi - trp * s_phi;
24          double ary = trr * s_th * s_phi + trt * c_th * s_phi + trp * c_phi;
25          double arz = trr * c_th - trt * s_th;
26          double atx = ttr * s_th * c_phi + ttt * c_th * c_phi - ttp * s_phi;
27          double aty = ttr * s_th * s_phi + ttt * c_th * s_phi + ttp * c_phi;
28          double atz = ttr * c_th - ttt * s_th;
29          double apx = tpr * s_th * c_phi + tpt * c_th * c_phi - tpp * s_phi;
30          double apy = tpr * s_th * s_phi + tpt * c_th * s_phi + tpp * c_phi;
31          double apz = tpr * c_th - tpt * s_th;
32          _txx = arx * s_th * c_phi + atx * c_th * c_phi - apx * s_phi;
33          _txy = ary * s_th * c_phi + aty * c_th * c_phi - apy * s_phi;
34          _txz = arz * s_th * c_phi + atz * c_th * c_phi - apz * s_phi;
35          _tyx = arx * s_th * s_phi + atx * c_th * s_phi + apx * c_phi;
36          _tyy = ary * s_th * s_phi + aty * c_th * s_phi + apy * c_phi;
37          _tyz = arz * s_th * s_phi + atz * c_th * s_phi + apz * c_phi;
38          _tzx = arx * c_th - atx * s_th;
39          _tzy = ary * c_th - aty * s_th;
40          _tzz = arz * c_th - atz * s_th;
41      }
42  
43  // Construct a spherical tensor from coordinates and direction.
44      public SphericalPointTensor(double r, double phi, double theta,
45              double trr, double trt, double trp,
46              double ttr, double ttt, double ttp,
47              double tpr, double tpt, double tpp)
48      {
49          super(new SphericalPoint(r, phi, theta));
50          double c_phi = cosPhi();
51          double s_phi = sinPhi();
52          double c_th = cosTheta();
53          double s_th = sinTheta();
54          double arx = trr * s_th * c_phi + trt * c_th * c_phi - trp * s_phi;
55          double ary = trr * s_th * s_phi + trt * c_th * s_phi + trp * c_phi;
56          double arz = trr * c_th - trt * s_th;
57          double atx = ttr * s_th * c_phi + ttt * c_th * c_phi - ttp * s_phi;
58          double aty = ttr * s_th * s_phi + ttt * c_th * s_phi + ttp * c_phi;
59          double atz = ttr * c_th - ttt * s_th;
60          double apx = tpr * s_th * c_phi + tpt * c_th * c_phi - tpp * s_phi;
61          double apy = tpr * s_th * s_phi + tpt * c_th * s_phi + tpp * c_phi;
62          double apz = tpr * c_th - tpt * s_th;
63          _txx = arx * s_th * c_phi + atx * c_th * c_phi - apx * s_phi;
64          _txy = ary * s_th * c_phi + aty * c_th * c_phi - apy * s_phi;
65          _txz = arz * s_th * c_phi + atz * c_th * c_phi - apz * s_phi;
66          _tyx = arx * s_th * s_phi + atx * c_th * s_phi + apx * c_phi;
67          _tyy = ary * s_th * s_phi + aty * c_th * s_phi + apy * c_phi;
68          _tyz = arz * s_th * s_phi + atz * c_th * s_phi + apz * c_phi;
69          _tzx = arx * c_th - atx * s_th;
70          _tzy = ary * c_th - aty * s_th;
71          _tzz = arz * c_th - atz * s_th;
72      }
73  
74  }