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
2e14e7df
Commit
2e14e7df
authored
1 year ago
by
Felix Weiglhofer
Committed by
Volker Friese
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
StsDigi: Clamp out-of-range timestamp.
parent
4bcb31df
No related branches found
No related tags found
1 merge request
!1227
CbmStsDigi: Remove assert from constructor.
Pipeline
#23073
passed
1 year ago
Stage: build
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/data/sts/CbmStsDigi.h
+14
-6
14 additions, 6 deletions
core/data/sts/CbmStsDigi.h
with
14 additions
and
6 deletions
core/data/sts/CbmStsDigi.h
+
14
−
6
View file @
2e14e7df
...
@@ -60,6 +60,7 @@ public:
...
@@ -60,6 +60,7 @@ public:
**/
**/
XPU_D
CbmStsDigi
(
int32_t
address
,
int32_t
channel
,
uint32_t
time
,
uint16_t
charge
)
XPU_D
CbmStsDigi
(
int32_t
address
,
int32_t
channel
,
uint32_t
time
,
uint16_t
charge
)
{
{
time
=
ClampTime
(
time
);
PackAddressAndTime
(
address
,
time
);
PackAddressAndTime
(
address
,
time
);
PackChannelAndCharge
(
channel
,
charge
);
PackChannelAndCharge
(
channel
,
charge
);
}
}
...
@@ -127,12 +128,9 @@ public:
...
@@ -127,12 +128,9 @@ public:
/** Update Time of measurement
/** Update Time of measurement
** @param New Time [ns]
** @param New Time [ns]
**/
**/
XPU_D
void
SetTime
(
double
dNewTime
)
XPU_D
void
SetTime
(
uint32_t
dNewTime
)
{
{
// StsDigi is not able to store negative timestamps.
dNewTime
=
ClampTime
(
dNewTime
);
assert
(
dNewTime
>=
0
);
// StsDigi has a maximal time range of ~2.1s (2 147 483 647 ns).
assert
(
dNewTime
<=
kMaxTimestamp
);
PackTime
(
dNewTime
);
PackTime
(
dNewTime
);
}
}
...
@@ -153,7 +151,11 @@ public:
...
@@ -153,7 +151,11 @@ public:
**
**
** Slightly more efficient than calling both individual setters.
** Slightly more efficient than calling both individual setters.
**/
**/
XPU_D
void
SetAddressAndTime
(
int32_t
address
,
uint32_t
time
)
{
PackAddressAndTime
(
address
,
time
);
}
XPU_D
void
SetAddressAndTime
(
int32_t
address
,
uint32_t
time
)
{
time
=
ClampTime
(
time
);
PackAddressAndTime
(
address
,
time
);
}
/** String output **/
/** String output **/
...
@@ -206,6 +208,12 @@ private:
...
@@ -206,6 +208,12 @@ private:
return
CbmStsAddress
::
UnpackDigiAddress
(
packedAddress
);
return
CbmStsAddress
::
UnpackDigiAddress
(
packedAddress
);
}
}
XPU_D
uint32_t
ClampTime
(
uint32_t
time
)
const
{
if
(
time
>
kMaxTimestamp
)
time
=
kMaxTimestamp
;
return
time
;
}
#if !defined(NO_ROOT) && !XPU_IS_HIP_CUDA
#if !defined(NO_ROOT) && !XPU_IS_HIP_CUDA
ClassDefNV
(
CbmStsDigi
,
8
);
ClassDefNV
(
CbmStsDigi
,
8
);
#endif
#endif
...
...
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