Commit 7dcb0d5f authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add udpate histogram

parent 4791f036
Pipeline #98257 passed with stages
in 1 minute and 20 seconds
...@@ -85,6 +85,7 @@ class PHistogram{ ...@@ -85,6 +85,7 @@ class PHistogram{
size_t p_overXMax; size_t p_overXMax;
}; };
#include "PHistogram_impl.h" #include "PHistogram_impl.h"
#endif #endif
......
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#ifndef __UPDATE_HISTOGRAM_H__
#define __UPDATE_HISTOGRAM_H__
#include <iostream>
///Update the 2d histogram
/** @param[out] histValue : table of the histogram values
* @param xValue : value to be put in the histogram on x axis
* @param yValue : value to be put in the histogram on y 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 yMin : minimum value of y
* @param yRange : range of y
* @param nbX : number of value on x axis
* @param nbY : number of value on y axis
*/
template<typename T>
void update_histogram2dRange(T* histValue, T xValue, T yValue, T amplitude, T xMin, T xRange, T yMin, T yRange, size_t nbX, size_t nbY){
size_t posX(((xValue - xMin)*((T)nbX))/xRange);
size_t posY(((yValue - yMin)*((T)nbY))/yRange);
if(posX >= nbX || posY >= nbY){
return;
}
histValue[posX*nbY + posY] += amplitude;
}
///Update the 2d histogram
/** @param[out] histValue : table of the histogram values
* @param xValue : value to be put in the histogram on x axis
* @param yValue : value to be put in the histogram on y 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 yMin : minimum value of y
* @param yMax : maximum value of y
* @param nbX : number of value on x axis
* @param nbY : number of value on y axis
*/
template<typename T>
void update_histogram2d(T* histValue, T xValue, T yValue, T amplitude, T xMin, T xMax, T yMin, T yMax, size_t nbX, size_t nbY){
update_histogram2dRange(histValue, xValue, yValue, amplitude, xMin, xMax - xMin, yMin, yMax - yMin, nbX, nbY);
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment