ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
ECCE @ EIC Software
Deprecated List
Modules
Namespaces
Classes
Files
File List
acts
blob
master
CI
Core
include
Acts
EventData
Fitter
Geometry
detail
AbstractVolume.hpp
ApproachDescriptor.hpp
BoundarySurfaceFace.hpp
BoundarySurfaceT.hpp
ConeLayer.hpp
CuboidVolumeBounds.hpp
CuboidVolumeBuilder.hpp
CutoutCylinderVolumeBounds.hpp
CylinderLayer.hpp
CylinderVolumeBounds.hpp
CylinderVolumeBuilder.hpp
CylinderVolumeHelper.hpp
DetectorElementBase.hpp
DiscLayer.hpp
Extent.hpp
GenericApproachDescriptor.hpp
GenericCuboidVolumeBounds.hpp
GeometryContext.hpp
GeometryID.hpp
GeometryObject.hpp
GeometryObjectSorter.hpp
GeometryStatics.hpp
GlueVolumesDescriptor.hpp
HierarchicalGeometryContainer.hpp
IConfinedTrackingVolumeBuilder.hpp
ILayerArrayCreator.hpp
ILayerBuilder.hpp
ITrackingGeometryBuilder.hpp
ITrackingVolumeArrayCreator.hpp
ITrackingVolumeBuilder.hpp
ITrackingVolumeHelper.hpp
Layer.hpp
LayerArrayCreator.hpp
LayerCreator.hpp
NavigationLayer.hpp
PassiveLayerBuilder.hpp
PlaneLayer.hpp
Polyhedron.hpp
ProtoLayer.hpp
SurfaceArrayCreator.hpp
TrackingGeometry.hpp
TrackingGeometryBuilder.hpp
TrackingVolume.hpp
TrackingVolumeArrayCreator.hpp
TrapezoidVolumeBounds.hpp
Volume.hpp
VolumeBounds.hpp
MagneticField
Material
Propagator
Seeding
Surfaces
TrackFinder
Utilities
Vertexing
Visualization
src
doc
Examples
Fatras
Plugins
Tests
thirdparty
analysis
coresoftware
Doxygen_Assist
ecce-detectors
fun4all_eicdetectors
geant4
macros
online_distribution
tutorials
doxygen_mainpage.h
File Members
External Links
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
GeometryID.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file GeometryID.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2016-2019 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
#pragma once
10
11
#include <cstdint>
12
#include <functional>
13
#include <iosfwd>
14
15
namespace
Acts {
16
28
class
GeometryID
{
29
public
:
30
using
Value
= uint64_t;
31
33
constexpr
GeometryID
(
Value
encoded) :
m_value
(encoded) {}
35
GeometryID
() =
default
;
36
GeometryID
(
GeometryID
&&) =
default
;
37
GeometryID
(
const
GeometryID
&) =
default
;
38
~GeometryID
() =
default
;
39
GeometryID
&
operator=
(
GeometryID
&&) =
default
;
40
GeometryID
&
operator=
(
const
GeometryID
&) =
default
;
41
43
constexpr
Value
value
()
const
{
return
m_value
; }
44
46
constexpr
Value
volume
()
const
{
return
getBits
(
kVolumeMask
); }
48
constexpr
Value
boundary
()
const
{
return
getBits
(
kBoundaryMask
); }
50
constexpr
Value
layer
()
const
{
return
getBits
(
kLayerMask
); }
52
constexpr
Value
approach
()
const
{
return
getBits
(
kApproachMask
); }
54
constexpr
Value
sensitive
()
const
{
return
getBits
(
kSensitiveMask
); }
55
57
constexpr
GeometryID
&
setVolume
(
Value
volume
) {
58
return
setBits
(
kVolumeMask
, volume);
59
}
61
constexpr
GeometryID
&
setBoundary
(
Value
boundary
) {
62
return
setBits
(
kBoundaryMask
, boundary);
63
}
65
constexpr
GeometryID
&
setLayer
(
Value
layer
) {
66
return
setBits
(
kLayerMask
, layer);
67
}
69
constexpr
GeometryID
&
setApproach
(
Value
approach
) {
70
return
setBits
(
kApproachMask
, approach);
71
}
73
constexpr
GeometryID
&
setSensitive
(
Value
sensitive
) {
74
return
setBits
(
kSensitiveMask
, sensitive);
75
}
76
77
private
:
78
// (2^8)-1 = 255 volumes
79
static
constexpr
Value
kVolumeMask
= 0xff00000000000000;
80
// (2^8)-1 = 255 boundaries
81
static
constexpr
Value
kBoundaryMask
= 0x00ff000000000000;
82
// (2^12)-1 = 4096 layers
83
static
constexpr
Value
kLayerMask
= 0x0000fff000000000;
84
// (2^8)-1 = 255 approach surfaces
85
static
constexpr
Value
kApproachMask
= 0x0000000ff0000000;
86
// (2^28)-1 sensitive surfaces
87
static
constexpr
Value
kSensitiveMask
= 0x000000000fffffff;
88
89
Value
m_value
= 0;
90
92
static
constexpr
int
extractShift
(
Value
mask
) {
93
// use compiler builtin to extract the number of trailing bits from the
94
// mask. the builtin should be available on all supported compilers.
95
// need unsigned long long version (...ll) to ensure uint64_t compatibility.
96
// WARNING undefined behaviour for mask == 0 which we should not have.
97
return
__builtin_ctzll(mask);
98
}
100
constexpr
Value
getBits
(
Value
mask
)
const
{
101
return
(
m_value
& mask) >>
extractShift
(mask);
102
}
104
constexpr
GeometryID
&
setBits
(
Value
mask
,
Value
id
) {
105
m_value
= (
m_value
& ~mask) | ((
id
<<
extractShift
(mask)) &
mask
);
106
// return *this here so we need to write less lines in the set... methods
107
return
*
this
;
108
}
109
110
friend
constexpr
bool
operator==
(
GeometryID
lhs,
GeometryID
rhs) {
111
return
lhs.
m_value
== rhs.
m_value
;
112
}
113
friend
constexpr
bool
operator<
(
GeometryID
lhs,
GeometryID
rhs) {
114
return
lhs.
m_value
< rhs.
m_value
;
115
}
116
};
117
118
std::ostream&
operator<<
(std::ostream& os, GeometryID
id
);
119
120
}
// namespace Acts
121
122
// specialize std::hash so GeometryId can be used e.g. in an unordered_map
123
namespace
std {
124
template
<>
125
struct
hash
<Acts::GeometryID> {
126
auto
operator()
(
Acts::GeometryID
gid)
const
noexcept {
127
return
std::hash<Acts::GeometryID::Value>()(gid.value());
128
}
129
};
130
}
// namespace std
acts
blob
master
Core
include
Acts
Geometry
GeometryID.hpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:20
using
1.8.2 with
ECCE GitHub integration