ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkDetDescr
TrkSurfaces
src
CylinderBounds.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// CylinderBounds.cxx, (c) ATLAS Detector Software
8
9
// Trk
10
#include "
TrkSurfaces/CylinderBounds.h
"
11
// Gaudi
12
#include "GaudiKernel/MsgStream.h"
13
// STD
14
#include <cmath>
15
#include <iomanip>
16
#include <iostream>
17
18
Trk::CylinderBounds::CylinderBounds
()
19
:
m_boundValues
(
CylinderBounds
::
bv_length
, 0.)
20
,
m_checkPhi
(false)
21
{}
22
23
Trk::CylinderBounds::CylinderBounds
(
double
radius,
double
halez)
24
:
m_boundValues
(
CylinderBounds
::
bv_length
, 0.)
25
,
m_checkPhi
(false)
26
{
27
m_boundValues
[
CylinderBounds::bv_radius
] = fabs(radius);
28
m_boundValues
[
CylinderBounds::bv_halfPhiSector
] =
M_PI
;
29
m_boundValues
[
CylinderBounds::bv_halfZ
] = fabs(halez);
30
}
31
32
Trk::CylinderBounds::CylinderBounds
(
double
radius,
double
haphi,
double
halez)
33
:
m_boundValues
(
CylinderBounds
::
bv_length
, 0.)
34
,
m_checkPhi
(true)
35
{
36
m_boundValues
[
CylinderBounds::bv_radius
] = fabs(radius);
37
m_boundValues
[
CylinderBounds::bv_halfPhiSector
] = haphi;
38
m_boundValues
[
CylinderBounds::bv_halfZ
] = fabs(halez);
39
}
40
41
Trk::CylinderBounds::CylinderBounds
(
double
radius,
double
haphi,
double
averagephi,
double
halez)
42
:
m_boundValues
(
CylinderBounds
::
bv_length
, 0.)
43
,
m_checkPhi
(true)
44
{
45
m_boundValues
[
CylinderBounds::bv_radius
] = fabs(radius);
46
m_boundValues
[
CylinderBounds::bv_averagePhi
] = averagephi;
47
m_boundValues
[
CylinderBounds::bv_halfPhiSector
] = haphi;
48
m_boundValues
[
CylinderBounds::bv_halfZ
] = fabs(halez);
49
}
50
51
bool
52
Trk::CylinderBounds::operator==
(
const
SurfaceBounds
& sbo)
const
53
{
54
// check the type first not to compare apples with oranges
55
const
Trk::CylinderBounds
* cylbo =
dynamic_cast<
const
Trk::CylinderBounds
*
>
(&sbo);
56
if
(!cylbo)
57
return
false
;
58
return
(
m_boundValues
== cylbo->
m_boundValues
);
59
}
60
61
double
62
Trk::CylinderBounds::minDistance
(
const
Amg::Vector2D
& pos)
const
63
{
64
const
double
pi2 = 2. *
M_PI
;
65
66
double
sZ = fabs(pos[
locZ
]) -
m_boundValues
[
CylinderBounds::bv_halfZ
];
67
double
wF =
m_boundValues
[
CylinderBounds::bv_halfPhiSector
];
68
if
(wF >=
M_PI
)
69
return
sZ;
70
double
dF =
71
fabs(pos[
locRPhi
] /
m_boundValues
[
CylinderBounds::bv_radius
] -
m_boundValues
[
CylinderBounds::bv_averagePhi
]);
72
if
(dF >
M_PI
)
73
dF = pi2 - dF;
74
double
sF = 2. *
m_boundValues
[
CylinderBounds::bv_radius
] * sin(.5 * (dF - wF));
75
76
if
(sF <= 0. || sZ <= 0.) {
77
if
(sF > sZ){
78
return
sF;
79
}
80
81
return
sZ;
82
}
83
return
sqrt(sF * sF + sZ * sZ);
84
}
85
86
// ostream operator overload
87
MsgStream&
88
Trk::CylinderBounds::dump
(MsgStream& sl)
const
89
{
90
sl << std::setiosflags(std::ios::fixed);
91
sl << std::setprecision(7);
92
sl <<
"Trk::CylinderBounds: (radius, averagePhi, halfPhiSector, halflengthInZ) = "
;
93
sl <<
"("
<< this->
r
() <<
", "
<< this->
averagePhi
() <<
", "
;
94
sl << this->
halfPhiSector
() <<
", "
<< this->
halflengthZ
() <<
")"
;
95
sl << std::setprecision(-1);
96
return
sl;
97
}
98
99
std::ostream&
100
Trk::CylinderBounds::dump
(std::ostream& sl)
const
101
{
102
sl << std::setiosflags(std::ios::fixed);
103
sl << std::setprecision(7);
104
sl <<
"Trk::CylinderBounds: (radius, averagePhi, halfPhiSector, halflengthInZ) = "
;
105
sl <<
"("
<< this->
r
() <<
", "
<< this->
averagePhi
() <<
", "
;
106
sl << this->
halfPhiSector
() <<
", "
<< this->
halflengthZ
() <<
")"
;
107
sl << std::setprecision(-1);
108
return
sl;
109
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
CylinderBounds.h
Trk::CylinderBounds
Bounds for a cylindrical Surface.
Definition
CylinderBounds.h:46
Trk::CylinderBounds::minDistance
virtual double minDistance(const Amg::Vector2D &pos) const override final
Minimal distance to boundary ( > 0 if outside and <=0 if inside).
Definition
CylinderBounds.cxx:62
Trk::CylinderBounds::m_checkPhi
bool m_checkPhi
Definition
CylinderBounds.h:144
Trk::CylinderBounds::bv_halfZ
@ bv_halfZ
Definition
CylinderBounds.h:54
Trk::CylinderBounds::bv_radius
@ bv_radius
Definition
CylinderBounds.h:51
Trk::CylinderBounds::bv_length
@ bv_length
Definition
CylinderBounds.h:55
Trk::CylinderBounds::bv_averagePhi
@ bv_averagePhi
Definition
CylinderBounds.h:52
Trk::CylinderBounds::bv_halfPhiSector
@ bv_halfPhiSector
Definition
CylinderBounds.h:53
Trk::CylinderBounds::dump
virtual MsgStream & dump(MsgStream &sl) const override
Output Method for MsgStream.
Definition
CylinderBounds.cxx:88
Trk::CylinderBounds::halfPhiSector
double halfPhiSector() const
This method returns the halfPhiSector angle.
Trk::CylinderBounds::m_boundValues
std::vector< TDD_real_t > m_boundValues
internal storage of the geometry parameters
Definition
CylinderBounds.h:143
Trk::CylinderBounds::CylinderBounds
CylinderBounds()
Default Constructor.
Definition
CylinderBounds.cxx:18
Trk::CylinderBounds::operator==
virtual bool operator==(const SurfaceBounds &sbo) const override
Equality operator.
Definition
CylinderBounds.cxx:52
Trk::CylinderBounds::averagePhi
double averagePhi() const
This method returns the average phi.
Trk::CylinderBounds::halflengthZ
double halflengthZ() const
This method returns the halflengthZ.
Trk::SurfaceBounds::SurfaceBounds
SurfaceBounds()=default
Default Constructor.
r
int r
Definition
globals.cxx:22
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition
GeoPrimitives.h:48
Trk::locRPhi
@ locRPhi
Definition
ParamDefs.h:40
Trk::locZ
@ locZ
local cylindrical
Definition
ParamDefs.h:42
Generated on
for ATLAS Offline Software by
1.17.0