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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
materialPlotHelper.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file materialPlotHelper.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 <iosfwd>
13
14
namespace
Acts {
15
27
class
GeometryID {
28
public
:
29
using
Value
= uint64_t;
30
32
constexpr
GeometryID
(
Value
encoded) :
m_value
(encoded) {}
34
GeometryID
() =
default
;
35
GeometryID
(
GeometryID
&&) =
default
;
36
GeometryID
(
const
GeometryID
&) =
default
;
37
~GeometryID
() =
default
;
38
GeometryID
&
operator=
(
GeometryID
&&) =
default
;
39
GeometryID
&
operator=
(
const
GeometryID
&) =
default
;
40
42
constexpr
Value
value
()
const
{
return
m_value
; }
43
45
constexpr
Value
volume
()
const
{
return
getBits
(
volume_mask
); }
47
constexpr
Value
boundary
()
const
{
return
getBits
(
boundary_mask
); }
49
constexpr
Value
layer
()
const
{
return
getBits
(
layer_mask
); }
51
constexpr
Value
approach
()
const
{
return
getBits
(
approach_mask
); }
53
constexpr
Value
sensitive
()
const
{
return
getBits
(
sensitive_mask
); }
54
55
private
:
56
// clang-format off
57
static
constexpr
Value
volume_mask
= 0xff00000000000000;
// 255 volumes
58
static
constexpr
Value
boundary_mask
= 0x00ff000000000000;
// 255 boundaries
59
static
constexpr
Value
layer_mask
= 0x0000fff000000000;
// 4095 layers
60
static
constexpr
Value
approach_mask
= 0x0000000ff0000000;
// 255 approach surfaces
61
static
constexpr
Value
sensitive_mask
= 0x000000000fffffff;
// (2^28)-1 sensitive surfaces
62
// clang-format on
63
64
Value
m_value
= 0;
65
67
static
constexpr
int
extractShift
(
Value
mask
) {
68
// use compiler builtin to extract the number of trailing bits from the
69
// mask. the builtin should be available on all supported compilers.
70
// need unsigned long long version (...ll) to ensure uint64_t compatibility.
71
// WARNING undefined behaviour for mask == 0 which we should not have.
72
return
__builtin_ctzll(mask);
73
}
75
constexpr
Value
getBits
(
Value
mask
)
const
{
76
return
(
m_value
& mask) >>
extractShift
(mask);
77
}
78
79
friend
constexpr
bool
operator==
(
GeometryID
lhs,
GeometryID
rhs) {
80
return
lhs.m_value == rhs.m_value;
81
}
82
friend
constexpr
bool
operator<
(
GeometryID
lhs,
GeometryID
rhs) {
83
return
lhs.m_value < rhs.m_value;
84
}
85
};
86
87
std::ostream&
operator<<
(std::ostream& os, GeometryID
id
);
88
89
}
// namespace Acts
acts
blob
master
Examples
Scripts
MaterialMaping
materialPlotHelper.hpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:24
using
1.8.2 with
ECCE GitHub integration