ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
FPTracker
src
FPTracker/src/TransversePoint.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
FPTracker/TransversePoint.h
"
6
#include <sstream>
7
#include <cmath>
8
#include <iomanip>
9
#include <stdexcept>
10
namespace
FPTracker
{
11
TransversePoint::TransversePoint
():
m_x
(0.),
m_y
(0.){
12
}
13
TransversePoint::TransversePoint
(
double
x
,
double
y
):
m_x
(
x
),
m_y
(
y
){
14
}
15
16
double
TransversePoint::x
()
const
{
return
m_x
;}
17
double
TransversePoint::y
()
const
{
return
m_y
;}
18
19
TransversePoint
&
TransversePoint::operator*=
(
double
scalar) {
20
m_x
*= scalar;
21
m_y
*= scalar;
22
return
*
this
;
23
}
24
25
double
TransversePoint::mag2
()
const
{
return
m_x
*
m_x
+
m_y
*
m_y
;}
26
27
double
TransversePoint::mag
()
const
28
{
29
return
std::sqrt(
mag2
());
30
}
31
32
double
TransversePoint::operator[]
(
unsigned
int
i)
const
33
{
34
if
(i>1)
35
{
36
std::ostringstream ost;
37
ost<<
"TranversePoint index out of range: "
<<i<<
'\n'
;
38
throw
std::range_error(ost.str());
39
}
40
if
(i == 0){
return
m_x
;}
41
return
m_y
;
42
}
43
44
double
&
TransversePoint::operator[]
(
unsigned
int
i){
45
if
( i>1)
46
{
47
std::ostringstream ost;
48
ost<<
"TranversePoint index out of range: "
<<i<<
'\n'
;
49
throw
std::range_error(ost.str());
50
}
51
52
if
(i == 0){
return
m_x
;}
53
return
m_y
;
54
}
55
56
TransversePoint
&
TransversePoint::operator+=
(
const
TransversePoint
& rhs){
57
m_x
+= rhs.
m_x
;
58
m_y
+= rhs.
m_y
;
59
return
*
this
;
60
}
61
TransversePoint
&
TransversePoint::operator-=
(
const
TransversePoint
& rhs){
62
m_x
-= rhs.
m_x
;
63
m_y
-= rhs.
m_y
;
64
return
*
this
;
65
}
66
std::string
TransversePoint::str
()
const
{
67
std::ostringstream ost;
68
ost<<std::setprecision(3)<<std::scientific<<
"x\t"
<<
m_x
<<
" y\t"
<<
m_y
;
69
return
ost.str();
70
}
71
TransversePoint
operator+
(
const
TransversePoint
& lhs,
const
TransversePoint
& rhs){
72
TransversePoint
point(lhs);
73
return
point += rhs;
74
}
75
76
TransversePoint
operator-
(
const
TransversePoint
& lhs,
const
TransversePoint
& rhs){
77
TransversePoint
point(lhs);
78
return
point -= rhs;
79
}
80
std::ostream&
operator<<
(std::ostream& os,
const
TransversePoint
& p){
81
os<<p.str();
82
return
os;
83
}
84
85
TransversePoint
operator*
(
double
scalar,
const
TransversePoint
& point) {
86
TransversePoint
p = point;
87
return
p*=scalar;
88
}
89
90
91
}
operator*
ElementConstReference operator*() const
Return a reference to the referenced element.
TransversePoint.h
FPTracker::TransversePoint
Definition
FPTracker/FPTracker/TransversePoint.h:12
FPTracker::TransversePoint::m_x
double m_x
Definition
FPTracker/FPTracker/TransversePoint.h:27
FPTracker::TransversePoint::m_y
double m_y
Definition
FPTracker/FPTracker/TransversePoint.h:28
FPTracker::TransversePoint::mag2
double mag2() const
Definition
FPTracker/src/TransversePoint.cxx:25
FPTracker::TransversePoint::str
std::string str() const
Definition
FPTracker/src/TransversePoint.cxx:66
FPTracker::TransversePoint::y
double y() const
Definition
FPTracker/src/TransversePoint.cxx:17
FPTracker::TransversePoint::mag
double mag() const
Definition
FPTracker/src/TransversePoint.cxx:27
FPTracker::TransversePoint::x
double x() const
Definition
FPTracker/src/TransversePoint.cxx:16
FPTracker::TransversePoint::operator[]
double operator[](unsigned int) const
Definition
FPTracker/src/TransversePoint.cxx:32
FPTracker::TransversePoint::TransversePoint
TransversePoint()
Definition
FPTracker/src/TransversePoint.cxx:11
FPTracker::TransversePoint::operator-=
TransversePoint & operator-=(const TransversePoint &rhs)
Definition
FPTracker/src/TransversePoint.cxx:61
FPTracker::TransversePoint::operator*=
TransversePoint & operator*=(double)
Definition
FPTracker/src/TransversePoint.cxx:19
FPTracker::TransversePoint::operator+=
TransversePoint & operator+=(const TransversePoint &rhs)
Definition
FPTracker/src/TransversePoint.cxx:56
FPTracker
Definition
FPTracker/FPTracker/Beamline.h:12
FPTracker::operator-
Point operator-(const Point &lhs, const Point &rhs)
Definition
FPTracker/src/Point.cxx:103
FPTracker::operator+
Point operator+(const Point &lhs, const Point &rhs)
Definition
FPTracker/src/Point.cxx:98
FPTracker::operator<<
std::ostream & operator<<(std::ostream &os, const Beamline &bl)
Definition
FPTracker/src/Beamline.cxx:163
Generated on
for ATLAS Offline Software by
1.17.0