slsDetector Class Reference

This is the base class for all SLS detector functionalities. More...

#include <slsDetector.h>

Inheritance diagram for slsDetector:

eigerDetector mythenDetector List of all members.

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 ()
virtual int readConfigurationFile (string const fname)=0
virtual int writeConfigurationFile (string const fname)=0
virtual int dumpDetectorSetup (string const fname)=0
virtual int retrieveDetectorSetup (string const fname)=0
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=NULL)
virtual sls_detector_modulereadTrimFile (string fname, sls_detector_module *myMod=NULL)=0
virtual int writeTrimFile (string fname, sls_detector_module mod)=0
virtual int writeTrimFile (string fname, int imod)=0
char * setFilePath (string s)
char * setFileName (string s)
int setFileIndex (int i)
char * getFilePath ()
char * getFileName ()
int getFileIndex ()
string createFileName ()
virtual int writeDataFile (string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1)=0
virtual int writeDataFile (string fname, int *data)=0
virtual int readDataFile (string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=0)=0
virtual int readDataFile (string fname, int *data)=0
char * getCalDir ()
char * setCalDir (string s)
virtual int readCalibrationFile (string fname, float &gain, float &offset)=0
virtual int writeCalibrationFile (string fname, float gain, float offset)=0
virtual int readAngularConversion (string fname="")=0
virtual int writeAngularConversion (string fname="")=0
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_modulegetModule (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 ()
detectorDatapopFinalDataQueue ()
int64_t setTimer (timerIndex index, int64_t t=-1)
int64_t getTimeLeft (timerIndex index)
int setSpeed (speedVariable sp, int value=-1)
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 getFlatFieldCorrection (float *corr=NULL, float *ecorr=NULL)
int setRateCorrection (float t=0)
int getRateCorrection (float &t)
int getRateCorrection ()
int setBadChannelCorrection (string fname="")
int getBadChannelCorrection (int *bad=NULL)
char * getBadChannelCorrectionFile ()
virtual int setAngularConversion (string fname="")=0
virtual int getAngularConversion (int &direction, angleConversionConstant *angconv=NULL)=0
virtual char * getAngularConversion ()=0
virtual float setGlobalOffset (float f)=0
virtual float setFineOffset (float f)=0
virtual float getFineOffset ()=0
virtual float getGlobalOffset ()=0
virtual int setPositions (int nPos, float *pos)=0
virtual int getPositions (float *pos=NULL)=0
virtual float setBinSize (float bs)=0
virtual float getBinSize ()=0
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)
virtual int resetMerging (float *mp, float *mv, float *me, int *mm)=0
virtual int addToMerging (float *p1, float *v1, float *e1, float *mp, float *mv, float *me, int *mm)=0
int finalizeMerging (float *mp, float *mv, float *me, int *mm)
int exitServer ()
virtual void * processData (int delflag=1)=0
sls_detector_modulecreateModule ()
void deleteModule (sls_detector_module *myMod)
virtual void acquire (int delflag=1)=0

Protected 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 ()

Protected Attributes

sharedSlsDetectorthisDetector
int onlineFlag
int detId
int shmId
MySocketTCPcontrolSocket
MySocketTCPstopSocket
MySocketTCPdataSocket
queue< int * > dataQueue
queue< detectorData * > finalDataQueue
float currentPosition
float currentPositionIndex
float currentI0
float * mergingBins
float * mergingCounts
float * mergingErrors
int * mergingMultiplicity
float * ffcoefficients
float * fferrors
sls_detector_moduledetectorModules
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...

Detailed Description

This is the base class for all SLS detector functionalities.

The slsDetector class is expected to become the interface class for all SLS Detectors acquisition (and analysis) software.

Author:
Anna Bergamaschi
Version:
0.1alpha


Member Typedef Documentation

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!).


Member Enumeration Documentation

anonymous enum

online flags enum

See also:
setOnline
Enumerator:
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)


Constructor & Destructor Documentation

slsDetector::slsDetector ( detectorType  type = GENERIC,
int  id = 0 
)

(default) constructor

