changed clock for jungfrau, maybe other debugging stuff outside this folder

This commit is contained in:
Dhanya Maliakal 2016-11-21 09:21:30 +01:00
parent ebf102b8d9
commit 9d106f6c93
4 changed files with 131 additions and 100 deletions

View File

@ -91,7 +91,7 @@ u_int32_t progressMask=0;
int phase_shift=0;//DEFAULT_PHASE_SHIFT; int phase_shift=0;//DEFAULT_PHASE_SHIFT;
int ipPacketSize=DEFAULT_IP_PACKETSIZE; int ipPacketSize=DEFAULT_IP_PACKETSIZE;
int udpPacketSize=DEFAULT_UDP_PACKETSIZE; int udpPacketSize=DEFAULT_UDP_PACKETSIZE;
int clockdivider = 20; int clockdivider = 40;
/* /*
#ifndef NEW_PLL_RECONFIG #ifndef NEW_PLL_RECONFIG
u_int32_t clkDivider[2]={32,16}; u_int32_t clkDivider[2]={32,16};

View File

@ -5105,16 +5105,15 @@ void multiSlsDetector::startReceivingDataThread(){
//initializations //initializations
int numReadoutPerDetector = 1; int numReadoutPerDetector = 1;
bool jungfrau = false; bool jungfrau = false;
int expectedsize = 1024*256;/**shouldnt work for other bit modes or anythign*/
if(getDetectorsType() == EIGER){ if(getDetectorsType() == EIGER){
numReadoutPerDetector = 2; numReadoutPerDetector = 2;
expectedsize = 1024*256;
}else if(getDetectorsType() == JUNGFRAU){ }else if(getDetectorsType() == JUNGFRAU){
jungfrau = true; jungfrau = true;
expectedsize = 8192*128; //expectedsize = 8192*128;
} }
int singleDatabytes = detectors[ithread/numReadoutPerDetector]->getDataBytes(); int singleDatabytes = detectors[ithread/numReadoutPerDetector]->getDataBytes();
int nel=(singleDatabytes/numReadoutPerDetector)/sizeof(int); int nel=(singleDatabytes/numReadoutPerDetector)/sizeof(int);
int expectedsize = singleDatabytes/numReadoutPerDetector;//8192*128; //1024*256
int* image = new int[nel]; int* image = new int[nel];
int len,idet = 0; int len,idet = 0;
singleframe[ithread]=NULL; singleframe[ithread]=NULL;
@ -5160,8 +5159,9 @@ void multiSlsDetector::startReceivingDataThread(){
//infinite loop, exited only (if gui restarted/ enabledatastreaming called) //infinite loop, exited only (if gui restarted/ enabledatastreaming called)
while(true){ while(true){
//cprintf(GREEN,"%d waiting to copy\n",ithread);
sem_wait(&sem_singlewait[ithread]); //wait for it to be copied sem_wait(&sem_singlewait[ithread]); //wait for it to be copied
//cprintf(GREEN,"%d gonna copy\n",ithread);
//check to exit thread //check to exit thread
if(killAllReceivingDataThreads) if(killAllReceivingDataThreads)
break; break;
@ -5210,8 +5210,14 @@ void multiSlsDetector::startReceivingDataThread(){
#endif #endif
if(currentFrameIndex ==-1) cprintf(RED,"multi frame index -1!!\n"); if(currentFrameIndex ==-1) cprintf(RED,"multi frame index -1!!\n");
} }
if(singleframe[ithread]==NULL){
singleDatabytes = detectors[ithread/numReadoutPerDetector]->getDataBytes();
nel=(singleDatabytes/numReadoutPerDetector)/sizeof(int);
delete [] image;
image = new int[nel];
expectedsize = singleDatabytes/numReadoutPerDetector;
}
singleframe[ithread]=image; singleframe[ithread]=image;
// close the message // close the message
zmq_msg_close(&message); zmq_msg_close(&message);
@ -5236,9 +5242,15 @@ void multiSlsDetector::startReceivingDataThread(){
else{ else{
//actual data //actual data
//cprintf(BLUE,"%d actual dataaa\n",ithread); //cprintf(BLUE,"%d actual dataaa\n",ithread);
//memset((char*)(singleframe[ithread]),0xFF,singleDatabytes/numReadoutPerDetector);
memcpy((char*)(singleframe[ithread]),(char*)zmq_msg_data(&message),singleDatabytes/numReadoutPerDetector); memcpy((char*)(singleframe[ithread]),(char*)zmq_msg_data(&message),singleDatabytes/numReadoutPerDetector);
//cprintf(GREEN,"%d copied data %d\n",ithread,singleDatabytes/numReadoutPerDetector);
if(!ithread){
for(int i=0;i<30;i++)
cprintf(BLUE,"value[%d]:%d\n",i,(short int)singleframe[ithread][i]);
}
//jungfrau masking adcval //jungfrau masking adcval
if(jungfrau){ if(jungfrau){
for(unsigned int i=0;i<nel;i++){ for(unsigned int i=0;i<nel;i++){
@ -5294,8 +5306,11 @@ void multiSlsDetector::readFrameFromReceiver(){
bytesperchannel = slsdatabytes/slsmaxchannels; bytesperchannel = slsdatabytes/slsmaxchannels;
slsmaxX = detectors[0]->getTotalNumberOfChannels(X); slsmaxX = detectors[0]->getTotalNumberOfChannels(X);
slsmaxY = detectors[0]->getTotalNumberOfChannels(Y); slsmaxY = detectors[0]->getTotalNumberOfChannels(Y);
//cprintf(BLUE,"slsdatabytes:%d slsmaxchannels:%d bytesperchannel:%d slsmaxX:%d slsmaxY:%d\n",
// slsdatabytes,slsmaxchannels,bytesperchannel,slsmaxX,slsmaxY);
} }
int nel=(thisMultiDetector->dataBytes)/sizeof(int); int nel=(thisMultiDetector->dataBytes)/sizeof(int);
//cprintf(BLUE,"multi databytes:%d\n",thisMultiDetector->dataBytes);
if(nel <= 0){ if(nel <= 0){
cprintf(RED,"Error: Multislsdetector databytes not valid : %d\n", thisMultiDetector->dataBytes); cprintf(RED,"Error: Multislsdetector databytes not valid : %d\n", thisMultiDetector->dataBytes);
return; return;
@ -5337,7 +5352,8 @@ void multiSlsDetector::readFrameFromReceiver(){
} }
//assemble data //assemble data
if(maxX){ //eiger, so interleaving between ports in one readout itself if(maxX){
//eiger, so interleaving between ports in one readout itself
offsetY = (maxY - (thisMultiDetector->offsetY[idet] + slsmaxY)) * maxX * bytesperchannel; offsetY = (maxY - (thisMultiDetector->offsetY[idet] + slsmaxY)) * maxX * bytesperchannel;
//the left half or right half //the left half or right half
if(!(ireadout%numReadoutPerDetector)) if(!(ireadout%numReadoutPerDetector))
@ -5345,26 +5361,36 @@ void multiSlsDetector::readFrameFromReceiver(){
else else
offsetX = thisMultiDetector->offsetX[idet] + halfreadoutoffset; offsetX = thisMultiDetector->offsetX[idet] + halfreadoutoffset;
offsetX *= bytesperchannel; offsetX *= bytesperchannel;
//cprintf(BLUE,"offsetx:%d offsety:%d maxx:%d slsmaxX:%d slsmaxY:%d bytesperchannel:%d\n", //cprintf(BLUE,"ireadout:%d, offsetx:%d offsety:%d maxx:%d slsmaxX:%d slsmaxY:%d bytesperchannel:%d\n",
// offsetX,offsetY,maxX,slsmaxX,slsmaxY,bytesperchannel); // ireadout, offsetX,offsetY,maxX,slsmaxX,slsmaxY,bytesperchannel);
// cprintf(BLUE,"copying bytes:%d\n", (slsmaxX/numReadoutPerDetector)*bytesperchannel); // cprintf(BLUE,"copying bytes:%d\n", (slsmaxX/numReadoutPerDetector)*bytesperchannel);
//itnerleaving with other detectors
//interleaving with other detectors
//bottom //bottom
if(((idet+1)%2) == 0){ if(((idet+1)%2) == 0){
for(int i=0;i<slsmaxY;++i) for(int i=0;i<slsmaxY;++i){
// cprintf(BLUE,"%d i:%d gonna copy sourceoffset:%d destoffset:%d\n",ireadout,i,
// i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
// offsetY + offsetX +((slsmaxY-i)*maxX*bytesperchannel));
memcpy(((char*)multiframe) + offsetY + offsetX + ((slsmaxY-i)*maxX*bytesperchannel), memcpy(((char*)multiframe) + offsetY + offsetX + ((slsmaxY-i)*maxX*bytesperchannel),
(char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel, (char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
(slsmaxX/numReadoutPerDetector)*bytesperchannel); (slsmaxX/numReadoutPerDetector)*bytesperchannel);
} }
}
//top //top
else{ else{
for(int i=0;i<slsmaxY;++i) for(int i=0;i<slsmaxY;++i){
//cprintf(BLUE,"%d i:%d gonna copy sourceoffset:%d destoffset:%d \n",ireadout,i,
// i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
// offsetY + offsetX + (i*maxX*bytesperchannel));
memcpy(((char*)multiframe) + offsetY + offsetX + (i*maxX*bytesperchannel), memcpy(((char*)multiframe) + offsetY + offsetX + (i*maxX*bytesperchannel),
(char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel, (char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
(slsmaxX/numReadoutPerDetector)*bytesperchannel); (slsmaxX/numReadoutPerDetector)*bytesperchannel);
} }
} }
}
//no interleaving, just add to the end //no interleaving, just add to the end
//numReadout always 1 here //numReadout always 1 here
else{ else{

View File

@ -4933,11 +4933,16 @@ double* slsDetector::decodeData(int *datain, double *fdata) {
} }
break; break;
default: default:
if(thisDetector->myDetectorType == MYTHEN){
for (ichan=0; ichan<nch; ichan++) { for (ichan=0; ichan<nch; ichan++) {
ival=datain[ichan]&0xffffff; ival=datain[ichan]&0xffffff;
dataout[ichan]=ival; dataout[ichan]=ival;
} }
} }
for (ichan=0; ichan<nch; ichan++) {
dataout[ichan]=ival;
}
}
} }
} else { } else {
for (ichan=0; ichan<nch; ichan++) { for (ichan=0; ichan<nch; ichan++) {