Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Analysis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LHCb
Analysis
Commits
528948c0
Commit
528948c0
authored
1 year ago
by
Gerhard Raven
Browse files
Options
Downloads
Patches
Plain Diff
support putting any enum into FunTuple
parent
cfc82398
No related branches found
No related tags found
1 merge request
!973
support more enum types in FunTuple
Pipeline
#5392332
passed
1 year ago
Stage: test
Stage: .post
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Phys/FunTuple/src/FillTuple.h
+25
-20
25 additions, 20 deletions
Phys/FunTuple/src/FillTuple.h
with
25 additions
and
20 deletions
Phys/FunTuple/src/FillTuple.h
+
25
−
20
View file @
528948c0
...
...
@@ -14,8 +14,12 @@
// Gaudi
#include
"GaudiAlg/GaudiTupleAlg.h"
// Event
// Event -- to support various 'enum' classes
#include
"Event/MCVertex.h"
#include
"Event/ODIN.h"
#include
"Event/TrackEnums.h"
#include
"MCInterfaces/IMCReconstructed.h"
#include
"MCInterfaces/IMCReconstructible.h"
// custom classes
#include
"InvalidValue.h"
...
...
@@ -25,6 +29,7 @@
// Custom error code
#include
"ErrorCode.h"
#include
<type_traits>
namespace
LHCb
::
FTuple
{
// max buffer size for storing array
...
...
@@ -65,8 +70,13 @@ namespace LHCb::FTuple {
// default fill: just forward to column
template
<
typename
T
>
inline
StatusCode
fill_
(
const
Tuples
::
Tuple
&
ntuple
,
const
std
::
string
&
colname
,
const
T
&
val
)
{
return
ntuple
->
column
(
colname
,
val
);
StatusCode
fill_
(
const
Tuples
::
Tuple
&
ntuple
,
const
std
::
string
&
colname
,
const
T
&
val
)
{
if
constexpr
(
std
::
is_enum_v
<
T
>
)
{
// FIXME/TODO: this should really be done in NTuple::column instead...
return
fill_
(
ntuple
,
colname
,
static_cast
<
std
::
underlying_type_t
<
T
>>
(
val
)
);
}
else
{
return
ntuple
->
column
(
colname
,
val
);
}
}
// fill for scalar SIMD types (float_v)
...
...
@@ -81,13 +91,6 @@ namespace LHCb::FTuple {
return
ntuple
->
column
(
colname
,
val
.
cast
()
);
}
// fill for BXTypes (enum class of uint32_t see:
// https://gitlab.cern.ch/lhcb/LHCb/-/blob/master/Event/DAQEvent/include/Event/ODIN.h#L149)
using
BXTypes
=
LHCb
::
ODIN
::
BXTypes
;
inline
StatusCode
fill_
(
const
Tuples
::
Tuple
&
ntuple
,
const
std
::
string
&
colname
,
const
BXTypes
&
val
)
{
return
ntuple
->
column
(
colname
,
static_cast
<
std
::
uint8_t
>
(
val
)
);
}
// fill for uint64_t (unsigned long): Special since we cast it to unsigned long long
// as done in TupleObj.h in Gaudi. This is to side step a platform specific warning flagged by TupleObj.cpp in
// Gaudi. (see issue): https://gitlab.cern.ch/lhcb/DaVinci/-/issues/48 (Particularly see suggestion by Marco about
...
...
@@ -222,15 +225,17 @@ namespace LHCb::FTuple {
// list the supported types
inline
const
auto
map_valtype_callcolfun
=
make_map
<
bool
,
short
int
,
unsigned
short
int
,
int
,
unsigned
int
,
long
int
,
unsigned
long
int
,
long
long
int
,
unsigned
long
long
int
,
SIMDWrapper
::
scalar
::
int_v
,
float
,
double
,
std
::
uint64_t
,
BXTypes
,
SIMDWrapper
::
scalar
::
float_v
,
Gaudi
::
LorentzVector
,
Gaudi
::
XYZVector
,
Gaudi
::
XYZPoint
,
Gaudi
::
SymMatrix3x3
,
Gaudi
::
SymMatrix4x4
,
Gaudi
::
SymMatrix5x5
,
std
::
vector
<
double
>
,
std
::
vector
<
float
>
,
std
::
vector
<
int
>
,
std
::
vector
<
bool
>
,
std
::
vector
<
unsigned
int
>
,
std
::
vector
<
unsigned
long
int
>
,
std
::
vector
<
long
long
int
>
,
std
::
vector
<
long
int
>
,
std
::
vector
<
SIMDWrapper
::
scalar
::
float_v
>
,
LHCb
::
LinAlg
::
Vec
<
double
,
3
>
,
LHCb
::
LinAlg
::
Vec
<
double
,
4
>
,
LHCb
::
LinAlg
::
Vec
<
float
,
3
>
,
LHCb
::
LinAlg
::
Vec
<
float
,
4
>
,
LHCb
::
LinAlg
::
Vec
<
SIMDWrapper
::
scalar
::
float_v
,
3
>
,
LHCb
::
LinAlg
::
Vec
<
SIMDWrapper
::
scalar
::
float_v
,
4
>
,
LHCb
::
LinAlg
::
Vec3
<
double
>
,
LHCb
::
LinAlg
::
Vec3
<
float
>
,
LHCb
::
LinAlg
::
Vec3
<
SIMDWrapper
::
scalar
::
float_v
>
,
unsigned
long
long
int
,
SIMDWrapper
::
scalar
::
int_v
,
float
,
double
,
std
::
uint64_t
,
LHCb
::
ODIN
::
BXTypes
,
LHCb
::
MCVertex
::
MCVertexType
,
IMCReconstructible
::
RecCategory
,
IMCReconstructed
::
RecCategory
,
LHCb
::
Event
::
Enum
::
Track
::
History
,
LHCb
::
Event
::
Enum
::
Track
::
FitHistory
,
LHCb
::
Event
::
Enum
::
Track
::
Type
,
LHCb
::
Event
::
Enum
::
Track
::
FitStatus
,
LHCb
::
Event
::
Enum
::
Track
::
Flag
,
SIMDWrapper
::
scalar
::
float_v
,
Gaudi
::
LorentzVector
,
Gaudi
::
XYZVector
,
Gaudi
::
XYZPoint
,
Gaudi
::
SymMatrix3x3
,
Gaudi
::
SymMatrix4x4
,
Gaudi
::
SymMatrix5x5
,
std
::
vector
<
double
>
,
std
::
vector
<
float
>
,
std
::
vector
<
int
>
,
std
::
vector
<
bool
>
,
std
::
vector
<
unsigned
int
>
,
std
::
vector
<
unsigned
long
int
>
,
std
::
vector
<
long
long
int
>
,
std
::
vector
<
long
int
>
,
std
::
vector
<
SIMDWrapper
::
scalar
::
float_v
>
,
LHCb
::
LinAlg
::
Vec
<
double
,
3
>
,
LHCb
::
LinAlg
::
Vec
<
double
,
4
>
,
LHCb
::
LinAlg
::
Vec
<
float
,
3
>
,
LHCb
::
LinAlg
::
Vec
<
float
,
4
>
,
LHCb
::
LinAlg
::
Vec
<
SIMDWrapper
::
scalar
::
float_v
,
3
>
,
LHCb
::
LinAlg
::
Vec
<
SIMDWrapper
::
scalar
::
float_v
,
4
>
,
LHCb
::
LinAlg
::
Vec3
<
double
>
,
LHCb
::
LinAlg
::
Vec3
<
float
>
,
LHCb
::
LinAlg
::
Vec3
<
SIMDWrapper
::
scalar
::
float_v
>
,
std
::
map
<
std
::
string
,
std
::
any
>>
();
// fill function to loop through supported types invoking function that calls fill function
...
...
@@ -239,4 +244,4 @@ namespace LHCb::FTuple {
if
(
f
==
map_valtype_callcolfun
.
end
()
)
{
return
StatusCode
{
EC
::
ErrorCode
::
TypeNotSupported
};
}
return
std
::
invoke
(
f
->
second
,
ntuple
,
colname
,
val
);
}
}
// namespace LHCb::FTuple
\ No newline at end of file
}
// namespace LHCb::FTuple
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment