Belle II Software  release-06-02-00
Vector3D.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
9 
10 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
11 
12 #include <TVector3.h>
13 
14 #include <sstream>
15 #include <ostream>
16 
17 using namespace Belle2;
18 using namespace TrackFindingCDC;
19 
20 Vector3D::Vector3D(const TVector3& tVector3)
21  : m_xy(tVector3.X(), tVector3.Y())
22  , m_z(tVector3.Z())
23 {
24 }
25 
26 Vector3D::Vector3D(const B2Vector3D& b2Vector3)
27  : m_xy(b2Vector3.X(), b2Vector3.Y())
28  , m_z(b2Vector3.Z())
29 {
30 }
31 
32 Vector3D& Vector3D::operator=(const TVector3& tVector3)
33 {
34  m_xy.setX(tVector3.X());
35  m_xy.setY(tVector3.Y());
36  m_z = tVector3.Z();
37  return *this;
38 }
39 
41 {
42  m_xy.setX(b2Vector3.X());
43  m_xy.setY(b2Vector3.Y());
44  m_z = b2Vector3.Z();
45  return *this;
46 }
47 
48 Vector3D::operator const TVector3() const
49 {
50  return TVector3(x(), y(), z());
51 }
52 
53 Vector3D::operator const B2Vector3D() const
54 {
55  return B2Vector3D(x(), y(), z());
56 }
57 
58 std::ostream& TrackFindingCDC::operator<<(std::ostream& output, const Vector3D& vector3D)
59 {
60  return output << "Vector3D(" << vector3D.x() << "," << vector3D.y() << "," << vector3D.z() << ")";
61 }
62 
63 std::string Vector3D::__str__() const
64 {
65  std::stringstream sstream;
66  sstream << *this;
67  return sstream.str();
68 }
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:420
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:416
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:418
void setY(const double y)
Setter for the y coordinate.
Definition: Vector2D.h:622
void setX(const double x)
Setter for the x coordinate.
Definition: Vector2D.h:612
A three dimensional vector.
Definition: Vector3D.h:32
Vector3D & operator=(const TVector3 &tVector3)
Assignment translating from a TVector3 instance.
Definition: Vector3D.cc:32
std::string __str__() const
Output operator for python.
Definition: Vector3D.cc:63
Vector2D m_xy
Memory for the first and second coordinate available as a vector.
Definition: Vector3D.h:561
double x() const
Getter for the x coordinate.
Definition: Vector3D.h:462
double y() const
Getter for the y coordinate.
Definition: Vector3D.h:474
double m_z
Memory for the third coordinate.
Definition: Vector3D.h:564
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:486
Vector3D()
Default constructor for ROOT compatibility.
Definition: Vector3D.h:36
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:493
Abstract base class for different kinds of events.