11 { (*this)[0] =
x; (*this)[1] =
y; }
14 { (*this)[0] =
x; (*this)[1] =
y; (*this)[2] =
z; }
17 { (*this)[0] = pt[0]; (*this)[1] = pt[1]; (*this)[2] = pt[2]; }
20 { (*this)[0] = pt[0]; (*this)[1] = pt[1]; (*this)[2] = pt[2]; }
24 for (
auto const &v : (*
this)){
36 for(
auto const &v : (*
this)) res += v*v;
49 {
return sqrt(
SqDist(obj)); }
58 if(
size()!=3 || obj.size()!=3)
60 throw GeoAlgoException(
"<<Cross>> only possible for 3-dimensional vectors!");
66 return (*
this)[0] == 0.0 && (*this)[1] == 0.0 ? 0.0 : atan2((*
this)[1],(*
this)[0]);
71 throw GeoAlgoException(
"<<Theta>> Only possible for 3-dimensional vectors!");
73 return (*this).Length() == 0.0 ? 0.0 : acos( (*
this)[2] / (*this).Length() );
79 throw GeoAlgoException(
"<<Angle>> only possible for 2 or 3-dimensional vectors!");
85 throw GeoAlgoException(
"<<ToTLorentsVector>> only possible for 3-dimensional vectors!");
86 return TLorentzVector((*
this)[0],(*
this)[1],(*
this)[2],0.);
98 if(
size() != obj.size()) {
99 std::ostringstream
msg;
100 msg <<
"<<" << __FUNCTION__ <<
">>" 101 <<
" size mismatch: " 102 <<
size() <<
" != " << obj.size()
111 for(
size_t i=0; i<
size(); ++i) dist += ((*
this)[i] - obj[i]) * ((*
this)[i] - obj[i]);
119 {
return (*
this) * obj; }
124 res[0] = (*this)[1] * obj[2] - obj[1] * (*this)[2];
125 res[1] = (*this)[2] * obj[0] - obj[2] * (*this)[0];
126 res[2] = (*this)[0] * obj[1] - obj[0] * (*this)[1];
137 double c = cos(theta);
138 double s = sin(theta);
140 double ynew = (*this)[1] * c - (*this)[2] *
s;
141 double znew = (*this)[1] * s + (*this)[2] *
c;
153 double c = cos(theta);
154 double s = sin(theta);
156 double xnew = (*this)[0] * c + (*this)[2] *
s;
157 double znew = - (*this)[0] * s + (*this)[2] *
c;
169 double c = cos(theta);
170 double s = sin(theta);
172 double xnew = (*this)[0] * c - (*this)[1] *
s;
173 double ynew = (*this)[0] * s + (*this)[1] *
c;
void msg(const char *fmt,...)
double _Angle_(const Vector &obj) const
Compute the angle in degrees between 2 vectors w/o dimension check.
double _Dot_(const Vector &obj) const
Compute a dot product w/o dimention check.
Class def header for a class GeoAlgoException.
double Phi() const
Compute the angle Phi.
void compat(const Vector &obj) const
Dimensional check for a compatibility.
double _SqDist_(const Vector &obj) const
Compute the squared-distance to another vector w/o dimension check.
double Dist(const Vector &obj) const
Compute the distance to another vector.
void Normalize()
Normalize itself.
double SqLength() const
Compute the squared length of the vector.
Vector _Cross_(const Vector &obj) const
Compute a cross product w/o dimension check.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
double Length() const
Compute the length of the vector.
double Dot(const Vector &obj) const
Class def header for a class Point and Vector.
bool IsValid() const
Check if point is valid.
Vector Cross(const Vector &obj) const
Compute a dot product of two vectors.
void RotateY(const double &theta)
double SqDist(const Vector &obj) const
Compute the squared distance to another vector.
TLorentzVector ToTLorentzVector() const
Compute an opening angle w.r.t. the given vector.
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
void RotateX(const double &theta)
rotation operations
Vector Dir() const
Return a direction unit vector.
double Theta() const
Compute the angle theta.
double _Dist_(const Vector &obj) const
Compute the distance to another vector w/o dimension check.
static const double kINVALID_DOUBLE
void RotateZ(const double &theta)
double Angle(const Vector &obj) const
Compute a cross product of two vectors.
QTextStream & endl(QTextStream &s)