All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Friends | List of all members
geoalgo::Vector Class Reference

#include <GeoVector.h>

Inheritance diagram for geoalgo::Vector:

Public Member Functions

 Vector ()
 Default ctor. More...
 
 Vector (size_t n)
 Ctor to instantiate with invalid value. More...
 
 Vector (const std::vector< double > &obj)
 Default ctor w/ a bare std::vector<double> More...
 
 Vector (const double x, const double y)
 ctor w/ x & y More...
 
 Vector (const double x, const double y, const double z)
 ctor w/ x, y & z More...
 
 Vector (const TVector3 &pt)
 ctor w/ TVector3 More...
 
 Vector (const TLorentzVector &pt)
 ctor w/ TLorentzVector More...
 
void Normalize ()
 Normalize itself. More...
 
bool IsValid () const
 Check if point is valid. More...
 
double SqLength () const
 Compute the squared length of the vector. More...
 
double Length () const
 Compute the length of the vector. More...
 
Vector Dir () const
 Return a direction unit vector. More...
 
double Phi () const
 Compute the angle Phi. More...
 
double Theta () const
 Compute the angle theta. More...
 
double SqDist (const Vector &obj) const
 Compute the squared distance to another vector. More...
 
double Dist (const Vector &obj) const
 Compute the distance to another vector. More...
 
double Dot (const Vector &obj) const
 
Vector Cross (const Vector &obj) const
 Compute a dot product of two vectors. More...
 
double Angle (const Vector &obj) const
 Compute a cross product of two vectors. More...
 
TLorentzVector ToTLorentzVector () const
 Compute an opening angle w.r.t. the given vector. More...
 
void compat (const Vector &obj) const
 Dimensional check for a compatibility. More...
 
void RotateX (const double &theta)
 rotation operations More...
 
void RotateY (const double &theta)
 
void RotateZ (const double &theta)
 
Vectoroperator+= (const Vector &rhs)
 
Vectoroperator-= (const Vector &rhs)
 
Vectoroperator*= (const double rhs)
 
Vectoroperator/= (const double rhs)
 
Vectoroperator= (const Vector &rhs)
 
Vector operator+ (const Vector &rhs) const
 
Vector operator- (const Vector &rhs) const
 
double operator* (const Vector &rhs) const
 
Vector operator* (const double &rhs) const
 
Vector operator/ (const double &rhs) const
 
bool operator< (const Vector &rhs) const
 
bool operator< (const double &rhs) const
 
bool operator== (const Vector &rhs) const
 
bool operator!= (const Vector &rhs) const
 
 Vector ()
 Default ctor. More...
 
 Vector (size_t n)
 Ctor to instantiate with invalid value. More...
 
 Vector (const std::vector< double > &obj)
 Default ctor w/ a bare std::vector<double> More...
 
 Vector (const double x, const double y)
 ctor w/ x & y More...
 
 Vector (const double x, const double y, const double z)
 ctor w/ x, y & z More...
 
 Vector (const TVector3 &pt)
 ctor w/ TVector3 More...
 
 Vector (const TLorentzVector &pt)
 ctor w/ TLorentzVector More...
 
virtual ~Vector ()
 Default dtor. More...
 
void Normalize ()
 Normalize itself. More...
 
bool IsValid () const
 Check if point is valid. More...
 
double SqLength () const
 Compute the squared length of the vector. More...
 
double Length () const
 Compute the length of the vector. More...
 
Vector Dir () const
 Return a direction unit vector. More...
 
double Phi () const
 Compute the angle Phi. More...
 
double Theta () const
 Compute the angle theta. More...
 
double SqDist (const Vector &obj) const
 Compute the squared distance to another vector. More...
 
double Dist (const Vector &obj) const
 Compute the distance to another vector. More...
 
double Dot (const Vector &obj) const
 
Vector Cross (const Vector &obj) const
 Compute a dot product of two vectors. More...
 
double Angle (const Vector &obj) const
 Compute a cross product of two vectors. More...
 
TLorentzVector ToTLorentzVector () const
 Compute an opening angle w.r.t. the given vector. More...
 
void compat (const Vector &obj) const
 Dimensional check for a compatibility. More...
 
void RotateX (const double &theta)
 rotation operations More...
 
void RotateY (const double &theta)
 
void RotateZ (const double &theta)
 
std::string dump () const
 
Vectoroperator+= (const Vector &rhs)
 
Vectoroperator-= (const Vector &rhs)
 