Parameters:
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

See also:
initSharedMemory
if it fails the detector id is incremented until it succeeds

Initializes the detector stucture

See also:
initializeDetectorSize

slsDetector::~slsDetector (  )  [inline]

destructor


Member Function Documentation

virtual void slsDetector::acquire ( int  delflag = 1  )  [pure virtual]

pure virtual function performs the complete acquisition and data processing moves the detector to next position
starts and reads the detector
reads the IC (if required)
reads the encoder (iof required for angualr conversion)
processes the data (flat field, rate, angular conversion and merging processData()) /param delflag if 1 the data are processed, written to file and then deleted. If 0 they are added to the finalDataQueue

See also:
mythenDetector::acquire()

Implemented in mythenDetector.

virtual int slsDetector::addToMerging ( float *  p1,
float *  v1,
float *  e1,
float *  mp,
float *  mv,
float *  me,
int *  mm 
) [pure virtual]

pure virtual function merge dataset

Parameters:
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
See also:
mythenDetector::addToMerging

Implemented in mythenDetector.

int* slsDetector::analogTest ( analogTestMode  mode  ) 

analog test

Parameters:
modte test mode
Returns:
pointer to acquired data
not yet implemented

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

sls_detector_module * slsDetector::createModule (  ) 

Allocates the memory for a sls_detector_module structure and initializes it

Returns:
myMod the pointer to the allocate dmemory location

float * slsDetector::decodeData ( int *  datain  ) 

decode data from the detector converting them to an array of floats, one for each channle

Parameters:
datain data from the detector
Returns:
pointer to a float array with a data per channel

Reimplemented in eigerDetector.

void slsDetector::deleteModule ( sls_detector_module myMod  ) 

frees the memory for a sls_detector_module structure

Parameters:
myMod the pointer to the memory to be freed

int slsDetector::digitalTest ( digitalTestMode  mode,
int  imod = 0 
)

Digital test of the modules

Parameters:
mode test mode
imod module number for chip test or module firmware test
Returns:
OK or error mask

virtual int slsDetector::dumpDetectorSetup ( string const   fname  )  [pure virtual]

Purely virtual function Should be implemented in the specific detector class /sa mythenDetector::dumpDetectorSetup

Implemented in mythenDetector.

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.

Parameters:
cmd is the command to be executed
answer is the answer from the detector
Returns:
OK or FAIL depending on the command outcome

int slsDetector::executeTrimming ( trimMode  mode,
int  par1,
int  par2,
int  imod = -1 
)

execute trimming

Parameters:
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)
Returns:
OK or FAIl (FAIL also if some channel are 0 or 63

int slsDetector::exists (  )  [inline]

sets the onlineFlag

Returns:
1 if the detector structure has already be initlialized, 0 otherwise

int slsDetector::exitServer (  ) 

turns off server

int slsDetector::fillBadChannelMask (  )  [protected]

fill bad channel mask (0 if channel is good, 1 if bad)

int slsDetector::finalizeMerging ( float *  mp,
float *  mv,
float *  me,
int *  mm 
)

pure virtual function calculates the "final" positions, data value and errors for the emrged data

Parameters:
mp already merged postions
mv already merged data
me already merged errors (squared sum)
mm multiplicity of merged arrays
Returns:
FAIL or the number of non empty bins (i.e. points belonging to the pattern)
See also:
mythenDetector::finalizeMerging

Reimplemented in mythenDetector.

int slsDetector::flatFieldCorrect ( float *  datain,
float *  errin,
float *  dataout,
float *  errout 
)

flat field correct data

Parameters:
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)
Returns:
0

int slsDetector::flatFieldCorrect ( float  datain,
float  errin,
float &  dataout,
float &  errout,
float  ffcoefficient,
float  fferr 
)

flat field correct data

Parameters:
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
Returns:
0

int slsDetector::freeSharedMemory (  )  [protected]

Frees the shared memory - should not be used

float slsDetector::getADC ( dacIndex  index,
int  imod = 0 
)

set dacs value

Parameters:
index ADC index
imod module number
Returns:
current ADC value

