ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkDetDescr
TrkVolumes
src
Volume.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// Volume.cxx, (c) ATLAS Detector software
8
9
// Trk
10
#include "
TrkVolumes/Volume.h
"
11
#include "
TrkDetDescrUtils/ObjectAccessor.h
"
12
#include "
TrkVolumes/VolumeBounds.h
"
13
//CxxUtils
14
#include "
CxxUtils/inline_hints.h
"
15
// Gaudi
16
#include "GaudiKernel/MsgStream.h"
17
// STD
18
#include <iostream>
19
20
21
// constructor with Amg::Transform3D
22
Trk::Volume::Volume
(std::unique_ptr<Amg::Transform3D> htrans,
23
std::shared_ptr<Trk::VolumeBounds> volbounds)
24
:
m_transform
(
std
::move(htrans))
25
,
m_center
(
m_transform
?
m_transform
->translation() :
Trk
::
s_origin
)
26
,
m_volumeBounds
(
std
::move(volbounds))
27
{}
28
29
// copy constructor
30
Trk::Volume::Volume
(
const
Trk::Volume
& vol)
31
:
m_transform
(vol.
m_transform
32
?
std
::make_unique<
Amg
::
Transform3D
>(*(vol.
m_transform
))
33
: nullptr),
34
m_center
(vol.
m_center
),
35
m_volumeBounds
(vol.
m_volumeBounds
) {}
36
37
// copy constructor with shift
38
Trk::Volume::Volume
(
const
Trk::Volume
& vol,
const
Amg::Transform3D
& shift)
39
:
m_transform
(vol.
m_transform
?
std
::make_unique<
Amg
::
Transform3D
>(
40
shift * (*(vol.
m_transform
)))
41
:
std
::make_unique<
Amg
::
Transform3D
>(shift)),
42
m_center
(shift * vol.
m_center
),
43
m_volumeBounds
(vol.
m_volumeBounds
) {}
44
45
// assignment operator
46
Trk::Volume
&
47
Trk::Volume::operator=
(
const
Trk::Volume
& vol)
48
{
49
if
(
this
!= &vol) {
50
m_transform
= vol.
m_transform
51
? std::make_unique<Amg::Transform3D>(*vol.
m_transform
)
52
:
nullptr
;
53
m_center
= vol.
m_center
;
54
m_volumeBounds
= vol.
m_volumeBounds
;
55
}
56
return
*
this
;
57
}
58
59
Trk::Volume
*
60
Trk::Volume::clone
()
const
61
{
62
return
new
Trk::Volume
(*
this
);
63
}
64
65
// We compile this package with optimization, even in debug builds; otherwise,
66
// the heavy use of Eigen makes it too slow. However, from here we may call
67
// to out-of-line Eigen code that is linked from other DSOs; in that case,
68
// it would not be optimized. Avoid this by forcing all Eigen code
69
// to be inlined here if possible.
70
ATH_FLATTEN
71
bool
72
Trk::Volume::inside
(
const
Amg::Vector3D
& gp,
double
tol)
const
73
{
74
if
(!
m_transform
) {
75
return
(
volumeBounds
()).inside(gp, tol);
76
}
77
Amg::Vector3D
posInVolFrame((
transform
().inverse()) * gp);
78
return
(
volumeBounds
()).inside(posInVolFrame, tol);
79
}
80
81
Trk::ObjectAccessor
82
Trk::Volume::boundarySurfaceAccessor
(
83
const
Amg::Vector3D
& gp,
84
const
Amg::Vector3D
& dir,
85
bool
forceInside)
const
86
{
87
if
(!
m_transform
) {
88
return
Trk::ObjectAccessor
(
89
volumeBounds
().
boundarySurfaceAccessor
(gp, dir, forceInside));
90
}
91
return
Trk::ObjectAccessor
(
volumeBounds
().
boundarySurfaceAccessor
(
92
transform
().inverse() * gp, dir, forceInside));
93
}
94
97
MsgStream&
98
Trk::operator<<
(MsgStream& sl,
const
Trk::Volume
& vol)
99
{
100
sl <<
"Trk::Volume with VolumeBounds :"
<< vol.
volumeBounds
() <<
endmsg
;
101
return
sl;
102
}
103
104
std::ostream&
105
Trk::operator<<
(std::ostream& sl,
const
Trk::Volume
& vol)
106
{
107
sl <<
"Trk::Volume with VolumeBounds :"
<< vol.
volumeBounds
() << std::endl;
108
return
sl;
109
}
110
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
Transform3D
Eigen::Affine3d Transform3D
Definition
GeoPrimitives.h:46
ObjectAccessor.h
VolumeBounds.h
Volume.h
Trk::ObjectAccessor
Definition
ObjectAccessor.h:15
Trk::Volume
Base class for all volumes inside the tracking realm, it defines the interface for inherited Volume c...
Definition
Volume.h:36
Trk::Volume::Volume
Volume()=default
Defaults copies are special due ot unique ptr data member.
Trk::Volume::operator=
Volume & operator=(Volume &&)=default
Trk::Volume::transform
const Amg::Transform3D & transform() const
Return methods for geometry transform.
Definition
Volume.h:83
Trk::Volume::volumeBounds
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Definition
Volume.h:96
Trk::Volume::m_center
Amg::Vector3D m_center
center position of the surface
Definition
Volume.h:79
Trk::Volume::m_transform
std::unique_ptr< Amg::Transform3D > m_transform
Transform3D (optional).
Definition
Volume.h:78
Trk::Volume::m_volumeBounds
std::shared_ptr< VolumeBounds > m_volumeBounds
the volumeBounds
Definition
Volume.h:80
Trk::Volume::boundarySurfaceAccessor
ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D &gp, const Amg::Vector3D &mom, bool forceInside=false) const
Provide accessor for BoundarySurfaces.
Definition
Volume.cxx:82
Trk::Volume::clone
virtual Volume * clone() const
polymorpic deep copy
Definition
Volume.cxx:60
Trk::Volume::inside
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
Definition
Volume.cxx:72
inline_hints.h
ATH_FLATTEN
#define ATH_FLATTEN
Definition
inline_hints.h:52
Amg
Definition of ATLAS Math & Geometry primitives (Amg).
Definition
AmgStringHelpers.h:19
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition
GeoPrimitives.h:46
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition
AlignModule.cxx:204
Trk::s_origin
static const Amg::Vector3D s_origin(0, 0, 0)
origin position
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0