My Project
 All Classes Files Functions Variables Macros
slsDetectorUsers.h
Go to the documentation of this file.
1 #ifndef SLS_DETECTOR_USERS_H
2 #define SLS_DETECTOR_USERS_H
3 
4 
5 
16 class detectorData;
17 class multiSlsDetector;
18 class multiSlsDetectorCommand;
19 
20 #include "sls_detector_defs.h"
21 
22 
23 #include <stdint.h>
24 #include <string>
25 
26 
27 
28 
29 
30 /*
31  \mainpage
32 <CENTER><H1>API for SLS detectors data acquisition</H1></CENTER>
33 <HR>
34 */
86  {
87 
88  public:
89 
95  slsDetectorUsers(int& ret, int id=0);
96 
98  virtual ~slsDetectorUsers();
99 
104  std::string getDetectorDeveloper();
105 
110  int setOnline(int const online=-1);
111 
116  int setReceiverOnline(int const online=-1);
117 
118 
123  void startMeasurement();
124 
129  int stopMeasurement();
130 
135  int getDetectorStatus();
136 
140  std::string getFilePath();
141 
147  std::string setFilePath(std::string s);
148 
153  std::string getFileName();
154 
161  std::string setFileName(std::string s);
162 
167  int getFileIndex();
168 
174  int setFileIndex(int i);
175 
180  std::string getFlatFieldCorrectionDir();
181 
187  std::string setFlatFieldCorrectionDir(std::string dir);
188 
193  std::string getFlatFieldCorrectionFile();
194 
200  int setFlatFieldCorrectionFile(std::string fname="");
201 
202 
203 
209  int enableFlatFieldCorrection(int i=-1);
210 
216  int enableCountRateCorrection(int i=-1);
217 
223  int enablePixelMaskCorrection(int i=-1);
224 
230  int enableAngularConversion(int i=-1);
231 
234  int enableWriteToFile(int i=-1);
235 
242  int setPositions(int nPos, double *pos);
243 
249  int getPositions(double *pos=NULL);
250 
259  int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
260 
269  int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
276  int getMaximumDetectorSize(int &nx, int &ny);
277 
278 
284  int setBitDepth(int i=-1);
285 
286 
287 
293  int setSettings(int isettings=-1);
294 
299  int getThresholdEnergy();
300 
301 
307  int setThresholdEnergy(int e_eV);
308 
317  int setThresholdEnergy(int e_ev, int tb, int isettings = -1, int id = -1);
318 
319 
328  double setExposureTime(double t=-1, bool inseconds=false, int imod = -1);
329 
337  double setExposurePeriod(double t=-1, bool inseconds=false, int imod = -1);
338 
346  double setDelayAfterTrigger(double t=-1, bool inseconds=false, int imod = -1);
347 
354  int64_t setNumberOfGates(int64_t t=-1, int imod = -1);
355 
362  int64_t setNumberOfFrames(int64_t t=-1, int imod = -1);
363 
370  int64_t setNumberOfCycles(int64_t t=-1, int imod = -1);
371 
377  int setTimingMode(int pol=-1);
378 
384  int readConfigurationFile(std::string const fname);
385 
386 
393  int dumpDetectorSetup(std::string const fname);
400  int retrieveDetectorSetup(std::string const fname);
401 
406  std::string getDetectorType();
407 
413  int setReceiverMode(int n=-1);
414 
421  void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
422 
429  void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
430 
436  virtual void initDataset(int refresh);
437 
438 
449  virtual void addFrame(double *data, double pos, double i0, double t, std::string fname, double var);
450 
459  virtual void finalizeDataset(double *a, double *v, double *e, int &np);
460 
461 
466  int enableDataStreamingFromReceiver(int i=-1);
467 
473  int enableDataStreamingToClient(int i=-1);
474 
481  int setReceiverDataStreamingOutPort(int i=-1);
482 
489  int setClientDataStreamingInPort(int i=-1);
490 
497  std::string setReceiverDataStreamingOutIP(std::string ip="");
498 
505  std::string setClientDataStreamingInIP(std::string ip="");
506 
512  int64_t getModuleFirmwareVersion(int imod=-1);
513 
519  int64_t getModuleSerialNumber(int imod=-1);
520 
526  int64_t getDetectorFirmwareVersion(int imod=-1);
527 
533  int64_t getDetectorSerialNumber(int imod=-1);
534 
540  int64_t getDetectorSoftwareVersion(int imod=-1);
541 
546  int64_t getThisSoftwareVersion();
547 
554  int enableGapPixels(int enable=-1);
555 
562  std::string setReceiverFramesDiscardPolicy(std::string f="get");
563 
569  int setReceiverPartialFramesPadding(int f = -1);
570 
576  int setReceiverFramesPerFile(int f = -1);
577 
582  int sendSoftwareTrigger();
583 
590  double getMeasuredPeriod(bool inseconds=false, int imod = -1);
591 
598  double getMeasuredSubFramePeriod(bool inseconds=false, int imod = -1);
599 
605  void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
606 
613  void registerGetPositionCallback( double (*func)(void*),void *arg);
619  void registerConnectChannelsCallback( int (*func)(void*),void *arg);
625  void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
631  void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
637  void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
643  void registerGetI0Callback( double (*func)(int,void*),void *arg);
644 
652  std::string putCommand(int narg, char *args[], int pos=-1);
653 
661  std::string getCommand(int narg, char *args[], int pos=-1);
662 
663  /************************************************************************
664 
665  ADVANCED FUNCTIONS
666 
667  *********************************************************************/
673  int setClockDivider(int value);
674 
680  int setParallelMode(int value);
681 
687  int setOverflowMode(int value);
688 
695  int setAllTrimbits(int val, int id = -1);
696 
704  int setDAC(std::string dac, int val, int id = -1);
705 
712  int getADC(std::string adc, int id = -1);
713 
718  int startReceiver();
719 
724  int stopReceiver();
725 
732  int startAcquisition();
733 
738  int stopAcquisition();
739 
745  int setReceiverSilentMode(int i);
746 
752  int setHighVoltage(int i);
753 
760 
766  int setReceiverFifoDepth(int i = -1);
767 
773  int setFlowControl10G(int i = -1);
774 
780  int setTenGigabitEthernet(int i = -1);
781 
786  int getNMods();
787 
795  double setSubFrameExposureTime(double t=-1, bool inseconds=false, int imod = -1);
796 
805  double setSubFrameExposureDeadTime(double t=-1, bool inseconds=false, int imod = -1);
806 
813  int64_t setNumberOfStorageCells(int64_t t=-1, int imod = -1);
814 
820  int setStoragecellStart(int pos=-1);
821 
830  int setROI(int n=-1, slsDetectorDefs::ROI roiLimits[]=NULL, int imod = -1);
831 
839  slsDetectorDefs::ROI* getROI(int &n, int imod = -1);
840 
841  /************************************************************************
842 
843  STATIC FUNCTIONS
844 
845  *********************************************************************/
846 
851  static std::string runStatusType(int s){ \
852  switch (s) { \
853  case 0: return std::string("idle"); \
854  case 1: return std::string("error"); \
855  case 2: return std::string("waiting"); \
856  case 3: return std::string("finished"); \
857  case 4: return std::string("data"); \
858  case 5: return std::string("running"); \
859  case 6: return std::string("stoppped"); \
860  default: return std::string("unknown"); \
861  }};
862 
863 
864 
870  static int getDetectorSettings(std::string s){ \
871  if (s=="standard") return 0; \
872  if (s=="fast") return 1; \
873  if (s=="highgain") return 2; \
874  if (s=="dynamicgain") return 3; \
875  if (s=="lowgain") return 4; \
876  if (s=="mediumgain") return 5; \
877  if (s=="veryhighgain") return 6; \
878  return -1; };
879 
884  static std::string getDetectorSettings(int s){\
885  switch(s) { \
886  case 0: return std::string("standard");\
887  case 1: return std::string("fast");\
888  case 2: return std::string("highgain");\
889  case 3: return std::string("dynamicgain"); \
890  case 4: return std::string("lowgain"); \
891  case 5: return std::string("mediumgain"); \
892  case 6: return std::string("veryhighgain"); \
893  default: return std::string("undefined"); \
894  }};
895 
896 
897 
904  static std::string getTimingMode(int f){ \
905  switch(f) { \
906  case 0: return std::string( "auto"); \
907  case 1: return std::string("trigger"); \
908  case 2: return std::string("ro_trigger"); \
909  case 3: return std::string("gating"); \
910  case 4: return std::string("triggered_gating"); \
911  case 5: return std::string("burst_trigger"); \
912  default: return std::string( "unknown"); \
913  } };
914 
921  static int getTimingMode(std::string s){ \
922  if (s== "auto") return 0; \
923  if (s== "trigger") return 1; \
924  if (s== "ro_trigger") return 2; \
925  if (s== "gating") return 3; \
926  if (s== "triggered_gating") return 4; \
927  return -1; };
928 
929 
930  private:
931  multiSlsDetector *myDetector;
932  multiSlsDetectorCommand *myCmd;
933  };
934 
935 #endif
int stopMeasurement()
stop measurement
double setSubFrameExposureDeadTime(double t=-1, bool inseconds=false, int imod=-1)
std::string setFilePath(std::string s)
sets the default output files path
int enableWriteToFile(int i=-1)
int64_t getModuleFirmwareVersion(int imod=-1)
int64_t getDetectorSoftwareVersion(int imod=-1)
int enableGapPixels(int enable=-1)
int setStoragecellStart(int pos=-1)
int64_t getDetectorFirmwareVersion(int imod=-1)
slsDetectorDefs::ROI * getROI(int &n, int imod=-1)
int setBitDepth(int i=-1)
set/get dynamic range
void registerDataCallback(int(*userCallback)(detectorData *d, int f, int s, void *), void *pArg)
register calbback for accessing detector final data, also enables data streaming in client and receiv...
int sendSoftwareTrigger()
void startMeasurement()
start measurement and acquires
int setAllTrimbits(int val, int id=-1)
sets all trimbits to value (only available for eiger)
static std::string getTimingMode(int f)
returns external communication mode std::string from index
int setOverflowMode(int value)
show saturated for overflow in subframes in 32 bit mode (eiger only)
void registerGoToPositionNoWaitCallback(int(*func)(double, void *), void *arg)
register callback for moving the detector without waiting
int setReceiverOnline(int const online=-1)
sets the receivers onlineFlag
int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1)
sets the detector size (only 1 ROI)
double setExposurePeriod(double t=-1, bool inseconds=false, int imod=-1)
set/get exposure period
virtual void initDataset(int refresh)
function to initalize a set of measurements (reset binning if angular conversion, reset summing other...
int64_t getThisSoftwareVersion()
int setTimingMode(int pol=-1)
set/get the external communication mode
double setExposureTime(double t=-1, bool inseconds=false, int imod=-1)
set/get exposure time value
int retrieveDetectorSetup(std::string const fname)
Loads the detector setup from file.
int setReceiverPartialFramesPadding(int f=-1)
int stopReceiver()
stop receiver listening mode
std::string getCommand(int narg, char *args[], int pos=-1)
gets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowT...
int setReceiverMode(int n=-1)
sets the mode by which gui requests data from receiver
int setOnline(int const online=-1)
sets the onlineFlag
int64_t setNumberOfCycles(int64_t t=-1, int imod=-1)
set/get number of cycles i.e. number of triggers
double setSubFrameExposureTime(double t=-1, bool inseconds=false, int imod=-1)
std::string setFlatFieldCorrectionDir(std::string dir)
set flat field corrections file directory
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 - ca...
std::string getDetectorType()
useful for data plotting etc.
int setDAC(std::string dac, int val, int id=-1)
set dac value
std::string getFlatFieldCorrectionFile()
get flat field corrections file name
void registerConnectChannelsCallback(int(*func)(void *), void *arg)
register callback for connecting to the epics channels
static int getDetectorSettings(std::string s)
returns detector settings std::string from index
void registerGetI0Callback(double(*func)(int, void *), void *arg)
register calbback reading to I0
std::string getFlatFieldCorrectionDir()
get flat field corrections file directory
double getMeasuredSubFramePeriod(bool inseconds=false, int imod=-1)
int setHighVoltage(int i)
The slsDetectorUsers class is a minimal interface class which should be instantiated by the users in ...
virtual ~slsDetectorUsers()
virtual destructor
int setTenGigabitEthernet(int i=-1)
int getThresholdEnergy()
get threshold energy
int setClientDataStreamingInPort(int i=-1)
void registerDisconnectChannelsCallback(int(*func)(void *), void *arg)
register callback to disconnect the epics channels
int setReceiverSilentMode(int i)
std::string getFileName()
int setThresholdEnergy(int e_eV)
set threshold energy
int dumpDetectorSetup(std::string const fname)
Reads the parameters from the detector and writes them to file.
int setReceiverFramesPerFile(int f=-1)
int setReceiverDataStreamingOutPort(int i=-1)
int enableDataStreamingToClient(int i=-1)
int getPositions(double *pos=NULL)
get positions for the acquisition
int setClockDivider(int value)
sets clock divider of detector
int64_t setNumberOfStorageCells(int64_t t=-1, int imod=-1)
int enableCountRateCorrection(int i=-1)
enable/disable count rate corrections
int64_t setNumberOfGates(int64_t t=-1, int imod=-1)
set/get number of gates
int setFlatFieldCorrectionFile(std::string fname="")
set flat field correction file
int getDetectorStatus()
get run status
int setParallelMode(int value)
sets parallel mode
int startReceiver()
start receiver listening mode
virtual void addFrame(double *data, double pos, double i0, double t, std::string fname, double var)
adds frame to merging/summation - can be overcome by the user&#39;s functions thanks to the virtual prope...
int setFileIndex(int i)
sets the default output file index
int enableDataStreamingFromReceiver(int i=-1)
std::string setFileName(std::string s)
sets the default output files path
void registerRawDataCallback(int(*userCallback)(double *p, int n, void *), void *pArg)
register callback for accessing raw data - if the rawDataCallback is registered, no filewriting/postp...
int getDetectorSize(int &x0, int &y0, int &nx, int &ny)
gets detector size (roi size if only one roi)
int resetFramesCaughtInReceiver()
std::string setReceiverDataStreamingOutIP(std::string ip="")
int64_t setNumberOfFrames(int64_t t=-1, int imod=-1)
set/get number of frames i.e. number of exposure per trigger
int setPositions(int nPos, double *pos)
set positions for the acquisition
slsDetectorUsers(int &ret, int id=0)
default constructor
int64_t getModuleSerialNumber(int imod=-1)
std::string setClientDataStreamingInIP(std::string ip="")
std::string setReceiverFramesDiscardPolicy(std::string f="get")
int enablePixelMaskCorrection(int i=-1)
enable/disable bad channel corrections
static std::string getDetectorSettings(int s)
returns detector settings std::string from index
std::string getDetectorDeveloper()
useful to define subset of working functions
double getMeasuredPeriod(bool inseconds=false, int imod=-1)
std::string getFilePath()
returns the default output files path
void registerGoToPositionCallback(int(*func)(double, void *), void *arg)
register callback for moving the detector
int readConfigurationFile(std::string const fname)
Reads the configuration file – will contain all the informations needed for the configuration (e...
static std::string runStatusType(int s)
returns std::string from run status index
int getADC(std::string adc, int id=-1)
get adc value
static int getTimingMode(std::string s)
returns external communication mode std::string from index
int setSettings(int isettings=-1)
set detector settings
double setDelayAfterTrigger(double t=-1, bool inseconds=false, int imod=-1)
set/get delay after trigger
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
int setReceiverFifoDepth(int i=-1)
int64_t getDetectorSerialNumber(int imod=-1)
std::string putCommand(int narg, char *args[], int pos=-1)
sets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowT...
int setFlowControl10G(int i=-1)
int setROI(int n=-1, slsDetectorDefs::ROI roiLimits[]=NULL, int imod=-1)
int enableAngularConversion(int i=-1)
enable/disable angular conversion
int enableFlatFieldCorrection(int i=-1)
enable/disable flat field corrections (without changing file name)
int getMaximumDetectorSize(int &nx, int &ny)
gets the maximum detector size