slsDetectorUsers is composed of multiSlsDetector instead of being its base class

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@268 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi 2012-10-02 07:23:24 +00:00
parent 2e5dc6515f
commit fe73d4cb92
5 changed files with 87 additions and 66 deletions

View File

@ -9,11 +9,11 @@ INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsD
CC=g++ CC=g++
SRC_CLNT= slsDetectorAnalysis/fileIO.cpp MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/angularConversionStatic.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp SRC_CLNT= slsDetectorAnalysis/fileIO.cpp MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/angularConversionStatic.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsDetector/slsDetectorUsers.cpp
OBJS = $(SRC_CLNT:.cpp=.o) OBJS = $(SRC_CLNT:.cpp=.o)
HEADERS = $(SRC_CLNT:.cpp=.h) commonFiles/sls_detector_defs.h slsDetectorAnalysis/detectorData.h slsDetector/slsDetectorBase.h slsDetector/slsDetectorUsers.h multiSlsDetector/multiSlsDetectorCommand.h slsDetectorAnalysis/enCalLogClass.h slsDetectorAnalysis/angCalLogClass.h slsDetectorAnalysis/angleConversionConstant.h usersFunctions/angleFunction.h HEADERS = $(SRC_CLNT:.cpp=.h) commonFiles/sls_detector_defs.h slsDetectorAnalysis/detectorData.h slsDetector/slsDetectorBase.h multiSlsDetector/multiSlsDetectorCommand.h slsDetectorAnalysis/enCalLogClass.h slsDetectorAnalysis/angCalLogClass.h slsDetectorAnalysis/angleConversionConstant.h usersFunctions/angleFunction.h

View File

