Implemenging common mode and ghost corrections for moench03 (and generalized)

This commit is contained in:
2019-08-13 16:06:32 +02:00
parent 31d2250cba
commit 846d270243
11 changed files with 437 additions and 86 deletions

View File

@ -1,43 +1,52 @@
#ifndef MOENCH03COMMONMODE_H
#define MOENCH03COMMONMODE_H
#include "commonModeSubtraction.h"
#include "commonModeSubtractionNew.h"
class moench03CommonMode : public commonModeSubtraction {
class commonModeSubtractionColumn: public commonModeSubtraction{
public:
commonModeSubtractionColumn(int nr=200) : commonModeSubtraction(800), rows(nr) {};
virtual int getROI(int ix, int iy){return ix+(iy/200)*400;};
virtual void addToCommonMode(double val, int ix=0, int iy=0) {
if (ix<rows || ix>399-rows) {
int iroi=getROI(ix,iy);
if (iroi>=0 && iroi<nROI) {
mean[iroi]+=val;
mean2[iroi]+=val*val;
nCm[iroi]++;
}
}
};
private:
int rows;
};
class commonModeSubtractionSuperColumn: public commonModeSubtraction{
public:
commonModeSubtractionSuperColumn() : commonModeSubtraction(32) {};
virtual int getROI(int ix, int iy){ return ix/25+(iy/200)*16;};
};
class commonModeSubtractionHalf: public commonModeSubtraction{
public:
commonModeSubtractionHalf() : commonModeSubtraction(2) {};
virtual int getROI(int ix, int iy){ (void) ix; return iy/200;};
};
class moench03CommonMode : public commonModeSubtractionColumn {
/** @short class to calculate the common mode noise for moench02 i.e. on 4 supercolumns separately */
public:
/** constructor - initalizes a commonModeSubtraction with 4 different regions of interest
\param nn number of samples for the moving average
*/
moench03CommonMode(int nn=1000) : commonModeSubtraction(nn,32){} ;
moench03CommonMode(int nr=20) : commonModeSubtractionColumn(nr){} ;
/** add value to common mode as a function of the pixel value, subdividing the region of interest in the 4 supercolumns of 40 columns each;
\param val value to add to the common mode
\param ix pixel coordinate in the x direction
\param iy pixel coordinate in the y direction
*/
virtual void addToCommonMode(double val, int ix=0, int iy=0) {
// (void) iy;
int isc=ix/25+(iy/200)*16;
if (isc>=0 && isc<nROI) {
cmPed[isc]+=val;
nCm[isc]++;
}
};
/**returns common mode value as a function of the pixel value, subdividing the region of interest in the 4 supercolumns of 40 columns each;
\param ix pixel coordinate in the x direction
\param iy pixel coordinate in the y direction
\returns common mode value
*/
virtual double getCommonMode(int ix=0, int iy=0) {
(void) iy;
int isc=ix/25+(iy/200)*16;
if (isc>=0 && isc<nROI) {
if (nCm[isc]>0) return cmPed[isc]/nCm[isc]-cmStat[isc].Mean();
}
return 0;
};
};