slsDetectorUsers Class Reference

Class for detector functionalitiesto embed the detector controls in the users custom interface e.g. EPICS, Lima etc. More...

#include <slsDetectorUsers.h>

List of all members.

Public Member Functions

 slsDetectorUsers (int id=0)
 default constructor
virtual ~slsDetectorUsers ()
 virtual destructor
string getDetectorDeveloper ()
 useful to define subset of working functions
int setOnline (int const online=-1)
 sets the onlineFlag
void startMeasurement ()
 start measurement and acquires
int stopMeasurement ()
 stop measurement
int getDetectorStatus ()
 get run status
string getFilePath ()
 returns the default output files path
string setFilePath (string s)
 sets the default output files path
string getFileName ()
string setFileName (string s)
 sets the default output files path
int getFileIndex ()
int setFileIndex (int i)
 sets the default output file index
string getFlatFieldCorrectionDir ()
 get flat field corrections file directory
string setFlatFieldCorrectionDir (string dir)
 set flat field corrections file directory
string getFlatFieldCorrectionFile ()
 get flat field corrections file name
int setFlatFieldCorrectionFile (string fname="")
 set flat field correction file
int enableFlatFieldCorrection (int i=-1)
 enable/disable flat field corrections (without changing file name)
int enableCountRateCorrection (int i=-1)
 enable/disable count rate corrections
int enablePixelMaskCorrection (int i=-1)
 enable/disable bad channel corrections
int enableAngularConversion (int i=-1)
 enable/disable angular conversion
int enableWriteToFile (int i=-1)
int setPositions (int nPos, double *pos)
 set positions for the acquisition
int getPositions (double *pos=NULL)
 get positions for the acquisition
int setDetectorSize (int x0=-1, int y0=-1, int nx=-1, int ny=-1)
 sets the detector size
int getDetectorSize (int &x0, int &y0, int &nx, int &ny)
 gets detector size
int getMaximumDetectorSize (int &nx, int &ny)
 setsthe maximum detector size
int setBitDepth (int i=-1)
 set/get dynamic range
int setSettings (int isettings=-1)
 set detector settings
int getThresholdEnergy ()
 get threshold energy
int setThresholdEnergy (int e_eV)
 set threshold energy
double setExposureTime (double t=-1, bool inseconds=false)
 set/get exposure time value
double setExposurePeriod (double t=-1, bool inseconds=false)
 set/get exposure period
double setDelayAfterTrigger (double t=-1, bool inseconds=false)
 set/get delay after trigger
int64_t setNumberOfGates (int64_t t=-1)
 set/get number of gates
int64_t setNumberOfFrames (int64_t t=-1)
 set/get number of frames i.e. number of exposure per trigger
int64_t setNumberOfCycles (int64_t t=-1)
 set/get number of cycles i.e. number of triggers
int setTimingMode (int pol=-1)
 set/get the external communication mode
int readConfigurationFile (string const fname)
 Reads the configuration file -- will contain all the informations needed for the configuration (e.g. for a PSI detector caldir, settingsdir, angconv, badchannels, hostname etc.).
int dumpDetectorSetup (string const fname)
 Reads the parameters from the detector and writes them to file.
int retrieveDetectorSetup (string const fname)
 Loads the detector setup from file.
string getDetectorType ()
 useful for data plotting etc.
int setReceiverMode (int n=-1)
 sets the mode by which gui requests data from receiver
void registerDataCallback (int(*userCallback)(detectorData *d, int f, int s, void *), void *pArg)
 register calbback for accessing detector final data
void registerRawDataCallback (int(*userCallback)(double *p, int n, void *), void *pArg)
 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
virtual void initDataset (int refresh)
 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
virtual void addFrame (double *data, double pos, double i0, double t, string fname, double var)
 adds frame to merging/summation - can be overcome by the user's functions thanks to the virtual property
virtual void finalizeDataset (double *a, double *v, double *e, int &np)
 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
int enableDataStreamingFromReceiver (int i=-1)
int64_t getModuleFirmwareVersion ()
int64_t getModuleSerialNumber (int imod=-1)
int64_t getDetectorFirmwareVersion ()
int64_t getDetectorSerialNumber ()
int64_t getDetectorSoftwareVersion ()
int64_t getThisSoftwareVersion ()
void registerAcquisitionFinishedCallback (int(*func)(double, int, void *), void *pArg)
 register calbback for accessing detector final data
void registerGetPositionCallback (double(*func)(void *), void *arg)
 register calbback for reading detector position
void registerConnectChannelsCallback (int(*func)(void *), void *arg)
 register callback for connecting to the epics channels
