mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-03 21:18:40 +01:00
changes in the software structure debugged
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@131 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@@ -5,24 +5,8 @@
|
||||
#define SLS_DETECTOR_H
|
||||
|
||||
#include "MySocketTCP.h"
|
||||
/* #include <iostream> */
|
||||
/* #include <fstream> */
|
||||
/* #include <iomanip> */
|
||||
/* #include <cstring> */
|
||||
/* #include <string> */
|
||||
/* #include <sstream> */
|
||||
/* #include <queue> */
|
||||
/* extern "C" { */
|
||||
/* #include <pthread.h> */
|
||||
/* } */
|
||||
/* #include <fcntl.h> */
|
||||
/* #include <unistd.h> */
|
||||
/* #include <sys/stat.h> */
|
||||
/* #include <sys/types.h> */
|
||||
/* #include <sys/uio.h> */
|
||||
|
||||
//#include "sls_detector_defs.h"
|
||||
#include "slsDetectorUtils.h"
|
||||
//#include "slsDetectorCommand.h"
|
||||
|
||||
|
||||
|
||||
@@ -285,17 +269,15 @@ typedef struct sharedSlsDetector {
|
||||
|
||||
|
||||
using slsDetectorUtils::getDetectorType;
|
||||
|
||||
using slsDetectorUtils::flatFieldCorrect;
|
||||
using slsDetectorUtils::rateCorrect;
|
||||
using slsDetectorUtils::setBadChannelCorrection;
|
||||
|
||||
using slsDetectorUtils::readAngularConversion;
|
||||
using slsDetectorUtils::writeAngularConversion;
|
||||
using slsDetectorUtils::resetMerging;
|
||||
using slsDetectorUtils::finalizeMerging;
|
||||
using slsDetectorUtils::addToMerging;
|
||||
using slsDetectorUtils::readDataFile;
|
||||
using slsDetectorUtils::writeDataFile;
|
||||
using slsDetectorUtils::createFileName;
|
||||
|
||||
|
||||
|
||||
/** (default) constructor
|
||||
\param 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
|
||||
@@ -318,11 +300,8 @@ typedef struct sharedSlsDetector {
|
||||
//slsDetector(string const fname);
|
||||
// ~slsDetector(){while(dataQueue.size()>0){}};
|
||||
/** destructor */
|
||||
~slsDetector();//{ disconnect_channels();};
|
||||
//virtual ~slsDetector();//{ disconnect_channels();};
|
||||
~slsDetector();
|
||||
|
||||
/** sets the onlineFlag
|
||||
\param off can be: <BR> GET_ONLINE_FLAG, returns wether the detector is in online or offline state;<BR> OFFLINE_FLAG, detector in offline state (i.e. no communication to the detector - using only local structure - no data acquisition possible!);<BR> ONLINE_FLAG detector in online state (i.e. communication to the detector updating the local structure) */
|
||||
int setOnline(int const online=GET_ONLINE_FLAG);
|
||||
|
||||
/** returns if the detector already existed
|
||||
@@ -340,38 +319,51 @@ typedef struct sharedSlsDetector {
|
||||
int configureMAC();
|
||||
|
||||
/**
|
||||
Purely virtual function
|
||||
Should be implemented in the specific detector class
|
||||
/sa mythenDetector::readConfigurationFile
|
||||
Reads the configuration file fname
|
||||
\param fname file name
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(string const fname);
|
||||
// virtual int readConfigurationFile(string const fname);
|
||||
int readConfigurationFile(string const fname);
|
||||
|
||||
|
||||
int readConfigurationFile(ifstream &infile);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Purely virtual function
|
||||
Should be implemented in the specific detector class
|
||||
/sa mythenDetector::writeConfigurationFile
|
||||
|
||||
Writes the configuration file fname
|
||||
\param fname file name
|
||||
\returns OK or FAIL
|
||||
|
||||
*/
|
||||
int writeConfigurationFile(string const fname);
|
||||
//virtual int writeConfigurationFile(string const fname);
|
||||
/*
|
||||
It should be possible to dump all the settings of the detector (including trimbits, threshold energy, gating/triggering, acquisition time etc.
|
||||
in a file and retrieve it for repeating the measurement with identicals ettings, if necessary
|
||||
*/
|
||||
int writeConfigurationFile(ofstream &outfile);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Purely virtual function
|
||||
Should be implemented in the specific detector class
|
||||
/sa mythenDetector::dumpDetectorSetup
|
||||
Saves the detector setup to file
|
||||
\param fname file to write to
|
||||
\param level if 2 reads also trimbits, flat field, angular correction etc. and writes them to files with automatically added extension
|
||||
\returns OK or FAIL
|
||||
|
||||
*/
|
||||
int dumpDetectorSetup(string const fname, int level=0);
|
||||
//virtual int dumpDetectorSetup(string const fname, int level=0);
|
||||
/**
|
||||
Purely virtual function
|
||||
Should be implemented in the specific detector class
|
||||
/sa mythenDetector::retrieveDetectorSetup
|
||||
Loads the detector setup from file
|
||||
\param fname file to read from
|
||||
\param level if 2 reads also reads trimbits, angular conversion coefficients etc. from files with default extensions as generated by dumpDetectorSetup
|
||||
\returns OK or FAIL
|
||||
|
||||
*/
|
||||
int retrieveDetectorSetup(string const fname, int level=0);
|
||||
//virtual int retrieveDetectorSetup(string const fname, int level=0);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
configure the socket communication and initializes the socket instances
|
||||
|
||||
@@ -430,9 +422,21 @@ typedef struct sharedSlsDetector {
|
||||
/** disconnect from the stop port */
|
||||
int disconnectStop();
|
||||
|
||||
/**
|
||||
sets the network parameters
|
||||
\param i network parameter type can be CLIENT_IP, CLIENT_MAC, SERVER_MAC
|
||||
\param s value to be set
|
||||
\returns parameter
|
||||
|
||||
*/
|
||||
char* setNetworkParameter(networkParameter index, string value);
|
||||
|
||||
/**
|
||||
gets the network parameters
|
||||
\param i network parameter type can be CLIENT_IP, CLIENT_MAC, SERVER_MAC
|
||||
\returns parameter
|
||||
|
||||
*/
|
||||
char* getNetworkParameter(networkParameter index);
|
||||
|
||||
/* I/O */
|
||||
@@ -467,6 +471,8 @@ typedef struct sharedSlsDetector {
|
||||
\sa sharedSlsDetector
|
||||
*/
|
||||
int getTrimEn(int *en=NULL) {if (en) {for (int ien=0; ien<thisDetector->nTrimEn; ien++) en[ien]=thisDetector->trimEnergies[ien];} return (thisDetector->nTrimEn);};
|
||||
|
||||
|
||||
/** sets the number of trim energies and their value \sa sharedSlsDetector
|
||||
\param nen number of energies
|
||||
\param en array of energies
|
||||
@@ -528,11 +534,21 @@ typedef struct sharedSlsDetector {
|
||||
};
|
||||
|
||||
|
||||
/** loads the modules settings/trimbits reading from a file - file name extension is automatically generated! */
|
||||
int loadSettingsFile(string fname, int nmod=0);
|
||||
|
||||
/** loads the modules settings/trimbits reading from a file
|
||||
\param fname file name . If not specified, extension is automatically generated!
|
||||
\param imod module number, -1 means all modules
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int loadSettingsFile(string fname, int imod=-1);
|
||||
|
||||
/** gets the modules settings/trimbits and writes them to file - file name extension is automatically generated! */
|
||||
int saveSettingsFile(string fname, int nmod=0);
|
||||
|
||||
/** saves the modules settings/trimbits writing to a file
|
||||
\param fname file name . Axtension is automatically generated!
|
||||
\param imod module number, -1 means all modules
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int saveSettingsFile(string fname, int imod=-1);
|
||||
|
||||
|
||||
/**
|
||||
@@ -1139,7 +1155,6 @@ typedef struct sharedSlsDetector {
|
||||
|
||||
|
||||
/**
|
||||
pure virtual function
|
||||
set angular conversion
|
||||
\param fname file with angular conversion constants ("" disable)
|
||||
\returns 0 if angular conversion disabled, >0 otherwise
|
||||
@@ -1238,12 +1253,7 @@ typedef struct sharedSlsDetector {
|
||||
*/
|
||||
int exitServer();
|
||||
|
||||
/** 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
|
||||
\sa mythenDetector::processData
|
||||
*/
|
||||
// void* processData(int delflag=1); // thread function
|
||||
|
||||
/** Allocates the memory for a sls_detector_module structure and initializes it
|
||||
\returns myMod the pointer to the allocate dmemory location
|
||||
|
||||
@@ -1257,19 +1267,6 @@ typedef struct sharedSlsDetector {
|
||||
void deleteModule(sls_detector_module *myMod);
|
||||
|
||||
|
||||
/** pure virtual function
|
||||
performs the complete acquisition and data processing
|
||||
moves the detector to next position <br>
|
||||
starts and reads the detector <br>
|
||||
reads the IC (if required) <br>
|
||||
reads the encoder (iof required for angualr conversion) <br>
|
||||
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
|
||||
\sa mythenDetector::acquire()
|
||||
*/
|
||||
|
||||
//void acquire(int delflag=1);
|
||||
|
||||
/** calcualtes the total number of steps of the acquisition.
|
||||
called when number of frames, number of cycles, number of positions and scan steps change
|
||||
*/
|
||||
@@ -1306,10 +1303,6 @@ typedef struct sharedSlsDetector {
|
||||
*/
|
||||
|
||||
int getDetectorId(int i=-1) {return detId;};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Receives a data frame from the detector socket
|
||||
\returns pointer to the data (or NULL if failed)
|
||||
@@ -1317,16 +1310,24 @@ typedef struct sharedSlsDetector {
|
||||
*/
|
||||
int* getDataFromDetector();
|
||||
|
||||
/**
|
||||
Loads dark image or gain image to the detector
|
||||
\param index is 0 for dark image and 1 for gain image
|
||||
\fname file name to load data from
|
||||
|
||||
/** returns if the detector is Master, slave or nothing
|
||||
\param flag can be GET_MASTER, NO_MASTER, IS_MASTER, IS_SLAVE
|
||||
\returns master flag of the detector
|
||||
*/
|
||||
int loadImageToDetector(int index,string const fname);
|
||||
masterFlags setMaster(masterFlags flag){};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Sets/gets the synchronization mode of the various detectors
|
||||
\param sync syncronization mode
|
||||
\returns current syncronization mode
|
||||
*/
|
||||
synchronizationMode setSynchronization(synchronizationMode sync=GET_SYNCHRONIZATION_MODE){};
|
||||
|
||||
int loadImageToDetector(imageType index,string const fname);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -1335,10 +1336,6 @@ typedef struct sharedSlsDetector {
|
||||
*/
|
||||
sharedSlsDetector *thisDetector;
|
||||
|
||||
// /**
|
||||
// \sa setOnline
|
||||
// */
|
||||
//int onlineFlag;
|
||||
|
||||
/**
|
||||
detector ID
|
||||
@@ -1432,10 +1429,6 @@ typedef struct sharedSlsDetector {
|
||||
|
||||
|
||||
|
||||
/* /\** mutex to synchronize threads *\/ */
|
||||
/* pthread_mutex_t mp; */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user