#include <slsDetector.h>
Inheritance diagram for slsDetector:
Public Types | |
typedef slsDetector::sharedSlsDetector | sharedSlsDetector |
Structure allocated in shared memory to store detector settings and be accessed in parallel by several applications (take care of possible conflicts!). | |
GET_ONLINE_FLAG | |
OFFLINE_FLAG | |
ONLINE_FLAG | |
enum | { GET_ONLINE_FLAG, OFFLINE_FLAG, ONLINE_FLAG } |
Public Member Functions | |
slsDetector (detectorType type=GENERIC, int id=0) | |
~slsDetector () | |
int | setOnline (int const online) |
int | exists () |
int | readConfigurationFile (string const fname) |
int | writeConfigurationFile (string const fname) |
int | dumpDetectorSetup (string const fname) |
int | retrieveDetectorSetup (string const fname) |
int | setTCPSocket (string const name="", int const control_port=-1, int const stop_port=-1, int const data_port=-1) |
char * | getHostname () |
int | getControlPort () |
int | getStopPort () |
int | getDataPort () |
char * | getTrimDir () |
char * | setTrimDir (string s) |
int | getTrimEn (int *en) |
sls_detector_module * | readTrimFile (string fname, sls_detector_module *myMod=NULL) |
int | writeTrimFile (string fname, sls_detector_module mod) |
int | writeTrimFile (string fname, int imod) |
char * | setFilePath (string s) |
char * | setFileName (string s) |
int | setFileIndex (int i) |
char * | getFilePath () |
char * | getFileName () |
int | getFileIndex () |
string | createFileName () |
int | writeDataFile (string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1) |
int | writeDataFile (string fname, int *data) |
int | readDataFile (string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=0) |
int | readDataFile (string fname, int *data) |
char * | getCalDir () |
char * | setCalDir (string s) |
int | readCalibrationFile (string fname, float &gain, float &offset) |
int | writeCalibrationFile (string fname, float gain, float offset) |
int | readAngularConversion (string fname="") |
int | writeAngularConversion (string fname="") |
int | execCommand (string cmd, string answer) |
int | setDetectorType (detectorType type=GET_DETECTOR_TYPE) |
int | setDetectorType (string type) |
void | getDetectorType (char *type) |
int | setNumberOfModules (int n, dimension d=X) |
int | getMaxNumberOfModules (dimension d=X) |
externalSignalFlag | setExternalSignalFlags (externalSignalFlag pol=GET_EXTERNAL_SIGNAL_FLAG, int signalindex=0) |
externalCommunicationMode | setExternalCommunicationMode (externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE) |
int64_t | getId (idMode mode, int imod=0) |
int | digitalTest (digitalTestMode mode, int imod=0) |
int * | analogTest (analogTestMode mode) |
int | enableAnalogOutput (int ichan) |
int | enableAnalogOutput (int imod, int ichip, int ichan) |
int | giveCalibrationPulse (float vcal, int npulses) |
int | writeRegister (int addr, int val) |
int | readRegister (int addr) |
float | setDAC (float val, dacIndex index, int imod=-1) |
float | getADC (dacIndex index, int imod=0) |
int | setChannel (int64_t reg, int ichan=-1, int ichip=-1, int imod=-1) |
int | setChannel (sls_detector_channel chan) |
sls_detector_channel | getChannel (int ichan, int ichip, int imod) |
int | setChip (int reg, int ichip=-1, int imod=-1) |
int | setChip (sls_detector_chip chip) |
sls_detector_chip | getChip (int ichip, int imod) |
int | setModule (int reg, int imod=-1) |
int | setModule (sls_detector_module module) |
sls_detector_module * | getModule (int imod) |
int | getThresholdEnergy (int imod=-1) |
int | setThresholdEnergy (int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS) |
detectorSettings | getSettings (int imod=-1) |
detectorSettings | setSettings (detectorSettings isettings, int imod=-1) |
int | startAcquisition () |
int | stopAcquisition () |
int | startReadOut () |
int | getRunStatus () |
int * | startAndReadAll () |
int | startAndReadAllNoWait () |
int * | getDataFromDetectorNoWait () |
int * | readFrame () |
int * | readAll () |
int * | popDataQueue () |
int64_t | setTimer (timerIndex index, int64_t t=-1) |
int64_t | getTimeLeft (timerIndex index) |
int | setClockDivider (int i) |
int | getClockDivider () |
int | setSetLength (int i) |
int | getSetLength () |
int | setDynamicRange (int n=-1) |
int | setROI (int nroi=-1, int *xmin=NULL, int *xmax=NULL, int *ymin=NULL, int *ymax=NULL) |
int | setReadOutFlags (readOutFlags flag) |
int | executeTrimming (trimMode mode, int par1, int par2, int imod=-1) |
int | setFlatFieldCorrection (string fname="") |
int | getFlatFieldCorrections (float *corr=NULL, float *ecorr=NULL) |
int | setRateCorrection (float t=0) |
int | getRateCorrections (float &t) |
int | getRateCorrections () |
int | setBadChannelCorrection (string fname="") |
int | getBadChannelCorrections (int *bad=NULL) |
int | setAngularConversion (string fname="") |
int | getAngularConversion (int &direction, angleConversionConstant *angconv=NULL) |
float | setGlobalOffset (float f) |
float | setFineOffset (float f) |
float | getFineOffset () |
float | getGlobalOffset () |
int | setPositions (int nPos, float *pos) |
int | getPositions (float *pos=NULL) |
float | setBinSize (float bs) |
float | getBinSize () |
float * | decodeData (int *datain) |
int | flatFieldCorrect (float datain, float errin, float &dataout, float &errout, float ffcoefficient, float fferr) |
int | flatFieldCorrect (float *datain, float *errin, float *dataout, float *errout) |
int | rateCorrect (float datain, float errin, float &dataout, float &errout, float tau, float t) |
int | rateCorrect (float *datain, float *errin, float *dataout, float *errout) |
int | resetMerging (float *mp, float *mv, float *me, int *mm) |
int | addToMerging (float *p1, float *v1, float *e1, float *mp, float *mv, float *me, int *mm) |
int | finalizeMerging (float *mp, float *mv, float *me, int *mm) |
int | exitServer () |
void * | processData () |
sls_detector_module * | createModule () |
void | deleteModule (sls_detector_module *myMod) |
void | acquire () |
Private Member Functions | |
int * | getDataFromDetector () |
int | initSharedMemory (detectorType type=GENERIC, int id=0) |
int | freeSharedMemory () |
int | initializeDetectorSize (detectorType type) |
int | initializeDetectorStructure () |
int | sendChannel (sls_detector_channel *) |
int | sendChip (sls_detector_chip *) |
int | sendModule (sls_detector_module *) |
int | receiveChannel (sls_detector_channel *) |
int | receiveChip (sls_detector_chip *) |
int | receiveModule (sls_detector_module *) |
void | startThread () |
int | fillBadChannelMask () |
Private Attributes | |
sharedSlsDetector * | thisDetector |
int | onlineFlag |
int | detId |
int | shmId |
MySocketTCP * | controlSocket |
MySocketTCP * | stopSocket |
MySocketTCP * | dataSocket |
queue< int * > | dataQueue |
pthread_t | dataProcessingThread |
float | currentPosition |
float | currentPositionIndex |
float | currentI0 |
float * | mergingBins |
float * | mergingCounts |
float * | mergingErrors |
int * | mergingMultiplicity |
float * | ffcoefficients |
float * | fferrors |
sls_detector_module * | detectorModules |
float * | dacs |
float * | adcs |
int * | chipregs |
int * | chanregs |
int * | badChannelMask |
Classes | |
struct | sharedSlsDetector |
Structure allocated in shared memory to store detector settings and be accessed in parallel by several applications (take care of possible conflicts!). More... |
The slsDetector class is expected to become the interface class for all SLS Detectors acquisition (and analysis) software.
typedef struct slsDetector::sharedSlsDetector slsDetector::sharedSlsDetector |
Structure allocated in shared memory to store detector settings and be accessed in parallel by several applications (take care of possible conflicts!).
anonymous enum |
online flags enum
slsDetector::slsDetector | ( | detectorType | type = GENERIC , |
|
int | id = 0 | |||
) |
(default) constructor
type | is needed to define the size of the detector shared memory 9defaults to GENERIC i.e. the largest shared memory needed by any slsDetector is allocated | |
id | is the detector index which is needed to define the shared memory id. Different physical detectors should have different IDs in order to work independently |
sets onlineFlag to OFFLINE_FLAG
Initlializes shared memory
Initializes the detector stucture
slsDetector::~slsDetector | ( | ) | [inline] |
destructor
void slsDetector::acquire | ( | ) |
int slsDetector::addToMerging | ( | float * | p1, | |
float * | v1, | |||
float * | e1, | |||
float * | mp, | |||
float * | mv, | |||
float * | me, | |||
int * | mm | |||
) |
not yet implemented merge dataset
p1 | angular positions of dataset | |
v1 | data | |
e1 | errors | |
mp | already merged postions | |
mv | already merged data | |
me | already merged errors (squared sum) | |
mm | multiplicity of merged arrays |
Reimplemented in mythenDetector.
int* slsDetector::analogTest | ( | analogTestMode | mode | ) |
analog test
modte | test mode |
string slsDetector::createFileName | ( | ) |
generates file name without extension
always appends to file path and file name the run index.
in case also appends the position index
Filenames will be of the form: filepath/filename(_px)_i where x is the position index and i is the run index
slsDetector::sls_detector_module * slsDetector::createModule | ( | ) |
Allocates the memory for a sls_detector_module structure and initializes it
float * slsDetector::decodeData | ( | int * | datain | ) |
decode data from the detector converting them to an array of floats, one for each channle
datain | data from the detector |
Reimplemented in mythenDetector, and eigerDetector.
void slsDetector::deleteModule | ( | sls_detector_module * | myMod | ) |
frees the memory for a sls_detector_module structure
myMod | the pointer to the memory to be freed |
int slsDetector::digitalTest | ( | digitalTestMode | mode, | |
int | imod = 0 | |||
) |
Digital test of the modules
mode | test mode | |
imod | module number for chip test or module firmware test |
int slsDetector::dumpDetectorSetup | ( | string const | fname | ) |
not yet implemented
should dump to a file all the current detector parameters
int slsDetector::enableAnalogOutput | ( | int | imod, | |
int | ichip, | |||
int | ichan | |||
) |
enable analog output of channel ichan, chip ichip, module imod
not yet implemented
int slsDetector::enableAnalogOutput | ( | int | ichan | ) |
enable analog output of channel ichan
not yet implemented
int slsDetector::execCommand | ( | string | cmd, | |
string | answer | |||
) |
executes a system command on the server e.g. mount an nfs disk, reboot and returns answer etc.
cmd | is the command to be executed | |
answer | is the answer from the detector |
int slsDetector::executeTrimming | ( | trimMode | mode, | |
int | par1, | |||
int | par2, | |||
int | imod = -1 | |||
) |
execute trimming
mode | trim mode | |
par1 | if noise, beam or fixed setting trimming it is count limit, if improve maximum number of iterations | |
par2 | if noise or beam nsigma, if improve par2!=means vthreshold will be optimized, if fixed settings par2<0 trimwith median, par2>=0 trim with level | |
imod | module number (-1 all) |
int slsDetector::exists | ( | ) | [inline] |
sets the onlineFlag
int slsDetector::exitServer | ( | ) |
turns of server
int slsDetector::fillBadChannelMask | ( | ) | [private] |
fill bad channel mask (0 if channel is good, 1 if bad)
int slsDetector::finalizeMerging | ( | float * | mp, | |
float * | mv, | |||
float * | me, | |||
int * | mm | |||
) |
calculates the "final" positions, data value and errors for the emrged data
mp | already merged postions | |
mv | already merged data | |
me | already merged errors (squared sum) | |
mm | multiplicity of merged arrays |
Reimplemented in mythenDetector.
int slsDetector::flatFieldCorrect | ( | float * | datain, | |
float * | errin, | |||
float * | dataout, | |||
float * | errout | |||
) |
flat field correct data
datain | data array | |
errin | error array on data (if NULL will default to sqrt(datain) | |
dataout | array of corrected data | |
errout | error on corrected data (if not NULL) |
int slsDetector::flatFieldCorrect | ( | float | datain, | |
float | errin, | |||
float & | dataout, | |||
float & | errout, | |||
float | ffcoefficient, | |||
float | fferr | |||
) |
flat field correct data
datain | data | |
errin | error on data (if<=0 will default to sqrt(datain) | |
dataout | corrected data | |
errout | error on corrected data | |
ffcoefficient | flat field correction coefficient | |
fferr | erro on ffcoefficient |
int slsDetector::freeSharedMemory | ( | ) | [private] |
Frees the shared memory - should not be used
float slsDetector::getADC | ( | dacIndex | index, | |
int | imod = 0 | |||
) |
set dacs value
index | ADC index | |
imod | module number |
int slsDetector::getAngularConversion | ( | int & | direction, | |
angleConversionConstant * | angconv = NULL | |||
) |
get angular conversion
reference | to diffractometer direction | |
angconv | array that will be filled with the angular conversion constants |
Reimplemented in mythenDetector.
int slsDetector::getBadChannelCorrections | ( | int * | bad = NULL |
) |
get bad channels correction
bad | pointer to array that if bad!=NULL will be filled with the bad channel list |
float slsDetector::getBinSize | ( | ) | [inline] |
return detector bin size used for merging (approx angular resolution)
Reimplemented in mythenDetector.
char* slsDetector::getCalDir | ( | ) | [inline] |
returns the location of the calibration files
slsDetector::sls_detector_channel slsDetector::getChannel | ( | int | ichan, | |
int | ichip, | |||
int | imod | |||
) |
get channel
ichan | channel number | |
ichip | chip number | |
imod | module number |
slsDetector::sls_detector_chip slsDetector::getChip | ( | int | ichip, | |
int | imod | |||
) |
get chip
ichip | chip number | |
imod | module number |
int slsDetector::getClockDivider | ( | ) | [inline] |
get clock divider
not implemented (should be something more general like "set speed including also waitstates, set cycles etc.)
int slsDetector::getControlPort | ( | ) | [inline] |
returns the detector control port
int * slsDetector::getDataFromDetector | ( | ) | [private] |
Receives a data frame from the detector socket
int * slsDetector::getDataFromDetectorNoWait | ( | ) |
receives a data frame from the detector socket
int slsDetector::getDataPort | ( | ) | [inline] |
returns the detector data port
void slsDetector::getDetectorType | ( | char * | type | ) |
gets detector type normally the detector knows what type of detector it is
type | is the string where the detector type will be written ("Mythen", "Pilatus", "XFS", "Gotthard", Agipd") |
int slsDetector::getFileIndex | ( | ) | [inline] |
returns the default output file index
char* slsDetector::getFileName | ( | ) | [inline] |
returns the default output files root name
char* slsDetector::getFilePath | ( | ) | [inline] |
returns the default output files path
float slsDetector::getFineOffset | ( | ) | [inline] |
get detector fine offset
Reimplemented in mythenDetector.
int slsDetector::getFlatFieldCorrections | ( | float * | corr = NULL , |
|
float * | ecorr = NULL | |||
) |
get flat field corrections
corr | if !=NULL will be filled with the correction coefficients | |
ecorr | if !=NULL will be filled with the correction coefficients errors |
float slsDetector::getGlobalOffset | ( | ) | [inline] |
get detector global offset
Reimplemented in mythenDetector.
char* slsDetector::getHostname | ( | ) | [inline] |
returns the detector hostname
int64_t slsDetector::getId | ( | idMode | mode, | |
int | imod = 0 | |||
) |
get detector ids/versions for module
mode | which id/version has to be read | |
imod | module number for module serial number |
int slsDetector::getMaxNumberOfModules | ( | dimension | d = X |
) |
get the maximum size of the detector
d | dimension |
slsDetector::sls_detector_module * slsDetector::getModule | ( | int | imod | ) |
get module
imod | module number |
int slsDetector::getPositions | ( | float * | pos = NULL |
) | [inline] |
get positions for the acquisition
pos | array which will contain the encoder positions |
Reimplemented in mythenDetector.
int slsDetector::getRateCorrections | ( | ) |
get rate correction
int slsDetector::getRateCorrections | ( | float & | t | ) |
get rate correction
t | reference for dead time |
int slsDetector::getRunStatus | ( | ) |
get run status
int slsDetector::getSetLength | ( | ) | [inline] |
get length cycles
not implemented (should be something more general like "set speed including also waitstates, set cycles etc.)
slsDetector::detectorSettings slsDetector::getSettings | ( | int | imod = -1 |
) |
get detector settings
imod | module number (-1 all) |
int slsDetector::getStopPort | ( | ) | [inline] |
returns the detector stop port
int slsDetector::getThresholdEnergy | ( | int | imod = -1 |
) |
get threshold energy
imod | module number (-1 all) |
int64_t slsDetector::getTimeLeft | ( | timerIndex | index | ) |
get current timer value
index | timer index |
char* slsDetector::getTrimDir | ( | ) | [inline] |
returns the detector trimbit directory
int slsDetector::getTrimEn | ( | int * | en | ) | [inline] |
returns the number of trim energies and their value
point | to the array that will contain the trim energies (in ev) |
int slsDetector::giveCalibrationPulse | ( | float | vcal, | |
int | npulses | |||
) |
give a train of calibration pulses
vcal | pulse amplitude | |
npulses | number of pulses |
int slsDetector::initializeDetectorSize | ( | detectorType | type | ) | [private] |
Initializes the thisDetector structure
type | is needed to define the number of channels, chips, modules etc. |
if the shared memory has newly be created, initialize the detector variables
set hostname to default
set ports to defaults
set thisDetector->myDetectorType to type and according to this set nChans, nChips, nDacs, nAdcs, nModMax, dynamicRange, nMod
number of modules is initally the maximum number of modules
calculates the expected data size
set trimDsdir, calDir and filePath to default to home directory
set fileName to default to run
set fileIndex to default to 0
set number of trim energies to 0
set correction mask to 0
set deat time
set number of bad chans to 0
set number of bad flat field chans to 0
set angular direction to 1
set fine offset to 0
set global offset to 0
set number of rois to 0
set readoutflags to none
set current settings to uninitialized
set threshold to -1
set clockdivider to 1
set number of positions to 0
set binsize
calculates the memory offsets for flat field coefficients and errors, module structures, dacs, adcs, chips and channels
also in case thisDetector alread existed initialize the pointer for flat field coefficients and errors, module structures, dacs, adcs, chips and channels
if thisDetector is new, initialize its structures
fill the BadChannelMask
int slsDetector::initializeDetectorStructure | ( | ) | [private] |
Initializes the module structures in thisDetector if the detector did not exists before
for each of the detector modules up to the maximum number which can be installed initlialize the sls_detector_module structure
initializes the serial number and register to 0
initializes the dacs values to 0
initializes the adc values to 0
initializes the chip registers to 0
initializes the channel registers to 0
initialize gain and offset to -1
int slsDetector::initSharedMemory | ( | detectorType | type = GENERIC , |
|
int | id = 0 | |||
) | [private] |
Initializes the shared memory
type | is needed to define the size of the shared memory | |
id | is the detector id needed to define the shared memory id |
the shared memory key is set to DEFAULT_SHM_KEY+id
The size of the shared memory is: size of shared structure + ffcoefficents +fferrors + modules+ dacs+adcs+chips+chans
thisDetector pointer is set to the memory address of the shared memory
shm_id returns -1 is shared memory initialization fails
int * slsDetector::popDataQueue | ( | ) |
pops the data from the data queue
void * slsDetector::processData | ( | ) |
function for processing data
Pop data queue
decode data
write raw data file
rate correction
flat field correction
angular conversion
data merging
file writing
int slsDetector::rateCorrect | ( | float * | datain, | |
float * | errin, | |||
float * | dataout, | |||
float * | errout | |||
) |
rate correct data
datain | data array | |
errin | error array on data (if NULL will default to sqrt(datain) | |
dataout | array of corrected data | |
errout | error on corrected data (if not NULL) |
int slsDetector::rateCorrect | ( | float | datain, | |
float | errin, | |||
float & | dataout, | |||
float & | errout, | |||
float | tau, | |||
float | t | |||
) |
rate correct data
datain | data | |
errin | error on data (if<=0 will default to sqrt(datain) | |
dataout | corrected data | |
errout | error on corrected data | |
tau | dead time 9in ns) | |
t | acquisition time (in ns) |
int * slsDetector::readAll | ( | ) |
asks and receives all data from the detector and puts them in a data queue
int slsDetector::readAngularConversion | ( | string | fname = "" |
) |
reads an angular conversion file
fname | file to be read |
Reimplemented in mythenDetector.
int slsDetector::readCalibrationFile | ( | string | fname, | |
float & | gain, | |||
float & | offset | |||
) |
reads a calibration file
fname | file to be read | |
gain | reference to the gain variable reference to the offset variable |
Reimplemented in mythenDetector, and eigerDetector.
int slsDetector::readConfigurationFile | ( | string const | fname | ) |
Every detector should have a basic configuration file containing: type (mythen, pilatus etc.) hostname portnumber communication type (default TCP/IP) eventually secondary portnumber (e.g. mythen stop function) number of modules installed if different from the detector size (x,y)
to be changed
int slsDetector::readDataFile | ( | string | fname, | |
int * | data | |||
) |
reads a data file
name | of the file to be read | |
data | array of data values |
Reimplemented in mythenDetector, and eigerDetector.
int slsDetector::readDataFile | ( | string | fname, | |
float * | data, | |||
float * | err = NULL , |
|||
float * | ang = NULL , |
|||
char | dataformat = 'f' , |
|||
int | nch = 0 | |||
) |
reads a data file
name | of the file to be read | |
data | array of data values to be filled | |
err | array of arrors on the data. If NULL no errors are expected on the file | |
ang | array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err) | |
dataformat | format of the data: can be 'i' integer or 'f' float (default) | |
nch | number of channels to be written to file. if <=0 defaults to the number of installed channels of the detector |
Reimplemented in mythenDetector, and eigerDetector.
int * slsDetector::readFrame | ( | ) |
asks and receives a data frame from the detector
int slsDetector::readRegister | ( | int | addr | ) |
read register
addr | address |
sls_detector_module* slsDetector::readTrimFile | ( | string | fname, | |
sls_detector_module * | myMod = NULL | |||
) |
reads a trim file
fname | name of the file to be read | |
myMod | pointer to the module structure which has to be set. If it is NULL a new module structure will be created |
Reimplemented in mythenDetector, and eigerDetector.
int slsDetector::receiveChannel | ( | sls_detector_channel * | ) | [private] |
receive a sls_detector_channel structure over socket
int slsDetector::receiveChip | ( | sls_detector_chip * | ) | [private] |
receive a sls_detector_chip structure over socket
int slsDetector::receiveModule | ( | sls_detector_module * | ) | [private] |
receive a sls_detector_module structure over socket
int slsDetector::resetMerging | ( | float * | mp, | |
float * | mv, | |||
float * | me, | |||
int * | mm | |||
) |
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
mp | already merged postions | |
mv | already merged data | |
me | already merged errors (squared sum) | |
mm | multiplicity of merged arrays |
Reimplemented in mythenDetector.
int slsDetector::retrieveDetectorSetup | ( | string const | fname | ) |
not yet implemented
should retrieve from a file all the current detector parameters
int slsDetector::sendChannel | ( | sls_detector_channel * | ) | [private] |
send a sls_detector_channel structure over socket
int slsDetector::sendChip | ( | sls_detector_chip * | ) | [private] |
send a sls_detector_chip structure over socket
int slsDetector::sendModule | ( | sls_detector_module * | ) | [private] |
send a sls_detector_module structure over socket
int slsDetector::setAngularConversion | ( | string | fname = "" |
) |
set angular conversion
fname | file with angular conversion constants ("" disable) |
Reimplemented in mythenDetector.
int slsDetector::setBadChannelCorrection | ( | string | fname = "" |
) |
set bad channels correction
fname | file with bad channel list ("" disable) |
float slsDetector::setBinSize | ( | float | bs | ) | [inline] |
set detector bin size used for merging (approx angular resolution)
Reimplemented in mythenDetector.
char* slsDetector::setCalDir | ( | string | s | ) | [inline] |
sets the location of the calibration files
int slsDetector::setChannel | ( | sls_detector_channel | chan | ) |
configure channel
chan | channel to be set - must contain correct channel, module and chip number |
int slsDetector::setChannel | ( | int64_t | reg, | |
int | ichan = -1 , |
|||
int | ichip = -1 , |
|||
int | imod = -1 | |||
) |
configure channel
reg | channel register | |
ichan | channel number (-1 all) | |
ichip | chip number (-1 all) | |
imod | module number (-1 all) |
int slsDetector::setChip | ( | sls_detector_chip | chip | ) |
configure chip
chip | chip to be set - must contain correct module and chip number and also channel registers |
int slsDetector::setChip | ( | int | reg, | |
int | ichip = -1 , |
|||
int | imod = -1 | |||
) |
configure chip
reg | chip register | |
ichip | chip number (-1 all) | |
imod | module number (-1 all) |
int slsDetector::setClockDivider | ( | int | i | ) | [inline] |
set clock divider
not implemented (should be something more general like "set speed including also waitstates, set cycles etc.)
float slsDetector::setDAC | ( | float | val, | |
dacIndex | index, | |||
int | imod = -1 | |||
) |
set dacs value
val | value (in V) | |
index | DAC index | |
imod | module number (if -1 alla modules) |
int slsDetector::setDetectorType | ( | string | type | ) |
sets/gets detector type normally the detector knows what type of detector it is
type | is the detector type ("Mythen", "Pilatus", "XFS", "Gotthard", Agipd") |
int slsDetector::setDetectorType | ( | detectorType | type = GET_DETECTOR_TYPE |
) |
sets/gets detector type normally the detector knows what type of detector it is
type | is the detector type (defaults to GET_DETECTOR_TYPE) |
int slsDetector::setDynamicRange | ( | int | n = -1 |
) |
set/get dynamic range
n | dynamic range (-1 get) |
externalCommunicationMode slsDetector::setExternalCommunicationMode | ( | externalCommunicationMode | pol = GET_EXTERNAL_COMMUNICATION_MODE |
) |
set/get the external communication mode
obsolete
pol | value to be set |
externalSignalFlag slsDetector::setExternalSignalFlags | ( | externalSignalFlag | pol = GET_EXTERNAL_SIGNAL_FLAG , |
|
int | signalindex = 0 | |||
) |
set/get the use of an external signal
pol | meaning of the signal |
signalIndex | index of the signal |
int slsDetector::setFileIndex | ( | int | i | ) | [inline] |
sets the default output file index
char* slsDetector::setFileName | ( | string | s | ) | [inline] |
sets the default output files root name
char* slsDetector::setFilePath | ( | string | s | ) | [inline] |
sets the default output files path
float slsDetector::setFineOffset | ( | float | f | ) | [inline] |
set detector fine offset
Reimplemented in mythenDetector.
int slsDetector::setFlatFieldCorrection | ( | string | fname = "" |
) |
set flat field corrections
fname | name of the flat field file (or "" if disable) |
float slsDetector::setGlobalOffset | ( | float | f | ) | [inline] |
set detector global offset
Reimplemented in mythenDetector.
int slsDetector::setModule | ( | sls_detector_module | module | ) |
configure chip
module | module to be set - must contain correct module number and also channel and chip registers |
int slsDetector::setModule | ( | int | reg, | |
int | imod = -1 | |||
) |
configure module
imod | module number (-1 all) |
int slsDetector::setNumberOfModules | ( | int | n, | |
dimension | d = X | |||
) |
set/get the size of the detector
n | number of modules | |
d | dimension |
int slsDetector::setOnline | ( | int const | online | ) |
sets the onlineFlag
off | can be: GET_ONLINE_FLAG, returns wether the detector is in online or offline state; OFFLINE_FLAG, detector in offline state (i.e. no communication to the detector - using only local structure - no data acquisition possible!); ONLINE_FLAG detector in online state (i.e. communication to the detector updating the local structure) |
int slsDetector::setPositions | ( | int | nPos, | |
float * | pos | |||
) | [inline] |
set positions for the acquisition
nPos | number of positions | |
pos | array with the encoder positions |
Reimplemented in mythenDetector.
int slsDetector::setRateCorrection | ( | float | t = 0 |
) |
set rate correction
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 |
int slsDetector::setReadOutFlags | ( | readOutFlags | flag | ) |
set/get readout flags
flag | readout flag to be set |
int slsDetector::setROI | ( | int | nroi = -1 , |
|
int * | xmin = NULL , |
|||
int * | xmax = NULL , |
|||
int * | ymin = NULL , |
|||
int * | ymax = NULL | |||
) |
set roi
not yet implemented
int slsDetector::setSetLength | ( | int | i | ) | [inline] |
set length cycles
not implemented (should be something more general like "set speed including also waitstates, set cycles etc.)
detectorSettings slsDetector::setSettings | ( | detectorSettings | isettings, | |
int | imod = -1 | |||
) |
set detector settings
isettings | settings | |
imod | module number (-1 all) |
int slsDetector::setTCPSocket | ( | string const | name = "" , |
|
int const | control_port = -1 , |
|||
int const | stop_port = -1 , |
|||
int const | data_port = -1 | |||
) |
configure the socket communication and initializes the socket instances
name | hostname - if "" the current hostname is used | |
control_port | port for control commands - if -1 the current is used | |
stop_port | port for stop command - if -1 the current is used | |
data_port | port for receiving data - if -1 the current is used |
int slsDetector::setThresholdEnergy | ( | int | e_eV, | |
int | imod = -1 , |
|||
detectorSettings | isettings = GET_SETTINGS | |||
) |
set threshold energy
e_eV | threshold in eV | |
imod | module number (-1 all) | |
isettings | ev. change settings |
int64_t slsDetector::setTimer | ( | timerIndex | index, | |
int64_t | t = -1 | |||
) |
set/get timer value
index | timer index | |
t | time in ns or number of...(e.g. frames, gates, probes) |
char* slsDetector::setTrimDir | ( | string | s | ) | [inline] |
sets the detector trimbit directory
int slsDetector::startAcquisition | ( | ) |
start detector acquisition
int * slsDetector::startAndReadAll | ( | ) |
start detector acquisition and read all data putting them a data queue
int slsDetector::startAndReadAllNoWait | ( | ) |
start detector acquisition and read out, but does not read data from socket
int slsDetector::startReadOut | ( | ) |
start readout (without exposure or interrupting exposure)
void slsDetector::startThread | ( | ) | [private] |
start data processing threas
int slsDetector::stopAcquisition | ( | ) |
stop detector acquisition
int slsDetector::writeAngularConversion | ( | string | fname = "" |
) |
writes an angular conversion file
fname | file to be written |
Reimplemented in mythenDetector.
int slsDetector::writeCalibrationFile | ( | string | fname, | |
float | gain, | |||
float | offset | |||
) |
writes a clibration file
fname | file to be written | |
gain | ||
offset |
Reimplemented in mythenDetector, and eigerDetector.
int slsDetector::writeConfigurationFile | ( | string const | fname | ) |
Every detector should have a basic configuration file containing: type (mythen, pilatus etc.) hostname portnumber communication type (default TCP/IP) eventually secondary portnumber (e.g. mythen stop function) number of modules installed if different from the detector size (x,y)
to be changed
int slsDetector::writeDataFile | ( | string | fname, | |
int * | data | |||
) |
writes a data file
name | of the file to be written | |
data | array of data values |
Reimplemented in mythenDetector, and eigerDetector.
int slsDetector::writeDataFile | ( | string | fname, | |
float * | data, | |||
float * | err = NULL , |
|||
float * | ang = NULL , |
|||
char | dataformat = 'f' , |
|||
int | nch = -1 | |||
) |
writes a data file
name | of the file to be written | |
data | array of data values | |
err | array of arrors on the data. If NULL no errors will be written | |
ang | array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err) | |
dataformat | format of the data: can be 'i' integer or 'f' float (default) | |
nch | number of channels to be written to file. if -1 defaults to the number of installed channels of the detector |
Reimplemented in mythenDetector, and eigerDetector.
int slsDetector::writeRegister | ( | int | addr, | |
int | val | |||
) |
write register
addr | address value |
int slsDetector::writeTrimFile | ( | string | fname, | |
int | imod | |||
) |
writes a trim file for module number imod - the values will be read from the current detector structure
fname | name of the file to be written | |
imod | module number |
Reimplemented in mythenDetector, and eigerDetector.
int slsDetector::writeTrimFile | ( | string | fname, | |
sls_detector_module | mod | |||
) |
writes a trim file
fname | name of the file to be written | |
mod | module structure which has to be written to file |
Reimplemented in mythenDetector, and eigerDetector.
float* slsDetector::adcs [private] |
pointer to adc valuse
int* slsDetector::badChannelMask [private] |
pointer to bad channel mask 0 is channel is good 1 if it is bad
int* slsDetector::chanregs [private] |
pointer to channal registers
int* slsDetector::chipregs [private] |
pointer to chip registers
MySocketTCP* slsDetector::controlSocket [private] |
socket for control commands
float slsDetector::currentI0 [private] |
I0 measured
float slsDetector::currentPosition [private] |
current position of the detector
float slsDetector::currentPositionIndex [private] |
current position index of the detector
float* slsDetector::dacs [private] |
pointer to dac valuse
pthread_t slsDetector::dataProcessingThread [private] |
data processing thread???
queue<int*> slsDetector::dataQueue [private] |
data queue
MySocketTCP* slsDetector::dataSocket [private] |
socket for data acquisition
sls_detector_module* slsDetector::detectorModules [private] |
pointer to detector module structures
int slsDetector::detId [private] |
detector ID
float* slsDetector::ffcoefficients [private] |
pointer to flat field coefficients
float* slsDetector::fferrors [private] |
pointer to flat field coefficient errors
float* slsDetector::mergingBins [private] |
merging bins
float* slsDetector::mergingCounts [private] |
merging counts
float* slsDetector::mergingErrors [private] |
merging errors
int* slsDetector::mergingMultiplicity [private] |
merging multiplicity
int slsDetector::onlineFlag [private] |
int slsDetector::shmId [private] |
shared memeory ID
MySocketTCP* slsDetector::stopSocket [private] |
socket for emergency stop
sharedSlsDetector* slsDetector::thisDetector [private] |
address of the detector structure in shared memory