mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +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:
parent
29a540818f
commit
f6a2d599a0
@ -24,7 +24,7 @@ ID: $Id$
|
||||
using namespace std;
|
||||
|
||||
|
||||
char ans[MAX_STR_LENGTH];
|
||||
char ans[MAX_STR_LENGTH];
|
||||
|
||||
int multiSlsDetector::freeSharedMemory() {
|
||||
// Detach Memory address
|
||||
@ -62,7 +62,7 @@ int multiSlsDetector::initSharedMemory(int id=0) {
|
||||
sz=sizeof(sharedMultiSlsDetector);
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
std::cout<<"multiSlsDetector: Size of shared memory is "<< sz << " - id " << mem_key << std::endl;
|
||||
#endif
|
||||
shm_id = shmget(mem_key,sz,IPC_CREAT | 0666); // allocate shared memory
|
||||
@ -680,8 +680,8 @@ int multiSlsDetector::removeSlsDetector(int pos) {
|
||||
single=1;
|
||||
}
|
||||
|
||||
// if (pos<0 )
|
||||
// pos=thisMultiDetector->numberOfDetectors-1;
|
||||
// if (pos<0 )
|
||||
// pos=thisMultiDetector->numberOfDetectors-1;
|
||||
|
||||
if (pos>=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 */
|
||||
// }
|
||||
|
||||
/**
|
||||
/**
|
||||
Sets/gets the synchronization mode of the various detectors
|
||||
\param sync syncronization mode
|
||||
\returns current syncronization mode
|
||||
*/
|
||||
*/
|
||||
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
|
||||
enum timerIndex {
|
||||
FRAME_NUMBER,
|
||||
@ -1434,7 +1434,7 @@ void multiSlsDetector::resetFinalDataQueue() {
|
||||
CYCLES_NUMBER,
|
||||
GATE_INTEGRATED_TIME
|
||||
}
|
||||
*/
|
||||
*/
|
||||
int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t){
|
||||
int i;
|
||||
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;
|
||||
|
||||
@ -1522,7 +1522,7 @@ int multiSlsDetector::setSpeed(speedVariable index, int value){
|
||||
|
||||
|
||||
|
||||
// Flags
|
||||
// Flags
|
||||
int multiSlsDetector::setDynamicRange(int n, int pos){
|
||||
|
||||
// cout << "multi " << endl;
|
||||
@ -1588,10 +1588,10 @@ double* multiSlsDetector::decodeData(int *datain, double *fdata) {
|
||||
#ifdef VERBOSE
|
||||
cout << "done " << endl;
|
||||
#endif
|
||||
// for (int j=0; j<detectors[i]->getTotalNumberOfChannels(); j++) {
|
||||
// dataout[ich]=detp[j];
|
||||
// ich++;
|
||||
// }
|
||||
// for (int j=0; j<detectors[i]->getTotalNumberOfChannels(); j++) {
|
||||
// dataout[ich]=detp[j];
|
||||
// ich++;
|
||||
// }
|
||||
//delete [] detp;
|
||||
}
|
||||
}
|
||||
@ -1600,7 +1600,7 @@ double* multiSlsDetector::decodeData(int *datain, double *fdata) {
|
||||
}
|
||||
|
||||
//Correction
|
||||
/*
|
||||
/*
|
||||
enum correctionFlags {
|
||||
DISCARD_BAD_CHANNELS,
|
||||
AVERAGE_NEIGHBOURS_FOR_BAD_CHANNELS,
|
||||
@ -1608,7 +1608,7 @@ double* multiSlsDetector::decodeData(int *datain, double *fdata) {
|
||||
RATE_CORRECTION,
|
||||
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
|
||||
\param c can be ANGULAR_DIRECTION, GLOBAL_OFFSET, FINE_OFFSET, BIN_SIZE
|
||||
\param v the value to be set
|
||||
\returns the actual value
|
||||
*/
|
||||
*/
|
||||
|
||||
double multiSlsDetector::setAngularConversionParameter(angleConversionParameter c, double 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() {
|
||||
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){
|
||||
|
||||
if (s.find('+')==string::npos) {
|
||||
@ -2414,10 +2414,10 @@ int multiSlsDetector::getTrimEn(int *ene) {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
returns the location of the calibration files
|
||||
\sa sharedSlsDetector
|
||||
*/
|
||||
*/
|
||||
char* multiSlsDetector::getCalDir() {
|
||||
string s0="", s1="", s;
|
||||
//char ans[1000];
|
||||
@ -2443,10 +2443,10 @@ char* multiSlsDetector::getCalDir() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
sets the location of the calibration files
|
||||
\sa sharedSlsDetector
|
||||
*/
|
||||
*/
|
||||
char* multiSlsDetector::setCalDir(string s){
|
||||
|
||||
if (s.find('+')==string::npos) {
|
||||
@ -2476,10 +2476,10 @@ char* multiSlsDetector::setCalDir(string s){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
returns the location of the calibration files
|
||||
\sa sharedSlsDetector
|
||||
*/
|
||||
*/
|
||||
char* multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
string s0="", s1="",s ;
|
||||
|
||||
@ -2506,10 +2506,10 @@ char* multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
sets the location of the calibration files
|
||||
\sa sharedSlsDetector
|
||||
*/
|
||||
*/
|
||||
char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
|
||||
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
|
||||
* @author Anna Bergamaschi
|
||||
* @version 0.1alpha
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
class multiSlsDetector : public slsDetectorUtils {
|
||||
|
||||
//public virtual slsDetectorUtils {
|
||||
//public virtual slsDetectorUtils {
|
||||
|
||||
|
||||
typedef struct sharedMultiSlsDetector {
|
||||
@ -217,17 +217,17 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
using slsDetectorUtils::readAngularConversion;
|
||||
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!)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/** (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
|
||||
|
||||
|
||||
*/
|
||||
*/
|
||||
multiSlsDetector(int id=0);
|
||||
//slsDetector(string const fname);
|
||||
/** destructor */
|
||||
@ -347,13 +347,13 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
\param sync syncronization mode
|
||||
\returns current syncronization mode
|
||||
*/
|
||||
/* enum synchronizationMode { */
|
||||
/* GET_SYNCHRONIZATION_MODE=-1, /\**< the multidetector will return its synchronization mode *\/ */
|
||||
/* NONE, /\**< all detectors are independent (no cabling) *\/ */
|
||||
/* MASTER_GATES, /\**< the master gates 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 *\/ */
|
||||
/* }; */
|
||||
/* enum synchronizationMode { */
|
||||
/* GET_SYNCHRONIZATION_MODE=-1, /\**< the multidetector will return its synchronization mode *\/ */
|
||||
/* NONE, /\**< all detectors are independent (no cabling) *\/ */
|
||||
/* MASTER_GATES, /\**< the master gates 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 *\/ */
|
||||
/* }; */
|
||||
|
||||
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);
|
||||
|
||||
/* /\** */
|
||||
/* get current timer value */
|
||||
/* \param index timer index */
|
||||
/* \returns elapsed time value in ns or number of...(e.g. frames, gates, probes) */
|
||||
/* *\/ */
|
||||
/* int64_t getTimeLeft(timerIndex index); */
|
||||
/* /\** */
|
||||
/* get current timer value */
|
||||
/* \param index timer index */
|
||||
/* \returns elapsed time value in ns or number of...(e.g. frames, gates, probes) */
|
||||
/* *\/ */
|
||||
/* int64_t getTimeLeft(timerIndex index); */
|
||||
|
||||
|
||||
|
||||
@ -1013,7 +1013,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
|
||||
|
||||
|
||||
//receiver
|
||||
//receiver
|
||||
|
||||
/**
|
||||
calls setReceiverTCPSocket if online and sets the flag
|
||||
|
@ -171,7 +171,7 @@ slsDetector::slsDetector(detectorType type, int id): slsDetectorUtils(),
|
||||
adcs(NULL),
|
||||
chipregs(NULL),
|
||||
chanregs(NULL)
|
||||
{
|
||||
{
|
||||
while (shmId<0) {
|
||||
/**Initlializes shared memory \sa initSharedMemory
|
||||
|
||||
@ -955,14 +955,14 @@ string slsDetector::checkOnline() {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
configure the socket communication and check that the server exists
|
||||
enum communicationProtocol{
|
||||
TCP,
|
||||
UDP
|
||||
}{};
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
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;
|
||||
stopSocket=NULL;
|
||||
}
|
||||
if (dataSocket){
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
}
|
||||
} else
|
||||
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;
|
||||
#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) {
|
||||
checkOnline();
|
||||
} 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() {
|
||||
if (controlSocket)
|
||||
return controlSocket->Connect();
|
||||
return FAIL;
|
||||
}
|
||||
/** disconnect from the control port */
|
||||
/** disconnect from the control port */
|
||||
int slsDetector::disconnectControl() {
|
||||
if (controlSocket)
|
||||
controlSocket->Disconnect();
|
||||
@ -1095,28 +1073,28 @@ int slsDetector::disconnectControl() {
|
||||
|
||||
|
||||
|
||||
/** connect to the data port */
|
||||
int slsDetector::connectData() {
|
||||
/** connect to the data port */
|
||||
int slsDetector::connectData() {
|
||||
if (dataSocket)
|
||||
return dataSocket->Connect();
|
||||
return FAIL;
|
||||
};
|
||||
/** disconnect from the data port */
|
||||
int slsDetector::disconnectData(){
|
||||
/** disconnect from the data port */
|
||||
int slsDetector::disconnectData(){
|
||||
if (dataSocket)
|
||||
dataSocket->Disconnect();
|
||||
return OK;
|
||||
}
|
||||
;
|
||||
|
||||
/** connect to the stop port */
|
||||
int slsDetector::connectStop() {
|
||||
/** connect to the stop port */
|
||||
int slsDetector::connectStop() {
|
||||
if (stopSocket)
|
||||
return stopSocket->Connect();
|
||||
return FAIL;
|
||||
};
|
||||
/** disconnect from the stop port */
|
||||
int slsDetector::disconnectStop(){
|
||||
/** disconnect from the stop port */
|
||||
int slsDetector::disconnectStop(){
|
||||
if (stopSocket)
|
||||
stopSocket->Disconnect();
|
||||
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
|
||||
e.g. mount an nfs disk, reboot and returns answer etc.
|
||||
*/
|
||||
*/
|
||||
int slsDetector::execCommand(string cmd, string answer){
|
||||
|
||||
char arg[MAX_STR_LENGTH], retval[MAX_STR_LENGTH];
|
||||
@ -1183,7 +1161,7 @@ int slsDetector::execCommand(string cmd, string answer){
|
||||
|
||||
// Detector configuration functions
|
||||
|
||||
/*
|
||||
/*
|
||||
the detector knows what type of detector it is
|
||||
|
||||
enum detectorType{
|
||||
@ -1196,7 +1174,7 @@ int slsDetector::execCommand(string cmd, string answer){
|
||||
AGIPD
|
||||
};
|
||||
|
||||
*/
|
||||
*/
|
||||
int slsDetector::setDetectorType(detectorType const type){
|
||||
|
||||
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,
|
||||
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)
|
||||
|
||||
enum externalSignalFlag {
|
||||
enum externalSignalFlag {
|
||||
GET_EXTERNAL_SIGNAL_FLAG,
|
||||
SIGNAL_OFF,
|
||||
GATE_ACTIVE_HIGH,
|
||||
GATE_ACTIVE_LOW,
|
||||
TRIGGER_RISING_EDGE,
|
||||
TRIGGER_FALLING_EDGE
|
||||
}{};
|
||||
*/
|
||||
}{};
|
||||
*/
|
||||
|
||||
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
|
||||
enum externalCommunicationMode{
|
||||
GET_EXTERNAL_COMMUNICATION_MODE,
|
||||
@ -1495,9 +1473,9 @@ slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags(external
|
||||
GATE_FIX_DURATION,
|
||||
GATE_WITH_START_TRIGGER,
|
||||
GATE_COINCIDENCE_WITH_INTERNAL_ENABLE
|
||||
};
|
||||
};
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunicationMode( externalCommunicationMode pol){
|
||||
|
||||
@ -1550,8 +1528,8 @@ slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunication
|
||||
};
|
||||
|
||||
|
||||
// Tests and identification
|
||||
/*
|
||||
// Tests and identification
|
||||
/*
|
||||
Gets versions
|
||||
|
||||
enum idMode{
|
||||
@ -1562,7 +1540,7 @@ slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunication
|
||||
DETECTOR_SOFTWARE_VERSION
|
||||
}{};
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -1628,7 +1606,7 @@ int64_t slsDetector::getId( idMode mode, int imod){
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
Digital test of the modules
|
||||
|
||||
enum digitalTestMode {
|
||||
@ -1640,7 +1618,7 @@ int64_t slsDetector::getId( idMode mode, int imod){
|
||||
DETECTOR_SOFTWARE_TEST
|
||||
}{};
|
||||
returns ok or error mask
|
||||
*/
|
||||
*/
|
||||
|
||||
int slsDetector::digitalTest( digitalTestMode mode, int imod){
|
||||
|
||||
@ -1689,48 +1667,48 @@ int slsDetector::digitalTest( digitalTestMode mode, int imod){
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
analog test of the modules
|
||||
enum analogTestMode {
|
||||
COUNT_CALIBRATION_PULSES,
|
||||
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);
|
||||
ichan-=imod*(nChans*nChips);
|
||||
int ichip=ichan/nChans;
|
||||
ichan-=ichip*(nChans);
|
||||
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;
|
||||
};
|
||||
};
|
||||
*/
|
||||
/*
|
||||
give a train of calibration pulses
|
||||
*/
|
||||
/*
|
||||
int slsDetector::giveCalibrationPulse(double vcal, int npulses){
|
||||
std::cout<< "function not yet implemented " << std::endl;
|
||||
};
|
||||
give a train of calibration pulses
|
||||
*/
|
||||
// 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){
|
||||
|
||||
@ -1827,8 +1805,8 @@ int slsDetector::readRegister(int addr){
|
||||
};
|
||||
|
||||
|
||||
// Expert initialization functions
|
||||
/*
|
||||
// Expert initialization functions
|
||||
/*
|
||||
set dacs or read ADC for the module
|
||||
enum dacIndex {
|
||||
TRIMBIT_SIZE,
|
||||
@ -1839,8 +1817,8 @@ int slsDetector::readRegister(int addr){
|
||||
PREAMP,
|
||||
TEMPERATURE,
|
||||
HUMIDITY,
|
||||
}{};
|
||||
*/
|
||||
}{};
|
||||
*/
|
||||
|
||||
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
|
||||
enum channelRegisterBit {
|
||||
COMPARATOR_ENABLE_OFF,
|
||||
@ -1958,7 +1936,7 @@ dacs_t slsDetector::getADC(dacIndex index, int imod){
|
||||
TRIMBIT_OFF // should always be the last!
|
||||
}
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
int slsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod){
|
||||
sls_detector_channel myChan;
|
||||
@ -2136,13 +2114,13 @@ slsDetectorDefs::sls_detector_channel slsDetector::getChannel(int ichan, int ic
|
||||
return myChan;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
configure chip
|
||||
enum chipRegisterBit {
|
||||
ENABLE_ANALOG_OUTPUT,
|
||||
OUTPUT_WIDTH // should always be the last
|
||||
}{};
|
||||
*/
|
||||
*/
|
||||
int slsDetector::setChip(int reg, int ichip, int imod){
|
||||
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;
|
||||
sls_detector_chip myChip;
|
||||
@ -2287,13 +2265,13 @@ int slsDetector::setChip(sls_detector_chip chip){
|
||||
return myChip;
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
configure module
|
||||
enum moduleRegisterBit {
|
||||
I_DON_T_KNOW,
|
||||
OUTPUT_WIDTH // should always be the last
|
||||
}{};
|
||||
*/
|
||||
*/
|
||||
|
||||
int slsDetector::setModule(int reg, int imod){
|
||||
sls_detector_module myModule;
|
||||
@ -2563,30 +2541,30 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){
|
||||
|
||||
|
||||
|
||||
// calibration functions
|
||||
// calibration functions
|
||||
/*
|
||||
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;
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
calibrated setup of the threshold
|
||||
*/
|
||||
*/
|
||||
|
||||
int slsDetector::getThresholdEnergy(int imod){
|
||||
|
||||
@ -2660,10 +2638,10 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
|
||||
return thisDetector->currentThresholdEV;
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
select detector settings
|
||||
*/
|
||||
slsDetectorDefs::detectorSettings slsDetector::getSettings(int imod){
|
||||
*/
|
||||
slsDetectorDefs::detectorSettings slsDetector::getSettings(int imod){
|
||||
|
||||
|
||||
int fnum=F_SET_SETTINGS;
|
||||
@ -3244,7 +3222,7 @@ int* slsDetector::startAndReadAll(){
|
||||
startAndReadAllNoWait();
|
||||
//#ifdef VERBOSE
|
||||
// std::cout<< "started" << std::endl;
|
||||
//#endif
|
||||
//#endif
|
||||
while ((retval=getDataFromDetector())){
|
||||
#ifdef VERBOSE
|
||||
i++;
|
||||
@ -3262,11 +3240,11 @@ int* slsDetector::startAndReadAll(){
|
||||
// std::cout << std::endl;
|
||||
#endif
|
||||
return dataQueue.front(); // check what we return!
|
||||
/* while ((retval=getDataFromDetectorNoWait()))
|
||||
/* while ((retval=getDataFromDetectorNoWait()))
|
||||
i++;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Received " << i << " frames"<< std::endl;
|
||||
#endif
|
||||
#endif
|
||||
return dataQueue.front(); // check what we return!
|
||||
*/
|
||||
|
||||
@ -3317,7 +3295,7 @@ int slsDetector::startAndReadAllNoWait(){
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
set or read the acquisition timers
|
||||
enum timerIndex {
|
||||
FRAME_NUMBER,
|
||||
@ -3329,7 +3307,7 @@ int slsDetector::startAndReadAllNoWait(){
|
||||
CYCLES_NUMBER,
|
||||
GATE_INTEGRATED_TIME
|
||||
}
|
||||
*/
|
||||
*/
|
||||
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)
|
||||
thisDetector->timerValue[index]=t;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (t>=0)
|
||||
thisDetector->timerValue[index]=t;
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl;
|
||||
#endif
|
||||
@ -3678,11 +3656,11 @@ double slsDetector::getCurrentProgress() {
|
||||
/*
|
||||
important speed parameters
|
||||
|
||||
enum speedVariable {
|
||||
enum speedVariable {
|
||||
CLOCK_DIVIDER,
|
||||
WAIT_STATES,
|
||||
SET_SIGNAL_LENGTH
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
int slsDetector::setSpeed(speedVariable sp, int value) {
|
||||
@ -3775,7 +3753,7 @@ int64_t slsDetector::getTimeLeft(timerIndex index){
|
||||
};
|
||||
|
||||
|
||||
// Flags
|
||||
// Flags
|
||||
int slsDetector::setDynamicRange(int n){
|
||||
|
||||
// cout << "single " << endl;
|
||||
@ -3843,17 +3821,17 @@ int slsDetector::setROI(int nroi, int *xmin, int *xmax, int *ymin, int *ymax){
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
|
||||
enum readOutFlags {
|
||||
NORMAL_READOUT,
|
||||
setReadOutFlags(STORE_IN_RAM,
|
||||
READ_HITS,
|
||||
ZERO_COMPRESSION,
|
||||
BACKGROUND_CORRECTION
|
||||
NORMAL_READOUT,
|
||||
setReadOutFlags(STORE_IN_RAM,
|
||||
READ_HITS,
|
||||
ZERO_COMPRESSION,
|
||||
BACKGROUND_CORRECTION
|
||||
}{};
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
int slsDetector::setReadOutFlags(readOutFlags flag){
|
||||
|
||||
@ -3896,16 +3874,16 @@ int slsDetector::setReadOutFlags(readOutFlags flag){
|
||||
return thisDetector->roFlags;
|
||||
};
|
||||
|
||||
//Trimming
|
||||
/*
|
||||
enum trimMode {
|
||||
//Trimming
|
||||
/*
|
||||
enum trimMode {
|
||||
NOISE_TRIMMING,
|
||||
BEAM_TRIMMING,
|
||||
IMPROVE_TRIMMING,
|
||||
FIXEDSETTINGS_TRIMMING,
|
||||
OFFLINE_TRIMMING
|
||||
}{};
|
||||
*/
|
||||
}{};
|
||||
*/
|
||||
int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
|
||||
|
||||
int fnum= F_EXECUTE_TRIMMING;
|
||||
@ -4037,7 +4015,7 @@ double* slsDetector::decodeData(int *datain, double *fdata) {
|
||||
}
|
||||
|
||||
//Correction
|
||||
/*
|
||||
/*
|
||||
enum correctionFlags {
|
||||
DISCARD_BAD_CHANNELS,
|
||||
AVERAGE_NEIGHBOURS_FOR_BAD_CHANNELS,
|
||||
@ -4045,7 +4023,7 @@ double* slsDetector::decodeData(int *datain, double *fdata) {
|
||||
RATE_CORRECTION,
|
||||
ANGULAR_CONVERSION
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
int slsDetector::setFlatFieldCorrection(string fname)
|
||||
|
||||
@ -4122,9 +4100,9 @@ int slsDetector::fillModuleMask(int *mM){
|
||||
int slsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
|
||||
if (corr!=NULL) {
|
||||
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) {
|
||||
// #ifdef VERBOSE
|
||||
// std::cout<< ichan << " "<< corr[ichan] << std::endl;
|
||||
// #endif
|
||||
// #ifdef VERBOSE
|
||||
// std::cout<< ichan << " "<< corr[ichan] << std::endl;
|
||||
// #endif
|
||||
ffcoefficients[ichan]=corr[ichan];
|
||||
if (ecorr!=NULL)
|
||||
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]);
|
||||
if (errout)
|
||||
errout[ichan]=eo;
|
||||
// #ifdef VERBOSE
|
||||
// cout << ichan << " " <<datain[ichan]<< " " << ffcoefficients[ichan]<< " " << dataout[ichan] << endl;
|
||||
// #endif
|
||||
// #ifdef VERBOSE
|
||||
// cout << ichan << " " <<datain[ichan]<< " " << ffcoefficients[ichan]<< " " << dataout[ichan] << endl;
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -4534,9 +4512,9 @@ int slsDetector::configureMAC(){
|
||||
strcpy(arg[2],getServerMAC());
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
//#ifdef VERBOSE
|
||||
std::cout<< "slsDetector configureMAC "<< std::endl;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
for(i=0;i<3;i++){
|
||||
if(!strcmp(arg[i],"none"))
|
||||
@ -4555,24 +4533,27 @@ int slsDetector::configureMAC(){
|
||||
pcword = strtok (NULL, ".");
|
||||
}
|
||||
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.
|
||||
sword.assign(arg[1]);
|
||||
strcpy(arg[1],"");
|
||||
stringstream sstr(sword);
|
||||
while(getline(sstr,sword,':'))
|
||||
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.
|
||||
sword.assign(arg[2]);
|
||||
strcpy(arg[2],"");
|
||||
stringstream ssstr(sword);
|
||||
while(getline(ssstr,sword,':'))
|
||||
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
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int slsDetector::readAngularConversion(ifstream& ifs) {
|
||||
int slsDetector::readAngularConversion(ifstream& ifs) {
|
||||
|
||||
return readAngularConversion(ifs,thisDetector->nModsMax, thisDetector->angOff);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
\returns master flag of the detector
|
||||
*/
|
||||
*/
|
||||
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
|
||||
\param sync syncronization mode can be GET_SYNCHRONIZATION_MODE, NO_SYNCHRONIZATION, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
|
||||
\returns current syncronization mode
|
||||
*/
|
||||
*/
|
||||
slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchronizationMode flag) {
|
||||
|
||||
|
||||
@ -5339,14 +5320,14 @@ string slsDetector::checkReceiverOnline() {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
configure the socket communication and check that the receiver exists
|
||||
enum communicationProtocol{
|
||||
TCP,
|
||||
UDP
|
||||
}{};
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
int slsDetector::setReceiverTCPSocket(string const name, int const data_port){
|
||||
|
||||
@ -5777,9 +5758,9 @@ int slsDetector::updateReceiverNoWait() {
|
||||
char lastClientIP[INET_ADDRSTRLEN];
|
||||
|
||||
n = dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
#ifdef VERBOSE
|
||||
//#ifdef VERBOSE
|
||||
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
n = dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); cout<<"index:"<<ind<<endl;
|
||||
//thisDetector->xx=xx;update file index how?
|
||||
|
@ -37,21 +37,21 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
|
||||
public:
|
||||
|
||||
/* /\** online flags enum \sa setOnline*\/ */
|
||||
/* 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!) *\/ */
|
||||
/* ONLINE_FLAG =1/\**< detector in online state (i.e. communication to the detector updating the local structure) *\/ */
|
||||
/* }; */
|
||||
/* /\** online flags enum \sa setOnline*\/ */
|
||||
/* 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!) *\/ */
|
||||
/* 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.
|
||||
|
||||
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 */
|
||||
int alreadyExisting;
|
||||
|
||||
@ -245,7 +245,7 @@ typedef struct sharedSlsDetector {
|
||||
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 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);
|
||||
|
||||
/** 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
|
||||
*/
|
||||
*/
|
||||
slsDetector(int id);
|
||||
|
||||
|
||||
@ -915,7 +915,7 @@ typedef struct sharedSlsDetector {
|
||||
|
||||
int updateDetector();
|
||||
|
||||
// Acquisition functions
|
||||
// Acquisition functions
|
||||
|
||||
|
||||
/**
|
||||
@ -957,12 +957,12 @@ typedef struct sharedSlsDetector {
|
||||
*/
|
||||
int startAndReadAllNoWait();
|
||||
|
||||
/* /\** */
|
||||
/* receives a data frame from the detector socket */
|
||||
/* \returns pointer to the data or NULL. If NULL disconnects the socket */
|
||||
/* \sa getDataFromDetector */
|
||||
/* *\/ */
|
||||
/* int* getDataFromDetectorNoWait(); */
|
||||
/* /\** */
|
||||
/* receives a data frame from the detector socket */
|
||||
/* \returns pointer to the data or NULL. If NULL disconnects the socket */
|
||||
/* \sa getDataFromDetector */
|
||||
/* *\/ */
|
||||
/* int* getDataFromDetectorNoWait(); */
|
||||
|
||||
/**
|
||||
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);
|
||||
|
||||
|
||||
/* /\** */
|
||||
/* pure virtual function */
|
||||
/* 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 mv already merged data */
|
||||
/* \param me already merged errors (squared sum) */
|
||||
/* \param mm multiplicity of merged arrays */
|
||||
/* \returns OK or FAIL */
|
||||
/* \sa mythenDetector::resetMerging */
|
||||
/* *\/ */
|
||||
/* /\** */
|
||||
/* pure virtual function */
|
||||
/* 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 mv already merged data */
|
||||
/* \param me already merged errors (squared sum) */
|
||||
/* \param mm multiplicity of merged arrays */
|
||||
/* \returns OK or FAIL */
|
||||
/* \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 */
|
||||
/* merge dataset */
|
||||
/* \param p1 angular positions of dataset */
|
||||
/* \param v1 data */
|
||||
/* \param e1 errors */
|
||||
/* \param mp already merged postions */
|
||||
/* \param mv already merged data */
|
||||
/* \param me already merged errors (squared sum) */
|
||||
/* \param mm multiplicity of merged arrays */
|
||||
/* \sa mythenDetector::addToMerging */
|
||||
/* *\/ */
|
||||
/* int addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm); */
|
||||
/* /\** */
|
||||
/* pure virtual function */
|
||||
/* merge dataset */
|
||||
/* \param p1 angular positions of dataset */
|
||||
/* \param v1 data */
|
||||
/* \param e1 errors */
|
||||
/* \param mp already merged postions */
|
||||
/* \param mv already merged data */
|
||||
/* \param me already merged errors (squared sum) */
|
||||
/* \param mm multiplicity of merged arrays */
|
||||
/* \sa mythenDetector::addToMerging */
|
||||
/* *\/ */
|
||||
/* int addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm); */
|
||||
|
||||
/* /\** pure virtual function */
|
||||
/* calculates the "final" positions, data value and errors for the emrged data */
|
||||
/* \param mp already merged postions */
|
||||
/* \param mv already merged data */
|
||||
/* \param me already merged errors (squared sum) */
|
||||
/* \param mm multiplicity of merged arrays */
|
||||
/* \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) */
|
||||
/* \sa mythenDetector::finalizeMerging */
|
||||
/* *\/ */
|
||||
/* int finalizeMerging(double *mp, double *mv,double *me, int *mm); */
|
||||
/* /\** pure virtual function */
|
||||
/* calculates the "final" positions, data value and errors for the emrged data */
|
||||
/* \param mp already merged postions */
|
||||
/* \param mv already merged data */
|
||||
/* \param me already merged errors (squared sum) */
|
||||
/* \param mm multiplicity of merged arrays */
|
||||
/* \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) */
|
||||
/* \sa mythenDetector::finalizeMerging */
|
||||
/* *\/ */
|
||||
/* int finalizeMerging(double *mp, double *mv,double *me, int *mm); */
|
||||
|
||||
/**
|
||||
turns off server
|
||||
@ -1364,7 +1364,7 @@ typedef struct sharedSlsDetector {
|
||||
|
||||
|
||||
|
||||
//receiver
|
||||
//receiver
|
||||
|
||||
|
||||
/**
|
||||
|
@ -19,20 +19,20 @@
|
||||
\section howto_sec How to use it
|
||||
|
||||
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
|
||||
<BR>
|
||||
make package
|
||||
<br>
|
||||
and link the shared library created to your software slsDetectorSoftware/bin/libSlsDetector.so
|
||||
<br>
|
||||
The software can also be installed (with super-user rights)<br>
|
||||
make install
|
||||
<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).
|
||||
In case you need to embed the detector control e.g in the beamline control software, compile these classes using
|
||||
<BR>
|
||||
make package
|
||||
<br>
|
||||
and link the shared library created to your software slsDetectorSoftware/bin/libSlsDetector.so
|
||||
<br>
|
||||
The software can also be installed (with super-user rights)<br>
|
||||
make install
|
||||
<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).
|
||||
|
||||
@author Anna Bergamaschi
|
||||
@version 0.1alpha
|
||||
@author Anna Bergamaschi
|
||||
@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
|
||||
|
||||
|
||||
* @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;
|
||||
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 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 setNumberOfFrames(int64_t t=-1){return setTimer(FRAME_NUMBER,t);};
|
||||
int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,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 setNumberOfGates(int64_t t=-1){return setTimer(GATES_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);};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
|
@ -598,9 +598,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||
i++;
|
||||
|
||||
// descrToFuncMap[i].m_pFuncName="progress";
|
||||
// descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
// i++;
|
||||
// descrToFuncMap[i].m_pFuncName="progress";
|
||||
// descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
// i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="now"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||
@ -675,9 +675,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
|
||||
numberOfCommands=i;
|
||||
|
||||
// #ifdef VERBOSE
|
||||
// cout << "Number of commands is " << numberOfCommands << endl;
|
||||
// #endif
|
||||
// #ifdef VERBOSE
|
||||
// cout << "Number of commands is " << numberOfCommands << endl;
|
||||
// #endif
|
||||
}
|
||||
|
||||
|
||||
@ -771,7 +771,26 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
||||
#ifdef VERBOSE
|
||||
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
||||
#endif
|
||||
|
||||
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();
|
||||
return string("");
|
||||
|
||||
@ -864,8 +883,24 @@ string slsDetectorCommand::cmdStatus(int narg, char *args[], int action) {
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
//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();
|
||||
}
|
||||
else if (string(args[1])=="stop")
|
||||
myDet->stopAcquisition();
|
||||
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
|
||||
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();
|
||||
return("freed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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))
|
||||
// ;
|
||||
// else
|
||||
// return string("could not scan port number")+string(args[1]);
|
||||
// }
|
||||
// if (sscanf(args[1],"%d",&val))
|
||||
// ;
|
||||
// else
|
||||
// return string("could not scan port number")+string(args[1]);
|
||||
// }
|
||||
|
||||
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 */
|
||||
/* \param narg number of arguments */
|
||||
/* \param args array of string arguments */
|
||||
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
||||
/* \returns answer string */
|
||||
/* *\/ */
|
||||
/* 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 args array of string arguments */
|
||||
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
||||
/* \returns answer string */
|
||||
/* *\/ */
|
||||
virtual string executeLine(int narg, char *args[], int action);
|
||||
|
||||
/* /\** */
|
||||
/* returns the help for the executeLine command */
|
||||
/* \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) */
|
||||
/* *\/ */
|
||||
/* /\** */
|
||||
/* returns the help for the executeLine command */
|
||||
/* \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) */
|
||||
/* *\/ */
|
||||
string helpLine(int narg, char *args[], int action=HELP_ACTION);
|
||||
static string helpAcquire(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
|
||||
break;
|
||||
|
||||
// loop measurements
|
||||
// loop measurements
|
||||
|
||||
|
||||
if (measurement_finished)
|
||||
@ -569,7 +569,7 @@ int slsDetectorUtils::testFunction(int times) {
|
||||
}
|
||||
}
|
||||
}
|
||||
/* else{
|
||||
/* else{
|
||||
std::cout<<"\nWeird Status. "<<runStatusType(s)<<" Exit\n";
|
||||
exit(-1);
|
||||
}*/
|
||||
@ -633,8 +633,8 @@ int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
|
||||
int iline=0;
|
||||
|
||||
if (level==2) {
|
||||
// fname=fname1+string(".config");
|
||||
// readConfigurationFile(fname);
|
||||
// fname=fname1+string(".config");
|
||||
// readConfigurationFile(fname);
|
||||
#ifdef VERBOSE
|
||||
cout << "config file read" << endl;
|
||||
#endif
|
||||
|
@ -84,14 +84,14 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
// int getFileIndex(){return fileIO::getFileIndex();};
|
||||
// int setFileIndex(int s){return fileIO::setFileIndex(s);};
|
||||
|
||||
/*
|
||||
/*
|
||||
int getScanPrecision(int i){return slsDetectorActions::getScanPrecision(i);};
|
||||
|
||||
int getActionMask() {return slsDetectorActions::getActionMask();};
|
||||
float getCurrentScanVariable(int i) {return slsDetectorActions::getCurrentScanVariable(i);};
|
||||
int getCurrentPositionIndex(){return angularConversion::getCurrentPositionIndex();};
|
||||
int getNumberOfPositions(){return angularConversion::getNumberOfPositions();};
|
||||
*/
|
||||
*/
|
||||
|
||||
// int getActionMask() {return slsDetectorActions::getActionMask();};
|
||||
// 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;
|
||||
|
||||
/**
|
||||
/**
|
||||
changes/gets the port number
|
||||
\param t type port type can be CONTROL_PORT, DATA_PORT, STOP_PORT
|
||||
\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
|
||||
\param index can be DARK_IMAGE or GAIN_IMAGE
|
||||
\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
|
||||
|
||||
/* I/O */
|
||||
/* I/O */
|
||||
|
||||
|
||||
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, sls_detector_module *myMod){
|
||||
|
Loading…
x
Reference in New Issue
Block a user