void registerDisconnectChannelsCallback (int(*func)(void *), void *arg)
 register callback to disconnect the epics channels
void registerGoToPositionCallback (int(*func)(double, void *), void *arg)
 register callback for moving the detector
void registerGoToPositionNoWaitCallback (int(*func)(double, void *), void *arg)
 register callback for moving the detector without waiting
void registerGetI0Callback (double(*func)(int, void *), void *arg)
 register calbback reading to I0
string putCommand (int narg, char *args[], int pos=-1)
 sets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf
string getCommand (int narg, char *args[], int pos=-1)
 gets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf
int setClockDivider (int value)
 sets clock divider of detector
int getContinuousReadoutFlag ()
 gets continuous readout flag
void setContinuousReadoutFlag ()
 sets continuous readout flag
int getStoreInRamReadoutFlag ()
 gets store in ram readout flag
void setStoreInRamReadoutFlag ()
 sets store in ram readout flag
int getParallelReadoutFlag ()
 gets parallel readout flag
void setParallelReadoutFlag ()
 sets parallel readout flag
int getNonParallelReadoutFlag ()
 gets non parallel readout flag
void setNonParallelReadoutFlag ()
 sets non parallel readout flag
int getSafeReadoutFlag ()
 gets safe readout flag
void setSafeReadoutFlag ()
 sets safe readout flag
int setAllTrimbits (int val)
 sets all trimbits to value (only available for eiger)
int setDAC (int id, int dacindex, int val)
 set dac value
int getADC (int id, int adcindex)
 get adc value

Static Public Member Functions

static string runStatusType (int s)
 returns string from run status index
static int getDetectorSettings (string s)
 returns detector settings string from index
static string getDetectorSettings (int s)
 returns detector settings string from index
static string getTimingMode (int f)
 returns external communication mode string from index
static int getTimingMode (string s)
 returns external communication mode string from index

Detailed Description

Class for detector functionalitiesto embed the detector controls in the users custom interface e.g. EPICS, Lima etc.

The slsDetectorUsers class is a minimal interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration or parameters file that can be read/written.

Definition at line 85 of file slsDetectorUsers.h.


Constructor & Destructor Documentation

slsDetectorUsers::slsDetectorUsers ( int  id = 0  ) 

default constructor

virtual slsDetectorUsers::~slsDetectorUsers (  )  [virtual]

virtual destructor


Member Function Documentation

virtual void slsDetectorUsers::addFrame ( double *  data,
double  pos,
double  i0,
double  t,
string  fname,
double  var 
) [virtual]

adds frame to merging/summation - can be overcome by the user's functions thanks to the virtual property

Parameters:
data pointer to the raw data
pos encoder position
i0 beam monitor readout for intensity normalization (if 0 not performed)
t exposure time in seconds, required only if rate corrections
fname file name (unused since filewriting would be performed by the user)
var optional parameter - unused.
int slsDetectorUsers::dumpDetectorSetup ( string const   fname  ) 

Reads the parameters from the detector and writes them to file.

Parameters:
fname file to write to
Returns:
OK or FAIL
int slsDetectorUsers::enableAngularConversion ( int  i = -1  ) 

enable/disable angular conversion

Parameters:
i 0 disables, 1 enables, -1 gets
Returns:
0 if angular conversion disabled, 1 if enabled
int slsDetectorUsers::enableCountRateCorrection ( int  i = -1  ) 

enable/disable count rate corrections

Parameters:
i 0 disables, 1 enable, -1 gets
Returns:
0 if count corrections disabled, 1 if enabled
int slsDetectorUsers::enableDataStreamingFromReceiver ( int  i = -1  ) 

Enable data streaming from receiver (zmq)

Parameters:
i 1 to set, 0 to reset and -1 to get
Returns:
data streaming enable
int slsDetectorUsers::enableFlatFieldCorrection ( int  i = -1  ) 

enable/disable flat field corrections (without changing file name)

Parameters:
i 0 disables, 1 enables, -1 gets
Returns:
0 if ff corrections disabled, 1 if enabled
int slsDetectorUsers::enablePixelMaskCorrection ( int  i = -1  ) 

enable/disable bad channel corrections

Parameters:
i 0 disables, 1 enables, -1 gets
Returns:
0 if bad channels corrections disabled, 1 if enabled
int slsDetectorUsers::enableWriteToFile ( int  i = -1  ) 

Enable write file function included

virtual void slsDetectorUsers::finalizeDataset ( double *  a,
double *  v,
double *  e,
int &  np 
) [virtual]

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

