ROOTPWA
lorentz.cc
Go to the documentation of this file.
1 #include <lorentz.h>
2 
3 
5 rotation::set(double alpha, double beta, double gamma)
6 {
7  double ca, sa, cb, sb, cg, sg;
8 
9  ca = cos(alpha);
10  sa = sin(alpha);
11  cb = cos(beta);
12  sb = sin(beta);
13  cg = cos(gamma);
14  sg = sin(gamma);
15 
16  this->el(0, 0) = ca * cb * cg - sa * sg;
17  this->el(0, 1) = cb * cg * sa + ca * sg;
18  this->el(0, 2) = -cg * sb;
19 
20  this->el(1, 0) = -sg * cb * ca - cg * sa;
21  this->el(1, 1) = -sg * cb * sa + cg * ca;
22  this->el(1, 2) = sb * sg;
23 
24  this->el(2, 0) = ca * sb;
25  this->el(2, 1) = sa * sb;
26  this->el(2, 2) = cb;
27 
28  return (*this);
29 }
30 
31 
32 rotation::rotation(double alpha, double beta, double gamma)
33  : matrix<double>(3, 3)
34 {
35  this->set(alpha, beta, gamma);
36 }
37 
38 
41 {
42  this->set(V.phi(), V.theta(), 0.0);
43  return (*this);
44 }
45 
46 
49 {
50  V = R * V;
51  return V;
52 }
53 
54 
55 //particle operator*=(particle& part,const rotation& R) {
56 // part._p._V *= R*part._p._V;
57 // return part;
58 //}
59 
60 
63 {
64  this->zero();
65  for (int row = 1; row < 4; ++row)
66  for (int col = 1; col < 4; ++col) {
67  // this->el(row, col) = r.el(row - 1, col - 1);
68  this->el(row, col) = (const_cast<rotation*>(&r))->el(row - 1, col - 1);
69  }
70  this->el(0, 0) = 1;
71  return(*this);
72 }
73 
74 
76  lorentzTransform::set(double alpha, double beta, double gamma)
77 {
78  rotation r(alpha, beta, gamma);
79  this->zero();
80  this->set(r);
81  return(*this);
82 }
83 
84 
85 lorentzTransform::lorentzTransform(double alpha, double beta, double gamma)
86  : matrix<double>(4, 4)
87 {
88  this->set(alpha, beta, gamma);
89 }
90 
91 
93  : matrix<double>(4, 4)
94 {
95  this->set(r);
96 }
97 
98 
101 {
102  double gamma;
103  double gFactor;
104 
105  this->_beta = beta.len();
106  this->_gamma = 1.0/sqrt(1 - beta.lenSq());
107  gamma = this->_gamma;
108  gFactor = pow(gamma, 2) / (gamma + 1);
109 
110  this->el(0, 0) = gamma;
111  this->el(0, 1) = gamma * beta.x();
112  this->el(0, 2) = gamma * beta.y();
113  this->el(0, 3) = gamma * beta.z();
114 
115  this->el(1, 1) = (pow(beta.x(), 2) * gFactor) + 1;
116  this->el(1, 2) = beta.x() * beta.y() * gFactor;
117  this->el(1, 3) = beta.x() * beta.z() * gFactor;
118 
119  this->el(2, 2) = (pow(beta.y(), 2) * gFactor) + 1;
120  this->el(2, 3) = beta.y() * beta.z() * gFactor;
121 
122  this->el(3, 3) = (pow(beta.z(), 2) * gFactor) + 1;
123 
124  this->el(1, 0) = this->el(0, 1);
125  this->el(2, 0) = this->el(0, 2);
126  this->el(2, 1) = this->el(1, 2);
127  this->el(3, 0) = this->el(0, 3);
128  this->el(3, 1) = this->el(1, 3);
129  this->el(3, 2) = this->el(2, 3);
130 
131  return(*this);
132 }
133 
134 
136  : matrix<double>(4, 4)
137 {
138  this->set(beta);
139 }
140 
141 
144 {
145  threeVec beta;
146 
147  beta.el(0) = -p.x() / p.t();
148  beta.el(1) = -p.y() / p.t();
149  beta.el(2) = -p.z() / p.t();
150 
151  this->set(beta);
152  return(*this);
153 }
154 
155 
157  : matrix<double>(4, 4)
158 {
159  this->set(p);
160 }
161 
162 
163 // lorentzTransform lorentzTransform::operator*=(const lorentzTransform& L) {
164 // this->_beta = L._beta;
165 // this->_gamma = L._gamma;
166 // *this = *((lorentzTransform*) &(L * (*this)));
167 // return *this;
168 // }
169 
170 
171 fourVec
173 { //new
174  v = L * v;
175  return v;
176 }
177 
178 
179 // template class matrix<double>;