Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Volume.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Volume.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2016-2020 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#include "
Acts/Geometry/Volume.hpp
"
10
11
#include "
Acts/Definitions/Units.hpp
"
12
#include "
Acts/Geometry/VolumeBounds.hpp
"
13
14
#include <iostream>
15
#include <utility>
16
17
using namespace
Acts::UnitLiterals;
18
19
Acts::Volume::Volume
(
const
Transform3
&
transform
,
20
std::shared_ptr<const VolumeBounds> volbounds)
21
: GeometryObject(),
22
m_transform
(transform),
23
m_itransform
(
m_transform
.inverse()),
24
m_center
(
m_transform
.
translation
()),
25
m_volumeBounds
(std::
move
(volbounds)),
26
m_orientedBoundingBox
(
m_volumeBounds
->boundingBox(
27
nullptr, {0.05_mm, 0.05_mm, 0.05_mm},
this
)) {}
28
29
Acts::Volume::Volume
(
const
Volume& vol,
const
Transform3
& shift)
30
: GeometryObject(),
31
m_transform
(shift * vol.
m_transform
),
32
m_itransform
(
m_transform
.inverse()),
33
m_center
(
m_transform
.
translation
()),
34
m_volumeBounds
(vol.
m_volumeBounds
),
35
m_orientedBoundingBox
(
m_volumeBounds
->boundingBox(
36
nullptr, {0.05_mm, 0.05_mm, 0.05_mm},
this
)) {}
37
38
Acts::Vector3
Acts::Volume::binningPosition
(
const
GeometryContext
&
/*gctx*/
,
39
Acts::BinningValue
bValue)
const
{
40
// for most of the binning types it is actually the center,
41
// just for R-binning types the
42
if
(bValue ==
Acts::binR
|| bValue ==
Acts::binRPhi
) {
43
// the binning Position for R-type may have an offset
44
return
(center() +
m_volumeBounds
->binningOffset(bValue));
45
}
46
// return the center
47
return
center();
48
}
49
50
// assignment operator
51
Acts::Volume
&
Acts::Volume::operator=
(
const
Acts::Volume
& vol) {
52
if
(
this
!= &vol) {
53
m_transform
= vol.
m_transform
;
54
m_center
= vol.
m_center
;
55
m_volumeBounds
= vol.
m_volumeBounds
;
56
}
57
return
*
this
;
58
}
59
60
bool
Acts::Volume::inside
(
const
Acts::Vector3
&
gpos
,
double
tol)
const
{
61
Acts::Vector3
posInVolFrame((
transform
().inverse()) * gpos);
62
return
(volumeBounds()).inside(posInVolFrame, tol);
63
}
64
65
std::ostream&
Acts::operator<<
(std::ostream& sl,
const
Acts::Volume
& vol) {
66
sl <<
"Volume with "
<< vol.
volumeBounds
() << std::endl;
67
return
sl;
68
}
69
70
Acts::Volume::BoundingBox
Acts::Volume::boundingBox
(
71
const
Vector3
& envelope)
const
{
72
return
m_volumeBounds
->boundingBox(&
m_transform
, envelope,
this
);
73
}
74
75
const
Acts::Volume::BoundingBox
&
Acts::Volume::orientedBoundingBox
()
const
{
76
return
m_orientedBoundingBox
;
77
}
acts
blob
sPHENIX
Core
src
Geometry
Volume.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:36
using
1.8.2 with
sPHENIX GitHub integration