Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CTA-LAPP
PHOENIX_LIBS
PhoenixMath
Commits
ba0b0bd4
Commit
ba0b0bd4
authored
May 06, 2021
by
Pierre Aubert
Browse files
Add function to update a 1d histogram
parent
0b4a80e3
Pipeline
#118220
passed with stages
in 36 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
src/PHistogram/update_histogram.h
src/PHistogram/update_histogram.h
+31
-0
No files found.
src/PHistogram/update_histogram.h
View file @
ba0b0bd4
...
...
@@ -9,6 +9,37 @@
#include <iostream>
///Update the 1d histogram
/** @param[out] histValue : table of the histogram values
* @param xValue : value to be put in the histogram on x axis
* @param amplitude : aplitude to be added to the proper histogram bin, if (xValue, yValue) is in the histogram
* @param xMin : minimum value of x
* @param xRange : range of x
* @param nbX : number of value on x axis
*/
template
<
typename
T
>
void
update_histogram1dRange
(
T
*
histValue
,
T
xValue
,
T
amplitude
,
T
xMin
,
T
xRange
,
size_t
nbX
){
size_t
posX
(((
xValue
-
xMin
)
*
((
T
)
nbX
))
/
xRange
);
if
(
posX
>=
nbX
){
return
;
}
histValue
[
posX
]
+=
amplitude
;
}
///Update the 1d histogram
/** @param[out] histValue : table of the histogram values
* @param xValue : value to be put in the histogram on x axis
* @param amplitude : aplitude to be added to the proper histogram bin, if (xValue, yValue) is in the histogram
* @param xMin : minimum value of x
* @param xMax : maximum value of x
* @param nbX : number of value on x axis
*/
template
<
typename
T
>
void
update_histogram1d
(
T
*
histValue
,
T
xValue
,
T
amplitude
,
T
xMin
,
T
xMax
,
size_t
nbX
){
update_histogram1dRange
(
histValue
,
xValue
,
amplitude
,
xMin
,
xMax
-
xMin
,
nbX
);
}
///Update the 2d histogram
/** @param[out] histValue : table of the histogram values
* @param xValue : value to be put in the histogram on x axis
...
...
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