Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computing
cbmroot
Commits
b4ed6340
Commit
b4ed6340
authored
2 years ago
by
Felix Weiglhofer
Browse files
Options
Downloads
Patches
Plain Diff
Unpack: Make BMON Unpacker thread-safe.
parent
6579588d
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1242
algo::Unpack: Unpack BMON and MUCH in parallel.
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
algo/detectors/bmon/UnpackBmon.cxx
+11
-10
11 additions, 10 deletions
algo/detectors/bmon/UnpackBmon.cxx
algo/detectors/bmon/UnpackBmon.h
+8
-5
8 additions, 5 deletions
algo/detectors/bmon/UnpackBmon.h
with
19 additions
and
15 deletions
algo/detectors/bmon/UnpackBmon.cxx
+
11
−
10
View file @
b4ed6340
...
...
@@ -19,15 +19,16 @@ namespace cbm::algo
// ---- Algorithm execution ---------------------------------------------
UnpackBmon
::
resultType
UnpackBmon
::
operator
()(
const
uint8_t
*
msContent
,
const
fles
::
MicrosliceDescriptor
&
msDescr
,
const
uint64_t
tTimeslice
)
const
uint64_t
tTimeslice
)
const
{
// --- Output data
resultType
result
=
{};
TimeSpec
time
;
// --- Current Timeslice start time in epoch units. Note that it is always a multiple of epochs
// --- and the epoch is a multiple of ns.
fC
urrentTsTime
=
static_cast
<
uint64_t
>
(
tTimeslice
/
critof001
::
kuEpochInNs
)
%
critof001
::
kulEpochCycleEp
;
time
.
c
urrentTsTime
=
static_cast
<
uint64_t
>
(
tTimeslice
/
critof001
::
kuEpochInNs
)
%
critof001
::
kulEpochCycleEp
;
// --- Number of messages in microslice
auto
msSize
=
msDescr
.
size
;
...
...
@@ -76,11 +77,11 @@ namespace cbm::algo
switch
(
message
[
messageNr
].
getMessageType
())
{
case
critof001
::
MSG_HIT
:
{
ProcessHitMessage
(
message
[
messageNr
],
result
.
first
,
result
.
second
);
ProcessHitMessage
(
message
[
messageNr
],
time
,
result
.
first
,
result
.
second
);
break
;
}
case
critof001
::
MSG_EPOCH
:
{
ProcessEpochMessage
(
message
[
messageNr
]);
ProcessEpochMessage
(
message
[
messageNr
]
,
time
);
break
;
}
case
critof001
::
MSG_SLOWC
:
{
...
...
@@ -104,8 +105,8 @@ namespace cbm::algo
// ----- Process hit message --------------------------------------------
inline
void
UnpackBmon
::
ProcessHitMessage
(
const
critof001
::
Message
&
message
,
vector
<
CbmBmonDigi
>&
digiVec
,
UnpackBmonMonitorData
&
monitor
)
const
inline
void
UnpackBmon
::
ProcessHitMessage
(
const
critof001
::
Message
&
message
,
const
TimeSpec
&
time
,
vector
<
CbmBmonDigi
>&
digiVec
,
UnpackBmonMonitorData
&
monitor
)
const
{
// IGNORES:
// - Duplicate messages
...
...
@@ -126,7 +127,7 @@ namespace cbm::algo
const
uint32_t
channel
=
message
.
getGdpbHitChanId
();
const
uint32_t
channelUId
=
(
elinkPar
.
fChannelUId
)[
channel
];
double
messageTime
=
message
.
getMsgFullTimeD
(
fC
urrentEpochInTs
)
-
elinkPar
.
fTimeOffset
;
double
messageTime
=
message
.
getMsgFullTimeD
(
time
.
c
urrentEpochInTs
)
-
elinkPar
.
fTimeOffset
;
const
double
charge
=
(
double
)
message
.
getGdpbHit32Tot
();
//cast from uint32_t
// --- Create output digi
...
...
@@ -136,14 +137,14 @@ namespace cbm::algo
// ----- Process an epoch message ---------------------------------------
inline
void
UnpackBmon
::
ProcessEpochMessage
(
const
critof001
::
Message
&
message
)
inline
void
UnpackBmon
::
ProcessEpochMessage
(
const
critof001
::
Message
&
message
,
TimeSpec
&
time
)
const
{
const
uint64_t
epoch
=
message
.
getGdpbEpEpochNb
();
// --- Calculate epoch relative to timeslice start time; correct for epoch cycles
if
(
fC
urrentTsTime
<=
epoch
)
{
fC
urrentEpochInTs
=
epoch
-
fC
urrentTsTime
;
}
if
(
time
.
c
urrentTsTime
<=
epoch
)
{
time
.
c
urrentEpochInTs
=
epoch
-
time
.
c
urrentTsTime
;
}
else
{
fC
urrentEpochInTs
=
epoch
+
critof001
::
kulEpochCycleEp
-
fC
urrentTsTime
;
time
.
c
urrentEpochInTs
=
epoch
+
critof001
::
kulEpochCycleEp
-
time
.
c
urrentTsTime
;
}
//Problem if MS spans multiple epoch cycles?
}
...
...
This diff is collapsed.
Click to expand it.
algo/detectors/bmon/UnpackBmon.h
+
8
−
5
View file @
b4ed6340
...
...
@@ -104,13 +104,18 @@ namespace cbm::algo
** @return STS digi data
**/
resultType
operator
()(
const
uint8_t
*
msContent
,
const
fles
::
MicrosliceDescriptor
&
msDescr
,
const
uint64_t
tTimeslice
);
const
uint64_t
tTimeslice
)
const
;
/** @brief Set the parameter container
** @param params Pointer to parameter container
**/
void
SetParams
(
std
::
unique_ptr
<
UnpackBmonPar
>
params
)
{
fParams
=
*
(
std
::
move
(
params
));
}
private
:
// datatypes
struct
TimeSpec
{
uint64_t
currentTsTime
;
///< Unix time of timeslice in units of epoch length
uint32_t
currentEpochInTs
;
///< Current epoch number relative to timeslice start epoch
};
private
:
// methods
/** @brief Process a hit message
...
...
@@ -118,18 +123,16 @@ namespace cbm::algo
** @param digiVec Vector to append the created digi to
** @param monitor Reference to monitor object
**/
void
ProcessHitMessage
(
const
critof001
::
Message
&
message
,
std
::
vector
<
CbmBmonDigi
>&
digiVec
,
void
ProcessHitMessage
(
const
critof001
::
Message
&
message
,
const
TimeSpec
&
time
,
std
::
vector
<
CbmBmonDigi
>&
digiVec
,
UnpackBmonMonitorData
&
monitor
)
const
;
/** @brief Process an epoch message (TS_MSB)
** @param message SMX message (32-bit word)
**/
void
ProcessEpochMessage
(
const
critof001
::
Message
&
message
)
;
void
ProcessEpochMessage
(
const
critof001
::
Message
&
message
,
TimeSpec
&
time
)
const
;
private
:
// members
uint64_t
fCurrentTsTime
=
0
;
///< Unix time of timeslice in units of epoch length
uint32_t
fCurrentEpochInTs
=
0
;
///< Current epoch number relative to timeslice start epoch
UnpackBmonPar
fParams
=
{};
///< Parameter container
};
...
...
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