mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 23:37:14 +02:00
function to write pedestal rms and some fixes
This commit is contained in:
@ -8,7 +8,7 @@ LDFLAG= ../tiffIO.cpp -L/usr/lib64/ -lpthread -lm -lstdc++ -pthread -lrt -
|
||||
MAIN=moench03ClusterFinder.cpp
|
||||
|
||||
|
||||
all: moenchClusterFinder moenchMakeEta moenchInterpolation moenchNoInterpolation moenchPhotonCounter moenchAnalog
|
||||
all: moenchClusterFinder moenchMakeEta moenchMakeEta3 moenchInterpolation moenchInterpolation3 moenchNoInterpolation moenchPhotonCounter moenchAnalog
|
||||
|
||||
|
||||
|
||||
@ -25,9 +25,15 @@ moenchClusterFinderHighZ: moench03ClusterFinder.cpp $(INCS) clean
|
||||
moenchMakeEta: moench03Interpolation.cpp $(INCS) clean
|
||||
g++ -o moenchMakeEta moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DFF
|
||||
|
||||
moenchMakeEta3: moench03Interpolation.cpp $(INCS) clean
|
||||
g++ -o moenchMakeEta3 moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DFF -DETA3
|
||||
|
||||
moenchInterpolation: moench03Interpolation.cpp $(INCS) clean
|
||||
g++ -o moenchInterpolation moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
|
||||
|
||||
moenchInterpolation3: moench03Interpolation.cpp $(INCS) clean
|
||||
g++ -o moenchInterpolation3 moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DETA3
|
||||
|
||||
moenchNoInterpolation: moench03NoInterpolation.cpp $(INCS) clean
|
||||
g++ -o moenchNoInterpolation moench03NoInterpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
|
||||
|
||||
|
@ -77,28 +77,24 @@ int main(int argc, char *argv[]) {
|
||||
#ifndef NOINTERPOLATION
|
||||
int etabins=1000;//nsubpix*2*100;
|
||||
int etabinsY=etabins;//nsubpix*2*100;
|
||||
#ifndef ETA3
|
||||
|
||||
double etamin=-1, etamax=2;
|
||||
//double etamin=-0.1, etamax=1.1;
|
||||
|
||||
double etax=0, etay=0;
|
||||
#ifndef FF
|
||||
double int_x, int_y;
|
||||
// double d_x, d_y, res=5, xx, yy;
|
||||
int ok;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ETA3
|
||||
double eta3min=-2, eta3max=2;
|
||||
double eta3x, eta3y;
|
||||
|
||||
#ifndef FF
|
||||
double int3_x, int3_y;
|
||||
etamin=-2;
|
||||
etamax=2;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifndef FF
|
||||
//#ifndef FF
|
||||
int quad;
|
||||
#endif
|
||||
//#endif
|
||||
double sum, totquad;
|
||||
double sDum[2][2];
|
||||
|
||||
@ -133,7 +129,13 @@ int main(int argc, char *argv[]) {
|
||||
#endif
|
||||
// #endif
|
||||
#ifndef NOINTERPOLATION
|
||||
#ifndef ETA3
|
||||
eta2InterpolationPosXY *interp=new eta2InterpolationPosXY(NC, NR, nSubPixels, nSubPixelsY, etabins, etabinsY, etamin, etamax);
|
||||
#endif
|
||||
#ifdef ETA3
|
||||
eta3InterpolationPosXY *interp=new eta3InterpolationPosXY(NC, NR, nSubPixels, nSubPixelsY, etabins, etabinsY, etamin, etamax);
|
||||
#endif
|
||||
|
||||
//eta2InterpolationCleverAdaptiveBins *interp=new eta2InterpolationCleverAdaptiveBins(NC, NR, nsubpix, etabins, etamin, etamax);
|
||||
#endif
|
||||
#ifdef NOINTERPOLATION
|
||||
@ -191,12 +193,20 @@ int main(int argc, char *argv[]) {
|
||||
if (nframes==0) f0=lastframe;
|
||||
nframes++;
|
||||
}
|
||||
#ifndef FF
|
||||
//#ifndef FF
|
||||
#ifndef ETA3
|
||||
quad=interp->calcEta(cl.get_cluster(), etax, etay, sum, totquad, sDum);
|
||||
#endif
|
||||
#ifdef FF
|
||||
interp->calcEta(cl.get_cluster(), etax, etay, sum, totquad, sDum);
|
||||
#ifdef ETA3
|
||||
quad=interp->calcEta3(cl.get_cluster(), etax, etay, sum);
|
||||
totquad=sum;
|
||||
#endif
|
||||
//#endif
|
||||
// #ifdef FF
|
||||
// #ifndef ETA3
|
||||
// interp->calcEta(cl.get_cluster(), etax, etay, sum, totquad, sDum);
|
||||
// #endif
|
||||
// #endif
|
||||
|
||||
if (sum>cmin && totquad/sum>0.8 && totquad/sum<1.2 && sum<cmax ) {
|
||||
nph++;
|
||||
|
@ -487,6 +487,12 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
|
||||
sprintf(imgfname,"%s/%s_ped.tiff",outdir,fformat);
|
||||
mt->writePedestal(imgfname);
|
||||
sprintf(imgfname,"%s/%s_noise.tiff",outdir,fformat);
|
||||
mt->writePedestalRMS(imgfname);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -479,6 +479,37 @@ public:
|
||||
return ped;
|
||||
};
|
||||
|
||||
virtual double *getPedestalRMS(){
|
||||
int nx, ny;
|
||||
dets[0]->getDetectorSize(nx,ny);
|
||||
double *rms=new double[nx*ny];
|
||||
double *p0=new double[nx*ny];
|
||||
|
||||
for (int i=0; i<nThreads; i++) {
|
||||
//inte=(slsInterpolation*)dets[i]->getInterpolation(nb,emi,ema);
|
||||
// cout << i << endl;
|
||||
p0=dets[i]->getPedestalRMS(p0);
|
||||
if (p0) {
|
||||
if (i==0) {
|
||||
|
||||
for (int ib=0; ib<nx*ny; ib++) {
|
||||
rms[ib]=p0[ib]/((double)nThreads);
|
||||
// cout << p0[ib] << " ";
|
||||
}
|
||||
} else {
|
||||
for (int ib=0; ib<nx*ny; ib++) {
|
||||
rms[ib]+=p0[ib]/((double)nThreads);
|
||||
// cout << p0[ib] << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
delete [] p0;
|
||||
return rms;
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtual double *setPedestal(double *h=NULL){
|
||||
//int nb=0;
|
||||
@ -515,6 +546,26 @@ public:
|
||||
|
||||
};
|
||||
|
||||
virtual void *writePedestalRMS(const char * imgname){
|
||||
|
||||
int nx, ny;
|
||||
dets[0]->getDetectorSize(nx,ny);
|
||||
|
||||
double *rms=getPedestalRMS();
|
||||
float *gm=new float[nx*ny];
|
||||
if (gm) {
|
||||
for (int ix=0; ix<nx*ny; ix++) {
|
||||
gm[ix]=rms[ix];
|
||||
}
|
||||
WriteToTiff(gm,imgname ,nx, ny);
|
||||
delete [] gm;
|
||||
delete [] rms;
|
||||
} else cout << "Could not allocate float image " << endl;
|
||||
|
||||
return NULL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
virtual void *readPedestal(const char * imgname, int nb=-1, double emin=1, double emax=0){
|
||||
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
// int nnx, nny, ns;
|
||||
int nn=dets[0]->getImageSize(nnx, nny,nsx, nsy);
|
||||
if (image) {
|
||||
delete image;
|
||||
delete [] image;
|
||||
image=NULL;
|
||||
}
|
||||
image=new int[nn];
|
||||
|
Reference in New Issue
Block a user