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 
21 #include <stdint.h>
22 #include <string>
23 
24 
25 
26 
27 
28 /*
29  \mainpage
30 <CENTER><H1>API for SLS detectors data acquisition</H1></CENTER>
31 <HR>
32 */
84  {
85 
86  public:
87 
93  slsDetectorUsers(int& ret, int id=0);
94 
96  virtual ~slsDetectorUsers();
97 
102  std::string getDetectorDeveloper();
103 
108  int setOnline(int const online=-1);
109 
114  int setReceiverOnline(int const online=-1);
115 
116 
121  void startMeasurement();
122 
127  int stopMeasurement();
128 
133  int getDetectorStatus();
134 
138  std::string getFilePath();
139 
145  std::string setFilePath(std::string s);
146 
151  std::string getFileName();
152 
159  std::string setFileName(std::string s);
160 
165  int getFileIndex();
166 
172  int setFileIndex(int i);
173 
178  std::string getFlatFieldCorrectionDir();
179 
185  std::string setFlatFieldCorrectionDir(std::string dir);
186 
191  std::string getFlatFieldCorrectionFile();
192 
198  int setFlatFieldCorrectionFile(std::string fname="");
199 
200 
201 
207  int enableFlatFieldCorrection(int i=-1);
208 
214  int enableCountRateCorrection(int i=-1);
215 
221  int enablePixelMaskCorrection(int i=-1);
222 
228  int enableAngularConversion(int i=-1);
229 
232  int enableWriteToFile(int i=-1);
233 
240  int setPositions(int nPos, double *pos);
241 
247  int getPositions(double *pos=NULL);
248 
257  int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
258 
259 
268  int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
275  int getMaximumDetectorSize(int &nx, int &ny);
276 
277 
283  int setBitDepth(int i=-1);
284 
285 
286 
292  int setSettings(int isettings=-1);
293 
298  int getThresholdEnergy();
299 
300 
306  int setThresholdEnergy(int e_eV);
307 
316  int setThresholdEnergy(int e_ev, int tb, int isettings = -1, int id = -1);
317 
318 
327  double setExposureTime(double t=-1, bool inseconds=false, int imod = -1);
328 
336  double setExposurePeriod(double t=-1, bool inseconds=false, int imod = -1);
337 
345  double setDelayAfterTrigger(double t=-1, bool inseconds=false, int imod = -1);
346 
353  int64_t setNumberOfGates(int64_t t=-1, int imod = -1);
354 
361  int64_t setNumberOfFrames(int64_t t=-1, int imod = -1);
362 
369  int64_t setNumberOfCycles(int64_t t=-1, int imod = -1);
370 
376  int setTimingMode(int pol=-1);
377 
383  int readConfigurationFile(std::string const fname);
384 
385 
392  int dumpDetectorSetup(std::string const fname);
399  int retrieveDetectorSetup(std::string const fname);
400 
405  std::string getDetectorType();
406 
412  int setReceiverMode(int n=-1);
413 
420  void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
421 
428  void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
429 
435  virtual void initDataset(int refresh);
436 
437 
448  virtual void addFrame(double *data, double pos, double i0, double t, std::string fname, double var);
449 
458  virtual void finalizeDataset(double *a, double *v, double *e, int &np);
459 
460 
465  int enableDataStreamingFromReceiver(int i=-1);
466 
472  int enableDataStreamingToClient(int i=-1);
473 
480  int setReceiverDataStreamingOutPort(int i=-1);
481 
488  int setClientDataStreamingInPort(int i=-1);
489 
496  std::string setReceiverDataStreamingOutIP(std::string ip="");
497 
504  std::string setClientDataStreamingInIP(std::string ip="");
505 
510  int64_t getModuleFirmwareVersion();
511 
517  int64_t getModuleSerialNumber(int imod=-1);
518 
523  int64_t getDetectorFirmwareVersion();
524 
529  int64_t getDetectorSerialNumber();
530 
535  int64_t getDetectorSoftwareVersion();
536 
541  int64_t getThisSoftwareVersion();
542 
549  int enableGapPixels(int enable=-1);
550 
557  std::string setReceiverFramesDiscardPolicy(std::string f="get");
558 
564  int setReceiverPartialFramesPadding(int f = -1);
565 
571  int setReceiverFramesPerFile(int f = -1);
572 
577  int sendSoftwareTrigger();
578 
585  double getMeasuredPeriod(bool inseconds=false, int imod = -1);
586 
593  double getMeasuredSubFramePeriod(bool inseconds=false, int imod = -1);
594 
600  void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
601 
608  void registerGetPositionCallback( double (*func)(void*),void *arg);
614  void registerConnectChannelsCallback( int (*func)(void*),void *arg);
620  void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
626  void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
632  void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
638  void registerGetI0Callback( double (*func)(int,void*),void *arg);
639 
647  std::string putCommand(int narg, char *args[], int pos=-1);
648 
656  std::string getCommand(int narg, char *args[], int pos=-1);
657 
658  /************************************************************************
659 
660  ADVANCED FUNCTIONS
661 
662  *********************************************************************/
668  int setClockDivider(int value);
669 
675  int setParallelMode(int value);
676 
682  int setOverflowMode(int value);
683 
690  int setAllTrimbits(int val, int id = -1);
691 
699  int setDAC(std::string dac, int val, int id = -1);
700 
707  int getADC(std::string adc, int id = -1);
708 
713  int startReceiver();
714 
719  int stopReceiver();
720 
727  int startAcquisition();
728 
733  int stopAcquisition();
734 
740  int setReceiverSilentMode(int i);
741 
747  int setHighVoltage(int i);
748 
755 
761  int setReceiverFifoDepth(int i = -1);
762 
768  int setFlowControl10G(int i = -1);
769 
775  int setTenGigabitEthernet(int i = -1);
776 
781  int getNMods();
782 
790  double setSubFrameExposureTime(double t=-1, bool inseconds=false, int imod = -1);
791 
800  double setSubFrameExposureDeadTime(double t=-1, bool inseconds=false, int imod = -1);
801 
808  int64_t setNumberOfStorageCells(int64_t t=-1, int imod = -1);
809 
815  int setStoragecellStart(int pos=-1);
816 
817  /************************************************************************
818 
819  STATIC FUNCTIONS
820 
821  *********************************************************************/
822 
827  static std::string runStatusType(int s){ \
828  switch (s) { \
829  case 0: return std::string("idle"); \
830  case 1: return std::string("error"); \
831  case 2: return std::string("waiting"); \
832  case 3: return std::string("finished"); \
833  case 4: return std::string("data"); \
834  case 5: return std::string("running"); \
835  default: return std::string("unknown"); \
836  }};
837 
838 
839 
845  static int getDetectorSettings(std::string s){ \
846  if (s=="standard") return 0; \
847  if (s=="fast") return 1; \
848  if (s=="highgain") return 2; \
849  if (s=="dynamicgain") return 3; \
850  if (s=="lowgain") return 4; \
851  if (s=="mediumgain") return 5; \
852  if (s=="veryhighgain") return 6; \
853  return -1; };
854 
859  static std::string getDetectorSettings(int s){\
860  switch(s) { \
861  case 0: return std::string("standard");\
862  case 1: return std::string("fast");\
863  case 2: return std::string("highgain");\
864  case 3: return std::string("dynamicgain"); \
865  case 4: return std::string("lowgain"); \
866  case 5: return std::string("mediumgain"); \
867  case 6: return std::string("veryhighgain"); \
868  default: return std::string("undefined"); \
869  }};
870 
871 
872 
879  static std::string getTimingMode(int f){ \
880  switch(f) { \
881  case 0: return std::string( "auto"); \
882  case 1: return std::string("trigger"); \
883  case 2: return std::string("ro_trigger"); \
884  case 3: return std::string("gating"); \
885  case 4: return std::string("triggered_gating"); \
886  case 5: return std::string("burst_trigger"); \
887  default: return std::string( "unknown"); \
888  } };
889 
896  static int getTimingMode(std::string s){ \
897  if (s== "auto") return 0; \
898  if (s== "trigger") return 1; \
899  if (s== "ro_trigger") return 2; \
900  if (s== "gating") return 3; \
901  if (s== "triggered_gating") return 4; \
902  return -1; };
903 
904 
905  private:
906  multiSlsDetector *myDetector;
907  multiSlsDetectorCommand *myCmd;
908  };
909 
910 #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)
int enableGapPixels(int enable=-1)
int setStoragecellStart(int pos=-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
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
int64_t getDetectorSerialNumber()
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
int64_t getModuleFirmwareVersion()
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
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...
int64_t getDetectorFirmwareVersion()
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)
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)
int64_t getDetectorSoftwareVersion()
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