mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-08 19:10:42 +02:00
clang-format on multi detector
This commit is contained in:
parent
500304024d
commit
ff440f1325
File diff suppressed because it is too large
Load Diff
@ -2,13 +2,14 @@
|
|||||||
#define MULTI_SLS_DETECTOR_H
|
#define MULTI_SLS_DETECTOR_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@libdoc The multiSlsDetector class is used to operate several slsDetectors in parallel.
|
@libdoc The multiSlsDetector class is used to operate several slsDetectors in
|
||||||
|
parallel.
|
||||||
* @short This is the base class for multi detector system functionalities
|
* @short This is the base class for multi detector system functionalities
|
||||||
* @author Anna Bergamaschi
|
* @author Anna Bergamaschi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sls_detector_defs.h"
|
|
||||||
#include "error_defs.h"
|
#include "error_defs.h"
|
||||||
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
class slsDetector;
|
class slsDetector;
|
||||||
class SharedMemory;
|
class SharedMemory;
|
||||||
@ -16,28 +17,28 @@ class ZmqSocket;
|
|||||||
class detectorData;
|
class detectorData;
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <thread>
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define MULTI_SHMVERSION 0x181002
|
#define MULTI_SHMVERSION 0x181002
|
||||||
#define SHORT_STRING_LENGTH 50
|
#define SHORT_STRING_LENGTH 50
|
||||||
#define DATE_LENGTH 30
|
#define DATE_LENGTH 30
|
||||||
|
|
||||||
class multiSlsDetector : public virtual slsDetectorDefs, public virtual errorDefs {
|
class multiSlsDetector : public virtual slsDetectorDefs,
|
||||||
|
public virtual errorDefs {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @short structure allocated in shared memory to store detector settings for IPC and cache
|
* @short structure allocated in shared memory to store detector settings
|
||||||
|
* for IPC and cache
|
||||||
*/
|
*/
|
||||||
typedef struct sharedMultiSlsDetector {
|
typedef struct sharedMultiSlsDetector {
|
||||||
|
|
||||||
|
/* FIXED PATTERN FOR STATIC FUNCTIONS. DO NOT CHANGE, ONLY APPEND
|
||||||
/* FIXED PATTERN FOR STATIC FUNCTIONS. DO NOT CHANGE, ONLY APPEND ------*/
|
* ------*/
|
||||||
|
|
||||||
/** shared memory version */
|
/** shared memory version */
|
||||||
int shmversion;
|
int shmversion;
|
||||||
@ -54,10 +55,8 @@ private:
|
|||||||
/** number of sls detectors in shared memory */
|
/** number of sls detectors in shared memory */
|
||||||
int numberOfDetectors;
|
int numberOfDetectors;
|
||||||
|
|
||||||
/** END OF FIXED PATTERN -----------------------------------------------*/
|
/** END OF FIXED PATTERN
|
||||||
|
* -----------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Number of detectors operated at once */
|
/** Number of detectors operated at once */
|
||||||
int numberOfDetector[2];
|
int numberOfDetector[2];
|
||||||
@ -102,7 +101,6 @@ private:
|
|||||||
/** timer values */
|
/** timer values */
|
||||||
int64_t timerValue[MAX_TIMERS];
|
int64_t timerValue[MAX_TIMERS];
|
||||||
|
|
||||||
|
|
||||||
/** flag for acquiring */
|
/** flag for acquiring */
|
||||||
bool acquiringFlag;
|
bool acquiringFlag;
|
||||||
|
|
||||||
@ -115,16 +113,12 @@ private:
|
|||||||
|
|
||||||
} sharedMultiSlsDetector;
|
} sharedMultiSlsDetector;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param id multi detector id
|
* @param id multi detector id
|
||||||
* @param verify true to verify if shared memory version matches existing one
|
* @param verify true to verify if shared memory version matches existing
|
||||||
|
* one
|
||||||
* @param update true to update last user pid, date etc
|
* @param update true to update last user pid, date etc
|
||||||
*/
|
*/
|
||||||
multiSlsDetector(int id = 0, bool verify = true, bool update = true);
|
multiSlsDetector(int id = 0, bool verify = true, bool update = true);
|
||||||
@ -137,7 +131,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Creates/open shared memory, initializes detector structure and members
|
* Creates/open shared memory, initializes detector structure and members
|
||||||
* Called by constructor/ set hostname / read config file
|
* Called by constructor/ set hostname / read config file
|
||||||
* @param verify true to verify if shared memory version matches existing one
|
* @param verify true to verify if shared memory version matches existing
|
||||||
|
* one
|
||||||
* @param update true to update last user pid, date etc
|
* @param update true to update last user pid, date etc
|
||||||
*/
|
*/
|
||||||
void setupMultiDetector(bool verify = true, bool update = true);
|
void setupMultiDetector(bool verify = true, bool update = true);
|
||||||
@ -154,16 +149,19 @@ public:
|
|||||||
* and return a vector of results
|
* and return a vector of results
|
||||||
*/
|
*/
|
||||||
template <typename RT, typename... CT>
|
template <typename RT, typename... CT>
|
||||||
std::vector<RT> parallelCall(RT (slsDetector::*somefunc)(CT...), CT... Args);
|
std::vector<RT> parallelCall(RT (slsDetector::*somefunc)(CT...),
|
||||||
|
CT... Args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If specific position, then provide result with that detector at position pos
|
* If specific position, then provide result with that detector at position
|
||||||
* else concatenate the result of all detectors
|
* pos else concatenate the result of all detectors
|
||||||
* @param somefunc function pointer
|
* @param somefunc function pointer
|
||||||
* @param pos positin of detector in array (-1 is for all)
|
* @param pos positin of detector in array (-1 is for all)
|
||||||
* @returns result for detector at that position or concatenated string of all detectors
|
* @returns result for detector at that position or concatenated string of
|
||||||
|
* all detectors
|
||||||
*/
|
*/
|
||||||
// std::string concatResultOrPos(std::string (slsDetector::*somefunc)(int), int pos);
|
// std::string concatResultOrPos(std::string (slsDetector::*somefunc)(int),
|
||||||
|
// int pos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decodes which detector and the corresponding channel numbers for it
|
* Decodes which detector and the corresponding channel numbers for it
|
||||||
@ -282,23 +280,25 @@ public:
|
|||||||
* Gets the hostname of detector at particular position
|
* Gets the hostname of detector at particular position
|
||||||
* or concatenated hostnames of all the sls detectors
|
* or concatenated hostnames of all the sls detectors
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns concatenated hostnames of all detectors or hostname of specific one
|
* @returns concatenated hostnames of all detectors or hostname of specific
|
||||||
|
* one
|
||||||
*/
|
*/
|
||||||
std::string getHostname(int detPos = -1);
|
std::string getHostname(int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends detectors to the end of the list in shared memory
|
* Appends detectors to the end of the list in shared memory
|
||||||
* Connects to them to set up online flag
|
* Connects to them to set up online flag
|
||||||
* @param name concatenated hostname of the sls detectors to be appended to the list
|
* @param name concatenated hostname of the sls detectors to be appended to
|
||||||
|
* the list
|
||||||
*/
|
*/
|
||||||
void addMultipleDetectors(const char *name);
|
void addMultipleDetectors(const char *name);
|
||||||
|
|
||||||
|
|
||||||
using slsDetectorDefs::getDetectorType;
|
using slsDetectorDefs::getDetectorType;
|
||||||
/**
|
/**
|
||||||
* Get Detector type for a particular sls detector or get the first one
|
* Get Detector type for a particular sls detector or get the first one
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns detector type of sls detector in position pos, if -1, returns the first det type
|
* @returns detector type of sls detector in position pos, if -1, returns
|
||||||
|
* the first det type
|
||||||
*/
|
*/
|
||||||
detectorType getDetectorsType(int detPos = -1);
|
detectorType getDetectorsType(int detPos = -1);
|
||||||
|
|
||||||
@ -306,14 +306,16 @@ public:
|
|||||||
* Concatenates string types of all sls detectors or
|
* Concatenates string types of all sls detectors or
|
||||||
* returns the detector type of the first sls detector
|
* returns the detector type of the first sls detector
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns detector type of sls detector in position pos, if -1, concatenates
|
* @returns detector type of sls detector in position pos, if -1,
|
||||||
|
* concatenates
|
||||||
*/
|
*/
|
||||||
std::string sgetDetectorsType(int detPos = -1);
|
std::string sgetDetectorsType(int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Detector type (concatenates if different)
|
* Gets Detector type (concatenates if different)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns detector type of sls detector in position pos, if -1, concatenates
|
* @returns detector type of sls detector in position pos, if -1,
|
||||||
|
* concatenates
|
||||||
*/
|
*/
|
||||||
std::string getDetectorType(int detPos = -1);
|
std::string getDetectorType(int detPos = -1);
|
||||||
|
|
||||||
@ -338,7 +340,8 @@ public:
|
|||||||
void getNumberOfDetectors(int &nx, int &ny);
|
void getNumberOfDetectors(int &nx, int &ny);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the total number of channels of all sls detectors from shared memory
|
* Returns the total number of channels of all sls detectors from shared
|
||||||
|
* memory
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns the total number of channels of all sls detectors
|
* @returns the total number of channels of all sls detectors
|
||||||
*/
|
*/
|
||||||
@ -364,21 +367,23 @@ public:
|
|||||||
int getTotalNumberOfChannelsInclGapPixels(dimension d, int detPos = -1);
|
int getTotalNumberOfChannelsInclGapPixels(dimension d, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum number of channels of all sls detectors in each dimension d
|
* Returns the maximum number of channels of all sls detectors in each
|
||||||
* from shared memory. multi detector shared memory variable to calculate
|
* dimension d from shared memory. multi detector shared memory variable to
|
||||||
* offsets for each sls detector
|
* calculate offsets for each sls detector
|
||||||
* @param d dimension d
|
* @param d dimension d
|
||||||
* @returns the maximum number of channels of all sls detectors in dimension d
|
* @returns the maximum number of channels of all sls detectors in dimension
|
||||||
|
* d
|
||||||
*/
|
*/
|
||||||
int getMaxNumberOfChannelsPerDetector(dimension d);
|
int getMaxNumberOfChannelsPerDetector(dimension d);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum number of channels of all sls detectors in each dimension d
|
* Sets the maximum number of channels of all sls detectors in each
|
||||||
* from shared memory, multi detector shared memory variable to calculate
|
* dimension d from shared memory, multi detector shared memory variable to
|
||||||
* offsets for each sls detector
|
* calculate offsets for each sls detector
|
||||||
* @param d dimension d
|
* @param d dimension d
|
||||||
* @param i maximum number of channels for multi structure in dimension d
|
* @param i maximum number of channels for multi structure in dimension d
|
||||||
* @returns the maximum number of channels of all sls detectors in dimension d
|
* @returns the maximum number of channels of all sls detectors in dimension
|
||||||
|
* d
|
||||||
*/
|
*/
|
||||||
int setMaxNumberOfChannelsPerDetector(dimension d, int i);
|
int setMaxNumberOfChannelsPerDetector(dimension d, int i);
|
||||||
|
|
||||||
@ -386,7 +391,8 @@ public:
|
|||||||
* Get Detector offset from shared memory in dimension d
|
* Get Detector offset from shared memory in dimension d
|
||||||
* @param d dimension d
|
* @param d dimension d
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns offset in dimension d, -1 if pos is not an actual position in list
|
* @returns offset in dimension d, -1 if pos is not an actual position in
|
||||||
|
* list
|
||||||
*/
|
*/
|
||||||
int getDetectorOffset(dimension d, int detPos = -1);
|
int getDetectorOffset(dimension d, int detPos = -1);
|
||||||
|
|
||||||
@ -399,8 +405,8 @@ public:
|
|||||||
void setDetectorOffset(dimension d, int off, int detPos = -1);
|
void setDetectorOffset(dimension d, int off, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the channel offsets in X and Y dimension for all the sls detectors
|
* Updates the channel offsets in X and Y dimension for all the sls
|
||||||
* It is required for decodeNMod and setting ROI
|
* detectors It is required for decodeNMod and setting ROI
|
||||||
*/
|
*/
|
||||||
void updateOffsets();
|
void updateOffsets();
|
||||||
|
|
||||||
@ -408,8 +414,10 @@ public:
|
|||||||
* Checks if the multi detectors are online and sets the online flag
|
* Checks if the multi detectors are online and sets the online flag
|
||||||
* @param online if GET_ONLINE_FLAG, only returns shared memory online flag,
|
* @param online if GET_ONLINE_FLAG, only returns shared memory online flag,
|
||||||
* else sets the detector in online/offline state
|
* else sets the detector in online/offline state
|
||||||
* if OFFLINE_FLAG, (i.e. no communication to the detector - using only local structure - no data acquisition possible!);
|
* if OFFLINE_FLAG, (i.e. no communication to the detector - using only
|
||||||
* if ONLINE_FLAG, detector in online state (i.e. communication to the detector updating the local structure)
|
* local structure - no data acquisition possible!); if ONLINE_FLAG,
|
||||||
|
* detector in online state (i.e. communication to the detector updating the
|
||||||
|
* local structure)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns online/offline status
|
* @returns online/offline status
|
||||||
*/
|
*/
|
||||||
@ -491,9 +499,9 @@ public:
|
|||||||
detectorSettings getSettings(int detPos = -1);
|
detectorSettings getSettings(int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load detector settings from the settings file picked from the trimdir/settingsdir
|
* Load detector settings from the settings file picked from the
|
||||||
* Eiger only stores in shared memory ( a get will overwrite this)
|
* trimdir/settingsdir Eiger only stores in shared memory ( a get will
|
||||||
* For Eiger, one must use threshold
|
* overwrite this) For Eiger, one must use threshold
|
||||||
* @param isettings settings
|
* @param isettings settings
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns current settings
|
* @returns current settings
|
||||||
@ -515,7 +523,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns current threshold value for imod in ev (-1 failed)
|
* @returns current threshold value for imod in ev (-1 failed)
|
||||||
*/
|
*/
|
||||||
int setThresholdEnergy(int e_eV, detectorSettings isettings=GET_SETTINGS,int tb=1, int detPos = -1);
|
int setThresholdEnergy(int e_eV, detectorSettings isettings = GET_SETTINGS,
|
||||||
|
int tb = 1, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the detector trimbit/settings directory \sa sharedSlsDetector
|
* Returns the detector trimbit/settings directory \sa sharedSlsDetector
|
||||||
@ -586,14 +595,16 @@ public:
|
|||||||
int sendSoftwareTrigger(int detPos = -1);
|
int sendSoftwareTrigger(int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start detector acquisition and read all data (Blocking until end of acquisition)
|
* Start detector acquisition and read all data (Blocking until end of
|
||||||
|
* acquisition)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int startAndReadAll(int detPos = -1);
|
int startAndReadAll(int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start readout (without exposure or interrupting exposure) (Eiger store in ram)
|
* Start readout (without exposure or interrupting exposure) (Eiger store in
|
||||||
|
* ram)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
@ -618,7 +629,8 @@ public:
|
|||||||
* @param index timer index
|
* @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, probes)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @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,
|
||||||
|
* probes)
|
||||||
*/
|
*/
|
||||||
int64_t setTimer(timerIndex index, int64_t t = -1, int detPos = -1);
|
int64_t setTimer(timerIndex index, int64_t t = -1, int detPos = -1);
|
||||||
|
|
||||||
@ -629,7 +641,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns exposure time in ns, or s if specified
|
* @returns exposure time in ns, or s if specified
|
||||||
*/
|
*/
|
||||||
double setExposureTime(double t = -1, bool inseconds = false, int detPos = -1);
|
double setExposureTime(double t = -1, bool inseconds = false,
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get exposure period
|
* Set/get exposure period
|
||||||
@ -638,7 +651,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns exposure period in ns, or s if specified
|
* @returns exposure period in ns, or s if specified
|
||||||
*/
|
*/
|
||||||
double setExposurePeriod(double t = -1, bool inseconds = false, int detPos = -1);
|
double setExposurePeriod(double t = -1, bool inseconds = false,
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get delay after trigger (Gotthard, Jungfrau(not for this release))
|
* Set/get delay after trigger (Gotthard, Jungfrau(not for this release))
|
||||||
@ -647,7 +661,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns delay after trigger in ns, or s if specified
|
* @returns delay after trigger in ns, or s if specified
|
||||||
*/
|
*/
|
||||||
double setDelayAfterTrigger(double t = -1, bool inseconds = false, int detPos = -1);
|
double setDelayAfterTrigger(double t = -1, bool inseconds = false,
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Advanced users)
|
* (Advanced users)
|
||||||
@ -657,7 +672,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns sub frame exposure time in ns, or s if specified
|
* @returns sub frame exposure time in ns, or s if specified
|
||||||
*/
|
*/
|
||||||
double setSubFrameExposureTime(double t = -1, bool inseconds = false, int detPos = -1);
|
double setSubFrameExposureTime(double t = -1, bool inseconds = false,
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (Advanced users)
|
* (Advanced users)
|
||||||
@ -667,7 +683,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns sub frame dead time in ns, or s if specified
|
* @returns sub frame dead time in ns, or s if specified
|
||||||
*/
|
*/
|
||||||
double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false, int detPos = -1);
|
double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false,
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get number of frames
|
* Set/get number of frames
|
||||||
@ -720,18 +737,22 @@ public:
|
|||||||
double getMeasuredSubFramePeriod(bool inseconds = false, int detPos = -1);
|
double getMeasuredSubFramePeriod(bool inseconds = false, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get timer value left in acquisition (not all implemented for all detectors)
|
* Set/get timer value left in acquisition (not all implemented for all
|
||||||
|
* detectors)
|
||||||
* @param index timer index
|
* @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, probes)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @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,
|
||||||
|
* probes)
|
||||||
*/
|
*/
|
||||||
int64_t getTimeLeft(timerIndex index, int detPos = -1);
|
int64_t getTimeLeft(timerIndex index, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set speed
|
* Set speed
|
||||||
* @param sp speed type (clkdivider option for Jungfrau and Eiger, others for Mythen/Gotthard)
|
* @param sp speed type (clkdivider option for Jungfrau and Eiger, others
|
||||||
* @param value (clkdivider 0,1,2 for full, half and quarter speed). Other values check manual
|
* for Mythen/Gotthard)
|
||||||
|
* @param value (clkdivider 0,1,2 for full, half and quarter speed). Other
|
||||||
|
* values check manual
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns value of speed set
|
* @returns value of speed set
|
||||||
*/
|
*/
|
||||||
@ -739,7 +760,8 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get dynamic range and updates the number of dataBytes
|
* Set/get dynamic range and updates the number of dataBytes
|
||||||
* (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to 1)
|
* (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to
|
||||||
|
* 1)
|
||||||
* @param i dynamic range (-1 get)
|
* @param i dynamic range (-1 get)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns current dynamic range
|
* @returns current dynamic range
|
||||||
@ -768,7 +790,8 @@ public:
|
|||||||
* Get adc value
|
* Get adc value
|
||||||
* @param index adc(DAC) index
|
* @param index adc(DAC) index
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns current adc value (temperature for eiger and jungfrau in millidegrees)
|
* @returns current adc value (temperature for eiger and jungfrau in
|
||||||
|
* millidegrees)
|
||||||
*/
|
*/
|
||||||
int getADC(dacIndex index, int detPos = -1);
|
int getADC(dacIndex index, int detPos = -1);
|
||||||
|
|
||||||
@ -778,20 +801,26 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns current timing mode
|
* @returns current timing mode
|
||||||
*/
|
*/
|
||||||
externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE, int detPos = -1);
|
externalCommunicationMode setExternalCommunicationMode(
|
||||||
|
externalCommunicationMode pol = GET_EXTERNAL_COMMUNICATION_MODE,
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get external signal flags (to specify triggerinrising edge etc) (Gotthard, Mythen)
|
* Set/get external signal flags (to specify triggerinrising edge etc)
|
||||||
|
* (Gotthard, Mythen)
|
||||||
* @param pol external signal flag (-1 gets)
|
* @param pol external signal flag (-1 gets)
|
||||||
* @param signalindex singal index (0 - 3)
|
* @param signalindex singal index (0 - 3)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns current timing mode
|
* @returns current timing mode
|
||||||
*/
|
*/
|
||||||
externalSignalFlag setExternalSignalFlags(externalSignalFlag pol=GET_EXTERNAL_SIGNAL_FLAG , int signalindex=0, int detPos = -1);
|
externalSignalFlag
|
||||||
|
setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG,
|
||||||
|
int signalindex = 0, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get readout flags (Eiger, Mythen)
|
* Set/get readout flags (Eiger, Mythen)
|
||||||
* @param flag readout flag (Eiger options: parallel, nonparallel, safe etc.) (-1 gets)
|
* @param flag readout flag (Eiger options: parallel, nonparallel, safe
|
||||||
|
* etc.) (-1 gets)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns readout flag
|
* @returns readout flag
|
||||||
*/
|
*/
|
||||||
@ -854,7 +883,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns network parameter value set (from getNetworkParameter)
|
* @returns network parameter value set (from getNetworkParameter)
|
||||||
*/
|
*/
|
||||||
std::string setNetworkParameter(networkParameter parameter, std::string value, int detPos = -1);
|
std::string setNetworkParameter(networkParameter parameter,
|
||||||
|
std::string value, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get network parameter
|
* Get network parameter
|
||||||
@ -868,9 +898,11 @@ public:
|
|||||||
* (advanced users)
|
* (advanced users)
|
||||||
* Set/Get receiver streaming out ZMQ port and restarts receiver sockets
|
* Set/Get receiver streaming out ZMQ port and restarts receiver sockets
|
||||||
* @param i sets, -1 gets
|
* @param i sets, -1 gets
|
||||||
* If detPos is -1(multi module), port calculated (increments) for all the individual detectors using i
|
* If detPos is -1(multi module), port calculated (increments) for all the
|
||||||
|
* individual detectors using i
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns receiver streaming out ZMQ port (if multiple, of first receiver socket)
|
* @returns receiver streaming out ZMQ port (if multiple, of first receiver
|
||||||
|
* socket)
|
||||||
*/
|
*/
|
||||||
int setReceiverDataStreamingOutPort(int i = -1, int detPos = -1);
|
int setReceiverDataStreamingOutPort(int i = -1, int detPos = -1);
|
||||||
|
|
||||||
@ -878,9 +910,11 @@ public:
|
|||||||
* (advanced users)
|
* (advanced users)
|
||||||
* Set/Get client streaming in ZMQ port and restarts client sockets
|
* Set/Get client streaming in ZMQ port and restarts client sockets
|
||||||
* @param i sets, -1 gets
|
* @param i sets, -1 gets
|
||||||
* If detPos is -1(multi module), port calculated (increments) for all the individual detectors using i
|
* If detPos is -1(multi module), port calculated (increments) for all the
|
||||||
|
* individual detectors using i
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns receiver streaming out ZMQ port (if multiple, of first receiver socket)
|
* @returns receiver streaming out ZMQ port (if multiple, of first receiver
|
||||||
|
* socket)
|
||||||
*/
|
*/
|
||||||
int setClientDataStreamingInPort(int i = -1, int detPos = -1);
|
int setClientDataStreamingInPort(int i = -1, int detPos = -1);
|
||||||
|
|
||||||
@ -892,7 +926,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns receiver streaming out ZMQ IP
|
* @returns receiver streaming out ZMQ IP
|
||||||
*/
|
*/
|
||||||
std::string setReceiverDataStreamingOutIP(std::string ip="", int detPos = -1);
|
std::string setReceiverDataStreamingOutIP(std::string ip = "",
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (advanced users)
|
* (advanced users)
|
||||||
@ -902,7 +937,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns client streaming in ZMQ IP
|
* @returns client streaming in ZMQ IP
|
||||||
*/
|
*/
|
||||||
std::string setClientDataStreamingInIP(std::string ip="", int detPos = -1);
|
std::string setClientDataStreamingInIP(std::string ip = "",
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set 10GbE Flow Control (Eiger)
|
* Set 10GbE Flow Control (Eiger)
|
||||||
@ -928,7 +964,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int loadImageToDetector(imageType index, const std::string& fname, int detPos = -1);
|
int loadImageToDetector(imageType index, const std::string &fname,
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes the counter memory block from the detector (Gotthard)
|
* Writes the counter memory block from the detector (Gotthard)
|
||||||
@ -937,7 +974,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int writeCounterBlockFile(const std::string& fname,int startACQ=0, int detPos = -1);
|
int writeCounterBlockFile(const std::string &fname, int startACQ = 0,
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets counter in detector (Gotthard)
|
* Resets counter in detector (Gotthard)
|
||||||
@ -949,7 +987,8 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get counter bit in detector (Gotthard)
|
* Set/get counter bit in detector (Gotthard)
|
||||||
* @param i is -1 to get, 0 to reset and any other value to set the counter bit
|
* @param i is -1 to get, 0 to reset and any other value to set the counter
|
||||||
|
* bit
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns the counter bit in detector
|
* @returns the counter bit in detector
|
||||||
*/
|
*/
|
||||||
@ -973,7 +1012,8 @@ public:
|
|||||||
int setROI(int n = -1, ROI roiLimits[] = NULL, int detPos = -1);
|
int setROI(int n = -1, ROI roiLimits[] = NULL, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get ROI from each detector and convert it to the multi detector scale (Gotthard)
|
* Get ROI from each detector and convert it to the multi detector scale
|
||||||
|
* (Gotthard)
|
||||||
* @param n number of rois
|
* @param n number of rois
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
@ -981,7 +1021,8 @@ public:
|
|||||||
ROI *getROI(int &n, int detPos = -1);
|
ROI *getROI(int &n, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write to ADC register (Gotthard, Jungfrau, ChipTestBoard). For expert users
|
* Write to ADC register (Gotthard, Jungfrau, ChipTestBoard). For expert
|
||||||
|
* users
|
||||||
* @param addr address of adc register
|
* @param addr address of adc register
|
||||||
* @param val value
|
* @param val value
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
@ -999,9 +1040,11 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set deactivated Receiver padding mode (Eiger only)
|
* Set deactivated Receiver padding mode (Eiger only)
|
||||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
* @param padding padding option for deactivated receiver. Can be 1
|
||||||
|
* (padding), 0 (no padding), -1 (gets)
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for
|
||||||
|
* padding option
|
||||||
*/
|
*/
|
||||||
int setDeactivatedRxrPaddingMode(int padding = -1, int detPos = -1);
|
int setDeactivatedRxrPaddingMode(int padding = -1, int detPos = -1);
|
||||||
|
|
||||||
@ -1283,7 +1326,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns frames discard policy set in receiver
|
* @returns frames discard policy set in receiver
|
||||||
*/
|
*/
|
||||||
frameDiscardPolicy setReceiverFramesDiscardPolicy(frameDiscardPolicy f = GET_FRAME_DISCARD_POLICY, int detPos = -1);
|
frameDiscardPolicy setReceiverFramesDiscardPolicy(
|
||||||
|
frameDiscardPolicy f = GET_FRAME_DISCARD_POLICY, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the partial frames padding enable in receiver
|
* Sets the partial frames padding enable in receiver
|
||||||
@ -1405,7 +1449,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* (previously setReadReceiverFrequency)
|
* (previously setReadReceiverFrequency)
|
||||||
* Sets the receiver streaming frequency
|
* Sets the receiver streaming frequency
|
||||||
* @param freq nth frame streamed out, if 0, streamed out at a timer of 200 ms
|
* @param freq nth frame streamed out, if 0, streamed out at a timer of 200
|
||||||
|
* ms
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns receiver streaming frequency
|
* @returns receiver streaming frequency
|
||||||
*/
|
*/
|
||||||
@ -1488,7 +1533,8 @@ public:
|
|||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns OK/FAIL
|
* @returns OK/FAIL
|
||||||
*/
|
*/
|
||||||
int setCTBPatLoops(int level,int &start, int &stop, int &n, int detPos = -1);
|
int setCTBPatLoops(int level, int &start, int &stop, int &n,
|
||||||
|
int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the wait address in the CTB
|
* Sets the wait address in the CTB
|
||||||
@ -1511,8 +1557,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Loads the detector setup from file
|
* Loads the detector setup from file
|
||||||
* @param fname file to read from
|
* @param fname file to read from
|
||||||
* @param level if 2 reads also reads trimbits, angular conversion coefficients etc.
|
* @param level if 2 reads also reads trimbits, angular conversion
|
||||||
* from files with default extensions as generated by dumpDetectorSetup
|
* coefficients etc. from files with default extensions as generated by
|
||||||
|
* dumpDetectorSetup
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int retrieveDetectorSetup(const std::string &fname, int level = 0);
|
int retrieveDetectorSetup(const std::string &fname, int level = 0);
|
||||||
@ -1520,8 +1567,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Saves the detector setup to file
|
* Saves the detector setup to file
|
||||||
* @param fname file to write to
|
* @param fname file to write to
|
||||||
* @param level if 2 reads also trimbits, flat field, angular correction etc.
|
* @param level if 2 reads also trimbits, flat field, angular correction
|
||||||
* and writes them to files with automatically added extension
|
* etc. and writes them to files with automatically added extension
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int dumpDetectorSetup(const std::string &fname, int level = 0);
|
int dumpDetectorSetup(const std::string &fname, int level = 0);
|
||||||
@ -1532,7 +1579,8 @@ public:
|
|||||||
* gets detector status and progress index as arguments
|
* gets detector status and progress index as arguments
|
||||||
* @param pArg argument
|
* @param pArg argument
|
||||||
*/
|
*/
|
||||||
void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
|
void registerAcquisitionFinishedCallback(int (*func)(double, int, void *),
|
||||||
|
void *pArg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* register callback for accessing measurement final data
|
* register callback for accessing measurement final data
|
||||||
@ -1540,7 +1588,8 @@ public:
|
|||||||
* gets detector status and progress index as arguments
|
* gets detector status and progress index as arguments
|
||||||
* @param pArg argument
|
* @param pArg argument
|
||||||
*/
|
*/
|
||||||
void registerMeasurementFinishedCallback(int( *func)(int,int, void*), void *pArg);
|
void registerMeasurementFinishedCallback(int (*func)(int, int, void *),
|
||||||
|
void *pArg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* register callback for accessing detector progress
|
* register callback for accessing detector progress
|
||||||
@ -1559,19 +1608,19 @@ public:
|
|||||||
* s is for subframe number for eiger for 32 bit mode
|
* s is for subframe number for eiger for 32 bit mode
|
||||||
* @param pArg argument
|
* @param pArg argument
|
||||||
*/
|
*/
|
||||||
void registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg);
|
void registerDataCallback(int (*userCallback)(detectorData *, int, int,
|
||||||
|
void *),
|
||||||
|
void *pArg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a complete acquisition
|
* Performs a complete acquisition
|
||||||
* resets frames caught in receiver, starts receiver, starts detector,
|
* resets frames caught in receiver, starts receiver, starts detector,
|
||||||
* blocks till detector finished acquisition, stop receiver, increments file index,
|
* blocks till detector finished acquisition, stop receiver, increments file
|
||||||
* loops for measurements, calls required call backs.
|
* index, loops for measurements, calls required call backs.
|
||||||
* @returns OK or FAIL depending on if it already started
|
* @returns OK or FAIL depending on if it already started
|
||||||
*/
|
*/
|
||||||
int acquire();
|
int acquire();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if detector position is out of bounds
|
* Returns true if detector position is out of bounds
|
||||||
*/
|
*/
|
||||||
@ -1585,7 +1634,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Initialize (open/create) shared memory for the sharedMultiDetector structure
|
* Initialize (open/create) shared memory for the sharedMultiDetector
|
||||||
|
* structure
|
||||||
* @param verify true to verify if shm size matches existing one
|
* @param verify true to verify if shm size matches existing one
|
||||||
* @param update true to update last user pid, date etc
|
* @param update true to update last user pid, date etc
|
||||||
* @returns true if shared memory was created in this call, else false
|
* @returns true if shared memory was created in this call, else false
|
||||||
@ -1624,7 +1674,8 @@ private:
|
|||||||
/**
|
/**
|
||||||
* add gap pixels to the image (only for Eiger in 4 bit mode)
|
* add gap pixels to the image (only for Eiger in 4 bit mode)
|
||||||
* @param image pointer to image without gap pixels
|
* @param image pointer to image without gap pixels
|
||||||
* @param gpImage poiner to image with gap pixels, if NULL, allocated inside function
|
* @param gpImage poiner to image with gap pixels, if NULL, allocated inside
|
||||||
|
* function
|
||||||
* @returns number of data bytes of image with gap pixels
|
* @returns number of data bytes of image with gap pixels
|
||||||
*/
|
*/
|
||||||
int processImageWithGapPixels(char *image, char *&gpImage);
|
int processImageWithGapPixels(char *image, char *&gpImage);
|
||||||
@ -1680,7 +1731,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
int kbhit(void);
|
int kbhit(void);
|
||||||
|
|
||||||
|
|
||||||
/** Multi detector Id */
|
/** Multi detector Id */
|
||||||
int detId;
|
int detId;
|
||||||
|
|
||||||
@ -1699,11 +1749,12 @@ private:
|
|||||||
/** ZMQ Socket - Receiver to Client */
|
/** ZMQ Socket - Receiver to Client */
|
||||||
std::vector<std::unique_ptr<ZmqSocket>> zmqSocket;
|
std::vector<std::unique_ptr<ZmqSocket>> zmqSocket;
|
||||||
|
|
||||||
|
/** semaphore to let postprocessing thread continue for next
|
||||||
/** semaphore to let postprocessing thread continue for next scan/measurement */
|
* scan/measurement */
|
||||||
sem_t sem_newRTAcquisition;
|
sem_t sem_newRTAcquisition;
|
||||||
|
|
||||||
/** semaphore to let main thread know it got all the dummy packets (also from ext. process) */
|
/** semaphore to let main thread know it got all the dummy packets (also
|
||||||
|
* from ext. process) */
|
||||||
sem_t sem_endRTAcquisition;
|
sem_t sem_endRTAcquisition;
|
||||||
|
|
||||||
/** Total number of frames/images for next acquisition */
|
/** Total number of frames/images for next acquisition */
|
||||||
@ -1745,14 +1796,6 @@ private:
|
|||||||
|
|
||||||
int (*dataReady)(detectorData *, int, int, void *);
|
int (*dataReady)(detectorData *, int, int, void *);
|
||||||
void *pCallbackArg;
|
void *pCallbackArg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user