BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnEnums.h
Go to the documentation of this file.
1
/**
2
* \file BmnEnums.h
3
* \author Andrey Lebedev <andrey.lebedev@gsi.de> - Original author. First version of code for CBM experiment.
4
* \author Sergey Merts <Sergey.Merts@gmail.com> - Modification for BMN experiment.
5
* \date 2008-2014
6
* \brief Define enumerations used in tracking.
7
**/
8
9
#ifndef BMNENUMS_H_
10
#define BMNENUMS_H_
11
12
#include <cstddef>
13
#include <type_traits>
14
15
/*
16
* A preprocessor definition to make an enumeration type a bitmask.
17
* If not familiar with bitmasks, see "C++ named requirements: BitmaskType" on cppreference (link:
18
* https://cppreference.dev/w/cpp/named_req/BitmaskType)
19
*/
20
#define MAKE_ENUM_BITMASK(EnumType) \
21
inline EnumType& operator|=(EnumType& lhv, const EnumType rhv) \
22
{ \
23
lhv = (EnumType)((std::underlying_type_t<EnumType>)lhv | (std::underlying_type_t<EnumType>)rhv); \
24
return lhv; \
25
} \
26
inline EnumType& operator&=(EnumType& lhv, const EnumType rhv) \
27
{ \
28
lhv = (EnumType)((std::underlying_type_t<EnumType>)lhv & (std::underlying_type_t<EnumType>)rhv); \
29
return lhv; \
30
} \
31
inline EnumType& operator^=(EnumType& lhv, const EnumType rhv) \
32
{ \
33
lhv = (EnumType)((std::underlying_type_t<EnumType>)lhv ^ (std::underlying_type_t<EnumType>)rhv); \
34
return lhv; \
35
} \
36
constexpr EnumType operator|(const EnumType lhv, const EnumType rhv) \
37
{ \
38
return (EnumType)((std::underlying_type_t<EnumType>)lhv | (std::underlying_type_t<EnumType>)rhv); \
39
} \
40
constexpr EnumType operator&(const EnumType lhv, const EnumType rhv) \
41
{ \
42
return (EnumType)((std::underlying_type_t<EnumType>)lhv & (std::underlying_type_t<EnumType>)rhv); \
43
} \
44
constexpr EnumType operator^(const EnumType lhv, const EnumType rhv) \
45
{ \
46
return (EnumType)((std::underlying_type_t<EnumType>)lhv ^ (std::underlying_type_t<EnumType>)rhv); \
47
} \
48
constexpr EnumType operator~(const EnumType value) \
49
{ \
50
return (EnumType)(~((std::underlying_type_t<EnumType>)value)); \
51
}
52
53
/*
54
* Checks if an enumeration-type argument has at least one of the provided flags (for bitmasks)
55
* @tparam T An enumeration type
56
* @param lhv An enumeration-type argument for which one wants to check the existence of some flags from `rhv`
57
* @param rhv Enumeration-type values one is looking for in the `lhv` argument
58
* @return 'true' if the enum argument has some of the provided flags, or 'false' if it doesn't
59
*/
60
template
<
typename
T>
61
inline
auto
HasAnyFlags
(
const
T lhv,
const
T rhv) -> std::enable_if_t<std::is_enum_v<T>,
bool
>
62
{
63
return
(std::underlying_type_t<T>)(lhv & rhv) != 0 ?
true
:
false
;
64
}
65
66
/*
67
* Checks if an enumeration-type argument has all of the provided flags (for bitmasks)
68
* @tparam T An enumeration type
69
* @param lhv An enumeration-type argument for which one wants to check the existence of all the flags from `rhv`
70
* @param rhv Enumeration-type values one is looking for in the `lhv` argument
71
* @return 'true' if the enum argument has all of the provided flags, or 'false' if it doesn't
72
*/
73
template
<
typename
T>
74
inline
auto
HasAllFlags
(
const
T lhv,
const
T rhv) -> std::enable_if_t<std::is_enum_v<T>,
bool
>
75
{
76
return
((lhv & rhv) == rhv) ? true :
false
;
77
}
78
79
/**
80
* Define type of hit on detector station.
81
*/
82
enum
BmnHitType
83
{
84
kBMNSTRIPHIT
= 0,
/**< Strip hit. */
85
kBMNPIXELHIT
= 1,
/**< Pixel hit. */
86
kBMNMIXHIT
= 2
/**< Mixed type of hits, i.e. both strip and pixel hits. **/
87
};
88
89
/**
90
* Define status code.
91
*/
92
enum
BmnStatus
93
{
94
kBMNSUCCESS
= 0,
/**< Success. */
95
kBMNERROR
= 1,
/**< Error. */
96
kBMNTIMEOUT
= 2,
97
kBMNFINISH
= 3,
98
kBMNCONTINUE
= 4
99
};
100
101
/**
102
* Define reconstructed track quality.
103
*/
104
enum
BmnTrackQa
105
{
106
kBMNGOOD
= 0,
/**< Good track. */
107
kBMNBAD
= 1,
/**< Bad track. */
108
kBMNGOODMERGE
= 2
/**< Correctly merged track. */
109
};
110
111
/**
112
* Define system identificator.
113
*/
114
enum
BmnSystemId
115
{
116
kBMNGEM
= 0,
/**< GEM detector. */
117
kBMNTOF
= 2,
/**< TOF detector. */
118
kBMNSTS
= 4
/**< STS detector. */
119
};
120
121
/**
122
* Define status of TOF hit merging
123
*/
124
enum
BmnTofHitQA
125
{
126
kBMNTOFGOOD
= 0,
/**< merged TOF hit. */
127
kBMNTOFBAD
= 1,
/**< not merged TOF hit. */
128
};
129
130
/**
131
* Define type of event
132
*/
133
enum
BmnTriggerType
134
{
135
kBMNBEAM
= 6,
/**< "beam" BC1 + BC2 + T0 + VC */
136
kBMNMINBIAS
= 1,
/**< "min.bias" BC1 + BC2 + T0 + VC + FD */
137
};
138
139
/**
140
* Define type of event
141
*/
142
enum
BmnEventType
143
{
144
kBMNPEDESTAL
= 0,
/**< pedestal event. */
145
kBMNPAYLOAD
= 1,
/**< spill event. */
146
kBMNEOS
= 2,
/**< End of spill. */
147
kBMNSTAT
= 3,
/**< Statistics. */
148
kBMNEMPTY
= 4,
/**< No event (wrong sync word or metadata payload) */
149
};
150
151
/**
152
* Define worker state
153
*/
154
enum
BmnWorkerState
155
{
156
kBMNWAIT
= 0,
157
kBMNWORK
= 1,
158
kBMNRECON
= 2,
159
};
160
161
/**
162
* Define experimental setup
163
*/
164
enum
BmnSetup
165
{
166
kBMNSETUP
= 0,
167
kSRCSETUP
= 1,
168
};
169
170
#endif
/* BMNENUMS_H_ */
BmnStatus
BmnStatus
Define status code.
Definition
BmnEnums.h:93
kBMNTIMEOUT
@ kBMNTIMEOUT
Definition
BmnEnums.h:96
kBMNFINISH
@ kBMNFINISH
Definition
BmnEnums.h:97
kBMNERROR
@ kBMNERROR
Error.
Definition
BmnEnums.h:95
kBMNSUCCESS
@ kBMNSUCCESS
Success.
Definition
BmnEnums.h:94
kBMNCONTINUE
@ kBMNCONTINUE
Definition
BmnEnums.h:98
HasAnyFlags
auto HasAnyFlags(const T lhv, const T rhv) -> std::enable_if_t< std::is_enum_v< T >, bool >
Definition
BmnEnums.h:61
BmnTofHitQA
BmnTofHitQA
Define status of TOF hit merging.
Definition
BmnEnums.h:125
kBMNTOFGOOD
@ kBMNTOFGOOD
merged TOF hit.
Definition
BmnEnums.h:126
kBMNTOFBAD
@ kBMNTOFBAD
not merged TOF hit.
Definition
BmnEnums.h:127
BmnWorkerState
BmnWorkerState
Define worker state.
Definition
BmnEnums.h:155
kBMNWAIT
@ kBMNWAIT
Definition
BmnEnums.h:156
kBMNRECON
@ kBMNRECON
Definition
BmnEnums.h:158
kBMNWORK
@ kBMNWORK
Definition
BmnEnums.h:157
BmnSetup
BmnSetup
Define experimental setup.
Definition
BmnEnums.h:165
kSRCSETUP
@ kSRCSETUP
Definition
BmnEnums.h:167
kBMNSETUP
@ kBMNSETUP
Definition
BmnEnums.h:166
HasAllFlags
auto HasAllFlags(const T lhv, const T rhv) -> std::enable_if_t< std::is_enum_v< T >, bool >
Definition
BmnEnums.h:74
BmnTriggerType
BmnTriggerType
Define type of event.
Definition
BmnEnums.h:134
kBMNMINBIAS
@ kBMNMINBIAS
"min.bias" BC1 + BC2 + T0 + VC + FD
Definition
BmnEnums.h:136
kBMNBEAM
@ kBMNBEAM
"beam" BC1 + BC2 + T0 + VC
Definition
BmnEnums.h:135
BmnHitType
BmnHitType
Define type of hit on detector station.
Definition
BmnEnums.h:83
kBMNMIXHIT
@ kBMNMIXHIT
Mixed type of hits, i.e.
Definition
BmnEnums.h:86
kBMNPIXELHIT
@ kBMNPIXELHIT
Pixel hit.
Definition
BmnEnums.h:85
kBMNSTRIPHIT
@ kBMNSTRIPHIT
Strip hit.
Definition
BmnEnums.h:84
BmnEventType
BmnEventType
Define type of event.
Definition
BmnEnums.h:143
kBMNSTAT
@ kBMNSTAT
Statistics.
Definition
BmnEnums.h:147
kBMNEOS
@ kBMNEOS
End of spill.
Definition
BmnEnums.h:146
kBMNPAYLOAD
@ kBMNPAYLOAD
spill event.
Definition
BmnEnums.h:145
kBMNPEDESTAL
@ kBMNPEDESTAL
pedestal event.
Definition
BmnEnums.h:144
kBMNEMPTY
@ kBMNEMPTY
No event (wrong sync word or metadata payload).
Definition
BmnEnums.h:148
BmnTrackQa
BmnTrackQa
Define reconstructed track quality.
Definition
BmnEnums.h:105
kBMNBAD
@ kBMNBAD
Bad track.
Definition
BmnEnums.h:107
kBMNGOODMERGE
@ kBMNGOODMERGE
Correctly merged track.
Definition
BmnEnums.h:108
kBMNGOOD
@ kBMNGOOD
Good track.
Definition
BmnEnums.h:106
BmnSystemId
BmnSystemId
Define system identificator.
Definition
BmnEnums.h:115
kBMNTOF
@ kBMNTOF
TOF detector.
Definition
BmnEnums.h:117
kBMNGEM
@ kBMNGEM
GEM detector.
Definition
BmnEnums.h:116
kBMNSTS
@ kBMNSTS
STS detector.
Definition
BmnEnums.h:118
install
include
BmnEnums.h
Generated on
for BmnRoot by
1.17.0