different between acquisition index and frame index

This commit is contained in:
Dhanya Maliakal 2015-03-12 12:22:19 +01:00
parent 6232c6584a
commit 7e44648da9
12 changed files with 41 additions and 30 deletions

View File

@ -1,6 +1,6 @@
CC = powerpc-4xx-softfloat-gcc
CCX = powerpc-4xx-softfloat-g++
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE -DMARTIN
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE -DMARTIN
LDLIBS += -lm -lstdc++
PROGS = eigerDetectorServer

View File

@ -0,0 +1 @@
../../slsReceiverSoftware/include/ansi.h

View File

@ -167,6 +167,10 @@ int initDetectorStop(){
void getModuleConfiguration(){
int *m=&master;
int *t=⊤
/*if(getDetectorNumber() == 0xbeb015){
master = 1;
top = 1;
}*/
Beb_GetModuleCopnfiguration(m,t);
if(top) printf("*************** TOP ***************\n");
else printf("*************** BOTTOM ***************\n");

View File

@ -4562,11 +4562,11 @@ int multiSlsDetector::resetFramesCaught() {
int* multiSlsDetector::readFrameFromReceiver(char* fName, int &fIndex){
int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex){
int nel=(thisMultiDetector->dataBytes)/sizeof(int);
if(nel <= 0){
cout << "Multislsdetector databytes not valid :" << thisMultiDetector->dataBytes << endl;
fIndex = -1;
acquisitionIndex = -1;
return NULL;
}
@ -4586,11 +4586,11 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &fIndex){
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
if (detectors[id]) {
n=detectors[id]->getDataBytes();
retdet=detectors[id]->readFrameFromReceiver(fName,fIndex);
retdet=detectors[id]->readFrameFromReceiver(fName, acquisitionIndex, frameIndex);
if(detectors[id]->getErrorMask())
setErrorMask(getErrorMask()|(1<<id));
if (retdet){
if (fIndex==-1){
if (acquisitionIndex==-1){
complete = FAIL;
delete [] retdet;
}else{
@ -4640,7 +4640,7 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &fIndex){
strcpy(fName,fullFName.c_str());
//if some of the receivers did not give data, dont count it
if((getDetectorsType() == EIGER) &&(complete ==FAIL))
fIndex = -1;
acquisitionIndex = -1;
return retval;
};

View File

@ -1155,10 +1155,11 @@ class multiSlsDetector : public slsDetectorUtils {
/**
* Reads a frame from receiver
* @param fName file name of current frame()
* @param fIndex current frame index
* @param acquisitionIndex current acquisition index
* @param frameIndex current frame index (for each scan)
/returns a frame read from recever
*/
int* readFrameFromReceiver(char* fName, int &fIndex);
int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex);
/** Locks/Unlocks the connection to the receiver
/param lock sets (1), usets (0), gets (-1) the lock

View File

@ -6447,7 +6447,7 @@ int slsDetector::resetFramesCaught(){
int* slsDetector::readFrameFromReceiver(char* fName, int &fIndex){
int* slsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex){
int fnum=F_READ_RECEIVER_FRAME;
int nel=thisDetector->dataBytes/sizeof(int);
int* retval=new int[nel];
@ -6472,7 +6472,8 @@ int* slsDetector::readFrameFromReceiver(char* fName, int &fIndex){
return NULL;
} else {
n=dataSocket->ReceiveDataOnly(fName,MAX_STR_LENGTH);
n=dataSocket->ReceiveDataOnly(&fIndex,sizeof(fIndex));
n=dataSocket->ReceiveDataOnly(&acquisitionIndex,sizeof(acquisitionIndex));
n=dataSocket->ReceiveDataOnly(&frameIndex,sizeof(frameIndex));
n=dataSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
#ifdef VERBOSE

View File

@ -1528,10 +1528,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
/**
* Reads a frame from receiver
* @param fName file name of current frame()
* @param fIndex current frame index
* @param acquisitionIndex current acquisition index
* @param frameIndex current frame index (for each scan)
/returns a frame read from recever
*/
int* readFrameFromReceiver(char* fName, int &fIndex);
int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex);
/** Locks/Unlocks the connection to the receiver
/param lock sets (1), usets (0), gets (-1) the lock

View File

@ -496,10 +496,11 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
/**
* Reads a frame from receiver
* @param fName file name of current frame()
* @param fIndex current frame index
* @param acquisitionIndex current acquisition index
* @param frameIndex current frame index (for each scan)
/returns a frame read from recever
*/
virtual int* readFrameFromReceiver(char* fName, int &fIndex)=0;
virtual int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex)=0;
/** Sets the read receiver frequency

View File

@ -628,10 +628,11 @@ virtual int resetFramesCaught()=0;
/**
* Reads a frame from receiver
* @param fName file name of current frame()
* @param fIndex current frame index
* @param acquisitionIndex current acquisition index
* @param frameIndex current frame index (for each scan)
/returns a frame read from recever
*/
virtual int* readFrameFromReceiver(char* fName, int &fIndex)=0;
virtual int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex)=0;
/**

View File

@ -497,7 +497,8 @@ void* postProcessing::processData(int delflag) {
int progress = -1;
char currentfName[MAX_STR_LENGTH]="";
int currentfIndex = -1;
int currentAcquisitionIndex = -1;
int currentFrameIndex = -1;
bool newData = false;
int nthframe = setReadReceiverFrequency(0);
#ifdef VERBOSE
@ -526,14 +527,14 @@ void* postProcessing::processData(int delflag) {
//get progress
pthread_mutex_lock(&mg);
if(setReceiverOnline() == ONLINE_FLAG)
currentfIndex = getReceiverCurrentFrameIndex();
currentAcquisitionIndex = getReceiverCurrentFrameIndex();
pthread_mutex_unlock(&mg);
//updating progress
if(currentfIndex != -1)
setCurrentProgress(currentfIndex+1);
if(currentAcquisitionIndex != -1)
setCurrentProgress(currentAcquisitionIndex+1);
#ifdef VERY_VERY_DEBUG
cout << "currentfIndex:" << currentfIndex << endl;
cout << "currentAcquisitionIndex:" << currentAcquisitionIndex << endl;
#endif
@ -579,10 +580,10 @@ void* postProcessing::processData(int delflag) {
if (dataReady){
//for random reads, ask only if it has new data
if(!newData){
if(currentfIndex > progress)
if(currentAcquisitionIndex > progress)
newData = true;
#ifdef VERY_VERY_DEBUG
cout << "currentfindex:" << currentfIndex << " progress:" << progress << endl;
cout << "currentAcquisitionIndex:" << currentAcquisitionIndex << " progress:" << progress << endl;
#endif
}
@ -595,7 +596,7 @@ void* postProcessing::processData(int delflag) {
strcpy(currentfName,"");
pthread_mutex_lock(&mg);
//int* receiverData = new int [getTotalNumberOfChannels()];
int* receiverData = readFrameFromReceiver(currentfName,currentfIndex);
int* receiverData = readFrameFromReceiver(currentfName,currentAcquisitionIndex,currentFrameIndex);
pthread_mutex_unlock(&mg);
//if detector returned null
@ -604,18 +605,18 @@ void* postProcessing::processData(int delflag) {
//no data or wrong data for print out
if(receiverData == NULL){
currentfIndex = -1;
currentAcquisitionIndex = -1;
cout<<"****Detector Data returned is NULL***"<<endl;
}
//not garbage frame
if(currentfIndex < 0){
if(currentAcquisitionIndex < 0){
#ifdef VERY_VERY_DEBUG
cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
#endif
if(receiverData)
delete [] receiverData;
}else if (currentfIndex > progress){
}else if (currentAcquisitionIndex > progress){
#ifdef VERY_VERY_DEBUG
cout << "GOT data" << endl;
#endif
@ -624,10 +625,10 @@ void* postProcessing::processData(int delflag) {
if ((fdata) && (dataReady)){
// cout << "DATAREADY 3" << endl;
thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels());
dataReady(thisData, currentfIndex, pCallbackArg);
dataReady(thisData, currentFrameIndex, pCallbackArg);
delete thisData;
fdata = NULL;
progress = currentfIndex;
progress = currentAcquisitionIndex;
#ifdef VERY_VERY_DEBUG
cout << "progress:" << progress << endl;
#endif

View File

@ -805,7 +805,7 @@ enum externalCommunicationMode{
#endif
default:
ret = FAIL;
sprintf("This timing mode %d not implemented in this detector\n",(int)arg);
sprintf(mess,"This timing mode %d not implemented in this detector\n",(int)arg);
break;
}
}