EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
EtmLine2D.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EtmLine2D.cc
1
#include <assert.h>
2
#include <math.h>
3
4
#include <
EtmLine2D.h
>
5
6
// -------------------------------------------------------------------------------------------
7
// -------------------------------------------------------------------------------------------
8
9
EtmLine2D::EtmLine2D
(
const
TVector2 &
x
,
const
TVector2 &
v
): mX(x), mV(v.Unit())
10
{
11
CalculateNormal
();
12
}
// EtmLine2D::EtmLine2D()
13
14
// -------------------------------------------------------------------------------------------
15
16
EtmLine2D::EtmLine2D
(
const
TVector2 &
x
,
double
alfa): mX(x) {
17
mV
= TVector2(
cos
(alfa), sin(alfa));
18
19
CalculateNormal
();
20
}
// EtmLine2D::EtmLine2D()
21
22
// -------------------------------------------------------------------------------------------
23
24
void
EtmLine2D::CalculateNormal
(
void
)
25
{
26
mN
=
mV
.Rotate(
M_PI
/2);
27
}
// EtmLine2D::CalculateNormal()
28
29
// -------------------------------------------------------------------------------------------
30
// -------------------------------------------------------------------------------------------
31
32
TVector2
EtmLine2D::Cross
(
const
EtmLine2D
&line)
const
33
{
34
// Efficiency is least of concerns for this code;
35
const
TVector2 &x1 =
mX
, &
v1
=
mV
, &
x2
= line.
mX
, &
v2
= line.
mV
;
36
double
x1v2 = x1*
v2
, x1v1 = x1*
v1
, v1v2 = v1*
v2
, x2v2 = x2*
v2
, x2v1 = x2*
v1
;
37
38
// FIXME: do it better later;
39
assert(v1v2*v1v2 != 1.0);
40
double
t1
= (x2v2*v1v2 - x2v1 + x1v1 - x1v2*v1v2)/(v1v2*v1v2 - 1.0);
41
42
return
x1 + t1*
v1
;
43
}
// EtmLine2D::Cross()
44
45
// -------------------------------------------------------------------------------------------
46
47
double
EtmLine2D::Distance
(
const
TVector2 &
point
)
const
48
{
49
return
(point -
mX
)*
mN
;
50
}
// EtmLine2D::Distance()
51
52
// -------------------------------------------------------------------------------------------
53
54
bool
EtmLine2D::IsParallel
(
const
EtmLine2D
&line)
const
55
{
56
// FIXME: do it better later; for now I'm only interested in EtmLine2D::Cross() to work;
57
double
v1v2 =
mV
*line.
mV
;
58
59
return
(v1v2*v1v2 == 1.0);
60
}
// EtmLine2D::IsParallel()
61
62
// -------------------------------------------------------------------------------------------
63
// -------------------------------------------------------------------------------------------
64
65
ClassImp
(
EtmLine2D
)
EicToyModel
blob
master
source
EtmLine2D.cc
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:38
using
1.8.2 with
EIC GitHub integration