mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
refactored ONLY THE CLIENT first stage, compiles
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "d2bce7e372c241cd235977b92be18555bca6a77d"
|
||||
#define GITREPUUID "def79807f6f40ed1797b8154240adbc0e35c95e0"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4020
|
||||
#define GITDATE 0x20180927
|
||||
#define GITBRANCH "4.0.0"
|
||||
#define GITREV 0x4039
|
||||
#define GITDATE 0x20181002
|
||||
#define GITBRANCH "refactor"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10,18 +10,13 @@
|
||||
*/
|
||||
|
||||
#include "slsDetectorUtils.h"
|
||||
#include "energyConversion.h"
|
||||
#include "angleConversionConstant.h"
|
||||
#include "MySocketTCP.h"
|
||||
#include "angleConversionConstant.h"
|
||||
|
||||
class multiSlsDetector;
|
||||
class SharedMemory;
|
||||
class receiverInterface;
|
||||
|
||||
#define SLS_SHMVERSION 0x180629
|
||||
#define NMODMAXX 24
|
||||
#define NMODMAXY 24
|
||||
#define SLS_SHMVERSION 0x181002
|
||||
#define NCHIPSMAX 10
|
||||
#define NCHANSMAX 65536
|
||||
#define NDACSMAX 16
|
||||
@ -29,8 +24,6 @@ class receiverInterface;
|
||||
* parameter list that has to be initialized depending on the detector type
|
||||
*/
|
||||
typedef struct detParameterList {
|
||||
int nModMaxX;
|
||||
int nModMaxY;
|
||||
int nChanX;
|
||||
int nChanY;
|
||||
int nChipX;
|
||||
@ -40,13 +33,12 @@ typedef struct detParameterList {
|
||||
int nGain;
|
||||
int nOffset;
|
||||
int dynamicRange;
|
||||
int moveFlag;
|
||||
int nGappixelsX;
|
||||
int nGappixelsY;
|
||||
} detParameterList;
|
||||
|
||||
|
||||
class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
class slsDetector : public slsDetectorUtils {
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -100,28 +92,6 @@ private:
|
||||
/** list of the energies at which the detector has been trimmed */
|
||||
int trimEnergies[MAX_TRIMEN];
|
||||
|
||||
/** indicator for the acquisition progress - set to 0 at the beginning
|
||||
* of the acquisition and incremented when each frame is processed */
|
||||
int progressIndex;
|
||||
|
||||
/** total number of frames to be acquired */
|
||||
int totalProgress;
|
||||
|
||||
/** path of the output files */
|
||||
char filePath[MAX_STR_LENGTH];
|
||||
|
||||
/** number of installed modules of the detector (x and y directions) */
|
||||
int nMod[2];
|
||||
|
||||
/** number of modules ( nMod[X]*nMod[Y]) \see nMod */
|
||||
int nMods;
|
||||
|
||||
/** maximum number of modules of the detector (x and y directions) */
|
||||
int nModMax[2];
|
||||
|
||||
/** maximum number of modules (nModMax[X]*nModMax[Y]) \see nModMax */
|
||||
int nModsMax;
|
||||
|
||||
/** number of channels per chip */
|
||||
int nChans;
|
||||
|
||||
@ -152,9 +122,6 @@ private:
|
||||
/** size of the data that are transfered from the detector */
|
||||
int dataBytes;
|
||||
|
||||
/** corrections to be applied to the data \see ::correctionFlags */
|
||||
int correctionMask;
|
||||
|
||||
/** threaded processing flag
|
||||
* (i.e. if data are processed in a separate thread) */
|
||||
int threadedProcessing;
|
||||
@ -162,61 +129,6 @@ private:
|
||||
/** dead time (in ns) for rate corrections */
|
||||
double tDead;
|
||||
|
||||
/** directory where the flat field files are stored */
|
||||
char flatFieldDir[MAX_STR_LENGTH];
|
||||
|
||||
/** file used for flat field corrections */
|
||||
char flatFieldFile[MAX_STR_LENGTH];
|
||||
|
||||
/** number of bad channels from bad channel list */
|
||||
int nBadChans;
|
||||
|
||||
/** file with the bad channels */
|
||||
char badChanFile[MAX_STR_LENGTH];
|
||||
|
||||
/** list of bad channels */
|
||||
int badChansList[MAX_BADCHANS];
|
||||
|
||||
/** number of bad channels from flat field
|
||||
* i.e. channels which read 0 in the flat field file */
|
||||
int nBadFF;
|
||||
|
||||
/** list of bad channels from flat field
|
||||
* i.e. channels which read 0 in the flat field file */
|
||||
int badFFList[MAX_BADCHANS];
|
||||
|
||||
/** file with the angular conversion factors */
|
||||
char angConvFile[MAX_STR_LENGTH];
|
||||
|
||||
/** array of angular conversion constants for each module
|
||||
* \see ::angleConversionConstant */
|
||||
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) */
|
||||
double fineOffset;
|
||||
|
||||
/** beamline offset (might be a few degrees beacuse of encoder offset -
|
||||
* normally it is kept fixed for a long period of time) */
|
||||
double globalOffset;
|
||||
|
||||
/** number of positions at which the detector should acquire */
|
||||
int numberOfPositions;
|
||||
|
||||
/** list of encoder positions at which the detector should acquire */
|
||||
double detPositions[MAXPOS];
|
||||
|
||||
/** bin size for data merging */
|
||||
double binSize;
|
||||
|
||||
/** add encoder value flag (i.e. wether the detector is
|
||||
* moving - 1 - or stationary - 0) */
|
||||
int moveFlag;
|
||||
|
||||
/** number of rois defined */
|
||||
int nROI;
|
||||
|
||||
@ -238,39 +150,6 @@ private:
|
||||
/** timer values */
|
||||
int64_t timerValue[MAX_TIMERS];
|
||||
|
||||
/** action mask */
|
||||
int actionMask;
|
||||
|
||||
/** action script */
|
||||
mystring actionScript[MAX_ACTIONS];
|
||||
|
||||
/** action parameter */
|
||||
mystring actionParameter[MAX_ACTIONS];
|
||||
|
||||
/** scan mode */
|
||||
int scanMode[MAX_SCAN_LEVELS];
|
||||
|
||||
/** scan script */
|
||||
mystring scanScript[MAX_SCAN_LEVELS];
|
||||
|
||||
/** scan parameter */
|
||||
mystring scanParameter[MAX_SCAN_LEVELS];
|
||||
|
||||
/** n scan steps */
|
||||
int nScanSteps[MAX_SCAN_LEVELS];
|
||||
|
||||
/** scan steps */
|
||||
mysteps scanSteps[MAX_SCAN_LEVELS];
|
||||
|
||||
/** scan precision */
|
||||
int scanPrecision[MAX_SCAN_LEVELS];
|
||||
|
||||
/** memory offsets for the flat field coefficients */
|
||||
int ffoff;
|
||||
|
||||
/** memory offsets for the flat filed coefficient errors */
|
||||
int fferroff;
|
||||
|
||||
/** memory offsets for the module structures */
|
||||
int modoff;
|
||||
|
||||
@ -357,9 +236,6 @@ private:
|
||||
/** additional json header */
|
||||
char receiver_additionalJsonHeader[MAX_STR_LENGTH];
|
||||
|
||||
/** frames per file in receiver */
|
||||
int receiver_framesPerFile;
|
||||
|
||||
/** detector control server software API version */
|
||||
int64_t detectorControlAPIVersion;
|
||||
|
||||
@ -384,6 +260,27 @@ private:
|
||||
/** silent receiver */
|
||||
bool receiver_silentMode;
|
||||
|
||||
/** path of the output files */
|
||||
char receiver_filePath[MAX_STR_LENGTH];
|
||||
|
||||
/** file name prefix */
|
||||
char receiver_fileName[MAX_STR_LENGTH];
|
||||
|
||||
/** file index */
|
||||
int receiver_fileIndex;
|
||||
|
||||
/** file format */
|
||||
fileFormat receiver_fileFormatType;
|
||||
|
||||
/** frames per file */
|
||||
int receiver_framesPerFile;
|
||||
|
||||
/** filewriteenable */
|
||||
bool receiver_fileWriteEnable;
|
||||
|
||||
/** overwriteenable */
|
||||
bool receiver_overWriteEnable;
|
||||
|
||||
} sharedSlsDetector;
|
||||
|
||||
|
||||
@ -392,13 +289,6 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
using slsDetectorUtils::getDetectorType;
|
||||
using postProcessing::flatFieldCorrect;
|
||||
using postProcessing::rateCorrect;
|
||||
using postProcessing::setBadChannelCorrection;
|
||||
using angularConversion::readAngularConversion;
|
||||
using angularConversion::writeAngularConversion;
|
||||
using slsDetectorUtils::getAngularConversion;
|
||||
|
||||
//FIXME: all pos or id arguments needed only for same multi signature
|
||||
|
||||
@ -432,16 +322,6 @@ public:
|
||||
*/
|
||||
bool isMultiSlsDetectorClass();
|
||||
|
||||
/**
|
||||
* Decode data from the detector converting them to an array of doubles,
|
||||
* one for each channel (Mythen only)
|
||||
* @param datain data from the detector
|
||||
* @param nn size of datain array
|
||||
* @param fdata double array of decoded data
|
||||
* @returns pointer to a double array with a data per channel
|
||||
*/
|
||||
double* decodeData(int *datain, int &nn, double *fdata=NULL);
|
||||
|
||||
/**
|
||||
* Clears error mask and also the bit in parent det multi error mask
|
||||
* @returns error mask
|
||||
@ -562,6 +442,8 @@ public:
|
||||
*/
|
||||
void disconnectStop();
|
||||
|
||||
using slsDetectorUtils::getDetectorType;
|
||||
|
||||
/**
|
||||
* Get detector type by connecting to the detector without creating an object
|
||||
* @param name hostname of detector
|
||||
@ -605,72 +487,6 @@ public:
|
||||
*/
|
||||
std::string getDetectorType();
|
||||
|
||||
/**
|
||||
* Returns number of modules from shared memory (Mythen)
|
||||
* Other detectors, it is 1
|
||||
* @returns number of modules
|
||||
*/
|
||||
int getNMods();
|
||||
|
||||
/**
|
||||
* Returns number of modules in dimension d from shared memory (Mythen)
|
||||
* Other detectors, it is 1
|
||||
* @param d dimension d
|
||||
* @returns number of modules in dimension d
|
||||
*/
|
||||
int getNMod(dimension d);
|
||||
|
||||
/**
|
||||
* Returns maximum number of modules from shared memory (Mythen)
|
||||
* Other detectors, it is 1
|
||||
* @returns maximum number of modules
|
||||
*/
|
||||
int getMaxMods();
|
||||
|
||||
/**
|
||||
* Returns maximum number of modules in dimension d from shared memory (Mythen)
|
||||
* Other detectors, it is 1
|
||||
* @param d dimension d
|
||||
* @returns maximum number of modules in dimension d
|
||||
*/
|
||||
int getNMaxMod(dimension d);
|
||||
|
||||
/**
|
||||
* Returns maximum number of modules in dimension d (Mythen)
|
||||
* from the detector directly.
|
||||
* Other detectors, it is 1
|
||||
* @param d dimension d
|
||||
* @returns maximum number of modules in dimension d
|
||||
*/
|
||||
int getMaxNumberOfModules(dimension d=X); //
|
||||
|
||||
/**
|
||||
* Sets/Gets the number of modules in dimension d (Mythen)
|
||||
* from the detector directly.
|
||||
* Other detectors, it is 1
|
||||
* @param i the number of modules to set to (-1 gets)
|
||||
* @param d dimension d
|
||||
* @returns the number of modules in dimension d
|
||||
*/
|
||||
int setNumberOfModules(int n=GET_FLAG, dimension d=X);
|
||||
|
||||
/**
|
||||
* returns the number of channels per that module
|
||||
* from shared memory (Mythen)
|
||||
* @param imod insignificant
|
||||
* @returns number of channels per module
|
||||
*/
|
||||
int getChansPerMod(int imod=0);
|
||||
|
||||
/**
|
||||
* returns the number of channels per that module in dimension d
|
||||
* from shared memory (Mythen)
|
||||
* @param d dimension d
|
||||
* @param imod insignificant
|
||||
* @returns number of channels per module in dimension d
|
||||
*/
|
||||
int getChansPerMod( dimension d,int imod=0);
|
||||
|
||||
/**
|
||||
* Returns the total number of channels from shared memory
|
||||
* @returns the total number of channels
|
||||
@ -693,26 +509,6 @@ public:
|
||||
*/
|
||||
int getTotalNumberOfChannelsInclGapPixels(dimension d);
|
||||
|
||||
/**
|
||||
* Returns the maximum number of channels from shared memory (Mythen)
|
||||
* @returns the maximum number of channels
|
||||
*/
|
||||
int getMaxNumberOfChannels();
|
||||
|
||||
/**
|
||||
* Returns the maximum number of channels in dimension d from shared memory (Mythen)
|
||||
* @param d dimension d
|
||||
* @returns the maximum number of channels in dimension d
|
||||
*/
|
||||
int getMaxNumberOfChannels(dimension d);
|
||||
|
||||
/**
|
||||
* Returns the maximum number of channels in dimension d from shared memory (Mythen)
|
||||
* @param d dimension d
|
||||
* @returns the maximum number of channels in dimension d
|
||||
*/
|
||||
int getMaxNumberOfChannelsInclGapPixels(dimension d);
|
||||
|
||||
/**
|
||||
* returns the number of channels per chip from shared memory (Mythen)
|
||||
* @returns number of channels per chip
|
||||
@ -784,7 +580,7 @@ public:
|
||||
/**
|
||||
* Set/Gets TCP Port of detector or receiver
|
||||
* @param t port type
|
||||
* @param p port number (-1 gets)
|
||||
* @param num port number (-1 gets)
|
||||
* @returns port number
|
||||
*/
|
||||
int setPort(portType type, int num=-1);
|
||||
@ -895,7 +691,6 @@ public:
|
||||
* @returns OK or FAIL if the file could not be written
|
||||
* \sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
|
||||
*/
|
||||
using energyConversion::writeSettingsFile;
|
||||
int writeSettingsFile(std::string fname, int imod, int iodelay, int tau);
|
||||
|
||||
/**
|
||||
@ -1017,35 +812,6 @@ public:
|
||||
*/
|
||||
int saveCalibrationFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Sets/gets the detector in position i as master of the structure (Mythen)
|
||||
* (e.g. it gates the other detectors and therefore must be started as last.
|
||||
* Assumes that signal 0 is gate in, signal 1 is trigger in, signal 2 is gate out
|
||||
* @param i position of master (-1 gets, -2 unset)
|
||||
* @return master's position (-1 none)
|
||||
*/
|
||||
masterFlags setMaster(masterFlags flag);
|
||||
|
||||
/**
|
||||
* Sets/gets the synchronization mode of the various detector (Mythen)
|
||||
* @param sync syncronization mode
|
||||
* @returns current syncronization mode
|
||||
*/
|
||||
synchronizationMode setSynchronization(synchronizationMode sync=GET_SYNCHRONIZATION_MODE);
|
||||
|
||||
/**
|
||||
* Calcualtes the total number of steps of the acquisition
|
||||
* Called when number of frames, number of cycles, number of positions and scan steps change
|
||||
* @returns the total number of steps of the acquisition
|
||||
*/
|
||||
int setTotalProgress();
|
||||
|
||||
/**
|
||||
* Returns the current progress in %
|
||||
* @returns the current progress in %
|
||||
*/
|
||||
double getCurrentProgress();
|
||||
|
||||
/**
|
||||
* Get run status of the detector
|
||||
* @returns the status of the detector
|
||||
@ -1053,19 +819,11 @@ public:
|
||||
runStatus getRunStatus();
|
||||
|
||||
/**
|
||||
* Prepares detector for acquisition (Eiger and Gotthard)
|
||||
* For Gotthard, it sets the detector data transmission mode (CPU or receiver)
|
||||
* Prepares detector for acquisition (Eiger)
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int prepareAcquisition();
|
||||
|
||||
/**
|
||||
* Cleans up after acquisition (Gotthard only)
|
||||
* For Gotthard, it sets the detector data transmission to default (via CPU)
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int cleanupAcquisition();
|
||||
|
||||
/**
|
||||
* Start detector acquisition (Non blocking)
|
||||
* @returns OK or FAIL if even one does not start properly
|
||||
@ -1085,65 +843,22 @@ public:
|
||||
int sendSoftwareTrigger();
|
||||
|
||||
/**
|
||||
* Start readout (without exposure or interrupting exposure) (Mythen)
|
||||
* Start detector acquisition and read all data (Blocking until end of acquisition)
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int startAndReadAll();
|
||||
|
||||
/**
|
||||
* Start readout (without exposure or interrupting exposure) (Eiger store in ram)
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int startReadOut();
|
||||
|
||||
/**
|
||||
* Start detector acquisition and read all data (Blocking until end of acquisition)
|
||||
* (Mythen, puts all data into a data queue. Others, data at receiver via udp packets)
|
||||
* @returns pointer to the front of the data queue (return significant only for Mythen)
|
||||
* \sa startAndReadAllNoWait getDataFromDetector dataQueue
|
||||
*/
|
||||
int* startAndReadAll();
|
||||
|
||||
/**
|
||||
* Start detector acquisition and call read out, but not reading (data for Mythen,
|
||||
* and status for other detectors) from the socket.
|
||||
* (startAndReadAll calls this and getDataFromDetector. Client is not blocking,
|
||||
* but server is blocked until getDataFromDetector is called. so not recommended
|
||||
* for users)
|
||||
* Requests and receives all data from the detector (Eiger store in ram)
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int startAndReadAllNoWait();
|
||||
|
||||
/**
|
||||
* Reads from the detector socket (data frame for Mythen and status for other
|
||||
* detectors)
|
||||
* @returns pointer to the data or NULL. If NULL disconnects the socket
|
||||
* (return significant only for Mythen)
|
||||
* Other detectors return NULL
|
||||
* \sa getDataFromDetector
|
||||
*/
|
||||
int* getDataFromDetector(int *retval=NULL);
|
||||
|
||||
/**
|
||||
* Requests and receives a single data frame from the detector
|
||||
* (Mythen: and puts it in the data queue)
|
||||
* @returns pointer to the data or NULL. (return Mythen significant)
|
||||
* Other detectors return NULL
|
||||
* \sa getDataFromDetector
|
||||
*/
|
||||
int* readFrame();
|
||||
|
||||
/**
|
||||
* Receives all data from the detector
|
||||
* (Mythen: and puts them in a data queue)
|
||||
* @returns pointer to the front of the queue or NULL (return Mythen significant)
|
||||
* Other detectors return NULL
|
||||
* \sa getDataFromDetector dataQueue
|
||||
*/
|
||||
int* readAll();
|
||||
|
||||
/**
|
||||
* Requests detector for all data, calls readAll afterwards
|
||||
* (Mythen: and puts them in a data queue)
|
||||
* @returns pointer to the front of the queue or NULL (return Mythen significant)
|
||||
* Other detectors return NULL
|
||||
* \sa getDataFromDetector dataQueue
|
||||
*/
|
||||
int readAllNoWait();
|
||||
int readAll();
|
||||
|
||||
/**
|
||||
* Configures in detector the destination for UDP packets (Not Mythen)
|
||||
@ -1439,16 +1154,6 @@ public:
|
||||
*/
|
||||
int digitalTest(digitalTestMode mode, int imod=0);
|
||||
|
||||
/**
|
||||
* Execute trimming (Mythen)
|
||||
* @param mode trimming mode type
|
||||
* @param par1 parameter 1
|
||||
* @param par2 parameter 2
|
||||
* @param imod module index (-1 for all)
|
||||
* @returns result of trimming
|
||||
*/
|
||||
int executeTrimming(trimMode mode, int par1, int par2, int imod=-1);
|
||||
|
||||
/**
|
||||
* Load dark or gain image to detector (Gotthard)
|
||||
* @param index image type, 0 for dark image and 1 for gain image
|
||||
@ -1691,15 +1396,7 @@ public:
|
||||
int getChanRegs(double* retval,bool fromDetector);
|
||||
|
||||
/**
|
||||
* Configure module (who calls this?)
|
||||
* @param imod module number (-1 all)
|
||||
* @returns current register value
|
||||
* \sa ::sls_detector_module
|
||||
*/
|
||||
int setModule(int reg, int imod=-1);
|
||||
|
||||
/**
|
||||
* Configure Module (Mythen, Eiger)
|
||||
* Configure Module (Eiger)
|
||||
* Called for loading trimbits and settings settings to the detector
|
||||
* @param module module to be set - must contain correct module number and
|
||||
* also channel and chip registers
|
||||
@ -1723,77 +1420,6 @@ public:
|
||||
*/
|
||||
sls_detector_module *getModule(int imod);
|
||||
|
||||
/**
|
||||
* Configure channel (Mythen)
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Configure channel (Mythen)
|
||||
* @param chan channel to be set -
|
||||
* must contain correct channel, module and chip number
|
||||
* @returns current register value
|
||||
*/
|
||||
int setChannel(sls_detector_channel chan);
|
||||
|
||||
/**
|
||||
* Get channel (Mythen)
|
||||
* @param ichan channel number
|
||||
* @param ichip chip number
|
||||
* @param imod module number
|
||||
* @returns current channel structure for channel
|
||||
*/
|
||||
sls_detector_channel getChannel(int ichan, int ichip, int imod);
|
||||
|
||||
/**
|
||||
* Configure chip (Mythen)
|
||||
* @param reg chip register
|
||||
* @param ichip chip number (-1 all)
|
||||
* @param imod module number (-1 all)
|
||||
* @returns current register value
|
||||
* \sa ::sls_detector_chip
|
||||
*/
|
||||
int setChip(int reg, int ichip=-1, int imod=-1);
|
||||
|
||||
/**
|
||||
* Configure chip (Mythen)
|
||||
* @param chip chip to be set
|
||||
* must contain correct module and chip number and also channel registers
|
||||
* @returns current register value
|
||||
* \sa ::sls_detector_chip
|
||||
*/
|
||||
int setChip(sls_detector_chip chip);
|
||||
|
||||
/**
|
||||
* Get chip (Mythen)
|
||||
* @param ichip chip number
|
||||
* @param imod module number
|
||||
* @returns current chip structure for channel
|
||||
* \bug probably does not return corretly!
|
||||
*/
|
||||
sls_detector_chip getChip(int ichip, int imod);
|
||||
|
||||
/**
|
||||
* Get Move Flag (Mythen)
|
||||
* @param imod module number (-1 all)
|
||||
* @param istep step index
|
||||
* @returns move flag
|
||||
*/
|
||||
int getMoveFlag(int imod);
|
||||
|
||||
/**
|
||||
* Fill Module mask for flat field corrections (Mythen)
|
||||
* @param mM array
|
||||
* @returns number of modules
|
||||
*/
|
||||
int fillModuleMask(int *mM);
|
||||
|
||||
/**
|
||||
* Calibrate Pedestal (ChipTestBoard)
|
||||
* Starts acquisition, calibrates pedestal and writes to fpga
|
||||
@ -1830,123 +1456,6 @@ public:
|
||||
*/
|
||||
int getRateCorrection();
|
||||
|
||||
/**
|
||||
* Rate correct data (Mythen)
|
||||
* @param datain data array
|
||||
* @param errin error array on data (if NULL will default to sqrt(datain)
|
||||
* @param dataout array of corrected data
|
||||
* @param errout error on corrected data (if not NULL)
|
||||
* @returns 0
|
||||
*/
|
||||
int rateCorrect(double* datain, double *errin, double* dataout, double *errout);
|
||||
|
||||
/**
|
||||
* Set flat field corrections (Mythen)
|
||||
* @param fname name of the flat field file (or "" if disable)
|
||||
* @returns 0 if disable (or file could not be read), >0 otherwise
|
||||
*/
|
||||
int setFlatFieldCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set flat field corrections (Mythen)
|
||||
* @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(double *corr, double *ecorr=NULL);
|
||||
|
||||
/**
|
||||
* Get flat field corrections (Mythen)
|
||||
* @param corr if !=NULL will be filled with the correction coefficients
|
||||
* @param ecorr if !=NULL will be filled with the correction coefficients errors
|
||||
* @returns 0 if ff correction disabled, >0 otherwise
|
||||
*/
|
||||
int getFlatFieldCorrection(double *corr=NULL, double *ecorr=NULL);
|
||||
|
||||
/**
|
||||
* Flat field correct data (Mythen)
|
||||
* @param datain data array
|
||||
* @param errin error array on data (if NULL will default to sqrt(datain)
|
||||
* @param dataout array of corrected data
|
||||
* @param errout error on corrected data (if not NULL)
|
||||
* @returns 0
|
||||
*/
|
||||
int flatFieldCorrect(double* datain, double *errin, double* dataout, double *errout);
|
||||
|
||||
/**
|
||||
* Set bad channels correction (Mythen)
|
||||
* @param fname file with bad channel list ("" disable)
|
||||
* @returns 0 if bad channel disabled, >0 otherwise
|
||||
*/
|
||||
int setBadChannelCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set bad channels correction (Mythen)
|
||||
* @param nch number of bad channels
|
||||
* @param chs array of channels
|
||||
* @param ff 0 if normal bad channels, 1 if ff bad channels
|
||||
* @returns 0 if bad channel disabled, >0 otherwise
|
||||
*/
|
||||
int setBadChannelCorrection(int nch, int *chs, int ff=0);
|
||||
|
||||
/**
|
||||
* Get bad channels correction (Mythen)
|
||||
* @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
|
||||
*/
|
||||
int getBadChannelCorrection(int *bad=NULL);
|
||||
|
||||
/**
|
||||
* Reads an angular conversion file (Mythen, Gotthard)
|
||||
* \sa angleConversionConstant mythenDetector::readAngularConversion
|
||||
* @param fname file to be read
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversionFile(std::string fname="");
|
||||
|
||||
/**
|
||||
* Reads an angular conversion file (Mythen, Gotthard)
|
||||
* \sa angleConversionConstant mythenDetector::readAngularConversion
|
||||
* @param ifs input stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversion(std::ifstream& ifs);
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
* \sa angleConversionConstant mythenDetector::writeAngularConversion
|
||||
* @param fname file to be written
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(std::string fname="");
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
* \sa angleConversionConstant mythenDetector::writeAngularConversion
|
||||
* @param ofs output stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(std::ofstream &ofs);
|
||||
|
||||
/**
|
||||
* Get angular conversion (Mythen, Gotthard)
|
||||
* \sa angleConversionConstant mythenDetector::getAngularConversion
|
||||
* @param direction reference to diffractometer
|
||||
* @param angconv array that will be filled with the angular conversion constants
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int getAngularConversion(int &direction, angleConversionConstant *angconv=NULL) ;
|
||||
|
||||
/**
|
||||
* Return angular conversion pointer (Mythen, Gotthard)
|
||||
* @param imod module number
|
||||
* @returns angular conversion pointer
|
||||
*/
|
||||
angleConversionConstant *getAngularConversionPointer(int imod=0);
|
||||
|
||||
/**
|
||||
* Prints receiver configuration
|
||||
* @returns OK or FAIL
|
||||
@ -2035,7 +1544,7 @@ public:
|
||||
* @param s file directory
|
||||
* @returns file dir
|
||||
*/
|
||||
std::string setFilePath(std::string s="");
|
||||
std::string setFilePath(std::string s);
|
||||
|
||||
/**
|
||||
* Returns file name prefix
|
||||
@ -2048,14 +1557,14 @@ public:
|
||||
* @param s file name prefix
|
||||
* @returns file name prefix
|
||||
*/
|
||||
std::string setFileName(std::string s="");
|
||||
std::string setFileName(std::string s);
|
||||
|
||||
/**
|
||||
* Sets the max frames per file in receiver
|
||||
* @param f max frames per file
|
||||
* @returns max frames per file in receiver
|
||||
*/
|
||||
int setReceiverFramesPerFile(int f = -1);
|
||||
int setReceiverFramesPerFile(int f=-1);
|
||||
|
||||
/**
|
||||
* Sets the frames discard policy in receiver
|
||||
@ -2082,7 +1591,7 @@ public:
|
||||
* @param f file format
|
||||
* @returns file format
|
||||
*/
|
||||
fileFormat setFileFormat(fileFormat f=GET_FILE_FORMAT);
|
||||
fileFormat setFileFormat(fileFormat f);
|
||||
|
||||
/**
|
||||
* Returns file index
|
||||
@ -2095,7 +1604,13 @@ public:
|
||||
* @param i file index
|
||||
* @returns file index
|
||||
*/
|
||||
int setFileIndex(int i=-1);
|
||||
int setFileIndex(int i);
|
||||
|
||||
/**
|
||||
* increments file index
|
||||
* @returns the file index
|
||||
*/
|
||||
int incrementFileIndex();
|
||||
|
||||
/**
|
||||
* Receiver starts listening to packets
|
||||
@ -2109,13 +1624,6 @@ public:
|
||||
*/
|
||||
int stopReceiver();
|
||||
|
||||
/**
|
||||
* Sets the receiver to start any readout remaining in the fifo and
|
||||
* change status to transmitting (Mythen)
|
||||
* The status changes to run_finished when fifo is empty
|
||||
*/
|
||||
runStatus startReceiverReadout();
|
||||
|
||||
/**
|
||||
* Gets the status of the listening mode of receiver
|
||||
* @returns status
|
||||
@ -2194,13 +1702,6 @@ public:
|
||||
*/
|
||||
int enableDataStreamingFromReceiver(int enable=-1);
|
||||
|
||||
/**
|
||||
* Enable/disable or get data compression in receiver
|
||||
* @param i is -1 to get, 0 to disable and 1 to enable
|
||||
* @returns data compression in receiver
|
||||
*/
|
||||
int enableReceiverCompression(int i = -1);
|
||||
|
||||
/**
|
||||
* Enable/disable or 10Gbe
|
||||
* @param i is -1 to get, 0 to disable and 1 to enable
|
||||
@ -2348,20 +1849,6 @@ private:
|
||||
*/
|
||||
void deleteModule(sls_detector_module *myMod);
|
||||
|
||||
/**
|
||||
* Send a sls_detector_channel structure over socket
|
||||
* @param myChan channel structure to send
|
||||
* @returns number of bytes sent to the detector
|
||||
*/
|
||||
int sendChannel(sls_detector_channel* myChan);
|
||||
|
||||
/**
|
||||
* Send a sls_detector_chip structure over socket
|
||||
* @param myChip chip structure to send
|
||||
* @returns number of bytes sent to the detector
|
||||
*/
|
||||
int sendChip(sls_detector_chip* myChip);
|
||||
|
||||
/**
|
||||
* Send a sls_detector_module structure over socket
|
||||
* @param myMod module structure to send
|
||||
@ -2369,20 +1856,6 @@ private:
|
||||
*/
|
||||
int sendModule(sls_detector_module* myMod);
|
||||
|
||||
/**
|
||||
* Receive a sls_detector_channel structure over socket
|
||||
* @param myChan channel structure to receive
|
||||
* @returns number of bytes received from the detector
|
||||
*/
|
||||
int receiveChannel(sls_detector_channel* myChan);
|
||||
|
||||
/**
|
||||
* Receive a sls_detector_chip structure over socket
|
||||
* @param myChip chip structure to receive
|
||||
* @returns number of bytes received from the detector
|
||||
*/
|
||||
int receiveChip(sls_detector_chip* myChip);
|
||||
|
||||
/**
|
||||
* Receive a sls_detector_module structure over socket
|
||||
* @param myMod module structure to receive
|
||||
@ -2431,7 +1904,6 @@ private:
|
||||
*/
|
||||
std::string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
|
||||
/**
|
||||
* Get MAC from the receiver using udpip and
|
||||
* set up UDP connection in detector
|
||||
@ -2439,6 +1911,94 @@ private:
|
||||
*/
|
||||
int setUDPConnection();
|
||||
|
||||
/**
|
||||
* reads a calibration file
|
||||
* @param fname file to be read
|
||||
* @param gain reference to the gain variable
|
||||
* @param offset reference to the offset variable
|
||||
* @returns OK if successful, else FAIL or -1
|
||||
*/
|
||||
static int readCalibrationFile(std::string fname, double &gain, double &offset);
|
||||
|
||||
/**
|
||||
* writes a calibration file
|
||||
* @param fname file to be written
|
||||
* @param gain
|
||||
* @param offset
|
||||
* @returns OK if successful, else FAIL or -1
|
||||
*/
|
||||
static int writeCalibrationFile(std::string fname, double gain, double offset);
|
||||
|
||||
/**
|
||||
* reads a calibration file
|
||||
* @param fname file to be read
|
||||
* @param gain reference to the gain variable
|
||||
* @param offset reference to the offset variable
|
||||
* @returns OK if successful, else FAIL or -1
|
||||
*/
|
||||
static int readCalibrationFile(std::string fname, int *gain, int *offset);
|
||||
|
||||
/**
|
||||
* writes a calibration file
|
||||
* @param fname file to be written
|
||||
* @param gain reference to the gain variable
|
||||
* @param offset reference to the offset variable
|
||||
* @returns OK if successful, else FAIL or -1
|
||||
*/
|
||||
static int writeCalibrationFile(std::string fname, int *gain, int *offset);
|
||||
|
||||
/*
|
||||
* Template function to do linear interpolation between two points (Eiger only)
|
||||
*/
|
||||
template <typename E, typename V>
|
||||
V linearInterpolation(const E x, const E x1, const E x2, const V y1, const V y2){
|
||||
double k = static_cast<double>(y2-y1)/(x2-x1);
|
||||
double m = y1-k*x1;
|
||||
int y = round( k*x+m );
|
||||
return static_cast<V>(y);
|
||||
}
|
||||
|
||||
/**
|
||||
* interpolates dacs and trimbits between 2 trim files
|
||||
* @param a first module structure
|
||||
* @param b second module structure
|
||||
* @param energy energy to trim at
|
||||
* @param e1 reference trim value
|
||||
* @param e2 reference trim value
|
||||
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||
* @returns the pointer to the module structure with interpolated values or NULL if error
|
||||
*/
|
||||
sls_detector_module* interpolateTrim(
|
||||
sls_detector_module* a, sls_detector_module* b, const int energy,
|
||||
const int e1, const int e2, int tb=1);
|
||||
|
||||
/**
|
||||
* reads a trim/settings file
|
||||
* @param fname name of the file to be read
|
||||
* @param iodelay io delay (detector specific)
|
||||
* @param tau tau (detector specific)
|
||||
* @param myMod pointer to the module structure which has to be set. <BR>
|
||||
* If it is NULL a new module structure will be created
|
||||
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||
* @returns the pointer to myMod or NULL if reading the file failed
|
||||
*/
|
||||
|
||||
sls_detector_module* readSettingsFile(std::string fname,
|
||||
int& iodelay, int& tau,
|
||||
sls_detector_module* myMod=NULL, int tb=1);
|
||||
|
||||
/**
|
||||
* writes a trim/settings file
|
||||
* @param fname name of the file to be written
|
||||
* @param mod module structure which has to be written to file
|
||||
* @param iodelay io delay (detector specific)
|
||||
* @param tau tau (detector specific)
|
||||
* @returns OK or FAIL if the file could not be written
|
||||
*/
|
||||
int writeSettingsFile(std::string fname,
|
||||
sls_detector_module mod, int iodelay, int tau);
|
||||
|
||||
|
||||
/** slsDetector Id or position in the detectors list */
|
||||
int detId;
|
||||
|
||||
@ -2462,12 +2022,6 @@ private:
|
||||
/** socket for data acquisition */
|
||||
MySocketTCP *dataSocket;
|
||||
|
||||
/** pointer to flat field coefficients in shared memory */
|
||||
double *ffcoefficients;
|
||||
|
||||
/** pointer to flat field coefficient errors in shared memory */
|
||||
double *fferrors;
|
||||
|
||||
/** pointer to detector module structures in shared memory */
|
||||
sls_detector_module *detectorModules;
|
||||
|
||||
|
@ -84,114 +84,6 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
std::string getDetectorDeveloper(){return std::string("PSI");};
|
||||
// protected:
|
||||
|
||||
/**
|
||||
set angular conversion
|
||||
\param fname file with angular conversion constants ("" disable)
|
||||
\returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
virtual int setAngularConversionFile(std::string fname="")=0;
|
||||
|
||||
|
||||
/**
|
||||
pure virtual function
|
||||
returns the angular conversion file
|
||||
*/
|
||||
virtual std::string getAngularConversionFile()=0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
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
|
||||
*/
|
||||
virtual int setActionScript(int iaction, std::string fname="")=0;
|
||||
|
||||
/**
|
||||
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
|
||||
*/
|
||||
virtual int setActionParameter(int iaction, std::string par="")=0;
|
||||
|
||||
/**
|
||||
returns action script
|
||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
||||
\returns action script
|
||||
*/
|
||||
virtual std::string getActionScript(int iaction)=0;
|
||||
|
||||
/**
|
||||
returns action parameter
|
||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
||||
\returns action parameter
|
||||
*/
|
||||
virtual std::string getActionParameter(int iaction)=0;
|
||||
|
||||
/**
|
||||
set scan script
|
||||
\param index is the scan index (0 or 1)
|
||||
\param script fname for script ("" disable, "none" disables and overwrites current, "threshold" makes threshold scan, "trimbits" make trimbits scan, "energy" makes energy scan)
|
||||
\returns 0 if scan disabled, >0 otherwise
|
||||
*/
|
||||
virtual int setScanScript(int index, std::string script="")=0;
|
||||
|
||||
/**
|
||||
set scan script parameter
|
||||
\param index is the scan index (0 or 1)
|
||||
\param spar parameter to be passed to the scan script with syntax par=spar
|
||||
\returns 0 if scan disabled, >0 otherwise
|
||||
*/
|
||||
virtual int setScanParameter(int index, std::string spar="")=0;
|
||||
|
||||
|
||||
/** set scan precision
|
||||
\param index is the scan index (0 or 1)
|
||||
\param precision number of decimals to use for the scan variable in the file name
|
||||
\returns 0 if scan disabled, >0 otherwise */
|
||||
virtual int setScanPrecision(int index, int precision=-1)=0;
|
||||
|
||||
/**
|
||||
set scan steps (passed to the scan script as var=step)
|
||||
\param index is the scan index (0 or 1)
|
||||
\param nvalues is the number of steps
|
||||
\param values array of steps
|
||||
\returns 0 if scan disabled, >0 otherwise*/
|
||||
|
||||
virtual int setScanSteps(int index, int nvalues=-1, double *values=NULL)=0;
|
||||
|
||||
/**
|
||||
get scan script
|
||||
\param index is the scan index (0 or 1)
|
||||
\returns "none" if disables, "threshold" threshold scan, "trimbits" trimbits scan, "energy" energy scan or scan script name
|
||||
*/
|
||||
virtual std::string getScanScript(int index)=0;
|
||||
|
||||
/**
|
||||
get scan script
|
||||
\param index is the scan index (0 or 1)
|
||||
\returns scan script parameter
|
||||
*/
|
||||
virtual std::string getScanParameter(int index)=0;
|
||||
|
||||
/**
|
||||
get scan precision
|
||||
\param index is the scan index (0 or 1)
|
||||
\returns precision i.e. number of decimals to use for the scan variable in the file name
|
||||
*/
|
||||
virtual int getScanPrecision(int index)=0;
|
||||
|
||||
/**
|
||||
get scan steps
|
||||
\param index is the scan index (0 or 1)
|
||||
\param values pointer to array of values (must be allocated in advance)
|
||||
\returns number of steps
|
||||
*/
|
||||
virtual int getScanSteps(int index, double *values=NULL)=0;
|
||||
|
||||
|
||||
/**
|
||||
Writes the configuration file -- will contain all the informations needed for the configuration (e.g. for a PSI detector caldir, settingsdir, angconv, badchannels etc.)
|
||||
\param fname file name
|
||||
@ -208,26 +100,6 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int loadImageToDetector(imageType index,std::string const fname)=0;
|
||||
|
||||
/**
|
||||
\returns number of positions
|
||||
*/
|
||||
virtual int getNumberOfPositions()=0;// {return 0;};
|
||||
|
||||
/**
|
||||
\returns action mask
|
||||
*/
|
||||
virtual int getActionMask()=0;// {return 0;};
|
||||
/**
|
||||
\param index scan level index
|
||||
\returns current scan variable
|
||||
*/
|
||||
virtual double getCurrentScanVariable(int index)=0;// {return 0;};
|
||||
|
||||
/**
|
||||
\returns current position index
|
||||
*/
|
||||
virtual int getCurrentPositionIndex()=0;// {return 0;};
|
||||
|
||||
/**
|
||||
\returns total number of channels
|
||||
*/
|
||||
@ -238,28 +110,15 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int getTotalNumberOfChannels(dimension d)=0;
|
||||
|
||||
/** generates file name without extension */
|
||||
virtual std::string createFileName()=0;
|
||||
|
||||
|
||||
virtual void incrementProgress()=0;
|
||||
virtual void setCurrentProgress(int i=0)=0;
|
||||
virtual double getCurrentProgress()=0;
|
||||
virtual void incrementFileIndex()=0;
|
||||
virtual int setTotalProgress()=0;
|
||||
|
||||
|
||||
virtual double* decodeData(int *datain, int &nn, double *fdata=NULL)=0;
|
||||
|
||||
|
||||
virtual std::string getCurrentFileName()=0;
|
||||
|
||||
|
||||
virtual int getFileIndexFromFileName(std::string fname)=0;
|
||||
|
||||
virtual int getIndicesFromFileName(std::string fname,int &index)=0;
|
||||
|
||||
virtual double *convertAngles()=0;
|
||||
/**
|
||||
set rate correction
|
||||
\param t dead time in ns - if 0 disable correction, if >0 set dead time to t, if <0 set deadtime to default dead time for current settings
|
||||
@ -279,10 +138,6 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
\returns 0 if rate correction disabled, >0 otherwise
|
||||
*/
|
||||
virtual int getRateCorrection()=0;
|
||||
|
||||
virtual int setFlatFieldCorrection(std::string fname="")=0;
|
||||
|
||||
int setFlatFieldCorrectionFile(std::string fname=""){return setFlatFieldCorrection(fname);};
|
||||
|
||||
/**
|
||||
set/get dynamic range
|
||||
@ -290,22 +145,6 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
\returns current dynamic range
|
||||
*/
|
||||
virtual int setDynamicRange(int i=-1)=0;
|
||||
// int setBitDepth(int i=-1){return setDynamicRange(i);};
|
||||
|
||||
/**
|
||||
set/get the size of the detector
|
||||
\param i number of modules
|
||||
\param d dimension
|
||||
\returns current number of modules in direction d
|
||||
*/
|
||||
virtual int setNumberOfModules(int i=-1, dimension d=X)=0;
|
||||
|
||||
// int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1){return setNumberOfModules(nx/getChansPerMod(0),X);};
|
||||
|
||||
// int getDetectorSize(int &x0, int &y0, int &nx, int &ny){x0=0; nx=setNumberOfModules(-1,X)*getChansPerMod(0); return nx;};
|
||||
|
||||
virtual int getMaxNumberOfModules(dimension d=X)=0; //
|
||||
// int getMaximumDetectorSize(int &nx, int &ny){nx=getMaxNumberOfModules(X)*getChansPerMod(0); ny=1; return nx;};
|
||||
|
||||
|
||||
/** Locks/Unlocks the connection to the server
|
||||
@ -329,12 +168,6 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
|
||||
int startMeasurement(){acquire(0); return OK;};
|
||||
|
||||
/**
|
||||
asks and receives a data frame from the detector, writes it to disk and processes the data
|
||||
\returns pointer to the data or NULL (unused!!!).
|
||||
*/
|
||||
virtual int* readFrame()=0;
|
||||
|
||||
|
||||
/**
|
||||
get detector ids/versions for module=0
|
||||
@ -343,8 +176,6 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
\returns id
|
||||
*/
|
||||
virtual int64_t getId(idMode mode, int imod=0)=0;
|
||||
int64_t getModuleFirmwareVersion(){return getId(MODULE_FIRMWARE_VERSION,-1);};
|
||||
int64_t getModuleSerialNumber(int imod=-1){return getId(MODULE_SERIAL_NUMBER,imod);};
|
||||
int64_t getDetectorFirmwareVersion(){return getId(DETECTOR_FIRMWARE_VERSION,-1);};
|
||||
int64_t getDetectorSerialNumber(){return getId(DETECTOR_SERIAL_NUMBER,-1);};
|
||||
int64_t getDetectorSoftwareVersion(){return getId(DETECTOR_SOFTWARE_VERSION,-1);};
|
||||
@ -361,14 +192,13 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int stopAcquisition()=0;
|
||||
int stopMeasurement(){return stopAcquisition();};
|
||||
virtual int getChansPerMod(int imod=0)=0;
|
||||
|
||||
/**
|
||||
set/get timer value
|
||||
\param index timer index
|
||||
\param t time in ns or number of...(e.g. frames, gates, probes)
|
||||
\param t time in ns or number of...(e.g. frames, gates)
|
||||
\param imod module number
|
||||
\returns timer set value in ns or number of...(e.g. frames, gates, probes)
|
||||
\returns timer set value in ns or number of...(e.g. frames, gates)
|
||||
*/
|
||||
virtual int64_t setTimer(timerIndex index, int64_t t=-1, int imod = -1)=0;
|
||||
int64_t setExposureTime(int64_t t=-1, int imod = -1){return setTimer(ACQUISITION_TIME,t,imod);};
|
||||
@ -457,7 +287,6 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
virtual dacs_t setDAC(dacs_t val, dacIndex index , int mV, int imod=-1)=0;
|
||||
int setDACValue(int val, int index , int imod=-1) { return (int)setDAC((dacs_t)val,(dacIndex)index,0,imod);};
|
||||
|
||||
|
||||
/**
|
||||
gets ADC value
|
||||
\param index ADC index
|
||||
@ -466,7 +295,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual dacs_t getADC(dacIndex index, int imod=-1)=0;
|
||||
int getADCValue(int index, int imod=-1){return (int)getADC((dacIndex)index, imod);};
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@short get run status
|
||||
\returns status mask
|
||||
@ -557,6 +386,12 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int setFileIndex(int i)=0;
|
||||
|
||||
/**
|
||||
@short increments file index
|
||||
\returns the file index
|
||||
*/
|
||||
virtual int incrementFileIndex()=0;
|
||||
|
||||
|
||||
//receiver
|
||||
/**
|
||||
@ -627,76 +462,33 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
*/
|
||||
virtual int setReadReceiverFrequency(int freq=-1)=0;
|
||||
|
||||
/** Sets the receiver to start any readout remaining in the fifo and
|
||||
* change status to transmitting.
|
||||
* The status changes to run_finished when fifo is empty
|
||||
*/
|
||||
virtual runStatus startReceiverReadout()=0;
|
||||
|
||||
|
||||
/** returns detector type std::string from detector type index
|
||||
\param t std::string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
|
||||
\returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, MÖNCH, GENERIC
|
||||
\param t std::string can be Eiger, Gotthard, Jungfrau, Unknown
|
||||
\returns EIGER, GOTTHARD, JUNGFRAU, GENERIC
|
||||
*/
|
||||
static std::string getDetectorType(detectorType t){\
|
||||
switch (t) {\
|
||||
case MYTHEN: return std::string("Mythen"); \
|
||||
case PILATUS: return std::string("Pilatus"); \
|
||||
case EIGER: return std::string("Eiger"); \
|
||||
case GOTTHARD: return std::string("Gotthard"); \
|
||||
case AGIPD: return std::string("Agipd"); \
|
||||
case MOENCH: return std::string("Moench"); \
|
||||
case JUNGFRAU: return std::string("Jungfrau"); \
|
||||
case JUNGFRAUCTB: return std::string("JungfrauCTB"); \
|
||||
case PROPIX: return std::string("Propix"); \
|
||||
default: return std::string("Unknown"); \
|
||||
}};
|
||||
|
||||
/** returns detector type index from detector type std::string
|
||||
\param type can be MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC
|
||||
\returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Mönch, Unknown
|
||||
\param type can be EIGER, GOTTHARD, JUNGFRAU, GENERIC
|
||||
\returns Eiger, Gotthard, Jungfrau, Unknown
|
||||
*/
|
||||
static detectorType getDetectorType(std::string const type){\
|
||||
if (type=="Mythen") return MYTHEN;\
|
||||
if (type=="Pilatus") return PILATUS; \
|
||||
if (type=="Eiger") return EIGER; \
|
||||
if (type=="Gotthard") return GOTTHARD; \
|
||||
if (type=="Agipd") return AGIPD; \
|
||||
if (type=="Moench") return MOENCH; \
|
||||
if (type=="Jungfrau") return JUNGFRAU; \
|
||||
if (type=="JungfrauCTB") return JUNGFRAUCTB; \
|
||||
if (type=="Propix") return PROPIX; \
|
||||
return GENERIC;};
|
||||
|
||||
|
||||
|
||||
/** returns synchronization type index from std::string
|
||||
\param type can be none, gating, trigger, complementary
|
||||
\returns ONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
|
||||
*/
|
||||
static synchronizationMode getSyncType(std::string const type){\
|
||||
if (type=="none") return NO_SYNCHRONIZATION;\
|
||||
if (type=="gating") return MASTER_GATES;\
|
||||
if (type=="trigger") return MASTER_TRIGGERS; \
|
||||
if (type=="complementary") return SLAVE_STARTS_WHEN_MASTER_STOPS; \
|
||||
return GET_SYNCHRONIZATION_MODE; \
|
||||
};
|
||||
|
||||
/** returns synchronization type std::string from index
|
||||
\param s can be NONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
|
||||
\returns none, gating, trigger, complementary, unknown
|
||||
*/
|
||||
static std::string getSyncType(synchronizationMode s ){\
|
||||
switch(s) { \
|
||||
case NO_SYNCHRONIZATION: return std::string("none"); \
|
||||
case MASTER_GATES: return std::string("gating"); \
|
||||
case MASTER_TRIGGERS: return std::string("trigger"); \
|
||||
case SLAVE_STARTS_WHEN_MASTER_STOPS: return std::string("complementary"); \
|
||||
default: return std::string("unknown"); \
|
||||
}};
|
||||
|
||||
|
||||
|
||||
/** returns std::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, OUTPUT_LOW, OUTPUT_HIGH, MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG
|
||||
\returns std::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, gnd, vcc, sync, unknown
|
||||
@ -862,8 +654,8 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
}};
|
||||
|
||||
/** returns std::string from timer index
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_DEADTIME
|
||||
\returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, SUBFRAME_DEADTIME
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_DEADTIME
|
||||
\returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, SUBFRAME_DEADTIME
|
||||
*/
|
||||
static std::string getTimerType(timerIndex t){ \
|
||||
switch (t) { \
|
||||
@ -872,7 +664,6 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
case FRAME_PERIOD: return std::string("frame_period"); \
|
||||
case DELAY_AFTER_TRIGGER: return std::string("delay_after_trigger"); \
|
||||
case GATES_NUMBER: return std::string("gates_number"); \
|
||||
case PROBES_NUMBER: return std::string("probes_number"); \
|
||||
case CYCLES_NUMBER: return std::string("cycles_number"); \
|
||||
case ACTUAL_TIME: return std::string("actual_time"); \
|
||||
case MEASUREMENT_TIME: return std::string("measurement_time"); \
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,14 +36,11 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
std::string helpLine(int narg, char *args[], int action=HELP_ACTION);
|
||||
static std::string helpAcquire(int narg, char *args[], int action);
|
||||
static std::string helpData(int narg, char *args[], int action);
|
||||
static std::string helpFrame(int narg, char *args[], int action);
|
||||
static std::string helpStatus(int narg, char *args[], int action);
|
||||
static std::string helpDataStream(int narg, char *args[], int action);
|
||||
static std::string helpFree(int narg, char *args[], int action);
|
||||
static std::string helpHostname(int narg, char *args[], int action);
|
||||
static std::string helpUser(int narg, char *args[], int action);
|
||||
static std::string helpMaster(int narg, char *args[], int action);
|
||||
static std::string helpSync(int narg, char *args[], int action);
|
||||
static std::string helpExitServer(int narg, char *args[], int action);
|
||||
static std::string helpSettingsDir(int narg, char *args[], int action);
|
||||
static std::string helpCalDir(int narg, char *args[], int action);
|
||||
@ -51,14 +48,8 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
static std::string helpOutDir(int narg, char *args[], int action);
|
||||
static std::string helpFileName(int narg, char *args[], int action);
|
||||
static std::string helpFileIndex(int narg, char *args[], int action);
|
||||
static std::string helpFlatField(int narg, char *args[], int action);
|
||||
static std::string helpRateCorr(int narg, char *args[], int action);
|
||||
static std::string helpBadChannels(int narg, char *args[], int action);
|
||||
static std::string helpAngConv(int narg, char *args[], int action);
|
||||
static std::string helpThreaded(int narg, char *args[], int action);
|
||||
static std::string helpPositions(int narg, char *args[], int action);
|
||||
static std::string helpScripts(int narg, char *args[], int action);
|
||||
static std::string helpScans(int narg, char *args[], int action);
|
||||
static std::string helpNetworkParameter(int narg, char *args[], int action);
|
||||
static std::string helpPort(int narg, char *args[], int action);
|
||||
static std::string helpLock(int narg, char *args[], int action);
|
||||
@ -107,14 +98,11 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
std::string cmdUnknown(int narg, char *args[], int action);
|
||||
std::string cmdAcquire(int narg, char *args[], int action);
|
||||
std::string cmdData(int narg, char *args[], int action);
|
||||
std::string cmdFrame(int narg, char *args[], int action);
|
||||
std::string cmdStatus(int narg, char *args[], int action);
|
||||
std::string cmdDataStream(int narg, char *args[], int action);
|
||||
std::string cmdFree(int narg, char *args[], int action);
|
||||
std::string cmdHostname(int narg, char *args[], int action);
|
||||
std::string cmdUser(int narg, char *args[], int action);
|
||||
std::string cmdMaster(int narg, char *args[], int action);
|
||||
std::string cmdSync(int narg, char *args[], int action);
|
||||
std::string cmdHelp(int narg, char *args[], int action);
|
||||
std::string cmdExitServer(int narg, char *args[], int action);
|
||||
std::string cmdSettingsDir(int narg, char *args[], int action);
|
||||
@ -123,14 +111,8 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
std::string cmdOutDir(int narg, char *args[], int action);
|
||||
std::string cmdFileName(int narg, char *args[], int action);
|
||||
std::string cmdFileIndex(int narg, char *args[], int action);
|
||||
std::string cmdFlatField(int narg, char *args[], int action);
|
||||
std::string cmdRateCorr(int narg, char *args[], int action);
|
||||
std::string cmdBadChannels(int narg, char *args[], int action);
|
||||
std::string cmdAngConv(int narg, char *args[], int action);
|
||||
std::string cmdThreaded(int narg, char *args[], int action);
|
||||
std::string cmdPositions(int narg, char *args[], int action);
|
||||
std::string cmdScripts(int narg, char *args[], int action);
|
||||
std::string cmdScans(int narg, char *args[], int action);
|
||||
std::string cmdNetworkParameter(int narg, char *args[], int action);
|
||||
std::string cmdPort(int narg, char *args[], int action);
|
||||
std::string cmdLock(int narg, char *args[], int action);
|
||||
|
@ -72,55 +72,14 @@ int slsDetectorUsers::setFileIndex(int i){
|
||||
return (int)myDetector->setFileIndex(i);
|
||||
}
|
||||
|
||||
string slsDetectorUsers::getFlatFieldCorrectionDir(){
|
||||
return myDetector->getFlatFieldCorrectionDir();
|
||||
}
|
||||
|
||||
string slsDetectorUsers::setFlatFieldCorrectionDir(string dir){
|
||||
return myDetector->setFlatFieldCorrectionDir(dir);
|
||||
}
|
||||
|
||||
string slsDetectorUsers::getFlatFieldCorrectionFile(){
|
||||
return myDetector->getFlatFieldCorrectionFile();
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setFlatFieldCorrectionFile(string fname){
|
||||
return myDetector->setFlatFieldCorrectionFile(fname);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::enableFlatFieldCorrection(int i){
|
||||
return myDetector->enableFlatFieldCorrection(i);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::enableCountRateCorrection(int i){
|
||||
return myDetector->enableCountRateCorrection(i);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::enablePixelMaskCorrection(int i){
|
||||
return myDetector->enablePixelMaskCorrection(i);
|
||||
}
|
||||
int slsDetectorUsers::enableAngularConversion(int i){
|
||||
return myDetector->enableAngularConversion(i);
|
||||
}
|
||||
int slsDetectorUsers::enableWriteToFile(int i){
|
||||
return myDetector->enableWriteToFile(i);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setPositions(int nPos, double *pos){
|
||||
return myDetector->setPositions(nPos, pos);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::getPositions(double *pos){
|
||||
return myDetector->getPositions(pos);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setDetectorSize(int x0, int y0, int nx, int ny){
|
||||
if(myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y)>1)
|
||||
return 1;
|
||||
int nmod=nx/(myDetector->getChansPerMod(0));
|
||||
cout << myDetector->getChansPerMod(0) << " " << nx << " " << nmod << endl;
|
||||
return myDetector->setNumberOfModules(nmod)*myDetector->getChansPerMod(0);}
|
||||
|
||||
int slsDetectorUsers::getDetectorSize(int &x0, int &y0, int &nx, int &ny){
|
||||
y0=0;
|
||||
x0=0;
|
||||
@ -226,19 +185,6 @@ string slsDetectorUsers::getDetectorType(){
|
||||
return myDetector->sgetDetectorsType();
|
||||
}
|
||||
|
||||
void slsDetectorUsers::initDataset(int refresh){
|
||||
myDetector->initDataset(refresh);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::addFrame(double *data, double pos, double i0, double t, string fname, double var){
|
||||
myDetector->addFrame(data,pos,i0,t,fname,var);
|
||||
}
|
||||
|
||||
|
||||
void slsDetectorUsers::finalizeDataset(double *a, double *v, double *e, int &np){
|
||||
myDetector->finalizeDataset(a, v, e, np);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setReceiverMode(int n){
|
||||
return myDetector->setReadReceiverFrequency(n);
|
||||
}
|
||||
@ -267,14 +213,6 @@ string slsDetectorUsers::setClientDataStreamingInIP(string ip){
|
||||
return myDetector->setClientDataStreamingInIP(ip);
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::getModuleFirmwareVersion(){
|
||||
return myDetector->getModuleFirmwareVersion();
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::getModuleSerialNumber(int imod){
|
||||
return myDetector->getModuleSerialNumber(imod);
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::getDetectorFirmwareVersion(){
|
||||
return myDetector->getDetectorFirmwareVersion();
|
||||
}
|
||||
@ -337,39 +275,10 @@ void slsDetectorUsers::registerDataCallback(int( *userCallback)(detectorData*, i
|
||||
myDetector->registerDataCallback(userCallback,pArg);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerRawDataCallback(int( *userCallback)(double*, int, void*), void *pArg){
|
||||
myDetector->registerRawDataCallback(userCallback,pArg);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg){
|
||||
myDetector->registerAcquisitionFinishedCallback(func,pArg);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerGetPositionCallback( double (*func)(void*),void *arg){
|
||||
myDetector->registerGetPositionCallback(func,arg);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerConnectChannelsCallback( int (*func)(void*),void *arg){
|
||||
myDetector->registerConnectChannelsCallback(func,arg);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerDisconnectChannelsCallback( int (*func)(void*),void *arg){
|
||||
myDetector->registerDisconnectChannelsCallback(func,arg);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerGoToPositionCallback( int (*func)(double,void*),void *arg){
|
||||
myDetector->registerGoToPositionCallback(func,arg);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg){
|
||||
myDetector->registerGoToPositionNoWaitCallback(func,arg);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerGetI0Callback( double (*func)(int,void*),void *arg){
|
||||
myDetector->registerGetI0Callback(func,arg);
|
||||
}
|
||||
|
||||
|
||||
string slsDetectorUsers::putCommand(int narg, char *args[], int pos){
|
||||
if(narg < 2)
|
||||
return string("Error: Insufficient Parameters");
|
||||
@ -455,8 +364,8 @@ int slsDetectorUsers::setTenGigabitEthernet(int i) {
|
||||
return myDetector->enableTenGigabitEthernet(i);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::getNMods() {
|
||||
return myDetector->getNMods();
|
||||
int slsDetectorUsers::getNumberOfDetectors() {
|
||||
return myDetector->getNumberOfDetectors();
|
||||
}
|
||||
|
||||
double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds, int imod){
|
||||
|
@ -62,7 +62,6 @@ You can find examples of how this classes can be instatiated in mainClient.cpp
|
||||
\authors <a href="mailto:anna.bergamaschi@psi.ch">Anna Bergamaschi</a>, <a href="mailto:dhanya.thattil@psi.ch">Dhanya Thattil</a>
|
||||
@version 3.0
|
||||
<H2>Currently supported detectors</H2>
|
||||
\li MYTHEN
|
||||
\li GOTTHARD controls
|
||||
\li GOTTHARD data receiver
|
||||
\li EIGER
|
||||
@ -171,41 +170,6 @@ class slsDetectorUsers
|
||||
*/
|
||||
int setFileIndex(int i);
|
||||
|
||||
/**
|
||||
@short get flat field corrections file directory
|
||||
\returns flat field correction file directory
|
||||
*/
|
||||
std::string getFlatFieldCorrectionDir();
|
||||
|
||||
/**
|
||||
@short set flat field corrections file directory
|
||||
\param dir flat field correction file directory
|
||||
\returns flat field correction file directory
|
||||
*/
|
||||
std::string setFlatFieldCorrectionDir(std::string dir);
|
||||
|
||||
/**
|
||||
@short get flat field corrections file name
|
||||
\returns flat field correction file name
|
||||
*/
|
||||
std::string getFlatFieldCorrectionFile();
|
||||
|
||||
/**
|
||||
@short set flat field correction file
|
||||
\param fname name of the flat field file (or "" if disable)
|
||||
\returns 0 if disable (or file could not be read), >0 otherwise
|
||||
*/
|
||||
int setFlatFieldCorrectionFile(std::string fname="");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@short enable/disable flat field corrections (without changing file name)
|
||||
\param i 0 disables, 1 enables, -1 gets
|
||||
\returns 0 if ff corrections disabled, 1 if enabled
|
||||
*/
|
||||
int enableFlatFieldCorrection(int i=-1);
|
||||
|
||||
/**
|
||||
@short enable/disable count rate corrections
|
||||
\param i 0 disables, 1 enables with default values, -1 gets
|
||||
@ -213,49 +177,10 @@ class slsDetectorUsers
|
||||
*/
|
||||
int enableCountRateCorrection(int i=-1);
|
||||
|
||||
/**
|
||||
@short enable/disable bad channel corrections
|
||||
\param i 0 disables, 1 enables, -1 gets
|
||||
\returns 0 if bad channels corrections disabled, 1 if enabled
|
||||
*/
|
||||
int enablePixelMaskCorrection(int i=-1);
|
||||
|
||||
/**
|
||||
@short enable/disable angular conversion
|
||||
\param i 0 disables, 1 enables, -1 gets
|
||||
\returns 0 if angular conversion disabled, 1 if enabled
|
||||
*/
|
||||
int enableAngularConversion(int i=-1);
|
||||
|
||||
/**Enable write file function included*/
|
||||
|
||||
int enableWriteToFile(int i=-1);
|
||||
|
||||
/**
|
||||
@short set positions for the acquisition
|
||||
\param nPos number of positions
|
||||
\param pos array with the encoder positions
|
||||
\returns number of positions
|
||||
*/
|
||||
int setPositions(int nPos, double *pos);
|
||||
|
||||
/**
|
||||
@short get positions for the acquisition
|
||||
\param pos array which will contain the encoder positions
|
||||
\returns number of positions
|
||||
*/
|
||||
int getPositions(double *pos=NULL);
|
||||
|
||||
/**
|
||||
@short sets the detector size
|
||||
\param x0 horizontal position origin in channel number (-1 unchanged)
|
||||
\param y0 vertical position origin in channel number (-1 unchanged)
|
||||
\param nx number of channels in horiziontal (-1 unchanged)
|
||||
\param ny number of channels in vertical (-1 unchanged)
|
||||
\returns OK/FAIL
|
||||
*/
|
||||
int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
|
||||
|
||||
|
||||
/**
|
||||
@short gets detector size
|
||||
@ -419,43 +344,6 @@ class slsDetectorUsers
|
||||
|
||||
void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
|
||||
|
||||
/**
|
||||
@short register callback for accessing raw data - if the rawDataCallback is registered, no filewriting/postprocessing will be carried on automatically by the software - the raw data are deleted by the software
|
||||
\param userCallback function for postprocessing and saving the data - p is the pointer to the data, n is the number of channels
|
||||
\param pArg argument
|
||||
*/
|
||||
|
||||
void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
|
||||
|
||||
/**
|
||||
@short function to initalize a set of measurements (reset binning if angular conversion, reset summing otherwise) - can be overcome by the user's functions thanks to the virtual property
|
||||
\param refresh if 1, all parameters like ffcoefficients, badchannels, ratecorrections etc. are reset (should be called at least onece with this option), if 0 simply reset merging/ summation
|
||||
*/
|
||||
|
||||
virtual void initDataset(int refresh);
|
||||
|
||||
|
||||
/**
|
||||
@short adds frame to merging/summation - can be overcome by the user's functions thanks to the virtual property
|
||||
\param data pointer to the raw data
|
||||
\param pos encoder position
|
||||
\param i0 beam monitor readout for intensity normalization (if 0 not performed)
|
||||
\param t exposure time in seconds, required only if rate corrections
|
||||
\param fname file name (unused since filewriting would be performed by the user)
|
||||
\param var optional parameter - unused.
|
||||
*/
|
||||
|
||||
virtual void addFrame(double *data, double pos, double i0, double t, std::string fname, double var);
|
||||
|
||||
/**
|
||||
@short finalizes the data set returning the array of angles, values and errors to be used as final data - can be overcome by the user's functions thanks to the virtual property
|
||||
\param a pointer to the array of angles - can be null if no angular coversion is required
|
||||
\param v pointer to the array of values
|
||||
\param e pointer to the array of errors
|
||||
\param np reference returning the number of points
|
||||
*/
|
||||
|
||||
virtual void finalizeDataset(double *a, double *v, double *e, int &np);
|
||||
|
||||
|
||||
/** Enable or disable streaming data from receiver (creates transmitting sockets)
|
||||
@ -503,19 +391,6 @@ class slsDetectorUsers
|
||||
*/
|
||||
std::string setClientDataStreamingInIP(std::string ip="");
|
||||
|
||||
/**
|
||||
get get Module Firmware Version
|
||||
\returns id
|
||||
*/
|
||||
int64_t getModuleFirmwareVersion();
|
||||
|
||||
/**
|
||||
get get Module Serial Number
|
||||
@param imod module number
|
||||
\returns id
|
||||
*/
|
||||
int64_t getModuleSerialNumber(int imod=-1);
|
||||
|
||||
/**
|
||||
get get Detector Firmware Version
|
||||
\returns id
|
||||
@ -599,44 +474,6 @@ class slsDetectorUsers
|
||||
*/
|
||||
void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
|
||||
|
||||
/**
|
||||
@short register calbback for reading detector position
|
||||
\param func function for reading the detector position
|
||||
\param arg argument
|
||||
*/
|
||||
|
||||
void registerGetPositionCallback( double (*func)(void*),void *arg);
|
||||
/**
|
||||
@short register callback for connecting to the epics channels
|
||||
\param func function for connecting to the epics channels
|
||||
\param arg argument
|
||||
*/
|
||||
void registerConnectChannelsCallback( int (*func)(void*),void *arg);
|
||||
/**
|
||||
@short register callback to disconnect the epics channels
|
||||
\param func function to disconnect the epics channels
|
||||
\param arg argument
|
||||
*/
|
||||
void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
|
||||
/**
|
||||
@short register callback for moving the detector
|
||||
\param func function for moving the detector
|
||||
\param arg argument
|
||||
*/
|
||||
void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
|
||||
/**
|
||||
@short register callback for moving the detector without waiting
|
||||
\param func function for moving the detector
|
||||
\param arg argument
|
||||
*/
|
||||
void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
|
||||
/**
|
||||
@short register calbback reading to I0
|
||||
\param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0)
|
||||
\param arg argument
|
||||
*/
|
||||
void registerGetI0Callback( double (*func)(int,void*),void *arg);
|
||||
|
||||
/**
|
||||
@short sets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf
|
||||
\param narg value to be set
|
||||
@ -775,10 +612,10 @@ class slsDetectorUsers
|
||||
int setTenGigabitEthernet(int i = -1);
|
||||
|
||||
/**
|
||||
* returns total number of detector modules
|
||||
* @returns the total number of detector modules
|
||||
* returns total number of detectors
|
||||
* @returns the total number of detectors
|
||||
*/
|
||||
int getNMods();
|
||||
int getNumberOfDetectors();
|
||||
|
||||
/**
|
||||
* Set sub frame exposure time (only for Eiger)
|
||||
|
@ -1,9 +1,7 @@
|
||||
#include "slsDetectorUtils.h"
|
||||
#include "usersFunctions.h"
|
||||
#include "slsDetectorCommand.h"
|
||||
#include "postProcessing.h"
|
||||
#include "enCalLogClass.h"
|
||||
#include "angCalLogClass.h"
|
||||
|
||||
|
||||
#include <cstdlib>
|
||||
#include <sys/ipc.h>
|
||||
@ -12,32 +10,26 @@
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
slsDetectorUtils::slsDetectorUtils() {
|
||||
|
||||
|
||||
slsDetectorUtils::slsDetectorUtils():
|
||||
stoppedFlag(0),
|
||||
timerValue(0),
|
||||
currentSettings(0),
|
||||
currentThresholdEV(0),
|
||||
totalProgress(0),
|
||||
progressIndex(0),
|
||||
acquisition_finished(NULL),
|
||||
measurement_finished(NULL),
|
||||
acqFinished_p(NULL),
|
||||
measFinished_p(NULL),
|
||||
progress_call(0),
|
||||
pProgressCallArg(0)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
cout << "setting callbacks" << endl;
|
||||
#endif
|
||||
acquisition_finished=NULL;
|
||||
acqFinished_p=NULL;
|
||||
measurement_finished=NULL;
|
||||
measFinished_p=NULL;
|
||||
progress_call=0;
|
||||
pProgressCallArg=0;
|
||||
registerGetPositionCallback(&defaultGetPosition, NULL);
|
||||
registerConnectChannelsCallback(&defaultConnectChannels,NULL);
|
||||
registerDisconnectChannelsCallback(&defaultDisconnectChannels,NULL);
|
||||
registerGoToPositionCallback(&defaultGoToPosition,NULL);
|
||||
registerGoToPositionNoWaitCallback(&defaultGoToPositionNoWait,NULL);
|
||||
registerGetI0Callback(&defaultGetI0,NULL);
|
||||
#ifdef VERBOSE
|
||||
|
||||
registerAcquisitionFinishedCallback(&dummyAcquisitionFinished,this);
|
||||
registerMeasurementFinishedCallback(&dummyMeasurementFinished,this);
|
||||
cout << "done " << endl;
|
||||
#endif
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -61,73 +53,16 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
|
||||
|
||||
bool receiver = (setReceiverOnline()==ONLINE_FLAG);
|
||||
if(!receiver){
|
||||
setDetectorIndex(-1);
|
||||
}
|
||||
|
||||
int nc=setTimer(CYCLES_NUMBER,-1);
|
||||
int nf=setTimer(FRAME_NUMBER,-1);
|
||||
if (nc==0) nc=1;
|
||||
if (nf==0) nf=1;
|
||||
int multiframe = nc*nf;
|
||||
|
||||
progressIndex=0;
|
||||
*stoppedFlag=0;
|
||||
|
||||
angCalLogClass *aclog=NULL;
|
||||
enCalLogClass *eclog=NULL;
|
||||
int connectChannels=0;
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Acquire function "<< delflag << endl;
|
||||
cout << "Stopped flag is "<< stoppedFlag << delflag << endl;
|
||||
#endif
|
||||
|
||||
void *status;
|
||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION)) || getActionMode(angCalLog) || (getScanMode(0)==positionScan)|| (getScanMode(1)==positionScan)) {
|
||||
if (connectChannels==0)
|
||||
if (connect_channels) {
|
||||
connect_channels(CCarg);
|
||||
connectChannels=1;
|
||||
}
|
||||
}
|
||||
if (getActionMode(angCalLog)) {
|
||||
aclog=new angCalLogClass(this);
|
||||
}
|
||||
if (getActionMode(enCalLog)) {
|
||||
eclog=new enCalLogClass(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
setJoinThread(0);
|
||||
positionFinished(0);
|
||||
|
||||
|
||||
int nm=timerValue[MEASUREMENTS_NUMBER];
|
||||
if (nm<1)
|
||||
nm=1;
|
||||
|
||||
|
||||
int np=getNumberOfPositions();
|
||||
if (np<1)
|
||||
np=1;
|
||||
|
||||
|
||||
int ns0=1;
|
||||
if (*actionMask & (1 << MAX_ACTIONS)) {
|
||||
ns0=getScanSteps(0);
|
||||
if (ns0<1)
|
||||
ns0=1;
|
||||
}
|
||||
|
||||
int ns1=1;
|
||||
if (*actionMask & (1 << (MAX_ACTIONS+1))) {
|
||||
ns1=getScanSteps(1);
|
||||
if (ns1<1)
|
||||
ns1=1;
|
||||
}
|
||||
|
||||
// verify receiver is idle
|
||||
if(receiver){
|
||||
pthread_mutex_lock(&mg);
|
||||
@ -137,12 +72,10 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
pthread_mutex_unlock(&mg);
|
||||
}
|
||||
|
||||
|
||||
// start processing thread
|
||||
if (*threadedProcessing)
|
||||
startThread(delflag);
|
||||
#ifdef VERBOSE
|
||||
cout << " starting thread " << endl;
|
||||
#endif
|
||||
|
||||
|
||||
//resets frames caught in receiver
|
||||
if(receiver){
|
||||
@ -152,304 +85,84 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
pthread_mutex_unlock(&mg);
|
||||
}
|
||||
|
||||
|
||||
// loop through measurements
|
||||
for(int im=0;im<nm;++im) {
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << " starting measurement "<< im << " of " << nm << endl;
|
||||
#endif
|
||||
if (*stoppedFlag)
|
||||
break;
|
||||
|
||||
// start script
|
||||
if (*stoppedFlag==0) {
|
||||
executeAction(startScript);
|
||||
}
|
||||
// start receiver
|
||||
if(receiver){
|
||||
|
||||
for (int is0=0; is0<ns0; ++is0) {
|
||||
|
||||
if (*stoppedFlag==0) {
|
||||
executeScan(0,is0);
|
||||
} else
|
||||
break;
|
||||
|
||||
|
||||
for (int is1=0; is1<ns1; ++is1) {
|
||||
|
||||
if (*stoppedFlag==0) {
|
||||
executeScan(1,is1);
|
||||
} else
|
||||
break;
|
||||
|
||||
if (*stoppedFlag==0) {
|
||||
executeAction(scriptBefore);
|
||||
} else
|
||||
break;
|
||||
|
||||
ResetPositionIndex();
|
||||
|
||||
for (int ip=0; ip<np; ++ip) {
|
||||
|
||||
if (*stoppedFlag==0) {
|
||||
if (getNumberOfPositions()>0) {
|
||||
moveDetector(detPositions[ip]);
|
||||
IncrementPositionIndex();
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "moving to position" << std::endl;
|
||||
#endif
|
||||
}
|
||||
} else
|
||||
break;
|
||||
|
||||
|
||||
pthread_mutex_lock(&mp);
|
||||
createFileName();
|
||||
pthread_mutex_unlock(&mp);
|
||||
|
||||
// script before
|
||||
if (*stoppedFlag==0) {
|
||||
executeAction(scriptBefore);
|
||||
} else
|
||||
break;
|
||||
|
||||
|
||||
// header before
|
||||
if (*stoppedFlag==0) {
|
||||
executeAction(headerBefore);
|
||||
|
||||
if (*correctionMask&(1<< ANGULAR_CONVERSION) || aclog){
|
||||
positionFinished(0);
|
||||
setCurrentPosition(getDetectorPosition());
|
||||
}
|
||||
|
||||
if (aclog)
|
||||
aclog->addStep(getCurrentPosition(), getCurrentFileName());
|
||||
|
||||
if (eclog)
|
||||
eclog->addStep(setDAC(-1,THRESHOLD,0), getCurrentFileName());
|
||||
|
||||
|
||||
if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
||||
if (get_i0)
|
||||
get_i0(0, IOarg);
|
||||
}
|
||||
|
||||
setCurrentFrameIndex(0);
|
||||
|
||||
if (multiframe>1)
|
||||
setFrameIndex(0);
|
||||
else
|
||||
setFrameIndex(-1);
|
||||
|
||||
// file name and start receiver
|
||||
if(receiver){
|
||||
pthread_mutex_lock(&mp);
|
||||
createFileName();
|
||||
pthread_mutex_unlock(&mp);
|
||||
//send receiver file name
|
||||
pthread_mutex_lock(&mg);
|
||||
setFileName(fileIO::getFileName());
|
||||
|
||||
if(startReceiver() == FAIL) {
|
||||
cout << "Start receiver failed " << endl;
|
||||
stopReceiver();
|
||||
*stoppedFlag=1;
|
||||
pthread_mutex_unlock(&mg);
|
||||
break;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "Receiver started " << endl;
|
||||
#endif
|
||||
pthread_mutex_unlock(&mg);
|
||||
|
||||
//let processing thread listen to these packets
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "Acquiring " << endl;
|
||||
#endif
|
||||
startAndReadAll();
|
||||
#ifdef VERBOSE
|
||||
cout << "detector finished" << endl;
|
||||
cout << "returned! " << endl;
|
||||
#endif
|
||||
|
||||
|
||||
if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
||||
if (get_i0)
|
||||
currentI0=get_i0(1,IOarg);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "pos finished? " << endl;
|
||||
#endif
|
||||
|
||||
positionFinished(1);
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "done! " << endl;
|
||||
#endif
|
||||
|
||||
|
||||
if (*threadedProcessing==0){
|
||||
#ifdef VERBOSE
|
||||
cout << "start unthreaded process data " << endl;
|
||||
#endif
|
||||
processData(delflag);
|
||||
}
|
||||
|
||||
} else
|
||||
break;
|
||||
|
||||
while (dataQueueSize()) usleep(100000);
|
||||
|
||||
// close file
|
||||
if(!receiver){
|
||||
detectorType type = getDetectorsType();
|
||||
if ((type==GOTTHARD) || (type==MOENCH) || (type==JUNGFRAUCTB) ){
|
||||
if((*correctionMask)&(1<<WRITE_FILE))
|
||||
closeDataFile();
|
||||
}
|
||||
}
|
||||
|
||||
// stop receiver
|
||||
else{
|
||||
pthread_mutex_lock(&mg);
|
||||
if (stopReceiver() == FAIL) {
|
||||
*stoppedFlag = 1;
|
||||
pthread_mutex_unlock(&mg);
|
||||
} else {
|
||||
pthread_mutex_unlock(&mg);
|
||||
if (*threadedProcessing && dataReady)
|
||||
sem_wait(&sem_endRTAcquisition); // waits for receiver's external process to be done sending data to gui
|
||||
}
|
||||
}
|
||||
|
||||
// header after
|
||||
if (*stoppedFlag==0) {
|
||||
pthread_mutex_lock(&mp);
|
||||
executeAction(headerAfter);
|
||||
pthread_mutex_unlock(&mp);
|
||||
}
|
||||
|
||||
if (*stoppedFlag) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "exiting since the detector has been stopped" << std::endl;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
}//end position loop ip
|
||||
|
||||
|
||||
//script after
|
||||
if (*stoppedFlag==0) {
|
||||
executeAction(scriptAfter);
|
||||
}
|
||||
|
||||
if (*stoppedFlag) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "exiting since the detector has been stopped" << std::endl;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
}//end scan1 loop is1
|
||||
|
||||
|
||||
if (*stoppedFlag) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "exiting since the detector has been stopped" << std::endl;
|
||||
#endif
|
||||
pthread_mutex_lock(&mg);
|
||||
if(startReceiver() == FAIL) {
|
||||
cout << "Start receiver failed " << endl;
|
||||
stopReceiver();
|
||||
*stoppedFlag=1;
|
||||
pthread_mutex_unlock(&mg);
|
||||
break;
|
||||
}
|
||||
|
||||
}//end scan0 loop is0
|
||||
|
||||
|
||||
|
||||
if (*stoppedFlag==0) {
|
||||
executeAction(stopScript);
|
||||
}
|
||||
|
||||
if (*stoppedFlag) {
|
||||
#ifdef VERBOSE
|
||||
cout << "findex incremented " << endl;
|
||||
#endif
|
||||
if(*correctionMask&(1<<WRITE_FILE))
|
||||
IncrementFileIndex();
|
||||
pthread_mutex_lock(&mg);
|
||||
setFileIndex(fileIO::getFileIndex());
|
||||
pthread_mutex_unlock(&mg);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "exiting since the detector has been stopped" << std::endl;
|
||||
#endif
|
||||
break;
|
||||
|
||||
//let processing thread listen to these packets
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
}
|
||||
|
||||
// detector start
|
||||
startAndReadAll();
|
||||
|
||||
if (*threadedProcessing==0){
|
||||
processData(delflag);
|
||||
}
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "findex incremented " << endl;
|
||||
#endif
|
||||
if(*correctionMask&(1<<WRITE_FILE))
|
||||
IncrementFileIndex();
|
||||
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
||||
setFileIndex(fileIO::getFileIndex());
|
||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||
// stop receiver
|
||||
if(receiver){
|
||||
pthread_mutex_lock(&mg);
|
||||
if (stopReceiver() == FAIL) {
|
||||
*stoppedFlag = 1;
|
||||
pthread_mutex_unlock(&mg);
|
||||
} else {
|
||||
pthread_mutex_unlock(&mg);
|
||||
if (*threadedProcessing && dataReady)
|
||||
sem_wait(&sem_endRTAcquisition); // waits for receiver's external process to be done sending data to gui
|
||||
}
|
||||
}
|
||||
|
||||
int findex = 0;
|
||||
pthread_mutex_lock(&mg);
|
||||
findex = incrementFileIndex();
|
||||
pthread_mutex_unlock(&mg);
|
||||
|
||||
if (measurement_finished){
|
||||
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
||||
measurement_finished(im,*fileIndex,measFinished_p);
|
||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||
pthread_mutex_lock(&mg);
|
||||
measurement_finished(im,findex,measFinished_p);
|
||||
pthread_mutex_unlock(&mg);
|
||||
}
|
||||
|
||||
if (*stoppedFlag) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "exiting since the detector has been stopped" << std::endl;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
}//end measurements loop im
|
||||
|
||||
|
||||
|
||||
// waiting for the data processing thread to finish!
|
||||
if (*threadedProcessing) {
|
||||
#ifdef VERBOSE
|
||||
cout << "wait for data processing thread" << endl;
|
||||
#endif
|
||||
setJoinThread(1);
|
||||
|
||||
//let processing thread continue and checkjointhread
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
|
||||
pthread_join(dataProcessingThread, &status);
|
||||
#ifdef VERBOSE
|
||||
cout << "data processing thread joined" << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if(progress_call)
|
||||
progress_call(getCurrentProgress(),pProgressCallArg);
|
||||
|
||||
|
||||
if (connectChannels) {
|
||||
if (disconnect_channels)
|
||||
disconnect_channels(DCarg);
|
||||
}
|
||||
|
||||
if (aclog)
|
||||
delete aclog;
|
||||
|
||||
if (eclog)
|
||||
delete eclog;
|
||||
#ifdef VERBOSE
|
||||
cout << "acquisition finished callback " << endl;
|
||||
#endif
|
||||
if (acquisition_finished)
|
||||
acquisition_finished(getCurrentProgress(),getDetectorStatus(),acqFinished_p);
|
||||
#ifdef VERBOSE
|
||||
cout << "acquisition finished callback done " << endl;
|
||||
#endif
|
||||
|
||||
sem_destroy(&sem_newRTAcquisition);
|
||||
sem_destroy(&sem_endRTAcquisition);
|
||||
@ -473,128 +186,35 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
//Naveen change
|
||||
|
||||
int slsDetectorUtils::setTotalProgress() {
|
||||
|
||||
int nf=1, npos=1, nscan[MAX_SCAN_LEVELS]={1,1}, nc=1, nm=1;
|
||||
|
||||
if (timerValue[FRAME_NUMBER])
|
||||
nf=timerValue[FRAME_NUMBER];
|
||||
int nf=1, nc=1, ns=1, nm=1;
|
||||
|
||||
if (timerValue[CYCLES_NUMBER]>0)
|
||||
nc=timerValue[CYCLES_NUMBER];
|
||||
if (timerValue[FRAME_NUMBER])
|
||||
nf=timerValue[FRAME_NUMBER];
|
||||
|
||||
if (timerValue[MEASUREMENTS_NUMBER]>0)
|
||||
nm=timerValue[MEASUREMENTS_NUMBER];
|
||||
if (timerValue[CYCLES_NUMBER]>0)
|
||||
nc=timerValue[CYCLES_NUMBER];
|
||||
|
||||
if (*numberOfPositions>0)
|
||||
npos=*numberOfPositions;
|
||||
if (timerValue[STORAGE_CELL_NUMBER]>0)
|
||||
ns=timerValue[STORAGE_CELL_NUMBER]+1;
|
||||
|
||||
if ((nScanSteps[0]>0) && (*actionMask & (1 << MAX_ACTIONS)))
|
||||
nscan[0]=nScanSteps[0];
|
||||
if (timerValue[MEASUREMENTS_NUMBER]>0)
|
||||
nm=timerValue[MEASUREMENTS_NUMBER];
|
||||
|
||||
if ((nScanSteps[1]>0) && (*actionMask & (1 << (MAX_ACTIONS+1))))
|
||||
nscan[1]=nScanSteps[1];
|
||||
|
||||
totalProgress=nm*nf*nc*npos*nscan[0]*nscan[1];
|
||||
totalProgress=nm*nf*nc*ns;
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "nc " << nc << endl;
|
||||
cout << "nm " << nm << endl;
|
||||
cout << "nf " << nf << endl;
|
||||
cout << "npos " << npos << endl;
|
||||
cout << "nscan[0] " << nscan[0] << endl;
|
||||
cout << "nscan[1] " << nscan[1] << endl;
|
||||
|
||||
cout << "Set total progress " << totalProgress << endl;
|
||||
cout << "nm " << nm << endl;
|
||||
cout << "nf " << nf << endl;
|
||||
cout << "nc " << nc << endl;
|
||||
cout << "ns " << ns << endl;
|
||||
cout << "Set total progress " << totalProgress << endl;
|
||||
#endif
|
||||
return totalProgress;
|
||||
return totalProgress;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetectorUtils::setBadChannelCorrection(string fname, int &nbadtot, int *badchanlist, int off){
|
||||
|
||||
int nbad;
|
||||
int badlist[MAX_BADCHANS];
|
||||
|
||||
ifstream infile;
|
||||
string str;
|
||||
//int interrupt=0;
|
||||
//int ich;
|
||||
//int chmin,chmax;
|
||||
#ifdef VERBOSE
|
||||
std::cout << "utils: Setting bad channel correction to " << fname << std::endl;
|
||||
#endif
|
||||
// int modmi=0;
|
||||
int modma=1;
|
||||
int singlefile=0;
|
||||
|
||||
string fn;
|
||||
int offset=off;
|
||||
|
||||
|
||||
nbadtot=0;
|
||||
|
||||
if (fname=="" || fname=="none") {
|
||||
;
|
||||
} else {
|
||||
|
||||
if (fname.find(".sn")==string::npos && fname.find(".chans")==string::npos) {
|
||||
modma=setNumberOfModules();
|
||||
singlefile=1;
|
||||
}
|
||||
|
||||
for (int im=0; im<modma; im++) {
|
||||
|
||||
|
||||
if (singlefile) {
|
||||
|
||||
ostringstream ostfn;
|
||||
ostfn << fname << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
|
||||
fn=ostfn.str();
|
||||
|
||||
} else
|
||||
fn=fname;
|
||||
|
||||
|
||||
|
||||
infile.open(fn.c_str(), ios_base::in);
|
||||
if (infile.is_open()==0) {
|
||||
std::cout << "could not open file " << fname <<std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
nbad=setBadChannelCorrection(infile, nbad, badlist, offset);
|
||||
infile.close();
|
||||
|
||||
for (int ich=0; ich<nbad; ich++) {
|
||||
if (nbadtot<MAX_BADCHANS) {
|
||||
badchanlist[nbadtot]=badlist[ich];
|
||||
nbadtot++;
|
||||
}
|
||||
}
|
||||
|
||||
offset+=getChansPerMod(im);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (nbadtot>0 && nbadtot<MAX_BADCHANS) {
|
||||
return nbadtot;
|
||||
} else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
double slsDetectorUtils::getCurrentProgress() {
|
||||
pthread_mutex_lock(&mp);
|
||||
#ifdef VERBOSE
|
||||
@ -611,7 +231,8 @@ double slsDetectorUtils::getCurrentProgress() {
|
||||
void slsDetectorUtils::incrementProgress() {
|
||||
pthread_mutex_lock(&mp);
|
||||
progressIndex++;
|
||||
cout << fixed << setprecision(2) << setw (6) << 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
||||
cout << fixed << setprecision(2) << setw (6)
|
||||
<< 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
||||
pthread_mutex_unlock(&mp);
|
||||
#ifdef VERBOSE
|
||||
cout << endl;
|
||||
@ -625,7 +246,8 @@ void slsDetectorUtils::incrementProgress() {
|
||||
void slsDetectorUtils::setCurrentProgress(int i){
|
||||
pthread_mutex_lock(&mp);
|
||||
progressIndex=i;
|
||||
cout << fixed << setprecision(2) << setw (6) << 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
||||
cout << fixed << setprecision(2) << setw (6)
|
||||
<< 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
||||
pthread_mutex_unlock(&mp);
|
||||
#ifdef VERBOSE
|
||||
cout << endl;
|
||||
@ -638,11 +260,8 @@ void slsDetectorUtils::setCurrentProgress(int i){
|
||||
int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
|
||||
|
||||
|
||||
|
||||
slsDetectorCommand *cmd;
|
||||
|
||||
|
||||
// char ext[100];
|
||||
int skip=0;
|
||||
string fname;
|
||||
string str;
|
||||
@ -652,16 +271,12 @@ int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
|
||||
char *args[10];
|
||||
|
||||
char myargs[10][1000];
|
||||
|
||||
//args[0]=myargs[0];
|
||||
//args[1]=myargs[1];
|
||||
;
|
||||
|
||||
string sargname, sargval;
|
||||
int iline=0;
|
||||
|
||||
if (level==2) {
|
||||
// fname=fname1+string(".config");
|
||||
// readConfigurationFile(fname);
|
||||
#ifdef VERBOSE
|
||||
cout << "config file read" << endl;
|
||||
#endif
|
||||
@ -703,11 +318,7 @@ int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
|
||||
}
|
||||
|
||||
if (level!=2) {
|
||||
if (string(args[0])==string("flatfield"))
|
||||
skip=1;
|
||||
else if (string(args[0])==string("badchannels"))
|
||||
skip=1;
|
||||
else if (string(args[0])==string("trimbits"))
|
||||
if (string(args[0])==string("trimbits"))
|
||||
skip=1;
|
||||
}
|
||||
if (skip==0)
|
||||
@ -755,8 +366,6 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
names[nvar++]="cycles";
|
||||
names[nvar++]="measurements";
|
||||
names[nvar++]="timing";
|
||||
names[nvar++]="flatfield";
|
||||
names[nvar++]="badchannels";
|
||||
|
||||
switch (type) {
|
||||
case EIGER:
|
||||
@ -767,29 +376,12 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
names[nvar++]="trimbits";
|
||||
break;
|
||||
case GOTTHARD:
|
||||
case PROPIX:
|
||||
names[nvar++]="flags";
|
||||
names[nvar++]="delay";
|
||||
names[nvar++]="gates";
|
||||
names[nvar++]="ratecorr";
|
||||
break;
|
||||
case JUNGFRAU:
|
||||
names[nvar++]="flags";
|
||||
names[nvar++]="delay";
|
||||
names[nvar++]="gates";
|
||||
names[nvar++]="ratecorr";
|
||||
names[nvar++]="clkdivider";
|
||||
break;
|
||||
case MYTHEN:
|
||||
names[nvar++]="flags";
|
||||
names[nvar++]="threshold";
|
||||
names[nvar++]="delay";
|
||||
names[nvar++]="gates";
|
||||
names[nvar++]="probes";
|
||||
names[nvar++]="fineoff";
|
||||
names[nvar++]="ratecorr";
|
||||
names[nvar++]="trimbits";
|
||||
break;
|
||||
case JUNGFRAUCTB:
|
||||
names[nvar++]="dac:0";
|
||||
names[nvar++]="dac:1";
|
||||
@ -838,24 +430,6 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
}
|
||||
|
||||
|
||||
names[nvar++]="startscript";
|
||||
names[nvar++]="startscriptpar";
|
||||
names[nvar++]="stopscript";
|
||||
names[nvar++]="stopscriptpar";
|
||||
names[nvar++]="scriptbefore";
|
||||
names[nvar++]="scriptbeforepar";
|
||||
names[nvar++]="scriptafter";
|
||||
names[nvar++]="scriptafterpar";
|
||||
names[nvar++]="scan0script";
|
||||
names[nvar++]="scan0par";
|
||||
names[nvar++]="scan0prec";
|
||||
names[nvar++]="scan0steps";
|
||||
names[nvar++]="scan1script";
|
||||
names[nvar++]="scan1par";
|
||||
names[nvar++]="scan1prec";
|
||||
names[nvar++]="scan1steps";
|
||||
|
||||
|
||||
int iv=0;
|
||||
string fname1;
|
||||
|
||||
@ -868,13 +442,6 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
}
|
||||
|
||||
|
||||
int nargs;
|
||||
if (level==2)
|
||||
nargs=2;
|
||||
else
|
||||
nargs=1;
|
||||
|
||||
|
||||
if (level==2) {
|
||||
fname1=fname+string(".config");
|
||||
writeConfigurationFile(fname1);
|
||||
@ -887,49 +454,11 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
outfile.open(fname1.c_str(),ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
cmd=new slsDetectorCommand(this);
|
||||
for (iv=0; iv<nvar-3; iv++) {
|
||||
for (iv=0; iv<nvar; iv++) {
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
|
||||
}
|
||||
|
||||
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
if (level==2) {
|
||||
fname1=fname+string(".ff");
|
||||
strcpy(args[1],fname1.c_str());
|
||||
}
|
||||
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
|
||||
iv++;
|
||||
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
if (level==2) {
|
||||
fname1=fname+string(".bad");
|
||||
strcpy(args[1],fname1.c_str());
|
||||
}
|
||||
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
|
||||
iv++;
|
||||
|
||||
|
||||
|
||||
if (level==2) {
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
size_t c=fname.rfind('/');
|
||||
if (c<string::npos) {
|
||||
fname1=fname.substr(0,c+1)+string("trim_")+fname.substr(c+1);
|
||||
} else {
|
||||
fname1=string("trim_")+fname;
|
||||
}
|
||||
strcpy(args[1],fname1.c_str());
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "writing to file " << fname1 << std::endl;
|
||||
#endif
|
||||
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
|
||||
iv++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
delete cmd;
|
||||
|
||||
outfile.close();
|
||||
@ -948,3 +477,72 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetectorUtils::readDataFile(std::string fname, short int *data, int nch) {
|
||||
std::ifstream infile;
|
||||
int iline=0;
|
||||
std::string str;
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
iline=readDataFile(infile, data, nch, 0);
|
||||
infile.close();
|
||||
} else {
|
||||
std::cout<< "Could not read file " << fname << std::endl;
|
||||
return -1;
|
||||
}
|
||||
return iline;
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUtils::readDataFile(std::ifstream &infile, short int *data, int nch, int offset) {
|
||||
int ichan, iline=0;
|
||||
short int idata;
|
||||
int interrupt=0;
|
||||
std::string str;
|
||||
while (infile.good() and interrupt==0) {
|
||||
getline(infile,str);
|
||||
std::istringstream ssstr(str);
|
||||
ssstr >> ichan >> idata;
|
||||
if (ssstr.fail() || ssstr.bad()) {
|
||||
interrupt=1;
|
||||
break;
|
||||
}
|
||||
if (iline<nch) {
|
||||
if (ichan>=offset) {
|
||||
data[iline]=idata;
|
||||
iline++;
|
||||
}
|
||||
} else {
|
||||
interrupt=1;
|
||||
break;
|
||||
}
|
||||
return iline;
|
||||
};
|
||||
return iline;
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUtils::writeDataFile(std::string fname,int nch, short int *data) {
|
||||
std::ofstream outfile;
|
||||
if (data==NULL)
|
||||
return slsDetectorDefs::FAIL;
|
||||
outfile.open (fname.c_str(),std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
writeDataFile(outfile, nch, data, 0);
|
||||
outfile.close();
|
||||
return slsDetectorDefs::OK;
|
||||
} else {
|
||||
std::cout<< "Could not open file " << fname << "for writing"<< std::endl;
|
||||
return slsDetectorDefs::FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUtils::writeDataFile(std::ofstream &outfile,int nch, short int *data, int offset) {
|
||||
if (data==NULL)
|
||||
return slsDetectorDefs::FAIL;
|
||||
for (int ichan=0; ichan<nch; ichan++)
|
||||
outfile << ichan+offset << " " << *(data+ichan) << std::endl;
|
||||
return slsDetectorDefs::OK;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user