15 this->_init(0.0, 0.0, 0.0);
25 this->_init(V.
_x, V.
_y, V.
_z);
49 return threeVec( -this->_x, -this->_y, -this->_z);
54 return (this->_x*V.
_x + this->_y*V.
_y + this->_z*V.
_z);
60 this->_z*V.
_x - this->_x*V.
_z,
61 this->_x*V.
_y - this->_y*V.
_x);
108 os << this->_x <<
"\t" << this->_y <<
"\t" << this->_z << endl;
134 os.
write((
char*) &(this->_x),
sizeof(this->_x) );
135 os.
write((
char*) &(this->_y),
sizeof(this->_y) );
136 os.
write((
char*) &(this->_z),
sizeof(this->_z) );
143 is.
read((
char*) &(this->_x),
sizeof(this->_x) );
144 is.
read((
char*) &(this->_y),
sizeof(this->_y) );
145 is.
read((
char*) &(this->_z),
sizeof(this->_z) );
153 assert(index >=0 && index <=2);
165 cerr <<
"threeVec: error: index " << index <<
" out of bounds";
176 assert(index >=0 && index <=2);
188 cerr <<
"threeVec: error: index " << index <<
" out of bounds";
205 return (this->_x==V.
_x
212 return ( !(*
this==V) );
217 return ( this->lenSq() < V.
lenSq() );
222 return ( this->lenSq() > V.
lenSq() );
227 return ( this->lenSq() >= V.
lenSq() );
232 return ( this->lenSq() <= V.
lenSq() );
252 return pow( this->lenSq(),0.5 );
257 return acos( this->cosTheta() );
262 return ( this->_z/this->r() );
267 return atan2( this->_y, this->_x );
272 return pow(this->lenSq(),0.5);
277 return (this->_x*this->_x
279 + this->_z*this->_z);
284 return pow(this->lenSq(),0.5);
307 this->_init(x, y, z);
313 this->_x = r*sin(theta)*cos(phi);
314 this->_y = r*sin(theta)*sin(phi);
315 this->_z = r*cos(theta);
327 this->_init(0.0,
threeVec(0.0, 0.0, 0.0));
337 this->_init(v.
_t,v.
_V);
359 return fourVec( -this->_t, -this->_V );
364 return ( this->_t*v.
_t - this->_V*v.
_V );
369 return (this->_V/v.
_V );
412 os << this->_t <<
"\t";
438 os.
write((
char*) &(this->_t),
sizeof(this->_t) );
446 is.
read((
char*) &(this->_t),
sizeof(this->_t) );
455 assert(index >=0 && index <=3);
466 cerr <<
"fourVec: warning: index " << index <<
" out of bounds";
477 assert(index >=0 && index <=3);
488 cerr <<
"fourVec: warning: index " << index <<
" out of bounds";
510 return (this->_t==v.
_t && (this->_V == v.
_V) );
515 return ( !(*
this==v) );
520 return ( this->lenSq() < v.
lenSq() );
525 return ( this->lenSq() > v.
lenSq() );
530 return ( this->lenSq() >= v.
lenSq() );
535 return ( this->lenSq() <= v.
lenSq() );
565 return pow( this->_V.lenSq(),0.5 );
570 return acos( this->_V.cosTheta() );
575 return ( this->_V.cosTheta() );
580 return ( this->_V.phi() );
585 return pow(this->lenSq(),0.5);
590 return ( this->_t*this->_t - this->_V.lenSq() );
595 return pow(this->lenSq(),0.5);
636 this->_V.
polar(r, theta, phi);
642 this->_t = pow( this->_V.lenSq()+m*m, 0.5 );