Parameters:
a pointer to the array of angles - can be null if no angular coversion is required
v pointer to the array of values
e pointer to the array of errors
np reference returning the number of points
int slsDetectorUsers::getADC ( int  id,
int  adcindex 
)

get adc value

Parameters:
id module index (-1 for all)
adcindex adc index
See also:
dacIndex
Returns:
adc value
string slsDetectorUsers::getCommand ( int  narg,
char *  args[],
int  pos = -1 
)

gets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf

Parameters:
narg value to be set
args value to be set
pos position of detector in multislsdetector list
Returns:
answer string
int slsDetectorUsers::getContinuousReadoutFlag (  ) 

gets continuous readout flag

Returns:
gets continuous readout flag
string slsDetectorUsers::getDetectorDeveloper (  ) 

useful to define subset of working functions

Returns:
"PSI" or "Dectris"
int64_t slsDetectorUsers::getDetectorFirmwareVersion (  ) 

get get Detector Firmware Version

Returns:
id
int64_t slsDetectorUsers::getDetectorSerialNumber (  ) 

get get Detector Serial Number

Returns:
id
static string slsDetectorUsers::getDetectorSettings ( int  s  )  [inline, static]

returns detector settings string from index

Parameters:
s settings index
Returns:
standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, undefined when wrong index

Definition at line 682 of file slsDetectorUsers.h.

static int slsDetectorUsers::getDetectorSettings ( string  s  )  [inline, static]

returns detector settings string from index

Parameters:
s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain
Returns:
setting index (-1 unknown string)

Definition at line 668 of file slsDetectorUsers.h.

int slsDetectorUsers::getDetectorSize ( int &  x0,
int &  y0,
int &  nx,
int &  ny 
)

gets detector size

Parameters:
x0 horizontal position origin in channel number
y0 vertical position origin in channel number
nx number of channels in horiziontal
ny number of channels in vertical
Returns:
OK/FAIL
int64_t slsDetectorUsers::getDetectorSoftwareVersion (  ) 

get get Detector Software Version

Returns:
id
int slsDetectorUsers::getDetectorStatus (  ) 

get run status

Returns:
status mask
string slsDetectorUsers::getDetectorType (  ) 

useful for data plotting etc.

Returns:
Mythen, Eiger, Gotthard etc.
int slsDetectorUsers::getFileIndex (  ) 
Returns:
the default output file index
string slsDetectorUsers::getFileName (  ) 
Returns:
the default output files root name
string slsDetectorUsers::getFilePath (  ) 

returns the default output files path

string slsDetectorUsers::getFlatFieldCorrectionDir (  ) 

get flat field corrections file directory

Returns:
flat field correction file directory
string slsDetectorUsers::getFlatFieldCorrectionFile (  ) 

get flat field corrections file name

Returns:
flat field correction file name
int slsDetectorUsers::getMaximumDetectorSize ( int &  nx,
int &  ny 
)

setsthe maximum detector size

Parameters:
x0 horizontal position origin in channel number
y0 vertical position origin in channel number
nx number of channels in horiziontal
ny number of channels in vertical
Returns:
OK/FAIL
int64_t slsDetectorUsers::getModuleFirmwareVersion (  ) 

get get Module Firmware Version

Returns:
id
int64_t slsDetectorUsers::getModuleSerialNumber ( int  imod = -1  ) 

get get Module Serial Number

Parameters:
imod module number
Returns:
id
int slsDetectorUsers::getNonParallelReadoutFlag (  ) 

gets non parallel readout flag

Returns:
gets non parallel readout flag
int slsDetectorUsers::getParallelReadoutFlag (  ) 

gets parallel readout flag

Returns:
gets parallel readout flag
int slsDetectorUsers::getPositions ( double *  pos = NULL  ) 

get positions for the acquisition

Parameters:
pos array which will contain the encoder positions
Returns:
number of positions
int slsDetectorUsers::getSafeReadoutFlag (  ) 

gets safe readout flag

Returns:
gets safe readout flag
int slsDetectorUsers::getStoreInRamReadoutFlag (  ) 

gets store in ram readout flag

Returns:
gets store in ram readout flag
int64_t slsDetectorUsers::getThisSoftwareVersion (  ) 

get this Software Version

Returns:
id
int slsDetectorUsers::getThresholdEnergy (  ) 

get threshold energy

Returns:
current threshold value for imod in ev (-1 failed)
static int slsDetectorUsers::getTimingMode ( string  s  )  [inline, static]

returns external communication mode string from index

