receiver complete change

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@688 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-11-14 12:34:47 +00:00
parent cd88aff756
commit 3ce5db8f1d

View File

@ -5,7 +5,7 @@
#ifndef MOVINGSTAT_H
#define MOVINGSTAT_H
#include "sls_detector_defs.h"
//#include "sls_detector_defs.h"
#include <iostream>
#include <fstream>
@ -17,6 +17,13 @@
#include <math.h>
using namespace std;
typedef double double32_t;
typedef float float32_t;
typedef int int32_t;
/**
@short class handling pedestal data and moves according to data
*/
@ -32,24 +39,24 @@ public:
/**
* Clear number of data values
*/
void Clear(){
inline void Clear(){
m_n = 0;
}
/**
* Set Pedestal
*/
void SetN(int i) {n=i;};
inline void SetN(int i) {n=i;};
/**
* Get Pedestal
*/
int GetN() {return n;};
inline int GetN() {return n;};
/**
* Calculate Pedestal
*/
void Calc(double x) {
inline void Calc(double x) {
if (m_n<n) Add(x);
else Push(x);
}
@ -57,7 +64,7 @@ public:
/**
* Adding Pedestal
*/
void Add(double x){
inline void Add(double x){
m_n++;
// See Knuth TAOCP vol 2, 3rd edition, page 232
@ -77,7 +84,7 @@ public:
/**
* Push Pedestal
*/
void Push(double x){
inline void Push(double x){
if (m_n == 1){
m_oldM = m_newM = x;
m_oldM2 = x*x;
@ -94,35 +101,35 @@ public:
/**
* Get number of data values
*/
int NumDataValues() const{
inline int NumDataValues() const{
return m_n;
}
/**
* Get mean
*/
double Mean() const{
inline double Mean() const{
return (m_n > 0) ? m_newM/m_n : 0.0;
}
/**
* Get mean 2
*/
double M2() const{
inline double M2() const{
return ( (m_n > 1) ? m_newM2/m_n : 0.0 );
}
/**
* Get variance
*/
double Variance() const{
inline double Variance() const{
return ( (m_n > 1) ? (M2()-Mean()*Mean()) : 0.0 );
}
/**
* Get standard deviation
*/
double StandardDeviation() const{
inline double StandardDeviation() const{
return ( (Variance() > 0) ? sqrt( Variance() ) : -1 );
}