Vectoroperator*= (const double rhs)
 
Vectoroperator/= (const double rhs)
 
Vectoroperator= (const Vector &rhs)
 
Vector operator+ (const Vector &rhs) const
 
Vector operator- (const Vector &rhs) const
 
double operator* (const Vector &rhs) const
 
Vector operator* (const double &rhs) const
 
Vector operator/ (const double &rhs) const
 
bool operator< (const Vector &rhs) const
 
bool operator< (const double &rhs) const
 
bool operator== (const Vector &rhs) const
 
bool operator!= (const Vector &rhs) const
 

Protected Member Functions

double _SqDist_ (const Vector &obj) const
 Compute the squared-distance to another vector w/o dimension check. More...
 
double _Dist_ (const Vector &obj) const
 Compute the distance to another vector w/o dimension check. More...
 
double _Dot_ (const Vector &obj) const
 Compute a dot product w/o dimention check. More...
 
Vector _Cross_ (const Vector &obj) const
 Compute a cross product w/o dimension check. More...
 
double _Angle_ (const Vector &obj) const
 Compute the angle in degrees between 2 vectors w/o dimension check. More...
 
double _SqDist_ (const Vector &obj) const
 Compute the squared-distance to another vector w/o dimension check. More...
 
double _Dist_ (const Vector &obj) const
 Compute the distance to another vector w/o dimension check. More...
 
double _Dot_ (const Vector &obj) const
 Compute a dot product w/o dimention check. More...
 
Vector _Cross_ (const Vector &obj) const
 Compute a cross product w/o dimension check. More...
 
double _Angle_ (const Vector &obj) const
 Compute the angle in degrees between 2 vectors w/o dimension check. More...
 

Friends

class Trajectory
 
class HalfLine
 
class LineSegment
 
class Sphere
 
class GeoAlgo
 
std::ostream & operator<< (std::ostream &o,::geoalgo::Vector const &a)
 Streamer. More...
 
std::ostream & operator<< (std::ostream &o,::geoalgo::Vector const &a)
 Streamer. More...
 

Additional Inherited Members

- Public Attributes inherited from std::vector< T >
elements
 STL member. More...
 

Detailed Description

This class represents an n-dimensional vector

Definition at line 33 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

Constructor & Destructor Documentation

geoalgo::Vector::Vector ( )
inline

Default ctor.

Definition at line 41 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

41  : std::vector<double>()
42  {}
geoalgo::Vector::Vector ( size_t  n)
inline

Ctor to instantiate with invalid value.

Definition at line 45 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

45  : std::vector<double>(n,kINVALID_DOUBLE)
46  {}
geoalgo::Vector::Vector ( const std::vector< double > &  obj)
inline

Default ctor w/ a bare std::vector<double>

Definition at line 49 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

49  : std::vector<double>(obj)
50  {}
geoalgo::Vector::Vector ( const double  x,
const double  y 
)

ctor w/ x & y

Definition at line 10 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

10  : Vector(2)
11  { (*this)[0] = x; (*this)[1] = y; }
process_name opflash particleana ie x
process_name opflash particleana ie ie y
geoalgo::Vector::Vector ( const double  x,
const double  y,
const double  z 
)

ctor w/ x, y & z

Definition at line 13 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

13  : Vector(3)
14  { (*this)[0] = x; (*this)[1] = y; (*this)[2] = z; }
process_name opflash particleana ie ie ie z
process_name opflash particleana ie x
process_name opflash particleana ie ie y
geoalgo::Vector::Vector ( const TVector3 &  pt)

ctor w/ TVector3

Definition at line 16 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

16  : Vector(3)
17  { (*this)[0] = pt[0]; (*this)[1] = pt[1]; (*this)[2] = pt[2]; }
geoalgo::Vector::Vector ( const TLorentzVector &  pt)

ctor w/ TLorentzVector

Definition at line 19 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

19  : Vector(3)
20  { (*this)[0] = pt[0]; (*this)[1] = pt[1]; (*this)[2] = pt[2]; }
geoalgo::Vector::Vector ( )
inline

Default ctor.

Definition at line 43 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

43  : std::vector<double>()
44  {}
geoalgo::Vector::Vector ( size_t  n)
inline

Ctor to instantiate with invalid value.

Definition at line 47 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

47  : std::vector<double>(n,kINVALID_DOUBLE)
48  {}
geoalgo::Vector::Vector ( const std::vector< double > &  obj)
inline

