mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 10:30:41 +02:00
changed clock for jungfrau, maybe other debugging stuff outside this folder
This commit is contained in:
parent
ebf102b8d9
commit
9d106f6c93
@ -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};
|
||||
|
Binary file not shown.
@ -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;i<nel;i++){
|
||||
@ -5294,8 +5306,11 @@ void multiSlsDetector::readFrameFromReceiver(){
|
||||
bytesperchannel = slsdatabytes/slsmaxchannels;
|
||||
slsmaxX = detectors[0]->getTotalNumberOfChannels(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;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),
|
||||
(char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
|
||||
(slsmaxX/numReadoutPerDetector)*bytesperchannel);
|
||||
}
|
||||
}
|
||||
//top
|
||||
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),
|
||||
(char*)singleframe[ireadout]+ i*(slsmaxX/numReadoutPerDetector)*bytesperchannel,
|
||||
(slsmaxX/numReadoutPerDetector)*bytesperchannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
//no interleaving, just add to the end
|
||||
|
@ -4855,103 +4855,108 @@ int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
|
||||
|
||||
double* slsDetector::decodeData(int *datain, double *fdata) {
|
||||
|
||||
double *dataout;
|
||||
if (fdata) {
|
||||
dataout=fdata;
|
||||
// printf("not allocating fdata!\n");
|
||||
}
|
||||
else {
|
||||
dataout=new double[thisDetector->nChans*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; ichan<nch; ichan++) {
|
||||
// dataout[ichan]=0;
|
||||
ival=0;
|
||||
// for (ibyte=0; ibyte<2; ibyte++) {
|
||||
ibyte=0;
|
||||
iptr=ptr[ichan*2+ibyte];
|
||||
ival|=((iptr<<(ibyte*bytesize))&(0xff<<(ibyte*bytesize)));
|
||||
ibyte=1;
|
||||
iptr=ptr[ichan*2+ibyte];
|
||||
ival|=((iptr<<(ibyte*bytesize))&(0x3f<<(ibyte*bytesize)));
|
||||
|
||||
// }
|
||||
dataout[ichan]=ival;
|
||||
}
|
||||
} else {
|
||||
switch (nbits) {
|
||||
case 1:
|
||||
for (ibyte=0; ibyte<thisDetector->dataBytes; ibyte++) {
|
||||
iptr=ptr[ibyte]&0x1;
|
||||
for (ipos=0; ipos<8; ipos++) {
|
||||
// dataout[ibyte*2+ichan]=((iptr&((0xf)<<ichan))>>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; ibyte<thisDetector->dataBytes; ibyte++) {
|
||||
iptr=ptr[ibyte]&0xff;
|
||||
for (ipos=0; ipos<2; ipos++) {
|
||||
// dataout[ibyte*2+ichan]=((iptr&((0xf)<<ichan))>>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; ichan<thisDetector->dataBytes; ichan++) {
|
||||
ival=ptr[ichan]&0xff;
|
||||
dataout[ichan]=ival;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
for (ichan=0; ichan<nch; ichan++) {
|
||||
// dataout[ichan]=0;
|
||||
ival=0;
|
||||
for (ibyte=0; ibyte<2; ibyte++) {
|
||||
iptr=ptr[ichan*2+ibyte];
|
||||
ival|=((iptr<<(ibyte*bytesize))&(0xff<<(ibyte*bytesize)));
|
||||
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; ichan<nch; ichan++) {
|
||||
// dataout[ichan]=0;
|
||||
ival=0;
|
||||
// for (ibyte=0; ibyte<2; ibyte++) {
|
||||
ibyte=0;
|
||||
iptr=ptr[ichan*2+ibyte];
|
||||
ival|=((iptr<<(ibyte*bytesize))&(0xff<<(ibyte*bytesize)));
|
||||
ibyte=1;
|
||||
iptr=ptr[ichan*2+ibyte];
|
||||
ival|=((iptr<<(ibyte*bytesize))&(0x3f<<(ibyte*bytesize)));
|
||||
|
||||
// }
|
||||
dataout[ichan]=ival;
|
||||
}
|
||||
} else {
|
||||
switch (nbits) {
|
||||
case 1:
|
||||
for (ibyte=0; ibyte<thisDetector->dataBytes; ibyte++) {
|
||||
iptr=ptr[ibyte]&0x1;
|
||||
for (ipos=0; ipos<8; ipos++) {
|
||||
// dataout[ibyte*2+ichan]=((iptr&((0xf)<<ichan))>>ichan)&0xf;
|
||||
ival=(iptr>>(ipos))&0x1;
|
||||
dataout[ichan]=ival;
|
||||
ichan++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (ibyte=0; ibyte<thisDetector->dataBytes; ibyte++) {
|
||||
iptr=ptr[ibyte]&0xff;
|
||||
for (ipos=0; ipos<2; ipos++) {
|
||||
// dataout[ibyte*2+ichan]=((iptr&((0xf)<<ichan))>>ichan)&0xf;
|
||||
ival=(iptr>>(ipos*4))&0xf;
|
||||
dataout[ichan]=ival;
|
||||
ichan++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
for (ichan=0; ichan<thisDetector->dataBytes; ichan++) {
|
||||
ival=ptr[ichan]&0xff;
|
||||
dataout[ichan]=ival;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
for (ichan=0; ichan<nch; ichan++) {
|
||||
// dataout[ichan]=0;
|
||||
ival=0;
|
||||
for (ibyte=0; ibyte<2; ibyte++) {
|
||||
iptr=ptr[ichan*2+ibyte];
|
||||
ival|=((iptr<<(ibyte*bytesize))&(0xff<<(ibyte*bytesize)));
|
||||
}
|
||||
dataout[ichan]=ival;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(thisDetector->myDetectorType == MYTHEN){
|
||||
for (ichan=0; ichan<nch; ichan++) {
|
||||
ival=datain[ichan]&0xffffff;
|
||||
dataout[ichan]=ival;
|
||||
}
|
||||
}
|
||||
for (ichan=0; ichan<nch; ichan++) {
|
||||
dataout[ichan]=ival;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (ichan=0; ichan<nch; ichan++) {
|
||||
dataout[ichan]=datain[ichan];
|
||||
}
|
||||
}
|
||||
dataout[ichan]=ival;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for (ichan=0; ichan<nch; ichan++) {
|
||||
ival=datain[ichan]&0xffffff;
|
||||
dataout[ichan]=ival;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (ichan=0; ichan<nch; ichan++) {
|
||||
dataout[ichan]=datain[ichan];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "decoded "<< ichan << " channels" << std::endl;
|
||||
std::cout<< "decoded "<< ichan << " channels" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
return dataout;
|
||||
return dataout;
|
||||
}
|
||||
|
||||
//Correction
|
||||
|
Loading…
x
Reference in New Issue
Block a user