00001 #ifndef L3_COORDINATES_H
00002 #define L3_COORDINATES_H
00003
00004 #include <iostream>
00005 #include <math.h>
00006
00007
00008
00009 class l3ThreeVector
00010 {
00011 public:
00012 l3ThreeVector ( float _x=0, float _y=0, float _z=0 )
00013 { x = _x ; y = _y ; z = _z ; } ;
00014 void set ( float _x, float _y, float _z )
00015 { x = _x ; y = _y ; z = _z ; } ;
00016
00017 float x ;
00018 float y ;
00019 float z ;
00020 };
00021
00022
00023
00024 class l3xyzCoordinate {
00025
00026 private:
00027 double xyz[3] ;
00028
00029 public:
00030 l3xyzCoordinate() { xyz[0] = xyz[1] = xyz[2] = 0 ; } ;
00031 l3xyzCoordinate(double X, double Y, double Z )
00032 {
00033 xyz[0] = X ;
00034 xyz[1] = Y ;
00035 xyz[2] = Z ;
00036 }
00037
00038
00039
00040 l3xyzCoordinate(l3ThreeVector hit) {
00041 Setxyz(hit.x, hit.y, hit.z);
00042 }
00043
00044 l3xyzCoordinate operator=(l3ThreeVector hit) {
00045 Setxyz(hit.x, hit.y, hit.z);
00046
00047 return *this;
00048 }
00049
00050
00051 double Getx() const { return xyz[0] ; } ;
00052 double Gety() const { return xyz[1] ; } ;
00053 double Getz() const { return xyz[2] ; } ;
00054 double* Getxyz() { return xyz ; } ;
00055
00056 inline double Getr() {
00057 return sqrt ( xyz[0]*xyz[0] +
00058 xyz[1]*xyz[1] +
00059 xyz[2]*xyz[2] );
00060 }
00061
00062 inline double Gettheta() {
00063 return atan2(hypot(xyz[0], xyz[1]), xyz[2]);
00064 }
00065
00066 inline double Geteta() {
00067 return - log(tan(Gettheta()/2));
00068 }
00069
00070 inline double Getphi() {
00071 return atan2(xyz[1], xyz[0]);
00072 }
00073
00074
00075
00076 void Setx(double X) { xyz[0] = X ; } ;
00077 void Sety(double Y) { xyz[1] = Y ; } ;
00078 void Setz(double Z) { xyz[2] = Z ; } ;
00079 void Setxyz(double X, double Y, double Z )
00080 {
00081 xyz[0] = X ;
00082 xyz[1] = Y ;
00083 xyz[2] = Z ;
00084 }
00085
00086 } ;
00087
00088 class l3ptrsCoordinate {
00089 private:
00090 double ptrs[4] ;
00091
00092 public:
00093
00094
00095
00096 l3ptrsCoordinate(double P=0,double T=0, double R=0, double S=0 )
00097 {
00098 ptrs[0] = P ;
00099 ptrs[1] = T ;
00100 ptrs[2] = R ;
00101 ptrs[3] = S ;
00102 } ;
00103
00104
00105
00106 inline double Getp() const { return ptrs[0] ; } ;
00107 inline double Gett() const { return ptrs[1] ; } ;
00108 inline double Getr() const { return ptrs[2] ; } ;
00109 inline double Gets() const { return ptrs[3] ; } ;
00110 inline double* Getptrs() { return ptrs ; } ;
00111
00112 inline void Setp(double P) { ptrs[0] = P ; } ;
00113 inline void Sett(double T) { ptrs[1] = T ; } ;
00114 inline void Setr(double R) { ptrs[2] = R ; } ;
00115 inline void Sets(double S) { ptrs[3] = S ; } ;
00116 inline void Setptrs(double P,double T, double R, double S ) {
00117 ptrs[0] = P ;
00118 ptrs[1] = T ;
00119 ptrs[2] = R ;
00120 ptrs[3] = S ;
00121 } ;
00122 } ;
00123
00124 #endif