1 #ifndef BASICTOOL_GEOVECTOR_CXX
2 #define BASICTOOL_GEOVECTOR_CXX
15 { (*this)[0] =
x; (*this)[1] =
y; }
17 Vector::Vector(
const double x,
const double y,
const double z) : Vector(3)
18 { (*this)[0] =
x; (*this)[1] =
y; (*this)[2] =
z; }
21 { (*this)[0] = pt[0]; (*this)[1] = pt[1]; (*this)[2] = pt[2]; }
24 { (*this)[0] = pt[0]; (*this)[1] = pt[1]; (*this)[2] = pt[2]; }
28 for (
auto const &v : (*
this)){
40 for(
auto const &v : (*
this)) res += v*v;
53 {
return sqrt(
SqDist(obj)); }
62 if(
size()!=3 || obj.size()!=3)
64 throw GeoAlgoException(
"<<Cross>> only possible for 3-dimensional vectors!");
70 return (*
this)[0] == 0.0 && (*this)[1] == 0.0 ? 0.0 : atan2((*
this)[1],(*
this)[0]);
75 throw GeoAlgoException(
"<<Theta>> Only possible for 3-dimensional vectors!");
77 return (*this).Length() == 0.0 ? 0.0 : acos( (*
this)[2] / (*this).Length() );
83 throw GeoAlgoException(
"<<Angle>> only possible for 2 or 3-dimensional vectors!");
89 throw GeoAlgoException(
"<<ToTLorentsVector>> only possible for 3-dimensional vectors!");
90 return TLorentzVector((*
this)[0],(*
this)[1],(*
this)[2],0.);
102 if(
size() != obj.size()) {
103 std::ostringstream
msg;
104 msg <<
"<<" << __FUNCTION__ <<
">>"
105 <<
" size mismatch: "
106 <<
size() <<
" != " << obj.size()
108 throw GeoAlgoException(msg.str());
115 for(
size_t i=0; i<
size(); ++i) dist += ((*
this)[i] - obj[i]) * ((*
this)[i] - obj[i]);
123 {
return (*
this) * obj; }
128 res[0] = (*this)[1] * obj[2] - obj[1] * (*this)[2];
129 res[1] = (*this)[2] * obj[0] - obj[2] * (*this)[0];
130 res[2] = (*this)[0] * obj[1] - obj[0] * (*this)[1];
135 {
return acos(
_Dot_(obj) /
Length() / obj.Length() ); }
141 double c = cos(theta);
142 double s = sin(theta);
144 double ynew = (*this)[1] * c - (*this)[2] *
s;
145 double znew = (*this)[1] * s + (*this)[2] * c;
157 double c = cos(theta);
158 double s = sin(theta);
160 double xnew = (*this)[0] * c + (*this)[2] *
s;
161 double znew = - (*this)[0] * s + (*this)[2] * c;
173 double c = cos(theta);
174 double s = sin(theta);
176 double xnew = (*this)[0] * c - (*this)[1] *
s;
177 double ynew = (*this)[0] * s + (*this)[1] * c;
187 std::string
msg=
"Pt (";
188 for(
size_t i=0; i<this->
size(); ++i)
process_name opflash particleana ie ie ie z
process_name opflash particleana ie x
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.
double Phi() const
Compute the angle Phi.
std::size_t size(FixedBins< T, C > const &) noexcept
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.
double Length() const
Compute the length of the vector.
process_name opflash particleana ie ie y
double Dot(const Vector &obj) const
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)
std::string to_string(WindowPattern const &pattern)
void RotateX(const double &theta)
rotation operations
then echo File list $list not found else cat $list while read file do echo $file sed s
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.