virtual char* slsDetector::getAngularConversion (  )  [pure virtual]

pure virtual function returns the angular conversion file

See also:
mythenDetector::getAngularConversion

Implemented in mythenDetector.

virtual int slsDetector::getAngularConversion ( int &  direction,
angleConversionConstant angconv = NULL 
) [pure virtual]

pure virtual function get angular conversion

Parameters:
reference to diffractometer direction
angconv array that will be filled with the angular conversion constants
Returns:
0 if angular conversion disabled, >0 otherwise
See also:
mythenDetector::getAngularConversion

Implemented in mythenDetector.

int slsDetector::getBadChannelCorrection ( int *  bad = NULL  ) 

get bad channels correction

Parameters:
bad pointer to array that if bad!=NULL will be filled with the bad channel list
Returns:
0 if bad channel disabled or no bad channels, >0 otherwise

char* slsDetector::getBadChannelCorrectionFile (  )  [inline]

returns the bad channel list file

virtual float slsDetector::getBinSize (  )  [pure virtual]

pure virtual function return detector bin size used for merging (approx angular resolution)

See also:
mythenDetector::getBinSize

Implemented in mythenDetector.

char* slsDetector::getCalDir (  )  [inline]

returns the location of the calibration files

See also:
sharedSlsDetector

sls_detector_channel slsDetector::getChannel ( int  ichan,
int  ichip,
int  imod 
)

get channel

Parameters:
ichan channel number
ichip chip number
imod module number
Returns:
current channel structure for channel

sls_detector_chip slsDetector::getChip ( int  ichip,
int  imod 
)

get chip

Parameters:
ichip chip number
imod module number
Returns:
current chip structure for channel
Bug:
probably does not return corretly!

int slsDetector::getControlPort (  )  [inline]

returns the detector control port

See also:
sharedSlsDetector

int * slsDetector::getDataFromDetector (  )  [protected]

Receives a data frame from the detector socket

Returns:
pointer to the data (or NULL if failed)

int * slsDetector::getDataFromDetectorNoWait (  ) 

receives a data frame from the detector socket

Returns:
pointer to the data or NULL. If NULL disconnects the socket
See also:
getDataFromDetector

int slsDetector::getDataPort (  )  [inline]

returns the detector data port

See also:
sharedSlsDetector

void slsDetector::getDetectorType ( char *  type  ) 

gets detector type normally the detector knows what type of detector it is

Parameters:
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

See also:
sharedSlsDetector

char* slsDetector::getFileName (  )  [inline]

returns the default output files root name

See also:
sharedSlsDetector

char* slsDetector::getFilePath (  )  [inline]

returns the default output files path

See also:
sharedSlsDetector

virtual float slsDetector::getFineOffset (  )  [pure virtual]

pure virtual function get detector fine offset

See also:
mythenDetector::getFineOffset

Implemented in mythenDetector.

int slsDetector::getFlatFieldCorrection ( float *  corr = NULL,
float *  ecorr = NULL 
)

get flat field corrections

Parameters:
corr if !=NULL will be filled with the correction coefficients
ecorr if !=NULL will be filled with the correction coefficients errors
Returns:
0 if ff correction disabled, >0 otherwise

virtual float slsDetector::getGlobalOffset (  )  [pure virtual]

pure virtual function get detector global offset

See also:
mythenDetector::getGlobalOffset

Implemented in mythenDetector.

char* slsDetector::getHostname (  )  [inline]

returns the detector hostname

See also:
sharedSlsDetector

int64_t slsDetector::getId ( idMode  mode,
int  imod = 0 
)

get detector ids/versions for module

Parameters:
mode which id/version has to be read
imod module number for module serial number
Returns:
id

int slsDetector::getMaxNumberOfModules ( dimension  d = X  ) 

get the maximum size of the detector

Parameters:
d dimension
Returns:
maximum number of modules that can be installed in direction d

sls_detector_module * slsDetector::getModule ( int  imod  ) 

get module

Parameters:
imod module number
Returns:
pointer to module structure (which has bee created and must then be deleted)

