//-------------------------------------------------------------------------- // // Environment: // This software is part of the EvtGen package developed jointly // for the BaBar and CLEO collaborations. If you use all or part // of it, please give an appropriate acknowledgement. // // Copyright Information: See EvtGen/COPYRIGHT // Copyright (C) 1998 Caltech, UCSB // // Module: EvtVector4R.cc // // Description: Real implementation of 4-vectors // // Modification history: // // DJL/RYD September 25, 1996 Module created // //------------------------------------------------------------------------ // #include "EvtGenBase/EvtPatches.hh" #include #include #include #include "EvtGenBase/EvtVector4R.hh" #include "EvtGenBase/EvtVector3R.hh" #include "EvtGenBase/EvtVector4C.hh" #include "EvtGenBase/EvtTensor4C.hh" using std::ostream; EvtVector4R::EvtVector4R(double e,double p1,double p2, double p3){ v[0]=e; v[1]=p1; v[2]=p2; v[3]=p3; } double EvtVector4R::mass() const{ double m2=v[0]*v[0]-v[1]*v[1]-v[2]*v[2]-v[3]*v[3]; if (m2>0.0) { return sqrt(m2); } else{ return 0.0; } } EvtVector4R rotateEuler(const EvtVector4R& rs, double alpha,double beta,double gamma){ EvtVector4R tmp(rs); tmp.applyRotateEuler(alpha,beta,gamma); return tmp; } EvtVector4R boostTo(const EvtVector4R& rs, const EvtVector4R& p4){ EvtVector4R tmp(rs); tmp.applyBoostTo(p4); return tmp; } EvtVector4R boostTo(const EvtVector4R& rs, const EvtVector3R& boost){ EvtVector4R tmp(rs); tmp.applyBoostTo(boost); return tmp; } void EvtVector4R::applyRotateEuler(double phi,double theta,double ksi){ double sp=sin(phi); double st=sin(theta); double sk=sin(ksi); double cp=cos(phi); double ct=cos(theta); double ck=cos(ksi); double x=( ck*ct*cp-sk*sp)*v[1]+( -sk*ct*cp-ck*sp)*v[2]+st*cp*v[3]; double y=( ck*ct*sp+sk*cp)*v[1]+(-sk*ct*sp+ck*cp)*v[2]+st*sp*v[3]; double z=-ck*st*v[1]+sk*st*v[2]+ct*v[3]; v[1]=x; v[2]=y; v[3]=z; } ostream& operator<<(ostream& s, const EvtVector4R& v){ s<<"("<