Parameters:
f index for communication mode
Returns:
auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode

Definition at line 718 of file slsDetectorUsers.h.

static string slsDetectorUsers::getTimingMode ( int  f  )  [inline, static]

returns external communication mode string from index

Parameters:
f index for communication mode
Returns:
auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode

Definition at line 702 of file slsDetectorUsers.h.

virtual void slsDetectorUsers::initDataset ( int  refresh  )  [virtual]

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

Parameters:
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
string slsDetectorUsers::putCommand ( int  narg,
char *  args[],
int  pos = -1 
)

sets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf

Parameters:
narg value to be set
args value to be set
pos position of detector in multislsdetector list
Returns:
answer string
int slsDetectorUsers::readConfigurationFile ( string const   fname  ) 

Reads the configuration file -- will contain all the informations needed for the configuration (e.g. for a PSI detector caldir, settingsdir, angconv, badchannels, hostname etc.).

Parameters:
fname file name
Returns:
OK or FAIL
void slsDetectorUsers::registerAcquisitionFinishedCallback ( int(*)(double, int, void *)  func,
void *  pArg 
)

register calbback for accessing detector final data

Parameters:
func function to be called at the end of the acquisition. gets detector status and progress index as arguments
void slsDetectorUsers::registerConnectChannelsCallback ( int(*)(void *)  func,
void *  arg 
)

register callback for connecting to the epics channels

Parameters:
func function for connecting to the epics channels
void slsDetectorUsers::registerDataCallback ( int(*)(detectorData *d, int f, int s, void *)  userCallback,
void *  pArg 
)

register calbback for accessing detector final data

Parameters:
userCallback function for plotting/analyzing the data. Its arguments are the data structure d and the frame number f, s is for subframe number for eiger for 32 bit mode
void slsDetectorUsers::registerDisconnectChannelsCallback ( int(*)(void *)  func,
void *  arg 
)

register callback to disconnect the epics channels

Parameters:
func function to disconnect the epics channels
void slsDetectorUsers::registerGetI0Callback ( double(*)(int, void *)  func,
void *  arg 
)

register calbback reading to I0

Parameters:
func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0)
void slsDetectorUsers::registerGetPositionCallback ( double(*)(void *)  func,
void *  arg 
)

register calbback for reading detector position

Parameters:
func function for reading the detector position
void slsDetectorUsers::registerGoToPositionCallback ( int(*)(double, void *)  func,
void *  arg 
)

register callback for moving the detector

Parameters:
func function for moving the detector
void slsDetectorUsers::registerGoToPositionNoWaitCallback ( int(*)(double, void *)  func,
void *  arg 
)

register callback for moving the detector without waiting

Parameters:
func function for moving the detector
void slsDetectorUsers::registerRawDataCallback ( int(*)(double *p, int n, void *)  userCallback,
void *  pArg 
)

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

Parameters:
userCallback function for postprocessing and saving the data - p is the pointer to the data, n is the number of channels
int slsDetectorUsers::retrieveDetectorSetup ( string const   fname  ) 

Loads the detector setup from file.

Parameters:
fname file to read from
Returns:
OK or FAIL
static string slsDetectorUsers::runStatusType ( int  s  )  [inline, static]

returns string from run status index

Parameters:
s run status index
Returns:
string error, waiting, running, data, finished or unknown when wrong index

Definition at line 650 of file slsDetectorUsers.h.

int slsDetectorUsers::setAllTrimbits ( int  val  ) 

sets all trimbits to value (only available for eiger)

Parameters:
val value to be set (-1 gets)
Returns:
value set
int slsDetectorUsers::setBitDepth ( int  i = -1  ) 

set/get dynamic range

Parameters:
i dynamic range (-1 get)
Returns:
current dynamic range
int slsDetectorUsers::setClockDivider ( int  value  ) 

sets clock divider of detector

Parameters:
value value to be set (-1 gets)
Returns:
speed of detector
void slsDetectorUsers::setContinuousReadoutFlag (  ) 

sets continuous readout flag

Returns:
OK if successful, else false
int slsDetectorUsers::setDAC ( int  id,
int  dacindex,
int  val 
)

set dac value

Parameters:
id module index (-1 for all)
dacindex dac index
See also:
dacIndex
Parameters:
val value to be set (-1 gets)
Returns:
dac value
double slsDetectorUsers::setDelayAfterTrigger ( double  t = -1,
bool  inseconds = false 
)

set/get delay after trigger

