source: HiSusy/trunk/Pythia8/pythia8170/phpdoc/FourVectors.php @ 1

Last change on this file since 1 was 1, checked in by zerwas, 11 years ago

first import of structure, PYTHIA8 and DELPHES

File size: 16.6 KB
Line 
1<html>
2<head>
3<title>Four-Vectors</title>
4<link rel="stylesheet" type="text/css" href="pythia.css"/>
5<link rel="shortcut icon" href="pythia32.gif"/>
6</head>
7<body>
8
9<script language=javascript type=text/javascript>
10function stopRKey(evt) {
11var evt = (evt) ? evt : ((event) ? event : null);
12var node = (evt.target) ? evt.target :((evt.srcElement) ? evt.srcElement : null);
13if ((evt.keyCode == 13) && (node.type=="text"))
14{return false;}
15}
16
17document.onkeypress = stopRKey;
18</script>
19<?php
20if($_POST['saved'] == 1) {
21if($_POST['filepath'] != "files/") {
22echo "<font color='red'>SETTINGS SAVED TO FILE</font><br/><br/>"; }
23else {
24echo "<font color='red'>NO FILE SELECTED YET.. PLEASE DO SO </font><a href='SaveSettings.php'>HERE</a><br/><br/>"; }
25}
26?>
27
28<form method='post' action='FourVectors.php'>
29
30<h2>Four-Vectors</h2>
31
32The <code>Vec4</code> class gives a simple implementation of four-vectors.
33The member function names are based on the assumption that these
34represent four-momentum vectors. Thus one can get or set
35<i>p_x, p_y, p_z</i> and <i>e</i>, but not <i>x, y, z</i>
36or <i>t</i>. This is only a matter of naming, however; a
37<code>Vec4</code> can equally well be used to store a space-time
38four-vector.
39 
40<p/>
41The <code>Particle</code> object contains a <code>Vec4 p</code> that
42stores the particle four-momentum, and another <code>Vec4 vProd</code>
43for the production vertex. For the latter the input/output method
44names are adapted to the space-time character rather than the normal
45energy-momentum one. Thus a user would not normally access the
46<code>Vec4</code> classes directly, but only via the methods of the
47<code>Particle</code> class,
48see <?php $filepath = $_GET["filepath"];
49echo "<a href='ParticleProperties.php?filepath=".$filepath."' target='page'>";?>Particle Properties</a>.
50
51<p/>
52Nevertheless you are free to use the PYTHIA four-vectors, e.g. as
53part of some simple analysis code based directly on the PYTHIA output,
54say to define the four-vector sum of a set of particles. But note that
55this class was never set up to allow complete generality, only  to
56provide the operations that are of use inside PYTHIA. There is no
57separate class for three-vectors, since such can easily be represented
58by four-vectors where the fourth component is not used.
59
60<p/>
61Four-vectors have the expected functionality: they can be created,
62copied, added, multiplied, rotated, boosted, and manipulated in other
63ways. Operator overloading is implemented where reasonable. Properties
64can be read out, not only the components themselves but also for derived
65quantities such as absolute momentum and direction angles.
66
67<h3>Constructors and basic operators</h3>
68
69A few methods are available to create or copy a four-vector:
70
71<a name="method1"></a>
72<p/><strong>Vec4::Vec4() &nbsp;</strong> <br/>
73creates a four-vector with all components set to 0.
74 
75
76<a name="method2"></a>
77<p/><strong>Vec4::Vec4(const Vec4& v) &nbsp;</strong> <br/>
78creates a four-vector copy of the input four-vector.
79 
80
81<a name="method3"></a>
82<p/><strong>Vec4& Vec4::operator=(const Vec4& v) &nbsp;</strong> <br/>
83copies the input four-vector.
84 
85
86<a name="method4"></a>
87<p/><strong>Vec4& Vec4::operator=(double value) &nbsp;</strong> <br/>
88gives a  four-vector with all components set to <i>value</i>.
89 
90
91<h3>Member methods for input</h3>
92
93The values stored in a four-vector can be modified in a few different
94ways:
95
96<a name="method5"></a>
97<p/><strong>void Vec4::reset() &nbsp;</strong> <br/>
98sets all components to 0.
99 
100
101<a name="method6"></a>
102<p/><strong>void Vec4::p(double pxIn, double pyIn, double pzIn, double eIn) &nbsp;</strong> <br/>
103sets all components to their input values.
104 
105
106<a name="method7"></a>
107<p/><strong>void Vec4::p(Vec4 pIn) &nbsp;</strong> <br/>
108sets all components equal to those of the input four-vector.
109 
110
111<a name="method8"></a>
112<p/><strong>void Vec4::px(double pxIn) &nbsp;</strong> <br/>
113 
114<strong>void Vec4::py(double pyIn) &nbsp;</strong> <br/>
115 
116<strong>void Vec4::pz(double pzIn) &nbsp;</strong> <br/>
117 
118<strong>void Vec4::e(double eIn) &nbsp;</strong> <br/>
119sets the respective component to the input value.
120 
121
122<h3>Member methods for output</h3>
123
124A number of methods provides output of basic or derived quantities:
125
126<a name="method9"></a>
127<p/><strong>double Vec4::px() &nbsp;</strong> <br/>
128 
129<strong>double Vec4::py() &nbsp;</strong> <br/>
130 
131<strong>double Vec4::pz() &nbsp;</strong> <br/>
132 
133<strong>double Vec4::e() &nbsp;</strong> <br/>
134gets the respective component.
135 
136
137<a name="method10"></a>
138<p/><strong>double Vec4::mCalc() &nbsp;</strong> <br/>
139 
140<strong>double Vec4::m2Calc() &nbsp;</strong> <br/>
141the (squared) mass, calculated from the four-vectors.
142If <i>m^2 &lt; 0</i> the mass is given with a minus sign,
143<i>-sqrt(-m^2)</i>.  Note the possible loss of precision
144in the calculation of <i>E^2 - p^2</i>; for particles the
145correct mass is stored separately to avoid such problems.
146 
147
148<a name="method11"></a>
149<p/><strong>double Vec4::pT() &nbsp;</strong> <br/>
150 
151<strong>double Vec4::pT2() &nbsp;</strong> <br/>
152the (squared) transverse momentum.
153 
154
155<a name="method12"></a>
156<p/><strong>double Vec4::pAbs() &nbsp;</strong> <br/>
157 
158<strong>double Vec4::pAbs2() &nbsp;</strong> <br/>
159the (squared) absolute momentum.
160 
161
162<a name="method13"></a>
163<p/><strong>double Vec4::eT() &nbsp;</strong> <br/>
164 
165<strong>double Vec4::eT2() &nbsp;</strong> <br/>
166the (squared) transverse energy,
167<i>eT = e * sin(theta) = e * pT / pAbs</i>.
168 
169
170<a name="method14"></a>
171<p/><strong>double Vec4::theta() &nbsp;</strong> <br/>
172the polar angle, in the range 0 through
173<i>pi</i>.
174 
175
176<a name="method15"></a>
177<p/><strong>double Vec4::phi() &nbsp;</strong> <br/>
178the azimuthal angle, in the range <i>-pi</i> through <i>pi</i>.
179 
180
181<a name="method16"></a>
182<p/><strong>double Vec4::thetaXZ() &nbsp;</strong> <br/>
183the angle in the <i>xz</i> plane, in the range <i>-pi</i> through
184<i>pi</i>, with 0 along the <i>+z</i> axis.
185 
186
187<a name="method17"></a>
188<p/><strong>double Vec4::pPos() &nbsp;</strong> <br/>
189 
190<strong>double Vec4::pNeg() &nbsp;</strong> <br/>
191the combinations <i>E+-p_z</i>. 
192
193<h3>Friend methods for output</h3>
194
195There are also some <code>friend</code> methods that take one, two
196or three four-vectors as argument. Several of them only use the
197three-vector part of the four-vector.
198
199<a name="method18"></a>
200<p/><strong>friend ostream& operator&lt;&lt;(ostream&, const Vec4& v) &nbsp;</strong> <br/>
201writes out the values of the four components of a <code>Vec4</code> and,
202within brackets, a fifth component being the invariant length of the
203four-vector, as provided by <code>mCalc()</code> above, and it all
204ended with a newline.
205 
206
207<a name="method19"></a>
208<p/><strong>friend double m(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
209 
210<strong>friend double m2(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
211the (squared) invariant mass.
212 
213
214<a name="method20"></a>
215<p/><strong>friend double dot3(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
216the three-product.
217 
218
219<a name="method21"></a>
220<p/><strong>friend double cross3(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
221the cross-product.
222 
223
224<a name="method22"></a>
225<p/><strong>friend double theta(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
226 
227<strong>friend double costheta(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
228the (cosine) of the opening angle between the vectors,
229in the range 0 through <i>pi</i>.
230 
231
232<a name="method23"></a>
233<p/><strong>friend double phi(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
234 
235<strong>friend double cosphi(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
236the (cosine) of the azimuthal angle between the vectors around the
237<i>z</i> axis, in the range 0 through <i>pi</i>.
238 
239
240<a name="method24"></a>
241<p/><strong>friend double phi(const Vec4& v1, const Vec4& v2, const Vec4& v3) &nbsp;</strong> <br/>
242 
243<strong>friend double cosphi(const Vec4& v1, const Vec4& v2, const Vec4& v3) &nbsp;</strong> <br/>
244the (cosine) of the azimuthal angle between the first two vectors
245around the direction of the third, in the range 0 through <i>pi</i>.
246 
247
248<h3>Operations with four-vectors</h3>
249
250Of course one should be able to add, subtract and scale four-vectors,
251and more:
252
253<a name="method25"></a>
254<p/><strong>Vec4 Vec4::operator-() &nbsp;</strong> <br/>
255return a vector with flipped sign for all components, while leaving
256the original vector unchanged.
257 
258
259<a name="method26"></a>
260<p/><strong>Vec4& Vec4::operator+=(const Vec4& v) &nbsp;</strong> <br/>
261add a four-vector to an existing one.
262 
263
264<a name="method27"></a>
265<p/><strong>Vec4& Vec4::operator-=(const Vec4& v) &nbsp;</strong> <br/>
266subtract a four-vector from an existing one.
267 
268
269<a name="method28"></a>
270<p/><strong>Vec4& Vec4::operator*=(double f) &nbsp;</strong> <br/>
271multiply all four-vector components by a real number.
272 
273
274<a name="method29"></a>
275<p/><strong>Vec4& Vec4::operator/=(double f) &nbsp;</strong> <br/>
276divide all four-vector components by a real number.
277 
278
279<a name="method30"></a>
280<p/><strong>friend Vec4 operator+(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
281add two four-vectors.
282 
283
284<a name="method31"></a>
285<p/><strong>friend Vec4 operator-(const Vec4& v1, const Vec4& v2) &nbsp;</strong> <br/>
286subtract two four-vectors.
287 
288
289<a name="method32"></a>
290<p/><strong>friend Vec4 operator*(double f, const Vec4& v) &nbsp;</strong> <br/>
291 
292<strong>friend Vec4 operator*(const Vec4& v, double f) &nbsp;</strong> <br/>
293multiply a four-vector by a real number.
294 
295
296<a name="method33"></a>
297<p/><strong>friend Vec4 operator/(const Vec4& v, double f) &nbsp;</strong> <br/>
298divide a four-vector by a real number.
299 
300
301<a name="method34"></a>
302<p/><strong>friend double operator*(const Vec4& v1, const Vec4 v2) &nbsp;</strong> <br/>
303four-vector product.
304 
305
306<p/>
307There are also a few related operations that are normal member methods:
308
309<a name="method35"></a>
310<p/><strong>void Vec4::rescale3(double f) &nbsp;</strong> <br/>
311multiply the three-vector components by <i>f</i>, but keep the
312fourth component unchanged.
313 
314
315<a name="method36"></a>
316<p/><strong>void Vec4::rescale4(double f) &nbsp;</strong> <br/>
317multiply all four-vector components by <i>f</i>.
318 
319
320<a name="method37"></a>
321<p/><strong>void Vec4::flip3() &nbsp;</strong> <br/>
322flip the sign of the three-vector components, but keep the
323fourth component unchanged.
324 
325
326<a name="method38"></a>
327<p/><strong>void Vec4::flip4() &nbsp;</strong> <br/>
328flip the sign of all four-vector components.
329 
330
331<h3>Rotations and boosts</h3>
332
333A common task is to rotate or boost four-vectors. In case only one
334four-vector is affected the operation may be performed directly on it.
335However, in case many particles are affected, the helper class
336<code>RotBstMatrix</code> can be used to speed up operations.
337
338<a name="method39"></a>
339<p/><strong>void Vec4::rot(double theta, double phi) &nbsp;</strong> <br/>
340rotate the three-momentum with the polar angle <i>theta</i>
341and the azimuthal angle <i>phi</i>.
342 
343
344<a name="method40"></a>
345<p/><strong>void Vec4::rotaxis(double phi, double nx, double ny, double nz) &nbsp;</strong> <br/>
346rotate the three-momentum with the azimuthal angle <i>phi</i>
347around the direction defined by the <i>(n_x, n_y, n_z)</i>
348three-vector.
349 
350
351<a name="method41"></a>
352<p/><strong>void Vec4::rotaxis(double phi, Vec4& n) &nbsp;</strong> <br/>
353rotate the three-momentum with the azimuthal angle <i>phi</i>
354around the direction defined by the three-vector part of <i>n</i>.
355 
356
357<a name="method42"></a>
358<p/><strong>void Vec4::bst(double betaX, double betaY, double betaZ) &nbsp;</strong> <br/>
359boost the four-momentum by <i>beta = (beta_x, beta_y, beta_z)</i>.
360 
361
362<a name="method43"></a>
363<p/><strong>void Vec4::bst(double betaX, double betaY, double betaZ,double gamma) &nbsp;</strong> <br/>
364boost the four-momentum by <i>beta = (beta_x, beta_y, beta_z)</i>,
365where the <i>gamma = 1/sqrt(1 - beta^2)</i> is also input to allow
366better precision when <i>beta</i> is close to unity.
367 
368
369<a name="method44"></a>
370<p/><strong>void Vec4::bst(const Vec4& p) &nbsp;</strong> <br/>
371boost the four-momentum by <i>beta = (p_x/E, p_y/E, p_z/E)</i>.
372 
373
374<a name="method45"></a>
375<p/><strong>void Vec4::bst(const Vec4& p, double m) &nbsp;</strong> <br/>
376boost the four-momentum by <i>beta = (p_x/E, p_y/E, p_z/E)</i>,
377where the <i>gamma = E/m</i> is also calculated from input to allow
378better precision when <i>beta</i> is close to unity.
379 
380
381<a name="method46"></a>
382<p/><strong>void Vec4::bstback(const Vec4& p) &nbsp;</strong> <br/>
383boost the four-momentum by <i>beta = (-p_x/E, -p_y/E, -p_z/E)</i>.
384 
385
386<a name="method47"></a>
387<p/><strong>void Vec4::bstback(const Vec4& p, double m) &nbsp;</strong> <br/>
388boost the four-momentum by <i>beta = (-p_x/E, -p_y/E, -p_z/E)</i>,
389where the <i>gamma = E/m</i> is also calculated from input to allow
390better precision when <i>beta</i> is close to unity.
391 
392
393<a name="method48"></a>
394<p/><strong>void Vec4::rotbst(const RotBstMatrix& M) &nbsp;</strong> <br/>
395perform a combined rotation and boost; see below for a description
396of the <code>RotBstMatrix</code>.
397 
398
399<p/>
400For a longer sequence of rotations and boosts, and where several
401<code>Vec4</code> are to be rotated and boosted in the same way,
402a more efficient approach is to define a <code>RotBstMatrix</code>,
403which forms a separate auxiliary class. You can build up this
4044-by-4 matrix by successive calls to the methods of the class,
405such that the matrix encodes the full sequence of operations.
406The order in which you do these calls must agree with the imagined
407order in which the rotations/boosts should be applied to a
408four-momentum, since in general the operations do not commute.
409
410<a name="method49"></a>
411<p/><strong>RotBstMatrix::RotBstMatrix() &nbsp;</strong> <br/>
412creates a diagonal unit matrix, i.e. one that leaves a four-vector
413unchanged.
414 
415
416<a name="method50"></a>
417<p/><strong>RotBstMatrix::RotBstMatrix(const RotBstMatrix& Min) &nbsp;</strong> <br/>
418creates a copy of the input matrix.
419 
420
421<a name="method51"></a>
422<p/><strong>RotBstMatrix& RotBstMatrix::operator=(const RotBstMatrix4& Min) &nbsp;</strong> <br/>
423copies the input matrix.
424 
425
426<a name="method52"></a>
427<p/><strong>void RotBstMatrix::rot(double theta = 0., double phi = 0.) &nbsp;</strong> <br/>
428rotate by this polar and azimuthal angle.
429 
430
431<a name="method53"></a>
432<p/><strong>void RotBstMatrix::rot(const Vec4& p) &nbsp;</strong> <br/>
433rotate so that a vector originally along the <i>+z</i> axis becomes
434parallel with <i>p</i>. More specifically, rotate by <i>-phi</i>,
435<i>theta</i> and <i>phi</i>, with angles defined by <i>p</i>.
436 
437
438<a name="method54"></a>
439<p/><strong>void RotBstMatrix::bst(double betaX = 0., double betaY = 0., double betaZ = 0.) &nbsp;</strong> <br/>
440boost by this <i>beta</i> vector.
441 
442
443<a name="method55"></a>
444<p/><strong>void RotBstMatrix::bst(const Vec4&) &nbsp;</strong> <br/>
445 
446<strong>void RotBstMatrix::bstback(const Vec4&) &nbsp;</strong> <br/>
447boost with a <i>beta = p/E</i> or <i>beta = -p/E</i>, respectively.
448 
449
450<a name="method56"></a>
451<p/><strong>void RotBstMatrix::bst(const Vec4& p1, const Vec4& p2) &nbsp;</strong> <br/>
452boost so that <i>p_1</i> is transformed to <i>p_2</i>. It is assumed
453that the two vectors obey <i>p_1^2 = p_2^2</i>.
454 
455
456<a name="method57"></a>
457<p/><strong>void RotBstMatrix::toCMframe(const Vec4& p1, const Vec4& p2) &nbsp;</strong> <br/>
458boost and rotate to the rest frame of <i>p_1</i> and <i>p_2</i>,
459with <i>p_1</i> along the <i>+z</i> axis.
460 
461
462<a name="method58"></a>
463<p/><strong>void RotBstMatrix::fromCMframe(const Vec4& p1, const Vec4& p2) &nbsp;</strong> <br/>
464rotate and boost from the rest frame of <i>p_1</i> and <i>p_2</i>,
465with <i>p_1</i> along the <i>+z</i> axis, to the actual frame of
466<i>p_1</i> and <i>p_2</i>, i.e. the inverse of the above.
467 
468
469<a name="method59"></a>
470<p/><strong>void RotBstMatrix::rotbst(const RotBstMatrix& Min); &nbsp;</strong> <br/>
471combine the current matrix with another one.
472 
473
474<a name="method60"></a>
475<p/><strong>void RotBstMatrix::invert() &nbsp;</strong> <br/>
476invert the matrix, which corresponds to an opposite sequence and sign
477of rotations and boosts.
478 
479
480<a name="method61"></a>
481<p/><strong>void RotBstMatrix::reset() &nbsp;</strong> <br/>
482reset to no rotation/boost; i.e. the default at creation.
483 
484
485<a name="method62"></a>
486<p/><strong>double RotBstMatrix::deviation() &nbsp;</strong> <br/>
487crude estimate how much a matrix deviates from the unit matrix:
488the sum of the absolute values of all non-diagonal matrix elements
489plus the sum of the absolute deviation of the diagonal matrix
490elements from unity.
491 
492
493<a name="method63"></a>
494<p/><strong>friend ostream& operator&lt;&lt;(ostream&, const RotBstMatrix& M) &nbsp;</strong> <br/>
495writes out the values of the sixteen components of a
496<code>RotBstMatrix</code>, on four consecutive lines and
497ended with a newline.
498 
499
500</body>
501</html>
502
503<!-- Copyright (C) 2012 Torbjorn Sjostrand -->
Note: See TracBrowser for help on using the repository browser.