mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
after merging with developer
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "83600fcb15c8261173ab15a8ba8d1009693f2d23"
|
||||
#define GITAUTH "Anna_Bergamaschi"
|
||||
#define GITREV 0x3962
|
||||
#define GITDATE 0x20180911
|
||||
#define GITBRANCH "anna"
|
||||
|
||||
#define GITREPUUID "d2bce7e372c241cd235977b92be18555bca6a77d"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4020
|
||||
#define GITDATE 0x20180927
|
||||
#define GITBRANCH "4.0.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "sls_receiver_exceptions.h"
|
||||
#include "SharedMemory.h"
|
||||
#include "receiverInterface.h"
|
||||
#include "gitInfoLib.h"
|
||||
@ -53,7 +53,6 @@ slsDetector::slsDetector(detectorType type, int multiId, int id, bool verify, mu
|
||||
}
|
||||
delete shm;
|
||||
|
||||
|
||||
initSharedMemory(true, type, multiId, verify);
|
||||
initializeDetectorStructure(type);
|
||||
initializeMembers();
|
||||
@ -81,8 +80,10 @@ slsDetector::slsDetector(int multiId, int id, bool verify, multiSlsDetector* m)
|
||||
offset(0) {
|
||||
/* called from multi constructor to populate structure,
|
||||
* so sls shared memory will be opened, not created */
|
||||
|
||||
// getDetectorType Froom shm will check if it was already existing
|
||||
detectorType type = getDetectorTypeFromShm(multiId, verify);
|
||||
|
||||
initSharedMemory(false, type, multiId, verify);
|
||||
initializeMembers();
|
||||
}
|
||||
@ -424,41 +425,46 @@ void slsDetector::addMultipleDetectors(const char* name) {
|
||||
cprintf(RED, "Error: Add Multiple Detectors should not be called at this level\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* pre: sharedMemory=0, thisDetector = 0
|
||||
* exceptions are caught in calling function, shm unmapped and deleted
|
||||
*/
|
||||
void slsDetector::initSharedMemory(bool created, detectorType type, int multiId,
|
||||
bool verify) {
|
||||
if (sharedMemory)
|
||||
delete sharedMemory;
|
||||
thisDetector = 0;
|
||||
try {
|
||||
// calculate shared memory size
|
||||
int sz = calculateSharedMemorySize(type);
|
||||
|
||||
// calculate shared memory size
|
||||
int sz = calculateSharedMemorySize(type);
|
||||
// shared memory object with name
|
||||
sharedMemory = new SharedMemory(multiId, detId);
|
||||
|
||||
// shared memory object with name
|
||||
sharedMemory = new SharedMemory(multiId, detId);
|
||||
// create
|
||||
if (created) {
|
||||
try {
|
||||
// create
|
||||
if (created) {
|
||||
thisDetector = (sharedSlsDetector*)sharedMemory->CreateSharedMemory(sz);
|
||||
} catch(...) {
|
||||
sharedMemory->RemoveSharedMemory();
|
||||
}
|
||||
// open and verify version
|
||||
else {
|
||||
thisDetector = (sharedSlsDetector*)sharedMemory->OpenSharedMemory(sz);
|
||||
if (verify && thisDetector->shmversion != SLS_SHMVERSION) {
|
||||
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
||||
"(expected 0x%x but got 0x%x)\n",
|
||||
multiId, detId, SLS_SHMVERSION,
|
||||
thisDetector->shmversion);
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
}
|
||||
} catch(...) {
|
||||
if (sharedMemory) {
|
||||
// unmap
|
||||
if (thisDetector) {
|
||||
sharedMemory->UnmapSharedMemory(thisDetector);
|
||||
thisDetector = 0;
|
||||
}
|
||||
// delete
|
||||
delete sharedMemory;
|
||||
sharedMemory = 0;
|
||||
thisDetector = 0;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
// open and verify version
|
||||
else {
|
||||
thisDetector = (sharedSlsDetector*)sharedMemory->OpenSharedMemory(sz);
|
||||
if (verify && thisDetector->shmversion != SLS_SHMVERSION) {
|
||||
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
||||
"(expected 0x%x but got 0x%x)\n",
|
||||
multiId, detId, SLS_SHMVERSION, thisDetector->shmversion);
|
||||
sharedMemory->UnmapSharedMemory(thisDetector); /** is this unncessary? */
|
||||
delete sharedMemory;/** is this unncessary? */
|
||||
sharedMemory = 0;
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,7 +702,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
thisDetector->timerValue[SAMPLES_JCTB] = 1;
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME] = 0;
|
||||
thisDetector->timerValue[STORAGE_CELL_NUMBER] = 0;
|
||||
thisDetector->timerValue[SUBFRAME_PERIOD] = 0;
|
||||
thisDetector->timerValue[SUBFRAME_DEADTIME] = 0;
|
||||
thisDetector->actionMask = 0;
|
||||
for (int i = 0; i < MAX_ACTIONS; ++i) {
|
||||
strcpy(thisDetector->actionScript[i], "none");
|
||||
@ -743,7 +749,9 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
thisDetector->receiverAPIVersion = 0;
|
||||
thisDetector->receiver_frameDiscardMode = NO_DISCARD;
|
||||
thisDetector->receiver_framePadding = 1;
|
||||
|
||||
thisDetector->activated = true;
|
||||
thisDetector->receiver_deactivatedPaddingEnable = true;
|
||||
thisDetector->receiver_silentMode = false;
|
||||
|
||||
// get the detector parameters based on type
|
||||
detParameterList detlist;
|
||||
@ -760,7 +768,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
thisDetector->nOffset = detlist.nOffset;
|
||||
thisDetector->dynamicRange = detlist.dynamicRange;
|
||||
thisDetector->moveFlag = detlist.moveFlag;
|
||||
detlist.nGappixelsY = detlist.nGappixelsX;
|
||||
thisDetector->nGappixels[X] = detlist.nGappixelsX;
|
||||
thisDetector->nGappixels[Y] = detlist.nGappixelsY;
|
||||
|
||||
|
||||
@ -1001,7 +1009,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType ty
|
||||
nd = detlist.nDacs;
|
||||
na = detlist.nAdcs;
|
||||
} catch(...) {
|
||||
;// FIXME do what here?
|
||||
return NULL;
|
||||
}
|
||||
dacs_t *dacs=new dacs_t[nd];
|
||||
dacs_t *adcs=new dacs_t[na];
|
||||
@ -1255,35 +1263,48 @@ int slsDetector::receiveModule(sls_detector_module* myMod) {
|
||||
|
||||
|
||||
slsReceiverDefs::detectorType slsDetector::getDetectorTypeFromShm(int multiId, bool verify) {
|
||||
SharedMemory* shm = new SharedMemory(multiId, detId);
|
||||
// shm not created before
|
||||
if (!shm->IsExisting()) {
|
||||
cprintf(RED,"Shared memory %s does not exist.\n"
|
||||
"Corrupted Multi Shared memory. Please free shared memory.\n",
|
||||
shm->GetName().c_str());
|
||||
throw SharedMemoryException();
|
||||
|
||||
detectorType type = GENERIC;
|
||||
SharedMemory* shm = 0;
|
||||
|
||||
try {
|
||||
// create
|
||||
shm = new SharedMemory(multiId, detId);
|
||||
|
||||
// shm not created before
|
||||
if (!shm->IsExisting()) {
|
||||
cprintf(RED,"Shared memory %s does not exist.\n"
|
||||
"Corrupted Multi Shared memory. Please free shared memory.\n",
|
||||
shm->GetName().c_str());
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
|
||||
// only basic size of structure (just version is required)
|
||||
sharedSlsDetector* sdet = 0;
|
||||
size_t sz = sizeof(sharedSlsDetector);
|
||||
|
||||
// open, map, verify version
|
||||
sdet = (sharedSlsDetector*)shm->OpenSharedMemory(sz);
|
||||
if (verify && sdet->shmversion != SLS_SHMVERSION) {
|
||||
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
||||
"(expected 0x%x but got 0x%x)\n",
|
||||
multiId, detId, SLS_SHMVERSION, sdet->shmversion);
|
||||
// unmap and throw
|
||||
sharedMemory->UnmapSharedMemory(thisDetector);
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
|
||||
// get type, unmap
|
||||
type = sdet->myDetectorType;
|
||||
shm->UnmapSharedMemory(sdet);
|
||||
delete shm;
|
||||
|
||||
} catch (...) {
|
||||
if (shm)
|
||||
delete shm;
|
||||
throw;
|
||||
}
|
||||
|
||||
// map basic size of sls detector structure (no need of offsets, just version is required)
|
||||
sharedSlsDetector* sdet = 0;
|
||||
size_t sz = sizeof(sharedSlsDetector);
|
||||
|
||||
// open, map, verify version, get type
|
||||
sdet = (sharedSlsDetector*)shm->OpenSharedMemory(sz);
|
||||
if (verify && sdet->shmversion != SLS_SHMVERSION) {
|
||||
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
||||
"(expected 0x%x but got 0x%x)\n",
|
||||
multiId, detId, SLS_SHMVERSION, sdet->shmversion);
|
||||
shm->UnmapSharedMemory(sdet); /** is this unncessary? */
|
||||
delete shm;/** is this unncessary? */
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
detectorType type = sdet->myDetectorType;
|
||||
|
||||
// unmap
|
||||
shm->UnmapSharedMemory(sdet);
|
||||
delete shm;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -1291,29 +1312,38 @@ slsReceiverDefs::detectorType slsDetector::getDetectorTypeFromShm(int multiId, b
|
||||
slsDetectorDefs::detectorType slsDetector::getDetectorType(const char *name, int cport) {
|
||||
int fnum=F_GET_DETECTOR_TYPE;
|
||||
int retval = FAIL;
|
||||
detectorType t=GENERIC;
|
||||
MySocketTCP *s= new MySocketTCP(name, cport);
|
||||
detectorType t = GENERIC;
|
||||
MySocketTCP* mySocket = 0;
|
||||
|
||||
try {
|
||||
mySocket = new MySocketTCP(name, cport);
|
||||
} catch(...) {
|
||||
cout << "Cannot create socket to server " << name << " over port " << cport << endl;
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
char m[MAX_STR_LENGTH];
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting detector type " << endl;
|
||||
#endif
|
||||
if (s->Connect() >= 0) {
|
||||
s->SendDataOnly(&fnum,sizeof(fnum));
|
||||
s->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
if (mySocket->Connect() >= 0) {
|
||||
mySocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
mySocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
if (retval!=FAIL) {
|
||||
s->ReceiveDataOnly(&t,sizeof(t));
|
||||
mySocket->ReceiveDataOnly(&t,sizeof(t));
|
||||
#ifdef VERBOSE
|
||||
cout << "Detector type is "<< t << endl;
|
||||
#endif
|
||||
} else {
|
||||
s->ReceiveDataOnly(m,sizeof(m));
|
||||
mySocket->ReceiveDataOnly(m,sizeof(m));
|
||||
std::cout<< "Detector returned error: " << m << std::endl;
|
||||
}
|
||||
s->Disconnect();
|
||||
mySocket->Disconnect();
|
||||
} else {
|
||||
cout << "Cannot connect to server " << name << " over port " << cport << endl;
|
||||
}
|
||||
delete s;
|
||||
delete mySocket;
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -1749,7 +1779,7 @@ string slsDetector::checkOnline() {
|
||||
controlSocket->SetTimeOut(5);
|
||||
thisDetector->onlineFlag=OFFLINE_FLAG;
|
||||
delete controlSocket;
|
||||
controlSocket=NULL;
|
||||
controlSocket=0;
|
||||
retval = string(thisDetector->hostname);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "offline!" << std::endl;
|
||||
@ -1769,7 +1799,7 @@ string slsDetector::checkOnline() {
|
||||
stopSocket->SetTimeOut(5);
|
||||
thisDetector->onlineFlag=OFFLINE_FLAG;
|
||||
delete stopSocket;
|
||||
stopSocket=NULL;
|
||||
stopSocket=0;
|
||||
retval = string(thisDetector->hostname);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "stop offline!" << std::endl;
|
||||
@ -1802,11 +1832,11 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
||||
strcpy(thisDetector->hostname,thisName);
|
||||
if (controlSocket) {
|
||||
delete controlSocket;
|
||||
controlSocket=NULL;
|
||||
controlSocket=0;
|
||||
}
|
||||
if (stopSocket) {
|
||||
delete stopSocket;
|
||||
stopSocket=NULL;
|
||||
stopSocket=0;
|
||||
}
|
||||
} else
|
||||
strcpy(thisName,thisDetector->hostname);
|
||||
@ -1819,7 +1849,7 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
||||
thisDetector->controlPort=thisCP;
|
||||
if (controlSocket) {
|
||||
delete controlSocket;
|
||||
controlSocket=NULL;
|
||||
controlSocket=0;
|
||||
}
|
||||
} else
|
||||
thisCP=thisDetector->controlPort;
|
||||
@ -1832,46 +1862,50 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
||||
thisDetector->stopPort=thisSP;
|
||||
if (stopSocket) {
|
||||
delete stopSocket;
|
||||
stopSocket=NULL;
|
||||
stopSocket=0;
|
||||
}
|
||||
} else
|
||||
thisSP=thisDetector->stopPort;
|
||||
|
||||
|
||||
// create control socket
|
||||
if (!controlSocket) {
|
||||
controlSocket= new MySocketTCP(thisName, thisCP);
|
||||
if (controlSocket->getErrorStatus()){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Control socket " << thisName << " "
|
||||
<< thisCP << std::endl;
|
||||
#endif
|
||||
delete controlSocket;
|
||||
controlSocket=NULL;
|
||||
retval=FAIL;
|
||||
}
|
||||
try {
|
||||
controlSocket = new MySocketTCP(thisName, thisCP);
|
||||
#ifdef VERYVERBOSE
|
||||
else
|
||||
std::cout<< "Control socket connected " <<thisName << " " << thisCP
|
||||
<< std::endl;
|
||||
std::cout<< "Control socket connected " <<
|
||||
thisName << " " << thisCP << std::endl;
|
||||
#endif
|
||||
} catch(...) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Control socket " <<
|
||||
thisName << " " << thisCP << std::endl;
|
||||
#endif
|
||||
controlSocket = 0;
|
||||
retval = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// create stop socket
|
||||
if (!stopSocket) {
|
||||
stopSocket=new MySocketTCP(thisName, thisSP);
|
||||
if (stopSocket->getErrorStatus()){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Stop socket "<<thisName << " " << thisSP
|
||||
<< std::endl;
|
||||
#endif
|
||||
delete stopSocket;
|
||||
stopSocket=NULL;
|
||||
retval=FAIL;
|
||||
}
|
||||
try {
|
||||
stopSocket = new MySocketTCP(thisName, thisSP);
|
||||
#ifdef VERYVERBOSE
|
||||
else
|
||||
std::cout<< "Stop socket connected " << thisName << " " << thisSP
|
||||
<< std::endl;
|
||||
std::cout<< "Stop socket connected " <<
|
||||
thisName << " " << thisSP << std::endl;
|
||||
#endif
|
||||
} catch(...) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Stop socket " <<
|
||||
thisName << " " << thisSP << std::endl;
|
||||
#endif
|
||||
stopSocket = 0;
|
||||
retval = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (retval!=FAIL) {
|
||||
checkOnline();
|
||||
|
||||
@ -1909,7 +1943,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret=FAIL;
|
||||
bool online=false;
|
||||
MySocketTCP *s;
|
||||
MySocketTCP *s = 0;
|
||||
|
||||
if (num>1024) {
|
||||
switch(index) {
|
||||
@ -1921,7 +1955,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
cout << thisDetector->controlPort<< " " << " " << thisDetector->stopPort
|
||||
<< endl;
|
||||
#endif
|
||||
if (s==NULL) {
|
||||
if (s==0) {
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "s=NULL"<< endl;
|
||||
@ -1959,7 +1993,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
s=dataSocket;
|
||||
retval=thisDetector->receiverTCPPort;
|
||||
if(strcmp(thisDetector->receiver_hostname,"none")){
|
||||
if (s==NULL) setReceiverTCPSocket("",retval);
|
||||
if (s==0) setReceiverTCPSocket("",retval);
|
||||
if (dataSocket)s=dataSocket;
|
||||
}
|
||||
online = (thisDetector->receiverOnlineFlag==ONLINE_FLAG);
|
||||
@ -1979,7 +2013,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
case STOP_PORT:
|
||||
s=stopSocket;
|
||||
retval=thisDetector->stopPort;
|
||||
if (s==NULL) setTCPSocket("",-1,DEFAULT_PORTNO+1);
|
||||
if (s==0) setTCPSocket("",-1,DEFAULT_PORTNO+1);
|
||||
if (stopSocket) s=stopSocket;
|
||||
else setTCPSocket("",-1,retval);
|
||||
online = (thisDetector->onlineFlag==ONLINE_FLAG);
|
||||
@ -1996,7 +2030,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
break;
|
||||
|
||||
default:
|
||||
s=NULL;
|
||||
s=0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2281,63 +2315,51 @@ int slsDetector::updateDetectorNoWait() {
|
||||
n += controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->dataBytes=nm;
|
||||
|
||||
//t=setSettings(GET_SETTINGS);
|
||||
n += controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
||||
thisDetector->currentSettings=t;
|
||||
|
||||
if((thisDetector->myDetectorType == EIGER) ||
|
||||
(thisDetector->myDetectorType == MYTHEN)){
|
||||
//thr=getThresholdEnergy();
|
||||
n += controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
||||
thisDetector->currentThresholdEV=thr;
|
||||
}
|
||||
|
||||
//retval=setFrames(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_NUMBER]=retval;
|
||||
|
||||
// retval=setExposureTime(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
||||
|
||||
if(thisDetector->myDetectorType == EIGER){
|
||||
//retval=setSubFrameExposureTime(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]=retval;
|
||||
|
||||
//retval=setSubFramePeriod(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[SUBFRAME_PERIOD]=retval;
|
||||
thisDetector->timerValue[SUBFRAME_DEADTIME]=retval;
|
||||
}
|
||||
|
||||
//retval=setPeriod(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER) {
|
||||
//retval=setDelay(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
|
||||
}
|
||||
|
||||
// retval=setGates(tns);
|
||||
if ((thisDetector->myDetectorType != JUNGFRAU) &&
|
||||
(thisDetector->myDetectorType != EIGER)){
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[GATES_NUMBER]=retval;
|
||||
}
|
||||
|
||||
//retval=setProbes(tns);
|
||||
if (thisDetector->myDetectorType == MYTHEN){
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[PROBES_NUMBER]=retval;
|
||||
}
|
||||
|
||||
//retval=setTrains(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[CYCLES_NUMBER]=retval;
|
||||
|
||||
//retval=setProbes(tns);
|
||||
if (thisDetector->myDetectorType == JUNGFRAUCTB){
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
if (retval>=0)
|
||||
@ -2346,10 +2368,7 @@ int slsDetector::updateDetectorNoWait() {
|
||||
|
||||
thisDetector->roFlags=ro;
|
||||
|
||||
//retval=setProbes(tns);
|
||||
getTotalNumberOfChannels();
|
||||
// thisDetector->dataBytes=getTotalNumberOfChannels()*
|
||||
//thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
}
|
||||
|
||||
|
||||
@ -3673,7 +3692,6 @@ int slsDetector::cleanupAcquisition() {
|
||||
|
||||
int slsDetector::startAcquisition() {
|
||||
|
||||
|
||||
int fnum=F_START_ACQUISITION;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
@ -3696,9 +3714,6 @@ int slsDetector::startAcquisition() {
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3743,6 +3758,35 @@ int slsDetector::stopAcquisition() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::sendSoftwareTrigger() {
|
||||
|
||||
int fnum=F_SOFTWARE_TRIGGER;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sending software trigger "<< std::endl;
|
||||
#endif
|
||||
thisDetector->stoppedFlag=0;
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetector::startReadOut() {
|
||||
|
||||
int fnum=F_START_READOUT;
|
||||
@ -3848,7 +3892,7 @@ int* slsDetector::getDataFromDetector(int *retval) {
|
||||
|
||||
int nodatadetectortype = false;
|
||||
detectorType types = getDetectorsType();
|
||||
if(types == EIGER || types == JUNGFRAU){
|
||||
if(types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX){
|
||||
nodatadetectortype = true;
|
||||
}
|
||||
|
||||
@ -3989,7 +4033,7 @@ int slsDetector::readAllNoWait() {
|
||||
int slsDetector::configureMAC() {
|
||||
int i;
|
||||
int ret=FAIL;
|
||||
int fnum=F_CONFIGURE_MAC,fnum2=F_RECEIVER_SHORT_FRAME;
|
||||
int fnum=F_CONFIGURE_MAC;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
char arg[6][50];memset(arg,0,sizeof(char)*6*50);
|
||||
int retval=-1;
|
||||
@ -4002,14 +4046,10 @@ int slsDetector::configureMAC() {
|
||||
if (thisDetector->myDetectorType == JUNGFRAU ||
|
||||
thisDetector->myDetectorType == EIGER) {
|
||||
sendpos = true;
|
||||
int max = multiDet->getNumberOfDetectors(X);
|
||||
if(!detId) {
|
||||
pos[0] = 0;
|
||||
pos[1] = 0;
|
||||
} else {
|
||||
pos[1] = detId / max;
|
||||
pos[0] = (detId % max) * ((thisDetector->myDetectorType == EIGER) ? 2 : 1); // for horiz. udp ports
|
||||
}
|
||||
int max = multiDet->getNumberOfDetectors(Y);
|
||||
|
||||
pos[0] = (detId % max); // row
|
||||
pos[1] = (detId / max) * ((thisDetector->myDetectorType == EIGER) ? 2 : 1);// col for horiz. udp ports
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "SLS [" << detId << "] - (" << pos[0] << "," << pos[1] << "," <<
|
||||
@ -4193,27 +4233,6 @@ int slsDetector::configureMAC() {
|
||||
std::cout<< "Configuring MAC failed " << std::endl;
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
||||
}
|
||||
else if (thisDetector->myDetectorType==GOTTHARD){
|
||||
//set frames per file - only for gotthard
|
||||
pthread_mutex_lock(&ms);
|
||||
if(retval==-1)
|
||||
setFramesPerFile(MAX_FRAMES_PER_FILE);
|
||||
else
|
||||
setFramesPerFile(SHORT_MAX_FRAMES_PER_FILE);
|
||||
pthread_mutex_unlock(&ms);
|
||||
//connect to receiver
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending adc val to receiver " << retval << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum2,retval,retval);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -4328,7 +4347,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) {
|
||||
//send acquisiton time/period/subexptime/frame/cycles/samples to receiver
|
||||
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||
|
||||
(index==ACQUISITION_TIME) || (index==SUBFRAME_ACQUISITION_TIME) ||
|
||||
(index==SUBFRAME_PERIOD) ||
|
||||
(index==SUBFRAME_DEADTIME) ||
|
||||
(index==SAMPLES_JCTB) || (index==STORAGE_CELL_NUMBER)){
|
||||
string timername = getTimerType(index);
|
||||
if(ret != FAIL){
|
||||
@ -4379,7 +4398,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) {
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
case SUBFRAME_PERIOD:
|
||||
case SUBFRAME_DEADTIME:
|
||||
case SAMPLES_JCTB:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_TIMER_NOT_SET));
|
||||
break;
|
||||
@ -4399,7 +4418,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) {
|
||||
|
||||
|
||||
|
||||
int64_t slsDetector::getTimeLeft(timerIndex index) {
|
||||
int64_t slsDetector::getTimeLeft(timerIndex index, int imod) {
|
||||
|
||||
|
||||
int fnum=F_GET_TIME_LEFT;
|
||||
@ -5524,9 +5543,14 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
std::cout << "frame number:" << thisDetector->timerValue[FRAME_NUMBER] << endl;
|
||||
std::cout << "sub exp time:" << thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]
|
||||
<< endl;
|
||||
std::cout << "sub period:" << thisDetector->timerValue[SUBFRAME_PERIOD] << endl;
|
||||
std::cout << "sub dead time:" << thisDetector->timerValue[SUBFRAME_DEADTIME] << endl;
|
||||
std::cout << "dynamic range:" << thisDetector->dynamicRange << endl;
|
||||
std::cout << "flippeddatax:" << thisDetector->flippedData[X] << endl;
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
std::cout << "activated: " << thisDetector->activated << endl;
|
||||
std::cout << "receiver deactivated padding: " << thisDetector->receiver_deactivatedPaddingEnable << endl;
|
||||
}
|
||||
std::cout << "silent Mode:" << thisDetector->receiver_silentMode << endl;
|
||||
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl;
|
||||
std::cout << "Gap pixels: " << thisDetector->gappixels << endl;
|
||||
std::cout << "rx streaming source ip:" << thisDetector->receiver_zmqip << endl;
|
||||
@ -5538,8 +5562,7 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
|
||||
#endif
|
||||
if(setDetectorType()!= GENERIC){
|
||||
if(!detId)
|
||||
sendMultiDetectorSize();
|
||||
sendMultiDetectorSize();
|
||||
setDetectorId();
|
||||
setDetectorHostname();
|
||||
setUDPConnection();
|
||||
@ -5566,7 +5589,7 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
if(thisDetector->myDetectorType == EIGER) {
|
||||
setTimer(SUBFRAME_ACQUISITION_TIME,
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]);
|
||||
setTimer(SUBFRAME_PERIOD,thisDetector->timerValue[SUBFRAME_PERIOD]);
|
||||
setTimer(SUBFRAME_DEADTIME,thisDetector->timerValue[SUBFRAME_DEADTIME]);
|
||||
}
|
||||
if(thisDetector->myDetectorType == JUNGFRAUCTB)
|
||||
setTimer(SAMPLES_JCTB,thisDetector->timerValue[SAMPLES_JCTB]);
|
||||
@ -5574,7 +5597,9 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
if(thisDetector->myDetectorType == EIGER){
|
||||
setFlippedData(X,-1);
|
||||
activate(-1);
|
||||
setDeactivatedRxrPaddingMode(thisDetector->receiver_deactivatedPaddingEnable);
|
||||
}
|
||||
setReceiverSilentMode(thisDetector->receiver_silentMode);
|
||||
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
enableTenGigabitEthernet(thisDetector->tenGigaEnable);
|
||||
@ -5587,6 +5612,9 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
setReceiverStreamingIP(getReceiverStreamingIP());
|
||||
setAdditionalJsonHeader(getAdditionalJsonHeader());
|
||||
enableDataStreamingFromReceiver(enableDataStreamingFromReceiver(-1));
|
||||
|
||||
if(thisDetector->myDetectorType == GOTTHARD)
|
||||
sendROI(-1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6401,6 +6429,7 @@ int slsDetector::setROI(int n,ROI roiLimits[]) {
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -6493,17 +6522,39 @@ int slsDetector::sendROI(int n,ROI roiLimits[]) {
|
||||
}
|
||||
|
||||
//update client
|
||||
if(ret!=FAIL){
|
||||
if(ret==FAIL){
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
} else {
|
||||
for(int i=0;i<retvalsize;++i)
|
||||
thisDetector->roiLimits[i]=retval[i];
|
||||
thisDetector->nROI = retvalsize;
|
||||
}
|
||||
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
for(int j=0;j<thisDetector->nROI;++j)
|
||||
cout<<"get"<< roiLimits[j].xmin<<"\t"<<roiLimits[j].xmax<<"\t"
|
||||
<<roiLimits[j].ymin<<"\t"<<roiLimits[j].ymax<<endl;
|
||||
//#endif
|
||||
cout<<"ROI [" <<j<<"] ("<< roiLimits[j].xmin<<"\t"<<roiLimits[j].xmax<<"\t"
|
||||
<<roiLimits[j].ymin<<"\t"<<roiLimits[j].ymax<<")"<<endl;
|
||||
#endif
|
||||
|
||||
// old firmware requires configuremac after setting roi
|
||||
if (thisDetector->myDetectorType == GOTTHARD) {
|
||||
configureMAC();
|
||||
}
|
||||
|
||||
// update roi in receiver
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
int fnum=F_RECEIVER_SET_ROI;
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending ROI to receiver " << thisDetector->nROI << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendROI(fnum, thisDetector->nROI, thisDetector->roiLimits);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -6561,7 +6612,7 @@ int slsDetector::activate(int const enable) {
|
||||
int retval = -1;
|
||||
int arg = enable;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret = OK;
|
||||
int ret = FAIL;
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER){
|
||||
std::cout<< "Not implemented for this detector" << std::endl;
|
||||
@ -6588,6 +6639,7 @@ int slsDetector::activate(int const enable) {
|
||||
setErrorMask((getErrorMask())|(DETECTOR_ACTIVATE));
|
||||
} else {
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
thisDetector->activated = retval;
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
@ -6604,12 +6656,13 @@ int slsDetector::activate(int const enable) {
|
||||
#endif
|
||||
|
||||
if(ret!=FAIL){
|
||||
int arg = thisDetector->activated;
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Activating/Deactivating Receiver: " << retval << std::endl;
|
||||
std::cout << "Activating/Deactivating Receiver: " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum2,retval,retval);
|
||||
ret=thisReceiver->sendInt(fnum2,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
@ -6626,12 +6679,44 @@ int slsDetector::activate(int const enable) {
|
||||
#endif
|
||||
|
||||
|
||||
return retval;
|
||||
return thisDetector->activated;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetector::setDeactivatedRxrPaddingMode(int padding) {
|
||||
int fnum = F_RECEIVER_DEACTIVATED_PADDING_ENABLE;
|
||||
int retval = -1;
|
||||
int arg = padding;
|
||||
int ret = OK;
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER){
|
||||
std::cout<< "Not implemented for this detector" << std::endl;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACTIVATE));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Deactivated Receiver Padding Enable: " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACTIVATE));
|
||||
else
|
||||
thisDetector->receiver_deactivatedPaddingEnable = retval;
|
||||
}
|
||||
|
||||
return thisDetector->receiver_deactivatedPaddingEnable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetector::getFlippedData(dimension d) {
|
||||
return thisDetector->flippedData[d];
|
||||
}
|
||||
@ -8662,7 +8747,7 @@ string slsDetector::checkReceiverOnline() {
|
||||
dataSocket->SetTimeOut(5);
|
||||
thisDetector->receiverOnlineFlag=OFFLINE_FLAG;
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
dataSocket=0;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "receiver offline!" << std::endl;
|
||||
#endif
|
||||
@ -8699,7 +8784,7 @@ int slsDetector::setReceiverTCPSocket(string const name, int const receiver_port
|
||||
strcpy(thisDetector->receiver_hostname,thisName);
|
||||
if (dataSocket){
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
dataSocket=0;
|
||||
}
|
||||
} else
|
||||
strcpy(thisName,thisDetector->receiver_hostname);
|
||||
@ -8713,28 +8798,30 @@ int slsDetector::setReceiverTCPSocket(string const name, int const receiver_port
|
||||
thisDetector->receiverTCPPort=thisRP;
|
||||
if (dataSocket){
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
dataSocket=0;
|
||||
}
|
||||
} else
|
||||
thisRP=thisDetector->receiverTCPPort;
|
||||
|
||||
//create data socket
|
||||
if (!dataSocket) {
|
||||
dataSocket=new MySocketTCP(thisName, thisRP);
|
||||
if (dataSocket->getErrorStatus()){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Data socket "<<thisName << " " <<
|
||||
thisRP << std::endl;
|
||||
#endif
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
retval=FAIL;
|
||||
}
|
||||
try {
|
||||
dataSocket = new MySocketTCP(thisName, thisRP);
|
||||
#ifdef VERYVERBOSE
|
||||
else
|
||||
std::cout<< "Data socket connected "<< thisName << " " << thisRP << std::endl;
|
||||
std::cout<< "Data socket connected " <<
|
||||
thisName << " " << thisRP << std::endl;
|
||||
#endif
|
||||
} catch(...) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Data socket " <<
|
||||
thisName << " " << thisRP << std::endl;
|
||||
#endif
|
||||
dataSocket = 0;
|
||||
retval = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//check if it connects
|
||||
if (retval!=FAIL) {
|
||||
checkReceiverOnline();
|
||||
@ -8918,7 +9005,17 @@ int slsDetector::updateReceiverNoWait() {
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->receiver_upstream = ind;
|
||||
|
||||
// activate
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->activated = ind;
|
||||
|
||||
// deactivated padding enable
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->receiver_deactivatedPaddingEnable = ind;
|
||||
|
||||
// silent mode
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->receiver_silentMode = ind;
|
||||
|
||||
if (!n) printf("n: %d\n", n);
|
||||
|
||||
@ -9341,13 +9438,6 @@ int slsDetector::startReceiver() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// tell detector to send to receiver (if start receiver failed, this is not executed)
|
||||
if(((thisDetector->myDetectorType == GOTTHARD ||
|
||||
thisDetector->myDetectorType == PROPIX) && ret!= FAIL))
|
||||
return prepareAcquisition(); // send data to receiver for these detectors
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -9359,11 +9449,6 @@ int slsDetector::stopReceiver() {
|
||||
int ret = FAIL;
|
||||
char mess[MAX_STR_LENGTH] = "";
|
||||
|
||||
if(thisDetector->myDetectorType == GOTTHARD ||
|
||||
thisDetector->myDetectorType == PROPIX)
|
||||
cleanupAcquisition(); // reset (send data to receiver) for these detectors,
|
||||
//so back to CPU (dont care about ok/fail at this point)
|
||||
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Stopping Receiver " << std::endl;
|
||||
@ -9843,8 +9928,10 @@ int slsDetector::setReceiverSilentMode(int i) {
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET));
|
||||
else
|
||||
thisDetector->receiver_silentMode = retval;
|
||||
}
|
||||
return retval;
|
||||
return thisDetector->receiver_silentMode;
|
||||
}
|
||||
|
||||
|
||||
|
@ -375,6 +375,15 @@ private:
|
||||
/** receiver partial frames padding enable */
|
||||
bool receiver_framePadding;
|
||||
|
||||
/** activated receiver */
|
||||
bool activated;
|
||||
|
||||
/** padding enable in deactivated receiver */
|
||||
bool receiver_deactivatedPaddingEnable;
|
||||
|
||||
/** silent receiver */
|
||||
bool receiver_silentMode;
|
||||
|
||||
} sharedSlsDetector;
|
||||
|
||||
|
||||
@ -510,7 +519,7 @@ public:
|
||||
* @param pos insignificant
|
||||
* @returns hostname
|
||||
*/
|
||||
string getHostname(int pos = -1);
|
||||
std::string getHostname(int pos = -1);
|
||||
|
||||
/**
|
||||
* Appends detectors to the end of the list in shared memory
|
||||
@ -573,7 +582,7 @@ public:
|
||||
* @param type string of detector type
|
||||
* @returns detector type in receiver
|
||||
*/
|
||||
int setDetectorType(string stype);
|
||||
int setDetectorType(std::string stype);
|
||||
|
||||
/**
|
||||
* Get Detector type from shared memory variable
|
||||
@ -587,14 +596,14 @@ public:
|
||||
* @param pos insignificant
|
||||
* @returns string version of detector type from shared memory variable
|
||||
*/
|
||||
string sgetDetectorsType(int pos=-1);
|
||||
std::string sgetDetectorsType(int pos=-1);
|
||||
|
||||
/**
|
||||
* Just to overload getDetectorType from users
|
||||
* Gets string version of detector type from shared memory variable
|
||||
* @returns gets string version of detector type from shared memory variable
|
||||
*/
|
||||
string getDetectorType();
|
||||
std::string getDetectorType();
|
||||
|
||||
/**
|
||||
* Returns number of modules from shared memory (Mythen)
|
||||
@ -759,7 +768,7 @@ public:
|
||||
* @returns empty string if it is online
|
||||
* else returns hostnameif it is offline
|
||||
*/
|
||||
string checkOnline();
|
||||
std::string checkOnline();
|
||||
|
||||
/**
|
||||
* Configure the TCP socket communciation and initializes the socket instances
|
||||
@ -769,7 +778,7 @@ public:
|
||||
* @returns OK or FAIL
|
||||
* \sa sharedSlsDetector
|
||||
*/
|
||||
int setTCPSocket(string const name="", int const control_port=-1, int const stop_port=-1);
|
||||
int setTCPSocket(std::string const name="", int const control_port=-1, int const stop_port=-1);
|
||||
|
||||
|
||||
/**
|
||||
@ -793,7 +802,7 @@ public:
|
||||
int getStopPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver TCP port \sa sharedSlsDetector
|
||||
* Returns the receiver TCP port \sa sharedSlsDetector
|
||||
* @returns the receiver TCP port
|
||||
*/
|
||||
int getReceiverPort();
|
||||
@ -809,7 +818,7 @@ public:
|
||||
* Get last client IP saved on detector server
|
||||
* @returns last client IP saved on detector server
|
||||
*/
|
||||
string getLastClientIP();
|
||||
std::string getLastClientIP();
|
||||
|
||||
/**
|
||||
* Exit detector server
|
||||
@ -824,7 +833,7 @@ public:
|
||||
* @param answer is the answer from the detector
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int execCommand(string cmd, string answer);
|
||||
int execCommand(std::string cmd, std::string answer);
|
||||
|
||||
/**
|
||||
* Updates some of the shared memory receiving the data from the detector
|
||||
@ -845,14 +854,14 @@ public:
|
||||
* @param fname configuration file name
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(string const fname);
|
||||
int readConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Load configuration from a stream
|
||||
* @param infile stream
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(ifstream &infile);
|
||||
int readConfigurationFile(std::ifstream &infile);
|
||||
|
||||
/**
|
||||
* Write current configuration to a file
|
||||
@ -860,7 +869,7 @@ public:
|
||||
* @param fname configuration file name
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeConfigurationFile(string const fname);
|
||||
int writeConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Write current configuration to a stream
|
||||
@ -868,13 +877,13 @@ public:
|
||||
* @param id detector id
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeConfigurationFile(ofstream &outfile, int id=-1);
|
||||
int writeConfigurationFile(std::ofstream &outfile, int id=-1);
|
||||
|
||||
/**
|
||||
* Returns the trimfile or settings file name (Useless??)
|
||||
* @returns the trimfile or settings file name
|
||||
*/
|
||||
string getSettingsFile();
|
||||
std::string getSettingsFile();
|
||||
|
||||
/**
|
||||
* Writes a trim/settings file for module number imod,
|
||||
@ -887,7 +896,7 @@ public:
|
||||
* \sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
|
||||
*/
|
||||
using energyConversion::writeSettingsFile;
|
||||
int writeSettingsFile(string fname, int imod, int iodelay, int tau);
|
||||
int writeSettingsFile(std::string fname, int imod, int iodelay, int tau);
|
||||
|
||||
/**
|
||||
* Get detector settings
|
||||
@ -956,7 +965,7 @@ public:
|
||||
* @param s trimbits/settings directory
|
||||
* @returns the trimbit/settings directory
|
||||
*/
|
||||
std::string setSettingsDir(string s);
|
||||
std::string setSettingsDir(std::string s);
|
||||
|
||||
/**
|
||||
* Returns the calibration files directory \sa sharedSlsDetector (Mythen)
|
||||
@ -969,7 +978,7 @@ public:
|
||||
* @param s the calibration files directory
|
||||
* @returns the calibration files directory
|
||||
*/
|
||||
std::string setCalDir(string s);
|
||||
std::string setCalDir(std::string s);
|
||||
|
||||
/**
|
||||
* Loads the modules settings/trimbits reading from a specific file
|
||||
@ -979,7 +988,7 @@ public:
|
||||
* from which will be calculated the detector index and the module index (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int loadSettingsFile(string fname, int imod=-1);
|
||||
int loadSettingsFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Saves the modules settings/trimbits to a specific file
|
||||
@ -988,7 +997,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int saveSettingsFile(string fname, int imod=-1);
|
||||
int saveSettingsFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Loads the modules calibration data reading from a specific file (Mythen)
|
||||
@ -997,7 +1006,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int loadCalibrationFile(string fname, int imod=-1);
|
||||
int loadCalibrationFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Saves the modules calibration data to a specific file (Mythen)
|
||||
@ -1006,7 +1015,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int saveCalibrationFile(string fname, int imod=-1);
|
||||
int saveCalibrationFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Sets/gets the detector in position i as master of the structure (Mythen)
|
||||
@ -1069,6 +1078,12 @@ public:
|
||||
*/
|
||||
int stopAcquisition();
|
||||
|
||||
/**
|
||||
* Give an internal software trigger to the detector (Eiger only)
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int sendSoftwareTrigger();
|
||||
|
||||
/**
|
||||
* Start readout (without exposure or interrupting exposure) (Mythen)
|
||||
* @returns OK or FAIL
|
||||
@ -1149,9 +1164,10 @@ public:
|
||||
* Set/get timer value left in acquisition (not all implemented for all detectors)
|
||||
* @param index timer index
|
||||
* @param t time in ns or number of...(e.g. frames, gates, probes)
|
||||
* @param imod module number
|
||||
* @returns timer set value in ns or number of...(e.g. frames, gates, probes)
|
||||
*/
|
||||
int64_t getTimeLeft(timerIndex index);
|
||||
int64_t getTimeLeft(timerIndex index, int imod = -1);
|
||||
|
||||
/**
|
||||
* Set speed
|
||||
@ -1259,94 +1275,94 @@ public:
|
||||
* @param s network parameter value
|
||||
* @returns network parameter value set (from getNetworkParameter)
|
||||
*/
|
||||
string setNetworkParameter(networkParameter index, string value);
|
||||
std::string setNetworkParameter(networkParameter index, std::string value);
|
||||
|
||||
/**
|
||||
* Get network parameter
|
||||
* @param p network parameter type
|
||||
* @returns network parameter value set (from getNetworkParameter)
|
||||
*/
|
||||
string getNetworkParameter(networkParameter index);
|
||||
std::string getNetworkParameter(networkParameter index);
|
||||
|
||||
/**
|
||||
* Returns the detector MAC address\sa sharedSlsDetector
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
string getDetectorMAC();
|
||||
std::string getDetectorMAC();
|
||||
|
||||
/**
|
||||
* Returns the detector IP address\sa sharedSlsDetector
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
string getDetectorIP();
|
||||
std::string getDetectorIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver IP address\sa sharedSlsDetector
|
||||
* @returns the receiver IP address
|
||||
*/
|
||||
string getReceiver();
|
||||
std::string getReceiver();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP IP address\sa sharedSlsDetector
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
string getReceiverUDPIP();
|
||||
std::string getReceiverUDPIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP MAC address\sa sharedSlsDetector
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
string getReceiverUDPMAC();
|
||||
std::string getReceiverUDPMAC();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port\sa sharedSlsDetector
|
||||
* @returns the receiver UDP port
|
||||
*/
|
||||
string getReceiverUDPPort();
|
||||
std::string getReceiverUDPPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
|
||||
* @returns the receiver UDP port 2 of same interface
|
||||
*/
|
||||
string getReceiverUDPPort2();
|
||||
std::string getReceiverUDPPort2();
|
||||
|
||||
/**
|
||||
* Returns the client zmq port \sa sharedSlsDetector
|
||||
* @returns the client zmq port
|
||||
*/
|
||||
string getClientStreamingPort();
|
||||
std::string getClientStreamingPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq port \sa sharedSlsDetector
|
||||
* @returns the receiver zmq port
|
||||
*/
|
||||
string getReceiverStreamingPort();
|
||||
std::string getReceiverStreamingPort();
|
||||
|
||||
/**
|
||||
* Returns the client zmq ip \sa sharedSlsDetector
|
||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getClientStreamingIP();
|
||||
std::string getClientStreamingIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq ip \sa sharedSlsDetector
|
||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getReceiverStreamingIP();
|
||||
std::string getReceiverStreamingIP();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address and sets it \sa sharedSlsDetector
|
||||
* @param detectorMAC detector MAC address
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
string setDetectorMAC(string detectorMAC);
|
||||
std::string setDetectorMAC(std::string detectorMAC);
|
||||
|
||||
/**
|
||||
* Validates the format of the detector IP address and sets it \sa sharedSlsDetector
|
||||
* @param detectorIP detector IP address
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
string setDetectorIP(string detectorIP);
|
||||
std::string setDetectorIP(std::string detectorIP);
|
||||
|
||||
/**
|
||||
* Validates and sets the receiver.
|
||||
@ -1355,21 +1371,21 @@ public:
|
||||
* @param receiver receiver hostname or IP address
|
||||
* @returns the receiver IP address from shared memory
|
||||
*/
|
||||
string setReceiver(string receiver);
|
||||
std::string setReceiver(std::string receiver);
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP IP address and sets it \sa sharedSlsDetector
|
||||
* @param udpip receiver UDP IP address
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
string setReceiverUDPIP(string udpip);
|
||||
std::string setReceiverUDPIP(std::string udpip);
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP MAC address and sets it \sa sharedSlsDetector
|
||||
* @param udpmac receiver UDP MAC address
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
string setReceiverUDPMAC(string udpmac);
|
||||
std::string setReceiverUDPMAC(std::string udpmac);
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP port\sa sharedSlsDetector
|
||||
@ -1391,7 +1407,7 @@ public:
|
||||
* calculate individual ports)
|
||||
* @returns the client zmq port
|
||||
*/
|
||||
string setClientStreamingPort(string port);
|
||||
std::string setClientStreamingPort(std::string port);
|
||||
|
||||
/**
|
||||
* Sets the receiver zmq port\sa sharedSlsDetector
|
||||
@ -1399,21 +1415,21 @@ public:
|
||||
* calculate individual ports)
|
||||
* @returns the receiver zmq port
|
||||
*/
|
||||
string setReceiverStreamingPort(string port);
|
||||
std::string setReceiverStreamingPort(std::string port);
|
||||
|
||||
/**
|
||||
* Sets the client zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP client zmq ip
|
||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setClientStreamingIP(string sourceIP);
|
||||
std::string setClientStreamingIP(std::string sourceIP);
|
||||
|
||||
/**
|
||||
* Sets the receiver zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP receiver zmq ip. If empty, uses rx_hostname
|
||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setReceiverStreamingIP(string sourceIP);
|
||||
std::string setReceiverStreamingIP(std::string sourceIP);
|
||||
|
||||
/**
|
||||
* Execute a digital test (Gotthard, Mythen)
|
||||
@ -1439,7 +1455,7 @@ public:
|
||||
* @param fname file name from which to load image
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int loadImageToDetector(imageType index,string const fname);
|
||||
int loadImageToDetector(imageType index,std::string const fname);
|
||||
|
||||
/**
|
||||
* Called from loadImageToDetector to send the image to detector
|
||||
@ -1455,7 +1471,7 @@ public:
|
||||
* @param startACQ is 1 to start acquisition after reading counter
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeCounterBlockFile(string const fname,int startACQ=0);
|
||||
int writeCounterBlockFile(std::string const fname,int startACQ=0);
|
||||
|
||||
/**
|
||||
* Gets counter memory block in detector (Gotthard)
|
||||
@ -1519,11 +1535,18 @@ public:
|
||||
int writeAdcRegister(int addr, int val);
|
||||
|
||||
/**
|
||||
* Activates the detector (Eiger only)
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
* @param enable active (1) or inactive (0), -1 gets
|
||||
* @returns 0 (inactive) or 1 (active)
|
||||
* @returns 0 (inactive) or 1 (active)for activate mode
|
||||
*/
|
||||
int activate(int const enable=GET_ONLINE_FLAG);
|
||||
int activate(int const enable=-1);
|
||||
|
||||
/**
|
||||
* Set deactivated Receiver padding mode (Eiger only)
|
||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
||||
*/
|
||||
int setDeactivatedRxrPaddingMode(int padding=-1);
|
||||
|
||||
/**
|
||||
* Returns the enable if data will be flipped across x or y axis (Eiger)
|
||||
@ -1635,7 +1658,7 @@ public:
|
||||
* @param fname file name
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int programFPGA(string fname);
|
||||
int programFPGA(std::string fname);
|
||||
|
||||
/**
|
||||
* Resets FPGA (Jungfrau)
|
||||
@ -1822,7 +1845,7 @@ public:
|
||||
* @param fname name of the flat field file (or "" if disable)
|
||||
* @returns 0 if disable (or file could not be read), >0 otherwise
|
||||
*/
|
||||
int setFlatFieldCorrection(string fname="");
|
||||
int setFlatFieldCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set flat field corrections (Mythen)
|
||||
@ -1857,7 +1880,7 @@ public:
|
||||
* @param fname file with bad channel list ("" disable)
|
||||
* @returns 0 if bad channel disabled, >0 otherwise
|
||||
*/
|
||||
int setBadChannelCorrection(string fname="");
|
||||
int setBadChannelCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set bad channels correction (Mythen)
|
||||
@ -1882,7 +1905,7 @@ public:
|
||||
* @param fname file to be read
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversionFile(string fname="");
|
||||
int readAngularConversionFile(std::string fname="");
|
||||
|
||||
/**
|
||||
* Reads an angular conversion file (Mythen, Gotthard)
|
||||
@ -1890,7 +1913,7 @@ public:
|
||||
* @param ifs input stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversion(ifstream& ifs);
|
||||
int readAngularConversion(std::ifstream& ifs);
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
@ -1898,7 +1921,7 @@ public:
|
||||
* @param fname file to be written
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(string fname="");
|
||||
int writeAngularConversion(std::string fname="");
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
@ -1906,7 +1929,7 @@ public:
|
||||
* @param ofs output stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(ofstream &ofs);
|
||||
int writeAngularConversion(std::ofstream &ofs);
|
||||
|
||||
/**
|
||||
* Get angular conversion (Mythen, Gotthard)
|
||||
@ -1942,7 +1965,7 @@ public:
|
||||
* Checks if the receiver is really online
|
||||
* @returns empty string if online, else returns receiver hostname
|
||||
*/
|
||||
string checkReceiverOnline();
|
||||
std::string checkReceiverOnline();
|
||||
|
||||
/**
|
||||
* Configure the socket communication and initializes the socket instances
|
||||
@ -1951,7 +1974,7 @@ public:
|
||||
* @returns OK is connection succeded, FAIL otherwise
|
||||
* \sa sharedSlsDetector
|
||||
*/
|
||||
int setReceiverTCPSocket(string const name="", int const receiver_port=-1);
|
||||
int setReceiverTCPSocket(std::string const name="", int const receiver_port=-1);
|
||||
|
||||
/**
|
||||
* Locks/Unlocks the connection to the receiver
|
||||
@ -1964,7 +1987,7 @@ public:
|
||||
* Returns the IP of the last client connecting to the receiver
|
||||
* @returns the IP of the last client connecting to the receiver
|
||||
*/
|
||||
string getReceiverLastClientIP();
|
||||
std::string getReceiverLastClientIP();
|
||||
|
||||
/**
|
||||
* Exits the receiver TCP server
|
||||
@ -2005,27 +2028,27 @@ public:
|
||||
* Returns output file directory
|
||||
* @returns output file directory
|
||||
*/
|
||||
string getFilePath();
|
||||
std::string getFilePath();
|
||||
|
||||
/**
|
||||
* Sets up the file directory
|
||||
* @param s file directory
|
||||
* @returns file dir
|
||||
*/
|
||||
string setFilePath(string s="");
|
||||
std::string setFilePath(std::string s="");
|
||||
|
||||
/**
|
||||
* Returns file name prefix
|
||||
* @returns file name prefix
|
||||
*/
|
||||
string getFileName();
|
||||
std::string getFileName();
|
||||
|
||||
/**
|
||||
* Sets up the file name prefix
|
||||
* @param s file name prefix
|
||||
* @returns file name prefix
|
||||
*/
|
||||
string setFileName(string s="");
|
||||
std::string setFileName(std::string s="");
|
||||
|
||||
/**
|
||||
* Sets the max frames per file in receiver
|
||||
@ -2213,7 +2236,7 @@ public:
|
||||
* @param fname pattern file to open
|
||||
* @returns OK/FAIL
|
||||
*/
|
||||
int setCTBPattern(string fname);
|
||||
int setCTBPattern(std::string fname);
|
||||
|
||||
/**
|
||||
* Writes a pattern word to the CTB
|
||||
@ -2371,33 +2394,33 @@ private:
|
||||
* Returns the additional json header \sa sharedSlsDetector
|
||||
* @returns the additional json header, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getAdditionalJsonHeader();
|
||||
std::string getAdditionalJsonHeader();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP socket buffer size\sa sharedSlsDetector
|
||||
* @returns the receiver UDP socket buffer size
|
||||
*/
|
||||
string getReceiverUDPSocketBufferSize() ;
|
||||
std::string getReceiverUDPSocketBufferSize() ;
|
||||
|
||||
/**
|
||||
* Returns the receiver real UDP socket buffer size\sa sharedSlsDetector
|
||||
* @returns the receiver real UDP socket buffer size
|
||||
*/
|
||||
string getReceiverRealUDPSocketBufferSize();
|
||||
std::string getReceiverRealUDPSocketBufferSize();
|
||||
|
||||
/**
|
||||
* Sets the additional json header\sa sharedSlsDetector
|
||||
* @param jsonheader additional json header
|
||||
* @returns additional json header, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setAdditionalJsonHeader(string jsonheader);
|
||||
std::string setAdditionalJsonHeader(std::string jsonheader);
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP socket buffer size
|
||||
* @param udpsockbufsize additional json header
|
||||
* @returns receiver udp socket buffer size
|
||||
*/
|
||||
string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
|
||||
std::string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
|
||||
|
||||
/**
|
||||
* Sets the transmission delay for left, right or entire frame
|
||||
@ -2406,7 +2429,7 @@ private:
|
||||
* @param delay delay
|
||||
* @returns transmission delay
|
||||
*/
|
||||
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
std::string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -373,7 +373,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
virtual int64_t setTimer(timerIndex index, int64_t t=-1, int imod = -1)=0;
|
||||
int64_t setExposureTime(int64_t t=-1, int imod = -1){return setTimer(ACQUISITION_TIME,t,imod);};
|
||||
int64_t setSubFrameExposureTime(int64_t t=-1, int imod = -1){return setTimer(SUBFRAME_ACQUISITION_TIME,t,imod);};
|
||||
int64_t setSubFramePeriod(int64_t t=-1, int imod = -1){return setTimer(SUBFRAME_PERIOD,t,imod);};
|
||||
int64_t setSubFrameDeadTime(int64_t t=-1, int imod = -1){return setTimer(SUBFRAME_DEADTIME,t,imod);};
|
||||
int64_t setExposurePeriod(int64_t t=-1, int imod = -1){return setTimer(FRAME_PERIOD,t,imod);};
|
||||
int64_t setDelayAfterTrigger(int64_t t=-1, int imod = -1){return setTimer(DELAY_AFTER_TRIGGER,t,imod);};
|
||||
int64_t setNumberOfGates(int64_t t=-1, int imod = -1){return setTimer(GATES_NUMBER,t,imod);};
|
||||
@ -481,12 +481,19 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int setOnline(int const online=-1)=0;
|
||||
|
||||
/** @short activates the detector (detector specific)
|
||||
\param enable can be: -1 returns wether the detector is in active (1) or inactive (0) state
|
||||
\returns 0 (inactive) or 1 (active)
|
||||
*/
|
||||
virtual int activate(int const enable=GET_ONLINE_FLAG)=0;
|
||||
/**
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
* @param enable active (1) or inactive (0), -1 gets
|
||||
* @returns 0 (inactive) or 1 (active)for activate mode
|
||||
*/
|
||||
virtual int activate(int const enable=-1)=0;
|
||||
|
||||
/**
|
||||
* Set deactivated Receiver padding mode (Eiger only)
|
||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
||||
*/
|
||||
virtual int setDeactivatedRxrPaddingMode(int padding=-1)=0;
|
||||
|
||||
/**
|
||||
@short set detector settings
|
||||
@ -855,8 +862,8 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
}};
|
||||
|
||||
/** returns std::string from timer index
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_PERIOD
|
||||
\returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, subframe_period
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_DEADTIME
|
||||
\returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, SUBFRAME_DEADTIME
|
||||
*/
|
||||
static std::string getTimerType(timerIndex t){ \
|
||||
switch (t) { \
|
||||
@ -875,7 +882,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
case FRAMES_FROM_START_PG: return std::string("frames_from_start_pg"); \
|
||||
case SAMPLES_JCTB: return std::string("samples_jctb"); \
|
||||
case SUBFRAME_ACQUISITION_TIME: return std::string("subframe_acquisition_time"); \
|
||||
case SUBFRAME_PERIOD: return std::string("subframe_period"); \
|
||||
case SUBFRAME_DEADTIME: return std::string("subframe_deadtime"); \
|
||||
case STORAGE_CELL_NUMBER: return std::string("storage_cell_number"); \
|
||||
default: return std::string("unknown"); \
|
||||
}};
|
||||
@ -887,17 +894,17 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
\returns TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL,
|
||||
TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3, -1 when unknown mode
|
||||
*/
|
||||
static int getADCIndex(std::string s){
|
||||
if (s=="temp_fpga") return TEMPERATURE_FPGA;
|
||||
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT;
|
||||
if (s=="temp_10ge") return TEMPERATURE_10GE;
|
||||
if (s=="temp_dcdc") return TEMPERATURE_DCDC;
|
||||
if (s=="temp_sodl") return TEMPERATURE_SODL;
|
||||
if (s=="temp_sodr") return TEMPERATURE_SODR;
|
||||
if (s=="temp_fpgafl") return TEMPERATURE_FPGA2;
|
||||
if (s=="temp_fpgafr") return TEMPERATURE_FPGA3;
|
||||
return -1;
|
||||
};
|
||||
static int getADCIndex(std::string s){ \
|
||||
if (s=="temp_fpga") return TEMPERATURE_FPGA; \
|
||||
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT; \
|
||||
if (s=="temp_10ge") return TEMPERATURE_10GE; \
|
||||
if (s=="temp_dcdc") return TEMPERATURE_DCDC; \
|
||||
if (s=="temp_sodl") return TEMPERATURE_SODL; \
|
||||
if (s=="temp_sodr") return TEMPERATURE_SODR; \
|
||||
if (s=="temp_fpgafl") return TEMPERATURE_FPGA2; \
|
||||
if (s=="temp_fpgafr") return TEMPERATURE_FPGA3; \
|
||||
return -1; \
|
||||
}; \
|
||||
|
||||
|
||||
/**
|
||||
@ -905,19 +912,43 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
\param s can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp
|
||||
\returns E_Vcmp_ll, E_Vcmp_lr, E_Vcmp_rl, E_Vcmp_rr, THRESHOLD, E_Vrf, E_Vrs, E_Vtr, E_cal, E_Vcp , -1 when unknown mode
|
||||
*/
|
||||
static int getDACIndex(std::string s){
|
||||
if (s=="vcmp_ll") return E_Vcmp_ll;
|
||||
if (s=="vcmp_lr") return E_Vcmp_lr;
|
||||
if (s=="vcmp_rl") return E_Vcmp_rl;
|
||||
if (s=="vcmp_rr") return E_Vcmp_rr;
|
||||
if (s=="vthreshold") return THRESHOLD;
|
||||
if (s=="vrf") return E_Vrf;
|
||||
if (s=="vrs") return E_Vrs;
|
||||
if (s=="vtr") return E_Vtr;
|
||||
if (s=="vcall") return E_cal;
|
||||
if (s=="vcp") return E_Vcp;
|
||||
return -1;
|
||||
};
|
||||
static int getDACIndex(std::string s){ \
|
||||
if (s=="vcmp_ll") return E_Vcmp_ll; \
|
||||
if (s=="vcmp_lr") return E_Vcmp_lr; \
|
||||
if (s=="vcmp_rl") return E_Vcmp_rl; \
|
||||
if (s=="vcmp_rr") return E_Vcmp_rr; \
|
||||
if (s=="vthreshold") return THRESHOLD; \
|
||||
if (s=="vrf") return E_Vrf; \
|
||||
if (s=="vrs") return E_Vrs; \
|
||||
if (s=="vtr") return E_Vtr; \
|
||||
if (s=="vcall") return E_cal; \
|
||||
if (s=="vcp") return E_Vcp; \
|
||||
return -1; \
|
||||
}; \
|
||||
|
||||
/**
|
||||
@short returns receiver frame discard policy from std::string
|
||||
\param s can be nodiscard, discardempty, discardpartial
|
||||
\returns NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES, GET_FRAME_DISCARD_POLICY when unknown mode
|
||||
*/
|
||||
static frameDiscardPolicy getReceiverFrameDiscardPolicy(std::string s){ \
|
||||
if (s=="nodiscard") return NO_DISCARD; \
|
||||
if (s=="discardempty") return DISCARD_EMPTY_FRAMES; \
|
||||
if (s=="discardpartial") return DISCARD_PARTIAL_FRAMES; \
|
||||
return GET_FRAME_DISCARD_POLICY; \
|
||||
}; \
|
||||
|
||||
/** returns std::string from frame discard policy
|
||||
\param f can be NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
|
||||
\returns std::string nodiscard, discardempty, discardpartial, unknown
|
||||
*/
|
||||
static std::string getReceiverFrameDiscardPolicy(frameDiscardPolicy f){ \
|
||||
switch (f) { \
|
||||
case NO_DISCARD: return std::string("nodiscard"); \
|
||||
case DISCARD_EMPTY_FRAMES: return std::string("discardempty"); \
|
||||
case DISCARD_PARTIAL_FRAMES: return std::string("discardpartial"); \
|
||||
default: return std::string("unknown"); \
|
||||
}}; \
|
||||
|
||||
|
||||
};
|
||||
|
@ -44,6 +44,12 @@ To address a specific controller i of detector j use:
|
||||
|
||||
<b>sls_detector_clnt j-i:cmd</b>
|
||||
|
||||
|
||||
To use different shared memory segements for different detectors on the same
|
||||
client pc, one can use environment variable <b>SLSDETNAME</b> set to any string to
|
||||
different strings to make the shared memory segments unique. One can then use
|
||||
the same multi detector id for both detectors as they have a different shared memory names.
|
||||
|
||||
For additional questions concerning the indexing of the detector, please refer to the SLS Detectors FAQ documentation.
|
||||
|
||||
The commands are sudivided into different pages depending on their functionalities:
|
||||
@ -193,7 +199,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
++i;
|
||||
|
||||
/*! \page acquisition
|
||||
- <b> status [s] </b> starts or stops acquisition in detector in non blocking mode. When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). \c s: [\c start, \c stop]. \c Returns the detector status: [\c running, \c error, \c transmitting, \c finished, \c waiting, \c idle]. \c Returns \c (string)
|
||||
- <b> status [s] </b> starts or stops acquisition in detector in non blocking mode. When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). Eiger can also provide an internal software trigger. \c s: [\c start, \c stop, \c trigger(EIGER only)]. \c Returns the detector status: [\c running, \c error, \c transmitting, \c finished, \c waiting, \c idle]. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="status"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdStatus;
|
||||
@ -324,7 +330,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdOnline;
|
||||
++i;
|
||||
/*! \page config
|
||||
- <b>activate</b> Activates/Deactivates the detector. Deactivated detector does not send data. Used for EIGER only. \c Returns \c (int)
|
||||
- <b>activate [b] [p]</b> Activates/Deactivates the detector. \c b is 1 for activate, 0 for deactivate. Deactivated detector does not send data. \c p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Used for EIGER only. \c Returns \c (int) (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="activate"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdOnline;
|
||||
@ -501,7 +507,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
*/
|
||||
|
||||
/*! \page config
|
||||
- <b>checkdetversion</b> Checks the version compatibility with detector software (if hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
- <b>checkdetversion</b> Checks the version compatibility with detector server (if hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="checkdetversion"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSN;
|
||||
@ -509,7 +515,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
|
||||
|
||||
/*! \page config
|
||||
- <b>checkrecversion</b> Checks the version compatibility with receiver software (if rx_hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
- <b>checkrecversion</b> Checks the version compatibility with receiver server (if rx_hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="checkrecversion"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSN;
|
||||
@ -598,9 +604,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>subperiod [i]</b> sets/gets sub frame period in s. Used in EIGER only in 32 bit mode. \c Returns \c (double with 9 decimal digits)
|
||||
- <b>subdeadtime [i]</b> sets/gets sub frame dead time in s. Subperiod is set in the detector = subexptime + subdeadtime. This value is normally a constant in the config file. Used in EIGER only in 32 bit mode. \c Returns \c (double with 9 decimal digits)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="subperiod"; //
|
||||
descrToFuncMap[i].m_pFuncName="subdeadtime"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
++i;
|
||||
|
||||
@ -654,14 +660,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>storagecells [i]</b> sets/gets number of storage cells per acquisition. For very advanced users only! For JUNGFRAU only. Range: 0-15. The #images = #frames * #cycles * (#storagecells +1). \c Returns \c (long long int)
|
||||
- <b>storagecells [i]</b> sets/gets number of additional storage cells per acquisition. For very advanced users only! For JUNGFRAU only. Range: 0-15. The #images = #frames * #cycles * (#storagecells +1). \c Returns \c (long long int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="storagecells"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>storagecell_start [i]</b> sets/gets the storage cell that stores the first acquisition of the series. Default is 0. For very advanced users only! For JUNGFRAU only. Range: 0-15. \c Returns \c (int)
|
||||
- <b>storagecell_start [i]</b> sets/gets the storage cell that stores the first acquisition of the series. Default is 15(0xf).. For very advanced users only! For JUNGFRAU only. Range: 0-15. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="storagecell_start"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
@ -743,6 +749,20 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>measuredperiod</b> gets the measured frame period (time between last frame and the previous one) in s. For Eiger only. Makes sense only for acquisitions of more than 1 frame. \c Returns \c (double with 9 decimal digits)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="measuredperiod"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>measuredsubperiod</b> gets the measured subframe period (time between last subframe and the previous one) in s. For Eiger only and in 32 bit mode. \c Returns \c (double with 9 decimal digits)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="measuredsubperiod"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||
++i;
|
||||
|
||||
/* speed */
|
||||
/*! \page config
|
||||
\section configspeed Speed
|
||||
@ -2243,21 +2263,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
++i;
|
||||
|
||||
/*! \page receiver
|
||||
- <b>r_framesperfile</b> sets/gets the frames per file in receiver. 0 means infinite or all frames in a single file. \c Returns \c (int)
|
||||
- <b>r_framesperfile [i]</b> sets/gets the frames per file in receiver to i. 0 means infinite or all frames in a single file. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="r_framesperfile"; //OK
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||
++i;
|
||||
|
||||
/*! \page receiver
|
||||
- <b>r_framesperfile</b> sets/gets the frames per file in receiver. 0 means infinite or all frames in a single file. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="r_framesperfile"; //OK
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||
++i;
|
||||
|
||||
/*! \page receiver
|
||||
- <b>r_discardpolicy</b> sets/gets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest). \c Returns \c (int)
|
||||
- <b>r_discardpolicy</b> sets/gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="r_discardpolicy"; //OK
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||
@ -2652,9 +2665,12 @@ string slsDetectorCommand::cmdStatus(int narg, char *args[], int action) {
|
||||
if (string(args[1])=="start")
|
||||
myDet->startAcquisition();
|
||||
else if (string(args[1])=="stop") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);//restream stop
|
||||
myDet->stopAcquisition();
|
||||
}
|
||||
else if (string(args[1])=="trigger") {
|
||||
myDet->sendSoftwareTrigger();
|
||||
}
|
||||
else
|
||||
return string("unknown action");
|
||||
}
|
||||
@ -2686,7 +2702,7 @@ string slsDetectorCommand::helpStatus(int narg, char *args[], int action) {
|
||||
os << string("busy \t gets the status of acquire- can be: 0 or 1. 0 for idle, 1 for running\n");
|
||||
}
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << string("status \t controls the detector acquisition - can be start or stop. When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). \n");
|
||||
os << string("status \t controls the detector acquisition - can be start or stop or trigger(EIGER only). When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). Eiger can also provide an internal software trigger\n");
|
||||
os << string("busy i\t sets the status of acquire- can be: 0(idle) or 1(running).Command Acquire sets it to 1 at beignning of acquire and back to 0 at the end. Clear Flag for unexpected acquire terminations. \n");
|
||||
}
|
||||
return os.str();
|
||||
@ -4360,11 +4376,20 @@ string slsDetectorCommand::cmdOnline(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION) {
|
||||
if (!sscanf(args[1],"%d",&ival))
|
||||
return string("Could not scan activate mode ")+string(args[1]);
|
||||
/* if(dynamic_cast<slsDetector*>(myDet) != NULL)
|
||||
return string("Can only set it from the multiDetector mode");*/
|
||||
myDet->activate(ival);
|
||||
bool padding = true;
|
||||
if (narg > 2) {
|
||||
if (string(args[2]) == "padding")
|
||||
padding = true;
|
||||
else if (string(args[2]) == "nopadding")
|
||||
padding = false;
|
||||
else
|
||||
return string ("Could not scan activate mode's padding option " + string(args[2]));
|
||||
myDet->setDeactivatedRxrPaddingMode(padding);
|
||||
}
|
||||
}
|
||||
sprintf(ans,"%d",myDet->activate());
|
||||
int ret = myDet->setDeactivatedRxrPaddingMode();
|
||||
sprintf(ans,"%d %s", myDet->activate(), ret == 1 ? "padding" : (ret == 0 ? "nopadding" : "unknown"));
|
||||
}
|
||||
else if(cmd=="r_online"){
|
||||
if (action==PUT_ACTION) {
|
||||
@ -4395,14 +4420,14 @@ string slsDetectorCommand::helpOnline(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "online i \n sets the detector in online (1) or offline (0) mode"<< std::endl;
|
||||
os << "r_online i \n sets the receiver in online (1) or offline (0) mode"<< std::endl;
|
||||
os << "activate i \n sets the detector in activated (1) or deactivated (0) mode (does not send data). Only for Eiger."<< std::endl;
|
||||
os << "activate i [p]\n sets the detector in activated (1) or deactivated (0) mode (does not send data). p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Only for Eiger."<< std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "online \n gets the detector online (1) or offline (0) mode"<< std::endl;
|
||||
os << "checkonline \n returns the hostnames of all detectors in offline mode"<< std::endl;
|
||||
os << "r_online \n gets the receiver online (1) or offline (0) mode"<< std::endl;
|
||||
os << "r_checkonline \n returns the hostnames of all receiver in offline mode"<< std::endl;
|
||||
os << "activate \n gets the detector activated (1) or deactivated (0) mode. Only for Eiger."<< std::endl;
|
||||
os << "activate \n gets the detector activated (1) or deactivated (0) mode. And padding or nonpadding for the deactivated receiver. Only for Eiger."<< std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
@ -4453,6 +4478,9 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
if (cmd == "roi")
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
if (cmd=="maxmod")
|
||||
return string("cannot put!");
|
||||
@ -4468,13 +4496,13 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
if ((val<0) || (narg!=((val*4)+2)) )
|
||||
return helpDetectorSize(narg,args,action);
|
||||
ROI allroi[val];
|
||||
pos=1;
|
||||
// std::cout << val << std::endl;
|
||||
for(i=0;i<val;i++){
|
||||
if ((!sscanf(args[++pos],"%d",&allroi[i].xmin)) ||
|
||||
(!sscanf(args[++pos],"%d",&allroi[i].xmax)) ||
|
||||
(!sscanf(args[++pos],"%d",&allroi[i].ymin)) ||
|
||||
(!sscanf(args[++pos],"%d",&allroi[i].ymax)) )
|
||||
// pos=1;
|
||||
pos=2;
|
||||
for(i=0;i<val;++i){
|
||||
if ((!sscanf(args[pos++],"%d",&allroi[i].xmin)) ||
|
||||
(!sscanf(args[pos++],"%d",&allroi[i].xmax)) ||
|
||||
(!sscanf(args[pos++],"%d",&allroi[i].ymin)) ||
|
||||
(!sscanf(args[pos++],"%d",&allroi[i].ymax)) )
|
||||
return string("cannot parse arguments for roi");
|
||||
}
|
||||
myDet->setROI(val,allroi);
|
||||
@ -4520,7 +4548,9 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
ret=myDet->setDynamicRange(val);
|
||||
} else if (cmd=="roi") {
|
||||
myDet->getROI(ret);
|
||||
ROI* r = myDet->getROI(ret);
|
||||
if (myDet->isMultiSlsDetectorClass() && r != NULL)
|
||||
delete [] r;
|
||||
} else if (cmd=="detsizechan") {
|
||||
sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y));
|
||||
return string(ans);
|
||||
@ -4874,8 +4904,8 @@ string slsDetectorCommand::helpSN(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "checkdetversion \n gets the version compatibility with detector software (if hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible."<< std::endl;
|
||||
os << "checkrecversion \n gets the version compatibility with receiver software (if rx_hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible."<< std::endl;
|
||||
os << "checkdetversion \n gets the version compatibility with detector server (if hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible."<< std::endl;
|
||||
os << "checkrecversion \n gets the version compatibility with receiver server (if rx_hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible."<< std::endl;
|
||||
os << "moduleversion:i \n gets the firmwareversion of the module i"<< std::endl;
|
||||
os << "modulenumber:i \n gets the serial number of the module i"<< std::endl;
|
||||
os << "detectornumber \n gets the serial number of the detector (MAC)"<< std::endl;
|
||||
@ -5649,8 +5679,8 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
index=SUBFRAME_ACQUISITION_TIME;
|
||||
else if (cmd=="period")
|
||||
index=FRAME_PERIOD;
|
||||
else if (cmd=="subperiod")
|
||||
index=SUBFRAME_PERIOD;
|
||||
else if (cmd=="subdeadtime")
|
||||
index=SUBFRAME_DEADTIME;
|
||||
else if (cmd=="delay")
|
||||
index=DELAY_AFTER_TRIGGER;
|
||||
else if (cmd=="gates")
|
||||
@ -5689,7 +5719,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
return string("cannot scan timer value ")+string(args[1]);
|
||||
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME ||
|
||||
index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER ||
|
||||
index == SUBFRAME_PERIOD) {
|
||||
index == SUBFRAME_DEADTIME) {
|
||||
// +0.5 for precision of eg.0.0000325
|
||||
t = ( val * 1E9 + 0.5);
|
||||
}else t=(int64_t)val;
|
||||
@ -5703,7 +5733,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
|
||||
if ((ret!=-1) && (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME
|
||||
|| index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER ||
|
||||
index == SUBFRAME_PERIOD)) {
|
||||
index == SUBFRAME_DEADTIME)) {
|
||||
rval=(double)ret*1E-9;
|
||||
sprintf(answer,"%0.9f",rval);
|
||||
}
|
||||
@ -5731,8 +5761,8 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
||||
os << "probes t \t sets the number of probes to accumulate (max 3! cycles should be set to 1, frames to the number of pump-probe events)" << std::endl;
|
||||
os << "samples t \t sets the number of samples expected from the jctb" << std::endl;
|
||||
os << "storagecells t \t sets number of storage cells per acquisition. For very advanced users only! For JUNGFRAU only. Range: 0-15. The #images = #frames * #cycles * (#storagecells+1)." << std::endl;
|
||||
os << "storagecell_start t \t sets the storage cell that stores the first acquisition of the series. Default is 0. For very advanced users only! For JUNGFRAU only. Range: 0-15." << std::endl;
|
||||
os << "subperiod t \t sets sub frame period in s. Used in EIGER only in 32 bit mode. " << std::endl;
|
||||
os << "storagecell_start t \t sets the storage cell that stores the first acquisition of the series. Default is 15(0xf). For very advanced users only! For JUNGFRAU only. Range: 0-15." << std::endl;
|
||||
os << "subdeadtime t \t sets sub frame dead time in s. Subperiod is set in the detector = subexptime + subdeadtime. This value is normally a constant in the config file. Used in EIGER only in 32 bit mode. " << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
|
||||
@ -5749,7 +5779,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
||||
os << "samples \t gets the number of samples expected from the jctb" << std::endl;
|
||||
os << "storagecells \t gets number of storage cells per acquisition.For JUNGFRAU only." << std::endl;
|
||||
os << "storagecell_start \t gets the storage cell that stores the first acquisition of the series." << std::endl;
|
||||
os << "subperiod \t gets sub frame period in s. Used in EIGER in 32 bit only." << std::endl;
|
||||
os << "subperiod \t gets sub frame dead time in s. Used in EIGER in 32 bit only." << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
}
|
||||
@ -5796,6 +5826,10 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
|
||||
index=MEASUREMENT_TIME;
|
||||
else if (cmd=="nframes")
|
||||
index=FRAMES_FROM_START;
|
||||
else if (cmd=="measuredperiod")
|
||||
index=MEASURED_PERIOD;
|
||||
else if (cmd=="measuredsubperiod")
|
||||
index=MEASURED_SUBPERIOD;
|
||||
else
|
||||
return string("could not decode timer ")+cmd;
|
||||
|
||||
@ -5805,13 +5839,13 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
ret=myDet->getTimeLeft(index);
|
||||
|
||||
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER || index==ACTUAL_TIME || index==MEASUREMENT_TIME)
|
||||
if ((ret!=-1) && (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER
|
||||
|| index==ACTUAL_TIME || index==MEASUREMENT_TIME ||
|
||||
MEASURED_PERIOD || MEASURED_SUBPERIOD))
|
||||
rval=(double)ret*1E-9;
|
||||
else rval=ret;
|
||||
|
||||
@ -5839,6 +5873,8 @@ string slsDetectorCommand::helpTimeLeft(int narg, char *args[], int action) {
|
||||
os << "framesl \t gets the number of frames left" << std::endl;
|
||||
os << "cyclesl \t gets the number of cycles left" << std::endl;
|
||||
os << "probesl \t gets the number of probes left" << std::endl;
|
||||
os << "measuredperiod \t gets the measured frame period (time between last frame and the previous one) in s. For Eiger only. Makes sense only for acquisitions of more than 1 frame." << std::endl;
|
||||
os << "measuredsubperiod \t gets the measured subframe period (time between last subframe and the previous one) in s. For Eiger only and in 32 bit mode." << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
}
|
||||
@ -6409,14 +6445,12 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
|
||||
else if(cmd=="r_discardpolicy") {
|
||||
if (action==PUT_ACTION){
|
||||
if (sscanf(args[1],"%d",&ival) && (ival >= 0) && (ival < NUM_DISCARD_POLICIES)) {
|
||||
myDet->setReceiverFramesDiscardPolicy((frameDiscardPolicy)ival);
|
||||
} else return string("could not scan frames discard policy\n");
|
||||
frameDiscardPolicy f = myDet->getReceiverFrameDiscardPolicy(string(args[1]));
|
||||
if (f == GET_FRAME_DISCARD_POLICY)
|
||||
return string("could not scan frame discard policy. Options: nodiscard, discardempty, discardpartial\n");
|
||||
myDet->setReceiverFramesDiscardPolicy(f);
|
||||
}
|
||||
char answer[100];
|
||||
memset(answer, 0, 100);
|
||||
sprintf(answer,"%d",myDet->setReceiverFramesDiscardPolicy());
|
||||
return string(answer);
|
||||
return myDet->getReceiverFrameDiscardPolicy(myDet->setReceiverFramesDiscardPolicy());
|
||||
}
|
||||
|
||||
else if(cmd=="r_padding") {
|
||||
@ -6450,7 +6484,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
|
||||
os << "rx_fifodepth [val]\t sets receiver fifo depth to val" << std::endl;
|
||||
os << "r_silent [i]\t sets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets." << std::endl;
|
||||
os << "r_framesperfile s\t sets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
||||
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest)." << std::endl;
|
||||
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
||||
os << "r_padding s\t enables/disables partial frames to be padded in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION){
|
||||
@ -6462,7 +6496,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
|
||||
os << "rx_fifodepth \t returns receiver fifo depth" << std::endl;
|
||||
os << "r_silent \t returns receiver silent mode enable. 1 is silent, 0 not silent." << std::endl;
|
||||
os << "r_framesperfile \t gets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
||||
os << "r_discardpolicy \t gets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest)." << std::endl;
|
||||
os << "r_discardpolicy \t gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
||||
os << "r_padding \t gets partial frames padding enable in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
@ -7014,7 +7048,8 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
||||
}
|
||||
}
|
||||
os << hex << reg << dec;
|
||||
|
||||
if (myDet->isMultiSlsDetectorClass() && aa != NULL)
|
||||
delete [] aa;
|
||||
|
||||
//os <<" "<< hex << myDet->readRegister(120) << dec;
|
||||
|
||||
|
@ -6,26 +6,28 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
slsDetectorUsers::slsDetectorUsers(int id) : myDetector(NULL){
|
||||
slsDetectorUsers::slsDetectorUsers(int& ret, int id) : myDetector(0), myCmd(0){
|
||||
try {
|
||||
myDetector=new multiSlsDetector(id);
|
||||
} catch(...) {
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
myCmd=new multiSlsDetectorCommand(myDetector);
|
||||
ret = 0;
|
||||
|
||||
myDetector=new multiSlsDetector(id);
|
||||
myCmd=new multiSlsDetectorCommand(myDetector);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
slsDetectorUsers::~slsDetectorUsers() {
|
||||
if (myDetector)
|
||||
delete myDetector;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
string slsDetectorUsers::getDetectorDeveloper(){
|
||||
return myDetector->getDetectorDeveloper();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetectorUsers::setOnline(int const online){
|
||||
return myDetector->setOnline(online);
|
||||
}
|
||||
@ -42,7 +44,6 @@ int slsDetectorUsers::stopMeasurement(){
|
||||
return myDetector->stopAcquisition();
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUsers::getDetectorStatus(){
|
||||
return (int)myDetector->getRunStatus();
|
||||
}
|
||||
@ -51,12 +52,10 @@ string slsDetectorUsers::getFilePath(){
|
||||
return myDetector->getFilePath();
|
||||
}
|
||||
|
||||
|
||||
string slsDetectorUsers::setFilePath(string s){
|
||||
return myDetector->setFilePath(s);
|
||||
}
|
||||
|
||||
|
||||
string slsDetectorUsers::getFileName(){
|
||||
return myDetector->getFileName();
|
||||
}
|
||||
@ -83,7 +82,7 @@ string slsDetectorUsers::setFlatFieldCorrectionDir(string dir){
|
||||
|
||||
string slsDetectorUsers::getFlatFieldCorrectionFile(){
|
||||
return myDetector->getFlatFieldCorrectionFile();
|
||||
};
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setFlatFieldCorrectionFile(string fname){
|
||||
return myDetector->setFlatFieldCorrectionFile(fname);
|
||||
@ -116,17 +115,37 @@ int slsDetectorUsers::getPositions(double *pos){
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setDetectorSize(int x0, int y0, int nx, int ny){
|
||||
if(myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y)>1)
|
||||
return 1;
|
||||
int nmod=nx/(myDetector->getChansPerMod(0));
|
||||
cout << myDetector->getChansPerMod(0) << " " << nx << " " << nmod << endl;
|
||||
return myDetector->setNumberOfModules(nmod)*myDetector->getChansPerMod(0);}
|
||||
// only one roi
|
||||
slsDetectorDefs::ROI roi[1];
|
||||
roi[0].xmin = x0;
|
||||
roi[0].ymin = y0;
|
||||
roi[0].xmax = x0 + nx;
|
||||
roi[0].ymax = y0 + ny;
|
||||
return myDetector->setROI(1, roi);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::getDetectorSize(int &x0, int &y0, int &nx, int &ny){
|
||||
y0=0;
|
||||
x0=0;
|
||||
nx=myDetector->getTotalNumberOfChannels(slsDetectorDefs::X);
|
||||
ny=myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y);
|
||||
int n = 0;
|
||||
slsDetectorDefs::ROI* roi = myDetector->getROI(n);
|
||||
|
||||
// roi
|
||||
if (roi != NULL && n > 0) {
|
||||
x0 = roi[0].xmin;
|
||||
y0 = roi[0].ymin;
|
||||
nx = roi[0].xmax - roi[0].xmin;
|
||||
ny = roi[0].ymax - roi[0].ymin;
|
||||
}
|
||||
// no roi
|
||||
else {
|
||||
y0=0;
|
||||
x0=0;
|
||||
nx=myDetector->getTotalNumberOfChannels(slsDetectorDefs::X);
|
||||
ny=myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y);
|
||||
}
|
||||
|
||||
if (roi != NULL)
|
||||
delete [] roi;
|
||||
|
||||
return nx*ny;
|
||||
}
|
||||
|
||||
@ -140,7 +159,6 @@ int slsDetectorUsers::setBitDepth(int i){
|
||||
return myDetector->setDynamicRange(i);
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUsers::setSettings(int isettings){
|
||||
return myDetector->slsDetectorBase::setSettings(isettings);
|
||||
}
|
||||
@ -160,43 +178,40 @@ int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int id
|
||||
double slsDetectorUsers::setExposureTime(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setExposureTime((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setExposureTime(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setExposureTime(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setExposurePeriod((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setExposurePeriod(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setExposurePeriod(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setDelayAfterTrigger((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setDelayAfterTrigger(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setDelayAfterTrigger(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::setNumberOfGates(int64_t t, int imod){
|
||||
@ -300,6 +315,44 @@ int slsDetectorUsers::enableGapPixels(int enable) {
|
||||
return myDetector->enableGapPixels(enable);
|
||||
}
|
||||
|
||||
std::string slsDetectorUsers::setReceiverFramesDiscardPolicy(std::string f) {
|
||||
return myDetector->getReceiverFrameDiscardPolicy(
|
||||
myDetector->setReceiverFramesDiscardPolicy(
|
||||
myDetector->getReceiverFrameDiscardPolicy(f)));
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setReceiverPartialFramesPadding(int f) {
|
||||
return myDetector->setReceiverPartialFramesPadding(f);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setReceiverFramesPerFile(int f) {
|
||||
return myDetector->setReceiverFramesPerFile(f);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::sendSoftwareTrigger() {
|
||||
return myDetector->sendSoftwareTrigger();
|
||||
}
|
||||
|
||||
double slsDetectorUsers::getMeasuredPeriod(bool inseconds, int imod) {
|
||||
if(!inseconds)
|
||||
return myDetector->getTimeLeft(slsReceiverDefs::MEASURED_PERIOD, imod);
|
||||
|
||||
int64_t tms = myDetector->getTimeLeft(slsReceiverDefs::MEASURED_PERIOD, imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
double slsDetectorUsers::getMeasuredSubFramePeriod(bool inseconds, int imod) {
|
||||
if(!inseconds)
|
||||
return myDetector->getTimeLeft(slsReceiverDefs::MEASURED_SUBPERIOD, imod);
|
||||
|
||||
int64_t tms = myDetector->getTimeLeft(slsReceiverDefs::MEASURED_SUBPERIOD, imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg){
|
||||
myDetector->registerDataCallback(userCallback,pArg);
|
||||
}
|
||||
@ -337,8 +390,6 @@ void slsDetectorUsers::registerGetI0Callback( double (*func)(int,void*),void *ar
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
string slsDetectorUsers::putCommand(int narg, char *args[], int pos){
|
||||
if(narg < 2)
|
||||
return string("Error: Insufficient Parameters");
|
||||
@ -352,8 +403,6 @@ string slsDetectorUsers::getCommand(int narg, char *args[], int pos){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetectorUsers::setClockDivider(int value) {
|
||||
return myDetector->setClockDivider(value);
|
||||
}
|
||||
@ -402,7 +451,6 @@ int slsDetectorUsers::stopAcquisition() {
|
||||
return myDetector->stopAcquisition();
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUsers::setReceiverSilentMode(int i) {
|
||||
return myDetector->setReceiverSilentMode(i);
|
||||
}
|
||||
@ -431,21 +479,38 @@ int slsDetectorUsers::getNMods() {
|
||||
return myDetector->getNMods();
|
||||
}
|
||||
|
||||
double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds){
|
||||
int64_t tms = (int64_t)(t * (1E+9));
|
||||
if (t < 0) tms = -1;
|
||||
if(!inseconds)
|
||||
return myDetector->setSubFrameExposureTime((int64_t)t);
|
||||
else
|
||||
return ((1E-9) * (double)myDetector->setSubFrameExposureTime(tms));
|
||||
double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setSubFrameExposureTime((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setSubFrameExposureTime(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
}
|
||||
|
||||
double slsDetectorUsers::setSubFrameExposurePeriod(double t, bool inseconds){
|
||||
int64_t tms = (int64_t)(t * (1E+9));
|
||||
if (t < 0) tms = -1;
|
||||
if(!inseconds)
|
||||
return myDetector->setSubFramePeriod((int64_t)t);
|
||||
else
|
||||
return ((1E-9) * (double)myDetector->setSubFramePeriod(tms));
|
||||
double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setSubFrameDeadTime((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setSubFrameDeadTime(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::setNumberOfStorageCells(int64_t t, int imod) {
|
||||
return myDetector->setTimer(slsReceiverDefs::STORAGE_CELL_NUMBER, t, imod);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setStoragecellStart(int pos) {
|
||||
return myDetector->setStoragecellStart(pos);
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ class multiSlsDetectorCommand;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
\mainpage
|
||||
<CENTER><H1>API for SLS detectors data acquisition</H1></CENTER>
|
||||
@ -72,12 +71,11 @@ You can find examples of how this classes can be instatiated in mainClient.cpp
|
||||
|
||||
|
||||
*/
|
||||
/**
|
||||
|
||||
@libdoc The slsDetectorUsers class is a minimal interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration or parameters file that can be read/written.
|
||||
*/
|
||||
/**
|
||||
@short Class for detector functionalities to embed the detector controls in the users custom interface e.g. EPICS, Lima etc.
|
||||
@short The slsDetectorUsers class is a minimal interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration or parameters file that can be read/written.
|
||||
|
||||
Class for detector functionalities to embed the detector controls in the users custom interface e.g. EPICS, Lima etc.
|
||||
|
||||
*/
|
||||
|
||||
@ -87,23 +85,22 @@ class slsDetectorUsers
|
||||
|
||||
public:
|
||||
|
||||
/** @short default constructor */
|
||||
slsDetectorUsers(int id=0);
|
||||
|
||||
/** @short default constructor
|
||||
* @param ret address of return value. It will be set to 0 for success, else 1 for failure
|
||||
* @param id multi detector id
|
||||
* in creating multidetector object
|
||||
*/
|
||||
slsDetectorUsers(int& ret, int id=0);
|
||||
|
||||
/** @short virtual destructor */
|
||||
virtual ~slsDetectorUsers();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@short useful to define subset of working functions
|
||||
\returns "PSI" or "Dectris"
|
||||
*/
|
||||
std::string getDetectorDeveloper();
|
||||
|
||||
|
||||
|
||||
/** @short sets the onlineFlag
|
||||
\param online can be: -1 returns wether the detector is in online (1) or offline (0) state; 0 detector in offline state; 1 detector in online state
|
||||
\returns 0 (offline) or 1 (online)
|
||||
@ -250,7 +247,7 @@ class slsDetectorUsers
|
||||
int getPositions(double *pos=NULL);
|
||||
|
||||
/**
|
||||
@short sets the detector size
|
||||
@short sets the detector size (only 1 ROI) (not Mythen supported anymore)
|
||||
\param x0 horizontal position origin in channel number (-1 unchanged)
|
||||
\param y0 vertical position origin in channel number (-1 unchanged)
|
||||
\param nx number of channels in horiziontal (-1 unchanged)
|
||||
@ -261,18 +258,16 @@ class slsDetectorUsers
|
||||
|
||||
|
||||
/**
|
||||
@short gets detector size
|
||||
@short gets detector size (not Mythen supported anymore)
|
||||
\param x0 horizontal position origin in channel number
|
||||
\param y0 vertical position origin in channel number
|
||||
\param nx number of channels in horiziontal
|
||||
\param ny number of channels in vertical
|
||||
\returns OK/FAIL
|
||||
\returns total number of channels
|
||||
*/
|
||||
int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
|
||||
/**
|
||||
@short gets the maximum detector size
|
||||
\param x0 horizontal position origin in channel number
|
||||
\param y0 vertical position origin in channel number
|
||||
\param nx number of channels in horiziontal
|
||||
\param ny number of channels in vertical
|
||||
\returns OK/FAIL
|
||||
@ -372,7 +367,6 @@ class slsDetectorUsers
|
||||
\returns number of frames
|
||||
*/
|
||||
int64_t setNumberOfCycles(int64_t t=-1, int imod = -1);
|
||||
|
||||
|
||||
/**
|
||||
@short set/get the external communication mode
|
||||
@ -420,6 +414,7 @@ class slsDetectorUsers
|
||||
/**
|
||||
@short register calbback for accessing detector final data, also enables data streaming in client and receiver (if receiver exists)
|
||||
\param userCallback function for plotting/analyzing the data. Its arguments are the data structure d and the frame number f, s is for subframe number for eiger for 32 bit mode
|
||||
\param pArg argument
|
||||
*/
|
||||
|
||||
void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
|
||||
@ -427,6 +422,7 @@ class slsDetectorUsers
|
||||
/**
|
||||
@short register callback for accessing raw data - if the rawDataCallback is registered, no filewriting/postprocessing will be carried on automatically by the software - the raw data are deleted by the software
|
||||
\param userCallback function for postprocessing and saving the data - p is the pointer to the data, n is the number of channels
|
||||
\param pArg argument
|
||||
*/
|
||||
|
||||
void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
|
||||
@ -463,7 +459,7 @@ class slsDetectorUsers
|
||||
|
||||
|
||||
/** Enable or disable streaming data from receiver (creates transmitting sockets)
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @param i 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming from receiver enable
|
||||
*/
|
||||
int enableDataStreamingFromReceiver(int i=-1);
|
||||
@ -502,7 +498,7 @@ class slsDetectorUsers
|
||||
/** (for expert users)
|
||||
* Set/Get client streaming in ZMQ IP
|
||||
* By default, it is the IP of receiver hostname
|
||||
* @param i sets, empty std::string gets
|
||||
* @param ip sets, empty std::string gets
|
||||
* @returns client streaming in ZMQ IP
|
||||
*/
|
||||
std::string setClientDataStreamingInIP(std::string ip="");
|
||||
@ -552,42 +548,92 @@ class slsDetectorUsers
|
||||
*/
|
||||
int enableGapPixels(int enable=-1);
|
||||
|
||||
/**
|
||||
* Sets the frames discard policy in receiver
|
||||
* frame discard policy options:
|
||||
* @param f nodiscard (default),discardempty, discardpartial (fastest), get to get the value
|
||||
* @returns f nodiscard (default),discardempty, discardpartial (fastest)
|
||||
*/
|
||||
std::string setReceiverFramesDiscardPolicy(std::string f="get");
|
||||
|
||||
/**
|
||||
* Sets the frame padding in receiver
|
||||
* @param f 0 does not partial frames, 1 pads partial frames (-1 gets)
|
||||
* @returns partial frames padding enable
|
||||
*/
|
||||
int setReceiverPartialFramesPadding(int f = -1);
|
||||
|
||||
/**
|
||||
* Sets the frames per file in receiver
|
||||
* @param f frames per file, 0 is infinite ie. every frame in same file (-1 gets)
|
||||
* @returns frames per file
|
||||
*/
|
||||
int setReceiverFramesPerFile(int f = -1);
|
||||
|
||||
/**
|
||||
* Sends a software internal trigger (EIGER only)
|
||||
* @returns 0 for success, 1 for fail
|
||||
*/
|
||||
int sendSoftwareTrigger();
|
||||
|
||||
/**
|
||||
* get measured period between previous two frames(EIGER only)
|
||||
* @param inseconds true if the value is in s, else ns
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns measured period
|
||||
*/
|
||||
double getMeasuredPeriod(bool inseconds=false, int imod = -1);
|
||||
|
||||
/**
|
||||
* get measured sub period between previous two sub frames in 32 bit mode (EIGER only)
|
||||
* @param inseconds true if the value is in s, else ns
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns measured sub period
|
||||
*/
|
||||
double getMeasuredSubFramePeriod(bool inseconds=false, int imod = -1);
|
||||
|
||||
/**
|
||||
@short register calbback for accessing detector final data
|
||||
\param func function to be called at the end of the acquisition. gets detector status and progress index as arguments
|
||||
\param pArg argument
|
||||
*/
|
||||
|
||||
void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
|
||||
|
||||
/**
|
||||
@short register calbback for reading detector position
|
||||
\param func function for reading the detector position
|
||||
\param arg argument
|
||||
*/
|
||||
|
||||
void registerGetPositionCallback( double (*func)(void*),void *arg);
|
||||
/**
|
||||
@short register callback for connecting to the epics channels
|
||||
\param func function for connecting to the epics channels
|
||||
\param arg argument
|
||||
*/
|
||||
void registerConnectChannelsCallback( int (*func)(void*),void *arg);
|
||||
/**
|
||||
@short register callback to disconnect the epics channels
|
||||
\param func function to disconnect the epics channels
|
||||
\param arg argument
|
||||
*/
|
||||
void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
|
||||
/**
|
||||
@short register callback for moving the detector
|
||||
\param func function for moving the detector
|
||||
\param arg argument
|
||||
*/
|
||||
void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
|
||||
/**
|
||||
@short register callback for moving the detector without waiting
|
||||
\param func function for moving the detector
|
||||
\param arg argument
|
||||
*/
|
||||
void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
|
||||
/**
|
||||
@short register calbback reading to I0
|
||||
\param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0)
|
||||
\param arg argument
|
||||
*/
|
||||
void registerGetI0Callback( double (*func)(int,void*),void *arg);
|
||||
|
||||
@ -662,13 +708,13 @@ class slsDetectorUsers
|
||||
|
||||
/**
|
||||
@short start receiver listening mode
|
||||
\param returns OK or FAIL
|
||||
\returns returns OK or FAIL
|
||||
*/
|
||||
int startReceiver();
|
||||
|
||||
/**
|
||||
@short stop receiver listening mode
|
||||
\param returns OK or FAIL
|
||||
\returns returns OK or FAIL
|
||||
*/
|
||||
int stopReceiver();
|
||||
|
||||
@ -703,7 +749,7 @@ class slsDetectorUsers
|
||||
/**
|
||||
* reset frames caught in receiver
|
||||
* should be called before startReceiver()
|
||||
* @retuns OK or FAIL
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int resetFramesCaughtInReceiver();
|
||||
|
||||
@ -736,19 +782,37 @@ class slsDetectorUsers
|
||||
|
||||
/**
|
||||
* Set sub frame exposure time (only for Eiger)
|
||||
* @param i sub frame exposure time (-1 gets)
|
||||
* @param t sub frame exposure time (-1 gets)
|
||||
* @param inseconds true if the value is in s, else ns
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns sub frame exposure time in ns, or s if specified
|
||||
*/
|
||||
double setSubFrameExposureTime(double t=-1, bool inseconds=false);
|
||||
double setSubFrameExposureTime(double t=-1, bool inseconds=false, int imod = -1);
|
||||
|
||||
/**
|
||||
* Set sub frame period (only for Eiger)
|
||||
* @param i sub frame period (-1 gets)
|
||||
* Set sub frame dead time (only for Eiger)
|
||||
* Very advanced feature. Meant to be a constant in config file by an expert for each individual module
|
||||
* @param t sub frame dead time (-1 gets)
|
||||
* @param inseconds true if the value is in s, else ns
|
||||
* @returns sub frame period in ns, or s if specified
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns sub frame dead time in ns, or s if specified
|
||||
*/
|
||||
double setSubFrameExposurePeriod(double t=-1, bool inseconds=false);
|
||||
double setSubFrameExposureDeadTime(double t=-1, bool inseconds=false, int imod = -1);
|
||||
|
||||
/**
|
||||
* set/get number of additional storage cells (Jungfrau)
|
||||
* @param t number of additional storage cells. Default is 0. (-1 gets)
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns number of additional storage cells
|
||||
*/
|
||||
int64_t setNumberOfStorageCells(int64_t t=-1, int imod = -1);
|
||||
|
||||
/**
|
||||
* Set storage cell that stores first acquisition of the series (Jungfrau)
|
||||
* @param pos storage cell index. Value can be 0 to 15. Default is 15. (-1 gets)
|
||||
* @returns the storage cell that stores the first acquisition of the series
|
||||
*/
|
||||
int setStoragecellStart(int pos=-1);
|
||||
|
||||
/************************************************************************
|
||||
|
||||
@ -829,12 +893,12 @@ class slsDetectorUsers
|
||||
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode
|
||||
*/
|
||||
|
||||
static int getTimingMode(std::string s){ \
|
||||
static int getTimingMode(std::string s){ \
|
||||
if (s== "auto") return 0; \
|
||||
if (s== "trigger") return 1; \
|
||||
if (s== "ro_trigger") return 2; \
|
||||
if (s== "gating") return 3; \
|
||||
if (s== "triggered_gating") return 4; \
|
||||
if (s== "triggered_gating") return 4; \
|
||||
return -1; };
|
||||
|
||||
|
||||
|
@ -291,9 +291,10 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
/**
|
||||
get current timer value
|
||||
\param index timer index
|
||||
\param imod module number
|
||||
\returns elapsed time value in ns or number of...(e.g. frames, gates, probes)
|
||||
*/
|
||||
virtual int64_t getTimeLeft(timerIndex index)=0;
|
||||
virtual int64_t getTimeLeft(timerIndex index, int imod = -1)=0;
|
||||
|
||||
/**
|
||||
* set storage cell that stores first acquisition of the series (Jungfrau only)
|
||||
@ -475,6 +476,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
|
||||
int acquire(int delflag=1);
|
||||
|
||||
/**
|
||||
* Give an internal software trigger to the detector (Eiger only)
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual int sendSoftwareTrigger()=0;
|
||||
|
||||
|
||||
|
||||
// double* convertAngles(){return convertAngles(currentPosition);};
|
||||
// virtual double* convertAngles(double pos)=0;
|
||||
|
Reference in New Issue
Block a user