virtual int slsDetector::getPositions ( float *  pos = NULL  )  [pure virtual]

pure virtual function get positions for the acquisition

Parameters:
pos array which will contain the encoder positions
Returns:
number of positions
See also:
mythenDetector::getPositions

Implemented in mythenDetector.

int slsDetector::getRateCorrection (  ) 

get rate correction

Returns:
0 if rate correction disabled, >0 otherwise

int slsDetector::getRateCorrection ( float &  t  ) 

get rate correction

Parameters:
t reference for dead time
Returns:
0 if rate correction disabled, >0 otherwise

int slsDetector::getRunStatus (  ) 

get run status

Returns:
status mask

detectorSettings slsDetector::getSettings ( int  imod = -1  ) 

get detector settings

Parameters:
imod module number (-1 all)
Returns:
current settings

int slsDetector::getStopPort (  )  [inline]

returns the detector stop port

See also:
sharedSlsDetector

int slsDetector::getThresholdEnergy ( int  imod = -1  ) 

get threshold energy

Parameters:
imod module number (-1 all)
Returns:
current threshold value for imod in ev (-1 failed)

int64_t slsDetector::getTimeLeft ( timerIndex  index  ) 

get current timer value

Parameters:
index timer index
Returns:
elapsed time value in ns or number of...(e.g. frames, gates, probes)

char* slsDetector::getTrimDir (  )  [inline]

returns the detector trimbit directory

See also:
sharedSlsDetector

int slsDetector::getTrimEn ( int *  en = NULL  )  [inline]

returns the number of trim energies and their value

See also:
sharedSlsDetector
Parameters:
point to the array that will contain the trim energies (in ev)
Returns:
number of trim energies
See also:
sharedSlsDetector

int slsDetector::giveCalibrationPulse ( float  vcal,
int  npulses 
)

give a train of calibration pulses

Parameters:
vcal pulse amplitude
npulses number of pulses
not yet implemented

int slsDetector::initializeDetectorSize ( detectorType  type  )  [protected]

Initializes the thisDetector structure

Parameters:
type is needed to define the number of channels, chips, modules etc.
See also:
sharedSlsDetector

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

sets bad channel list file to none

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

sets angular conversion file to none

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

See also:
initializeDetectorStructure();
set thisDetector->alreadyExisting=1

fill the BadChannelMask

See also:
fillBadChannelMask

int slsDetector::initializeDetectorStructure (  )  [protected]

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

See also:
sls_detector_module
sets the size of the module to nChans, nChips etc.

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 
) [protected]

Initializes the shared memory

Parameters:
type is needed to define the size of the shared memory
id is the detector id needed to define the shared memory id
Returns:
shm_id 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

Returns:
pointer to the popped data or NULL if the queue is empty.
See also:
dataQueue

detectorData * slsDetector::popFinalDataQueue (  ) 

pops the data from thepostprocessed data queue

Returns:
pointer to the popped data or NULL if the queue is empty.
See also:
finalDataQueue

virtual void* slsDetector::processData ( int  delflag = 1  )  [pure virtual]

pure virtual function function for processing data /param delflag if 1 the data are processed, written to file and then deleted. If 0 they are added to the finalDataQueue

See also:
mythenDetector::processData

Implemented in mythenDetector.

int slsDetector::rateCorrect ( float *  datain,
float *  errin,
float *  dataout,
float *  errout 
)

rate correct data

Parameters:
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)
Returns:
0

int slsDetector::rateCorrect ( float  datain,
float  errin,
float &  dataout,
float &  errout,
float  tau,
float  t 
)

rate correct data

Parameters:
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)
Returns:
0

int * slsDetector::readAll (  ) 

asks and receives all data from the detector and puts them in a data queue

Returns:
pointer to the front of the queue or NULL.
See also:
getDataFromDetector dataQueue

virtual int slsDetector::readAngularConversion ( string  fname = ""  )  [pure virtual]

Pure virtual function reads an angular conversion file

Parameters:
fname file to be read
See also:
angleConversionConstant mythenDetector::readAngularConversion