@ -47,7 +47,6 @@ Most methods of interest for the user are implemented in the ::slsDetectorBase i
*/ */
#include "slsDetectorUsers.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include <string> #include <string>
@ -64,7 +63,7 @@ using namespace std;
*/ */
//public virtual slsDetectorUsers, //public virtual slsDetectorUsers,
class slsDetectorBase : public slsDetectorUsers , public virtual slsDetectorDefs { class slsDetectorBase : public virtual slsDetectorDefs {
public: public:
@ -282,7 +281,7 @@ class slsDetectorBase : public slsDetectorUsers , public virtual slsDetectorDef
\returns current dynamic range \returns current dynamic range
*/ */
virtual int setDynamicRange(int i=-1)=0; virtual int setDynamicRange(int i=-1)=0;
int setBitDepth(int i=-1){return setDynamicRange(i);}; // int setBitDepth(int i=-1){return setDynamicRange(i);};
/** /**
set/get the size of the detector set/get the size of the detector
@ -292,12 +291,12 @@ class slsDetectorBase : public slsDetectorUsers , public virtual slsDetectorDef
*/ */
virtual int setNumberOfModules(int i=-1, dimension d=X)=0; virtual int setNumberOfModules(int i=-1, dimension d=X)=0;
int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1){return setNumberOfModules(nx/getChansPerMod(0),X);}; // int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1){return setNumberOfModules(nx/getChansPerMod(0),X);};
int getDetectorSize(int &x0, int &y0, int &nx, int &ny){x0=0; nx=setNumberOfModules(-1,X)*getChansPerMod(0); return nx;}; // int getDetectorSize(int &x0, int &y0, int &nx, int &ny){x0=0; nx=setNumberOfModules(-1,X)*getChansPerMod(0); return nx;};
virtual int getMaxNumberOfModules(dimension d=X)=0; // virtual int getMaxNumberOfModules(dimension d=X)=0; //
int getMaximumDetectorSize(int &nx, int &ny){nx=getMaxNumberOfModules(X)*getChansPerMod(0); ny=1; return nx;}; // int getMaximumDetectorSize(int &nx, int &ny){nx=getMaxNumberOfModules(X)*getChansPerMod(0); ny=1; return nx;};
/** Locks/Unlocks the connection to the server /** Locks/Unlocks the connection to the server
@ -376,6 +375,7 @@ int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);};
*/ */
virtual detectorSettings setSettings(detectorSettings isettings, int imod=-1)=0; virtual detectorSettings setSettings(detectorSettings isettings, int imod=-1)=0;
int setSettings(int isettings){return (int)setSettings((detectorSettings)isettings,-1);}; int setSettings(int isettings){return (int)setSettings((detectorSettings)isettings,-1);};
virtual detectorSettings getSettings(int imod=-1)=0; virtual detectorSettings getSettings(int imod=-1)=0;
/** /**
get threshold energy get threshold energy
@ -400,8 +400,8 @@ int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);};
int setThresholdEnergy(int e_eV){return setThresholdEnergy(e_eV,-1);}; int setThresholdEnergy(int e_eV){return setThresholdEnergy(e_eV,-1);};
int getBeamEnergy(){return 2*getThresholdEnergy();}; // int getBeamEnergy(){return 2*getThresholdEnergy();};
int setBeamEnergy(int e){return 2*setThresholdEnergy(e/2);}; //int setBeamEnergy(int e){return 2*setThresholdEnergy(e/2);};

View File

@ -12,7 +12,11 @@
*/ */
#include "detectorData.h"
class detectorData;
class multiSlsDetector;
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
@ -37,11 +41,11 @@ class slsDetectorUsers
public: public:
/** @short default constructor */ /** @short default constructor */
slsDetectorUsers(){}; slsDetectorUsers(int id=0);
/** @short virtual destructor */ /** @short virtual destructor */
virtual ~slsDetectorUsers(){}; ~slsDetectorUsers();
@ -49,7 +53,7 @@ class slsDetectorUsers
@short useful to define subset of working functions @short useful to define subset of working functions
\returns "PSI" or "Dectris" \returns "PSI" or "Dectris"
*/ */
virtual string getDetectorDeveloper()=0; string getDetectorDeveloper();
@ -57,43 +61,43 @@ class slsDetectorUsers
\param online can be: -1 returns wether the detector is in online (1) or offline (0) state; 0 detector in offline state; 1 detector in online state \param online can be: -1 returns wether the detector is in online (1) or offline (0) state; 0 detector in offline state; 1 detector in online state
\returns 0 (offline) or 1 (online) \returns 0 (offline) or 1 (online)
*/ */
virtual int setOnline(int const online=-1)=0; int setOnline(int const online=-1);
/** /**
@short start measurement and acquires @short start measurement and acquires
\returns OK/FAIL \returns OK/FAIL
*/ */
virtual int startMeasurement()=0; void startMeasurement();
/** /**
@short stop measurement @short stop measurement
\returns OK/FAIL \returns OK/FAIL
*/ */
virtual int stopMeasurement()=0; int stopMeasurement();
/** /**
@short get run status @short get run status
\returns status mask \returns status mask
*/ */
virtual int getDetectorStatus()=0; int getDetectorStatus();
/** /**
@short returns the default output files path @short returns the default output files path
*/ */
virtual string getFilePath()=0; string getFilePath();
/** /**
@short sets the default output files path @short sets the default output files path
\param s file path \param s file path
\returns file path \returns file path
*/ */
virtual string setFilePath(string s)=0; string setFilePath(string s);
/** /**
@short @short
\returns the default output files root name \returns the default output files root name
*/ */
virtual string getFileName()=0; string getFileName();
/** /**
@short sets the default output files path @short sets the default output files path
@ -101,46 +105,46 @@ class slsDetectorUsers
\returns the default output files root name \returns the default output files root name
*/ */
virtual string setFileName(string s)=0; string setFileName(string s);
/** /**
@short @short
\returns the default output file index \returns the default output file index
*/ */
virtual int getFileIndex()=0; int getFileIndex();
/** /**
@short sets the default output file index @short sets the default output file index
\param i file index \param i file index
\returns the default output file index \returns the default output file index
*/ */
virtual int setFileIndex(int i)=0; int setFileIndex(int i);
/** /**
@short get flat field corrections file directory @short get flat field corrections file directory
\returns flat field correction file directory \returns flat field correction file directory
*/ */
virtual string getFlatFieldCorrectionDir()=0; string getFlatFieldCorrectionDir();
/** /**
@short set flat field corrections file directory @short set flat field corrections file directory
\param dir flat field correction file directory \param dir flat field correction file directory
\returns flat field correction file directory \returns flat field correction file directory
*/ */
virtual string setFlatFieldCorrectionDir(string dir)=0; string setFlatFieldCorrectionDir(string dir);
/** /**
@short get flat field corrections file name @short get flat field corrections file name
\returns flat field correction file name \returns flat field correction file name
*/ */
virtual string getFlatFieldCorrectionFile()=0; string getFlatFieldCorrectionFile();
/** /**
@short set flat field correction file @short set flat field correction file
\param fname name of the flat field file (or "" if disable) \param fname name of the flat field file (or "" if disable)
\returns 0 if disable (or file could not be read), >0 otherwise \returns 0 if disable (or file could not be read), >0 otherwise
*/ */
virtual int setFlatFieldCorrectionFile(string fname="")=0; int setFlatFieldCorrectionFile(string fname="");
@ -149,32 +153,32 @@ class slsDetectorUsers
\param i 0 disables, 1 enables, -1 gets \param i 0 disables, 1 enables, -1 gets
\returns 0 if ff corrections disabled, 1 if enabled \returns 0 if ff corrections disabled, 1 if enabled
*/ */
virtual int enableFlatFieldCorrection(int i=-1)=0; int enableFlatFieldCorrection(int i=-1);
/** /**
@short enable/disable count rate corrections @short enable/disable count rate corrections
\param i 0 disables, 1 enable, -1 gets \param i 0 disables, 1 enable, -1 gets
\returns 0 if count corrections disabled, 1 if enabled \returns 0 if count corrections disabled, 1 if enabled
*/ */
virtual int enableCountRateCorrection(int i=-1)=0; int enableCountRateCorrection(int i=-1);
/** /**
@short enable/disable bad channel corrections @short enable/disable bad channel corrections
\param i 0 disables, 1 enables, -1 gets \param i 0 disables, 1 enables, -1 gets
\returns 0 if bad channels corrections disabled, 1 if enabled \returns 0 if bad channels corrections disabled, 1 if enabled
*/ */
virtual int enablePixelMaskCorrection(int i=-1)=0; int enablePixelMaskCorrection(int i=-1);
/** /**
@short enable/disable angular conversion @short enable/disable angular conversion
\param i 0 disables, 1 enables, -1 gets \param i 0 disables, 1 enables, -1 gets
\returns 0 if angular conversion disabled, 1 if enabled \returns 0 if angular conversion disabled, 1 if enabled
*/ */
virtual int enableAngularConversion(int i=-1)=0; int enableAngularConversion(int i=-1);
/**Enable write file function included*/ /**Enable write file function included*/
virtual int enableWriteToFile(int i=-1)=0; int enableWriteToFile(int i=-1);
/** /**
@short set positions for the acquisition @short set positions for the acquisition
@ -182,14 +186,14 @@ class slsDetectorUsers
\param pos array with the encoder positions \param pos array with the encoder positions
\returns number of positions \returns number of positions
*/ */
virtual int setPositions(int nPos, double *pos)=0; int setPositions(int nPos, double *pos);
/** /**
@short get positions for the acquisition @short get positions for the acquisition
\param pos array which will contain the encoder positions \param pos array which will contain the encoder positions
\returns number of positions \returns number of positions
*/ */
virtual int getPositions(double *pos=NULL)=0; int getPositions(double *pos=NULL);
/** /**
@short sets the detector size @short sets the detector size
@ -199,7 +203,7 @@ class slsDetectorUsers
\param ny number of channels in vertical (-1 unchanged) \param ny number of channels in vertical (-1 unchanged)
\returns OK/FAIL \returns OK/FAIL
*/ */
virtual int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1)=0; int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
/** /**
@ -210,7 +214,7 @@ class slsDetectorUsers
\param ny number of channels in vertical \param ny number of channels in vertical
\returns OK/FAIL \returns OK/FAIL
*/ */
virtual int getDetectorSize(int &x0, int &y0, int &nx, int &ny)=0; int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
/** /**
@short setsthe maximum detector size @short setsthe maximum detector size
\param x0 horizontal position origin in channel number \param x0 horizontal position origin in channel number
@ -219,7 +223,7 @@ class slsDetectorUsers
\param ny number of channels in vertical \param ny number of channels in vertical
\returns OK/FAIL \returns OK/FAIL
*/ */
virtual int getMaximumDetectorSize(int &nx, int &ny)=0; int getMaximumDetectorSize(int &nx, int &ny);
/** /**
@ -227,7 +231,7 @@ class slsDetectorUsers
\param i dynamic range (-1 get) \param i dynamic range (-1 get)
\returns current dynamic range \returns current dynamic range
*/ */
virtual int setBitDepth(int i=-1)=0; int setBitDepth(int i=-1);
@ -236,13 +240,13 @@ class slsDetectorUsers
\param isettings settings index (-1 gets) \param isettings settings index (-1 gets)
\returns current settings \returns current settings
*/ */
virtual int setSettings(int isettings=-1)=0; int setSettings(int isettings=-1);
/** /**
@short get threshold energy @short get threshold energy
\returns current threshold value for imod in ev (-1 failed) \returns current threshold value for imod in ev (-1 failed)
*/ */
virtual int getThresholdEnergy()=0; int getThresholdEnergy();
/** /**
@ -250,13 +254,13 @@ class slsDetectorUsers
\param e_eV threshold in eV \param e_eV threshold in eV
\returns current threshold value for imod in ev (-1 failed) \returns current threshold value for imod in ev (-1 failed)
*/ */
virtual int setThresholdEnergy(int e_eV)=0; int setThresholdEnergy(int e_eV);
/** /**
@short get beam energy -- only for dectris! @short get beam energy -- only for dectris!
\returns current beam energy \returns current beam energy
*/ */
virtual int getBeamEnergy()=0; int getBeamEnergy();
/** /**
@ -264,7 +268,7 @@ class slsDetectorUsers
\param e_eV beam in eV \param e_eV beam in eV
\returns current beam energyin ev (-1 failed) \returns current beam energyin ev (-1 failed)
*/ */
virtual int setBeamEnergy(int e_eV)=0; int setBeamEnergy(int e_eV);
/** /**
@short set/get exposure time value @short set/get exposure time value
@ -272,42 +276,42 @@ class slsDetectorUsers
\returns timer set value in ns \returns timer set value in ns
*/ */
virtual int64_t setExposureTime(int64_t t=-1)=0; int64_t setExposureTime(int64_t t=-1);
/** /**
@short set/get exposure period @short set/get exposure period
\param t time in ns (-1 gets) \param t time in ns (-1 gets)
\returns timer set value in ns \returns timer set value in ns
*/ */
virtual int64_t setExposurePeriod(int64_t t=-1)=0; int64_t setExposurePeriod(int64_t t=-1);
/** /**
@short set/get delay after trigger @short set/get delay after trigger
\param t time in ns (-1 gets) \param t time in ns (-1 gets)
\returns timer set value in ns \returns timer set value in ns
*/ */
virtual int64_t setDelayAfterTrigger(int64_t t=-1)=0; int64_t setDelayAfterTrigger(int64_t t=-1);
/** /**
@short set/get number of gates @short set/get number of gates
\param t number of gates (-1 gets) \param t number of gates (-1 gets)
\returns number of gates \returns number of gates
*/ */
virtual int64_t setNumberOfGates(int64_t t=-1)=0; int64_t setNumberOfGates(int64_t t=-1);
/** /**
@short set/get number of frames i.e. number of exposure per trigger @short set/get number of frames i.e. number of exposure per trigger
\param t number of frames (-1 gets) \param t number of frames (-1 gets)
\returns number of frames \returns number of frames
*/ */
virtual int64_t setNumberOfFrames(int64_t t=-1)=0; int64_t setNumberOfFrames(int64_t t=-1);
/** /**
@short set/get number of cycles i.e. number of triggers @short set/get number of cycles i.e. number of triggers
\param t number of frames (-1 gets) \param t number of frames (-1 gets)
\returns number of frames \returns number of frames
*/ */
virtual int64_t setNumberOfCycles(int64_t t=-1)=0; int64_t setNumberOfCycles(int64_t t=-1);
/** /**
@ -315,14 +319,14 @@ class slsDetectorUsers
\param pol value to be set \sa getTimingMode \param pol value to be set \sa getTimingMode
\returns current external communication mode \returns current external communication mode
*/ */
virtual int setTimingMode(int pol=-1)=0; int setTimingMode(int pol=-1);
/** /**
@short Reads the configuration file -- will contain all the informations needed for the configuration (e.g. for a PSI detector caldir, settingsdir, angconv, badchannels, hostname etc.) @short Reads the configuration file -- will contain all the informations needed for the configuration (e.g. for a PSI detector caldir, settingsdir, angconv, badchannels, hostname etc.)
\param fname file name \param fname file name
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int readConfigurationFile(string const fname)=0; int readConfigurationFile(string const fname);
/** /**
@ -331,66 +335,73 @@ class slsDetectorUsers
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int dumpDetectorSetup(string const fname)=0; int dumpDetectorSetup(string const fname);
/** /**
@short Loads the detector setup from file @short Loads the detector setup from file
\param fname file to read from \param fname file to read from
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int retrieveDetectorSetup(string const fname)=0; int retrieveDetectorSetup(string const fname);
/** /**
@short useful for data plotting etc. @short useful for data plotting etc.
\returns Mythen, Eiger, Gotthard etc. \returns Mythen, Eiger, Gotthard etc.
*/ */
virtual string getDetectorType()=0; string getDetectorType();
/** /**
@short register calbback for accessing detector final data @short register calbback for accessing detector final data
\param userCallback function for plotting/analyzing the data \param userCallback function for plotting/analyzing the data
*/ */
virtual void registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg)=0; void registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg);
/**
@short register calbback for accessing raw data
\param userCallback function for postprocessing and saving the data
*/
void registerRawDataCallback(int( *userCallback)(float*, void*), void *pArg);
/** /**
@short register calbback for accessing detector final data @short register calbback for accessing detector final data
\param func function to be called at the end of the acquisition. gets detector status and progress index as arguments \param func function to be called at the end of the acquisition. gets detector status and progress index as arguments
*/ */
virtual void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg)=0; void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
/** /**
@short register calbback for reading detector position @short register calbback for reading detector position
\param func function for reading the detector position \param func function for reading the detector position
*/ */
virtual void registerGetPositionCallback( double (*func)(void*),void *arg)=0; void registerGetPositionCallback( double (*func)(void*),void *arg);
/** /**
@short register callback for connecting to the epics channels @short register callback for connecting to the epics channels
\param func function for connecting to the epics channels \param func function for connecting to the epics channels
*/ */
virtual void registerConnectChannelsCallback( int (*func)(void*),void *arg)=0; void registerConnectChannelsCallback( int (*func)(void*),void *arg);
/** /**
@short register callback to disconnect the epics channels @short register callback to disconnect the epics channels
\param func function to disconnect the epics channels \param func function to disconnect the epics channels
*/ */
virtual void registerDisconnectChannelsCallback( int (*func)(void*),void *arg)=0; void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
/** /**
@short register callback for moving the detector @short register callback for moving the detector
\param func function for moving the detector \param func function for moving the detector
*/ */
virtual void registerGoToPositionCallback( int (*func)(double,void*),void *arg)=0; void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
/** /**
@short register callback for moving the detector without waiting @short register callback for moving the detector without waiting
\param func function for moving the detector \param func function for moving the detector
*/ */
virtual void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg)=0; void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
/** /**
@short register calbback reading to I0 @short register calbback reading to I0
\param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0) \param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0)
*/ */
virtual void registerGetI0Callback( double (*func)(int,void*),void *arg)=0; void registerGetI0Callback( double (*func)(int,void*),void *arg);
/************************************************************************ /************************************************************************
@ -478,6 +489,8 @@ class slsDetectorUsers
if (s== "triggered_gating") return 4; \ if (s== "triggered_gating") return 4; \
return -1; }; return -1; };
private:
multiSlsDetector *myDetector;
}; };

View File

@ -14,6 +14,8 @@ postProcessing::postProcessing(){
pCallbackArg = 0; pCallbackArg = 0;
registerDataCallback(&defaultDataReadyFunc, NULL); registerDataCallback(&defaultDataReadyFunc, NULL);
//cout << "done "<< endl; //cout << "done "<< endl;
rawDataReady = 0;
pRawDataArg = 0;
} }

View File

@ -242,6 +242,9 @@ s
void registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg) {dataReady = userCallback; pCallbackArg = pArg;}; void registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg) {dataReady = userCallback; pCallbackArg = pArg;};
void registerRawDataCallback(int( *userCallback)(float*, void*), void *pArg) {rawDataReady = userCallback; pRawDataArg = pArg;};
@ -324,6 +327,9 @@ s
int (*dataReady)(detectorData*,void*); int (*dataReady)(detectorData*,void*);
void *pCallbackArg; void *pCallbackArg;
int (*rawDataReady)(float*,void*);
void *pRawDataArg;
}; };