#include #include #include "MyLVector.h" MyLVector::MyLVector() {}; // implementation MyLVector::MyLVector(double c0, double c1, double c2, double c3) : My3Vector(c1, c2, c3), t(c0) // special initialization syntax {} MyLVector::MyLVector(double c0, My3Vector p ) : My3Vector(p), t(c0) // special initialization syntax {} double MyLVector::Mass() // Method for mass: { // caution: direct access to My3Vector x,y,z doesn't work with private ! return( sqrt( t*t - x*x - y*y - z*z ) ); } double MyLVector::Mass(MyLVector p) // Method for mass: { // caution: direct access to My3Vector x,y,z doesn't work with private ! return( sqrt( (p.t + t)*(p.t + t) - (p.x+x)*(p.x+x) - (p.y+y)*(p.y+y) - (p.z+z)*(p.z+z))); } void MyLVector::Print( ) { std::cout << "( " << t << ", " << x << ", " << y << ", " << z << " )" << std::endl; } MyLVector MyLVector::Add(MyLVector p) { My3Vector temp3 = My3Vector::Add(p); MyLVector temp(t+p.t, temp3); // MyLVector temp; //temp.t = t + p.t; //temp.x = x + p.x; //temp.y = y + p.y; //temp.z = z + p.z; return (temp); } void MyLVector::setXYZT(double c0, double c1, double c2, double c3) { x = c0; y = c1; z = c2; t = c3; } void MyLVector::setXYZM(double c1, double c2, double c3, double m) { if (m >= 0) { setXYZT( c1, c2, c3, sqrt(c1*c1+c2*c2+c3*c3+m*m)); } else { setXYZT( c1, c2, c3, sqrt( std::max((c1*c1+c2*c2+c3*c3-m*m), 0. ))); } } void MyLVector::setPtEtaPhiM(double pt, double eta, double phi, double m) { pt = std::abs(pt); setXYZM(pt*cos(phi), pt*sin(phi), pt*sinh(eta) ,m); }