Parameters:
t time in ns (-1 gets)
inseconds true if the value is in s, else ns
Returns:
timer set value in ns, or s if specified
int slsDetectorUsers::setDetectorSize ( int  x0 = -1,
int  y0 = -1,
int  nx = -1,
int  ny = -1 
)

sets the detector size

Parameters:
x0 horizontal position origin in channel number (-1 unchanged)
y0 vertical position origin in channel number (-1 unchanged)
nx number of channels in horiziontal (-1 unchanged)
ny number of channels in vertical (-1 unchanged)
Returns:
OK/FAIL
double slsDetectorUsers::setExposurePeriod ( double  t = -1,
bool  inseconds = false 
)

set/get exposure period

Parameters:
t time in ns (-1 gets)
inseconds true if the value is in s, else ns
Returns:
timer set value in ns, or s if specified
double slsDetectorUsers::setExposureTime ( double  t = -1,
bool  inseconds = false 
)

set/get exposure time value

Parameters:
t time in sn (-1 gets)
inseconds true if the value is in s, else ns
Returns:
timer set value in ns, or s if specified
int slsDetectorUsers::setFileIndex ( int  i  ) 

sets the default output file index

Parameters:
i file index
Returns:
the default output file index
string slsDetectorUsers::setFileName ( string  s  ) 

sets the default output files path

Parameters:
s file name
Returns:
the default output files root name
string slsDetectorUsers::setFilePath ( string  s  ) 

sets the default output files path

Parameters:
s file path
Returns:
file path
string slsDetectorUsers::setFlatFieldCorrectionDir ( string  dir  ) 

set flat field corrections file directory

Parameters:
dir flat field correction file directory
Returns:
flat field correction file directory
int slsDetectorUsers::setFlatFieldCorrectionFile ( string  fname = ""  ) 

set flat field correction file

Parameters:
fname name of the flat field file (or "" if disable)
Returns:
0 if disable (or file could not be read), >0 otherwise
void slsDetectorUsers::setNonParallelReadoutFlag (  ) 

sets non parallel readout flag

Returns:
OK if successful, else false
int64_t slsDetectorUsers::setNumberOfCycles ( int64_t  t = -1  ) 

set/get number of cycles i.e. number of triggers

Parameters:
t number of frames (-1 gets)
Returns:
number of frames
int64_t slsDetectorUsers::setNumberOfFrames ( int64_t  t = -1  ) 

set/get number of frames i.e. number of exposure per trigger

Parameters:
t number of frames (-1 gets)
Returns:
number of frames
int64_t slsDetectorUsers::setNumberOfGates ( int64_t  t = -1  ) 

set/get number of gates

Parameters:
t number of gates (-1 gets)
Returns:
number of gates
int slsDetectorUsers::setOnline ( int const   online = -1  ) 

sets the onlineFlag

Parameters:
online can be: -1 returns wether the detector is in online (1) or offline (0) state; 0 detector in offline state; 1 detector in online state
Returns:
0 (offline) or 1 (online)
void slsDetectorUsers::setParallelReadoutFlag (  ) 

sets parallel readout flag

Returns:
OK if successful, else false
int slsDetectorUsers::setPositions ( int  nPos,
double *  pos 
)

set positions for the acquisition

Parameters:
nPos number of positions
pos array with the encoder positions
Returns:
number of positions
int slsDetectorUsers::setReceiverMode ( int  n = -1  ) 

sets the mode by which gui requests data from receiver

Parameters:
n is 0 for random requests for fast acquisitions and greater than 0 for nth read requests
Returns:
the mode set in the receiver
void slsDetectorUsers::setSafeReadoutFlag (  ) 

sets safe readout flag

Returns:
OK if successful, else false
int slsDetectorUsers::setSettings ( int  isettings = -1  ) 

set detector settings

Parameters:
isettings settings index (-1 gets)
Returns:
current settings
void slsDetectorUsers::setStoreInRamReadoutFlag (  ) 

sets store in ram readout flag

Returns:
OK if successful, else false
int slsDetectorUsers::setThresholdEnergy ( int  e_eV  ) 

set threshold energy

Parameters:
e_eV threshold in eV
Returns:
current threshold value for imod in ev (-1 failed)
int slsDetectorUsers::setTimingMode ( int  pol = -1  ) 

set/get the external communication mode

Parameters:
pol value to be set
See also:
getTimingMode
Returns:
current external communication mode
void slsDetectorUsers::startMeasurement (  ) 

start measurement and acquires

Returns:
OK/FAIL
int slsDetectorUsers::stopMeasurement (  ) 

stop measurement

Returns:
OK/FAIL

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Defines

Generated on 19 Sep 2017 by  doxygen 1.6.1