Implemented in mythenDetector.

virtual int slsDetector::readCalibrationFile ( string  fname,
float &  gain,
float &  offset 
) [pure virtual]

Pure virtual function reads a calibration file

Parameters:
fname file to be read
gain reference to the gain variable reference to the offset variable
See also:
sharedSlsDetector mythenDetector::readCalibrationFile

Implemented in mythenDetector, and eigerDetector.

virtual int slsDetector::readConfigurationFile ( string const   fname  )  [pure virtual]

Purely virtual function Should be implemented in the specific detector class /sa mythenDetector::readConfigurationFile

Implemented in mythenDetector.

virtual int slsDetector::readDataFile ( string  fname,
int *  data 
) [pure virtual]

Pure virtual function reads a data file

Parameters:
name of the file to be read
data array of data values
Returns:
OK or FAIL if it could not read the file or data=NULL
See also:
mythenDetector::readDataFile

Implemented in mythenDetector, and eigerDetector.

virtual int slsDetector::readDataFile ( string  fname,
float *  data,
float *  err = NULL,
float *  ang = NULL,
char  dataformat = 'f',
int  nch = 0 
) [pure virtual]

Pure virtual function reads a data file

Parameters:
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
Returns:
OK or FAIL if it could not read the file or data=NULL
See also:
mythenDetector::readDataFile

Implemented in mythenDetector, and eigerDetector.

int * slsDetector::readFrame (  ) 

asks and receives a data frame from the detector

Returns:
pointer to the data or NULL. If NULL disconnects the socket
See also:
getDataFromDetector

int slsDetector::readRegister ( int  addr  ) 

read register

Parameters:
addr address
Returns:
current register value

virtual sls_detector_module* slsDetector::readTrimFile ( string  fname,
sls_detector_module myMod = NULL 
) [pure virtual]

Pure virtual function reads a trim file

Parameters:
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
Returns:
the pointer to myMod or NULL if reading the file failed
See also:
mythenDetector::readTrimFile

Implemented in mythenDetector, and eigerDetector.

int slsDetector::receiveChannel ( sls_detector_channel  )  [protected]

receive a sls_detector_channel structure over socket

int slsDetector::receiveChip ( sls_detector_chip  )  [protected]

receive a sls_detector_chip structure over socket

int slsDetector::receiveModule ( sls_detector_module  )  [protected]

receive a sls_detector_module structure over socket

virtual int slsDetector::resetMerging ( float *  mp,
float *  mv,
float *  me,
int *  mm 
) [pure virtual]

pure virtual function sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();

Parameters:
mp already merged postions
mv already merged data
me already merged errors (squared sum)
mm multiplicity of merged arrays
Returns:
OK or FAIL
See also:
mythenDetector::resetMerging

Implemented in mythenDetector.

virtual int slsDetector::retrieveDetectorSetup ( string const   fname  )  [pure virtual]

Purely virtual function Should be implemented in the specific detector class /sa mythenDetector::retrieveDetectorSetup

Implemented in mythenDetector.

int slsDetector::sendChannel ( sls_detector_channel  )  [protected]

send a sls_detector_channel structure over socket

int slsDetector::sendChip ( sls_detector_chip  )  [protected]

send a sls_detector_chip structure over socket

int slsDetector::sendModule ( sls_detector_module  )  [protected]

send a sls_detector_module structure over socket

virtual int slsDetector::setAngularConversion ( string  fname = ""  )  [pure virtual]

pure virtual function set angular conversion

Parameters:
fname file with angular conversion constants ("" disable)
Returns:
0 if angular conversion disabled, >0 otherwise
See also:
mythenDetector::setAngularConversion

Implemented in mythenDetector.

int slsDetector::setBadChannelCorrection ( string  fname = ""  ) 

set bad channels correction

Parameters:
fname file with bad channel list ("" disable)
Returns:
0 if bad channel disabled, >0 otherwise

virtual float slsDetector::setBinSize ( float  bs  )  [pure virtual]

pure virtual function set detector bin size used for merging (approx angular resolution)

