mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
updated svn
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@550 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
b660c0aebf
commit
c8535a15a8
@ -2,10 +2,10 @@
|
||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/gotthardDetectorServer"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||
//#define SVNREV 0x507
|
||||
//#define SVNREV 0x542
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "l_maliakal_d"
|
||||
#define SVNREV 0x507
|
||||
#define SVNDATE 0x20130411
|
||||
#define SVNREV 0x542
|
||||
#define SVNDATE 0x20130506
|
||||
//
|
||||
|
@ -2,10 +2,10 @@
|
||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/moenchDetectorServer"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||
//#define SVNREV 0x507
|
||||
//#define SVNREV 0x544
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "l_maliakal_d"
|
||||
#define SVNREV 0x507
|
||||
#define SVNDATE 0x20130411
|
||||
#define SVNREV 0x544
|
||||
#define SVNDATE 0x20130507
|
||||
//
|
||||
|
@ -2,10 +2,10 @@
|
||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/mythenDetectorServer"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||
//#define SVNREV 0x507
|
||||
//#define SVNREV 0x508
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "l_maliakal_d"
|
||||
#define SVNREV 0x507
|
||||
#define SVNREV 0x508
|
||||
#define SVNDATE 0x20130411
|
||||
//
|
||||
|
@ -2,10 +2,10 @@
|
||||
#define SVNURLLIB "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUIDLIB "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||
//#define SVNREV 0x507
|
||||
//#define SVNREV 0x549
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTHLIB "l_maliakal_d"
|
||||
#define SVNREVLIB 0x507
|
||||
#define SVNDATELIB 0x20130411
|
||||
#define SVNAUTHLIB "x04sa"
|
||||
#define SVNREVLIB 0x549
|
||||
#define SVNDATELIB 0x20130514
|
||||
//
|
||||
|
@ -430,8 +430,7 @@ void* postProcessing::processData(int delflag) {
|
||||
while(1){
|
||||
cout.flush();
|
||||
cout<<flush;
|
||||
usleep(200000);
|
||||
|
||||
usleep(20000);
|
||||
//get progress
|
||||
pthread_mutex_lock(&mg);
|
||||
caught=getReceiverCurrentFrameIndex();
|
||||
|
@ -18,6 +18,29 @@ void closeFile(int p){
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
int StartAcq(char* filepath, char*filename,int fileindex, int datasize, void*p){
|
||||
printf("--StartAcq: filepath:%s filename:%s fileindex:%d datasize:%d\n",
|
||||
filepath, filename, fileindex, datasize);
|
||||
|
||||
printf("--StartAcq: returning 0\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionFinished(int frames, void*p){
|
||||
printf("AcquisitionFinished: frames:%d why ?\n",frames);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GetData(int framenum, char* datapointer, FILE* descriptor, char* gui, void* p){
|
||||
printf("GetData: framenum: %d(%d)\n", framenum, *(int*)datapointer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int ret = slsDetectorDefs::OK;
|
||||
|
||||
@ -52,6 +75,10 @@ int main(int argc, char *argv[]) {
|
||||
//receiver->registerCallBackStartAcquisition(func,arg);
|
||||
|
||||
|
||||
|
||||
printf("Registering StartAcq()\n");
|
||||
receiver->registerCallBackStartAcquisition(StartAcq, NULL);
|
||||
|
||||
/**
|
||||
callback argument is
|
||||
total farmes caught
|
||||
@ -61,6 +88,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
//receiver->registerCallBackAcquisitionFinished(func,arg);
|
||||
|
||||
printf("Registering AcquisitionFinished()\n");
|
||||
receiver->registerCallBackAcquisitionFinished(AcquisitionFinished, NULL);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -80,6 +110,12 @@ int main(int argc, char *argv[]) {
|
||||
//receiver->registerCallBackRawDataReady(func,arg);
|
||||
|
||||
|
||||
printf("Registering GetData() \n");
|
||||
|
||||
|
||||
receiver->registerCallBackRawDataReady(GetData,NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
receiver->start();
|
||||
|
@ -86,6 +86,7 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det,bool moenchwit
|
||||
strcpy(filePath,"");
|
||||
strcpy(fileName,"run");
|
||||
guiFileName = new char[MAX_STR_LENGTH];
|
||||
strcpy(guiFileName,"");
|
||||
eth = new char[MAX_STR_LENGTH];
|
||||
strcpy(eth,"");
|
||||
|
||||
@ -439,6 +440,9 @@ int slsReceiverFunctionList::startWriting(){
|
||||
if(sfilefd) sfilefd=0;
|
||||
strcpy(savefilename,"");
|
||||
|
||||
//reset this before each acq or you send old data
|
||||
guiData = NULL;
|
||||
strcpy(guiFileName,"");
|
||||
|
||||
cout << "Max Frames Per File:" << maxFramesPerFile << endl;
|
||||
if (writeReceiverData)
|
||||
@ -515,6 +519,8 @@ int slsReceiverFunctionList::startWriting(){
|
||||
currframenum = (int)(*((int*)wbuf));
|
||||
else
|
||||
currframenum = (((int)(*((int*)wbuf))) & (frameIndexMask)) >> frameIndexOffset;
|
||||
|
||||
|
||||
//currframenum = (int)(*((int*)wbuf));
|
||||
//cout<<"**************curreframenm:"<<currframenum<<endl;
|
||||
|
||||
@ -536,8 +542,16 @@ int slsReceiverFunctionList::startWriting(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
//wait for gui data for 100ms
|
||||
if(nFrameToGui){
|
||||
for(int i=0;i<10;i++)
|
||||
if(guiData)
|
||||
break;
|
||||
else
|
||||
usleep(10000);//10ms
|
||||
}
|
||||
*/
|
||||
//copies gui data and sets/resets guiDataReady
|
||||
if(guiData){
|
||||
memcpy(latestData,wbuf,bufferSize);
|
||||
@ -586,31 +600,20 @@ int slsReceiverFunctionList::startWriting(){
|
||||
void slsReceiverFunctionList::readFrame(char* c,char** raw){
|
||||
|
||||
//point to gui data
|
||||
if (guiData == NULL){
|
||||
if (guiData == NULL)
|
||||
guiData = latestData;
|
||||
}else
|
||||
cout<<"gui data was not null" << endl;
|
||||
|
||||
//wait for gui data to be ready, not indefinitely
|
||||
for(int i=0;i<10;i++){
|
||||
if(!guiDataReady)
|
||||
usleep(100000);
|
||||
else
|
||||
break;
|
||||
}
|
||||
//copy data and filename
|
||||
strcpy(c,guiFileName);
|
||||
|
||||
//could not get gui data
|
||||
if(!guiDataReady)
|
||||
*raw = NULL;
|
||||
//data ready, set guidata to receive new data
|
||||
else{
|
||||
*raw = guiData;
|
||||
guiData = NULL;
|
||||
|
||||
//copy data and filename
|
||||
if(guiFileName)
|
||||
strcpy(c,guiFileName);
|
||||
else
|
||||
strcpy(c,"");
|
||||
*raw = guiData;
|
||||
|
||||
guiData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -943,26 +943,22 @@ int slsReceiverFuncs::moench_read_frame(){
|
||||
|
||||
// execute action if the arguments correctly arrived
|
||||
#ifdef SLS_RECEIVER_FUNCTION_LIST
|
||||
ret=FAIL;
|
||||
strcpy(mess,"did not start index\n");
|
||||
for(i=0;i<10;i++){
|
||||
startIndex=slsReceiverList->getStartFrameIndex();
|
||||
if(startIndex!=-1){
|
||||
ret=OK;
|
||||
break;
|
||||
}else
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
startIndex=slsReceiverList->getStartFrameIndex();
|
||||
|
||||
if(ret==FAIL)
|
||||
cout<<"failed to start"<<endl;
|
||||
/**send garbage with -1 index to try again*/
|
||||
if(startIndex==-1)
|
||||
cout<<"hadnt started yet"<<endl;
|
||||
else{
|
||||
ret = OK;
|
||||
//get frame
|
||||
slsReceiverList->readFrame(fName,&raw);
|
||||
/**send garbage with -1 index to try again*/
|
||||
if (raw == NULL){
|
||||
index = startIndex-1;
|
||||
cout << "didnt get data. Gui will try again" << endl;
|
||||
#ifdef VERBOSE
|
||||
cout<<"data not ready for gui yet"<<endl;
|
||||
#endif
|
||||
}else{
|
||||
//upto 40 indices, look at just index1 and index2 for now
|
||||
index=(int)(*(int*)raw);
|
||||
@ -1069,16 +1065,15 @@ int slsReceiverFuncs::moench_read_frame(){
|
||||
//********************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
arg=index - startIndex;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "\nstartIndex:" << startIndex << endl;
|
||||
cout << "fName:" << fName << endl;
|
||||
cout << "index:" << arg << endl;
|
||||
cout << "\nstartIndex:" << startIndex << endl;
|
||||
cout << "fName:" << fName << endl;
|
||||
cout << "index:" << arg << endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -1121,8 +1116,10 @@ int slsReceiverFuncs::gotthard_read_frame(){
|
||||
//retval is a full frame
|
||||
int rnel = GOTTHARD_BUFFER_SIZE/(sizeof(int));
|
||||
int* retval = new int[rnel];
|
||||
int* origVal = new int[rnel];
|
||||
//all initialized to 0
|
||||
for(i=0;i<rnel;i++) retval[i]=0;
|
||||
for(i=0;i<rnel;i++) origVal[i]=0;
|
||||
|
||||
//only for full frames
|
||||
int onebuffersize = GOTTHARD_BUFFER_SIZE/GOTTHARD_PACKETS_PER_FRAME;
|
||||
@ -1134,7 +1131,7 @@ int slsReceiverFuncs::gotthard_read_frame(){
|
||||
if(shortFrame!=-1)
|
||||
bufferSize=GOTTHARD_SHORT_BUFFER_SIZE;
|
||||
char* raw = new char[bufferSize];
|
||||
int* origVal = new int[rnel];
|
||||
|
||||
|
||||
//int* emptys = new int[rnel]();
|
||||
|
||||
@ -1148,61 +1145,41 @@ int slsReceiverFuncs::gotthard_read_frame(){
|
||||
// execute action if the arguments correctly arrived
|
||||
#ifdef SLS_RECEIVER_FUNCTION_LIST
|
||||
|
||||
//wait till you get first frame 1. to get index(from startindex 2. filename corresponds to buffer value
|
||||
ret=FAIL;
|
||||
strcpy(mess,"did not start index\n");
|
||||
for(int i=0;i<10;i++){
|
||||
startIndex=slsReceiverList->getStartFrameIndex();
|
||||
if(startIndex!=-1){
|
||||
ret=OK;
|
||||
break;
|
||||
}else
|
||||
usleep(500000);
|
||||
}
|
||||
|
||||
startIndex=slsReceiverList->getStartFrameIndex();
|
||||
/**send garbage with -1 index to try again*/
|
||||
if(startIndex==-1)
|
||||
cout<<"hadnt started yet"<<endl;
|
||||
else{
|
||||
ret = OK;
|
||||
|
||||
//got atleast first frame, read buffer
|
||||
if(ret==OK){
|
||||
if(shortFrame!=-1){
|
||||
//get frame
|
||||
slsReceiverList->readFrame(fName,&raw);
|
||||
//sending garbage values with index = -1 to try again
|
||||
if (raw == NULL){
|
||||
index = startIndex;
|
||||
memcpy((((char*)retval)+(GOTTHARD_SHORT_DATABYTES*shortFrame)),((char*) origVal)+4, GOTTHARD_SHORT_DATABYTES);
|
||||
}else{
|
||||
index=(int)(*(int*)raw);
|
||||
memcpy(origVal,raw,bufferSize);
|
||||
raw=NULL;
|
||||
//get frame
|
||||
slsReceiverList->readFrame(fName,&raw);
|
||||
/**send garbage with -1 index to try again*/
|
||||
if (raw == NULL){
|
||||
index = startIndex;
|
||||
#ifdef VERBOSE
|
||||
cout<<"data not ready for gui yet"<<endl;
|
||||
#endif
|
||||
}else{
|
||||
index=(int)(*(int*)raw);
|
||||
if(shortFrame==-1)
|
||||
index2= (int)(*((int*)((char*)(raw+onebuffersize))));
|
||||
memcpy(origVal,raw,bufferSize);
|
||||
raw=NULL;
|
||||
|
||||
//copy only the adc part
|
||||
//1 adc
|
||||
if(shortFrame!=-1){
|
||||
memcpy((((char*)retval)+(GOTTHARD_SHORT_DATABYTES*shortFrame)),((char*) origVal)+4, GOTTHARD_SHORT_DATABYTES);
|
||||
}
|
||||
|
||||
}else{
|
||||
//for full frames
|
||||
while(count<10){
|
||||
//get frame
|
||||
slsReceiverList->readFrame(fName,&raw);
|
||||
if (raw == NULL){
|
||||
count = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
index=(int)(*(int*)raw);
|
||||
index2= (int)(*((int*)((char*)(raw+onebuffersize))));
|
||||
memcpy(origVal,raw,bufferSize);
|
||||
raw=NULL;
|
||||
//cout<<"funcs\tindex:"<<index<<"\tindex2:"<<index2<<endl;
|
||||
|
||||
|
||||
//all adc
|
||||
else{
|
||||
//1 odd, 1 even
|
||||
if((index%2)!=index2%2){
|
||||
//ideal situation (should be odd, even(index+1))
|
||||
if(index%2){
|
||||
memcpy(retval,((char*) origVal)+4, onedatasize);
|
||||
memcpy((((char*)retval)+onedatasize), ((char*) origVal)+10+onedatasize, onedatasize);
|
||||
break;
|
||||
}
|
||||
|
||||
//swap to even,odd
|
||||
@ -1210,29 +1187,13 @@ int slsReceiverFuncs::gotthard_read_frame(){
|
||||
memcpy((((char*)retval)+onedatasize),((char*) origVal)+4, onedatasize);
|
||||
memcpy(retval, ((char*) origVal)+10+onedatasize, onedatasize);
|
||||
index=index2;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
strcpy(mess,"could not read frame due to more than 20 mismatched indices\n");
|
||||
|
||||
usleep(100000);
|
||||
count++;
|
||||
}
|
||||
|
||||
if ((count==10) || (count == -1)){
|
||||
if (count == -10)
|
||||
}else
|
||||
cout << "same type: index:" << index << "\tindex2:" << index2 << endl;
|
||||
else
|
||||
cout << "no data to read for gui" << endl;
|
||||
/**send garbage with -1 index to try again*/
|
||||
index = startIndex;
|
||||
memcpy(retval,((char*) origVal)+4, onedatasize);
|
||||
memcpy((((char*)retval)+onedatasize), ((char*) origVal)+10+onedatasize, onedatasize);
|
||||
}
|
||||
}
|
||||
|
||||
arg=((index - startIndex)/packetsPerFrame)-1;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "\nstartIndex:" << startIndex << endl;
|
||||
@ -1240,7 +1201,6 @@ int slsReceiverFuncs::gotthard_read_frame(){
|
||||
cout << "index:" << arg << endl;
|
||||
#endif
|
||||
|
||||
}else cout<<"failed to start"<<endl;
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -2,10 +2,10 @@
|
||||
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/slsReceiver"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3"
|
||||
//#define SVNREV 0x507
|
||||
//#define SVNREV 0x548
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "l_maliakal_d"
|
||||
#define SVNREV 0x507
|
||||
#define SVNDATE 0x20130411
|
||||
#define SVNREV 0x548
|
||||
#define SVNDATE 0x20130513
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user