From 3b3e4eb8c38136da2662625bce6ee36a8bd437a9 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 15 Nov 2013 12:26:46 +0000 Subject: [PATCH] some more changes to receiver git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@696 951219d9-93cf-4727-9268-0efd64621fa3 --- slsDetectorSoftware/Makefile | 2 +- .../singlePhotonFilter.cpp | 10 +++-- .../slsReceiver/receiver_defs.h | 7 +++- .../slsReceiver/slsReceiverFunctionList.cpp | 37 ++++++++++++------- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/slsDetectorSoftware/Makefile b/slsDetectorSoftware/Makefile index 9e9e46d73..34d0d4a6f 100644 --- a/slsDetectorSoftware/Makefile +++ b/slsDetectorSoftware/Makefile @@ -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") diff --git a/slsDetectorSoftware/slsDetectorAnalysis/singlePhotonFilter.cpp b/slsDetectorSoftware/slsDetectorAnalysis/singlePhotonFilter.cpp index a8a6bb850..6b24e84c9 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/singlePhotonFilter.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/singlePhotonFilter.cpp @@ -172,7 +172,7 @@ int singlePhotonFilter::initTree(){ //file myFile = new TFile(savefilename, "RECREATE"); /** later return error if it exists */ - + cout<<"File created: "<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() << " .. "<StandardDeviation() << endl; cout<<"writing "<< nHitsPerFrame << " hits to file" << endl; } +*/ + } diff --git a/slsDetectorSoftware/slsReceiver/receiver_defs.h b/slsDetectorSoftware/slsReceiver/receiver_defs.h index ebe3f7a62..a9c800e21 100755 --- a/slsDetectorSoftware/slsReceiver/receiver_defs.h +++ b/slsDetectorSoftware/slsReceiver/receiver_defs.h @@ -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 diff --git a/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp b/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp index ba5eb001d..a5db702c3 100644 --- a/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp +++ b/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp @@ -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:"<push(buffer); + cout<<"***************buffer pushed!!"<<(void*)buffer<= (fifosize-1)){ /*cout<<"*** sending not normally "<assignJobsForThread(startingmem,iJob); startingmem = mem0; iJob = 0; @@ -863,9 +871,10 @@ int slsReceiverFunctionList::startWriting(){ } else if(iJob>=(numJobsPerThread)){ /*cout<<"*** sending normally "< 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