Parameters:
bs bin size in degrees
Returns:
current bin size
See also:
mythenDetector::setBinSize

Implemented in mythenDetector.

char* slsDetector::setCalDir ( string  s  )  [inline]

sets the location of the calibration files

See also:
sharedSlsDetector

int slsDetector::setChannel ( sls_detector_channel  chan  ) 

configure channel

Parameters:
chan channel to be set - must contain correct channel, module and chip number
Returns:
current register value

int slsDetector::setChannel ( int64_t  reg,
int  ichan = -1,
int  ichip = -1,
int  imod = -1 
)

configure channel

Parameters:
reg channel register
ichan channel number (-1 all)
ichip chip number (-1 all)
imod module number (-1 all)
Returns:
current register value
See also:
sls_detector_channel

int slsDetector::setChip ( sls_detector_chip  chip  ) 

configure chip

Parameters:
chip chip to be set - must contain correct module and chip number and also channel registers
Returns:
current register value
See also:
sls_detector_chip

int slsDetector::setChip ( int  reg,
int  ichip = -1,
int  imod = -1 
)

configure chip

Parameters:
reg chip register
ichip chip number (-1 all)
imod module number (-1 all)
Returns:
current register value
See also:
sls_detector_chip

float slsDetector::setDAC ( float  val,
dacIndex  index,
int  imod = -1 
)

set dacs value

Parameters:
val value (in V)
index DAC index
imod module number (if -1 alla modules)
Returns:
current DAC value

int slsDetector::setDetectorType ( string  type  ) 

sets/gets detector type normally the detector knows what type of detector it is

Parameters:
type is the detector type ("Mythen", "Pilatus", "XFS", "Gotthard", Agipd")
Returns:
returns detector type index (1 GENERIC, 2 MYTHEN, 3 PILATUS, 4 XFS, 5 GOTTHARD, 6 AGIPD, -1 command failed)

int slsDetector::setDetectorType ( detectorType  type = GET_DETECTOR_TYPE  ) 

sets/gets detector type normally the detector knows what type of detector it is

Parameters:
type is the detector type (defaults to GET_DETECTOR_TYPE)
Returns:
returns detector type index (1 GENERIC, 2 MYTHEN, 3 PILATUS, 4 XFS, 5 GOTTHARD, 6 AGIPD, -1 command failed)

int slsDetector::setDynamicRange ( int  n = -1  ) 

set/get dynamic range

Parameters:
n dynamic range (-1 get)
Returns:
current dynamic range updates the size of the data expected from the detector
See also:
sharedSlsDetector

externalCommunicationMode slsDetector::setExternalCommunicationMode ( externalCommunicationMode  pol = GET_EXTERNAL_COMMUNICATION_MODE  ) 

set/get the external communication mode

obsolete

See also:
setExternalSignalFlags
Parameters:
pol value to be set
See also:
externalCommunicationMode
Returns:
current external communication mode

externalSignalFlag slsDetector::setExternalSignalFlags ( externalSignalFlag  pol = GET_EXTERNAL_SIGNAL_FLAG,
int  signalindex = 0 
)

set/get the use of an external signal

Parameters:
pol meaning of the signal
See also:
externalSignalFlag
Parameters:
signalIndex index of the signal
Returns:
current meaning of signal signalIndex

int slsDetector::setFileIndex ( int  i  )  [inline]

sets the default output file index

See also:
sharedSlsDetector

char* slsDetector::setFileName ( string  s  )  [inline]

sets the default output files root name

See also:
sharedSlsDetector

char* slsDetector::setFilePath ( string  s  )  [inline]

sets the default output files path

See also:
sharedSlsDetector

virtual float slsDetector::setFineOffset ( float  f  )  [pure virtual]

pure virtual function set detector fine offset

See also:
mythenDetector::setFineOffset

Implemented in mythenDetector.

int slsDetector::setFlatFieldCorrection ( string  fname = ""  ) 

set flat field corrections

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

virtual float slsDetector::setGlobalOffset ( float  f  )  [pure virtual]

pure virtual function set detector global offset

See also:
mythenDetector::setGlobalOffset

Implemented in mythenDetector.

int slsDetector::setModule ( sls_detector_module  module  ) 

configure chip

Parameters:
module module to be set - must contain correct module number and also channel and chip registers
Returns:
current register value
See also:
sls_detector_module

int slsDetector::setModule ( int  reg,
int  imod = -1 
)

configure module

Parameters:
imod module number (-1 all)
Returns:
current register value
See also:
sls_detector_module

int slsDetector::setNumberOfModules ( int  n,
dimension  d = X 
)

set/get the size of the detector

Parameters:
n number of modules
d dimension
Returns:
current number of modules in direction d

int slsDetector::setOnline ( int const   online  ) 

sets the onlineFlag

Parameters:
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)

