minor fixes (#708)

This commit is contained in:
Erik Fröjdh 2023-03-31 11:56:09 +02:00 committed by GitHub
parent 3b8c612103
commit 37e7471dc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 40 deletions

View File

@ -298,8 +298,8 @@ template <class dataType> class analogDetector {
if (gmap) if (gmap)
delete[] gmap; delete[] gmap;
gmap = new double[nnx * nny]; gmap = new double[nnx * nny];
for (iy = 0; iy < nny; ++iy) { for (iy = 0; iy < static_cast<int>(nny); ++iy) {
for (ix = 0; ix < nnx; ++ix) { for (ix = 0; ix < static_cast<int>(nnx); ++ix) {
gmap[iy * nnx + ix] = gm[iy * nnx + ix]; gmap[iy * nnx + ix] = gm[iy * nnx + ix];
// cout << gmap[iy*nnx+ix] << " " ; // cout << gmap[iy*nnx+ix] << " " ;
} }

View File

@ -54,28 +54,28 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
#endif #endif
#endif #endif
cout << "off is " << off << endl; cout << "off is " << off << endl;
if (off>0) if (off>0)
cout << "M04 RAW DATA NEW " << endl; cout << "M04 RAW DATA NEW " << endl;
else else
cout << "M04 ZMQ DATA NEW " << endl; cout << "M04 ZMQ DATA NEW " << endl;
int adc_nr[32] = {9, 8, 11, 10, 13, 12, 15, 14, 1, 0, 3, int adc_nr[32] = {9, 8, 11, 10, 13, 12, 15, 14, 1, 0, 3,
2, 5, 4, 7, 6, 23, 22, 21, 20, 19, 18, 2, 5, 4, 7, 6, 23, 22, 21, 20, 19, 18,
17, 16, 31, 30, 29, 28, 27, 26, 25, 24}; 17, 16, 31, 30, 29, 28, 27, 26, 25, 24};
int row, col; int row, col;
// int isample; // int isample;
int iadc; int iadc;
// int ix, iy; // int ix, iy;
// int npackets=40; // int npackets=40;
int i; int i;
// int adc4(0); // int adc4(0);
for (int is = 0; is < aSamples; is++) { for (int is = 0; is < aSamples; is++) {

View File

@ -198,19 +198,18 @@ template <typename dataType> slsDetectorData<dataType>::~slsDetectorData() {
template <typename dataType> template <typename dataType>
void slsDetectorData<dataType>::setDataMap(int **dMap) { void slsDetectorData<dataType>::setDataMap(int **dMap) {
int ip = 0; // int ip = 0;
int ix, iy;
if (dMap == NULL) { if (dMap == NULL) {
for (iy = 0; iy < ny; iy++) { for (int iy = 0; iy < ny; iy++) {
for (ix = 0; ix < nx; ix++) { for (int ix = 0; ix < nx; ix++) {
dataMap[iy][ix] = (iy * nx + ix) * sizeof(dataType); dataMap[iy][ix] = (iy * nx + ix) * sizeof(dataType);
} }
} }
} else { } else {
// cout << "set dmap "<< dataMap << " " << dMap << endl; // cout << "set dmap "<< dataMap << " " << dMap << endl;
for (iy = 0; iy < ny; iy++) { for (int iy = 0; iy < ny; iy++) {
// cout << iy << endl; // cout << iy << endl;
for (ix = 0; ix < nx; ix++) { for (int ix = 0; ix < nx; ix++) {
dataMap[iy][ix] = dMap[iy][ix]; dataMap[iy][ix] = dMap[iy][ix];
// cout << ix << " " << iy << endl; // cout << ix << " " << iy << endl;
/*ip=dataMap[ix][iy]/sizeof(dataType); /*ip=dataMap[ix][iy]/sizeof(dataType);
@ -220,8 +219,8 @@ void slsDetectorData<dataType>::setDataMap(int **dMap) {
} }
} }
/* //commented this part because it causes out-of-bound issues if nx or ny are larger than dataMap bounds (single-chip readout of strixel with groups of different pitches) VH 2023-02-24 /* //commented this part because it causes out-of-bound issues if nx or ny are larger than dataMap bounds (single-chip readout of strixel with groups of different pitches) VH 2023-02-24
for (iy = 0; iy < ny; iy++) { for (int iy = 0; iy < ny; iy++) {
for (ix = 0; ix < nx; ix++) { for (int ix = 0; ix < nx; ix++) {
ip = dataMap[iy][ix] / sizeof(dataType); ip = dataMap[iy][ix] / sizeof(dataType);
xmap[ip] = ix; xmap[ip] = ix;
ymap[ip] = iy; ymap[ip] = iy;
@ -293,7 +292,6 @@ template <typename dataType>
dataType **slsDetectorData<dataType>::getData(char *ptr, int dsize) { dataType **slsDetectorData<dataType>::getData(char *ptr, int dsize) {
int el = dsize / sizeof(dataType); int el = dsize / sizeof(dataType);
// dataType **data; // dataType **data;
int ix, iy;
// data=new dataType*[ny]; // data=new dataType*[ny];
// for(int i = 0; i < ny; i++) { // for(int i = 0; i < ny; i++) {
// data[i]=new dataType[nx]; // data[i]=new dataType[nx];
@ -303,6 +301,7 @@ dataType **slsDetectorData<dataType>::getData(char *ptr, int dsize) {
dsize = dataSize; dsize = dataSize;
for (int ip = 0; ip < (el); ip++) { for (int ip = 0; ip < (el); ip++) {
int ix, iy;
getPixel(ip, ix, iy); getPixel(ip, ix, iy);
if (ix >= 0 && ix < nx && iy >= 0 && iy < ny) { if (ix >= 0 && ix < nx && iy >= 0 && iy < ny) {
// data[iy][ix]=getChannel(ptr,ix,iy); // data[iy][ix]=getChannel(ptr,ix,iy);

View File

@ -30,13 +30,14 @@ int main(int argc, char *argv[]) {
int runmax = atoi(argv[5]); int runmax = atoi(argv[5]);
int nsubpix = atoi(argv[6]); int nsubpix = atoi(argv[6]);
int etabins = 1000; // nsubpix*2*100; // int etabins = 1000; // nsubpix*2*100;
double etamin = -1, etamax = 2; // double etamin = -1, etamax = 2;
int quad; int quad;
double sum, totquad; double sum, totquad;
double sDum[2][2]; double sDum[2][2];
double etax, etay, int_x, int_y; // double etax, etay;
int ok; double int_x, int_y;
// int ok;
int ix, iy, isx, isy; int ix, iy, isx, isy;

View File

@ -86,17 +86,10 @@ int main(int argc, char *argv[]) {
#endif #endif
//Read detector size from decoder
int nx = 400, ny = 400; int nx , ny;
decoder->getDetectorSize(nx, ny); decoder->getDetectorSize(nx, ny);
#ifdef CORR
int ncol_cm = CM_ROWS;
double xt_ghost = C_GHOST;
#endif
moench03CommonMode *cm = NULL;
moench03GhostSummation *gs;
double *gainmap = NULL;
//float *gm; //float *gm;
int ff, np; int ff, np;
@ -171,8 +164,15 @@ int main(int argc, char *argv[]) {
uint32_t nnx, nny; uint32_t nnx, nny;
moench03CommonMode *cm = nullptr;
moench03GhostSummation *gs = nullptr;
double *gainmap = nullptr;
#ifdef CORR #ifdef CORR
cout << "Applying common mode " << ncol_cm << endl; int ncol_cm = CM_ROWS;
double xt_ghost = C_GHOST;
std::cout << "Applying common mode " << ncol_cm << endl;
cm = new moench03CommonMode(ncol_cm); cm = new moench03CommonMode(ncol_cm);
// cout << "Applying ghost corrections " << xt_ghost << endl; // cout << "Applying ghost corrections " << xt_ghost << endl;