Belle II Software  release-05-01-25
Vector3D.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
11 
12 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
13 
14 #include <TVector3.h>
15 
16 #include <sstream>
17 #include <ostream>
18 
19 using namespace Belle2;
20 using namespace TrackFindingCDC;
21 
22 Vector3D::Vector3D(const TVector3& tVector3)
23  : m_xy(tVector3.X(), tVector3.Y())
24  , m_z(tVector3.Z())
25 {
26 }
27 
28 Vector3D::Vector3D(const B2Vector3D& b2Vector3)
29  : m_xy(b2Vector3.X(), b2Vector3.Y())
30  , m_z(b2Vector3.Z())
31 {
32 }
33 
34 Vector3D& Vector3D::operator=(const TVector3& tVector3)
35 {
36  m_xy.setX(tVector3.X());
37  m_xy.setY(tVector3.Y());
38  m_z = tVector3.Z();
39  return *this;
40 }
41 
43 {
44  m_xy.setX(b2Vector3.X());
45  m_xy.setY(b2Vector3.Y());
46  m_z = b2Vector3.Z();
47  return *this;
48 }
49 
50 Vector3D::operator const TVector3() const
51 {
52  return TVector3(x(), y(), z());
53 }
54 
55 Vector3D::operator const B2Vector3D() const
56 {
57  return B2Vector3D(x(), y(), z());
58 }
59 
60 std::ostream& TrackFindingCDC::operator<<(std::ostream& output, const Vector3D& vector3D)
61 {
62  return output << "Vector3D(" << vector3D.x() << "," << vector3D.y() << "," << vector3D.z() << ")";
63 }
64 
65 std::string Vector3D::__str__() const
66 {
67  std::stringstream sstream;
68  sstream << *this;
69  return sstream.str();
70 }
Belle2::TrackFindingCDC::Vector3D::Vector3D
Vector3D()
Default constructor for ROOT compatibility.
Definition: Vector3D.h:38
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::Vector2D::setY
void setY(const double y)
Setter for the y coordinate.
Definition: Vector2D.h:624
Belle2::TrackFindingCDC::Vector3D::operator=
Vector3D & operator=(const TVector3 &tVector3)
Assignment translating from a TVector3 instance.
Definition: Vector3D.cc:34
Belle2::TrackFindingCDC::Vector3D::m_z
double m_z
Memory for the third coordinate.
Definition: Vector3D.h:566
Belle2::TrackFindingCDC::Vector3D::x
double x() const
Getter for the x coordinate.
Definition: Vector3D.h:464
Belle2::B2Vector3::Z
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:434
Belle2::B2Vector3< double >
Belle2::B2Vector3D
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:507
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::Vector3D::y
double y() const
Getter for the y coordinate.
Definition: Vector3D.h:476
Belle2::TrackFindingCDC::Vector3D::m_xy
Vector2D m_xy
Memory for the first and second coordinate available as a vector.
Definition: Vector3D.h:563
Belle2::TrackFindingCDC::Vector3D::__str__
std::string __str__() const
Output operator for python.
Definition: Vector3D.cc:65
Belle2::TrackFindingCDC::Vector3D::z
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:488
Belle2::TrackFindingCDC::Vector2D::setX
void setX(const double x)
Setter for the x coordinate.
Definition: Vector2D.h:614
Belle2::B2Vector3::X
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:430
Belle2::B2Vector3::Y
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:432