virtual int slsDetector::setPositions ( int  nPos,
float *  pos 
) [pure virtual]

pure virtual function set positions for the acquisition

Parameters:
nPos number of positions
pos array with the encoder positions
Returns:
number of positions
See also:
mythenDetector::setPositions

Implemented in mythenDetector.

int slsDetector::setRateCorrection ( float  t = 0  ) 

set rate correction

Parameters:
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
Returns:
0 if rate correction disabled, >0 otherwise

int slsDetector::setReadOutFlags ( readOutFlags  flag  ) 

set/get readout flags

Parameters:
flag readout flag to be set
Returns:
current flag

int slsDetector::setROI ( int  nroi = -1,
int *  xmin = NULL,
int *  xmax = NULL,
int *  ymin = NULL,
int *  ymax = NULL 
)

set roi

not yet implemented

detectorSettings slsDetector::setSettings ( detectorSettings  isettings,
int  imod = -1 
)

set detector settings

Parameters:
isettings settings
imod module number (-1 all)
Returns:
current settings
in this function trimbits and calibration files are searched in the trimDir and calDir directories and the detector is initialized

int slsDetector::setSpeed ( speedVariable  sp,
int  value = -1 
)

sets/gets the value of important readout speed parameters

Parameters:
sp is the parameter to be set/get
value is the value to be set, if -1 get value
Returns:
current value for the specified parameter
See also:
speedVariable

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

Parameters:
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
Returns:
OK is connection succeded, FAIL otherwise
See also:
sharedSlsDetector

int slsDetector::setThresholdEnergy ( int  e_eV,
int  imod = -1,
detectorSettings  isettings = GET_SETTINGS 
)

set threshold energy

Parameters:
e_eV threshold in eV
imod module number (-1 all)
isettings ev. change settings
Returns:
current threshold value for imod in ev (-1 failed)

int64_t slsDetector::setTimer ( timerIndex  index,
int64_t  t = -1 
)

set/get timer value

Parameters:
index timer index
t time in ns or number of...(e.g. frames, gates, probes)
Returns:
timer set value in ns or number of...(e.g. frames, gates, probes)

char* slsDetector::setTrimDir ( string  s  )  [inline]

sets the detector trimbit directory

See also:
sharedSlsDetector

int slsDetector::startAcquisition (  ) 

start detector acquisition

Returns:
OK/FAIL

int * slsDetector::startAndReadAll (  ) 

start detector acquisition and read all data putting them a data queue

Returns:
pointer to the fron tof the data queue
See also:
startAndReadAllNoWait getDataFromDetector dataQueue

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)

Returns:
OK/FAIL

void slsDetector::startThread (  )  [protected]

start data processing threas

int slsDetector::stopAcquisition (  ) 

stop detector acquisition

Returns:
OK/FAIL

virtual int slsDetector::writeAngularConversion ( string  fname = ""  )  [pure virtual]

Pure virtual function writes an angular conversion file

Parameters:
fname file to be written
See also:
angleConversionConstant mythenDetector::writeAngularConversion

Implemented in mythenDetector.

virtual int slsDetector::writeCalibrationFile ( string  fname,
float  gain,
float  offset 
) [pure virtual]

Pure virtual function writes a calibration file

