Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LHCb
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
LHCb
Commits
67ec637e
Commit
67ec637e
authored
3 years ago
by
Marco Clemencic
Browse files
Options
Downloads
Patches
Plain Diff
Pass version to ODIN::from_version as template argument
parent
fdcfee63
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!3702
merge counter decoder into Louis' original branch
,
!3088
New ODIN implementation
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Event/DAQEvent/include/Event/ODIN.h
+8
-2
8 additions, 2 deletions
Event/DAQEvent/include/Event/ODIN.h
Event/DAQEvent/src/ODIN.cpp
+32
-26
32 additions, 26 deletions
Event/DAQEvent/src/ODIN.cpp
Kernel/LHCbAlgs/src/ODINCodec.cpp
+1
-1
1 addition, 1 deletion
Kernel/LHCbAlgs/src/ODINCodec.cpp
with
41 additions
and
29 deletions
Event/DAQEvent/include/Event/ODIN.h
+
8
−
2
View file @
67ec637e
...
...
@@ -137,7 +137,10 @@ namespace LHCb {
CalibrationTrigger
=
7
};
std
::
array
<
std
::
uint32_t
,
10
>
data
{
0
};
static
constexpr
int
BANK_VERSION
=
7
;
static
constexpr
int
BANK_SIZE
=
40
;
std
::
array
<
std
::
uint32_t
,
BANK_SIZE
/
sizeof
(
std
::
uint32_t
)
>
data
{
0
};
ODIN
()
=
default
;
ODIN
(
gsl
::
span
<
const
std
::
uint32_t
>
buffer
)
{
...
...
@@ -145,11 +148,14 @@ namespace LHCb {
std
::
memcpy
(
&
data
.
front
(),
&
buffer
.
front
(),
sizeof
(
data
)
);
}
template
<
int
VERSION
=
BANK_VERSION
,
typename
=
std
::
enable_if_t
<
VERSION
==
BANK_VERSION
||
VERSION
==
6
>
>
static
ODIN
from_version
(
gsl
::
span
<
const
std
::
uint32_t
>
buffer
);
// Retrieve pointer to class definition structure
const
CLID
&
clID
()
const
override
{
return
this
->
classID
();
}
static
const
CLID
&
classID
()
{
return
CLID_ODIN
;
}
static
constexpr
int
version
()
{
return
7
;
}
static
constexpr
int
version
()
{
return
BANK_VERSION
;
}
enum
Fields
{
RunNumberSize
=
32
,
...
...
This diff is collapsed.
Click to expand it.
Event/DAQEvent/src/ODIN.cpp
+
32
−
26
View file @
67ec637e
...
...
@@ -11,36 +11,42 @@
#include
<Event/ODIN.h>
namespace
LHCb
::
ODINImplementation
::
v7
{
template
<
>
ODIN
ODIN
::
from_version
<
7
>
(
gsl
::
span
<
const
std
::
uint32_t
>
buffer
)
{
return
buffer
;
}
template
<
>
ODIN
ODIN
::
from_version
<
6
>
(
gsl
::
span
<
const
std
::
uint32_t
>
buffer
)
{
using
LHCb
::
ODINImplementation
::
details
::
get_bits
;
ODIN
ODIN
::
from_version
(
int
version
,
gsl
::
span
<
const
std
::
uint32_t
>
buffer
)
{
if
(
v
ersi
on
==
ODIN
::
version
(
)
)
{
// for the current v
ersi
on we just initialize from the buffer
return
buffer
;
}
else
if
(
version
==
6
)
{
using
LHCb
::
ODINImplementation
::
details
::
get_bits
;
// Check size of the input
buffer
if
(
UNLIKELY
(
buff
er
.
si
ze
()
!=
10
)
)
{
throw
GaudiException
(
"Invalid buff
er
si
ze for ODIN bank version 6: got "
+
std
::
to_string
(
buffer
.
size
()
)
+
", expected 10"
,
"LHCb::ODIN::from_version"
,
StatusCode
::
FAILURE
);
}
ODIN
odin
;
ODIN
odin
;
// Map ODIN banck v6 layout to v7
odin
.
data
[
0
]
=
buffer
[
0
];
// run number
odin
.
data
[
1
]
=
buffer
[
1
];
// event type + calibration step
odin
.
data
[
7
]
=
buffer
[
2
];
// orbit number
odin
.
data
[
9
]
=
buffer
[
3
];
// event number (hi)
odin
.
data
[
8
]
=
buffer
[
4
];
// event number (lo)
odin
.
data
[
3
]
=
buffer
[
5
];
// gps time (hi)
odin
.
data
[
2
]
=
buffer
[
6
];
// gps time (lo)
odin
.
data
[
4
]
=
buffer
[
9
];
// TCK
// error bits + detector status (dropped): buffer[7]
// misc fields (buffer[8], ignoring bits 15, 21, 24-31)
odin
.
setBunchId
(
get_bits
<
12
,
8
*
32
+
0
>
(
buffer
)
);
odin
.
setTimeAlignmentEventWindow
(
get_bits
<
3
,
8
*
32
+
12
>
(
buffer
)
);
odin
.
setTriggerType
(
get_bits
<
3
,
8
*
32
+
16
>
(
buffer
)
);
odin
.
setCalibrationType
(
get_bits
<
2
,
8
*
32
+
19
>
(
buffer
)
);
odin
.
setBunchCrossingType
(
static_cast
<
ODIN
::
BXTypes
>
(
get_bits
<
2
,
8
*
32
+
22
>
(
buffer
)
)
);
// Map ODIN banck v6 layout to v7
odin
.
data
[
0
]
=
buffer
[
0
];
// run number
odin
.
data
[
1
]
=
buffer
[
1
];
// event type + calibration step
odin
.
data
[
7
]
=
buffer
[
2
];
// orbit number
odin
.
data
[
9
]
=
buffer
[
3
];
// event number (hi)
odin
.
data
[
8
]
=
buffer
[
4
];
// event number (lo)
odin
.
data
[
3
]
=
buffer
[
5
];
// gps time (hi)
odin
.
data
[
2
]
=
buffer
[
6
];
// gps time (lo)
odin
.
data
[
4
]
=
buffer
[
9
];
// TCK
// error bits + detector status (dropped): buffer[7]
// misc fields (buffer[8], ignoring bits 15, 21, 24-31)
odin
.
setBunchId
(
get_bits
<
12
,
8
*
32
+
0
>
(
buffer
)
);
odin
.
setTimeAlignmentEventWindow
(
get_bits
<
3
,
8
*
32
+
12
>
(
buffer
)
);
odin
.
setTriggerType
(
get_bits
<
3
,
8
*
32
+
16
>
(
buffer
)
);
odin
.
setCalibrationType
(
get_bits
<
2
,
8
*
32
+
19
>
(
buffer
)
);
odin
.
setBunchCrossingType
(
static_cast
<
ODIN
::
BXTypes
>
(
get_bits
<
2
,
8
*
32
+
22
>
(
buffer
)
)
);
return
odin
;
}
throw
GaudiException
(
"unknown ODIN bank version "
+
std
::
to_string
(
version
),
"ODIN"
,
StatusCode
::
FAILURE
);
return
odin
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
s
,
ODIN
::
CalibrationTypes
e
)
{
...
...
This diff is collapsed.
Click to expand it.
Kernel/LHCbAlgs/src/ODINCodec.cpp
+
1
−
1
View file @
67ec637e
...
...
@@ -50,7 +50,7 @@ ODIN LHCb::ODINCodec::decode( const RawBank& bank, const bool ignoreBankVersion
DecoderAssert
(
bank
.
size
()
==
expected_size
,
"Wrong ODIN bank size "
+
std
::
to_string
(
bank
.
size
()
)
+
", expected "
+
std
::
to_string
(
expected_size
)
);
return
ODIN
::
from_version
(
version
,
bank
.
range
<
const
unsigned
int
>
()
);
return
ODIN
::
from_version
<
6
>
(
bank
.
range
<
const
unsigned
int
>
()
);
}
else
{
DecoderAssert
(
false
,
"Unknown ODIN bank version "
+
std
::
to_string
(
version
)
+
", supported ones are: "
+
std
::
to_string
(
Bank
::
VERSION
)
);
...
...
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