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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computing
cbmroot
Commits
3289c59b
Commit
3289c59b
authored
1 year ago
by
Felix Weiglhofer
Committed by
Dominik Smith
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
UnpackTof: Make thread-safe.
parent
d9b8b7c4
No related branches found
No related tags found
1 merge request
!1219
algo: Unpack TOF and STS in parallel.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
algo/detectors/tof/UnpackTof.cxx
+10
-9
10 additions, 9 deletions
algo/detectors/tof/UnpackTof.cxx
algo/detectors/tof/UnpackTof.h
+11
-6
11 additions, 6 deletions
algo/detectors/tof/UnpackTof.h
with
21 additions
and
15 deletions
algo/detectors/tof/UnpackTof.cxx
+
10
−
9
View file @
3289c59b
...
...
@@ -18,15 +18,16 @@ namespace cbm::algo
// ---- Algorithm execution ---------------------------------------------
UnpackTof
::
resultType
UnpackTof
::
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
;
...
...
@@ -72,11 +73,11 @@ namespace cbm::algo
switch
(
message
[
messageNr
].
getMessageType
())
{
case
critof001
::
MSG_HIT
:
{
ProcessHitMessage
(
message
[
messageNr
],
result
.
first
,
result
.
second
);
ProcessHitMessage
(
message
[
messageNr
],
result
.
first
,
result
.
second
,
time
);
break
;
}
case
critof001
::
MSG_EPOCH
:
{
ProcessEpochMessage
(
message
[
messageNr
]);
ProcessEpochMessage
(
message
[
messageNr
]
,
time
);
break
;
}
case
critof001
::
MSG_SLOWC
:
{
...
...
@@ -101,7 +102,7 @@ namespace cbm::algo
// ----- Process hit message --------------------------------------------
inline
void
UnpackTof
::
ProcessHitMessage
(
const
critof001
::
Message
&
message
,
vector
<
CbmTofDigi
>&
digiVec
,
UnpackTofMonitorData
&
monitor
)
const
UnpackTofMonitorData
&
monitor
,
TimeSpec
&
time
)
const
{
// --- Check eLink and get parameters
const
uint32_t
elink
=
message
.
getGet4Idx
();
...
...
@@ -114,7 +115,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
...
...
@@ -124,14 +125,14 @@ namespace cbm::algo
// ----- Process an epoch message ---------------------------------------
inline
void
UnpackTof
::
ProcessEpochMessage
(
const
critof001
::
Message
&
message
)
inline
void
UnpackTof
::
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/tof/UnpackTof.h
+
11
−
6
View file @
3289c59b
...
...
@@ -19,6 +19,7 @@
#include
<vector>
#include
"CriGet4Mess001.h"
#include
"Prelude.h"
namespace
cbm
::
algo
{
...
...
@@ -96,13 +97,19 @@ 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
<
UnpackTofPar
>
params
)
{
fParams
=
*
(
std
::
move
(
params
));
}
private
:
// types
struct
TimeSpec
{
u64
currentTsTime
=
0
;
///< Unix time of timeslice in units of epoch length
u32
currentEpochInTs
=
0
;
///< Current epoch number relative to timeslice start epoch
};
private
:
// methods
/** @brief Process a hit message
** @param message SMX message (32-bit word)
...
...
@@ -110,16 +117,14 @@ namespace cbm::algo
** @param monitor Reference to monitor object
**/
void
ProcessHitMessage
(
const
critof001
::
Message
&
message
,
std
::
vector
<
CbmTofDigi
>&
digiVec
,
UnpackTofMonitorData
&
monitor
)
const
;
UnpackTofMonitorData
&
monitor
,
TimeSpec
&
time
)
const
;
/** @brief Process an epoch message
/** @brief Process an epoch message
** @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
UnpackTofPar
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