mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-25 04:00:40 +02:00
start and stop receiver for eiger doesnt include transmitting stage. set timer sends to anz type of receiver the num frames and acq period
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@796 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
b6d18131e8
commit
1607ddb096
@ -3536,56 +3536,46 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
|
|
||||||
|
|
||||||
//send acquisiton period/frame number to receiver
|
//send acquisiton period/frame number to receiver
|
||||||
switch(thisDetector->myDetectorType){
|
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD))
|
||||||
case EIGER:
|
{
|
||||||
if(index != FRAME_NUMBER)
|
if((ret != FAIL) && (t != -1)){
|
||||||
return thisDetector->timerValue[index];
|
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||||
break;
|
int64_t args[2];
|
||||||
//for gotthard and moench, mythen returns anyway because of no rxr
|
args[1] = retval;
|
||||||
default:
|
|
||||||
if(index != FRAME_PERIOD)
|
|
||||||
return thisDetector->timerValue[index];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((ret != FAIL) && (t != -1)){
|
|
||||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
|
||||||
int64_t args[2];
|
|
||||||
args[1] = retval;
|
|
||||||
if(index==FRAME_NUMBER)
|
|
||||||
args[0] = FRAME_NUMBER;
|
|
||||||
else{
|
|
||||||
args[0] = FRAME_PERIOD;
|
|
||||||
//if acquisition period is zero, then #frames/buffer depends on exposure time and not acq period
|
|
||||||
if(!retval)
|
|
||||||
args[1] = timerValue[ACQUISITION_TIME];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
if(index==FRAME_NUMBER){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(index==FRAME_PERIOD)
|
std::cout << "Sending/Getting number of frames to/from receiver " << retval << std::endl;
|
||||||
std::cout << "Sending/Getting acquisition period to/from receiver " << retval << std::endl;
|
|
||||||
else
|
|
||||||
std::cout << "Sending/Getting number of frames to/from receiver " << retval << std::endl;
|
|
||||||
#endif
|
#endif
|
||||||
if (connectData() == OK)
|
args[0] = FRAME_NUMBER;
|
||||||
ret=thisReceiver->sendIntArray(fnum,ut,args);
|
}else{
|
||||||
if((ut != retval)|| (ret==FAIL)){
|
#ifdef VERBOSE
|
||||||
ret = FAIL;
|
std::cout << "Sending/Getting acquisition period to/from receiver " << retval << std::endl;
|
||||||
if(index==FRAME_PERIOD){
|
#endif
|
||||||
cout << "ERROR:Acquisition Period in receiver set incorrectly to " << ut << " instead of " << retval << endl;
|
args[0] = FRAME_PERIOD;
|
||||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
|
//if acquisition period is zero, then #frames/buffer depends on exposure time and not acq period
|
||||||
}else{
|
if(!retval)
|
||||||
cout << "ERROR:Number of Frames in receiver set incorrectly to " << ut << " instead of " << retval << endl;
|
args[1] = timerValue[ACQUISITION_TIME];
|
||||||
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
|
}
|
||||||
|
|
||||||
|
if (connectData() == OK)
|
||||||
|
ret=thisReceiver->sendIntArray(fnum,ut,args);
|
||||||
|
if((ut != retval)|| (ret==FAIL)){
|
||||||
|
ret = FAIL;
|
||||||
|
if(index==FRAME_PERIOD){
|
||||||
|
cout << "ERROR:Acquisition Period in receiver set incorrectly to " << ut << " instead of " << retval << endl;
|
||||||
|
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
|
||||||
|
}else{
|
||||||
|
cout << "ERROR:Number of Frames in receiver set incorrectly to " << ut << " instead of " << retval << endl;
|
||||||
|
setErrorMask((getErrorMask())|(RECEIVER_FRAME_NUM_NOT_SET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ret==FORCE_UPDATE)
|
||||||
|
updateReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(ret==FORCE_UPDATE)
|
}
|
||||||
updateReceiver();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return thisDetector->timerValue[index];
|
return thisDetector->timerValue[index];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -3975,9 +3975,11 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
|||||||
myDet->startReceiver();
|
myDet->startReceiver();
|
||||||
else if(!strcasecmp(args[1],"stop")){
|
else if(!strcasecmp(args[1],"stop")){
|
||||||
myDet->startReceiverReadout();
|
myDet->startReceiverReadout();
|
||||||
while(myDet->getReceiverStatus() != RUN_FINISHED)
|
runStatus s = myDet->getReceiverStatus();
|
||||||
|
while((s != RUN_FINISHED)&&(s != IDLE))
|
||||||
usleep(50000);
|
usleep(50000);
|
||||||
myDet->stopReceiver();
|
if(s != IDLE)
|
||||||
|
myDet->stopReceiver();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return helpReceiver(narg, args, action);
|
return helpReceiver(narg, args, action);
|
||||||
|
@ -54,6 +54,7 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det):
|
|||||||
packetIndexMask(GOTTHARD_PACKET_INDEX_MASK),
|
packetIndexMask(GOTTHARD_PACKET_INDEX_MASK),
|
||||||
frameIndexOffset(GOTTHARD_FRAME_INDEX_OFFSET),
|
frameIndexOffset(GOTTHARD_FRAME_INDEX_OFFSET),
|
||||||
acquisitionPeriod(SAMPLE_TIME_IN_NS),
|
acquisitionPeriod(SAMPLE_TIME_IN_NS),
|
||||||
|
numberOfFrames(0),
|
||||||
shortFrame(-1),
|
shortFrame(-1),
|
||||||
currframenum(0),
|
currframenum(0),
|
||||||
prevframenum(0),
|
prevframenum(0),
|
||||||
@ -74,18 +75,18 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det):
|
|||||||
thread_started(0),
|
thread_started(0),
|
||||||
currentWriterThreadIndex(-1),
|
currentWriterThreadIndex(-1),
|
||||||
totalListeningFrameCount(0),
|
totalListeningFrameCount(0),
|
||||||
sfilefd(NULL),
|
|
||||||
writerthreads_mask(0x0),
|
writerthreads_mask(0x0),
|
||||||
listening_thread_running(0),
|
listening_thread_running(0),
|
||||||
killListeningThread(0),
|
killListeningThread(0),
|
||||||
killAllWritingThreads(0),
|
killAllWritingThreads(0),
|
||||||
cbAction(DO_EVERYTHING),
|
sfilefd(NULL),
|
||||||
startAcquisitionCallBack(NULL),
|
startAcquisitionCallBack(NULL),
|
||||||
pStartAcquisition(NULL),
|
pStartAcquisition(NULL),
|
||||||
acquisitionFinishedCallBack(NULL),
|
acquisitionFinishedCallBack(NULL),
|
||||||
pAcquisitionFinished(NULL),
|
pAcquisitionFinished(NULL),
|
||||||
rawDataReadyCallBack(NULL),
|
rawDataReadyCallBack(NULL),
|
||||||
pRawDataReady(NULL){
|
pRawDataReady(NULL),
|
||||||
|
cbAction(DO_EVERYTHING){
|
||||||
|
|
||||||
maxPacketsPerFile = MAX_FRAMES_PER_FILE * packetsPerFrame;
|
maxPacketsPerFile = MAX_FRAMES_PER_FILE * packetsPerFrame;
|
||||||
|
|
||||||
@ -261,7 +262,7 @@ char* slsReceiverFunctionList::setFilePath(char c[]){
|
|||||||
strcpy(filePath,c);
|
strcpy(filePath,c);
|
||||||
}else{
|
}else{
|
||||||
strcpy(filePath,"");
|
strcpy(filePath,"");
|
||||||
cout<<"FilePath does not exist:"<<filePath<<endl;
|
cout << "FilePath does not exist:" << filePath << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return getFilePath();
|
return getFilePath();
|
||||||
@ -270,7 +271,7 @@ char* slsReceiverFunctionList::setFilePath(char c[]){
|
|||||||
|
|
||||||
char* slsReceiverFunctionList::getFileName(){
|
char* slsReceiverFunctionList::getFileName(){
|
||||||
if(myDetectorType == EIGER)
|
if(myDetectorType == EIGER)
|
||||||
receiver->getFileName();
|
return receiver->getFileName();
|
||||||
else
|
else
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
@ -339,12 +340,9 @@ slsDetectorDefs::runStatus slsReceiverFunctionList::getStatus(){
|
|||||||
|
|
||||||
char* slsReceiverFunctionList::setDetectorHostname(char c[]){
|
char* slsReceiverFunctionList::setDetectorHostname(char c[]){
|
||||||
if(strlen(c)){
|
if(strlen(c)){
|
||||||
char *c0 = receiver->getDetectorHostname();
|
if(receiver->getDetectorHostname()== NULL)
|
||||||
if(c0== NULL)
|
|
||||||
receiver->initialize(c);
|
receiver->initialize(c);
|
||||||
delete[] c0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return receiver->getDetectorHostname();
|
return receiver->getDetectorHostname();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,9 +358,17 @@ void slsReceiverFunctionList::setUDPPortNo(int p){
|
|||||||
|
|
||||||
|
|
||||||
int32_t slsReceiverFunctionList::setNumberOfFrames(int32_t fnum){
|
int32_t slsReceiverFunctionList::setNumberOfFrames(int32_t fnum){
|
||||||
if(fnum >= 0)
|
if(fnum >= 0){
|
||||||
receiver->setNumberOfFrames(fnum);
|
if(myDetectorType == EIGER)
|
||||||
return receiver->getNumberOfFrames();
|
receiver->setNumberOfFrames(fnum);
|
||||||
|
else
|
||||||
|
numberOfFrames = fnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(myDetectorType == EIGER)
|
||||||
|
return receiver->getNumberOfFrames();
|
||||||
|
else
|
||||||
|
return numberOfFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t slsReceiverFunctionList::setScanTag(int32_t stag){
|
int32_t slsReceiverFunctionList::setScanTag(int32_t stag){
|
||||||
@ -418,6 +424,7 @@ int slsReceiverFunctionList::setNFrameToGui(int i){
|
|||||||
|
|
||||||
|
|
||||||
int64_t slsReceiverFunctionList::setAcquisitionPeriod(int64_t index){
|
int64_t slsReceiverFunctionList::setAcquisitionPeriod(int64_t index){
|
||||||
|
|
||||||
if(index >= 0){
|
if(index >= 0){
|
||||||
if(index != acquisitionPeriod){
|
if(index != acquisitionPeriod){
|
||||||
acquisitionPeriod = index;
|
acquisitionPeriod = index;
|
||||||
@ -1161,6 +1168,13 @@ int slsReceiverFunctionList::stopReceiver(){
|
|||||||
|
|
||||||
|
|
||||||
void slsReceiverFunctionList::startReadout(){
|
void slsReceiverFunctionList::startReadout(){
|
||||||
|
|
||||||
|
if(myDetectorType == EIGER){
|
||||||
|
receiver->stopReceiver();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//wait so that all packets which take time has arrived
|
//wait so that all packets which take time has arrived
|
||||||
usleep(50000);
|
usleep(50000);
|
||||||
|
|
||||||
@ -1201,7 +1215,7 @@ int slsReceiverFunctionList::startListening(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int lastpacketoffset, expected, rc, packetcount, maxBufferSize, carryonBufferSize;
|
int lastpacketoffset, expected, rc, packetcount, maxBufferSize, carryonBufferSize;
|
||||||
int lastframeheader;// for moench to check for all the packets in last frame
|
uint32_t lastframeheader;// for moench to check for all the packets in last frame
|
||||||
char* tempchar = NULL;
|
char* tempchar = NULL;
|
||||||
|
|
||||||
|
|
||||||
@ -1358,7 +1372,7 @@ int slsReceiverFunctionList::startListening(){
|
|||||||
cout << "last packet offset:" << lastpacketoffset << endl;
|
cout << "last packet offset:" << lastpacketoffset << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if((packetsPerFrame -1) != ((((uint32_t)(*((uint32_t*)(buffer+lastpacketoffset))))+1) & (packetIndexMask))){
|
if((unsigned int)(packetsPerFrame -1) != ((((uint32_t)(*((uint32_t*)(buffer+lastpacketoffset))))+1) & (packetIndexMask))){
|
||||||
memcpy(tempchar,buffer+lastpacketoffset, onePacketSize);
|
memcpy(tempchar,buffer+lastpacketoffset, onePacketSize);
|
||||||
#ifdef VERYDEBUG
|
#ifdef VERYDEBUG
|
||||||
cout << "tempchar header:" << (((((uint32_t)(*((uint32_t*)(tempchar))))+1)
|
cout << "tempchar header:" << (((((uint32_t)(*((uint32_t*)(tempchar))))+1)
|
||||||
@ -1422,7 +1436,8 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
|
|
||||||
thread_started = 1;
|
thread_started = 1;
|
||||||
|
|
||||||
int numpackets,tempframenum, nf;
|
int numpackets, nf;
|
||||||
|
uint32_t tempframenum;
|
||||||
char* wbuf;
|
char* wbuf;
|
||||||
char *data=new char[bufferSize];
|
char *data=new char[bufferSize];
|
||||||
int iFrame = 0;
|
int iFrame = 0;
|
||||||
@ -1576,15 +1591,14 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
int ndata;
|
int ndata;
|
||||||
char* buff = 0;
|
char* buff = 0;
|
||||||
data = wbuf+ HEADER_SIZE_NUM_TOT_PACKETS;
|
data = wbuf+ HEADER_SIZE_NUM_TOT_PACKETS;
|
||||||
int ir, ic;
|
|
||||||
int remainingsize = numpackets * onePacketSize;
|
int remainingsize = numpackets * onePacketSize;
|
||||||
int np;
|
int np;
|
||||||
int once = 0;
|
int once = 0;
|
||||||
double tot, tl, tr, bl, br, v;
|
double tot, tl, tr, bl, br;
|
||||||
int xmin = 1, ymin = 1, ix, iy;
|
int xmin = 1, ymin = 1, ix, iy;
|
||||||
|
|
||||||
|
|
||||||
while(buff = receiverdata[ithread]->findNextFrame(data,ndata,remainingsize )){
|
while(buff = receiverdata[ithread]->findNextFrame(data,ndata,remainingsize)){
|
||||||
np = ndata/onePacketSize;
|
np = ndata/onePacketSize;
|
||||||
|
|
||||||
//cout<<"buff framnum:"<<ithread <<":"<< ((((uint32_t)(*((uint32_t*)buff)))& (frameIndexMask)) >> frameIndexOffset)<<endl;
|
//cout<<"buff framnum:"<<ithread <<":"<< ((((uint32_t)(*((uint32_t*)buff)))& (frameIndexMask)) >> frameIndexOffset)<<endl;
|
||||||
@ -1730,7 +1744,8 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
|
|
||||||
|
|
||||||
void slsReceiverFunctionList::writeToFile_withoutCompression(char* buf,int numpackets){
|
void slsReceiverFunctionList::writeToFile_withoutCompression(char* buf,int numpackets){
|
||||||
int packetsToSave, offset,tempframenum,lastpacket;
|
int packetsToSave, offset,lastpacket;
|
||||||
|
uint32_t tempframenum;
|
||||||
|
|
||||||
//file write
|
//file write
|
||||||
if((enableFileWrite) && (sfilefd)){
|
if((enableFileWrite) && (sfilefd)){
|
||||||
|
@ -434,6 +434,9 @@ private:
|
|||||||
/** acquisition period */
|
/** acquisition period */
|
||||||
int64_t acquisitionPeriod;
|
int64_t acquisitionPeriod;
|
||||||
|
|
||||||
|
/** frame number */
|
||||||
|
int32_t numberOfFrames;
|
||||||
|
|
||||||
/** short frames */
|
/** short frames */
|
||||||
int shortFrame;
|
int shortFrame;
|
||||||
|
|
||||||
|
@ -1420,7 +1420,7 @@ int slsReceiverFuncs::start_readout(){
|
|||||||
#ifdef SLS_RECEIVER_FUNCTION_LIST
|
#ifdef SLS_RECEIVER_FUNCTION_LIST
|
||||||
slsReceiverList->startReadout();
|
slsReceiverList->startReadout();
|
||||||
retval = slsReceiverList->getStatus();
|
retval = slsReceiverList->getStatus();
|
||||||
if((retval == TRANSMITTING) || (retval == RUN_FINISHED))
|
if((retval == TRANSMITTING) || (retval == RUN_FINISHED) || (retval == IDLE))
|
||||||
ret = OK;
|
ret = OK;
|
||||||
else
|
else
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user