added xmap and ymap in moench02Ctb.h

This commit is contained in:
Marco Ramilli 2015-11-04 12:26:00 +01:00
parent 22ba839ad5
commit 0841467dc9
2 changed files with 37 additions and 10 deletions

View File

@ -9,10 +9,15 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
private: private:
int iframe; int iframe;
int *xmap, *ymap; // int *xmap, *ymap;
int nadc; int nadc;
int sc_width; int sc_width;
int sc_height; int sc_height;
int maplength;
public: public:
@ -29,34 +34,55 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
moench02CtbData(int ns=6400): slsDetectorData<uint16_t>(160, 160, ns*2*32, NULL, NULL) , nadc(4), sc_width(40), sc_height(160) { moench02CtbData(int ns=6400): slsDetectorData<uint16_t>(160, 160, ns*2*32, NULL, NULL) , nadc(4), sc_width(40), sc_height(160) {
int adc_nr[4]={0,40,40,120}; int adc_nr[4]={120,0,80,40};
int row, col; int row, col;
int isample; int isample;
int iadc; int iadc;
int ix, iy; int ix, iy;
maplength=this->getDataSize()/2;
cerr<<"Map Array Length: "<<maplength<<endl;
for (iadc=0; iadc<nadc; iadc++) { for (iadc=0; iadc<nadc; iadc++) {
for (int i=0; i<sc_width*sc_height; i++) { for (int i=0; i<sc_width*sc_height; i++) {
col=adc_nr[iadc]+(i%sc_width); col=adc_nr[iadc]+(i%sc_width);
row=i/sc_width; row=i/sc_width;
dataMap[row][col]=(32*i+iadc)*2; dataMap[row][col]=(32*i+iadc+2)*2;
if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize) { if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize) {
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl; cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
} }
} }
} }
for (int i=0; i<maplength; i++) {
isample=i/32;
iadc=i%32;
ix=isample%sc_width;
iy=isample/sc_width;
if(iadc>1 && iadc<6){
xmap[i]=adc_nr[iadc-2]+ix;
ymap[i]=iy;
}else{
xmap[i]=-1;
ymap[i]=-1;
}
}
iframe=0; iframe=0;
// cout << "data struct created" << endl; // cout << "data struct created" << endl;
}; };
void getPixel(int ip, int &x, int &y) {if (ip>=0 && ip<nx*ny) {x=xmap[ip]; y=ymap[ip];}}; void getPixel(int ip, int &x, int &y) {
if(ip>=0 && ip<maplength){
x=xmap[ip];
y=ymap[ip];
}else{
cerr<<"WRONG ARRAY LENGTH"<<endl;
cerr<<"Trying to access the "<<ip<<"-th element"<<endl;
}
};
/** /**

View File

@ -43,6 +43,7 @@ class slsDetectorData {
xmap=new int[dsize/sizeof(dataType)]; xmap=new int[dsize/sizeof(dataType)];
ymap=new int[dsize/sizeof(dataType)]; ymap=new int[dsize/sizeof(dataType)];
dataMask=new dataType*[ny]; dataMask=new dataType*[ny];
for(int i = 0; i < ny; i++) { for(int i = 0; i < ny; i++) {
dataMask[i] = new dataType[nx]; dataMask[i] = new dataType[nx];
@ -191,7 +192,7 @@ class slsDetectorData {
int setDataSize(int d) {dataSize=d; return dataSize;}; int setDataSize(int d) {dataSize=d; return dataSize;};
/** /**
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded. Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
\param data pointer to the dataset (including headers etc) \param data pointer to the dataset (including headers etc)