Parameters:
fname file to be written
gain 
offset 
See also:
sharedSlsDetector mythenDetector::writeCalibrationFile

Implemented in mythenDetector, and eigerDetector.

virtual int slsDetector::writeConfigurationFile ( string const   fname  )  [pure virtual]

Purely virtual function Should be implemented in the specific detector class /sa mythenDetector::writeConfigurationFile

Implemented in mythenDetector.

virtual int slsDetector::writeDataFile ( string  fname,
int *  data 
) [pure virtual]

Pure virtual function writes a data file

Parameters:
name of the file to be written
data array of data values
Returns:
OK or FAIL if it could not write the file or data=NULL
See also:
mythenDetector::writeDataFile

Implemented in mythenDetector, and eigerDetector.

virtual int slsDetector::writeDataFile ( string  fname,
float *  data,
float *  err = NULL,
float *  ang = NULL,
char  dataformat = 'f',
int  nch = -1 
) [pure virtual]

Pure virtual function writes a data file

Parameters:
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
Returns:
OK or FAIL if it could not write the file or data=NULL
See also:
mythenDetector::writeDataFile

Implemented in mythenDetector, and eigerDetector.

int slsDetector::writeRegister ( int  addr,
int  val 
)

write register

Parameters:
addr address value
Returns:
current register value

virtual int slsDetector::writeTrimFile ( string  fname,
int  imod 
) [pure virtual]

Pure virtual function writes a trim file for module number imod - the values will be read from the current detector structure

Parameters:
fname name of the file to be written
imod module number
Returns:
OK or FAIL if the file could not be written
See also:
sls_detector_module sharedSlsDetector mythenDetector::writeTrimFile(string, int)

Implemented in mythenDetector, and eigerDetector.

virtual int slsDetector::writeTrimFile ( string  fname,
sls_detector_module  mod 
) [pure virtual]

Pure virtual function writes a trim file

Parameters:
fname name of the file to be written
mod module structure which has to be written to file
Returns:
OK or FAIL if the file could not be written
See also:
sls_detector_module mythenDetector::writeTrimFile(string, sls_detector_module)

Implemented in mythenDetector, and eigerDetector.


Member Data Documentation

float* slsDetector::adcs [protected]

pointer to adc valuse

int* slsDetector::badChannelMask [protected]

pointer to bad channel mask 0 is channel is good 1 if it is bad

See also:
fillBadChannelMask()

int* slsDetector::chanregs [protected]

pointer to channal registers

int* slsDetector::chipregs [protected]

pointer to chip registers

MySocketTCP* slsDetector::controlSocket [protected]

socket for control commands

float slsDetector::currentI0 [protected]

I0 measured

float slsDetector::currentPosition [protected]

current position of the detector

float slsDetector::currentPositionIndex [protected]

current position index of the detector

float* slsDetector::dacs [protected]

pointer to dac valuse

queue<int*> slsDetector::dataQueue [protected]

data queue

MySocketTCP* slsDetector::dataSocket [protected]

socket for data acquisition

sls_detector_module* slsDetector::detectorModules [protected]

pointer to detector module structures

int slsDetector::detId [protected]

detector ID

float* slsDetector::ffcoefficients [protected]

pointer to flat field coefficients

float* slsDetector::fferrors [protected]

pointer to flat field coefficient errors

queue<detectorData*> slsDetector::finalDataQueue [protected]

queue containing the postprocessed data

float* slsDetector::mergingBins [protected]

merging bins

float* slsDetector::mergingCounts [protected]

merging counts

float* slsDetector::mergingErrors [protected]

merging errors

int* slsDetector::mergingMultiplicity [protected]

merging multiplicity

int slsDetector::onlineFlag [protected]

See also:
setOnline

int slsDetector::shmId [protected]

shared memeory ID

MySocketTCP* slsDetector::stopSocket [protected]

socket for emergency stop

sharedSlsDetector* slsDetector::thisDetector [protected]

address of the detector structure in shared memory


The documentation for this class was generated from the following files:
Generated on Tue Dec 1 15:31:44 2009 by  doxygen 1.4.7