merge from 4.0.1

This commit is contained in:
2019-02-11 14:37:54 +01:00
68 changed files with 6174 additions and 2231 deletions

View File

@@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "3c774478681813e451df683e2bc8403b37490323"
#define GITREPUUID "907d1655d1f6cf2bb8cf6ccd7e91e82f479dd2ca"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4084
#define GITDATE 0x20190208
#define GITBRANCH "4.0.1"
#define GITREV 0x4101
#define GITDATE 0x20190211
#define GITBRANCH "developer"

View File

@@ -145,7 +145,7 @@ double* slsDetector::decodeData(int *datain, int &nn, double *fdata) {
dataout[ichan]=*((u_int16_t*)ptr);
ptr+=2;
}
std::cout<< "decoded "<< ichan << " channels" << std::endl;
//std::cout<< "decoded "<< ichan << " channels" << std::endl;
} else {
switch (nbits) {
case 1:
@@ -1061,14 +1061,18 @@ void slsDetector::disconnectControl() {
int slsDetector::connectData() {
//cout << "connect" << endl;
if (dataSocket){
if (dataSocket->Connect() >= 0)
return OK;
else{
if (dataSocket->Connect() >= 0) {
//cout << "ok" << endl;
return OK;
} else{
std::cout << "cannot connect to receiver" << endl;
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER));
//cout << "fail" << endl;
return FAIL;}
}
//cout << "undefined" << endl;
return UNDEFINED;
}
@@ -2938,6 +2942,30 @@ int slsDetector::getThresholdEnergy(int imod) {
updateDetector();
}
}
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
int en=-1;
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
std::cout<< "Json header: " << header << std::endl;
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
//
size_t pos0;
pos0=header.find("\"threshold\"");
if (pos0!=std::string::npos) {
if (sscanf(header.substr(pos0).c_str(),"\"threshold\":%d", &en))
thisDetector->currentThresholdEV=en;
}
}
return thisDetector->currentThresholdEV;
}
@@ -2981,6 +3009,62 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
} else {
thisDetector->currentThresholdEV=e_eV;
}
/* add threshold to zmq header */
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
std::cout<< "Old json header: " << header << std::endl;
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
//
size_t pos0;
pos0=header.find(",\"threshold\"");
if (pos0==std::string::npos) {
pos0=header.find("\"threshold\"");
}
if (pos0!=std::string::npos) {
// remove old roi
// std::cout<< header.substr(0,pos) << std::endl;
// size_t pos0=header.find_last_of(",",0,pos);
// if (pos0==std::string::npos) {
// pos0=pos;
// } else
// std::cout<< header.substr(pos0) << std::endl;
size_t pos1=header.find_first_of(",",pos0+1);
// std::cout << pos0 << " " << pos1 << std::endl;
std::cout<< "Replacing old threshold: " << header.substr(pos0,pos1-pos0) << std::endl;
// if (pos1!=std::string::npos)
header.erase(pos0,pos1-pos0);
// else
// header.erase(pos0);
}
if (header.length()>0) {
if (header.at(0)==',')
header.erase(0,1);
if (header.length()>0)
header.append(",");
}
// std::cout<< "Left: " << header << std::endl;
char h[1000];
sprintf(h,"\"threshold\":%d",e_eV);
// std::cout<< "new ROI: " << h << std::endl;
header.append(h);
std::cout<< "New json header: " << header << std::endl;
setReceiverOnline(ONLINE_FLAG);
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
/***** END FOR ZMQ HEADER */
ret=OK;
if (thisDetector->myDetectorType==JUNGFRAUCTB) {
thisDetector->currentThresholdEV=e_eV;
}
return thisDetector->currentThresholdEV;
}
@@ -3739,8 +3823,8 @@ int* slsDetector::startAndReadAll() {
//#ifdef VERBOSE
#ifdef VERBOSE
int i=0;
#endif
//#endif
#endif
if(thisDetector->myDetectorType == EIGER) {
if (prepareAcquisition() == FAIL)
return NULL;
@@ -3750,15 +3834,15 @@ int* slsDetector::startAndReadAll() {
// std::cout<< "started" << std::endl;
//#endif
while ((retval=getDataFromDetector())){
#ifdef VERBOSE
#ifdef VERBOSE
++i;
std::cout<< i << std::endl;
// std::cout<< i << std::endl;
//#else
//std::cout<< "-" << flush;
#endif
#endif
dataQueue.push(retval);
//std::cout<< "pushed" << std::endl;
// std::cout<< "pushed" << retval << std::endl;
}
disconnectControl();
@@ -3766,7 +3850,7 @@ int* slsDetector::startAndReadAll() {
std::cout<< "received "<< i<< " frames" << std::endl;
//#else
// std::cout << std::endl;
#endif
#endif
return dataQueue.front(); // check what we return!
/* while ((retval=getDataFromDetectorNoWait()))
++i;
@@ -3810,10 +3894,13 @@ int* slsDetector::getDataFromDetector(int *retval) {
int nodatadetectortype = false;
detectorType types = getDetectorsType();
if(types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX){
// cout << types << endl;
if(types == EIGER || types == JUNGFRAU || types == GOTTHARD || types == PROPIX){
nodatadetectortype = true;
}
//cout << "nodata det" << nodatadetectortype << endl;
if (!nodatadetectortype && retval==NULL)
retval=new int[nel];
@@ -3835,22 +3922,22 @@ int* slsDetector::getDataFromDetector(int *retval) {
std::cout<< "Detector returned: " << mess << " " << n << std::endl;
} else {
;
#ifdef VERBOSE
#ifdef VERBOSE
std::cout<< "Detector successfully returned: " << mess << " " << n
<< std::endl;
#endif
#endif
}
if ((!nodatadetectortype) && (r==NULL)){
delete [] retval;
}
return NULL;
} else if (!nodatadetectortype){
// cout <<"??" << endl;
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
#ifdef VERBOSE
#ifdef VERBOSE
std::cout<< "Received "<< n << " data bytes" << std::endl;
#endif
#endif
if (n!=thisDetector->dataBytes) {
std::cout<< "wrong data size received from detector: received " <<
n << " but expected " << thisDetector->dataBytes << std::endl;
@@ -3866,7 +3953,8 @@ int* slsDetector::getDataFromDetector(int *retval) {
}
// cout << "get data returning " << endl;
// cout << "get data returning " << retval << endl;
// cout << endl;
return retval;
@@ -4555,11 +4643,11 @@ int slsDetector::getDataBytesInclGapPixels() {
dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod) {
dacs_t retval[2];
retval[0] = -1;
retval[1] = -1;
if (index!=ZMQ_emin && index!=ZMQ_emax) {
int fnum=F_SET_DAC;
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
@@ -4620,8 +4708,91 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod) {
}
if(mV)
return retval[1];
} else if(thisDetector->myDetectorType==JUNGFRAUCTB) {
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
std::cout<< "Old json header: " << header << std::endl;
return retval[0];
if (index==ZMQ_emin) {
size_t pos0, pos1;
pos0=header.find(",\"eMin\"");
if (pos0==std::string::npos) {
pos0=header.find("\"eMin\"");
} else pos0++;
if (pos0!=std::string::npos) {
pos1=header.find_first_of(",",pos0);
// std::cout << pos0 << " " << pos1 << std::endl;
std::cout<< "Replacing old eMin: " << header.substr(pos0,pos1-pos0) << std::endl;
// if (pos1!=std::string::npos)
if (val>=0)
header.erase(pos0,pos1-pos0);
// else
// header.erase(pos0);
}
if (val>=0) {
if (header.length()>0) {
if (header.at(0)==',')
header.erase(0,1);
if (header.length()>0)
header.append(",");
}
// std::cout<< "Left: " << header << std::endl;
char h[1000];
sprintf(h,"\"eMin\":%d",val);
// std::cout<< "new ROI: " << h << std::endl;
header.append(h);
} else {
sscanf(header.substr(pos0,pos1-pos0).c_str(),"\"eMin\":%d",&val);
}
} else if (index==ZMQ_emax) {
size_t pos0, pos1;
pos0=header.find(",\"eMax\"");
if (pos0==std::string::npos) {
pos0=header.find("\"eMax\"");
} else pos0++;
if (pos0!=std::string::npos) {
pos1=header.find_first_of(",",pos0);
// std::cout << pos0 << " " << pos1 << std::endl;
std::cout<< "Replacing old eMax: " << header.substr(pos0,pos1-pos0) << std::endl;
// if (pos1!=std::string::npos)
if (val>=0)
header.erase(pos0,pos1-pos0);
// else
// header.erase(pos0);
}
if (val>=0) {
if (header.length()>0) {
if (header.at(0)==',')
header.erase(0,1);
if (header.length()>0)
header.append(",");
}
// std::cout<< "Left: " << header << std::endl;
char h[1000];
sprintf(h,"\"eMax\":%d",val);
// std::cout<< "new ROI: " << h << std::endl;
header.append(h);
} else {
sscanf(header.substr(pos0,pos1-pos0).c_str(),"\"eMax\":%d",&val);
}
}
std::cout<< "New json header: " << header << std::endl;
setReceiverOnline(ONLINE_FLAG);
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
/***** END FOR ZMQ HEADER */
retval[0]=val;
}
return retval[0];
}
@@ -4792,13 +4963,14 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
int fnum=F_SET_READOUT_FLAGS;
readOutFlags retval;
//readOutFlags retval;
int retval;
char mess[MAX_STR_LENGTH]="";
int ret=OK;
#ifdef VERBOSE
std::cout<< "Setting readout flags to "<< flag << std::endl;
#endif
//#ifdef VERBOSE
std::cout<< "Setting readout flags to "<< hex << flag << dec << std::endl;
//#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
@@ -4811,10 +4983,11 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
setErrorMask((getErrorMask())|(COULD_NOT_SET_READOUT_FLAGS));
} else {
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
thisDetector->roFlags=retval;
thisDetector->roFlags=(readOutFlags)retval;
if (thisDetector->myDetectorType==JUNGFRAUCTB) {
getTotalNumberOfChannels();
int nn=getTotalNumberOfChannels();
cout << "Total number of channels is " << nn << endl;
//thisDetector->dataBytes=getTotalNumberOfChannels()*
//thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
}
@@ -4828,6 +5001,150 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
thisDetector->roFlags=flag;
}
// std::cout<< "***ZMQ: " << hex<< flag << std::endl;
if (flag & (PEDESTAL | NEWPEDESTAL | NEWFLAT | FLAT | FRAME)) {
std::cout<< "***frameMode: " << std::endl;
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
std::cout<< "Old json header: " << header << std::endl;
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
//
size_t pos0;
pos0=header.find(",\"frameMode\"");
if (pos0==std::string::npos) {
pos0=header.find("\"frameMode\"");
}
if (pos0!=std::string::npos) {
size_t pos1=header.find_first_of(",",pos0+1);
// if (pos1!=std::string::npos)
if (flag!=GET_READOUT_FLAGS) {
cout << dec<< pos0 << " " << pos1 << endl;
std::cout<< "Replacing frame Mode: " << header.substr(pos0,pos1-pos0) << std::endl;
header.erase(pos0,pos1-pos0);
}
else if (header.substr(pos0,pos1+pos0)=="\"frameMode\":\"pedestal\"")
retval|=PEDESTAL;
else if (header.substr(pos0,pos1+pos0)=="\"frameMode\":\"newPedestal\"")
retval|=NEWPEDESTAL;
else if (header.substr(pos0,pos1+pos0)=="\"frameMode\":\"flatfield\"")
retval|=FLAT;
else if (header.substr(pos0,pos1+pos0)=="\"frameMode\":\"newFlatfield\"")
retval|=NEWFLAT;
else
retval|=FRAME;
}
char h[1000];
switch (flag) {
case PEDESTAL:
retval|=PEDESTAL;
strcpy(h,"\"frameMode\":\"pedestal\"");
break;
case NEWPEDESTAL:
retval|=NEWPEDESTAL;
strcpy(h,"\"frameMode\":\"newPedestal\"");
break;
case FLAT:
retval|=FLAT;
strcpy(h,"\"frameMode\":\"flatfield\"");
break;
case NEWFLAT:
retval|=NEWFLAT;
strcpy(h,"\"frameMode\":\"newFlatfield\"");
break;
default:
retval|=FRAME;
strcpy(h,"\"frameMode\":\"frame\"");
}
if (flag!=GET_READOUT_FLAGS) {
if (header.length()>0) {
if (header.at(0)==',')
header.erase(0,1);
if (header.length()>0)
header.append(",");
}
header.append(h);
setReceiverOnline(ONLINE_FLAG);
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
}
std::cout<< "New json header: " << header << std::endl;
/***** END FOR ZMQ HEADER */
ret=OK;
// retval=flag;
}
if (flag & (COUNTING | INTERPOLATING | ANALOG)) {
std::cout<< "***detectorMode: " << std::endl;
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
std::cout<< "Old json header: " << header << std::endl;
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
//
size_t pos0;
pos0=header.find(",\"detectorMode\"");
if (pos0==std::string::npos) {
pos0=header.find("\"detectorMode\"");
}
if (pos0!=std::string::npos) {
size_t pos1=header.find_first_of(",",pos0+1);
// if (pos1!=std::string::npos)
if (flag!=GET_READOUT_FLAGS) {
cout << dec<< pos0 << " " << pos1 << endl;
std::cout<< "Replacing detector Mode: " << header.substr(pos0,pos1-pos0) << std::endl;
header.erase(pos0,pos1-pos0);
}
else if (header.substr(pos0,pos1+pos0)=="\"detectorMode\":\"counting\"")
retval|=COUNTING;
else if (header.substr(pos0,pos1+pos0)=="\"detectorMode\":\"interpolating\"")
retval|=INTERPOLATING;
else
retval|=ANALOG;
}
char h[1000];
switch (flag) {
case COUNTING:
strcpy(h,"\"detectorMode\":\"counting\"");
retval|=COUNTING;
break;
case INTERPOLATING:
retval|=INTERPOLATING;
strcpy(h,"\"detectorMode\":\"interpolating\"");
break;
default:
retval|=ANALOG;
strcpy(h,"\"detectorMode\":\"analog\"");
}
if (flag!=GET_READOUT_FLAGS) {
if (header.length()>0) {
if (header.at(0)==',')
header.erase(0,1);
if (header.length()>0)
header.append(",");
}
header.append(h);
setReceiverOnline(ONLINE_FLAG);
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
/***** END FOR ZMQ HEADER */
// retval=flag;
}
std::cout<< "New json header: " << header << std::endl;
ret=OK;
}
if (ret==OK) {
// thisDetector->roFlags=flag;
thisDetector->roFlags=(readOutFlags)retval;
}
std::cout<< retval << std::endl;
#ifdef VERBOSE
std::cout<< "Readout flag set to "<< retval << std::endl;
#endif
@@ -5571,12 +5888,14 @@ string slsDetector::setAdditionalJsonHeader(string jsonheader) {
strcpy(arg, jsonheader.c_str());
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
#ifdef VERBOSE
std::cout << "Sending additional json header " << arg << std::endl;
#endif
//#ifdef VERBOSE
// std::cout << "* Sending additional json header " << arg << std::endl;
//#endif
if (connectData() == OK){
ret=thisReceiver->sendString(fnum,retval,arg);
disconnectData();
// std::cout << "** Sending additional json header " << arg << std::endl;
ret=thisReceiver->sendString(fnum,retval,arg);
disconnectData();
}
if(ret==FAIL) {
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
@@ -6027,6 +6346,70 @@ int slsDetector::setROI(int n,ROI roiLimits[], int imod) {
//sort ascending order
int temp;
/***** NEW PART FOR ZMQ HEADER */
//std::cout<< "******* ROI" << std::endl;
// char header[1000];
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
std::cout<< "Old json header: " << header << std::endl;
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
//
size_t pos0;
pos0=header.find(",\"roi\"");
if (pos0==std::string::npos) {
pos0=header.find("\"roi\"");
}
if (pos0!=std::string::npos) {
// remove old roi
// std::cout<< header.substr(0,pos) << std::endl;
// size_t pos0=header.find_last_of(",",0,pos);
// if (pos0==std::string::npos) {
// pos0=pos;
// } else
// std::cout<< header.substr(pos0) << std::endl;
size_t pos1=header.find_first_of("]",pos0+1);
// std::cout << pos0 << " " << pos1 << std::endl;
std::cout<< "Replacing old ROI: " << header.substr(pos0,pos1-pos0+1) << std::endl;
// if (pos1!=std::string::npos)
header.erase(pos0,pos1-pos0+1);
// else
// header.erase(pos0);
}
if (header.length()>0) {
if (header.at(0)==',')
header.erase(0,1);
if (header.length()>0)
header.append(",");
}
// std::cout<< "Left: " << header << std::endl;
char h[1000];
if (n) {
sprintf(h,"\"roi\":[%d, %d, %d, %d]",roiLimits[0].xmin, roiLimits[0].xmax, roiLimits[0].ymin, roiLimits[0].ymax);
// std::cout<< "new ROI: " << h << std::endl;
} else {
sprintf(h,"\"roi\":[%d, %d, %d, %d]",-1, -1, -1, -1);
}
header.append(h);
std::cout<< "New json header: " << header << std::endl;
setReceiverOnline(ONLINE_FLAG);
setNetworkParameter(ADDITIONAL_JSON_HEADER, header);
/***** END FOR ZMQ HEADER */
ret=OK;
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
thisDetector->nROI = n;
thisDetector->roiLimits[0].xmin=roiLimits[0].xmin;
thisDetector->roiLimits[0].xmax=roiLimits[0].xmax;
thisDetector->roiLimits[0].ymin=roiLimits[0].ymin;
thisDetector->roiLimits[0].ymax=roiLimits[0].ymax;
// std::cout << "** " << thisDetector->nROI << endl;
getTotalNumberOfChannels();
// std::cout << "*** " << thisDetector->nROI << endl;
return ret;
}
// if(thisDetector->myDetectorType==JUNGFRAUCTB)
for(int i=0;i<n;++i){
// cout << "*** ROI "<< i << " xmin " << roiLimits[i].xmin << " xmax "
@@ -6052,16 +6435,51 @@ int slsDetector::setROI(int n,ROI roiLimits[], int imod) {
}
ret = sendROI(n,roiLimits);
if(ret==FAIL)
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
return ret;
}
slsDetectorDefs::ROI* slsDetector::getROI(int &n, int imod) {
sendROI(-1,NULL);
n=thisDetector->nROI;
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
int xmin, xmax, ymin, ymax;
string header=getNetworkParameter(ADDITIONAL_JSON_HEADER);
std::cout<< "Json header: " << header << std::endl;
//must be in the format '\"label1\":\"value1\",\"label2\":\"value2\"' etc."
//
size_t pos0;
pos0=header.find("\"roi\"");
if (pos0!=std::string::npos) {
sscanf(header.substr(pos0).c_str(),"\"roi\":[%d, %d, %d, %d]", &xmin, &xmax, &ymin, &ymax);
if (xmin<0 && xmax<0 && ymin<0 && ymax<0)
thisDetector->nROI=0;
else {
thisDetector->nROI=1;
thisDetector->roiLimits[0].xmin=xmin;
thisDetector->roiLimits[0].xmax=xmax;
thisDetector->roiLimits[0].ymin=ymin;
thisDetector->roiLimits[0].ymax=ymax;
}
} else {
thisDetector->nROI=0;
}
// cout << thisDetector->nROI << endl;
getTotalNumberOfChannels();
} else {
sendROI(-1,NULL);
n=thisDetector->nROI;
}
return thisDetector->roiLimits;
}

View File

@@ -176,31 +176,33 @@ int slsDetectorActions::setScan(int iscan, string script, int nvalues, double *v
if (par!="")
strcpy(scanParameter[iscan],par.c_str());
if (nvalues>=0) {
if (nvalues==0)
scanMode[iscan]=noScan;
else {
nScanSteps[iscan]=nvalues;
if (nvalues>=0) {
// cout << "nvalues " << nvalues << endl;
if (nvalues==0)
scanMode[iscan]=noScan;
else {
nScanSteps[iscan]=nvalues;
if (nvalues>MAX_SCAN_STEPS)
nScanSteps[iscan]=MAX_SCAN_STEPS;
}
}
}
if (values && scanMode[iscan]>0 ) {
for (int iv=0; iv<nScanSteps[iscan]; iv++) {
scanSteps[iscan][iv]=values[iv];
}
if (values && scanMode[iscan]>0 ) {
for (int iv=0; iv<nScanSteps[iscan]; iv++) {
scanSteps[iscan][iv]=values[iv];
// cout << values[iv] << endl;
}
}
if (precision>=0)
scanPrecision[iscan]=precision;
if (scanMode[iscan]>0){
if (precision>=0)
scanPrecision[iscan]=precision;
if (scanMode[iscan]>0){
*actionMask |= 1<< (iscan+MAX_ACTIONS);
} else {
*actionMask &= ~(1 << (iscan+MAX_ACTIONS));
}
} else {
*actionMask &= ~(1 << (iscan+MAX_ACTIONS));
}
setTotalProgress();

View File

@@ -1011,9 +1011,12 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdImage;
++i;
/*! \page data
- <b>gainimage fn</b> Loads the gain image to the detector from file fn (gain map for translation into number of photons of an analog detector). Cannot get.
*/
descrToFuncMap[i].m_pFuncName="flatimage"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdImage;
++i;
@@ -1123,7 +1126,19 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
\section settingsdacs DACs
commands to configure DACs of detector
*/
/*! \page settings
- <b>emin [i] </b> Sets/gets detector minimum energy threshold for the CTB (soft setting)
*/
descrToFuncMap[i].m_pFuncName="emin"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
++i;
/*! \page settings
- <b>emax [i] </b> Sets/gets detector maximum energy threshold for the CTB (soft setting)
*/
descrToFuncMap[i].m_pFuncName="emax"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
++i;
/*! \page settings
- <b>vthreshold [i] [mv]</b> Sets/gets detector threshold voltage for single photon counters. Normally in DAC units unless \c mv is specified at the end of the command line. \c Returns \c (int ["mV"])
*/
@@ -4098,7 +4113,6 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
t=ADDITIONAL_JSON_HEADER;
}
else return ("unknown network parameter")+cmd;
if (action==PUT_ACTION) {
myDet->setNetworkParameter(t, args[1]);
// switch it back on, if it had been switched on
@@ -4475,6 +4489,7 @@ 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;
pos=2;
for(i=0;i<val;++i){
if ((!sscanf(args[pos++],"%d",&allroi[i].xmin)) ||
@@ -5248,6 +5263,10 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
dac=M_vIbiasSh;
else if (cmd== "vIpreOut")
dac=M_vIpreOut;
else if (cmd== "emin")
dac=ZMQ_emin;
else if (cmd== "emax")
dac=ZMQ_emax;
else
return string("cannot decode dac ")+cmd;
@@ -5985,29 +6004,45 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
if (action==PUT_ACTION) {
string sval=string(args[1]);
if (sval=="none")
flag=NORMAL_READOUT;
flag=NORMAL_READOUT;
else if (sval=="storeinram")
flag=STORE_IN_RAM;
flag=STORE_IN_RAM;
else if (sval=="tot")
flag=TOT_MODE;
flag=TOT_MODE;
else if (sval=="continous")
flag=CONTINOUS_RO;
flag=CONTINOUS_RO;
else if (sval=="parallel")
flag=PARALLEL;
flag=PARALLEL;
else if (sval=="nonparallel")
flag=NONPARALLEL;
flag=NONPARALLEL;
else if (sval=="safe")
flag=SAFE;
flag=SAFE;
else if (sval=="digital")
flag=DIGITAL_ONLY;
flag=DIGITAL_ONLY;
else if (sval=="analog_digital")
flag=ANALOG_AND_DIGITAL;
flag=ANALOG_AND_DIGITAL;
else if (sval=="overflow")
flag=SHOW_OVERFLOW;
flag=SHOW_OVERFLOW;
else if (sval=="nooverflow")
flag=NOOVERFLOW;
flag=NOOVERFLOW;
else if (sval=="pedestal")
flag=PEDESTAL;
else if (sval=="flatfield")
flag=FLAT;
else if (sval=="newpedestal")
flag=NEWPEDESTAL;
else if (sval=="newflatfield")
flag=NEWFLAT;
else if (sval=="frame")
flag=FRAME;
else if (sval=="analog")
flag=ANALOG;
else if (sval=="counting")
flag=COUNTING;
else if (sval=="interpolating")
flag=INTERPOLATING;
else
return string("could not scan flag ")+string(args[1]);
return string("could not scan flag ")+string(args[1]);
}
myDet->setOnline(ONLINE_FLAG);
@@ -6038,6 +6073,22 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
strcat(answer,"overflow ");
if (retval & NOOVERFLOW)
strcat(answer,"nooverflow ");
if (retval & PEDESTAL)
strcat(answer,"pedestal ");
if (retval & NEWPEDESTAL)
strcat(answer,"newpedestal ");
if (retval & NEWFLAT)
strcat(answer,"newflat ");
if (retval & FLAT)
strcat(answer,"flatfield ");
if (retval & FRAME)
strcat(answer,"frame ");
if (retval & ANALOG)
strcat(answer,"analog ");
if (retval & COUNTING)
strcat(answer,"counting ");
if (retval & INTERPOLATING)
strcat(answer,"interpolating ");
if(strlen(answer))
return string(answer);
@@ -6992,8 +7043,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
}
os << hex << reg << dec;
if (myDet->isMultiSlsDetectorClass() && aa != NULL)
delete [] aa;
delete [] aa;
//os <<" "<< hex << myDet->readRegister(120) << dec;

View File

@@ -249,7 +249,7 @@ class slsDetectorUsers
int getPositions(double *pos=NULL);
/**
@short sets the detector size (only 1 ROI)
@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)
@@ -259,7 +259,7 @@ class slsDetectorUsers
int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
/**
@short gets detector size (roi size if only one roi)
@short gets detector size (roi size if only one roi) (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