mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
slsDetectorCalibration updated to latest version
This commit is contained in:
@ -14,7 +14,7 @@ class commonModeSubtraction {
|
||||
\param iroi number of regions on which one can calculate the common mode separately. Defaults to 1 i.e. whole detector
|
||||
|
||||
*/
|
||||
commonModeSubtraction(int iroi=1, int ns=3) : nROI(iroi), nsigma(ns) {
|
||||
commonModeSubtraction(int iroi=1, int ns=3) : nsigma(ns), nROI(iroi) {
|
||||
mean=new double[nROI];
|
||||
mean2=new double[nROI];
|
||||
nCm=new double[nROI];
|
||||
@ -23,6 +23,13 @@ class commonModeSubtraction {
|
||||
/** destructor - deletes the moving average(s) and the sum of pedestals calculator(s) */
|
||||
virtual ~commonModeSubtraction() {delete [] mean; delete [] mean2; delete [] nCm;};
|
||||
|
||||
/* commonModeSubtraction(commonModeSubtraction *cs) { */
|
||||
/* if (cs) new commonModeSubtraction(cs->getNRoi(), cs->nsigma); */
|
||||
/* } */
|
||||
|
||||
virtual commonModeSubtraction *Clone() {
|
||||
return new commonModeSubtraction(this->nROI, this->nsigma);
|
||||
}
|
||||
|
||||
/** clears the moving average and the sum of pedestals calculation - virtual func*/
|
||||
virtual void Clear(){
|
||||
@ -34,6 +41,7 @@ class commonModeSubtraction {
|
||||
|
||||
/** adds the average of pedestals to the moving average and reinitializes the calculation of the sum of pedestals for all ROIs. - virtual func*/
|
||||
virtual void newFrame(){
|
||||
//cout << "Reset CM" << endl;
|
||||
for (int i=0; i<nROI; i++) {
|
||||
// if (nCm[i]>0) cmStat[i].Calc(cmPed[i]/nCm[i]);
|
||||
nCm[i]=0;
|
||||
@ -52,7 +60,10 @@ class commonModeSubtraction {
|
||||
// if (iroi==0) val=100;
|
||||
// else val=-100;
|
||||
// if (isc>=0 && isc<nROI) {
|
||||
// cout << ix << " " << iy << " " << iroi << endl;
|
||||
//if (ix==15 && iy==15) cout << "=" << val << endl;
|
||||
if (iroi>=0 && iroi<nROI) {
|
||||
// cout << ix << " " << iy << " " << iroi << endl;
|
||||
mean[iroi]+=val;
|
||||
mean2[iroi]+=val*val;
|
||||
nCm[iroi]++;
|
||||
@ -70,9 +81,10 @@ class commonModeSubtraction {
|
||||
/* return 100; */
|
||||
/* else */
|
||||
/* return -100; */
|
||||
|
||||
// cout << "*" << ix << " " << iy << " " << iroi << " " << mean[iroi] << " " << nCm[iroi]<< endl;
|
||||
// if (ix==15 && iy==15) cout << "-" << mean[iroi]/nCm[iroi] << endl;
|
||||
if (iroi>=0 && iroi<nROI) {
|
||||
if (nCm[iroi]>0)
|
||||
if (nCm[iroi]>0)
|
||||
return mean[iroi]/nCm[iroi];
|
||||
}
|
||||
return 0;
|
||||
@ -96,8 +108,7 @@ class commonModeSubtraction {
|
||||
gets the common mode ROI for pixel ix, iy -should be overloaded!
|
||||
*/
|
||||
virtual int getROI(int ix, int iy){ (void) ix; (void) iy; return 0;};
|
||||
|
||||
|
||||
int getNRoi(){return nROI;};
|
||||
|
||||
protected:
|
||||
double *mean; /**<array of moving average of the pedestal average per region of interest */
|
||||
|
Reference in New Issue
Block a user