From 9d106f6c93dfcc854aa5ff192b4907ebbcca5616 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 21 Nov 2016 09:21:30 +0100 Subject: [PATCH] changed clock for jungfrau, maybe other debugging stuff outside this folder --- .../jungfrauDetectorServer/firmware_funcs.c | 2 +- ...verv2.2.0 => jungfrauDetectorServerv2.2.1} | Bin 126888 -> 126888 bytes .../multiSlsDetector/multiSlsDetector.cpp | 48 +++-- .../slsDetector/slsDetector.cpp | 181 +++++++++--------- 4 files changed, 131 insertions(+), 100 deletions(-) rename slsDetectorSoftware/jungfrauDetectorServer/{jungfrauDetectorServerv2.2.0 => jungfrauDetectorServerv2.2.1} (99%) diff --git a/slsDetectorSoftware/jungfrauDetectorServer/firmware_funcs.c b/slsDetectorSoftware/jungfrauDetectorServer/firmware_funcs.c index 4d9ea38c1..d6e485f48 100755 --- a/slsDetectorSoftware/jungfrauDetectorServer/firmware_funcs.c +++ b/slsDetectorSoftware/jungfrauDetectorServer/firmware_funcs.c @@ -91,7 +91,7 @@ u_int32_t progressMask=0; int phase_shift=0;//DEFAULT_PHASE_SHIFT; int ipPacketSize=DEFAULT_IP_PACKETSIZE; int udpPacketSize=DEFAULT_UDP_PACKETSIZE; -int clockdivider = 20; +int clockdivider = 40; /* #ifndef NEW_PLL_RECONFIG u_int32_t clkDivider[2]={32,16}; diff --git a/slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.2.0 b/slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.2.1 similarity index 99% rename from slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.2.0 rename to slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.2.1 index cdbf316386e4e580e3a8ed52b79d93bd0fc6a1dc..8f3ec4cf8a04b8239f46deee534f4ae7e29339e4 100755 GIT binary patch delta 46 zcmV+}0MY-b-v_AQ2aqWPGOkURL6!j+p+pb?ma|0=gHZvNgUMmH$zcI2M*%3e^{4@} EMyBEt1ONa4 delta 46 zcmV+}0MY-b-v_AQ2aqWPA>a|0L6!j+p+pb?l(R(;gHZvLgUMmH$zcI2M*$SK^{4@} EMxtL4(EtDd diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 36e8762e7..03ae47e9f 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -5105,16 +5105,15 @@ void multiSlsDetector::startReceivingDataThread(){ //initializations int numReadoutPerDetector = 1; bool jungfrau = false; - int expectedsize = 1024*256;/**shouldnt work for other bit modes or anythign*/ if(getDetectorsType() == EIGER){ numReadoutPerDetector = 2; - expectedsize = 1024*256; }else if(getDetectorsType() == JUNGFRAU){ jungfrau = true; - expectedsize = 8192*128; + //expectedsize = 8192*128; } int singleDatabytes = detectors[ithread/numReadoutPerDetector]->getDataBytes(); int nel=(singleDatabytes/numReadoutPerDetector)/sizeof(int); + int expectedsize = singleDatabytes/numReadoutPerDetector;//8192*128; //1024*256 int* image = new int[nel]; int len,idet = 0; singleframe[ithread]=NULL; @@ -5160,8 +5159,9 @@ void multiSlsDetector::startReceivingDataThread(){ //infinite loop, exited only (if gui restarted/ enabledatastreaming called) while(true){ - + //cprintf(GREEN,"%d waiting to copy\n",ithread); sem_wait(&sem_singlewait[ithread]); //wait for it to be copied + //cprintf(GREEN,"%d gonna copy\n",ithread); //check to exit thread if(killAllReceivingDataThreads) break; @@ -5210,8 +5210,14 @@ void multiSlsDetector::startReceivingDataThread(){ #endif 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; - // close the message zmq_msg_close(&message); @@ -5236,9 +5242,15 @@ void multiSlsDetector::startReceivingDataThread(){ else{ //actual data //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); + //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 if(jungfrau){ for(unsigned int i=0;igetTotalNumberOfChannels(X); 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); + //cprintf(BLUE,"multi databytes:%d\n",thisMultiDetector->dataBytes); if(nel <= 0){ cprintf(RED,"Error: Multislsdetector databytes not valid : %d\n", thisMultiDetector->dataBytes); return; @@ -5337,7 +5352,8 @@ void multiSlsDetector::readFrameFromReceiver(){ } //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; //the left half or right half if(!(ireadout%numReadoutPerDetector)) @@ -5345,24 +5361,34 @@ void multiSlsDetector::readFrameFromReceiver(){ else offsetX = thisMultiDetector->offsetX[idet] + halfreadoutoffset; offsetX *= bytesperchannel; - //cprintf(BLUE,"offsetx:%d offsety:%d maxx:%d slsmaxX:%d slsmaxY:%d bytesperchannel:%d\n", - // offsetX,offsetY,maxX,slsmaxX,slsmaxY,bytesperchannel); + //cprintf(BLUE,"ireadout:%d, offsetx:%d offsety:%d maxx:%d slsmaxX:%d slsmaxY:%d bytesperchannel:%d\n", + // ireadout, offsetX,offsetY,maxX,slsmaxX,slsmaxY,bytesperchannel); // cprintf(BLUE,"copying bytes:%d\n", (slsmaxX/numReadoutPerDetector)*bytesperchannel); - //itnerleaving with other detectors + + //interleaving with other detectors //bottom if(((idet+1)%2) == 0){ - for(int i=0;inChans*thisDetector->nChips*thisDetector->nMods]; - // printf("allocating fdata!\n"); - } - const int bytesize=8; - - int ival=0; - char *ptr=(char*)datain; - char iptr; - - int nbits=thisDetector->dynamicRange; - int nch=thisDetector->nChans*thisDetector->nChips*thisDetector->nMods; - int ipos=0, ichan=0, ibyte; - - if (thisDetector->timerValue[PROBES_NUMBER]==0) { - if (thisDetector->myDetectorType==JUNGFRAUCTB) { - - for (ichan=0; ichandataBytes; ibyte++) { - iptr=ptr[ibyte]&0x1; - for (ipos=0; ipos<8; ipos++) { - // dataout[ibyte*2+ichan]=((iptr&((0xf)<>ichan)&0xf; - ival=(iptr>>(ipos))&0x1; - dataout[ichan]=ival; - ichan++; + double *dataout; + if (fdata) { + dataout=fdata; + // printf("not allocating fdata!\n"); } - } - break; - case 4: - for (ibyte=0; ibytedataBytes; ibyte++) { - iptr=ptr[ibyte]&0xff; - for (ipos=0; ipos<2; ipos++) { - // dataout[ibyte*2+ichan]=((iptr&((0xf)<>ichan)&0xf; - ival=(iptr>>(ipos*4))&0xf; - dataout[ichan]=ival; - ichan++; + else { + dataout=new double[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods]; + // printf("allocating fdata!\n"); } - } - break; - case 8: - for (ichan=0; ichandataBytes; ichan++) { - ival=ptr[ichan]&0xff; - dataout[ichan]=ival; - } - break; - case 16: - for (ichan=0; ichandynamicRange; + int nch=thisDetector->nChans*thisDetector->nChips*thisDetector->nMods; + int ipos=0, ichan=0, ibyte; + + if (thisDetector->timerValue[PROBES_NUMBER]==0) { + if (thisDetector->myDetectorType==JUNGFRAUCTB) { + + for (ichan=0; ichandataBytes; ibyte++) { + iptr=ptr[ibyte]&0x1; + for (ipos=0; ipos<8; ipos++) { + // dataout[ibyte*2+ichan]=((iptr&((0xf)<>ichan)&0xf; + ival=(iptr>>(ipos))&0x1; + dataout[ichan]=ival; + ichan++; + } + } + break; + case 4: + for (ibyte=0; ibytedataBytes; ibyte++) { + iptr=ptr[ibyte]&0xff; + for (ipos=0; ipos<2; ipos++) { + // dataout[ibyte*2+ichan]=((iptr&((0xf)<>ichan)&0xf; + ival=(iptr>>(ipos*4))&0xf; + dataout[ichan]=ival; + ichan++; + } + } + break; + case 8: + for (ichan=0; ichandataBytes; ichan++) { + ival=ptr[ichan]&0xff; + dataout[ichan]=ival; + } + break; + case 16: + for (ichan=0; ichanmyDetectorType == MYTHEN){ + for (ichan=0; ichan