| 1 | /* ======================================================================== *\ | 
|---|
| 2 | ! | 
|---|
| 3 | ! * | 
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction | 
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful | 
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. | 
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY. | 
|---|
| 8 | ! * | 
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its | 
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee, | 
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and | 
|---|
| 12 | ! * that both that copyright notice and this permission notice appear | 
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express | 
|---|
| 14 | ! * or implied warranty. | 
|---|
| 15 | ! * | 
|---|
| 16 | ! | 
|---|
| 17 | ! | 
|---|
| 18 | !   Author(s): Thomas Bretz  11/2008 <mailto:tbretz@astro.uni-wuerzburg.de> | 
|---|
| 19 | ! | 
|---|
| 20 | !   Copyright: MAGIC Software Development, 2000-2009 | 
|---|
| 21 | ! | 
|---|
| 22 | ! | 
|---|
| 23 | \* ======================================================================== */ | 
|---|
| 24 |  | 
|---|
| 25 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // | 
|---|
| 27 | //  MQuaternion | 
|---|
| 28 | // | 
|---|
| 29 | // The MQuaternion is derived from TQuaternion. A quaternion is a four vector | 
|---|
| 30 | // which can store space and time (like a lorentz vector). | 
|---|
| 31 | // | 
|---|
| 32 | // There are a few advantages of the TQuaternion class over the | 
|---|
| 33 | // TLorentzVector, namely the implementation of a direct algebra with | 
|---|
| 34 | // just the space part of the vector keeping the time as it is. | 
|---|
| 35 | // (This is useful, e.g, for rotations and shift just in space). | 
|---|
| 36 | // | 
|---|
| 37 | //  - You can construct the MQuaternion from a TQuaternion or a TVector3 and | 
|---|
| 38 | //    time. | 
|---|
| 39 | //  - Multiplying the MQuaternion with a TRotation with rotate just the | 
|---|
| 40 | //    space-part. | 
|---|
| 41 | //  - You can access the data members with X(), Y(), Z() and T() | 
|---|
| 42 | //  - To get the length or squared-length of the space-vector use R() and R2() | 
|---|
| 43 | //  - Access the 2D vector (x/y) with XYvector() | 
|---|
| 44 | //  - Thera are a few new function to propagate a MQuaternion along a trajectory | 
|---|
| 45 | //    in space and time (also expressed as an MQuaternion with a direction | 
|---|
| 46 | //    vector and a speed) Here we assume v>0. | 
|---|
| 47 | // | 
|---|
| 48 | //    + PropagateDz(MQuaternion &w, Double_t dz) | 
|---|
| 49 | // | 
|---|
| 50 | //      If dz is positive the position is propagated along the given trajectory | 
|---|
| 51 | //      in space (such that the z-component will increase by dz) and | 
|---|
| 52 | //      forward in time. If dz<0 the result is vice versa. | 
|---|
| 53 | // | 
|---|
| 54 | //    + PropagateZ0(MQuaternion &w) | 
|---|
| 55 | // | 
|---|
| 56 | //      This is an abbreviation for Propagate(w, -Z()). It propagates the | 
|---|
| 57 | //      position such that its z-component will vanish. If this is along | 
|---|
| 58 | //      the given trajectory time will increase if it is backward time | 
|---|
| 59 | //      will decrease. | 
|---|
| 60 | // | 
|---|
| 61 | //    + PropagateZ(MQuaternion &w, Double_t z) | 
|---|
| 62 | // | 
|---|
| 63 | //      This is an abbreviation for Propagate(w, z-Z()). It propagates the | 
|---|
| 64 | //      position such that its z-component will become z. If this is along | 
|---|
| 65 | //      the given trajectory time will increase if it is backward time | 
|---|
| 66 | //      will decrease. | 
|---|
| 67 | // | 
|---|
| 68 | ////////////////////////////////////////////////////////////////////////////// | 
|---|
| 69 | #include "MQuaternion.h" | 
|---|
| 70 |  | 
|---|
| 71 | ClassImp(MQuaternion); | 
|---|
| 72 |  | 
|---|
| 73 | using namespace std; | 
|---|
| 74 |  | 
|---|