mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 17:18:00 +02:00
some changes in slsCalibration for moench
This commit is contained in:
@ -11,6 +11,7 @@ using namespace std;
|
||||
#define NC 400
|
||||
#define NR 400
|
||||
|
||||
#define XTALK
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
/**
|
||||
@ -20,6 +21,7 @@ int main(int argc, char *argv[]) {
|
||||
int nsubpix=10;
|
||||
int etabins=nsubpix*100;
|
||||
double etamin=-1, etamax=2;
|
||||
double eta3min=-2, eta3max=2;
|
||||
int quad;
|
||||
double sum, totquad;
|
||||
double sDum[2][2];
|
||||
@ -27,16 +29,29 @@ int main(int argc, char *argv[]) {
|
||||
double etax, etay;
|
||||
int runmin, runmax;
|
||||
single_photon_hit cl(3,3);
|
||||
|
||||
if (argc<5) {
|
||||
cout << "Wrong usage! Should be: "<< argv[0] << " infile " << " outfile runmin runmax" << endl;
|
||||
int iph=0;
|
||||
|
||||
if (argc<7) {
|
||||
cout << "Wrong usage! Should be: "<< argv[0] << " infile " << " outfile runmin runmax cmin cmax" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
etaInterpolationPosXY *interp=new etaInterpolationPosXY(NR, NC, nsubpix, etabins, etamin, etamax);
|
||||
eta2InterpolationPosXY *interp2=new eta2InterpolationPosXY(NR, NC, nsubpix, etabins, etamin, etamax);
|
||||
cout << "###########"<< endl;
|
||||
eta3InterpolationPosXY *interp3=new eta3InterpolationPosXY(NR, NC, nsubpix, etabins, eta3min, eta3max);
|
||||
// cout << eta3min << " " << eta3max << endl;
|
||||
runmin=atoi(argv[3]);
|
||||
runmax=atoi(argv[4]);
|
||||
double cmin=atof(argv[5]); //200
|
||||
double cmax=atof(argv[6]); //3000
|
||||
|
||||
#ifdef XTALK
|
||||
int old_val[3][3];
|
||||
int new_val[3][3];
|
||||
double xcorr=0.04;
|
||||
|
||||
// int ix=0;
|
||||
#endif
|
||||
|
||||
FILE *f;
|
||||
for (int i=runmin; i<runmax; i++) {
|
||||
@ -45,18 +60,55 @@ int main(int argc, char *argv[]) {
|
||||
if (f) {
|
||||
cout << "*" << endl;
|
||||
while (cl.read(f)) {
|
||||
interp->calcQuad(cl.get_cluster(), sum, totquad, sDum);
|
||||
if (sum>200 && sum<580 && cl.y<350)
|
||||
interp->addToFlatField(cl.get_cluster(),etax, etay);
|
||||
#ifdef XTALK
|
||||
if ((cl.x+1)%25!=0) {
|
||||
for (int ix=-1; ix<2; ix++) {
|
||||
for (int iy=-1; iy<2; iy++) {
|
||||
old_val[iy+1][ix+1]=cl.get_data(ix,iy);
|
||||
if (ix>=0) {
|
||||
new_val[iy+1][ix+1]=old_val[iy+1][ix+1]-old_val[iy+1][ix]*xcorr;
|
||||
cl.set_data(new_val[iy+1][ix+1],ix,iy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
quad=interp2->calcQuad(cl.get_cluster(), sum, totquad, sDum);
|
||||
|
||||
if (sum>cmin && totquad/sum>0.8 && totquad/sum<1.2 && totquad<cmax && quad<cmax) {
|
||||
/* Cross talk corrections !!! */
|
||||
// for (int ix=0; ix<2; ix++) {
|
||||
|
||||
|
||||
interp2->addToFlatField(cl.get_cluster(),etax, etay);
|
||||
// if (etax>0.49 && etax<0.51 && etay>0.49 && etay<0.51 ) {
|
||||
// cout << cl.y << " " << cl.x << " " << quad << " "<< totquad << " " <<sum << endl;
|
||||
|
||||
// }
|
||||
interp3->addToFlatField(cl.get_cluster(),etax, etay);
|
||||
iph++;
|
||||
if (iph%1000000==0) cout << iph << endl;
|
||||
if (iph%100000000==0) {
|
||||
sprintf(fname,"%s_eta2.tiff",argv[2]);
|
||||
interp2->writeFlatField(fname);
|
||||
sprintf(fname,"%s_eta3.tiff",argv[2]);
|
||||
interp3->writeFlatField(fname);
|
||||
}
|
||||
// if (iph>1E8) break;
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
fclose(f);
|
||||
interp->writeFlatField(argv[2]);
|
||||
|
||||
}
|
||||
else cout << "could not open file " << fname << endl;
|
||||
}
|
||||
|
||||
interp->writeFlatField(argv[2]);
|
||||
sprintf(fname,"%s_eta2.tiff",argv[2]);
|
||||
interp2->writeFlatField(fname);
|
||||
sprintf(fname,"%s_eta3.tiff",argv[2]);
|
||||
interp3->writeFlatField(fname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user