Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pierre-Alain Loizeau
cbmroot
Commits
48f13821
Commit
48f13821
authored
Oct 25, 2021
by
Felix Weiglhofer
Browse files
StsDigi: Add more error handling against timestamp overflows.
parent
cb194272
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
core/data/sts/CbmStsAddress.cxx
core/data/sts/CbmStsAddress.cxx
+4
-0
core/data/sts/CbmStsDigi.cxx
core/data/sts/CbmStsDigi.cxx
+1
-1
core/data/sts/CbmStsDigi.h
core/data/sts/CbmStsDigi.h
+2
-1
No files found.
core/data/sts/CbmStsAddress.cxx
View file @
48f13821
...
...
@@ -203,6 +203,10 @@ int32_t CbmStsAddress::PackDigiAddress(int32_t address)
|
kMask
[
1
][
kStsModule
]
<<
kShift
[
1
][
kStsModule
];
int32_t
ret
=
(
address
&
kDMask
)
>>
kShift
[
1
][
kStsUnit
];
// Check that no bits were set, that are stripped by this function.
assert
(
address
==
UnpackDigiAddress
(
ret
));
return
ret
;
}
// -------------------------------------------------------------------------
...
...
core/data/sts/CbmStsDigi.cxx
View file @
48f13821
...
...
@@ -37,7 +37,7 @@ void CbmStsDigi::PackAddressAndTime(int32_t newAddress, uint32_t newTime)
uint32_t
lowerAddr
=
packedAddr
&
((
1
<<
kNumLowerAddrBits
)
-
1
);
fAddress
=
lowerAddr
;
fTime
=
(
highestBitAddr
<<
kNumTimestampBits
)
|
newTime
;
fTime
=
(
highestBitAddr
<<
kNumTimestampBits
)
|
(
kTimestampMask
&
newTime
)
;
}
int32_t
CbmStsDigi
::
UnpackAddress
()
const
...
...
core/data/sts/CbmStsDigi.h
View file @
48f13821
...
...
@@ -47,8 +47,9 @@ public:
** @param time Measurement time [ns]
** @param charge Charge [ADC units]
**/
CbmStsDigi
(
int32_t
address
,
int32_t
channel
,
uint32_t
time
,
uint16_t
charge
)
CbmStsDigi
(
int32_t
address
,
int32_t
channel
,
double
time
,
uint16_t
charge
)
{
assert
(
time
>=
0
&&
time
<=
kMaxTimestamp
);
PackAddressAndTime
(
address
,
time
);
PackChannelAndCharge
(
channel
,
charge
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment