some more changes to receiver

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@696 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-11-15 12:26:46 +00:00
parent ff856d91a4
commit 3b3e4eb8c3
4 changed files with 36 additions and 20 deletions

View File

@ -1,7 +1,7 @@
CFLAGS= -DC_ONLY -fPIC
#FLAGS+= #-DVERBOSE -DVERYVERBOSE
DFLAGS= -DDACS_INT -DTHIS_PATH='"$(shell pwd)"' -DSLS_RECEIVER_FUNCTION_LIST $(shell root-config --cflags --glibs) -DMYROOT1
DFLAGS= -DDACS_INT -DTHIS_PATH='"$(shell pwd)"' -DSLS_RECEIVER_FUNCTION_LIST #$(shell root-config --cflags --glibs) -DMYROOT1
#ASM=$(shell echo "/lib/modules/`uname -r`/build/include")

View File

@ -172,7 +172,7 @@ int singlePhotonFilter::initTree(){
//file
myFile = new TFile(savefilename, "RECREATE"); /** later return error if it exists */
cout<<"File created: "<<savefilename<<endl;
//tree
char c1[10],c2[10],cdata[100];
sprintf(c1,"%d",nClusterX);
@ -235,9 +235,9 @@ int singlePhotonFilter::closeFile(){
if (myFile){
myFile = myTree->GetCurrentFile();
myFile->Close();
delete myFile;
myFile = NULL;//delete myFile;
}
delete myTree;
myTree = NULL;//delete myTree;
}
#else
if(myFile)
@ -536,12 +536,14 @@ void singlePhotonFilter::findHits(){
isData += 4096;
myData += 2048;
/*
if ((clusteriframe%1000 == 0) && (clusteriframe != 0) ){
cout << dec << "Frame: " << clusteriframe << " Hit Avg over last frames: " <<
nHitStat->Mean() << " .. "<<nHitStat->StandardDeviation() << endl;
cout<<"writing "<< nHitsPerFrame << " hits to file" << endl;
}
*/
}

View File

@ -16,7 +16,9 @@
//all max frames defined in sls_detector_defs.h. 20000 gotthard, 100000 for short gotthard, 1000 for moench
#define GOTTHARD_FIFO_SIZE 25000//11
//#define GOTTHARD_FIFO_SIZE 25000
#define GOTTHARD_FIFO_SIZE 11
#define GOTTHARD_ALIGNED_FRAME_SIZE 4096
#define GOTTHARD_PACKETS_PER_FRAME 2
#define GOTTHARD_ONE_PACKET_SIZE 1286
@ -35,7 +37,8 @@
#define GOTTHARD_PACKET_INDEX_MASK 0x1
#define GOTTHARD_NUM_JOBS_P_THREAD 5000//20000//3 with 25 frames
//#define GOTTHARD_NUM_JOBS_P_THREAD 5000//20000
#define GOTTHARD_NUM_JOBS_P_THREAD 3//with 25 frames
#define GOTTHARD_SHORT_NUM_JOBS_P_THREAD 2500//40000
#define MOENCH_NUM_JOBS_P_THREAD 1000//10000

View File

@ -540,7 +540,7 @@ int slsReceiverFunctionList::startListening(){
if (!fifofree->isEmpty()) {
if (ret!=0)
fifofree->pop(buffer);
while(!fifofree->pop(buffer));
if(ret == -3){
@ -574,6 +574,7 @@ int slsReceiverFunctionList::startListening(){
//#ifdef VERYVERBOSE
cerr << "recvfrom() failed:"<<endl;;// << receiver_threads_running<<endl;
fifofree->push(buffer);
cout<<"***************buffer pushed!!"<<(void*)buffer<<endl;
//#endif
continue;
}
@ -644,7 +645,7 @@ int slsReceiverFunctionList::startListening(){
}
}
}
cout<<"end of listening buffer with:"<<(void*)buffer<<endl;
delete tempchar;
return 0;
}
@ -833,7 +834,6 @@ int slsReceiverFunctionList::startWriting(){
/*cout<<"wbuf:"<<(void*)wbuf<<endl;*/
//filter and write
if(iJob==-2){
/*cout<<"startingmem changed"<<endl;*/
startingmem = wbuf;
/*cout<<"***************startingmem:"<<(void*)startingmem<<endl;
cout<<"mem0:"<<(void*)mem0<<endl;*/
@ -847,11 +847,19 @@ int slsReceiverFunctionList::startWriting(){
++pointinfifo;
++iJob;
/*if((((wbuf-mem0)/4096)+1)!=pointinfifo){
cout<<"+++++++++++++++++++++ wbuf:"<<(void*)wbuf<<endl;
cout<<"pointfifo:"<<pointinfifo<<endl;
cout<<"value:"<<((wbuf-mem0)/4096)+1<<endl;
cout<<"starting mem:"<<((startingmem-mem0)/4096)+1<<endl;
}*/
if(pointinfifo >= (fifosize-1)){
/*cout<<"*** sending not normally "<<iJob<<endl;
cout<<"value:"<<((startingmem-mem0)/4096)+1<<endl;
cout<<"value:"<<((wbuf-mem0)/4096)+1<<endl;
cout<<"pointfifo:"<<pointinfifo<<endl;
cout<<"iJob:"<<iJob<<endl;*/
cout<<"last sent:"<<(void*)wbuf<<endl;*/
filter->assignJobsForThread(startingmem,iJob);
startingmem = mem0;
iJob = 0;
@ -863,9 +871,10 @@ int slsReceiverFunctionList::startWriting(){
}
else if(iJob>=(numJobsPerThread)){
/*cout<<"*** sending normally "<<numJobsPerThread<<endl;
cout<<"value:"<<((startingmem-mem0)/4096)+1<<endl;
cout<<"value:"<<((wbuf-mem0)/4096)+1<<endl;
cout<<"pointfifo:"<<pointinfifo<<endl;
cout<<"iJob:"<<iJob<<endl;*/
cout<<"last sent:"<<(void*)wbuf<<endl;*/
//if(((startingmem-mem0)/4096)+numJobsPerThread)>
filter->assignJobsForThread(startingmem,numJobsPerThread);
iJob = -2;
}
@ -962,11 +971,13 @@ int slsReceiverFunctionList::startWriting(){
else{
//all jobs done
if(filter->checkIfJobsDone()){
//its all done
pthread_mutex_lock(&status_mutex);
status = RUN_FINISHED;
pthread_mutex_unlock(&(status_mutex));
cout << "Status: Run Finished" << endl;
if(fifo->isEmpty()){
//its all done
pthread_mutex_lock(&status_mutex);
status = RUN_FINISHED;
pthread_mutex_unlock(&(status_mutex));
cout << "Status: Run Finished" << endl;
}
}
}
}
@ -976,7 +987,7 @@ int slsReceiverFunctionList::startWriting(){
pthread_mutex_lock(&status_mutex);
status = RUN_FINISHED;
pthread_mutex_unlock(&(status_mutex));
cout << "Status: Run Finished" << endl;
cout << "***** Status: Run Finished *****" << endl;
}
}
//acquisition not done in detector