mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
indenting to emacs format and including check and start receiver before doing acquire or status start
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@291 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -24,7 +24,7 @@ ID: $Id$
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
char ans[MAX_STR_LENGTH];
|
char ans[MAX_STR_LENGTH];
|
||||||
|
|
||||||
int multiSlsDetector::freeSharedMemory() {
|
int multiSlsDetector::freeSharedMemory() {
|
||||||
// Detach Memory address
|
// Detach Memory address
|
||||||
@ -62,7 +62,7 @@ int multiSlsDetector::initSharedMemory(int id=0) {
|
|||||||
sz=sizeof(sharedMultiSlsDetector);
|
sz=sizeof(sharedMultiSlsDetector);
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<<"multiSlsDetector: Size of shared memory is "<< sz << " - id " << mem_key << std::endl;
|
std::cout<<"multiSlsDetector: Size of shared memory is "<< sz << " - id " << mem_key << std::endl;
|
||||||
#endif
|
#endif
|
||||||
shm_id = shmget(mem_key,sz,IPC_CREAT | 0666); // allocate shared memory
|
shm_id = shmget(mem_key,sz,IPC_CREAT | 0666); // allocate shared memory
|
||||||
@ -680,8 +680,8 @@ int multiSlsDetector::removeSlsDetector(int pos) {
|
|||||||
single=1;
|
single=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (pos<0 )
|
// if (pos<0 )
|
||||||
// pos=thisMultiDetector->numberOfDetectors-1;
|
// pos=thisMultiDetector->numberOfDetectors-1;
|
||||||
|
|
||||||
if (pos>=thisMultiDetector->numberOfDetectors)
|
if (pos>=thisMultiDetector->numberOfDetectors)
|
||||||
return thisMultiDetector->numberOfDetectors;
|
return thisMultiDetector->numberOfDetectors;
|
||||||
@ -806,11 +806,11 @@ int multiSlsDetector::setMaster(int i) {
|
|||||||
// SLAVE_STARTS_WHEN_MASTER_STOPS /**< the slave acquires when the master finishes, to avoid deadtime */
|
// SLAVE_STARTS_WHEN_MASTER_STOPS /**< the slave acquires when the master finishes, to avoid deadtime */
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets/gets the synchronization mode of the various detectors
|
Sets/gets the synchronization mode of the various detectors
|
||||||
\param sync syncronization mode
|
\param sync syncronization mode
|
||||||
\returns current syncronization mode
|
\returns current syncronization mode
|
||||||
*/
|
*/
|
||||||
slsDetectorDefs::synchronizationMode multiSlsDetector::setSynchronization(synchronizationMode sync) {
|
slsDetectorDefs::synchronizationMode multiSlsDetector::setSynchronization(synchronizationMode sync) {
|
||||||
|
|
||||||
|
|
||||||
@ -900,7 +900,7 @@ int multiSlsDetector::exists() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Initialization functions
|
// Initialization functions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1067,7 +1067,7 @@ int multiSlsDetector::getChanRegs(double* retval,bool fromDetector){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Communication to server */
|
/* Communication to server */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1422,7 +1422,7 @@ void multiSlsDetector::resetFinalDataQueue() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
set or read the acquisition timers
|
set or read the acquisition timers
|
||||||
enum timerIndex {
|
enum timerIndex {
|
||||||
FRAME_NUMBER,
|
FRAME_NUMBER,
|
||||||
@ -1434,7 +1434,7 @@ void multiSlsDetector::resetFinalDataQueue() {
|
|||||||
CYCLES_NUMBER,
|
CYCLES_NUMBER,
|
||||||
GATE_INTEGRATED_TIME
|
GATE_INTEGRATED_TIME
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t){
|
int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t){
|
||||||
int i;
|
int i;
|
||||||
int64_t ret1=-100, ret;
|
int64_t ret1=-100, ret;
|
||||||
@ -1451,7 +1451,7 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check return values!!!
|
// check return values!!!
|
||||||
|
|
||||||
thisMultiDetector->timerValue[index]=ret1;
|
thisMultiDetector->timerValue[index]=ret1;
|
||||||
|
|
||||||
@ -1522,7 +1522,7 @@ int multiSlsDetector::setSpeed(speedVariable index, int value){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
int multiSlsDetector::setDynamicRange(int n, int pos){
|
int multiSlsDetector::setDynamicRange(int n, int pos){
|
||||||
|
|
||||||
// cout << "multi " << endl;
|
// cout << "multi " << endl;
|
||||||
@ -1588,10 +1588,10 @@ double* multiSlsDetector::decodeData(int *datain, double *fdata) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "done " << endl;
|
cout << "done " << endl;
|
||||||
#endif
|
#endif
|
||||||
// for (int j=0; j<detectors[i]->getTotalNumberOfChannels(); j++) {
|
// for (int j=0; j<detectors[i]->getTotalNumberOfChannels(); j++) {
|
||||||
// dataout[ich]=detp[j];
|
// dataout[ich]=detp[j];
|
||||||
// ich++;
|
// ich++;
|
||||||
// }
|
// }
|
||||||
//delete [] detp;
|
//delete [] detp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1600,7 +1600,7 @@ double* multiSlsDetector::decodeData(int *datain, double *fdata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Correction
|
//Correction
|
||||||
/*
|
/*
|
||||||
enum correctionFlags {
|
enum correctionFlags {
|
||||||
DISCARD_BAD_CHANNELS,
|
DISCARD_BAD_CHANNELS,
|
||||||
AVERAGE_NEIGHBOURS_FOR_BAD_CHANNELS,
|
AVERAGE_NEIGHBOURS_FOR_BAD_CHANNELS,
|
||||||
@ -1608,7 +1608,7 @@ double* multiSlsDetector::decodeData(int *datain, double *fdata) {
|
|||||||
RATE_CORRECTION,
|
RATE_CORRECTION,
|
||||||
ANGULAR_CONVERSION
|
ANGULAR_CONVERSION
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -2218,12 +2218,12 @@ int multiSlsDetector::setChannel(long long reg, int ichan, int ichip, int imod)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
sets the value of s angular conversion parameter
|
sets the value of s angular conversion parameter
|
||||||
\param c can be ANGULAR_DIRECTION, GLOBAL_OFFSET, FINE_OFFSET, BIN_SIZE
|
\param c can be ANGULAR_DIRECTION, GLOBAL_OFFSET, FINE_OFFSET, BIN_SIZE
|
||||||
\param v the value to be set
|
\param v the value to be set
|
||||||
\returns the actual value
|
\returns the actual value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
double multiSlsDetector::setAngularConversionParameter(angleConversionParameter c, double v) {
|
double multiSlsDetector::setAngularConversionParameter(angleConversionParameter c, double v) {
|
||||||
double ret=slsDetectorUtils::setAngularConversionParameter(c,v);
|
double ret=slsDetectorUtils::setAngularConversionParameter(c,v);
|
||||||
@ -2307,7 +2307,7 @@ int multiSlsDetector::exitServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** returns the detector trimbit/settings directory */
|
/** returns the detector trimbit/settings directory */
|
||||||
char* multiSlsDetector::getSettingsDir() {
|
char* multiSlsDetector::getSettingsDir() {
|
||||||
string s0="", s1="", s;
|
string s0="", s1="", s;
|
||||||
|
|
||||||
@ -2336,7 +2336,7 @@ char* multiSlsDetector::getSettingsDir() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** sets the detector trimbit/settings directory \sa sharedSlsDetector */
|
/** sets the detector trimbit/settings directory \sa sharedSlsDetector */
|
||||||
char* multiSlsDetector::setSettingsDir(string s){
|
char* multiSlsDetector::setSettingsDir(string s){
|
||||||
|
|
||||||
if (s.find('+')==string::npos) {
|
if (s.find('+')==string::npos) {
|
||||||
@ -2414,10 +2414,10 @@ int multiSlsDetector::getTrimEn(int *ene) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns the location of the calibration files
|
returns the location of the calibration files
|
||||||
\sa sharedSlsDetector
|
\sa sharedSlsDetector
|
||||||
*/
|
*/
|
||||||
char* multiSlsDetector::getCalDir() {
|
char* multiSlsDetector::getCalDir() {
|
||||||
string s0="", s1="", s;
|
string s0="", s1="", s;
|
||||||
//char ans[1000];
|
//char ans[1000];
|
||||||
@ -2443,10 +2443,10 @@ char* multiSlsDetector::getCalDir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
sets the location of the calibration files
|
sets the location of the calibration files
|
||||||
\sa sharedSlsDetector
|
\sa sharedSlsDetector
|
||||||
*/
|
*/
|
||||||
char* multiSlsDetector::setCalDir(string s){
|
char* multiSlsDetector::setCalDir(string s){
|
||||||
|
|
||||||
if (s.find('+')==string::npos) {
|
if (s.find('+')==string::npos) {
|
||||||
@ -2476,10 +2476,10 @@ char* multiSlsDetector::setCalDir(string s){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns the location of the calibration files
|
returns the location of the calibration files
|
||||||
\sa sharedSlsDetector
|
\sa sharedSlsDetector
|
||||||
*/
|
*/
|
||||||
char* multiSlsDetector::getNetworkParameter(networkParameter p) {
|
char* multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||||
string s0="", s1="",s ;
|
string s0="", s1="",s ;
|
||||||
|
|
||||||
@ -2506,10 +2506,10 @@ char* multiSlsDetector::getNetworkParameter(networkParameter p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
sets the location of the calibration files
|
sets the location of the calibration files
|
||||||
\sa sharedSlsDetector
|
\sa sharedSlsDetector
|
||||||
*/
|
*/
|
||||||
char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||||
|
|
||||||
if (s.find('+')==string::npos) {
|
if (s.find('+')==string::npos) {
|
||||||
|
@ -28,17 +28,17 @@ class slsDetector;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@libdoc The multiSlsDetector class is used to operate several slsDetectors in parallel.
|
@libdoc The multiSlsDetector class is used to operate several slsDetectors in parallel.
|
||||||
*
|
*
|
||||||
* @short This is the base class for multi detector system functionalities
|
* @short This is the base class for multi detector system functionalities
|
||||||
* @author Anna Bergamaschi
|
* @author Anna Bergamaschi
|
||||||
* @version 0.1alpha
|
* @version 0.1alpha
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class multiSlsDetector : public slsDetectorUtils {
|
class multiSlsDetector : public slsDetectorUtils {
|
||||||
|
|
||||||
//public virtual slsDetectorUtils {
|
//public virtual slsDetectorUtils {
|
||||||
|
|
||||||
|
|
||||||
typedef struct sharedMultiSlsDetector {
|
typedef struct sharedMultiSlsDetector {
|
||||||
@ -217,17 +217,17 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
using slsDetectorUtils::readAngularConversion;
|
using slsDetectorUtils::readAngularConversion;
|
||||||
using slsDetectorUtils::writeAngularConversion;
|
using slsDetectorUtils::writeAngularConversion;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@short Structure allocated in shared memory to store detector settings and be accessed in parallel by several applications (take care of possible conflicts!)
|
@short Structure allocated in shared memory to store detector settings and be accessed in parallel by several applications (take care of possible conflicts!)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** (default) constructor
|
/** (default) constructor
|
||||||
\param id is the detector index which is needed to define the shared memory id. Different physical detectors should have different IDs in order to work independently
|
\param id is the detector index which is needed to define the shared memory id. Different physical detectors should have different IDs in order to work independently
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
multiSlsDetector(int id=0);
|
multiSlsDetector(int id=0);
|
||||||
//slsDetector(string const fname);
|
//slsDetector(string const fname);
|
||||||
/** destructor */
|
/** destructor */
|
||||||
@ -347,13 +347,13 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
\param sync syncronization mode
|
\param sync syncronization mode
|
||||||
\returns current syncronization mode
|
\returns current syncronization mode
|
||||||
*/
|
*/
|
||||||
/* enum synchronizationMode { */
|
/* enum synchronizationMode { */
|
||||||
/* GET_SYNCHRONIZATION_MODE=-1, /\**< the multidetector will return its synchronization mode *\/ */
|
/* GET_SYNCHRONIZATION_MODE=-1, /\**< the multidetector will return its synchronization mode *\/ */
|
||||||
/* NONE, /\**< all detectors are independent (no cabling) *\/ */
|
/* NONE, /\**< all detectors are independent (no cabling) *\/ */
|
||||||
/* MASTER_GATES, /\**< the master gates the other detectors *\/ */
|
/* MASTER_GATES, /\**< the master gates the other detectors *\/ */
|
||||||
/* MASTER_TRIGGERS, /\**< the master triggers the other detectors *\/ */
|
/* MASTER_TRIGGERS, /\**< the master triggers the other detectors *\/ */
|
||||||
/* SLAVE_STARTS_WHEN_MASTER_STOPS /\**< the slave acquires when the master finishes, to avoid deadtime *\/ */
|
/* SLAVE_STARTS_WHEN_MASTER_STOPS /\**< the slave acquires when the master finishes, to avoid deadtime *\/ */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
synchronizationMode setSynchronization(synchronizationMode sync=GET_SYNCHRONIZATION_MODE);
|
synchronizationMode setSynchronization(synchronizationMode sync=GET_SYNCHRONIZATION_MODE);
|
||||||
|
|
||||||
@ -485,7 +485,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Acquisition functions
|
// Acquisition functions
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -602,12 +602,12 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
*/
|
*/
|
||||||
int64_t getTimeLeft(timerIndex index);
|
int64_t getTimeLeft(timerIndex index);
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
/* get current timer value */
|
/* get current timer value */
|
||||||
/* \param index timer index */
|
/* \param index timer index */
|
||||||
/* \returns elapsed time value in ns or number of...(e.g. frames, gates, probes) */
|
/* \returns elapsed time value in ns or number of...(e.g. frames, gates, probes) */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* int64_t getTimeLeft(timerIndex index); */
|
/* int64_t getTimeLeft(timerIndex index); */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1013,7 +1013,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//receiver
|
//receiver
|
||||||
|
|
||||||
/**
|
/**
|
||||||
calls setReceiverTCPSocket if online and sets the flag
|
calls setReceiverTCPSocket if online and sets the flag
|
||||||
|
@ -171,7 +171,7 @@ slsDetector::slsDetector(detectorType type, int id): slsDetectorUtils(),
|
|||||||
adcs(NULL),
|
adcs(NULL),
|
||||||
chipregs(NULL),
|
chipregs(NULL),
|
||||||
chanregs(NULL)
|
chanregs(NULL)
|
||||||
{
|
{
|
||||||
while (shmId<0) {
|
while (shmId<0) {
|
||||||
/**Initlializes shared memory \sa initSharedMemory
|
/**Initlializes shared memory \sa initSharedMemory
|
||||||
|
|
||||||
@ -955,14 +955,14 @@ string slsDetector::checkOnline() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
configure the socket communication and check that the server exists
|
configure the socket communication and check that the server exists
|
||||||
enum communicationProtocol{
|
enum communicationProtocol{
|
||||||
TCP,
|
TCP,
|
||||||
UDP
|
UDP
|
||||||
}{};
|
}{};
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int slsDetector::setTCPSocket(string const name, int const control_port, int const stop_port){
|
int slsDetector::setTCPSocket(string const name, int const control_port, int const stop_port){
|
||||||
|
|
||||||
@ -985,10 +985,6 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
|||||||
delete stopSocket;
|
delete stopSocket;
|
||||||
stopSocket=NULL;
|
stopSocket=NULL;
|
||||||
}
|
}
|
||||||
if (dataSocket){
|
|
||||||
delete dataSocket;
|
|
||||||
dataSocket=NULL;
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
strcpy(thisName,thisDetector->hostname);
|
strcpy(thisName,thisDetector->hostname);
|
||||||
|
|
||||||
@ -1049,25 +1045,7 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
|||||||
std::cout<< "Stop socket connected " << thisName << " " << thisSP << std::endl;
|
std::cout<< "Stop socket connected " << thisName << " " << thisSP << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!dataSocket) {
|
|
||||||
dataSocket=new MySocketTCP(thisName, thisDP);
|
|
||||||
if (dataSocket->getErrorStatus()){
|
|
||||||
#ifdef VERBOSE
|
|
||||||
std::cout<< "Could not connect Data socket "<<thisName << " " << thisDP << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
delete dataSocket;
|
|
||||||
dataSocket=NULL;
|
|
||||||
|
|
||||||
|
|
||||||
retval=FAIL;
|
|
||||||
}
|
|
||||||
#ifdef VERYVERBOSE
|
|
||||||
else
|
|
||||||
std::cout<< "Data socket connected "<< thisName << " " << thisDP << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (retval!=FAIL) {
|
if (retval!=FAIL) {
|
||||||
checkOnline();
|
checkOnline();
|
||||||
} else {
|
} else {
|
||||||
@ -1080,13 +1058,13 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** connect to the control port */
|
/** connect to the control port */
|
||||||
int slsDetector::connectControl() {
|
int slsDetector::connectControl() {
|
||||||
if (controlSocket)
|
if (controlSocket)
|
||||||
return controlSocket->Connect();
|
return controlSocket->Connect();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
/** disconnect from the control port */
|
/** disconnect from the control port */
|
||||||
int slsDetector::disconnectControl() {
|
int slsDetector::disconnectControl() {
|
||||||
if (controlSocket)
|
if (controlSocket)
|
||||||
controlSocket->Disconnect();
|
controlSocket->Disconnect();
|
||||||
@ -1095,28 +1073,28 @@ int slsDetector::disconnectControl() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** connect to the data port */
|
/** connect to the data port */
|
||||||
int slsDetector::connectData() {
|
int slsDetector::connectData() {
|
||||||
if (dataSocket)
|
if (dataSocket)
|
||||||
return dataSocket->Connect();
|
return dataSocket->Connect();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
};
|
};
|
||||||
/** disconnect from the data port */
|
/** disconnect from the data port */
|
||||||
int slsDetector::disconnectData(){
|
int slsDetector::disconnectData(){
|
||||||
if (dataSocket)
|
if (dataSocket)
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/** connect to the stop port */
|
/** connect to the stop port */
|
||||||
int slsDetector::connectStop() {
|
int slsDetector::connectStop() {
|
||||||
if (stopSocket)
|
if (stopSocket)
|
||||||
return stopSocket->Connect();
|
return stopSocket->Connect();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
};
|
};
|
||||||
/** disconnect from the stop port */
|
/** disconnect from the stop port */
|
||||||
int slsDetector::disconnectStop(){
|
int slsDetector::disconnectStop(){
|
||||||
if (stopSocket)
|
if (stopSocket)
|
||||||
stopSocket->Disconnect();
|
stopSocket->Disconnect();
|
||||||
return OK;
|
return OK;
|
||||||
@ -1139,14 +1117,14 @@ int slsDetector::disconnectControl() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Communication to server */
|
/* Communication to server */
|
||||||
|
|
||||||
// General purpose functions
|
// General purpose functions
|
||||||
|
|
||||||
/*
|
/*
|
||||||
executes a system command on the server
|
executes a system command on the server
|
||||||
e.g. mount an nfs disk, reboot and returns answer etc.
|
e.g. mount an nfs disk, reboot and returns answer etc.
|
||||||
*/
|
*/
|
||||||
int slsDetector::execCommand(string cmd, string answer){
|
int slsDetector::execCommand(string cmd, string answer){
|
||||||
|
|
||||||
char arg[MAX_STR_LENGTH], retval[MAX_STR_LENGTH];
|
char arg[MAX_STR_LENGTH], retval[MAX_STR_LENGTH];
|
||||||
@ -1183,7 +1161,7 @@ int slsDetector::execCommand(string cmd, string answer){
|
|||||||
|
|
||||||
// Detector configuration functions
|
// Detector configuration functions
|
||||||
|
|
||||||
/*
|
/*
|
||||||
the detector knows what type of detector it is
|
the detector knows what type of detector it is
|
||||||
|
|
||||||
enum detectorType{
|
enum detectorType{
|
||||||
@ -1196,7 +1174,7 @@ int slsDetector::execCommand(string cmd, string answer){
|
|||||||
AGIPD
|
AGIPD
|
||||||
};
|
};
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int slsDetector::setDetectorType(detectorType const type){
|
int slsDetector::setDetectorType(detectorType const type){
|
||||||
|
|
||||||
int arg, retval=FAIL;
|
int arg, retval=FAIL;
|
||||||
@ -1261,7 +1239,7 @@ slsDetectorDefs::detectorType slsDetector::getDetectorsType(int pos){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* needed to set/get the size of the detector */
|
/* needed to set/get the size of the detector */
|
||||||
// if n=GET_FLAG returns the number of installed modules,
|
// if n=GET_FLAG returns the number of installed modules,
|
||||||
int slsDetector::setNumberOfModules(int n, dimension d){
|
int slsDetector::setNumberOfModules(int n, dimension d){
|
||||||
|
|
||||||
@ -1414,18 +1392,18 @@ int slsDetector::getMaxNumberOfModules(dimension d){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This function is used to set the polarity and meaning of the digital I/O signals (signal index)
|
This function is used to set the polarity and meaning of the digital I/O signals (signal index)
|
||||||
|
|
||||||
enum externalSignalFlag {
|
enum externalSignalFlag {
|
||||||
GET_EXTERNAL_SIGNAL_FLAG,
|
GET_EXTERNAL_SIGNAL_FLAG,
|
||||||
SIGNAL_OFF,
|
SIGNAL_OFF,
|
||||||
GATE_ACTIVE_HIGH,
|
GATE_ACTIVE_HIGH,
|
||||||
GATE_ACTIVE_LOW,
|
GATE_ACTIVE_LOW,
|
||||||
TRIGGER_RISING_EDGE,
|
TRIGGER_RISING_EDGE,
|
||||||
TRIGGER_FALLING_EDGE
|
TRIGGER_FALLING_EDGE
|
||||||
}{};
|
}{};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags(externalSignalFlag pol, int signalindex){
|
slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags(externalSignalFlag pol, int signalindex){
|
||||||
|
|
||||||
@ -1483,7 +1461,7 @@ slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags(external
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
this function is used to select wether the detector is triggered or gated and in which mode
|
this function is used to select wether the detector is triggered or gated and in which mode
|
||||||
enum externalCommunicationMode{
|
enum externalCommunicationMode{
|
||||||
GET_EXTERNAL_COMMUNICATION_MODE,
|
GET_EXTERNAL_COMMUNICATION_MODE,
|
||||||
@ -1495,9 +1473,9 @@ slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags(external
|
|||||||
GATE_FIX_DURATION,
|
GATE_FIX_DURATION,
|
||||||
GATE_WITH_START_TRIGGER,
|
GATE_WITH_START_TRIGGER,
|
||||||
GATE_COINCIDENCE_WITH_INTERNAL_ENABLE
|
GATE_COINCIDENCE_WITH_INTERNAL_ENABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunicationMode( externalCommunicationMode pol){
|
slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunicationMode( externalCommunicationMode pol){
|
||||||
|
|
||||||
@ -1550,8 +1528,8 @@ slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunication
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Tests and identification
|
// Tests and identification
|
||||||
/*
|
/*
|
||||||
Gets versions
|
Gets versions
|
||||||
|
|
||||||
enum idMode{
|
enum idMode{
|
||||||
@ -1562,7 +1540,7 @@ slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunication
|
|||||||
DETECTOR_SOFTWARE_VERSION
|
DETECTOR_SOFTWARE_VERSION
|
||||||
}{};
|
}{};
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1628,7 +1606,7 @@ int64_t slsDetector::getId( idMode mode, int imod){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Digital test of the modules
|
Digital test of the modules
|
||||||
|
|
||||||
enum digitalTestMode {
|
enum digitalTestMode {
|
||||||
@ -1640,7 +1618,7 @@ int64_t slsDetector::getId( idMode mode, int imod){
|
|||||||
DETECTOR_SOFTWARE_TEST
|
DETECTOR_SOFTWARE_TEST
|
||||||
}{};
|
}{};
|
||||||
returns ok or error mask
|
returns ok or error mask
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int slsDetector::digitalTest( digitalTestMode mode, int imod){
|
int slsDetector::digitalTest( digitalTestMode mode, int imod){
|
||||||
|
|
||||||
@ -1689,48 +1667,48 @@ int slsDetector::digitalTest( digitalTestMode mode, int imod){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
analog test of the modules
|
analog test of the modules
|
||||||
enum analogTestMode {
|
enum analogTestMode {
|
||||||
COUNT_CALIBRATION_PULSES,
|
COUNT_CALIBRATION_PULSES,
|
||||||
I_DON_T_KNOW
|
I_DON_T_KNOW
|
||||||
}{};
|
}{};
|
||||||
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
int* slsDetector::analogTest(analogTestMode mode){
|
|
||||||
std::cout<< "function not yet implemented " << std::endl;
|
|
||||||
};
|
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
enable analog output of channel
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
int slsDetector::enableAnalogOutput(int ichan){
|
int* slsDetector::analogTest(analogTestMode mode){
|
||||||
|
std::cout<< "function not yet implemented " << std::endl;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
enable analog output of channel
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
int slsDetector::enableAnalogOutput(int ichan){
|
||||||
int imod=ichan/(nChans*nChips);
|
int imod=ichan/(nChans*nChips);
|
||||||
ichan-=imod*(nChans*nChips);
|
ichan-=imod*(nChans*nChips);
|
||||||
int ichip=ichan/nChans;
|
int ichip=ichan/nChans;
|
||||||
ichan-=ichip*(nChans);
|
ichan-=ichip*(nChans);
|
||||||
enableAnalogOutput(imod,ichip,ichan);
|
enableAnalogOutput(imod,ichip,ichan);
|
||||||
|
|
||||||
};
|
};
|
||||||
int slsDetector::enableAnalogOutput(int imod, int ichip, int ichan){
|
int slsDetector::enableAnalogOutput(int imod, int ichip, int ichan){
|
||||||
std::cout<< "function not yet implemented " << std::endl;
|
std::cout<< "function not yet implemented " << std::endl;
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
give a train of calibration pulses
|
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
int slsDetector::giveCalibrationPulse(double vcal, int npulses){
|
give a train of calibration pulses
|
||||||
std::cout<< "function not yet implemented " << std::endl;
|
|
||||||
};
|
|
||||||
*/
|
*/
|
||||||
// Expert low level functions
|
/*
|
||||||
|
int slsDetector::giveCalibrationPulse(double vcal, int npulses){
|
||||||
|
std::cout<< "function not yet implemented " << std::endl;
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
// Expert low level functions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* write or read register */
|
/* write or read register */
|
||||||
|
|
||||||
int slsDetector::writeRegister(int addr, int val){
|
int slsDetector::writeRegister(int addr, int val){
|
||||||
|
|
||||||
@ -1827,8 +1805,8 @@ int slsDetector::readRegister(int addr){
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Expert initialization functions
|
// Expert initialization functions
|
||||||
/*
|
/*
|
||||||
set dacs or read ADC for the module
|
set dacs or read ADC for the module
|
||||||
enum dacIndex {
|
enum dacIndex {
|
||||||
TRIMBIT_SIZE,
|
TRIMBIT_SIZE,
|
||||||
@ -1839,8 +1817,8 @@ int slsDetector::readRegister(int addr){
|
|||||||
PREAMP,
|
PREAMP,
|
||||||
TEMPERATURE,
|
TEMPERATURE,
|
||||||
HUMIDITY,
|
HUMIDITY,
|
||||||
}{};
|
}{};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int imod){
|
dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int imod){
|
||||||
|
|
||||||
@ -1949,7 +1927,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
configure single channel
|
configure single channel
|
||||||
enum channelRegisterBit {
|
enum channelRegisterBit {
|
||||||
COMPARATOR_ENABLE_OFF,
|
COMPARATOR_ENABLE_OFF,
|
||||||
@ -1958,7 +1936,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
|
|||||||
TRIMBIT_OFF // should always be the last!
|
TRIMBIT_OFF // should always be the last!
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int slsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod){
|
int slsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod){
|
||||||
sls_detector_channel myChan;
|
sls_detector_channel myChan;
|
||||||
@ -2136,13 +2114,13 @@ slsDetectorDefs::sls_detector_channel slsDetector::getChannel(int ichan, int ic
|
|||||||
return myChan;
|
return myChan;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
configure chip
|
configure chip
|
||||||
enum chipRegisterBit {
|
enum chipRegisterBit {
|
||||||
ENABLE_ANALOG_OUTPUT,
|
ENABLE_ANALOG_OUTPUT,
|
||||||
OUTPUT_WIDTH // should always be the last
|
OUTPUT_WIDTH // should always be the last
|
||||||
}{};
|
}{};
|
||||||
*/
|
*/
|
||||||
int slsDetector::setChip(int reg, int ichip, int imod){
|
int slsDetector::setChip(int reg, int ichip, int imod){
|
||||||
sls_detector_chip myChip;
|
sls_detector_chip myChip;
|
||||||
|
|
||||||
@ -2229,7 +2207,7 @@ int slsDetector::setChip(sls_detector_chip chip){
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
slsDetectorDefs::sls_detector_chip slsDetector::getChip(int ichip, int imod){
|
slsDetectorDefs::sls_detector_chip slsDetector::getChip(int ichip, int imod){
|
||||||
|
|
||||||
int fnum=F_GET_CHIP;
|
int fnum=F_GET_CHIP;
|
||||||
sls_detector_chip myChip;
|
sls_detector_chip myChip;
|
||||||
@ -2287,13 +2265,13 @@ int slsDetector::setChip(sls_detector_chip chip){
|
|||||||
return myChip;
|
return myChip;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
configure module
|
configure module
|
||||||
enum moduleRegisterBit {
|
enum moduleRegisterBit {
|
||||||
I_DON_T_KNOW,
|
I_DON_T_KNOW,
|
||||||
OUTPUT_WIDTH // should always be the last
|
OUTPUT_WIDTH // should always be the last
|
||||||
}{};
|
}{};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int slsDetector::setModule(int reg, int imod){
|
int slsDetector::setModule(int reg, int imod){
|
||||||
sls_detector_module myModule;
|
sls_detector_module myModule;
|
||||||
@ -2563,30 +2541,30 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// calibration functions
|
// calibration functions
|
||||||
/*
|
/*
|
||||||
really needed?
|
really needed?
|
||||||
|
|
||||||
int slsDetector::setCalibration(int imod, detectorSettings isettings, double gain, double offset){
|
int slsDetector::setCalibration(int imod, detectorSettings isettings, double gain, double offset){
|
||||||
std::cout<< "function not yet implemented " << std::endl;
|
std::cout<< "function not yet implemented " << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
int slsDetector::getCalibration(int imod, detectorSettings isettings, double &gain, double &offset){
|
int slsDetector::getCalibration(int imod, detectorSettings isettings, double &gain, double &offset){
|
||||||
|
|
||||||
std::cout<< "function not yet implemented " << std::endl;
|
std::cout<< "function not yet implemented " << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
calibrated setup of the threshold
|
calibrated setup of the threshold
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int slsDetector::getThresholdEnergy(int imod){
|
int slsDetector::getThresholdEnergy(int imod){
|
||||||
|
|
||||||
@ -2660,10 +2638,10 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
|
|||||||
return thisDetector->currentThresholdEV;
|
return thisDetector->currentThresholdEV;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
select detector settings
|
select detector settings
|
||||||
*/
|
*/
|
||||||
slsDetectorDefs::detectorSettings slsDetector::getSettings(int imod){
|
slsDetectorDefs::detectorSettings slsDetector::getSettings(int imod){
|
||||||
|
|
||||||
|
|
||||||
int fnum=F_SET_SETTINGS;
|
int fnum=F_SET_SETTINGS;
|
||||||
@ -3244,7 +3222,7 @@ int* slsDetector::startAndReadAll(){
|
|||||||
startAndReadAllNoWait();
|
startAndReadAllNoWait();
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
// std::cout<< "started" << std::endl;
|
// std::cout<< "started" << std::endl;
|
||||||
//#endif
|
//#endif
|
||||||
while ((retval=getDataFromDetector())){
|
while ((retval=getDataFromDetector())){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
i++;
|
i++;
|
||||||
@ -3262,11 +3240,11 @@ int* slsDetector::startAndReadAll(){
|
|||||||
// std::cout << std::endl;
|
// std::cout << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return dataQueue.front(); // check what we return!
|
return dataQueue.front(); // check what we return!
|
||||||
/* while ((retval=getDataFromDetectorNoWait()))
|
/* while ((retval=getDataFromDetectorNoWait()))
|
||||||
i++;
|
i++;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Received " << i << " frames"<< std::endl;
|
std::cout<< "Received " << i << " frames"<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
return dataQueue.front(); // check what we return!
|
return dataQueue.front(); // check what we return!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -3317,7 +3295,7 @@ int slsDetector::startAndReadAllNoWait(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
set or read the acquisition timers
|
set or read the acquisition timers
|
||||||
enum timerIndex {
|
enum timerIndex {
|
||||||
FRAME_NUMBER,
|
FRAME_NUMBER,
|
||||||
@ -3329,7 +3307,7 @@ int slsDetector::startAndReadAllNoWait(){
|
|||||||
CYCLES_NUMBER,
|
CYCLES_NUMBER,
|
||||||
GATE_INTEGRATED_TIME
|
GATE_INTEGRATED_TIME
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
||||||
|
|
||||||
|
|
||||||
@ -3376,10 +3354,10 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
if (t>=0)
|
if (t>=0)
|
||||||
thisDetector->timerValue[index]=t;
|
thisDetector->timerValue[index]=t;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (t>=0)
|
if (t>=0)
|
||||||
thisDetector->timerValue[index]=t;
|
thisDetector->timerValue[index]=t;
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl;
|
std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -3678,11 +3656,11 @@ double slsDetector::getCurrentProgress() {
|
|||||||
/*
|
/*
|
||||||
important speed parameters
|
important speed parameters
|
||||||
|
|
||||||
enum speedVariable {
|
enum speedVariable {
|
||||||
CLOCK_DIVIDER,
|
CLOCK_DIVIDER,
|
||||||
WAIT_STATES,
|
WAIT_STATES,
|
||||||
SET_SIGNAL_LENGTH
|
SET_SIGNAL_LENGTH
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int slsDetector::setSpeed(speedVariable sp, int value) {
|
int slsDetector::setSpeed(speedVariable sp, int value) {
|
||||||
@ -3775,7 +3753,7 @@ int64_t slsDetector::getTimeLeft(timerIndex index){
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
int slsDetector::setDynamicRange(int n){
|
int slsDetector::setDynamicRange(int n){
|
||||||
|
|
||||||
// cout << "single " << endl;
|
// cout << "single " << endl;
|
||||||
@ -3843,17 +3821,17 @@ int slsDetector::setROI(int nroi, int *xmin, int *xmax, int *ymin, int *ymax){
|
|||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
enum readOutFlags {
|
enum readOutFlags {
|
||||||
NORMAL_READOUT,
|
NORMAL_READOUT,
|
||||||
setReadOutFlags(STORE_IN_RAM,
|
setReadOutFlags(STORE_IN_RAM,
|
||||||
READ_HITS,
|
READ_HITS,
|
||||||
ZERO_COMPRESSION,
|
ZERO_COMPRESSION,
|
||||||
BACKGROUND_CORRECTION
|
BACKGROUND_CORRECTION
|
||||||
}{};
|
}{};
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int slsDetector::setReadOutFlags(readOutFlags flag){
|
int slsDetector::setReadOutFlags(readOutFlags flag){
|
||||||
|
|
||||||
@ -3896,16 +3874,16 @@ int slsDetector::setReadOutFlags(readOutFlags flag){
|
|||||||
return thisDetector->roFlags;
|
return thisDetector->roFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Trimming
|
//Trimming
|
||||||
/*
|
/*
|
||||||
enum trimMode {
|
enum trimMode {
|
||||||
NOISE_TRIMMING,
|
NOISE_TRIMMING,
|
||||||
BEAM_TRIMMING,
|
BEAM_TRIMMING,
|
||||||
IMPROVE_TRIMMING,
|
IMPROVE_TRIMMING,
|
||||||
FIXEDSETTINGS_TRIMMING,
|
FIXEDSETTINGS_TRIMMING,
|
||||||
OFFLINE_TRIMMING
|
OFFLINE_TRIMMING
|
||||||
}{};
|
}{};
|
||||||
*/
|
*/
|
||||||
int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
|
int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
|
||||||
|
|
||||||
int fnum= F_EXECUTE_TRIMMING;
|
int fnum= F_EXECUTE_TRIMMING;
|
||||||
@ -4037,7 +4015,7 @@ double* slsDetector::decodeData(int *datain, double *fdata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Correction
|
//Correction
|
||||||
/*
|
/*
|
||||||
enum correctionFlags {
|
enum correctionFlags {
|
||||||
DISCARD_BAD_CHANNELS,
|
DISCARD_BAD_CHANNELS,
|
||||||
AVERAGE_NEIGHBOURS_FOR_BAD_CHANNELS,
|
AVERAGE_NEIGHBOURS_FOR_BAD_CHANNELS,
|
||||||
@ -4045,7 +4023,7 @@ double* slsDetector::decodeData(int *datain, double *fdata) {
|
|||||||
RATE_CORRECTION,
|
RATE_CORRECTION,
|
||||||
ANGULAR_CONVERSION
|
ANGULAR_CONVERSION
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int slsDetector::setFlatFieldCorrection(string fname)
|
int slsDetector::setFlatFieldCorrection(string fname)
|
||||||
|
|
||||||
@ -4122,9 +4100,9 @@ int slsDetector::fillModuleMask(int *mM){
|
|||||||
int slsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
|
int slsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
|
||||||
if (corr!=NULL) {
|
if (corr!=NULL) {
|
||||||
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) {
|
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) {
|
||||||
// #ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
// std::cout<< ichan << " "<< corr[ichan] << std::endl;
|
// std::cout<< ichan << " "<< corr[ichan] << std::endl;
|
||||||
// #endif
|
// #endif
|
||||||
ffcoefficients[ichan]=corr[ichan];
|
ffcoefficients[ichan]=corr[ichan];
|
||||||
if (ecorr!=NULL)
|
if (ecorr!=NULL)
|
||||||
fferrors[ichan]=ecorr[ichan];
|
fferrors[ichan]=ecorr[ichan];
|
||||||
@ -4196,9 +4174,9 @@ int slsDetector::flatFieldCorrect(double* datain, double *errin, double* dataout
|
|||||||
postProcessingFuncs::flatFieldCorrect(datain[ichan],e,dataout[ichan],eo,ffcoefficients[ichan],fferrors[ichan]);
|
postProcessingFuncs::flatFieldCorrect(datain[ichan],e,dataout[ichan],eo,ffcoefficients[ichan],fferrors[ichan]);
|
||||||
if (errout)
|
if (errout)
|
||||||
errout[ichan]=eo;
|
errout[ichan]=eo;
|
||||||
// #ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
// cout << ichan << " " <<datain[ichan]<< " " << ffcoefficients[ichan]<< " " << dataout[ichan] << endl;
|
// cout << ichan << " " <<datain[ichan]<< " " << ffcoefficients[ichan]<< " " << dataout[ichan] << endl;
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -4534,9 +4512,9 @@ int slsDetector::configureMAC(){
|
|||||||
strcpy(arg[2],getServerMAC());
|
strcpy(arg[2],getServerMAC());
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
std::cout<< "slsDetector configureMAC "<< std::endl;
|
std::cout<< "slsDetector configureMAC "<< std::endl;
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
for(i=0;i<3;i++){
|
for(i=0;i<3;i++){
|
||||||
if(!strcmp(arg[i],"none"))
|
if(!strcmp(arg[i],"none"))
|
||||||
@ -4555,24 +4533,27 @@ int slsDetector::configureMAC(){
|
|||||||
pcword = strtok (NULL, ".");
|
pcword = strtok (NULL, ".");
|
||||||
}
|
}
|
||||||
strcpy(arg[0],cword);
|
strcpy(arg[0],cword);
|
||||||
std::cout<<"arg0:"<<arg[0]<<"."<<std::endl;
|
#ifdef VERBOSE
|
||||||
|
std::cout<<"receiver ip:"<<arg[0]<<"."<<std::endl;
|
||||||
|
#endif
|
||||||
//converting MACaddress to hex.
|
//converting MACaddress to hex.
|
||||||
sword.assign(arg[1]);
|
sword.assign(arg[1]);
|
||||||
strcpy(arg[1],"");
|
strcpy(arg[1],"");
|
||||||
stringstream sstr(sword);
|
stringstream sstr(sword);
|
||||||
while(getline(sstr,sword,':'))
|
while(getline(sstr,sword,':'))
|
||||||
strcat(arg[1],sword.c_str());
|
strcat(arg[1],sword.c_str());
|
||||||
std::cout<<"arg1:"<<arg[1]<<"."<<std::endl;
|
#ifdef VERBOSE
|
||||||
|
std::cout<<"receiver mac:"<<arg[1]<<"."<<std::endl;
|
||||||
|
#endif
|
||||||
//converting server MACaddress to hex.
|
//converting server MACaddress to hex.
|
||||||
sword.assign(arg[2]);
|
sword.assign(arg[2]);
|
||||||
strcpy(arg[2],"");
|
strcpy(arg[2],"");
|
||||||
stringstream ssstr(sword);
|
stringstream ssstr(sword);
|
||||||
while(getline(ssstr,sword,':'))
|
while(getline(ssstr,sword,':'))
|
||||||
strcat(arg[2],sword.c_str());
|
strcat(arg[2],sword.c_str());
|
||||||
std::cout<<"arg2:"<<arg[2]<<"."<<std::endl;
|
#ifdef VERBOSE
|
||||||
|
std::cout<<"server mac:"<<arg[2]<<"."<<std::endl;
|
||||||
|
#endif
|
||||||
//send to server
|
//send to server
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (controlSocket) {
|
||||||
@ -4632,17 +4613,17 @@ int slsDetector::getAngularConversion(int &direction, angleConversionConstant *
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::readAngularConversionFile(string fname) {
|
int slsDetector::readAngularConversionFile(string fname) {
|
||||||
|
|
||||||
return readAngularConversion(fname,thisDetector->nModsMax, thisDetector->angOff);
|
return readAngularConversion(fname,thisDetector->nModsMax, thisDetector->angOff);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetector::readAngularConversion(ifstream& ifs) {
|
int slsDetector::readAngularConversion(ifstream& ifs) {
|
||||||
|
|
||||||
return readAngularConversion(ifs,thisDetector->nModsMax, thisDetector->angOff);
|
return readAngularConversion(ifs,thisDetector->nModsMax, thisDetector->angOff);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector:: writeAngularConversion(string fname) {
|
int slsDetector:: writeAngularConversion(string fname) {
|
||||||
@ -5194,10 +5175,10 @@ int slsDetector::saveCalibrationFile(string fname, int imod) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* returns if the detector is Master, slave or nothing
|
/* returns if the detector is Master, slave or nothing
|
||||||
\param flag can be GET_MASTER, NO_MASTER, IS_MASTER, IS_SLAVE
|
\param flag can be GET_MASTER, NO_MASTER, IS_MASTER, IS_SLAVE
|
||||||
\returns master flag of the detector
|
\returns master flag of the detector
|
||||||
*/
|
*/
|
||||||
slsDetectorDefs::masterFlags slsDetector::setMaster(masterFlags flag) {
|
slsDetectorDefs::masterFlags slsDetector::setMaster(masterFlags flag) {
|
||||||
|
|
||||||
|
|
||||||
@ -5238,11 +5219,11 @@ slsDetectorDefs::masterFlags slsDetector::setMaster(masterFlags flag) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Sets/gets the synchronization mode of the various detectors
|
Sets/gets the synchronization mode of the various detectors
|
||||||
\param sync syncronization mode can be GET_SYNCHRONIZATION_MODE, NO_SYNCHRONIZATION, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
|
\param sync syncronization mode can be GET_SYNCHRONIZATION_MODE, NO_SYNCHRONIZATION, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
|
||||||
\returns current syncronization mode
|
\returns current syncronization mode
|
||||||
*/
|
*/
|
||||||
slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchronizationMode flag) {
|
slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchronizationMode flag) {
|
||||||
|
|
||||||
|
|
||||||
@ -5339,14 +5320,14 @@ string slsDetector::checkReceiverOnline() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
configure the socket communication and check that the receiver exists
|
configure the socket communication and check that the receiver exists
|
||||||
enum communicationProtocol{
|
enum communicationProtocol{
|
||||||
TCP,
|
TCP,
|
||||||
UDP
|
UDP
|
||||||
}{};
|
}{};
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int slsDetector::setReceiverTCPSocket(string const name, int const data_port){
|
int slsDetector::setReceiverTCPSocket(string const name, int const data_port){
|
||||||
|
|
||||||
@ -5777,9 +5758,9 @@ int slsDetector::updateReceiverNoWait() {
|
|||||||
char lastClientIP[INET_ADDRSTRLEN];
|
char lastClientIP[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
n = dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
n = dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
n = dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); cout<<"index:"<<ind<<endl;
|
n = dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); cout<<"index:"<<ind<<endl;
|
||||||
//thisDetector->xx=xx;update file index how?
|
//thisDetector->xx=xx;update file index how?
|
||||||
|
@ -37,21 +37,21 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/* /\** online flags enum \sa setOnline*\/ */
|
/* /\** online flags enum \sa setOnline*\/ */
|
||||||
/* enum {GET_ONLINE_FLAG=-1, /\**< returns wether the detector is in online or offline state *\/ */
|
/* enum {GET_ONLINE_FLAG=-1, /\**< returns wether the detector is in online or offline state *\/ */
|
||||||
/* OFFLINE_FLAG=0, /\**< detector in offline state (i.e. no communication to the detector - using only local structure - no data acquisition possible!) *\/ */
|
/* OFFLINE_FLAG=0, /\**< detector in offline state (i.e. no communication to the detector - using only local structure - no data acquisition possible!) *\/ */
|
||||||
/* ONLINE_FLAG =1/\**< detector in online state (i.e. communication to the detector updating the local structure) *\/ */
|
/* ONLINE_FLAG =1/\**< detector in online state (i.e. communication to the detector updating the local structure) *\/ */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short Structure allocated in shared memory to store detector settings.
|
@short Structure allocated in shared memory to store detector settings.
|
||||||
|
|
||||||
Structure allocated in shared memory to store detector settings and be accessed in parallel by several applications on the same machine (take care of possible conflicts, particularly if things are run on different machines!)
|
Structure allocated in shared memory to store detector settings and be accessed in parallel by several applications on the same machine (take care of possible conflicts, particularly if things are run on different machines!)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
typedef struct sharedSlsDetector {
|
typedef struct sharedSlsDetector {
|
||||||
/** already existing flag. If the detector does not yet exist (alreadyExisting=0) the sharedMemory will be created, otherwise it will simly be linked */
|
/** already existing flag. If the detector does not yet exist (alreadyExisting=0) the sharedMemory will be created, otherwise it will simly be linked */
|
||||||
int alreadyExisting;
|
int alreadyExisting;
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ typedef struct sharedSlsDetector {
|
|||||||
int receiverOnlineFlag;
|
int receiverOnlineFlag;
|
||||||
|
|
||||||
|
|
||||||
} sharedSlsDetector;
|
} sharedSlsDetector;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -269,17 +269,17 @@ typedef struct sharedSlsDetector {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** (default) constructor
|
/** (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
|
\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
|
||||||
\param id is the detector index which is needed to define the shared memory id. Different physical detectors should have different IDs in order to work independently
|
\param id is the detector index which is needed to define the shared memory id. Different physical detectors should have different IDs in order to work independently
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
slsDetector(detectorType type=GENERIC, int id=0);
|
slsDetector(detectorType type=GENERIC, int id=0);
|
||||||
|
|
||||||
/** constructor
|
/** constructor
|
||||||
\param id is the detector index which is needed to define the shared memory id. Different physical detectors should have different IDs in order to work independently
|
\param id is the detector index which is needed to define the shared memory id. Different physical detectors should have different IDs in order to work independently
|
||||||
*/
|
*/
|
||||||
slsDetector(int id);
|
slsDetector(int id);
|
||||||
|
|
||||||
|
|
||||||
@ -915,7 +915,7 @@ typedef struct sharedSlsDetector {
|
|||||||
|
|
||||||
int updateDetector();
|
int updateDetector();
|
||||||
|
|
||||||
// Acquisition functions
|
// Acquisition functions
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -957,12 +957,12 @@ typedef struct sharedSlsDetector {
|
|||||||
*/
|
*/
|
||||||
int startAndReadAllNoWait();
|
int startAndReadAllNoWait();
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
/* receives a data frame from the detector socket */
|
/* receives a data frame from the detector socket */
|
||||||
/* \returns pointer to the data or NULL. If NULL disconnects the socket */
|
/* \returns pointer to the data or NULL. If NULL disconnects the socket */
|
||||||
/* \sa getDataFromDetector */
|
/* \sa getDataFromDetector */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* int* getDataFromDetectorNoWait(); */
|
/* int* getDataFromDetectorNoWait(); */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
asks and receives a data frame from the detector and puts it in the data queue
|
asks and receives a data frame from the detector and puts it in the data queue
|
||||||
@ -1189,43 +1189,43 @@ typedef struct sharedSlsDetector {
|
|||||||
int rateCorrect(double* datain, double *errin, double* dataout, double *errout);
|
int rateCorrect(double* datain, double *errin, double* dataout, double *errout);
|
||||||
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
/* pure virtual function */
|
/* pure virtual function */
|
||||||
/* sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize(); */
|
/* sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize(); */
|
||||||
/* \param mp already merged postions */
|
/* \param mp already merged postions */
|
||||||
/* \param mv already merged data */
|
/* \param mv already merged data */
|
||||||
/* \param me already merged errors (squared sum) */
|
/* \param me already merged errors (squared sum) */
|
||||||
/* \param mm multiplicity of merged arrays */
|
/* \param mm multiplicity of merged arrays */
|
||||||
/* \returns OK or FAIL */
|
/* \returns OK or FAIL */
|
||||||
/* \sa mythenDetector::resetMerging */
|
/* \sa mythenDetector::resetMerging */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
|
|
||||||
/* int resetMerging(double *mp, double *mv,double *me, int *mm); */
|
/* int resetMerging(double *mp, double *mv,double *me, int *mm); */
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
/* pure virtual function */
|
/* pure virtual function */
|
||||||
/* merge dataset */
|
/* merge dataset */
|
||||||
/* \param p1 angular positions of dataset */
|
/* \param p1 angular positions of dataset */
|
||||||
/* \param v1 data */
|
/* \param v1 data */
|
||||||
/* \param e1 errors */
|
/* \param e1 errors */
|
||||||
/* \param mp already merged postions */
|
/* \param mp already merged postions */
|
||||||
/* \param mv already merged data */
|
/* \param mv already merged data */
|
||||||
/* \param me already merged errors (squared sum) */
|
/* \param me already merged errors (squared sum) */
|
||||||
/* \param mm multiplicity of merged arrays */
|
/* \param mm multiplicity of merged arrays */
|
||||||
/* \sa mythenDetector::addToMerging */
|
/* \sa mythenDetector::addToMerging */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* int addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm); */
|
/* int addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm); */
|
||||||
|
|
||||||
/* /\** pure virtual function */
|
/* /\** pure virtual function */
|
||||||
/* calculates the "final" positions, data value and errors for the emrged data */
|
/* calculates the "final" positions, data value and errors for the emrged data */
|
||||||
/* \param mp already merged postions */
|
/* \param mp already merged postions */
|
||||||
/* \param mv already merged data */
|
/* \param mv already merged data */
|
||||||
/* \param me already merged errors (squared sum) */
|
/* \param me already merged errors (squared sum) */
|
||||||
/* \param mm multiplicity of merged arrays */
|
/* \param mm multiplicity of merged arrays */
|
||||||
/* \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) */
|
/* \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) */
|
||||||
/* \sa mythenDetector::finalizeMerging */
|
/* \sa mythenDetector::finalizeMerging */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* int finalizeMerging(double *mp, double *mv,double *me, int *mm); */
|
/* int finalizeMerging(double *mp, double *mv,double *me, int *mm); */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
turns off server
|
turns off server
|
||||||
@ -1364,7 +1364,7 @@ typedef struct sharedSlsDetector {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//receiver
|
//receiver
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,20 +19,20 @@
|
|||||||
\section howto_sec How to use it
|
\section howto_sec How to use it
|
||||||
|
|
||||||
The detectors can be simply operated by using the provided GUi or command line executable. <br>
|
The detectors can be simply operated by using the provided GUi or command line executable. <br>
|
||||||
In case you need to embed the detector control e.g in the beamline control software, compile these classes using
|
In case you need to embed the detector control e.g in the beamline control software, compile these classes using
|
||||||
<BR>
|
<BR>
|
||||||
make package
|
make package
|
||||||
<br>
|
<br>
|
||||||
and link the shared library created to your software slsDetectorSoftware/bin/libSlsDetector.so
|
and link the shared library created to your software slsDetectorSoftware/bin/libSlsDetector.so
|
||||||
<br>
|
<br>
|
||||||
The software can also be installed (with super-user rights)<br>
|
The software can also be installed (with super-user rights)<br>
|
||||||
make install
|
make install
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
Most methods of interest for the user are implemented in the ::slsDetectorBase interface class, but the classes to be implemented in the main program are either ::slsDetector (for single controller detectors) or ::multiSlsDetector (for multiple controllers, but can work also for single controllers).
|
Most methods of interest for the user are implemented in the ::slsDetectorBase interface class, but the classes to be implemented in the main program are either ::slsDetector (for single controller detectors) or ::multiSlsDetector (for multiple controllers, but can work also for single controllers).
|
||||||
|
|
||||||
@author Anna Bergamaschi
|
@author Anna Bergamaschi
|
||||||
@version 0.1alpha
|
@version 0.1alpha
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ using namespace std;
|
|||||||
@libdoc The slsDetectorBase contains also a set of purely virtual functions useful for the implementation of the derived classes
|
@libdoc The slsDetectorBase contains also a set of purely virtual functions useful for the implementation of the derived classes
|
||||||
|
|
||||||
|
|
||||||
* @short This is the base class for all detector functionalities
|
* @short This is the base class for all detector functionalities
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -348,11 +348,11 @@ class slsDetectorBase : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
virtual int64_t setTimer(timerIndex index, int64_t t=-1)=0;
|
virtual int64_t setTimer(timerIndex index, int64_t t=-1)=0;
|
||||||
int64_t setExposureTime(int64_t t=-1){return setTimer(ACQUISITION_TIME,t);};
|
int64_t setExposureTime(int64_t t=-1){return setTimer(ACQUISITION_TIME,t);};
|
||||||
int64_t setExposurePeriod(int64_t t=-1){return setTimer(FRAME_PERIOD,t);};
|
int64_t setExposurePeriod(int64_t t=-1){return setTimer(FRAME_PERIOD,t);};
|
||||||
int64_t setDelayAfterTrigger(int64_t t=-1){return setTimer(DELAY_AFTER_TRIGGER,t);};
|
int64_t setDelayAfterTrigger(int64_t t=-1){return setTimer(DELAY_AFTER_TRIGGER,t);};
|
||||||
int64_t setNumberOfGates(int64_t t=-1){return setTimer(GATES_NUMBER,t);};
|
int64_t setNumberOfGates(int64_t t=-1){return setTimer(GATES_NUMBER,t);};
|
||||||
int64_t setNumberOfFrames(int64_t t=-1){return setTimer(FRAME_NUMBER,t);};
|
int64_t setNumberOfFrames(int64_t t=-1){return setTimer(FRAME_NUMBER,t);};
|
||||||
int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);};
|
int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/**
|
/**
|
||||||
|
@ -598,9 +598,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
// descrToFuncMap[i].m_pFuncName="progress";
|
// descrToFuncMap[i].m_pFuncName="progress";
|
||||||
// descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
// descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||||
// i++;
|
// i++;
|
||||||
|
|
||||||
descrToFuncMap[i].m_pFuncName="now"; //
|
descrToFuncMap[i].m_pFuncName="now"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||||
@ -675,9 +675,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
|
|
||||||
numberOfCommands=i;
|
numberOfCommands=i;
|
||||||
|
|
||||||
// #ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
// cout << "Number of commands is " << numberOfCommands << endl;
|
// cout << "Number of commands is " << numberOfCommands << endl;
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -771,7 +771,26 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myDet->setOnline(ONLINE_FLAG);
|
myDet->setOnline(ONLINE_FLAG);
|
||||||
|
|
||||||
|
//receiver
|
||||||
|
if(myDet->setReceiverOnline()==ONLINE_FLAG){
|
||||||
|
if(myDet->setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG)
|
||||||
|
return string("can not connect to receiver");
|
||||||
|
if(myDet->getReceiverStatus()!=RUNNING){
|
||||||
|
//update receiver index
|
||||||
|
if(myDet->setReceiverFileIndex(myDet->getFileIndex())==-1)
|
||||||
|
return string("could not set receiver file index");
|
||||||
|
//start receiver
|
||||||
|
myDet->startReceiver();
|
||||||
|
usleep(2000000);
|
||||||
|
if(myDet->getReceiverStatus()!=RUNNING)
|
||||||
|
return string("could not start receiver");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
myDet->acquire();
|
myDet->acquire();
|
||||||
return string("");
|
return string("");
|
||||||
|
|
||||||
@ -864,8 +883,24 @@ string slsDetectorCommand::cmdStatus(int narg, char *args[], int action) {
|
|||||||
myDet->setOnline(ONLINE_FLAG);
|
myDet->setOnline(ONLINE_FLAG);
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
//myDet->setThreadedProcessing(0);
|
//myDet->setThreadedProcessing(0);
|
||||||
if (string(args[1])=="start")
|
if (string(args[1])=="start"){
|
||||||
|
//receiver
|
||||||
|
if(myDet->setReceiverOnline()==ONLINE_FLAG){
|
||||||
|
if(myDet->setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG)
|
||||||
|
return string("can not connect to receiver");
|
||||||
|
if(myDet->getReceiverStatus()!=RUNNING){
|
||||||
|
//update receiver index
|
||||||
|
if(myDet->setReceiverFileIndex(myDet->getFileIndex())==-1)
|
||||||
|
return string("could not set receiver file index");
|
||||||
|
//start receiver
|
||||||
|
myDet->startReceiver();
|
||||||
|
usleep(2000000);
|
||||||
|
if(myDet->getReceiverStatus()!=RUNNING)
|
||||||
|
return string("could not start receiver");
|
||||||
|
}
|
||||||
|
}
|
||||||
myDet->startAcquisition();
|
myDet->startAcquisition();
|
||||||
|
}
|
||||||
else if (string(args[1])=="stop")
|
else if (string(args[1])=="stop")
|
||||||
myDet->stopAcquisition();
|
myDet->stopAcquisition();
|
||||||
else
|
else
|
||||||
@ -891,7 +926,7 @@ string slsDetectorCommand::helpStatus(int narg, char *args[], int action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string slsDetectorCommand::cmdFree(int narg, char *args[], int action) {
|
string slsDetectorCommand::cmdFree(int narg, char *args[], int action) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
||||||
@ -901,7 +936,7 @@ string slsDetectorCommand::helpStatus(int narg, char *args[], int action) {
|
|||||||
}
|
}
|
||||||
myDet->freeSharedMemory();
|
myDet->freeSharedMemory();
|
||||||
return("freed");
|
return("freed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string slsDetectorCommand::helpFree(int narg, char *args[], int action) {
|
string slsDetectorCommand::helpFree(int narg, char *args[], int action) {
|
||||||
@ -2562,11 +2597,11 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if (sscanf(args[1],"%d",&val))
|
// if (sscanf(args[1],"%d",&val))
|
||||||
// ;
|
// ;
|
||||||
// else
|
// else
|
||||||
// return string("could not scan port number")+string(args[1]);
|
// return string("could not scan port number")+string(args[1]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
myDet->setOnline(ONLINE_FLAG);
|
myDet->setOnline(ONLINE_FLAG);
|
||||||
|
|
||||||
|
@ -20,19 +20,19 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
/* executes a set of string arguments according to a given format. It is used to read/write configuration file, dump and retrieve detector settings and for the command line interface command parsing */
|
/* executes a set of string arguments according to a given format. It is used to read/write configuration file, dump and retrieve detector settings and for the command line interface command parsing */
|
||||||
/* \param narg number of arguments */
|
/* \param narg number of arguments */
|
||||||
/* \param args array of string arguments */
|
/* \param args array of string arguments */
|
||||||
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
||||||
/* \returns answer string */
|
/* \returns answer string */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
virtual string executeLine(int narg, char *args[], int action);
|
virtual string executeLine(int narg, char *args[], int action);
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
/* returns the help for the executeLine command */
|
/* returns the help for the executeLine command */
|
||||||
/* \param os output stream to return the help to */
|
/* \param os output stream to return the help to */
|
||||||
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
string helpLine(int narg, char *args[], int action=HELP_ACTION);
|
string helpLine(int narg, char *args[], int action=HELP_ACTION);
|
||||||
static string helpAcquire(int narg, char *args[], int action);
|
static string helpAcquire(int narg, char *args[], int action);
|
||||||
static string helpData(int narg, char *args[], int action);
|
static string helpData(int narg, char *args[], int action);
|
||||||
|
@ -326,7 +326,7 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// loop measurements
|
// loop measurements
|
||||||
|
|
||||||
|
|
||||||
if (measurement_finished)
|
if (measurement_finished)
|
||||||
@ -569,7 +569,7 @@ int slsDetectorUtils::testFunction(int times) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* else{
|
/* else{
|
||||||
std::cout<<"\nWeird Status. "<<runStatusType(s)<<" Exit\n";
|
std::cout<<"\nWeird Status. "<<runStatusType(s)<<" Exit\n";
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}*/
|
}*/
|
||||||
@ -633,8 +633,8 @@ int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
|
|||||||
int iline=0;
|
int iline=0;
|
||||||
|
|
||||||
if (level==2) {
|
if (level==2) {
|
||||||
// fname=fname1+string(".config");
|
// fname=fname1+string(".config");
|
||||||
// readConfigurationFile(fname);
|
// readConfigurationFile(fname);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "config file read" << endl;
|
cout << "config file read" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
@ -84,14 +84,14 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
// int getFileIndex(){return fileIO::getFileIndex();};
|
// int getFileIndex(){return fileIO::getFileIndex();};
|
||||||
// int setFileIndex(int s){return fileIO::setFileIndex(s);};
|
// int setFileIndex(int s){return fileIO::setFileIndex(s);};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int getScanPrecision(int i){return slsDetectorActions::getScanPrecision(i);};
|
int getScanPrecision(int i){return slsDetectorActions::getScanPrecision(i);};
|
||||||
|
|
||||||
int getActionMask() {return slsDetectorActions::getActionMask();};
|
int getActionMask() {return slsDetectorActions::getActionMask();};
|
||||||
float getCurrentScanVariable(int i) {return slsDetectorActions::getCurrentScanVariable(i);};
|
float getCurrentScanVariable(int i) {return slsDetectorActions::getCurrentScanVariable(i);};
|
||||||
int getCurrentPositionIndex(){return angularConversion::getCurrentPositionIndex();};
|
int getCurrentPositionIndex(){return angularConversion::getCurrentPositionIndex();};
|
||||||
int getNumberOfPositions(){return angularConversion::getNumberOfPositions();};
|
int getNumberOfPositions(){return angularConversion::getNumberOfPositions();};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// int getActionMask() {return slsDetectorActions::getActionMask();};
|
// int getActionMask() {return slsDetectorActions::getActionMask();};
|
||||||
// double getCurrentScanVariable(int i) {return slsDetectorActions::getCurrentScanVariable(i);};
|
// double getCurrentScanVariable(int i) {return slsDetectorActions::getCurrentScanVariable(i);};
|
||||||
@ -175,7 +175,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
*/
|
*/
|
||||||
virtual char *setNetworkParameter(networkParameter i, string s)=0;
|
virtual char *setNetworkParameter(networkParameter i, string s)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
changes/gets the port number
|
changes/gets the port number
|
||||||
\param t type port type can be CONTROL_PORT, DATA_PORT, STOP_PORT
|
\param t type port type can be CONTROL_PORT, DATA_PORT, STOP_PORT
|
||||||
\param i new port number (<1024 gets)
|
\param i new port number (<1024 gets)
|
||||||
@ -365,7 +365,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loads dark image or gain image to the detector
|
Loads dark image or gain image to the detector
|
||||||
\param index can be DARK_IMAGE or GAIN_IMAGE
|
\param index can be DARK_IMAGE or GAIN_IMAGE
|
||||||
\fname file name to load data from
|
\fname file name to load data from
|
||||||
@ -571,7 +571,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//receiver
|
//receiver
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +70,7 @@ int energyConversion::writeCalibrationFile(string fname, double gain, double off
|
|||||||
|
|
||||||
#ifndef MYROOT
|
#ifndef MYROOT
|
||||||
|
|
||||||
/* I/O */
|
/* I/O */
|
||||||
|
|
||||||
|
|
||||||
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, sls_detector_module *myMod){
|
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, sls_detector_module *myMod){
|
||||||
|
Reference in New Issue
Block a user