Default ctor w/ a bare std::vector<double>

Definition at line 51 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

51  : std::vector<double>(obj)
52  {}
geoalgo::Vector::Vector ( const double  x,
const double  y 
)

ctor w/ x & y

geoalgo::Vector::Vector ( const double  x,
const double  y,
const double  z 
)

ctor w/ x, y & z

geoalgo::Vector::Vector ( const TVector3 &  pt)

ctor w/ TVector3

geoalgo::Vector::Vector ( const TLorentzVector &  pt)

ctor w/ TLorentzVector

virtual geoalgo::Vector::~Vector ( )
inlinevirtual

Default dtor.

Definition at line 60 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

Member Function Documentation

double geoalgo::Vector::_Angle_ ( const Vector obj) const
protected

Compute the angle in degrees between 2 vectors w/o dimension check.

Definition at line 130 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

131  { return acos( _Dot_(obj) / Length() / obj.Length() ); }
double _Dot_(const Vector &obj) const
Compute a dot product w/o dimention check.
double Length() const
Compute the length of the vector.
double geoalgo::Vector::_Angle_ ( const Vector obj) const
protected

Compute the angle in degrees between 2 vectors w/o dimension check.

Vector geoalgo::Vector::_Cross_ ( const Vector obj) const
protected

Compute a cross product w/o dimension check.

Definition at line 121 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

122  {
123  Vector res(3);
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];
127  return res;
128  }
Vector geoalgo::Vector::_Cross_ ( const Vector obj) const
protected

Compute a cross product w/o dimension check.

double geoalgo::Vector::_Dist_ ( const Vector obj) const
protected

Compute the distance to another vector w/o dimension check.

Definition at line 115 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

116  { return sqrt(_SqDist_(obj)); }
double _SqDist_(const Vector &obj) const
Compute the squared-distance to another vector w/o dimension check.
double geoalgo::Vector::_Dist_ ( const Vector obj) const
protected

Compute the distance to another vector w/o dimension check.

double geoalgo::Vector::_Dot_ ( const Vector obj) const
protected

Compute a dot product w/o dimention check.

Definition at line 118 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

119  { return (*this) * obj; }
double geoalgo::Vector::_Dot_ ( const Vector obj) const
protected

Compute a dot product w/o dimention check.

double geoalgo::Vector::_SqDist_ ( const Vector obj) const
protected

Compute the squared-distance to another vector w/o dimension check.

Definition at line 108 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

