Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
2513f63b
Commit
2513f63b
authored
Oct 10, 2018
by
Purves, Murray
Browse files
Amending nrps() function to use stl library
parent
d27a1c68
Pipeline
#16221
passed with stages
in 8 minutes and 57 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixio/spectrum.cc
View file @
2513f63b
#include
<algorithm>
#include
<cmath>
#include
"radixio/spectrum.hh"
...
...
@@ -10,14 +11,12 @@ short Spectrum::nrps() const
// Used by PCF file to allocate space in binary file structure
// Go through each SpectrumData object and find the maximum number of channels
int
maxChannels
=
0
;
for
(
size_t
i
=
0
;
i
<
mSpectrumData
.
size
();
++
i
)
{
if
(
mSpectrumData
[
i
].
numberOfChannels
>
maxChannels
)
{
maxChannels
=
mSpectrumData
[
i
].
numberOfChannels
;
}
}
auto
comparator
=
[](
const
SpectrumData
&
a
,
const
SpectrumData
&
b
)
{
return
a
.
numberOfChannels
<
b
.
numberOfChannels
;
};
int
maxChannels
=
(
*
std
::
max_element
(
mSpectrumData
.
begin
(),
mSpectrumData
.
end
(),
comparator
))
.
numberOfChannels
;
short
nrps
=
short
(
std
::
ceil
((
float
(
maxChannels
)
/
64.
f
)
+
1.
f
));
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment