diff --git a/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.h b/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.h index 34e5b05b7..f74b65664 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.h +++ b/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.h @@ -1,6 +1,9 @@ #ifndef COMMUNICATION_FUNCS_H #define COMMUNICATION_FUNCS_H +#include "sls_detector_defs.h" + + #define SEND_REC_MAX_SIZE 4096 #define DEFAULT_PORTNO 1952 #include diff --git a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.h b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.h index f89e77b20..88c140f18 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.h +++ b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.h @@ -2,6 +2,9 @@ #define FIRMWARE_FUNCS_H +#include "sls_detector_defs.h" + + #include #include #include diff --git a/slsDetectorSoftware/gotthardDetectorServer/registers_g.h b/slsDetectorSoftware/gotthardDetectorServer/registers_g.h index 9a6759cfe..02275c479 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/registers_g.h +++ b/slsDetectorSoftware/gotthardDetectorServer/registers_g.h @@ -2,6 +2,9 @@ #define REGISTERS_G_H +#include "sls_detector_defs.h" + + /* Definitions for FPGA*/ #define CSP0 0x20200000 #define MEM_SIZE 0x100000 diff --git a/slsDetectorSoftware/gotthardDetectorServer/server.c b/slsDetectorSoftware/gotthardDetectorServer/server.c index 403e6bd2e..686f35bc5 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/server.c +++ b/slsDetectorSoftware/gotthardDetectorServer/server.c @@ -1,5 +1,8 @@ /* A simple server in the internet domain using TCP The port number is passed as an argument */ + +#include "sls_detector_defs.h" + #include "communication_funcs.h" #include "server_funcs.h" #include diff --git a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.h b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.h index cf014cb01..a71664b9d 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.h +++ b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.h @@ -1,5 +1,10 @@ #ifndef SERVER_FUNCS_H #define SERVER_FUNCS_H + + +#include "sls_detector_defs.h" + + #include /* #include diff --git a/slsDetectorSoftware/gotthardDetectorServer/sharedmemory.h b/slsDetectorSoftware/gotthardDetectorServer/sharedmemory.h index f55e751e3..bdbddf719 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/sharedmemory.h +++ b/slsDetectorSoftware/gotthardDetectorServer/sharedmemory.h @@ -1,6 +1,7 @@ #ifndef SM #define SM +#include "sls_detector_defs.h" #include #include diff --git a/slsDetectorSoftware/gotthardDetectorServer/stop_server.c b/slsDetectorSoftware/gotthardDetectorServer/stop_server.c index 571c9a978..e3c8ff7e1 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/stop_server.c +++ b/slsDetectorSoftware/gotthardDetectorServer/stop_server.c @@ -1,5 +1,10 @@ /* A simple server in the internet domain using TCP The port number is passed as an argument */ + + +#include "sls_detector_defs.h" + + #include "communication_funcs.h" #include "firmware_funcs.h" diff --git a/slsDetectorSoftware/gotthardDetectorServer/trimming_funcs.h b/slsDetectorSoftware/gotthardDetectorServer/trimming_funcs.h index c41451008..42ecea24a 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/trimming_funcs.h +++ b/slsDetectorSoftware/gotthardDetectorServer/trimming_funcs.h @@ -1,5 +1,8 @@ #ifndef TRIMMING_FUNCS_H #define TRIMMING_FUNCS_H + +#include "sls_detector_defs.h" + int trim_fixed_settings(int countlim, int par2, int imod); int trim_with_noise(int countlim, int nsigma, int imod); int trim_with_beam(int countlim, int nsigma, int imod); diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 8186ae21e..9aee67377 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -3701,11 +3701,11 @@ int multiSlsDetector::getFramesCaughtByReceiver() { -int multiSlsDetector::getCurrentFrameIndex() { +int multiSlsDetector::getReceiverCurrentFrameIndex() { int ret=0,ret1=0; for (int i=0; inumberOfDetectors; i++) if (detectors[i]) - ret1+=detectors[i]->getCurrentFrameIndex(); + ret1+=detectors[i]->getReceiverCurrentFrameIndex(); if(!thisMultiDetector->numberOfDetectors) return ret; diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h index 111622df0..116973b2e 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h @@ -1084,7 +1084,7 @@ class multiSlsDetector : public slsDetectorUtils { /** gets the current frame index of receiver \returns current frame index of receiver */ - int getCurrentFrameIndex(); + int getReceiverCurrentFrameIndex(); /** * resets framescaught diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 1c7f2df95..6c0e3efa7 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -5773,7 +5773,7 @@ int slsDetector::getFramesCaughtByReceiver(){ -int slsDetector::getCurrentFrameIndex(){ +int slsDetector::getReceiverCurrentFrameIndex(){ int fnum=F_GET_FRAME_INDEX; int ret = FAIL; int retval=-1; diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index ed727a842..99c8742e9 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -1461,7 +1461,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion { /** gets the current frame index of receiver \returns current frame index of receiver */ - int getCurrentFrameIndex(); + int getReceiverCurrentFrameIndex(); /** * resets framescaught diff --git a/slsDetectorSoftware/slsDetector/slsDetectorBase.h b/slsDetectorSoftware/slsDetector/slsDetectorBase.h index 4025dd9d9..3e6da4cd3 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorBase.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorBase.h @@ -455,7 +455,7 @@ class slsDetectorBase : public virtual slsDetectorDefs { /** \returns current frame index of receiver */ - virtual int getCurrentFrameIndex()=0; + virtual int getReceiverCurrentFrameIndex()=0; /** Locks/Unlocks the connection to the receiver /param lock sets (1), usets (0), gets (-1) the lock diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index ce46ca079..4fff5b2fc 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -3609,7 +3609,7 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) { if (action==PUT_ACTION) return string("cannot put"); else{ - sprintf(answer,"%d",myDet->getCurrentFrameIndex()); + sprintf(answer,"%d",myDet->getReceiverCurrentFrameIndex()); return string(answer); } } diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp index 30d8293a2..b081346ce 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp @@ -233,6 +233,7 @@ void slsDetectorUtils::acquire(int delflag){ get_i0(0, IOarg); } + setCurrentFrameIndex(0); if ((timerValue[FRAME_NUMBER]*timerValue[CYCLES_NUMBER])>1) { setFrameIndex(0); } else { diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h index d782857d0..246d6326c 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h @@ -620,7 +620,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing { /** \returns current frame index of receiver */ -virtual int getCurrentFrameIndex()=0; +virtual int getReceiverCurrentFrameIndex()=0; /** * resets framescaught diff --git a/slsDetectorSoftware/slsDetectorAnalysis/fileIO.h b/slsDetectorSoftware/slsDetectorAnalysis/fileIO.h index e934b5fd4..7752981dc 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/fileIO.h +++ b/slsDetectorSoftware/slsDetectorAnalysis/fileIO.h @@ -30,7 +30,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase { /** default constructor */ - fileIO(): fileIOStatic(){frameIndex=-1;detIndex=-1; framesPerFile=&nframes; nframes=1; }; + fileIO(): fileIOStatic(){currentFrameIndex=-1;frameIndex=-1;detIndex=-1; framesPerFile=&nframes; nframes=1; }; /** virtual destructor */ virtual ~fileIO(){}; @@ -65,12 +65,19 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase { virtual int setFileIndex(int i) {*fileIndex=i; return *fileIndex;}; /** - sets the default output file index - \param i frame index to be set - \returns actual frame index + sets the default output file frame index + \param i file frame index to be set + \returns actual file frame index */ virtual int setFrameIndex(int i) {frameIndex=i; return frameIndex;}; + /** + sets the default output current frame index + \param i current frame index to be set + \returns actual current frame index + */ + virtual int setCurrentFrameIndex(int i) {currentFrameIndex=i; return currentFrameIndex;}; + /** sets the default output file index \param i frame index to be set @@ -101,15 +108,25 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase { virtual int getFileIndex() {return *fileIndex;}; /** - \returns the output frame index + \returns the output file frame index */ virtual int getFrameIndex() {return frameIndex;}; + /** + \returns the output current frame index + */ + virtual int getCurrentFrameIndex() {return currentFrameIndex;}; + /** \returns the detector index */ virtual int getDetectorIndex() {return detIndex;}; + /** + \returns the max frames per file + */ + virtual int getFramesPerFile() {return *framesPerFile;}; + string createFileName(); @@ -259,7 +276,9 @@ yes */ void incrementFileIndex() { (*fileIndex)++; }; - void incrementFrameIndex() { (frameIndex)++; }; + void incrementFrameIndex(int i) { frameIndex=frameIndex+i; }; + + void incrementCurrentFrameIndex() { (currentFrameIndex)++; }; void incrementDetectorIndex() { (detIndex)++; }; @@ -279,8 +298,10 @@ yes */ char *fileName; /** file index */ int *fileIndex; - /** frame index */ + /** file frame index */ int frameIndex; + /** current frame index */ + int currentFrameIndex; /** detector id */ int detIndex; /** frames per file */ diff --git a/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp b/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp index 76ad57c36..63c4c9bbf 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/postProcessing.cpp @@ -119,7 +119,7 @@ void postProcessing::processFrame(int *myData, int delflag) { //uses static function?!?!?!? writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i'); } else { - writeDataFile ((void*)myData, frameIndex); + writeDataFile ((void*)myData, currentFrameIndex); } #ifdef VERBOSE cout << "done " << endl; @@ -131,14 +131,22 @@ void postProcessing::processFrame(int *myData, int delflag) { } else if (dataReady){ thisData=new detectorData(fdata,NULL,NULL,getCurrentProgress(),(fname+string(".raw")).c_str(),getTotalNumberOfChannels()); - dataReady(thisData, -1, pCallbackArg); + dataReady(thisData, currentFrameIndex, pCallbackArg); delete thisData; fdata=NULL; } } - - if (getFrameIndex()>=0) - incrementFrameIndex(); + + incrementCurrentFrameIndex(); + if (getFrameIndex()>=0){ + if (getDetectorsType()==MYTHEN) + incrementFrameIndex(1); + else if((currentFrameIndex%getFramesPerFile())==0) + incrementFrameIndex(getFramesPerFile()); + } + + + @@ -243,7 +251,7 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) { if (dataReady) { thisData=new detectorData(val,err,ang,getCurrentProgress(),(fname+ext).c_str(),np); - dataReady(thisData, -1, pCallbackArg); + dataReady(thisData, currentFrameIndex, pCallbackArg); delete thisData; ang=NULL; val=NULL; @@ -386,7 +394,7 @@ void* postProcessing::processData(int delflag) { //receiver else{ pthread_mutex_lock(&mg); - int prevCaught=getCurrentFrameIndex(); + int prevCaught=getReceiverCurrentFrameIndex(); pthread_mutex_unlock(&mg); int caught=0; @@ -400,7 +408,7 @@ void* postProcessing::processData(int delflag) { usleep(200000); pthread_mutex_lock(&mg); - caught=getCurrentFrameIndex(); + caught=getReceiverCurrentFrameIndex(); pthread_mutex_unlock(&mg); incrementProgress(caught-prevCaught); if(caught-prevCaught) newData=true;