109  {
110  double dist = 0;
111  for(size_t i=0; i<size(); ++i) dist += ((*this)[i] - obj[i]) * ((*this)[i] - obj[i]);
112  return dist;
113  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
double geoalgo::Vector::_SqDist_ ( const Vector obj) const
protected

Compute the squared-distance to another vector w/o dimension check.

double geoalgo::Vector::Angle ( const Vector obj) const

Compute a cross product of two vectors.

Definition at line 76 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

76  {
77  compat(obj);
78  if(size()!=2 && size()!=3)
79  throw GeoAlgoException("<<Angle>> only possible for 2 or 3-dimensional vectors!");
80  return _Angle_(obj);
81  }
double _Angle_(const Vector &obj) const
Compute the angle in degrees between 2 vectors w/o dimension check.
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void compat(const Vector &obj) const
Dimensional check for a compatibility.
double geoalgo::Vector::Angle ( const Vector obj) const

Compute a cross product of two vectors.

void geoalgo::Vector::compat ( const Vector obj) const

Dimensional check for a compatibility.

Definition at line 97 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

97  {
98  if(size() != obj.size()) {
99  std::ostringstream msg;
100  msg << "<<" << __FUNCTION__ << ">>"
101  << " size mismatch: "
102  << size() << " != " << obj.size()
103  << std::endl;
104  throw GeoAlgoException(msg.str());
105  }
106  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void geoalgo::Vector::compat ( const Vector obj) const

Dimensional check for a compatibility.

Vector geoalgo::Vector::Cross ( const Vector obj) const

Compute a dot product of two vectors.

Definition at line 56 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

56  {
57 
58  if(size()!=3 || obj.size()!=3)
59 
60  throw GeoAlgoException("<<Cross>> only possible for 3-dimensional vectors!");
61 
62  return _Cross_(obj);
63  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
Vector _Cross_(const Vector &obj) const
Compute a cross product w/o dimension check.
Vector geoalgo::Vector::Cross ( const Vector obj) const

Compute a dot product of two vectors.

Vector geoalgo::Vector::Dir ( ) const

Return a direction unit vector.

Definition at line 91 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

91  {
92  Vector res(*this);
93  res /= res.Length();
94  return res;
95  }
Vector geoalgo::Vector::Dir ( ) const

Return a direction unit vector.

double geoalgo::Vector::Dist ( const Vector obj) const

Compute the distance to another vector.

Definition at line 48 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

49  { return sqrt(SqDist(obj)); }
double SqDist(const Vector &obj) const
Compute the squared distance to another vector.
double geoalgo::Vector::Dist ( const Vector obj) const

Compute the distance to another vector.

double geoalgo::Vector::Dot ( const Vector obj) const

Definition at line 51 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

51  {
52  compat(obj);
53  return _Dot_(obj);
54  }
double _Dot_(const Vector &obj) const
Compute a dot product w/o dimention check.
void compat(const Vector &obj) const
Dimensional check for a compatibility.
double geoalgo::Vector::Dot ( const Vector obj) const
std::string geoalgo::Vector::dump ( ) const

Definition at line 185 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.cxx.

185  {
186 
187  std::string msg="Pt (";
188  for(size_t i=0; i<this->size(); ++i)
189  msg += (std::to_string((*this)[i]) + ( (i+1) == this->size() ? ")" : ","));
190  return msg;
191  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
std::string to_string(WindowPattern const &pattern)
bool geoalgo::Vector::IsValid ( ) const

Check if point is valid.

Definition at line 22 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

22  {
23 
24  for (auto const &v : (*this)){
25  // if any point is different from kINVALID_DOUBLE
26  // then the point is valid
27  if (v != kINVALID_DOUBLE)
28  return true;
29  }
30 
31  return false;
32  }
bool geoalgo::Vector::IsValid ( ) const

Check if point is valid.

double geoalgo::Vector::Length ( ) const

Compute the length of the vector.

Definition at line 40 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

41  { return sqrt(SqLength()); }
double SqLength() const
Compute the squared length of the vector.
double geoalgo::Vector::Length ( ) const

Compute the length of the vector.

void geoalgo::Vector::Normalize ( )

Normalize itself.

Definition at line 89 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

89 { (*this) /= this->Length(); }
double Length() const
Compute the length of the vector.
void geoalgo::Vector::Normalize ( )

Normalize itself.

bool geoalgo::Vector::operator!= ( const Vector rhs) const
inline

Definition at line 180 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

181  { return !(*this == rhs); }
bool geoalgo::Vector::operator!= ( const Vector rhs) const
inline

Definition at line 185 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

186  { return !(*this == rhs); }
double geoalgo::Vector::operator* ( const Vector rhs) const
inline

Definition at line 140 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

141  {
142  double res=0;
143  for(size_t i=0; i<size(); ++i) res += (*this)[i] * rhs[i];
144  return res;
145  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
double geoalgo::Vector::operator* ( const Vector rhs) const
inline

Definition at line 145 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

146  {
147  double res=0;
148  for(size_t i=0; i<size(); ++i) res += (*this)[i] * rhs[i];
149  return res;
150  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
Vector geoalgo::Vector::operator* ( const double &  rhs) const
inline

Definition at line 147 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

148  {
149  Vector res((*this));
150  res *= rhs;
151  return res;
152  }
Vector geoalgo::Vector::operator* ( const double &  rhs) const
inline

Definition at line 152 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

153  {
154  Vector res((*this));
155  res *= rhs;
156  return res;
157  }
Vector& geoalgo::Vector::operator*= ( const double  rhs)
inline

Definition at line 110 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

110  {
111  for(auto &v : *this) v *= rhs;
112  return *this;
113  }
Vector& geoalgo::Vector::operator*= ( const double  rhs)
inline

Definition at line 115 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

115  {
116  for(auto &v : *this) v *= rhs;
117  return *this;
118  }
Vector geoalgo::Vector::operator+ ( const Vector rhs) const
inline

Definition at line 126 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

127  {
128  Vector res((*this));
129  res+=rhs;
130  return res;
131  }
Vector geoalgo::Vector::operator+ ( const Vector rhs) const
inline

Definition at line 131 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

132  {
133  Vector res((*this));
134  res+=rhs;
135  return res;
136  }
Vector& geoalgo::Vector::operator+= ( const Vector rhs)
inline

Definition at line 100 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

100  {
101  for(size_t i=0; i<size(); ++i) (*this)[i] += rhs[i];
102  return *this;
103  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
Vector& geoalgo::Vector::operator+= ( const Vector rhs)
inline

Definition at line 105 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

105  {
106  for(size_t i=0; i<size(); ++i) (*this)[i] += rhs[i];
107  return *this;
108  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
Vector geoalgo::Vector::operator- ( const Vector rhs) const
inline

Definition at line 133 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

134  {
135  Vector res((*this));
136  res-=rhs;
137  return res;
138  }
Vector geoalgo::Vector::operator- ( const Vector rhs) const
inline

Definition at line 138 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

139  {
140  Vector res((*this));
141  res-=rhs;
142  return res;
143  }
Vector& geoalgo::Vector::operator-= ( const Vector rhs)
inline

Definition at line 105 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

105  {
106  for(size_t i=0; i<size(); ++i) (*this)[i] -= rhs[i];
107  return *this;
108  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
Vector& geoalgo::Vector::operator-= ( const Vector rhs)
inline

Definition at line 110 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

110  {
111  for(size_t i=0; i<size(); ++i) (*this)[i] -= rhs[i];
112  return *this;
113  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
Vector geoalgo::Vector::operator/ ( const double &  rhs) const
inline

Definition at line 154 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

155  {
156  Vector res((*this));
157  res /= rhs;
158  return res;
159  }
Vector geoalgo::Vector::operator/ ( const double &  rhs) const
inline

Definition at line 159 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

160  {
161  Vector res((*this));
162  res /= rhs;
163  return res;
164  }
Vector& geoalgo::Vector::operator/= ( const double  rhs)
inline

Definition at line 115 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

115  {
116  for(auto &v : *this) v /= rhs;
117  return *this;
118  }
Vector& geoalgo::Vector::operator/= ( const double  rhs)
inline

Definition at line 120 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

120  {
121  for(auto &v : *this) v /= rhs;
122  return *this;
123  }
bool geoalgo::Vector::operator< ( const Vector rhs) const
inline

Definition at line 161 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

162  {
163  compat(rhs);
164  for(size_t i=0; i<size(); ++i)
165  if((*this)[i] < rhs[i]) return true;
166  return false;
167  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void compat(const Vector &obj) const
Dimensional check for a compatibility.
bool geoalgo::Vector::operator< ( const Vector rhs) const
inline

Definition at line 166 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

167  {
168  compat(rhs);
169  for(size_t i=0; i<size(); ++i)
170  if((*this)[i] < rhs[i]) return true;
171  return false;
172  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void compat(const Vector &obj) const
Dimensional check for a compatibility.
bool geoalgo::Vector::operator< ( const double &  rhs) const
inline

Definition at line 169 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

170  { return Length() < rhs; }
double Length() const
Compute the length of the vector.
bool geoalgo::Vector::operator< ( const double &  rhs) const
inline

Definition at line 174 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

175  { return Length() < rhs; }
double Length() const
Compute the length of the vector.
Vector& geoalgo::Vector::operator= ( const Vector rhs)
inline

Definition at line 120 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

120  {
121  this->resize(rhs.size());
122  for(size_t i=0; i<rhs.size(); ++i) (*this)[i]=rhs[i];
123  return (*this);
124  }
Vector& geoalgo::Vector::operator= ( const Vector rhs)
inline

Definition at line 125 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

125  {
126  this->resize(rhs.size());
127  for(size_t i=0; i<rhs.size(); ++i) (*this)[i]=rhs[i];
128  return (*this);
129  }
bool geoalgo::Vector::operator== ( const Vector rhs) const
inline

Definition at line 172 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

173  {
174  compat(rhs);
175  for(size_t i=0; i<size(); ++i)
176  if((*this)[i] != rhs[i]) return false;
177  return true;
178  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void compat(const Vector &obj) const
Dimensional check for a compatibility.
bool geoalgo::Vector::operator== ( const Vector rhs) const
inline

Definition at line 177 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

178  {
179  compat(rhs);
180  for(size_t i=0; i<size(); ++i)
181  if((*this)[i] != rhs[i]) return false;
182  return true;
183  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
void compat(const Vector &obj) const
Dimensional check for a compatibility.
double geoalgo::Vector::Phi ( ) const

Compute the angle Phi.

Definition at line 65 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

65  {
66  return (*this)[0] == 0.0 && (*this)[1] == 0.0 ? 0.0 : atan2((*this)[1],(*this)[0]);
67  }
double geoalgo::Vector::Phi ( ) const

Compute the angle Phi.

void geoalgo::Vector::RotateX ( const double &  theta)

rotation operations

Definition at line 134 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

135  {
136 
137  double c = cos(theta);
138  double s = sin(theta);
139 
140  double ynew = (*this)[1] * c - (*this)[2] * s;
141  double znew = (*this)[1] * s + (*this)[2] * c;
142 
143  (*this)[1] = ynew;
144  (*this)[2] = znew;
145 
146  return;
147  }
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
void geoalgo::Vector::RotateX ( const double &  theta)

rotation operations

void geoalgo::Vector::RotateY ( const double &  theta)

Definition at line 150 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

151  {
152 
153  double c = cos(theta);
154  double s = sin(theta);
155 
156  double xnew = (*this)[0] * c + (*this)[2] * s;
157  double znew = - (*this)[0] * s + (*this)[2] * c;
158 
159  (*this)[0] = xnew;
160  (*this)[2] = znew;
161 
162  return;
163  }
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
void geoalgo::Vector::RotateY ( const double &  theta)
void geoalgo::Vector::RotateZ ( const double &  theta)

Definition at line 166 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

167  {
168 
169  double c = cos(theta);
170  double s = sin(theta);
171 
172  double xnew = (*this)[0] * c - (*this)[1] * s;
173  double ynew = (*this)[0] * s + (*this)[1] * c;
174 
175  (*this)[0] = xnew;
176  (*this)[1] = ynew;
177 
178  return;
179  }
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
void geoalgo::Vector::RotateZ ( const double &  theta)
double geoalgo::Vector::SqDist ( const Vector obj) const

Compute the squared distance to another vector.

Definition at line 43 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

43  {
44  compat(obj);
45  return _SqDist_(obj);
46  }
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 geoalgo::Vector::SqDist ( const Vector obj) const

Compute the squared distance to another vector.

double geoalgo::Vector::SqLength ( ) const

Compute the squared length of the vector.

Definition at line 34 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

34  {
35  double res=0;
36  for(auto const &v : (*this)) res += v*v;
37  return res;
38  }
double geoalgo::Vector::SqLength ( ) const

Compute the squared length of the vector.

double geoalgo::Vector::Theta ( ) const

Compute the angle theta.

Definition at line 69 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

69  {
70  if ( size() != 3 )
71  throw GeoAlgoException("<<Theta>> Only possible for 3-dimensional vectors!");
72 
73  return (*this).Length() == 0.0 ? 0.0 : acos( (*this)[2] / (*this).Length() );
74  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
double geoalgo::Vector::Theta ( ) const

Compute the angle theta.

TLorentzVector geoalgo::Vector::ToTLorentzVector ( ) const

Compute an opening angle w.r.t. the given vector.

Convert geovector to TLorentzVector (with 4th element set equal to 0)

Definition at line 83 of file larcorealg/larcorealg/GeoAlgo/GeoVector.cxx.

83  {
84  if(size()!=3)
85  throw GeoAlgoException("<<ToTLorentsVector>> only possible for 3-dimensional vectors!");
86  return TLorentzVector((*this)[0],(*this)[1],(*this)[2],0.);
87  }
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
TLorentzVector geoalgo::Vector::ToTLorentzVector ( ) const

Compute an opening angle w.r.t. the given vector.

Convert geovector to TLorentzVector (with 4th element set equal to 0)

Friends And Related Function Documentation

GeoAlgo
friend

Definition at line 38 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

HalfLine
friend

Definition at line 35 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

LineSegment
friend

Definition at line 36 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

std::ostream& operator<< ( std::ostream &  o,
::geoalgo::Vector const &  a 
)
friend

Streamer.

Definition at line 185 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

186  { o << "Vector ("; for(auto const& v : a) o << v << " ";
187  o << ")";
188  return o;
189  }
process_name gaushit a
std::ostream& operator<< ( std::ostream &  o,
::geoalgo::Vector const &  a 
)
friend

Streamer.

Definition at line 190 of file sbncode/sbncode/OpT0Finder/flashmatch/GeoAlgo/GeoVector.h.

191  { o << a.dump(); return o; }
process_name gaushit a
Sphere
friend

Definition at line 37 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.

Trajectory
friend

Definition at line 34 of file larcorealg/larcorealg/GeoAlgo/GeoVector.h.


The documentation for this class was generated from the following files: