ATLAS Offline Software
Tracking
TrkExtrapolation
TrkExUtils
TrkExUtils
LineIntersection2D.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// LineIntersection2D.h, (c) ATLAS Detector software
8
9
#ifndef TRKEXUTILS_LINEINTERSECTION2D_H
10
#define TRKEXUTILS_LINEINTERSECTION2D_H
11
12
#include <cmath>
13
#include <utility>
14
15
#ifndef NUMERICALSTABLE
16
#define NUMERICALSTABLE 10e-7
17
#endif
18
19
namespace
Trk
{
20
21
/* @struct LineIntersction2D
22
23
Helper method having 2 lines given with two sets of points each
24
25
(x1,y1)(x2,y2) - line a
26
(X1,Y1)(X2,Y2) - line b
27
28
@author Andreas.Salzburger@cern.ch
29
*/
30
31
struct
LineIntersection2D
32
{
33
34
bool
valid
;
35
double
interX
;
36
double
interY
;
37
double
k
,
K
,
d
,
D
;
38
39
LineIntersection2D
(
double
x1
,
40
double
y1
,
41
double
x2
,
42
double
y2
,
43
double
X1,
44
double
Y1,
45
double
X2,
46
double
Y2)
47
{
48
// diffs, k's and d's
49
double
deltax =
x2
-
x1
;
50
double
deltay =
y2
-
y1
;
51
double
deltaX
= X2 - X1;
52
double
deltaY
= Y2 - Y1;
53
k
= deltay / deltax;
54
K
=
deltaY
/
deltaX
;
55
d
=
y2
-
k
*
x2
;
56
D
= Y2 -
K
* X2;
57
// check if valid
58
valid
= ((
k
-
K
) * (
k
-
K
) >
NUMERICALSTABLE
);
59
if
(
valid
) {
60
interX
= (
D
-
d
) / (
k
-
K
);
61
interY
=
interX
*
k
+
d
;
62
}
else
{
63
interX
= -99999.;
64
interY
= -99999.;
65
}
66
}
67
};
68
69
}
// end of namespace
70
71
#endif
72
plotBeamSpotCompare.x1
x1
Definition:
plotBeamSpotCompare.py:216
NUMERICALSTABLE
#define NUMERICALSTABLE
Definition:
LineIntersection2D.h:16
Trk::LineIntersection2D::k
double k
Definition:
LineIntersection2D.h:37
makeComparison.deltaY
int deltaY
Definition:
makeComparison.py:44
Trk::LineIntersection2D::K
double K
Definition:
LineIntersection2D.h:37
plotBeamSpotCompare.x2
x2
Definition:
plotBeamSpotCompare.py:218
makeTRTBarrelCans.y1
tuple y1
Definition:
makeTRTBarrelCans.py:15
Trk::LineIntersection2D::interX
double interX
Definition:
LineIntersection2D.h:35
makeTRTBarrelCans.y2
tuple y2
Definition:
makeTRTBarrelCans.py:18
compareGeometries.deltaX
float deltaX
Definition:
compareGeometries.py:32
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition:
FakeTrackBuilder.h:9
Trk::LineIntersection2D
Definition:
LineIntersection2D.h:32
Trk::LineIntersection2D::interY
double interY
Definition:
LineIntersection2D.h:36
Trk::LineIntersection2D::d
double d
Definition:
LineIntersection2D.h:37
Trk::LineIntersection2D::D
double D
Definition:
LineIntersection2D.h:37
Trk::LineIntersection2D::LineIntersection2D
LineIntersection2D(double x1, double y1, double x2, double y2, double X1, double Y1, double X2, double Y2)
Definition:
LineIntersection2D.h:39
Trk::LineIntersection2D::valid
bool valid
Definition:
LineIntersection2D.h:34
Generated on Sun Dec 22 2024 21:13:53 for ATLAS Offline Software by
1.8.18