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
MicromegasDefs.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file MicromegasDefs.cc
1
6
#include "
MicromegasDefs.h
"
7
8
namespace
9
{
10
//* converninece trait for underlying type
11
template
<
class
T>
12
using
underlying_type_t =
typename
std::underlying_type<T>::type
;
13
14
//* convert an strong type enum to integral type
15
template
<
class
T>
16
constexpr underlying_type_t<T>
17
to_underlying_type(
T
value
) noexcept
18
{
return
static_cast<
underlying_type_t<T>
>
(
value
);}
19
20
}
21
22
namespace
MicromegasDefs
23
{
24
25
//________________________________________________________________
26
TrkrDefs::hitsetkey
genHitSetKey
(uint8_t
layer
,
SegmentationType
type
, uint8_t
tile
)
27
{
28
TrkrDefs::hitsetkey
key =
TrkrDefs::genHitSetKey
(
TrkrDefs::TrkrId::micromegasId
, layer);
29
30
TrkrDefs::hitsetkey
tmp
= to_underlying_type(type);
31
key |= (tmp << kBitShiftSegmentation);
32
33
tmp =
tile
;
34
key |= (tmp << kBitShiftTileId);
35
36
return
key;
37
}
38
39
//________________________________________________________________
40
SegmentationType
getSegmentationType
(
TrkrDefs::hitsetkey
key)
41
{
42
TrkrDefs::hitsetkey
tmp
= (key >> kBitShiftSegmentation);
43
return
static_cast<
SegmentationType
>
(
tmp
);
44
}
45
46
//________________________________________________________________
47
uint8_t
getTileId
(
TrkrDefs::hitsetkey
key)
48
{
49
TrkrDefs::hitsetkey
tmp
= (key >> kBitShiftTileId);
50
return
tmp
;
51
}
52
53
//________________________________________________________________
54
TrkrDefs::hitkey
genHitKey
(uint16_t strip)
55
{
56
TrkrDefs::hitkey
key = strip << kBitShiftStrip;
57
return
key;
58
}
59
60
//________________________________________________________________
61
uint16_t
getStrip
(
TrkrDefs::hitkey
key )
62
{
63
TrkrDefs::hitkey
tmp
= (key >> kBitShiftStrip);
64
return
tmp
;
65
}
66
67
//________________________________________________________________
68
SegmentationType
getSegmentationType
(
TrkrDefs::cluskey
key)
69
{
70
TrkrDefs::hitsetkey
tmp
= (key >> TrkrDefs::kBitShiftClusId);
71
return
getSegmentationType
( tmp );
72
}
73
74
//________________________________________________________________
75
uint8_t
getTileId
(
TrkrDefs::cluskey
key)
76
{
77
TrkrDefs::hitsetkey
tmp
= (key >> TrkrDefs::kBitShiftClusId);
78
return
getTileId
( tmp );
79
}
80
81
}
coresoftware
blob
master
offline
packages
micromegas
MicromegasDefs.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:07
using
1.8.2 with
sPHENIX GitHub integration