major changes with inheritances

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@118 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi 2012-02-17 09:43:46 +00:00
parent 6778060b56
commit a556b2a7da
11 changed files with 9182 additions and 5738 deletions

View File

@ -1,11 +1,11 @@
CFLAGS= -DC_ONLY
FLAGS=-DVERBOSE
INCLUDES= -I commonFiles -I slsDetector -I MySocketTCP -I usersFunctions #-I multiSlsDetector
INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand
#-I eigerDetector -ImythenDetector -IgotthardDetector
#EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/SL5-x86/ -Wl,-R/usr/local/epics/base/lib/SL5-x86 -lca -lCom
SRC_CLNT= slsDetector/slsDetector.cpp MySocketTCP/MySocketTCP.cxx usersFunctions/usersFunctions.c #multiSlsDetector/multiSlsDetector.cpp
SRC_CLNT= slsDetector/slsDetector.cpp MySocketTCP/MySocketTCP.cxx usersFunctions/usersFunctions.c multiSlsDetector/multiSlsDetector.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp
#mythenDetector/mythenDetector.cpp eigerDetector/eigerDetector.cpp gotthardDetector/gotthardDetector.cpp
SRC_MYTHEN_SVC = mythenDetectorServer/server.c mythenDetectorServer/server_funcs.c mythenDetectorServer/communication_funcs.c mythenDetectorServer/firmware_funcs.c mythenDetectorServer/mcb_funcs.c mythenDetectorServer/trimming_funcs.c
#mythenDetectorServer/sharedmemory.c
@ -28,22 +28,20 @@ picassoServer: $(SRC_MYTHEN_SVC)
package: $(SRC_CLNT)
# $(CXX) -fPIC -g -o objs/multiSlsDetector.o -c -Wall multiSlsDetector/multiSlsDetector.cpp $(INCLUDES) $(FLAGS)
$(CXX) -fPIC -g -o objs/slsDetector.o -c -Wall slsDetector/slsDetector.cpp $(INCLUDES) $(FLAGS)
# $(CXX) -fPIC -g -o objs/eigerDetector.o -c -Wall eigerDetector/eigerDetector.cpp $(INCLUDES) $(FLAGS)
# $(CXX) -fPIC -g -o objs/mythenDetector.o -c -Wall mythenDetector/mythenDetector.cpp $(INCLUDES) $(FLAGS)
# $(CXX) -fPIC -g -o objs/gotthardDetector.o -c -Wall gotthardDetector/gotthardDetector.cpp $(INCLUDES) $(FLAGS)
package: $(SRC_CLNT)
$(CXX) -fPIC -g -o objs/slsDetectorCommand.o -c -Wall slsDetector/slsDetectorCommand.cpp $(INCLUDES) $(FLAGS)
$(CXX) -fPIC -g -o objs/slsDetectorUtils.o -c -Wall slsDetector/slsDetectorUtils.cpp $(INCLUDES) $(FLAGS)
$(CXX) -fPIC -g -o objs/slsDetector.o -c -Wall slsDetector/slsDetector.cpp $(INCLUDES) $(FLAGS)
$(CXX) -fPIC -g -o objs/multiSlsDetector.o -c -Wall multiSlsDetector/multiSlsDetector.cpp $(INCLUDES) $(FLAGS)
$(CXX) -fPIC -g -o objs/usersFunctions.o -c -Wall usersFunctions/usersFunctions.c $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
$(CXX) -fPIC -g -o objs/MySocketTCP.o -c -Wall MySocketTCP/MySocketTCP.cpp $(INCLUDES) $(FLAGS)
# $(CXX) -fPIC -g -o objs/multiSDetector.o -c -Wall multiSlsDetector/multiSlsDetector.cpp $(INCLUDES) $(FLAGS)
# $(CXX) -shared -Wl,-soname,libSlsDetector.so.1 -o libSlsDetector.so.1.0.1 objs/slsDetector.o objs/usersFunctions.o objs/MySocketTCP.o objs/multiSDetector.o -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
$(CXX) -shared -Wl,-soname,libSlsDetector.so.1 -o libSlsDetector.so.1.0.1 objs/slsDetector.o objs/usersFunctions.o objs/MySocketTCP.o -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
$(CXX) -shared -Wl,-soname,libSlsDetector.so.1 -o libSlsDetector.so.1.0.1 objs/slsDetector.o objs/slsDetectorUtils.o objs/slsDetectorCommand.o objs/multiSlsDetector.o objs/usersFunctions.o objs/MySocketTCP.o -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS)
#objs/mythenDetector.o objs/gotthardDetector.o
ln -sf libSlsDetector.so.1.0.1 libSlsDetector.so
ln -sf libSlsDetector.so libSlsDetector.so.1.0.1
ln -sf libSlsDetector.so.1 libSlsDetector.so
ar rcs libSlsDetector.a objs/slsDetector.o objs/usersFunctions.o objs/MySocketTCP.o #objs/multiSlsDetector.o
#objs/mythenDetector.o objs/gotthardDetector.o
ar rcs libSlsDetector.a objs/slsDetector.o objs/usersFunctions.o objs/MySocketTCP.o objs/multiSlsDetector.o objs/slsDetectorUtils.o objs/slsDetectorCommand.o
clean:
rm -rf libSlsDetector.so.1.0.1 libSlsDetector.so core objs/* docs/*
@ -64,6 +62,9 @@ install_inc:
# cp -P ../slsDetectorSoftware/mythenDetector/mythenDetector.h $(DESTDIR)
# cp -P ../slsDetectorSoftware/gotthardDetector/gotthardDetector.h $(DESTDIR)
cp -P ../slsDetectorSoftware/slsDetector/slsDetector.h $(DESTDIR)
cp -P ../slsDetectorSoftware/slsDetector/slsDetectorUtils.h $(DESTDIR)
cp -P ../slsDetectorSoftware/slsDetector/slsDetectorCommand.h $(DESTDIR)
cp -P ../slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h $(DESTDIR)
cp -P ../slsDetectorSoftware/commonFiles/sls_detector_defs.h $(DESTDIR)
cp -P ../slsDetectorSoftware/usersFunctions/usersFunctions.h $(DESTDIR)

View File

@ -3,8 +3,16 @@
#include <stdint.h>
/** default maximum string length */
#define MAX_STR_LENGTH 1000
/** default maximum string length */
#define MAX_SCAN_STEPS 2000
typedef float float32_t;
typedef int int32_t;
typedef int int32_t;
typedef char mystring[MAX_STR_LENGTH];
typedef float mysteps[MAX_SCAN_STEPS];
/**
\file sls_detector_defs.h
@ -17,11 +25,14 @@ and to the server programs running on the detector
* @see slsDetector
*/
/** default maximum string length */
#define MAX_STR_LENGTH 1000
/** get flag form most functions */
#define GET_FLAG -1
enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS};
/**
structure for a detector channel
should not be used by unexperienced users
@ -100,7 +111,6 @@ typedef struct {
*/
typedef struct {
int len; /**< is the number of elements of the array */
int *iptr; /**< is the pointer to the array */
} iarray ;
@ -128,6 +138,37 @@ enum communicationProtocol{
UDP /**< UDP */
};
/**
Communication protocol (normally TCP)
*/
enum networkParameter {
CLIENT_IP, /**< client IP */
CLIENT_MAC, /**< client mac */
SERVER_MAC /**< server MAC */
};
/**
type of action performed (for text client)
*/
enum {GET_ACTION, PUT_ACTION, READOUT_ACTION, HELP_ACTION};
/** online flags enum \sa setOnline*/
enum {GET_ONLINE_FLAG=-1, /**< returns wether the detector is in online or offline state */
OFFLINE_FLAG=0, /**< detector in offline state (i.e. no communication to the detector - using only local structure - no data acquisition possible!) */
ONLINE_FLAG =1/**< detector in online state (i.e. communication to the detector updating the local structure) */
};
/** synchronization of the various detectors (should be set for each detector individually?!?!?) */
enum synchronizationMode {
GET_SYNCHRONIZATION_MODE=-1, /**< the multidetector will return its synchronization mode */
NONE, /**< all detectors are independent (no cabling) */
MASTER_GATES, /**< the master gates the other detectors */
MASTER_TRIGGERS, /**< the master triggers the other detectors */
SLAVE_STARTS_WHEN_MASTER_STOPS /**< the slave acquires when the master finishes, to avoid deadtime */
};
/**
flags to get (or set) the size of the detector

File diff suppressed because it is too large Load Diff

View File

@ -13,26 +13,17 @@ ID: $Id$
#ifndef MULTI_SLS_DETECTOR_H
#define MULTI_SLS_DETECTOR_H
#include "slsDetector.h"
#include "slsDetectorUtils.h"
#include "sls_detector_defs.h"
class slsDetector;
//#include "sls_detector_defs.h"
#define MAXDET 100
//using namespace std;
/** synchronization of the various detectors (should be set for each detector individually?!?!?) */
enum synchronizationMode {
GET_SYNCHRONIZATION_MODE=-1, /**< the multidetector will return its synchronization mode */
NONE, /**< all detectors are independent (no cabling) */
MASTER_GATES, /**< the master gates the other detectors */
MASTER_TRIGGERS, /**< the master triggers the other detectors */
SLAVE_STARTS_WHEN_MASTER_STOPS /**< the slave acquires when the master finishes, to avoid deadtime */
};
/**
@ -46,7 +37,7 @@ ID: $Id$
*/
class multiSlsDetector {
class multiSlsDetector : public slsDetectorUtils {
@ -98,11 +89,12 @@ class multiSlsDetector {
/** timer values */
int64_t timerValue[MAX_TIMERS];
int64_t timerValue[MAX_TIMERS]; // needed?!?!?!?
/** detector settings (standard, fast, etc.) */
detectorSettings currentSettings;
detectorSettings currentSettings; // needed?!?!?!?
/** detector threshold (eV) */
int currentThresholdEV;
int currentThresholdEV; // needed?!?!?!?
/** indicator for the acquisition progress - set to 0 at the beginning of the acquisition and incremented every time that the data are written to file */
@ -138,8 +130,12 @@ class multiSlsDetector {
/** file with the bad channels */
char badChanFile[MAX_STR_LENGTH];
/** angular conversion file */
char angConvFile[MAX_STR_LENGTH];
/** array of angular conversion constants for each module \see ::angleConversionConstant */
angleConversionConstant angOff[MAXMODS];
//angleConversionConstant angOff[MAXMODS];
/** angular direction (1 if it corresponds to the encoder direction i.e. channel 0 is 0, maxchan is positive high angle, 0 otherwise */
int angDirection;
/** beamline fine offset (of the order of mdeg, might be adjusted for each measurements) */
@ -158,16 +154,16 @@ class multiSlsDetector {
int actionMask;
int actionMode[MAX_ACTIONS];
char actionScript[MAX_ACTIONS][MAX_STR_LENGTH];
char actionParameter[MAX_ACTIONS][MAX_STR_LENGTH];
//int actionMode[MAX_ACTIONS];
mystring actionScript[MAX_ACTIONS];
mystring actionParameter[MAX_ACTIONS];
int scanMode[MAX_SCAN_LEVELS];
char scanScript[MAX_SCAN_LEVELS][MAX_STR_LENGTH];
char scanParameter[MAX_SCAN_LEVELS][MAX_STR_LENGTH];
mystring scanScript[MAX_SCAN_LEVELS];
mystring scanParameter[MAX_SCAN_LEVELS];
int nScanSteps[MAX_SCAN_LEVELS];
float scanSteps[MAX_SCAN_LEVELS][MAX_SCAN_STEPS];
mysteps scanSteps[MAX_SCAN_LEVELS];
int scanPrecision[MAX_SCAN_LEVELS];
@ -192,6 +188,19 @@ class multiSlsDetector {
public:
using slsDetectorUtils::flatFieldCorrect;
using slsDetectorUtils::rateCorrect;
using slsDetectorUtils::setBadChannelCorrection;
using slsDetectorUtils::readAngularConversion;
using slsDetectorUtils::writeAngularConversion;
using slsDetectorUtils::resetMerging;
using slsDetectorUtils::finalizeMerging;
using slsDetectorUtils::addToMerging;
using slsDetectorUtils::readDataFile;
using slsDetectorUtils::writeDataFile;
using slsDetectorUtils::createFileName;
/**
@short Structure allocated in shared memory to store detector settings and be accessed in parallel by several applications (take care of possible conflicts!)
@ -218,8 +227,14 @@ class multiSlsDetector {
/** adds the detector with ID id in postion pos
\param id of the detector to be added (should already exist!)
\param pos position where it should be added (normally at the end of the list (default to -1)
\return the actual number of detectors*/
int addSlsDetector(int id, int pos=-1, int oX=-1, int oY=-1);
\return the actual number of detectors or -1 if it failed*/
int addSlsDetector(int id, int pos=-1);
/** adds the detector with ID id in postion pos
\param name of the detector to be added (should already exist in shared memory or at least be online)
\param pos position where it should be added (normally at the end of the list (default to -1)
\return the actual number of detectors or -1 if it failed*/
int addSlsDetector(char *name, int pos=-1);
/**removes the detector in position pos from the multidetector
\param pos position of the detector to be removed from the multidetector system (defaults to -1 i.e. last detector)
@ -227,17 +242,44 @@ class multiSlsDetector {
*/
int removeSlsDetector(int pos=-1);
/**removes the detector in position pos from the multidetector
\param name is the name of the detector
\returns the actual number of detectors
*/
int removeSlsDetector(char *name);
string setHostname(char*, int pos=-1);
string getHostname(int pos=-1);
/** adds a detector by id in position pos
\param ival detector id to be added
\param pos position to add it (-1 fails)
\returns detector ID or -1 if detector in position i is empty
*/
int setDetectorId(int ival, int pos=-1);
/** returns the id of the detector in position i
\param i position of the detector
\returns detector ID or -1 if detector in position i is empty*/
int getDetectorId(int i) {if (i>=0) if (detectors[i]) return detectors[i]->getDetectorId(); else return -1;};
int getDetectorId(int i);
/** returns the number of detectors in the multidetector structure
\returns number of detectors */
int getNumberOfDetectors() {return thisMultiDetector->numberOfDetectors;};
int getTotalNumberOfChannels(){return thisMultiDetector->numberOfChannels;};
float getScanStep(int index, int istep){return thisMultiDetector->scanSteps[index][istep];};
/** returns the detector offset (in number of channels)
\param pos position of the detector
\param ox reference to the offset in x
@ -265,21 +307,29 @@ class multiSlsDetector {
/**
Sets/gets the synchronization mode of the various detectors
\param sync syncronization mode
\returns current syncronization mode
*/
\returns current syncronization mode
*/
/* enum synchronizationMode { */
/* GET_SYNCHRONIZATION_MODE=-1, /\**< the multidetector will return its synchronization mode *\/ */
/* NONE, /\**< all detectors are independent (no cabling) *\/ */
/* MASTER_GATES, /\**< the master gates the other detectors *\/ */
/* MASTER_TRIGGERS, /\**< the master triggers the other detectors *\/ */
/* SLAVE_STARTS_WHEN_MASTER_STOPS /\**< the slave acquires when the master finishes, to avoid deadtime *\/ */
/* }; */
synchronizationMode setSynchronization(synchronizationMode sync=GET_SYNCHRONIZATION_MODE);
/** sets the onlineFlag
\param off can be: GET_ONLINE_FLAG, returns wether the detector is in online or offline state; OFFLINE_FLAG, detector in offline state (i.e. no communication to the detector - using only local structure - no data acquisition possible!); ONLINE_FLAG detector in online state (i.e. communication to the detector updating the local structure)
\returns online/offline status
*/
int setOnline(int const online=slsDetector::GET_ONLINE_FLAG);
/** sets the onlineFlag
\returns 1 if the detector structure has already be initlialized with the given idand belongs to this multiDetector instance, 0 otherwise */
int exists() ;
int setOnline(int const online=GET_ONLINE_FLAG);
/**
\returns 1 if the detector structure has already be initlialized with the given id and belongs to this multiDetector instance, 0 otherwise */
int exists();
/**
Purely virtual function
@ -306,204 +356,21 @@ class multiSlsDetector {
Should be implemented in the specific detector class
/sa mythenDetector::dumpDetectorSetup
*/
int dumpMultiDetectorSetup(string const fname, int level);
int dumpMultiDetectorSetup(string const fname, int level=0);
/**
Purely virtual function
Should be implemented in the specific detector class
/sa mythenDetector::retrieveDetectorSetup
*/
int retrieveMultiDetectorSetup(string const fname, int level);
/** generates file name without extension
always appends to file path and file name the run index.
in case also appends the position index
Filenames will be of the form: filepath/filename(_px)_i
where x is the position index and i is the run index
\returns file name without extension
\sa slsDetector::createFileName
*/
string createFileName();
/**
function that returns the file index from the file name
\param fname file name
\returns file index
\sa slsDetector::getFileIndexFromFileName
*/
int getFileIndexFromFileName(string fname) ;
/**
function that returns the variables from the file name
\param fname file name
\param index reference to index
\param p_index reference to position index
\param sv0 reference to scan variable 0
\param sv1 reference to scan variable 1
\returns file index
\sa slsDetector::getVariablesFromFileName
*/
int getVariablesFromFileName(string fname, int &index, int &p_index, float &sv0, float &sv1) ;
int retrieveMultiDetectorSetup(string const fname, int level=0);
/* I/O */
/**
sets the default output files path
\sa sharedMultiSlsDetector
*/
char* setFilePath(string s, int i=-1) {sprintf(thisMultiDetector->filePath, s.c_str()); return thisMultiDetector->filePath;};;
/**
sets the default output files root name
\sa sharedMultiSlsDetector
*/
char* setFileName(string s, int i=-1){sprintf(thisMultiDetector->fileName, s.c_str()); return thisMultiDetector->fileName;};
/**
sets the default output file index
\sa sharedMultiSlsDetector
*/
int setFileIndex(int i, int id=-1){thisMultiDetector->fileIndex=i; return thisMultiDetector->fileIndex;};
/**
returns the default output files path
\sa sharedMultiSlsDetector
*/
char* getFilePath(int id=-1) {return thisMultiDetector->filePath;};
/**
returns the default output files root name
\sa sharedMultiSlsDetector
*/
char* getFileName(int id=-1) {return thisMultiDetector->fileName;};
/**
returns the default output file index
\sa sharedMultiSlsDetector
*/
int getFileIndex(int id=-1) {return thisMultiDetector->fileIndex;};
/**
writes a data file
\param name of the file to be written
\param data array of data values
\param err array of arrors on the data. If NULL no errors will be written
\param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default)
\param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector
\returns OK or FAIL if it could not write the file or data=NULL
\sa mythenDetector::writeDataFile
*/
int writeDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1);
/**
writes a data file
\param name of the file to be written
\param data array of data values
\returns OK or FAIL if it could not write the file or data=NULL
\sa mythenDetector::writeDataFile
*/
int writeDataFile(string fname, int *data);
/**
reads a data file
\param name of the file to be read
\param data array of data values to be filled
\param err array of arrors on the data. If NULL no errors are expected on the file
\param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default)
\param nch number of channels to be written to file. if <=0 defaults to the number of installed channels of the detector
\returns OK or FAIL if it could not read the file or data=NULL
\sa mythenDetector::readDataFile
*/
int readDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=0) {return slsDetector::readDataFile(nch, fname, data, err, ang, dataformat);}
/**
reads a data file
\param name of the file to be read
\param data array of data values
\returns OK or FAIL if it could not read the file or data=NULL
\sa mythenDetector::readDataFile
*/
int readDataFile(string fname, int *data){slsDetector::readDataFile(fname,data,thisMultiDetector->numberOfChannels);};
/**
reads an angular conversion file for all detectors
\param fname file to be read
\sa angleConversionConstant mythenDetector::readAngularConversion
*/
/////////////////////////////// virtual int readAngularConversion(string fname="", int id=-1);
/**
writes an angular conversion file for all detectors
\param fname file to be written
\sa angleConversionConstant mythenDetector::writeAngularConversion
*/
/////////////////////////////////////////virtual int writeAngularConversion(string fname="", int id=-1);
/* Communication to server */
// Expert Initialization functions
/**
get threshold energy
@ -543,6 +410,21 @@ class multiSlsDetector {
int64_t getId(idMode mode, int imod=0);
int digitalTest(digitalTestMode mode, int imod=0);
int executeTrimming(trimMode mode, int par1, int par2, int imod=-1);
const char *getSettingsFile();
int decodeNMod(int i, int &idet, int &imod);
/** loads the modules settings/trimbits reading from a file - file name extension is automatically generated! */
int loadSettingsFile(string fname, int nmod=0);
/** gets the modules settings/trimbits and writes them to file - file name extension is automatically generated! */
int saveSettingsFile(string fname, int nmod=0);
@ -550,9 +432,8 @@ class multiSlsDetector {
int dumpDetectorSetup(string const fname, int level=0);
int retrieveDetectorSetup(string const fname, int level=0);
@ -587,11 +468,7 @@ class multiSlsDetector {
*/
int startReadOut();
/**
get run status <BR> Does it make sense to ask the status for all detectors?!?!?!
\returns status mask
*/
runStatus getRunStatus();
/**
start detector acquisition and read all data putting them a data queue
@ -669,6 +546,7 @@ class multiSlsDetector {
int setSpeed(speedVariable sp, int value=-1);
/**
@ -678,6 +556,13 @@ class multiSlsDetector {
\returns timer set value in ns or number of...(e.g. frames, gates, probes)
*/
int64_t setTimer(timerIndex index, int64_t t=-1);
/**
set/get timer value
\param index timer index
\param t time in ns or number of...(e.g. frames, gates, probes)
\returns timer set value in ns or number of...(e.g. frames, gates, probes)
*/
int64_t getTimeLeft(timerIndex index);
/* /\** */
/* get current timer value */
@ -713,14 +598,6 @@ class multiSlsDetector {
//Corrections
/**
set/get if the data processing and file writing should be done by a separate thread
s
\param b 0 sequencial data acquisition and file writing, 1 separate thread, -1 get
\returns thread flag
*/
int setThreadedProcessing(int b=-1) {if (b>=0) thisMultiDetector->threadedProcessing=b; return thisMultiDetector->threadedProcessing;}
/**
set flat field corrections
@ -729,6 +606,14 @@ s
*/
int setFlatFieldCorrection(string fname="");
/**
set flat field corrections
\param corr if !=NULL the flat field corrections will be filled with corr (NULL usets ff corrections)
\param ecorr if !=NULL the flat field correction errors will be filled with ecorr (1 otherwise)
\returns 0 if ff correction disabled, >0 otherwise
*/
int setFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL);
/**
get flat field corrections
\param corr if !=NULL will be filled with the correction coefficients
@ -737,22 +622,12 @@ s
*/
int getFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL);
/**
get flat field corrections file directory
\returns flat field correction file directory
*/
char *getFlatFieldCorrectionDir(){return thisMultiDetector->flatFieldDir;};
/**
set flat field corrections file directory
\param flat field correction file directory
*/
void setFlatFieldCorrectionDir(string dir){strcpy(thisMultiDetector->flatFieldDir,dir.c_str());};
/**
get flat field corrections file name
\returns flat field correction file name
*/
char *getFlatFieldCorrectionFile(){ if (thisMultiDetector->correctionMask&(1<<FLAT_FIELD_CORRECTION)) return thisMultiDetector->flatFieldFile; else return "none";};
/**
set rate correction
@ -788,6 +663,11 @@ s
*/
int setBadChannelCorrection(string fname="");
int setBadChannelCorrection(int nch, int *chs, int ff);
/**
get bad channels correction
\param bad pointer to array that if bad!=NULL will be filled with the bad channel list
@ -795,19 +675,8 @@ s
*/
int getBadChannelCorrection(int *bad=NULL);
/** returns the bad channel list file */
string getBadChannelCorrectionFile() {if (thisMultiDetector->correctionMask&(1<< DISCARD_BAD_CHANNELS)) return string(thisMultiDetector->badChanFile); else return string("none");};
/**
pure virtual function
set angular conversion
\param fname file with angular conversion constants ("" disable)
\returns 0 if angular conversion disabled, >0 otherwise
\sa mythenDetector::setAngularConversion
*/
/////////////////////////////////////////////////// virtual int setAngularConversion(string fname="");
/**
pure virtual function
get angular conversion
@ -819,173 +688,13 @@ s
/////////////////////////////////////////////////// virtual int getAngularConversion(int &direction, angleConversionConstant *angconv=NULL);
/**
pure virtual function
returns the angular conversion file
\sa mythenDetector::getAngularConversion */
/////////////////////////////////////////////////// virtual string getAngularConversion();
/**
pure virtual function
set detector global offset
\sa mythenDetector::setGlobalOffset
*/
/////////////////////////////////////////////////// virtual float setGlobalOffset(float f);
int setAngularConversion(string fname);
/**
pure virtual function
set detector fine offset
\sa mythenDetector::setFineOffset
*/
/////////////////////////////////////////////////// virtual float setFineOffset(float f);
/**
pure virtual function
get detector fine offset
\sa mythenDetector::getFineOffset
*/
/////////////////////////////////////////////////// virtual float getFineOffset();
/**
pure virtual function
get detector global offset
\sa mythenDetector::getGlobalOffset
*/
/////////////////////////////////////////////////// virtual float getGlobalOffset();
int readAngularConversion(string fname);
/**
pure virtual function
set positions for the acquisition
\param nPos number of positions
\param pos array with the encoder positions
\returns number of positions
\sa mythenDetector::setPositions
*/
/////////////////////////////////////////////////// virtual int setPositions(int nPos, float *pos);
/**
pure virtual function
get positions for the acquisition
\param pos array which will contain the encoder positions
\returns number of positions
\sa mythenDetector::getPositions
*/
/////////////////////////////////////////////////// virtual int getPositions(float *pos=NULL);
/** pure virtual function
set detector bin size used for merging (approx angular resolution)
\param bs bin size in degrees
\returns current bin size
\sa mythenDetector::setBinSize
*/
/////////////////////////////////////////////////// virtual float setBinSize(float bs);
int writeAngularConversion(string fname);
/** pure virtual function
return detector bin size used for merging (approx angular resolution)
\sa mythenDetector::getBinSize
*/
/////////////////////////////////////////////////// virtual float getBinSize();
/**
set action
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
\param fname for script ("" disable)
\param par for script
\returns 0 if action disabled, >0 otherwise
*/
int setAction(int iaction, string fname="", string par="");
/**
set action
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
\param fname for script ("" disable)
\returns 0 if action disabled, >0 otherwise
*/
int setActionScript(int iaction, string fname="");
/**
set action
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
\param par for script ("" disable)
\returns 0 if action disabled, >0 otherwise
*/
int setActionParameter(int iaction, string par="");
/**
returns action script
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action script
*/
string getActionScript(int iaction);
/**
returns action parameter
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action parameter
*/
string getActionParameter(int iaction);
/**
returns action mode
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action mode
*/
int getActionMode(int iaction);
/**
set scan
\param index of the scan (0,1)
\param fname for script ("" disables, "none" disables and overwrites current)
\param nvalues number of steps (0 disables, -1 leaves current value)
\param values pointer to steps (if NULL leaves current values)
\param par parameter for the scan script ("" leaves unchanged)
\returns 0 is scan disabled, >0 otherwise
*/
int setScan(int index, string script="", int nvalues=-1, float *values=NULL, string par="", int precision=-1);
int setScanScript(int index, string script="");
int setScanParameter(int index, string par="");
int setScanPrecision(int index, int precision=-1);
int setScanSteps(int index, int nvalues=-1, float *values=NULL);
/**
returns scan script
\param iscan can be (0,1)
\returns scan script
*/
string getScanScript(int iscan);
/**
returns scan parameter
\param iscan can be (0,1)
\returns scan parameter
*/
string getScanParameter(int iscan);
/**
returns scan mode
\param iscan can be (0,1)
\returns scan mode
*/
int getScanMode(int iscan);
/**
returns scan steps
\param iscan can be (0,1)
\param v is the pointer to the scan steps
\returns scan steps
*/
int getScanSteps(int iscan, float *v=NULL);
/**
returns scan precision
\param iscan can be (0,1)
\returns scan precision
*/
int getScanPrecision(int iscan);
float* convertAngles(float pos);
@ -1047,41 +756,41 @@ s
int rateCorrect(float* datain, float *errin, float* dataout, float *errout);
/**
pure virtual function
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
\param mp already merged postions
\param mv already merged data
\param me already merged errors (squared sum)
\param mm multiplicity of merged arrays
\returns OK or FAIL
\sa mythenDetector::resetMerging
*/
/////////////////////////////////////////////////// virtual int resetMerging(float *mp, float *mv,float *me, int *mm);
/**
pure virtual function
merge dataset
\param p1 angular positions of dataset
\param v1 data
\param e1 errors
\param mp already merged postions
\param mv already merged data
\param me already merged errors (squared sum)
\param mm multiplicity of merged arrays
\sa mythenDetector::addToMerging
*/
/////////////////////////////////////////////////// virtual int addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm);
/* /\** */
/* pure virtual function */
/* sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize(); */
/* \param mp already merged postions */
/* \param mv already merged data */
/* \param me already merged errors (squared sum) */
/* \param mm multiplicity of merged arrays */
/* \returns OK or FAIL */
/* \sa mythenDetector::resetMerging */
/* *\/ */
/* int resetMerging(float *mp, float *mv,float *me, int *mm) ; */
/* /\** */
/* pure virtual function */
/* merge dataset */
/* \param p1 angular positions of dataset */
/* \param v1 data */
/* \param e1 errors */
/* \param mp already merged postions */
/* \param mv already merged data */
/* \param me already merged errors (squared sum) */
/* \param mm multiplicity of merged arrays */
/* \sa mythenDetector::addToMerging */
/* *\/ */
/* int addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm); */
/** pure virtual function
calculates the "final" positions, data value and errors for the emrged data
\param mp already merged postions
\param mv already merged data
\param me already merged errors (squared sum)
\param mm multiplicity of merged arrays
\returns FAIL or the number of non empty bins (i.e. points belonging to the pattern)
\sa mythenDetector::finalizeMerging
*/
int finalizeMerging(float *mp, float *mv,float *me, int *mm);
/* /\** pure virtual function */
/* calculates the "final" positions, data value and errors for the emrged data */
/* \param mp already merged postions */
/* \param mv already merged data */
/* \param me already merged errors (squared sum) */
/* \param mm multiplicity of merged arrays */
/* \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) */
/* \sa mythenDetector::finalizeMerging */
/* *\/ */
/* int finalizeMerging(float *mp, float *mv,float *me, int *mm); */
/**
turns off server
@ -1107,27 +816,108 @@ s
float getCurrentProgress();
/**
get run status
\returns status mask
*/
//virtual runStatus getRunStatus()=0;
runStatus getRunStatus();
/**
set dacs value
\param val value (in V)
\param index DAC index
\param imod module number (if -1 alla modules)
\returns current DAC value
*/
float setDAC(float val, dacIndex index, int imod=-1);
/**
set dacs value
\param val value (in V)
\param index DAC index
\param imod module number (if -1 alla modules)
\returns current DAC value
*/
float getADC(dacIndex index, int imod=0);
/**
configure channel
\param reg channel register
\param ichan channel number (-1 all)
\param ichip chip number (-1 all)
\param imod module number (-1 all)
\returns current register value
\sa ::sls_detector_channel
*/
int setChannel(int64_t reg, int ichan=-1, int ichip=-1, int imod=-1);
/**
pure virtual function
get angular conversion
\param reference to diffractometer direction
\param angconv array that will be filled with the angular conversion constants
\returns 0 if angular conversion disabled, >0 otherwise
\sa mythenDetector::getAngularConversion
*/
int getAngularConversion(int &direction, angleConversionConstant *angconv=NULL) ;
/** returns the detector trimbit/settings directory \sa sharedSlsDetector */
char* getSettingsDir();
/** sets the detector trimbit/settings directory \sa sharedSlsDetector */
char* setSettingsDir(string s);
/**
returns the location of the calibration files
\sa sharedSlsDetector
*/
char* getCalDir();
/**
sets the location of the calibration files
\sa sharedSlsDetector
*/
char* setCalDir(string s);
char *getNetworkParameter(networkParameter);
char *setNetworkParameter(networkParameter, std::string);
int setPort(portType, int);
int lockServer(int);
string getLastClientIP();
int configureMAC(int);
string executeLine(int narg, char *args[], int action=slsDetector::GET_ACTION);
static string helpLine(int action=slsDetector::GET_ACTION);
int setNumberOfModules(int i=-1, dimension d=X);
int getMaxNumberOfModules(dimension d=X);
int setDynamicRange(int i=-1);
int writeRegister(int addr, int val);
int readRegister(int addr);
int setTrimEn(int nen, int *en=NULL);
int getTrimEn(int *en=NULL);
externalSignalFlag setExternalSignalFlags(externalSignalFlag pol=GET_EXTERNAL_SIGNAL_FLAG , int signalindex=0);
int setReadOutFlags(readOutFlags flag=GET_READOUT_FLAGS);
externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE);
protected:
@ -1205,8 +995,9 @@ s
/** merging multiplicity */
int *mergingMultiplicity;
};
#endif

View File

@ -2159,7 +2159,7 @@ int get_time_left(int file_des) {
#endif
n = sendDataOnly(file_des,&ret,sizeof(ret));
if (ret!=OK) {
if (ret==FAIL) {
n += sendDataOnly(file_des,mess,sizeof(mess));
} else {
n = sendDataOnly(file_des,&retval,sizeof(retval));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,429 @@
#ifndef SLS_DETECTOR_COMMAND_H
#define SLS_DETECTOR_COMMAND_H
#include "sls_detector_defs.h"
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>
using namespace std;
class slsDetectorCommand;
/* /\** This class handles the command line I/Os, help etc. */
/* It is inherited by both slsDetector and multiSlsDetector */
/* *\/ */
class slsDetectorCommand {
public:
slsDetectorCommand();
/* /\** */
/* executes a set of string arguments according to a given format. It is used to read/write configuration file, dump and retrieve detector settings and for the command line interface command parsing */
/* \param narg number of arguments */
/* \param args array of string arguments */
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
/* \returns answer string */
/* *\/ */
string executeLine(int narg, char *args[], int action=HELP_ACTION);
/* /\** */
/* returns the help for the executeLine command */
/* \param os output stream to return the help to */
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
/* *\/ */
static string helpLine(int narg, char *args[], int action=HELP_ACTION);
string cmdUnderDevelopment(int narg, char *args[], int action);
string cmdUnknown(int narg, char *args[], int action);
string cmdAcquire(int narg, char *args[], int action);
static string helpAcquire(int narg, char *args[], int action);
string cmdData(int narg, char *args[], int action);
static string helpData(int narg, char *args[], int action);
string cmdFrame(int narg, char *args[], int action);
static string helpFrame(int narg, char *args[], int action);
string cmdStatus(int narg, char *args[], int action);
static string helpStatus(int narg, char *args[], int action);
string cmdFree(int narg, char *args[], int action);
static string helpFree(int narg, char *args[], int action);
string cmdAdd(int narg, char *args[], int action);
static string helpAdd(int narg, char *args[], int action);
string cmdRemove(int narg, char *args[], int action);
static string helpRemove(int narg, char *args[], int action);
string cmdHostname(int narg, char *args[], int action);
static string helpHostname(int narg, char *args[], int action);
string cmdId(int narg, char *args[], int action);
static string helpId(int narg, char *args[], int action);
string cmdMaster(int narg, char *args[], int action);
static string helpMaster(int narg, char *args[], int action);
string cmdSync(int narg, char *args[], int action);
static string helpSync(int narg, char *args[], int action);
string cmdHelp(int narg, char *args[], int action);
string cmdExitServer(int narg, char *args[], int action);
static string helpExitServer(int narg, char *args[], int action);
string cmdSettingsDir(int narg, char *args[], int action);
static string helpSettingsDir(int narg, char *args[], int action);
string cmdCalDir(int narg, char *args[], int action);
static string helpCalDir(int narg, char *args[], int action);
string cmdTrimEn(int narg, char *args[], int action);
static string helpTrimEn(int narg, char *args[], int action);
string cmdOutDir(int narg, char *args[], int action);
static string helpOutDir(int narg, char *args[], int action);
string cmdFileName(int narg, char *args[], int action);
static string helpFileName(int narg, char *args[], int action);
string cmdFileIndex(int narg, char *args[], int action);
static string helpFileIndex(int narg, char *args[], int action);
string cmdFlatField(int narg, char *args[], int action);
static string helpFlatField(int narg, char *args[], int action);
string cmdRateCorr(int narg, char *args[], int action);
static string helpRateCorr(int narg, char *args[], int action);
string cmdBadChannels(int narg, char *args[], int action);
static string helpBadChannels(int narg, char *args[], int action);
string cmdAngConv(int narg, char *args[], int action);
static string helpAngConv(int narg, char *args[], int action);
string cmdThreaded(int narg, char *args[], int action);
static string helpThreaded(int narg, char *args[], int action);
string cmdPositions(int narg, char *args[], int action);
static string helpPositions(int narg, char *args[], int action);
string cmdScripts(int narg, char *args[], int action);
static string helpScripts(int narg, char *args[], int action);
string cmdScans(int narg, char *args[], int action);
static string helpScans(int narg, char *args[], int action);
string cmdNetworkParameter(int narg, char *args[], int action);
static string helpNetworkParameter(int narg, char *args[], int action);
string cmdPort(int narg, char *args[], int action);
static string helpPort(int narg, char *args[], int action);
string cmdLock(int narg, char *args[], int action);
static string helpLock(int narg, char *args[], int action);
string cmdLastClient(int narg, char *args[], int action);
static string helpLastClient(int narg, char *args[], int action);
string cmdOnline(int narg, char *args[], int action);
static string helpOnline(int narg, char *args[], int action);
string cmdConfigureMac(int narg, char *args[], int action);
static string helpConfigureMac(int narg, char *args[], int action);
string cmdDetectorSize(int narg, char *args[], int action);
static string helpDetectorSize(int narg, char *args[], int action);
string cmdSettings(int narg, char *args[], int action);
static string helpSettings(int narg, char *args[], int action);
string cmdSN(int narg, char *args[], int action);
static string helpSN(int narg, char *args[], int action);
string cmdDigiTest(int narg, char *args[], int action);
static string helpDigiTest(int narg, char *args[], int action);
string cmdRegister(int narg, char *args[], int action);
static string helpRegister(int narg, char *args[], int action);
string cmdDAC(int narg, char *args[], int action);
static string helpDAC(int narg, char *args[], int action);
string cmdTimer(int narg, char *args[], int action);
static string helpTimer(int narg, char *args[], int action);
string cmdTimeLeft(int narg, char *args[], int action);
static string helpTimeLeft(int narg, char *args[], int action);
string cmdSpeed(int narg, char *args[], int action);
static string helpSpeed(int narg, char *args[], int action);
string cmdAdvanced(int narg, char *args[], int action);
static string helpAdvanced(int narg, char *args[], int action);
string cmdConfiguration(int narg, char *args[], int action);
static string helpConfiguration(int narg, char *args[], int action);
virtual int setOnline(int const online=GET_ONLINE_FLAG)=0;
virtual void acquire(int delflag)=0;
virtual int* readAll()=0;
virtual int* readFrame()=0;
virtual void* processData(int delflag)=0;
virtual int startAcquisition()=0;
virtual int stopAcquisition()=0;
virtual runStatus getRunStatus()=0;
virtual int freeSharedMemory()=0;
virtual int addSlsDetector(int, int pos=-1){return -1;};
virtual int addSlsDetector(char*, int pos=-1){return -1;};
virtual int removeSlsDetector(int pos=-1){return -1;};
virtual int removeSlsDetector(char*){return -1;};
virtual string setHostname(char*, int pos=-1)=0;
virtual string getHostname(int pos=-1)=0;
virtual int getDetectorId(int i=-1) =0;
virtual int setDetectorId(int ival, int i=-1){return -1;};
virtual synchronizationMode setSynchronization(synchronizationMode sync=GET_SYNCHRONIZATION_MODE){return GET_SYNCHRONIZATION_MODE;};
virtual int exitServer()=0;
virtual int setMaster(int i=-1){return -1;};
virtual char* getSettingsDir()=0;
virtual char* setSettingsDir(string s)=0;
virtual char* getCalDir()=0;
virtual char* setCalDir(string s)=0;
virtual char* getFilePath()=0;
virtual char* setFilePath(string s)=0;
virtual char* getFileName()=0;
virtual char* setFileName(string s)=0;
virtual int getFileIndex()=0;
virtual int setFileIndex(int i)=0;
virtual int setFlatFieldCorrection(string fname="")=0;
virtual int getFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL)=0;
virtual int setFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL)=0;
virtual char *getFlatFieldCorrectionDir()=0;
virtual void setFlatFieldCorrectionDir(string dir)=0;
virtual char *getFlatFieldCorrectionFile()=0;
virtual int setRateCorrection(float t=0)=0;
virtual int getRateCorrection(float &t)=0;
virtual float getRateCorrectionTau()=0;
virtual int getRateCorrection()=0;
virtual int setBadChannelCorrection(string fname="")=0;
virtual int setBadChannelCorrection(int nch, int *chs, int ff=0)=0;
virtual int getBadChannelCorrection(int *bad=NULL)=0;
virtual string getBadChannelCorrectionFile()=0;
virtual int setAngularConversion(string fname="")=0;
virtual int getAngularConversion(int &direction, angleConversionConstant *angconv=NULL)=0;
virtual string getAngularConversion()=0;
virtual float setGlobalOffset(float f)=0;
virtual float setFineOffset(float f)=0;
virtual float getFineOffset()=0;
virtual float getGlobalOffset()=0;
virtual float setBinSize(float f)=0;
virtual float getBinSize()=0;
virtual int writeDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1)=0;
virtual int writeAngularConversion(string fname)=0;
virtual int setThreadedProcessing(int i=-1)=0;;
virtual int setPositions(int nPos, float *pos)=0;
virtual int getPositions(float *pos=NULL)=0;
virtual int setActionScript(int iaction, string fname="")=0;
virtual int setActionParameter(int iaction, string par="")=0;
virtual string getActionScript(int iaction)=0;
virtual string getActionParameter(int iaction)=0;
virtual int setScanScript(int index, string script="")=0;
virtual int setScanParameter(int index, string par="")=0;
virtual int setScanPrecision(int index, int precision=-1)=0;
virtual int setScanSteps(int index, int nvalues=-1, float *values=NULL)=0;
virtual string getScanScript(int index)=0;
virtual string getScanParameter(int index)=0;
virtual int getScanPrecision(int index)=0;
virtual int getScanSteps(int index, float *values=NULL)=0;
virtual char *getNetworkParameter(networkParameter i)=0;
virtual char *setNetworkParameter(networkParameter i, string s)=0;
virtual int setPort(portType t, int i=-1)=0;
virtual int lockServer(int i=-1)=0;
virtual string getLastClientIP()=0;
virtual int configureMAC(int)=0;
virtual int setNumberOfModules(int i=-1, dimension d=X)=0;
virtual int getMaxNumberOfModules(dimension d=X)=0;
virtual int setDynamicRange(int i=-1)=0;
virtual detectorSettings getSettings(int imod=-1)=0;
virtual detectorSettings setSettings(detectorSettings isettings, int imod=-1)=0;
virtual int getThresholdEnergy(int imod=-1)=0;
virtual int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS)=0;
virtual int64_t getId(idMode mode, int imod=0)=0;
virtual int digitalTest(digitalTestMode mode, int imod=0)=0;
virtual int executeTrimming(trimMode mode, int par1, int par2, int imod=-1)=0;
virtual const char *getSettingsFile()=0;
virtual int loadSettingsFile(string fname, int imod=-1)=0;
virtual int saveSettingsFile(string fname, int imod=-1)=0;
virtual int writeRegister(int addr, int val)=0;
virtual int readRegister(int addr)=0;
virtual float setDAC(float , dacIndex, int imod=-1)=0;
virtual float getADC(dacIndex, int imod=0)=0;
virtual int64_t setTimer(timerIndex index, int64_t t=-1)=0;
virtual int64_t getTimeLeft(timerIndex index)=0;
virtual int setSpeed(speedVariable sp, int value=-1)=0;
virtual int setTrimEn(int nen, int *en=NULL)=0;
virtual int getTrimEn(int *en=NULL)=0;
virtual externalSignalFlag setExternalSignalFlags(externalSignalFlag pol=GET_EXTERNAL_SIGNAL_FLAG , int signalindex=0)=0;
virtual int setReadOutFlags(readOutFlags flag=GET_READOUT_FLAGS)=0;
virtual externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE)=0;
virtual int readConfigurationFile(string const fname)=0;
virtual int writeConfigurationFile(string const fname)=0;
virtual int dumpDetectorSetup(string const fname, int level=0)=0;
virtual int retrieveDetectorSetup(string const fname, int level=0)=0;
/** returns string from run status index
\param s can be ERROR, WAITING, RUNNING, TRANSMITTING, RUN_FINISHED
\returns string error, waiting, running, data, finished
*/
static string runStatusType(runStatus);
/** returns detector type string from detector type index
\param type string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
\returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC
*/
static string getDetectorType(detectorType t);
/** returns detector type index from detector type string
\param t can be MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC
\returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
*/
static detectorType getDetectorType(string const type);
/** returns synchronization type index from string
\param t can be none, gating, trigger, complementary
\returns ONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
*/
static synchronizationMode getSyncType(string const type);
/** returns synchronization type string from index
\param t can be NONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
\returns none, gating, trigger, complementary
*/
static string getSyncType(synchronizationMode s );
/** returns string from external signal type index
\param f can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, =TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE
\returns string off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, unknown
*/
static string externalSignalType(externalSignalFlag f);
/** returns external signal type index from string
\param string off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, unknown
\returns f can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, =TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE,GET_EXTERNAL_SIGNAL_FLAG (if unknown)
*/
static externalSignalFlag externalSignalType(string sval);
/** returns synchronization type string from index
\param t can be NONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
\returns none, gating, trigger, complementary
*/
static detectorSettings getDetectorSettings(string s);
/** returns detector settings string from index
\param t can be STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, GET_SETTINGS
\returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, undefined
*/
static string getDetectorSettings(detectorSettings s);
private:
int numberOfCommands;
string cmd;
typedef string (slsDetectorCommand::*MemFuncGetter)(int narg, char *args[], int action);
struct FuncTable
{
string m_pFuncName;
//const char* m_pFuncName;
MemFuncGetter m_pFuncPtr;
};
FuncTable descrToFuncMap[1000];
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,912 @@
#ifndef SLS_DETECTOR_UTILS_H
#define SLS_DETECTOR_UTILS_H
//#include "MySocketTCP.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <sstream>
#include <queue>
extern "C" {
#include <pthread.h>
}
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <math.h>
using namespace std;
#include "sls_detector_defs.h"
#include "slsDetectorCommand.h"
#define MAX_TIMERS 10
#define MAX_ROIS 100
#define MAX_BADCHANS 2000
#define MAXPOS 50
#define MAX_SCAN_LEVELS 2
#define NMODMAXX 24
#define NMODMAXY 24
#define MAXMODS 36
#define NCHIPSMAX 10
#define NCHANSMAX 65536
#define NDACSMAX 16
#define DEFAULT_HOSTNAME "localhost"
#define DEFAULT_SHM_KEY 5678
#define defaultTDead {170,90,750} /**< should be changed in order to have it separate for the different detector types */
/**
data structure to hold the detector data after postprocessing (e.g. to plot, store in a root tree etc.)
*/
class detectorData {
public:
/** The constructor
\param val pointer to the data
\param err pointer to errors
\param ang pointer to the angles
\param f_ind file index
\param fname file name to which the data are saved
\param np number of points defaults to the number of detector channels
*/
detectorData(float *val=NULL, float *err=NULL, float *ang=NULL, float p_ind=-1, const char *fname="", int np=-1) : values(val), errors(err), angles(ang), progressIndex(p_ind), npoints(np){strcpy(fileName,fname);};
/**
the destructor
deletes also the arrays pointing to data/errors/angles if not NULL
*/
~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles;};
//private:
float *values; /**< pointer to the data */
float *errors; /**< pointer to the errors */
float *angles;/**< pointer to the angles */
float progressIndex;/**< file index */
char fileName[1000];/**< file name */
int npoints;/**< number of points */
};
class slsDetectorUtils : public slsDetectorCommand {
public:
slsDetectorUtils();
virtual ~slsDetectorUtils(){};
/** generates file name without extension
always appends to file path and file name the run index.
in case also appends the position index
Filenames will be of the form: filepath/filename(_px)_i
where x is the position index and i is the run index
\param filepath outdir
\param filename file root name
\param aMask action mask (scans, positions)
\param sv0 scan variable 0
\param prec0 scan precision 0
\param sv1 scan variable 1
\param prec1 scan precision 1
\param pindex position index
\param number of positions
\param findex file index
\returns file name without extension
*/
static string createFileName(char *filepath, char *filename, int aMask, float sv0, int prec0, float sv1, int prec1, int pindex, int npos, int findex);
virtual string createFileName();
/** static function that returns the file index from the file name
\param fname file name
\returns file index*/
static int getFileIndexFromFileName(string fname);
/** static function that returns the variables from the file name
\param fname file name
\param index reference to index
\param p_index reference to position index
\param sv0 reference to scan variable 0
\param sv1 reference to scan variable 1
\returns file index
*/
static int getVariablesFromFileName(string fname, int &index, int &p_index, float &sv0, float &sv1);
/**
writes a data file
\param name of the file to be written
\param data array of data values
\param err array of arrors on the data. If NULL no errors will be written
\param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default)
\param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector
\returns OK or FAIL if it could not write the file or data=NULL
\sa mythenDetector::writeDataFile
*/
int writeDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1);
int writeDataFile(ofstream &outfile, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1);
/**
writes a data file
\param name of the file to be written
\param data array of data values
\returns OK or FAIL if it could not write the file or data=NULL
\sa mythenDetector::writeDataFile
*/
int writeDataFile(string fname, int *data);
/**
reads a data file
\param name of the file to be read
\param data array of data values to be filled
\param err array of arrors on the data. If NULL no errors are expected on the file
\param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default)
\param nch number of channels to be written to file. if <=0 defaults to the number of installed channels of the detector
\returns OK or FAIL if it could not read the file or data=NULL
\sa mythenDetector::readDataFile
*/
int readDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f');
/**
reads a data file
\param name of the file to be read
\param data array of data values
\returns OK or FAIL if it could not read the file or data=NULL
\sa mythenDetector::readDataFile
*/
int readDataFile(string fname, int *data);
/**
writes a data file
\param name of the file to be written
\param data array of data values
\param err array of arrors on the data. If NULL no errors will be written
\param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default)
\param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector
\returns OK or FAIL if it could not write the file or data=NULL
\sa mythenDetector::writeDataFile
*/
static int writeDataFile(string fname, int nch, float *data, float *err=NULL, float *ang=NULL, char dataformat='f');
/**
writes a data file
\param name of the file to be written
\param data array of data values
\returns OK or FAIL if it could not write the file or data=NULL
\sa mythenDetector::writeDataFile
*/
static int writeDataFile(string fname,int nch, int *data);
/**
reads a data file
\param name of the file to be read
\param data array of data values to be filled
\param err array of arrors on the data. If NULL no errors are expected on the file
\param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default)
\param nch number of channels to be written to file. if <=0 defaults to the number of installed channels of the detector
\returns number of channels read or -1 if it could not read the file or data=NULL
\sa mythenDetector::readDataFile
*/
static int readDataFile(int nch, string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f');
/**
reads a data file
\param name of the file to be read
\param data array of data values
\returns OK or FAIL if it could not read the file or data=NULL
\sa mythenDetector::readDataFile
*/
static int readDataFile(string fname, int *data, int nch);
/**
reads an angular conversion file
\param fname file to be read
\sa angleConversionConstant mythenDetector::readAngularConversion
*/
static int readAngularConversion(string fname, int nmod, angleConversionConstant *angOff);
/**
reads an angular conversion file
\param fname file to be read
\sa angleConversionConstant mythenDetector::readAngularConversion
*/
static int readAngularConversion(ifstream& ifs, int nmod, angleConversionConstant *angOff);
/**
Pure virtual function
writes an angular conversion file
\param fname file to be written
\sa angleConversionConstant mythenDetector::writeAngularConversion
*/
static int writeAngularConversion(string fname, int nmod, angleConversionConstant *angOff);
/**
Pure virtual function
writes an angular conversion file
\param fname file to be written
\sa angleConversionConstant mythenDetector::writeAngularConversion
*/
static int writeAngularConversion(ofstream& ofs, int nmod, angleConversionConstant *angOff);
/**
set bad channels correction
\param fname file with bad channel list ("" disable)
\param nbad reference to number of bad channels
\param badlist array of badchannels
\returns 0 if bad channel disabled, >0 otherwise
*/
static int setBadChannelCorrection(string fname, int &nbad, int *badlist);
/**
flat field correct data
\param datain data
\param errin error on data (if<=0 will default to sqrt(datain)
\param dataout corrected data
\param errout error on corrected data
\param ffcoefficient flat field correction coefficient
\param fferr erro on ffcoefficient
\returns 0
*/
static int flatFieldCorrect(float datain, float errin, float &dataout, float &errout, float ffcoefficient, float fferr);
/**
rate correct data
\param datain data
\param errin error on data (if<=0 will default to sqrt(datain)
\param dataout corrected data
\param errout error on corrected data
\param tau dead time 9in ns)
\param t acquisition time (in ns)
\returns 0
*/
static int rateCorrect(float datain, float errin, float &dataout, float &errout, float tau, float t);
/**
pure virtual function
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
\param mp already merged postions
\param mv already merged data
\param me already merged errors (squared sum)
\param mm multiplicity of merged arrays
\returns OK or FAIL
\sa mythenDetector::resetMerging
*/
static int resetMerging(float *mp, float *mv,float *me, int *mm, float binsize);
int resetMerging(float *mp, float *mv,float *me, int *mm);
/**
pure virtual function
merge dataset
\param p1 angular positions of dataset
\param v1 data
\param e1 errors
\param mp already merged postions
\param mv already merged data
\param me already merged errors (squared sum)
\param mm multiplicity of merged arrays
\sa mythenDetector::addToMerging
*/
static int addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int nchans, float binsize,int angDirection, int correctionMask, int *badChanMask );
int addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm);
/** pure virtual function
calculates the "final" positions, data value and errors for the emrged data
\param mp already merged postions
\param mv already merged data
\param me already merged errors (squared sum)
\param mm multiplicity of merged arrays
\returns FAIL or the number of non empty bins (i.e. points belonging to the pattern)
\sa mythenDetector::finalizeMerging
*/
static int finalizeMerging(float *mp, float *mv,float *me, int *mm, float binsize);
int finalizeMerging(float *mp, float *mv,float *me, int *mm);
/**
reads a calibration file
\param fname file to be read
\param gain reference to the gain variable
\offset reference to the offset variable
\sa sharedSlsDetector mythenDetector::readCalibrationFile
*/
static int readCalibrationFile(string fname, float &gain, float &offset);
//virtual int readCalibrationFile(string fname, float &gain, float &offset);
/**
writes a calibration file
\param fname file to be written
\param gain
\param offset
\sa sharedSlsDetector mythenDetector::writeCalibrationFile
*/
static int writeCalibrationFile(string fname, float gain, float offset);
//virtual int writeCalibrationFile(string fname, float gain, float offset);
/**
sets the default output files path
\sa sharedSlsDetector
*/
char* setFilePath(string s) {sprintf(filePath, s.c_str()); return filePath;};
/**
sets the default output files root name
\sa sharedSlsDetector
*/
char* setFileName(string s) {sprintf(fileName, s.c_str()); return fileName;};
/**
sets the default output file index
\sa sharedSlsDetector
*/
int setFileIndex(int i) {*fileIndex=i; return *fileIndex;};
/**
returns the default output files path
\sa sharedSlsDetector
*/
char* getFilePath() {return filePath;};
/**
returns the default output files root name
\sa sharedSlsDetector
*/
char* getFileName() {return fileName;};
/**
returns the default output file index
\sa sharedSlsDetector
*/
int getFileIndex() {return *fileIndex;};
/**
pure virtual function
set positions for the acquisition
\param nPos number of positions
\param pos array with the encoder positions
\returns number of positions
\sa mythenDetector::setPositions
*/
int setPositions(int nPos, float *pos);
/**
pure virtual function
get positions for the acquisition
\param pos array which will contain the encoder positions
\returns number of positions
\sa mythenDetector::getPositions
*/
int getPositions(float *pos=NULL);
/**
set action
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
\param fname for script ("" disable)
\param par for script
\returns 0 if action disabled, >0 otherwise
*/
int setAction(int iaction, string fname="", string par="");
/**
set action
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
\param fname for script ("" disable)
\returns 0 if action disabled, >0 otherwise
*/
int setActionScript(int iaction, string fname="");
/**
set action
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
\param par for script ("" disable)
\returns 0 if action disabled, >0 otherwise
*/
int setActionParameter(int iaction, string par="");
/**
returns action script
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action script
*/
string getActionScript(int iaction);
/**
returns action parameter
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action parameter
*/
string getActionParameter(int iaction);
/**
returns action mode
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action mode
*/
int getActionMode(int iaction);
/**
set scan
\param index of the scan (0,1)
\param fname for script ("" disables, "none" disables and overwrites current)
\param nvalues number of steps (0 disables, -1 leaves current value)
\param values pointer to steps (if NULL leaves current values)
\param par parameter for the scan script ("" leaves unchanged)
\returns 0 is scan disabled, >0 otherwise
*/
int setScan(int index, string script="", int nvalues=-1, float *values=NULL, string par="", int precision=-1);
int setScanScript(int index, string script="");
int setScanParameter(int index, string par="");
int setScanPrecision(int index, int precision=-1);
int setScanSteps(int index, int nvalues=-1, float *values=NULL);
float getScanStep(int index, int istep){if (index<MAX_SCAN_LEVELS && istep<MAX_SCAN_STEPS) return scanSteps[index][istep]; else return -1;};
/**
returns scan script
\param iscan can be (0,1)
\returns scan script
*/
string getScanScript(int iscan);
/**
returns scan parameter
\param iscan can be (0,1)
\returns scan parameter
*/
string getScanParameter(int iscan);
/**
returns scan mode
\param iscan can be (0,1)
\returns scan mode
*/
int getScanMode(int iscan);
/**
returns scan steps
\param iscan can be (0,1)
\param v is the pointer to the scan steps
\returns scan steps
*/
int getScanSteps(int iscan, float *v=NULL);
/**
returns scan precision
\param iscan can be (0,1)
\returns scan precision
*/
int getScanPrecision(int iscan);
/**
set/get if the data processing and file writing should be done by a separate thread
s
\param b 0 sequencial data acquisition and file writing, 1 separate thread, -1 get
\returns thread flag
*/
int setThreadedProcessing(int b=-1) {if (b>=0) *threadedProcessing=b; return *threadedProcessing;}
/**
pure virtual function
set detector global offset
\sa mythenDetector::setGlobalOffset
*/
float setGlobalOffset(float f){*globalOffset=f; return *globalOffset;};
/**
pure virtual function
set detector fine offset
\sa mythenDetector::setFineOffset
*/
float setFineOffset(float f){*fineOffset=f; return *fineOffset;};
/**
pure virtual function
get detector fine offset
\sa mythenDetector::getFineOffset
*/
float getFineOffset(){return *fineOffset;};
/**
pure virtual function
get detector global offset
\sa mythenDetector::getGlobalOffset
*/
float getGlobalOffset(){return *globalOffset;};
/** pure virtual function
set detector bin size used for merging (approx angular resolution)
\param bs bin size in degrees
\returns current bin size
\sa mythenDetector::setBinSize
*/
float setBinSize(float bs){*binSize=bs; return *binSize;};
/** pure virtual function
return detector bin size used for merging (approx angular resolution)
\sa mythenDetector::getBinSize
*/
float getBinSize() {return *binSize;};
/**
pure virtual function
returns the angular conversion file
\sa mythenDetector::getAngularConversion */
string getAngularConversion(){if ((*correctionMask)&(1<< ANGULAR_CONVERSION)) return string(angConvFile); else return string("none");};
/** returns the bad channel list file */
string getBadChannelCorrectionFile() {if ((*correctionMask)&(1<< DISCARD_BAD_CHANNELS)) return string(badChanFile); else return string("none");};
/**
get flat field corrections file directory
\returns flat field correction file directory
*/
char *getFlatFieldCorrectionDir(){return flatFieldDir;};
/**
set flat field corrections file directory
\param flat field correction file directory
*/
void setFlatFieldCorrectionDir(string dir){strcpy(flatFieldDir,dir.c_str());};
/**
get flat field corrections file name
\returns flat field correction file name
*/
char *getFlatFieldCorrectionFile(){ if ((*correctionMask)&(1<<FLAT_FIELD_CORRECTION)) return flatFieldFile; else return "none";};
void acquire(int delflag);
// must change to total number of channels!
void *processData(int delflag);
virtual float* convertAngles(float pos)=0;
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
virtual float setDAC(float, dacIndex, int im=-1)=0;
virtual int setChannel(long long, int ich=-1, int ichip=-1, int imod=-1)=0;
virtual float getRateCorrectionTau()=0;
virtual int* startAndReadAll()=0;
virtual float* decodeData(int *datain)=0;
virtual int rateCorrect(float*, float*, float*, float*)=0;
virtual int flatFieldCorrect(float*, float*, float*, float*)=0;
virtual int getTotalNumberOfChannels()=0;
// virtual int getParameters();
/**
pops the data from the data queue
\returns pointer to the popped data or NULL if the queue is empty.
\sa dataQueue
*/
int* popDataQueue();
/**
pops the data from thepostprocessed data queue
\returns pointer to the popped data or NULL if the queue is empty.
\sa finalDataQueue
*/
detectorData* popFinalDataQueue();
/**
resets the raw data queue
\sa dataQueue
*/
void resetDataQueue();
/**
resets the postprocessed data queue
\sa finalDataQueue
*/
void resetFinalDataQueue();
/* virtual string getScanScript(int iscan)=0; */
/* virtual string getScanParameter(int iscan)=0; */
/* virtual string getActionScript(int iscan)=0; */
/* virtual string getActionParameter(int iscan)=0; */
/* virtual float getScanStep(int iscan, int istep)=0; */
int setTotalProgress();
float getCurrentProgress();
protected:
static const int64_t thisSoftwareVersion=0x20120124;
int fillBadChannelMask();
int getPointers(int * const l_stoppedFlag, \
int * const l_threadedProcessing, \
int * const l_actionMask, \
mystring * const l_actionScript, \
mystring * const l_actionParameter, \
int * const l_nScanSteps, \
int * const l_scanMode, \
mystring * const l_scanScript, \
mystring * const l_scanParameter, \
mysteps * const l_scanSteps, \
int * const l_scanPrecision, \
int * const l_numberOfPositions, \
float * const l_detPositions, \
char * const l_angConvFile, \
int * const l_correctionMask, \
float * const l_binSize, \
float * const l_fineOffset, \
float * const l_globalOffset, \
int * const l_angDirection, \
char * const l_flatFieldDir, \
char * const l_flatFieldFile, \
char * const l_badChanFile, \
int64_t * const l_timerValue, \
detectorSettings * const l_currentSettings, \
int * const l_currentThresholdEV, \
char * const l_filePath, \
char * const l_fileName, \
int * const l_fileIndex);
/**
data queue
*/
queue<int*> dataQueue;
/**
queue containing the postprocessed data
*/
queue<detectorData*> finalDataQueue;
private:
int totalProgress;
int progressIndex;
int *stoppedFlag;
int *threadedProcessing;
int *actionMask;
mystring *actionScript;
mystring *actionParameter;
int *nScanSteps;
mysteps *scanSteps;
int *scanMode;
int *scanPrecision;
mystring *scanScript;
mystring *scanParameter;
int *numberOfPositions;
float *detPositions;
char *angConvFile;
int *correctionMask;
float *binSize;
float *fineOffset;
float *globalOffset;
int *angDirection;
char *flatFieldDir;
char *flatFieldFile;
char *badChanFile;
int *nBadChans;
int *badChansList;
int *nBadFF;
int *badFFList;
int64_t *timerValue;
detectorSettings *currentSettings;
int *currentThresholdEV;
char *filePath;
char *fileName;
int *fileIndex;
/** mutex to synchronize threads */
pthread_mutex_t mp;
/** sets when the acquisition is finished */
int jointhread;
/** data queue size */
int queuesize;
/**
current position of the detector
*/
float currentPosition;
/**
current position index of the detector
*/
int currentPositionIndex;
/**
I0 measured
*/
float currentI0;
/**
current scan variable of the detector
*/
float currentScanVariable[MAX_SCAN_LEVELS];
/**
current scan variable index of the detector
*/
int currentScanIndex[MAX_SCAN_LEVELS];
/** merging bins */
float *mergingBins;
/** merging counts */
float *mergingCounts;
/** merging errors */
float *mergingErrors;
/** merging multiplicity */
int *mergingMultiplicity;
/** pointer to bad channel mask 0 is channel is good 1 if it is bad \sa fillBadChannelMask() */
int *badChannelMask;
/**
start data processing thread
*/
void startThread(int delflag=1); //
/** the data processing thread */
pthread_t dataProcessingThread;
/**
get bad channels correction
\param bad pointer to array that if bad!=NULL will be filled with the bad channel list
\returns 0 if bad channel disabled or no bad channels, >0 otherwise
*/
virtual int getBadChannelCorrection(int *bad=NULL)=0;
};
static void* startProcessData(void *n){\
slsDetectorUtils *myDet=(slsDetectorUtils*)n;\
myDet->processData(1);\
pthread_exit(NULL);\
};
static void* startProcessDataNoDelete(void *n){\
slsDetectorUtils *myDet=(slsDetectorUtils*)n;\
myDet->processData(0);\
pthread_exit(NULL);\
};
#endif