- Main Page
- Classes
- Files

- File List
- File Members

# slsDetectorUsers.h

Go to the documentation of this file.

    00001 #ifndef SLS_DETECTOR_USERS_H
    00002 #define SLS_DETECTOR_USERS_H
    00003
    00004
    00005
    00016 class detectorData;
    00017 class multiSlsDetector;
    00018 class multiSlsDetectorCommand;
    00019
    00020
    00021 #include <stdint.h>
    00022 #include <string>
    00023
    00024
    00025 using namespace std;
    00026
    00027
    00028
    00029 /*
    00030    \mainpage
    00031 <CENTER><H1>API for SLS detectors data acquisition</H1></CENTER>
    00032 <HR>
    00033 */
    00085 class slsDetectorUsers
    00086  {
    00087
    00088  public:
    00089
    00091    slsDetectorUsers(int id=0);
    00092
    00093
    00095    virtual ~slsDetectorUsers();
    00096
    00097
    00098
    00103    string getDetectorDeveloper();
    00104
    00105
    00106
    00111   int setOnline(int const online=-1);
    00112
    00117   void startMeasurement();
    00118
    00123    int stopMeasurement();
    00124
    00129    int getDetectorStatus();
    00130
    00134    string getFilePath();
    00135
    00141    string setFilePath(string s);
    00142
    00147    string getFileName();
    00148
    00155    string setFileName(string s);
    00156
    00161    int getFileIndex();
    00162
    00168    int setFileIndex(int i);
    00169
    00174    string getFlatFieldCorrectionDir();
    00175
    00181    string setFlatFieldCorrectionDir(string dir);
    00182
    00187    string getFlatFieldCorrectionFile();
    00188
    00194    int setFlatFieldCorrectionFile(string fname="");
    00195
    00196
    00197
    00203    int enableFlatFieldCorrection(int i=-1);
    00204
    00210    int enableCountRateCorrection(int i=-1);
    00211
    00217    int enablePixelMaskCorrection(int i=-1);
    00218
    00224    int enableAngularConversion(int i=-1);
    00225
    00228    int enableWriteToFile(int i=-1);
    00229
    00236    int setPositions(int nPos, double *pos);
    00237
    00243    int getPositions(double *pos=NULL);
    00244
    00253    int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
    00254
    00255
    00264    int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
    00273    int getMaximumDetectorSize(int &nx, int &ny);
    00274
    00275
    00281    int setBitDepth(int i=-1);
    00282
    00283
    00284
    00290    int setSettings(int isettings=-1);
    00291
    00296    int getThresholdEnergy();
    00297
    00298
    00304    int setThresholdEnergy(int e_eV);
    00305
    00306
    00314    double setExposureTime(double t=-1, bool inseconds=false);
    00315
    00322    double setExposurePeriod(double t=-1, bool inseconds=false);
    00323
    00330    double setDelayAfterTrigger(double t=-1, bool inseconds=false);
    00331
    00337    int64_t setNumberOfGates(int64_t t=-1);
    00338
    00344    int64_t setNumberOfFrames(int64_t t=-1);
    00345
    00351    int64_t setNumberOfCycles(int64_t t=-1);
    00352
    00353
    00359    int setTimingMode(int pol=-1);
    00360
    00366    int readConfigurationFile(string const fname);
    00367
    00368
    00375    int dumpDetectorSetup(string const fname);
    00382    int retrieveDetectorSetup(string const fname);
    00383
    00388    string getDetectorType();
    00389
    00395    int setReceiverMode(int n=-1);
    00396
    00402    void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
    00403
    00409    void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
    00410
    00416   virtual void initDataset(int refresh);
    00417
    00418
    00429   virtual void addFrame(double *data, double pos, double i0, double t, string fname, double var);
    00430
    00439   virtual void finalizeDataset(double *a, double *v, double *e, int &np);
    00440
    00441
    00447    int enableDataStreamingFromReceiver(int i=-1);
    00448
    00449
    00454   int64_t getModuleFirmwareVersion();
    00455
    00461   int64_t getModuleSerialNumber(int imod=-1);
    00462
    00467   int64_t getDetectorFirmwareVersion();
    00468
    00473   int64_t getDetectorSerialNumber();
    00474
    00479   int64_t getDetectorSoftwareVersion();
    00480
    00485   int64_t getThisSoftwareVersion();
    00486
    00492    void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
    00493
    00499    void registerGetPositionCallback( double (*func)(void*),void *arg);
    00504    void registerConnectChannelsCallback( int (*func)(void*),void *arg);
    00509    void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
    00514    void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
    00519    void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
    00524    void registerGetI0Callback( double (*func)(int,void*),void *arg);
    00525
    00533    string putCommand(int narg, char *args[], int pos=-1);
    00534
    00542    string getCommand(int narg, char *args[], int pos=-1);
    00543
    00544    /************************************************************************
    00545
    00546                             ADVANCED FUNCTIONS
    00547
    00548    *********************************************************************/
    00554    int setClockDivider(int value);
    00555
    00560    int getContinuousReadoutFlag();
    00561
    00566    void setContinuousReadoutFlag();
    00567
    00572    int getStoreInRamReadoutFlag();
    00573
    00578    void setStoreInRamReadoutFlag();
    00579
    00584    int getParallelReadoutFlag();
    00585
    00590    void setParallelReadoutFlag();
    00591
    00596    int getNonParallelReadoutFlag();
    00597
    00602    void setNonParallelReadoutFlag();
    00603
    00608    int getSafeReadoutFlag();
    00609
    00614    void setSafeReadoutFlag();
    00615
    00621    int setAllTrimbits(int val);
    00622
    00630    int setDAC(int id, int dacindex, int val);
    00631
    00638    int getADC(int id, int adcindex);
    00639
    00640   /************************************************************************
    00641
    00642                            STATIC FUNCTIONS
    00643
    00644   *********************************************************************/
    00645
    00650   static string runStatusType(int s){                                   \
    00651     switch (s) {                                                        \
    00652     case 0:     return string("idle");                                  \
    00653     case 1:       return string("error");                               \
    00654     case 2:      return  string("waiting");                             \
    00655     case 3:      return string("finished");                             \
    00656     case 4:      return string("data");                                 \
    00657     case 5:      return string("running");                              \
    00658     default:       return string("unknown");                            \
    00659     }};
    00660
    00661
    00662
    00668   static int getDetectorSettings(string s){             \
    00669     if (s=="standard") return 0;                        \
    00670     if (s=="fast") return 1;                            \
    00671     if (s=="highgain") return 2;                        \
    00672     if (s=="dynamicgain") return 3;                     \
    00673     if (s=="lowgain") return 4;                         \
    00674     if (s=="mediumgain") return 5;                      \
    00675     if (s=="veryhighgain") return 6;                    \
    00676     return -1;                                   };
    00677
    00682   static string getDetectorSettings(int s){\
    00683     switch(s) {                                         \
    00684     case 0:      return string("standard");\
    00685     case 1:      return string("fast");\
    00686     case 2:      return string("highgain");\
    00687     case 3:    return string("dynamicgain");    \
    00688     case 4:    return string("lowgain");                \
    00689     case 5:    return string("mediumgain");     \
    00690     case 6:    return string("veryhighgain");                   \
    00691     default:    return string("undefined");                     \
    00692     }};
    00693
    00694
    00695
    00702   static string getTimingMode(int f){   \
    00703     switch(f) {                                          \
    00704     case 0:      return string( "auto");                        \
    00705     case 1: return string("trigger");                   \
    00706     case 2: return string("ro_trigger");                                \
    00707     case 3: return string("gating");                    \
    00708     case 4: return string("triggered_gating");  \
    00709     default:    return string( "unknown");                              \
    00710     }      };
    00711
    00718   static int getTimingMode(string s){                                   \
    00719     if (s== "auto") return 0;                                           \
    00720     if (s== "trigger") return 1;                                        \
    00721     if (s== "ro_trigger") return 2;                                     \
    00722     if (s== "gating") return 3;                                         \
    00723     if (s== "triggered_gating") return 4;                               \
    00724     return -1;                                                  };
    00725
    00726
    00727  private:
    00728   multiSlsDetector *myDetector;
    00729   multiSlsDetectorCommand *myCmd;
    00730  };
    00731
    00732 #endif

All Classes Files Functions Variables Defines