mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 13:57:13 +02:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
0a1c4992e2 | |||
a5f0f6eb34 | |||
9649982932 | |||
eca2836703 | |||
d14c9600bb | |||
42971c94b7 | |||
b0fd4f4c44 | |||
06473cfcb2 | |||
6f2aad3836 | |||
38aad40fef | |||
51c5520472 | |||
75838f77b3 | |||
54bedeaa0a | |||
b33b2edbd0 |
@ -41,4 +41,4 @@ deploy:
|
||||
provider: script
|
||||
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||
on:
|
||||
branch: 4.1.0
|
||||
branch: 4.1.1
|
||||
|
63
RELEASE.txt
63
RELEASE.txt
@ -1,8 +1,8 @@
|
||||
SLS Detector Package 4.1.0 released on 04.10.2019 (Minor Release)
|
||||
=================================================================
|
||||
SLS Detector Package 4.1.1 released on 15.01.2020 (Bug Fix Release)
|
||||
===================================================================
|
||||
|
||||
|
||||
This document describes the differences between 4.1.0 and 4.0.2 releases.
|
||||
This document describes the differences between 4.1.0 and 4.1.1 releases.
|
||||
|
||||
CONTENTS
|
||||
--------
|
||||
@ -17,12 +17,14 @@ This document describes the differences between 4.1.0 and 4.0.2 releases.
|
||||
1. Topics Concerning
|
||||
====================
|
||||
|
||||
- software for eiger quad hardware integrated
|
||||
- command line framesl, cyclesl was printing in float (jungfrau, gotthard)
|
||||
- eiger interrupt subframe flag
|
||||
- eiger server reg command (+0x100 for left and +0x200 for right)
|
||||
- additional eiger parameters included i master file
|
||||
- detangled receiver streaming from data call back in client
|
||||
and allow for unregister data call back in client
|
||||
- (eiger) software trigger made to work along with blocking acquire
|
||||
- bug fix for locks in blocking acquire
|
||||
- parameter file allows for modular commands
|
||||
|
||||
Compared to 4.1.0,
|
||||
no firmware or on-board detector server update required for this release.
|
||||
|
||||
|
||||
2. Resolved Issues
|
||||
@ -31,36 +33,21 @@ This document describes the differences between 4.1.0 and 4.0.2 releases.
|
||||
Client
|
||||
------
|
||||
|
||||
1. Command line quad integrates Eiger quad hardware
|
||||
1. Registering data call back (registerDataCallback) used to enable data streaming
|
||||
via zmq in both receiver and client. Sending NULL unregistered call back,
|
||||
but did not disable streaming.
|
||||
Now, registering/unregistering this call back will only enable data streaming
|
||||
in client. Data streaming in receiver will have to be explicitly enabled.
|
||||
|
||||
2. (Eiger)
|
||||
Software trigger triggered via the stop server and hence, can be triggered
|
||||
also during blocking acquire.
|
||||
|
||||
3. If stop acquisition command was given immediately after starting a blocking acquire,
|
||||
it might have hanged the process. This bug is fixed now.
|
||||
|
||||
4. Parameter file now allows modular commands (using ':'). They are not ignored anymore.
|
||||
|
||||
2. Command line commands framesl, cyclesl, fatesl, problesl and nframes was
|
||||
printing the result in decimals. It is now fixed to print as whole numbers.
|
||||
|
||||
|
||||
Detector Server (Eiger)
|
||||
-----------------------
|
||||
|
||||
1. Command line quad integrates Eiger quad hardware
|
||||
|
||||
2. Control flag to set last subframe to be interrupted depending on subexptime.
|
||||
By default, it is disabled and will wait till the last sub frame has finished
|
||||
exposing.
|
||||
|
||||
3. Left and Right FEB registers accessed independently using addr (+0x100 and +0x200)
|
||||
respectively.
|
||||
|
||||
|
||||
Receiver
|
||||
--------
|
||||
|
||||
1. Command line quad integrates Eiger quad hardware
|
||||
|
||||
2. Master file has additional parameters for Eiger (Quad Enable, Gap Pixels Enable).
|
||||
Writer version update to 4.0.
|
||||
|
||||
3. Zmq Json Header has additional informaion
|
||||
|
||||
|
||||
|
||||
3. Known Issues
|
||||
===============
|
||||
@ -69,7 +56,7 @@ This document describes the differences between 4.1.0 and 4.0.2 releases.
|
||||
|
||||
4. Firmware Requirements
|
||||
========================
|
||||
|
||||
|
||||
Gotthard
|
||||
========
|
||||
Minimum compatible version : 11.01.2013
|
||||
|
Binary file not shown.
@ -176,6 +176,7 @@ One can configure all the detector settings in a parameter file {\tt{setup.det}}
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-parameters setup.det
|
||||
\end{verbatim}
|
||||
Note that the parameter file for any realease before 4.1.1 has not the possibility to understand parameters to be set differently for different half modules, i.e. {\tt{0:txndelay\_left xxxxx},\tt{1:txndelay\_left yyyyy}}.
|
||||
|
||||
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{vhighvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
|
||||
Other important settings that are configured in the {\tt{setup.det}} file are:
|
||||
@ -621,6 +622,7 @@ Here are the implemented options so far:
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
|
||||
ATTENTION: From release 4.1.1 with the {\tt{trigger}} option it is possible to have software triggers as a debugging tool (instead of the hardware trigger signal. One should start the acquisition (with the blocking {\tt{sls\_detector\_acquire}} if wanted and with another client one can send the softare trigger {\tt{sls\_detector\_put status trigger}}. This option allows for example to perform a motor scan (moving a motor in between single images) and still writing all images to the same file.
|
||||
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
|
||||
However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: 4.1.0
|
||||
version: 4.1.1
|
||||
|
||||
source:
|
||||
- path: ..
|
||||
@ -50,14 +50,14 @@ requirements:
|
||||
|
||||
outputs:
|
||||
- name: sls_detector_lib
|
||||
version: 4.1.0
|
||||
version: 4.1.1
|
||||
script: copy_lib.sh
|
||||
requirements:
|
||||
build:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- name: sls_detector_gui
|
||||
version: 4.1.0
|
||||
version: 4.1.1
|
||||
script: copy_gui.sh
|
||||
requirements:
|
||||
build:
|
||||
@ -81,5 +81,5 @@ outputs:
|
||||
- {{ cdt('libxdamage') }} # [linux]
|
||||
- {{ cdt('libxxf86vm') }} # [linux]
|
||||
run:
|
||||
- sls_detector_lib=4.1.0
|
||||
- sls_detector_lib=4.1.1
|
||||
- qwt 6.1.4=hf484d3e_1001
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorGui
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
|
||||
Revision: 532
|
||||
Branch: 4.1.0
|
||||
Repsitory UUID: b0fd4f4c44ac378744e724cce684aca4a56fe0fc
|
||||
Revision: 536
|
||||
Branch: 4.1.1
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4141
|
||||
Last Changed Date: 2019-10-04 09:28:27.000000001 +0200 ./src/qTabSettings.cpp
|
||||
Last Changed Rev: 4153
|
||||
Last Changed Date: 2020-01-14 15:47:24.000000001 +0100 ./src/qTabSettings.cpp
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
|
||||
#define GITREPUUID "b0fd4f4c44ac378744e724cce684aca4a56fe0fc"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4141
|
||||
#define GITDATE 0x20191004
|
||||
#define GITBRANCH "4.1.0"
|
||||
#define GITREV 0x4153
|
||||
#define GITDATE 0x20200114
|
||||
#define GITBRANCH "4.1.1"
|
||||
|
@ -373,6 +373,9 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
|
||||
// callbacks
|
||||
// Setting the callback function to get data from detector class
|
||||
if (myDet->setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) {
|
||||
myDet->enableDataStreamingFromReceiver(1);
|
||||
}
|
||||
myDet->registerDataCallback(&(GetDataCallBack),this); // also enables data streaming in client and receiver (if receiver exists)
|
||||
//Setting the callback function to alert when acquisition finished from detector class
|
||||
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this);
|
||||
|
@ -25,6 +25,8 @@
|
||||
#define MULTI_DETECTORS_NOT_ADDED 0x8000000000000000ULL
|
||||
#define MULTI_HAVE_DIFFERENT_VALUES 0x4000000000000000ULL
|
||||
#define MULTI_CONFIG_FILE_ERROR 0x2000000000000000ULL
|
||||
#define MULTI_PARM_FILE_ERROR 0x1000000000000000ULL
|
||||
|
||||
|
||||
// sls errors
|
||||
#define CRITICAL_ERROR_MASK 0xFFFFFFF
|
||||
@ -302,7 +304,7 @@ public:
|
||||
retval.append("Could not set/get auto comparator disable\n");
|
||||
|
||||
if(slsErrorMask&CONFIG_FILE)
|
||||
retval.append("Could not load/write config file\n");
|
||||
retval.append("Could not load/write config/parameter file\n");
|
||||
|
||||
//------------------------------------------------------ length of message
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
|
||||
Revision: 2094
|
||||
Branch: 4.1.0
|
||||
Repsitory UUID: b0fd4f4c44ac378744e724cce684aca4a56fe0fc
|
||||
Revision: 2101
|
||||
Branch: 4.1.1
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4141
|
||||
Last Changed Date: 2019-10-04 10:33:35.000000001 +0200 ./threadFiles/ThreadPool.o
|
||||
Last Changed Rev: 4153
|
||||
Last Changed Date: 2020-01-14 16:16:00.000000001 +0100 ./threadFiles/ThreadPool.o
|
||||
|
@ -26,6 +26,7 @@ ID: $Id$
|
||||
#include <rapidjson/document.h> //json header in zmq stream
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <iterator>
|
||||
|
||||
|
||||
|
||||
@ -523,7 +524,10 @@ std::string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
retval.append("Could not load Config File\n");
|
||||
critical = 0;
|
||||
}
|
||||
|
||||
if (multiMask & MULTI_PARM_FILE_ERROR) {
|
||||
retval.append("Could not load parameter File\n");
|
||||
critical = 0;
|
||||
}
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
//if the detector has error
|
||||
if (multiMask & (1 << idet)) {
|
||||
@ -1441,176 +1445,382 @@ int multiSlsDetector::readConfigurationFile(std::string const fname) {
|
||||
freeSharedMemory();
|
||||
setupMultiDetector();
|
||||
|
||||
|
||||
multiSlsDetectorClient* cmd;
|
||||
std::string ans;
|
||||
std::string str;
|
||||
std::ifstream infile;
|
||||
int iargval;
|
||||
int interrupt = 0;
|
||||
char* args[1000];
|
||||
|
||||
char myargs[1000][1000];
|
||||
|
||||
std::string sargname, sargval;
|
||||
int iline = 0;
|
||||
std::cout << "config file name " << fname << std::endl;
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
while (infile.good() and interrupt == 0) {
|
||||
sargname = "none";
|
||||
sargval = "0";
|
||||
getline(infile, str);
|
||||
++iline;
|
||||
|
||||
// remove comments that come after
|
||||
if (str.find('#') != std::string::npos)
|
||||
str.erase(str.find('#'));
|
||||
#ifdef VERBOSE
|
||||
std::cout << "string:" << str << std::endl;
|
||||
#endif
|
||||
if (str.length() < 2) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Empty line or Comment " << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
} else {
|
||||
std::istringstream ssstr(str);
|
||||
iargval = 0;
|
||||
while (ssstr.good()) {
|
||||
ssstr >> sargname;
|
||||
#ifdef VERBOSE
|
||||
std::cout << iargval << " " << sargname << std::endl;
|
||||
#endif
|
||||
strcpy(myargs[iargval], sargname.c_str());
|
||||
args[iargval] = myargs[iargval];
|
||||
#ifdef VERBOSE
|
||||
std::cout << "--" << iargval << " " << args[iargval] << std::endl;
|
||||
#endif
|
||||
++iargval;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << endl;
|
||||
for (int ia = 0; ia < iargval; ia++)
|
||||
cout << args[ia] << " ??????? ";
|
||||
cout << endl;
|
||||
#endif
|
||||
cmd = new multiSlsDetectorClient(iargval, args, PUT_ACTION, this);
|
||||
delete cmd;
|
||||
}
|
||||
++iline;
|
||||
}
|
||||
|
||||
infile.close();
|
||||
} else {
|
||||
std::cout << "Error opening configuration file " << fname << " for reading" << std::endl;
|
||||
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
|
||||
return FAIL;
|
||||
std::ifstream inFile;
|
||||
inFile.open(fname.c_str(), std::ifstream::in);
|
||||
if (!inFile.is_open()) {
|
||||
cprintf(RED, "Cannot open config file %s\n", fname.c_str());
|
||||
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Read configuration file of " << iline << " lines" << std::endl;
|
||||
#endif
|
||||
|
||||
while(inFile.good()) {
|
||||
std::string sLine;
|
||||
getline(inFile,sLine);
|
||||
// delete lines after comments
|
||||
if (sLine.find('#') != std::string::npos) {
|
||||
sLine.erase(sLine.find('#'));
|
||||
}
|
||||
// scan arguments
|
||||
std::istringstream iss(sLine);
|
||||
std::vector<std::string> vec = std::vector<std::string>(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>());
|
||||
// blank lines
|
||||
if (vec.size() == 0 || vec[0].empty()) {
|
||||
continue;
|
||||
}
|
||||
int iarg = vec.size();
|
||||
// copy to char array
|
||||
char arr[iarg][MAX_STR_LENGTH];
|
||||
memset(arr, 0, sizeof(arr));
|
||||
char* args[iarg];
|
||||
for (int i = 0; i < iarg; ++i) {
|
||||
args[i] = arr[i];
|
||||
strcpy(args[i], vec[i].c_str());
|
||||
}
|
||||
// execute command
|
||||
multiSlsDetectorClient(iarg, args, PUT_ACTION, this);
|
||||
}
|
||||
|
||||
inFile.close();
|
||||
|
||||
setNumberOfModules(-1);
|
||||
getMaxNumberOfModules();
|
||||
|
||||
// check error
|
||||
if (getErrorMask()) {
|
||||
int c;
|
||||
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
|
||||
getErrorMessage(c).c_str());
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::writeConfigurationFile(std::string const fname) {
|
||||
|
||||
std::vector <std::string> commands;
|
||||
commands.push_back("master");
|
||||
commands.push_back("sync");
|
||||
commands.push_back("outdir");
|
||||
commands.push_back("ffdir");
|
||||
commands.push_back("headerbefore");
|
||||
commands.push_back("headerafter");
|
||||
commands.push_back("headerbeforepar");
|
||||
commands.push_back("headerafterpar");
|
||||
commands.push_back("badchannels");
|
||||
commands.push_back("angconv");
|
||||
commands.push_back("globaloff");
|
||||
commands.push_back("binsize");
|
||||
commands.push_back("threaded");
|
||||
|
||||
std::ofstream outfile;
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (!outfile.is_open()) {
|
||||
cprintf(RED, "Cannot open config file %s for writing\n", fname.c_str());
|
||||
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
int ret = OK;
|
||||
slsDetectorCommand* cmd = new slsDetectorCommand(this);
|
||||
char arr[MAX_STR_LENGTH];
|
||||
char* args[1];
|
||||
args[0] = arr;
|
||||
|
||||
// detsizechan
|
||||
memset(args[0], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[0], "detsizechan");
|
||||
outfile << args[0] << ' ' << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||
// hostname
|
||||
memset(args[0], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[0], "hostname");
|
||||
outfile << args[0] << ' ' << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||
|
||||
// single detector configuration
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
outfile << endl;
|
||||
int ret1 = detectors[idet]->writeConfigurationFile(outfile, idet);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << idet));
|
||||
if (ret1 == FAIL)
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
// other configurations
|
||||
outfile << endl;
|
||||
for (unsigned int i = 0; i < commands.size(); ++i) {
|
||||
memset(args[0], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[0], commands[i].c_str());
|
||||
outfile << commands[i] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||
}
|
||||
|
||||
delete cmd;
|
||||
outfile.close();
|
||||
|
||||
if (ret == FAIL || getErrorMask()) {
|
||||
int c;
|
||||
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
|
||||
getErrorMessage(c).c_str());
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::writeConfigurationFile(std::string const fname) {
|
||||
int multiSlsDetector::retrieveDetectorSetup(std::string const fname1, int level){
|
||||
std::string fname = fname1;
|
||||
// setup
|
||||
if (level==2) {
|
||||
fname += std::string(".det");
|
||||
}
|
||||
|
||||
std::string names[] = {
|
||||
"detsizechan",
|
||||
"hostname",
|
||||
"master",
|
||||
"sync",
|
||||
"outdir",
|
||||
"ffdir",
|
||||
"headerbefore",
|
||||
"headerafter",
|
||||
"headerbeforepar",
|
||||
"headerafterpar",
|
||||
"badchannels",
|
||||
"angconv",
|
||||
"globaloff",
|
||||
"binsize",
|
||||
"threaded"
|
||||
};
|
||||
|
||||
int nvar = 15;
|
||||
char* args[100];
|
||||
for (int ia = 0; ia < 100; ++ia) {
|
||||
args[ia] = new char[1000];
|
||||
std::ifstream inFile;
|
||||
inFile.open(fname.c_str(), std::ifstream::in);
|
||||
if (!inFile.is_open()) {
|
||||
cprintf(RED, "Cannot open parameter file %s\n", fname.c_str());
|
||||
setErrorMask(getErrorMask() | MULTI_PARM_FILE_ERROR);
|
||||
return FAIL;
|
||||
}
|
||||
int ret = OK, ret1 = OK;
|
||||
|
||||
std::ofstream outfile;
|
||||
int iline = 0;
|
||||
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
slsDetectorCommand* cmd = new slsDetectorCommand(this);
|
||||
|
||||
// complete size of detector
|
||||
cout << iline << " " << names[iline] << endl;
|
||||
strcpy(args[0], names[iline].c_str());
|
||||
outfile << names[iline] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||
++iline;
|
||||
|
||||
// hostname of the detectors
|
||||
cout << iline << " " << names[iline] << endl;
|
||||
strcpy(args[0], names[iline].c_str());
|
||||
outfile << names[iline] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||
++iline;
|
||||
|
||||
// single detector configuration
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
outfile << endl;
|
||||
ret1 = detectors[idet]->writeConfigurationFile(outfile, idet);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << idet));
|
||||
if (ret1 == FAIL)
|
||||
ret = FAIL;
|
||||
while(inFile.good()) {
|
||||
std::string sLine;
|
||||
getline(inFile,sLine);
|
||||
// delete lines after comments
|
||||
if (sLine.find('#') != std::string::npos) {
|
||||
sLine.erase(sLine.find('#'));
|
||||
}
|
||||
// scan arguments
|
||||
std::istringstream iss(sLine);
|
||||
std::vector<std::string> vec = std::vector<std::string>(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>());
|
||||
// blank lines
|
||||
if (vec.size() == 0 || vec[0].empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
outfile << endl;
|
||||
//other configurations
|
||||
while (iline < nvar) {
|
||||
cout << iline << " " << names[iline] << endl;
|
||||
strcpy(args[0], names[iline].c_str());
|
||||
outfile << names[iline] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||
++iline;
|
||||
// skip commands according to level (setup=2)
|
||||
if (level!=2) {
|
||||
if (vec[0] == "flatfield" ||
|
||||
vec[0] == "badchannels" ||
|
||||
vec[0] == "trimbits") {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
delete cmd;
|
||||
outfile.close();
|
||||
#ifdef VERBOSE
|
||||
std::cout << "wrote " << iline << " lines to configuration file " << std::endl;
|
||||
#endif
|
||||
} else {
|
||||
std::cout << "Error opening configuration file " << fname << " for writing" << std::endl;
|
||||
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
|
||||
ret = FAIL;
|
||||
int iarg = vec.size();
|
||||
// copy to char array
|
||||
char arr[iarg][MAX_STR_LENGTH];
|
||||
memset(arr, 0, sizeof(arr));
|
||||
char* args[iarg];
|
||||
for (int i = 0; i < iarg; ++i) {
|
||||
args[i] = arr[i];
|
||||
strcpy(args[i], vec[i].c_str());
|
||||
}
|
||||
// execute command
|
||||
multiSlsDetectorClient(iarg, args, PUT_ACTION, this);
|
||||
}
|
||||
|
||||
for (int ia = 0; ia < 100; ++ia) {
|
||||
delete[] args[ia];
|
||||
}
|
||||
inFile.close();
|
||||
|
||||
return ret;
|
||||
// check error
|
||||
if (getErrorMask()) {
|
||||
int c;
|
||||
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
|
||||
getErrorMessage(c).c_str());
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::dumpDetectorSetup(std::string const fname1, int level){
|
||||
|
||||
std::vector <std::string> commands;
|
||||
// common config
|
||||
commands.push_back("fname");
|
||||
commands.push_back("index");
|
||||
commands.push_back("enablefwrite");
|
||||
commands.push_back("overwrite");
|
||||
commands.push_back("dr");
|
||||
commands.push_back("settings");
|
||||
commands.push_back("exptime");
|
||||
commands.push_back("period");
|
||||
commands.push_back("frames");
|
||||
commands.push_back("cycles");
|
||||
commands.push_back("measurements");
|
||||
commands.push_back("timing");
|
||||
|
||||
switch (getDetectorsType()) {
|
||||
case EIGER:
|
||||
commands.push_back("flags");
|
||||
commands.push_back("clkdivider");
|
||||
commands.push_back("threshold");
|
||||
commands.push_back("ratecorr");
|
||||
break;
|
||||
case GOTTHARD:
|
||||
case PROPIX:
|
||||
commands.push_back("flags");
|
||||
commands.push_back("delay");
|
||||
commands.push_back("gates");
|
||||
commands.push_back("ratecorr");
|
||||
break;
|
||||
case JUNGFRAU:
|
||||
commands.push_back("flags");
|
||||
commands.push_back("delay");
|
||||
commands.push_back("gates");
|
||||
commands.push_back("ratecorr");
|
||||
commands.push_back("clkdivider");
|
||||
break;
|
||||
case MYTHEN:
|
||||
commands.push_back("flags");
|
||||
commands.push_back("threshold");
|
||||
commands.push_back("delay");
|
||||
commands.push_back("gates");
|
||||
commands.push_back("probes");
|
||||
commands.push_back("fineoff");
|
||||
commands.push_back("ratecorr");
|
||||
break;
|
||||
case JUNGFRAUCTB:
|
||||
commands.push_back("dac:0");
|
||||
commands.push_back("dac:1");
|
||||
commands.push_back("dac:2");
|
||||
commands.push_back("dac:3");
|
||||
commands.push_back("dac:4");
|
||||
commands.push_back("dac:5");
|
||||
commands.push_back("dac:6");
|
||||
commands.push_back("dac:7");
|
||||
commands.push_back("dac:8");
|
||||
commands.push_back("dac:9");
|
||||
commands.push_back("dac:10");
|
||||
commands.push_back("dac:11");
|
||||
commands.push_back("dac:12");
|
||||
commands.push_back("dac:13");
|
||||
commands.push_back("dac:14");
|
||||
commands.push_back("dac:15");
|
||||
commands.push_back("adcvpp");
|
||||
commands.push_back("adcclk");
|
||||
commands.push_back("clkdivider");
|
||||
commands.push_back("adcphase");
|
||||
commands.push_back("adcpipeline");
|
||||
commands.push_back("adcinvert"); //
|
||||
commands.push_back("adcdisable");
|
||||
commands.push_back("patioctrl");
|
||||
commands.push_back("patclkctrl");
|
||||
commands.push_back("patlimits");
|
||||
commands.push_back("patloop0");
|
||||
commands.push_back("patnloop0");
|
||||
commands.push_back("patwait0");
|
||||
commands.push_back("patwaittime0");
|
||||
commands.push_back("patloop1");
|
||||
commands.push_back("patnloop1");
|
||||
commands.push_back("patwait1");
|
||||
commands.push_back("patwaittime1");
|
||||
commands.push_back("patloop2");
|
||||
commands.push_back("patnloop2");
|
||||
commands.push_back("patwait2");
|
||||
commands.push_back("patwaittime2");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// more common config
|
||||
commands.push_back("startscript");
|
||||
commands.push_back("startscriptpar");
|
||||
commands.push_back("stopscript");
|
||||
commands.push_back("stopscriptpar");
|
||||
commands.push_back("scriptbefore");
|
||||
commands.push_back("scriptbeforepar");
|
||||
commands.push_back("scriptafter");
|
||||
commands.push_back("scriptafterpar");
|
||||
commands.push_back("scan0script");
|
||||
commands.push_back("scan0par");
|
||||
commands.push_back("scan0prec");
|
||||
commands.push_back("scan0steps");
|
||||
commands.push_back("scan1script");
|
||||
commands.push_back("scan1par");
|
||||
commands.push_back("scan1prec");
|
||||
commands.push_back("scan1steps");
|
||||
|
||||
std::string fname = fname1;
|
||||
// setup
|
||||
if (level == 2) {
|
||||
// config
|
||||
fname += std::string(".config");
|
||||
writeConfigurationFile(fname);
|
||||
// parameters
|
||||
fname = fname1 + std::string(".det");
|
||||
}
|
||||
|
||||
std::ofstream outfile;
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (!outfile.is_open()) {
|
||||
cprintf(RED, "Cannot open parameter file %s for writing\n", fname.c_str());
|
||||
setErrorMask(getErrorMask() | MULTI_PARM_FILE_ERROR);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
slsDetectorCommand* cmd = new slsDetectorCommand(this);
|
||||
char arr[2][MAX_STR_LENGTH];
|
||||
char* args[2];
|
||||
args[0] = arr[0];
|
||||
args[1] = arr[1];
|
||||
memset(args[1], 0, MAX_STR_LENGTH);
|
||||
|
||||
for (unsigned int i = 0; i < commands.size(); ++i) {
|
||||
memset(args[0], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[0], commands[i].c_str());
|
||||
outfile << commands[i] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||
}
|
||||
|
||||
if (getDetectorsType() == MYTHEN) {
|
||||
// flatfield
|
||||
memset(args[0], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[0], "flatfield ");
|
||||
if (level == 2) {
|
||||
fname = fname1 + std::string(".ff");
|
||||
memset(args[1], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[1], fname.c_str());
|
||||
}
|
||||
outfile << "flatfield " << cmd->executeLine(2, args, GET_ACTION) << std::endl;
|
||||
|
||||
// badchannels
|
||||
memset(args[0], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[0], "badchannels ");
|
||||
if (level == 2) {
|
||||
fname = fname1 + std::string(".bad");
|
||||
memset(args[1], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[1], fname.c_str());
|
||||
}
|
||||
outfile << "badchannels " << cmd->executeLine(2, args, GET_ACTION) << std::endl;
|
||||
|
||||
// trimbits
|
||||
if (level == 2) {
|
||||
size_t c = fname1.rfind('/');
|
||||
if (c < std::string::npos) {
|
||||
fname = fname1.substr(0, c + 1) + std::string("trim_") + fname.substr(c + 1);
|
||||
} else {
|
||||
fname = std::string("trim_") + fname1;
|
||||
}
|
||||
memset(args[0], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[0], "trimbits ");
|
||||
memset(args[1], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[1], fname.c_str());
|
||||
outfile << "trimbits " << cmd->executeLine(2, args, GET_ACTION) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
delete cmd;
|
||||
outfile.close();
|
||||
|
||||
if (getErrorMask()) {
|
||||
int c;
|
||||
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
|
||||
getErrorMessage(c).c_str());
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
std::string multiSlsDetector::getSettingsFile() {
|
||||
return callDetectorMember(&slsDetector::getSettingsFile);
|
||||
|
@ -795,6 +795,26 @@ public:
|
||||
*/
|
||||
int writeConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Saves the detector setup to file
|
||||
* @param fname file to write to
|
||||
* @param level if 2 reads also trimbits, flat field, angular
|
||||
* correction etc. and writes them to files with automatically
|
||||
* added extension
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int dumpDetectorSetup(std::string const fname1, int level=0);
|
||||
|
||||
/**
|
||||
* Loads the detector setup from file
|
||||
* @param fname file to read from
|
||||
* @param level if 2 reads also reads trimbits, angular
|
||||
* conversion coefficients etc. from files with default
|
||||
* extensions as generated by dumpDetectorSetup
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int retrieveDetectorSetup(std::string const fname1, int level=0);
|
||||
|
||||
/**
|
||||
* Returns the trimfile or settings file name (Useless??)
|
||||
* @returns the trimfile or settings file name
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
|
||||
#define GITREPUUID "b0fd4f4c44ac378744e724cce684aca4a56fe0fc"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4141
|
||||
#define GITDATE 0x20191004
|
||||
#define GITBRANCH "4.1.0"
|
||||
#define GITREV 0x4153
|
||||
#define GITDATE 0x20200114
|
||||
#define GITBRANCH "4.1.1"
|
||||
|
@ -2407,254 +2407,126 @@ int slsDetector::updateDetector() {
|
||||
|
||||
|
||||
int slsDetector::readConfigurationFile(string const fname) {
|
||||
|
||||
|
||||
|
||||
string ans;
|
||||
string str;
|
||||
ifstream infile;
|
||||
//char *args[1000];
|
||||
|
||||
string sargname, sargval;
|
||||
#ifdef VERBOSE
|
||||
int iline=0;
|
||||
std::cout<< "config file name "<< fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
#ifdef VERBOSE
|
||||
iline=readConfigurationFile(infile);
|
||||
#else
|
||||
readConfigurationFile(infile);
|
||||
#endif
|
||||
infile.close();
|
||||
} else {
|
||||
std::cout<< "Error opening configuration file " << fname <<
|
||||
" for reading" << std::endl;
|
||||
setErrorMask((getErrorMask())|(CONFIG_FILE));
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Read configuration file of " << iline << " lines" << std::endl;
|
||||
#endif
|
||||
return OK;
|
||||
|
||||
std::cout << "Cannot read config file from slsDetector level" << std::endl;
|
||||
setErrorMask((getErrorMask())|(CONFIG_FILE));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::readConfigurationFile(ifstream &infile) {
|
||||
|
||||
|
||||
|
||||
|
||||
slsDetectorCommand *cmd=new slsDetectorCommand(this);
|
||||
|
||||
string ans;
|
||||
string str;
|
||||
int iargval;
|
||||
int interrupt=0;
|
||||
char *args[100];
|
||||
char myargs[1000][1000];
|
||||
|
||||
string sargname, sargval;
|
||||
int iline=0;
|
||||
while (infile.good() and interrupt==0) {
|
||||
sargname="none";
|
||||
sargval="0";
|
||||
getline(infile,str);
|
||||
++iline;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< str << std::endl;
|
||||
#endif
|
||||
if (str.find('#')!=string::npos) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Line is a comment " << std::endl;
|
||||
std::cout<< str << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
} else if (str.length()<2) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Empty line " << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
} else {
|
||||
istringstream ssstr(str);
|
||||
iargval=0;
|
||||
while (ssstr.good()) {
|
||||
ssstr >> sargname;
|
||||
//if (ssstr.good()) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< iargval << " " << sargname << std::endl;
|
||||
#endif
|
||||
strcpy(myargs[iargval],sargname.c_str());
|
||||
args[iargval]=myargs[iargval];
|
||||
++iargval;
|
||||
//}
|
||||
}
|
||||
ans=cmd->executeLine(iargval,args,PUT_ACTION);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< ans << std::endl;
|
||||
#endif
|
||||
}
|
||||
++iline;
|
||||
}
|
||||
delete cmd;
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetector::writeConfigurationFile(string const fname) {
|
||||
|
||||
ofstream outfile;
|
||||
#ifdef VERBOSE
|
||||
int ret;
|
||||
#endif
|
||||
outfile.open(fname.c_str(),ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
#ifdef VERBOSE
|
||||
ret=writeConfigurationFile(outfile);
|
||||
#else
|
||||
writeConfigurationFile(outfile);
|
||||
#endif
|
||||
outfile.close();
|
||||
}
|
||||
else {
|
||||
std::cout<< "Error opening configuration file " << fname <<
|
||||
" for writing" << std::endl;
|
||||
setErrorMask((getErrorMask())|(CONFIG_FILE));
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "wrote " <<ret << " lines to configuration file " << std::endl;
|
||||
#endif
|
||||
return OK;
|
||||
|
||||
|
||||
std::cout << "Cannot write config file from slsDetector level" << std::endl;
|
||||
setErrorMask((getErrorMask())|(CONFIG_FILE));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::writeConfigurationFile(ofstream &outfile, int id) {
|
||||
;
|
||||
slsDetectorCommand *cmd=new slsDetectorCommand(this);
|
||||
detectorType type = thisDetector->myDetectorType;
|
||||
string names[100];
|
||||
int nvar=0;
|
||||
|
||||
std::vector <std::string> commands;
|
||||
// common config
|
||||
names[nvar++] = "hostname";
|
||||
names[nvar++] = "port";
|
||||
names[nvar++] = "stopport";
|
||||
names[nvar++] = "settingsdir";
|
||||
names[nvar++] = "caldir";
|
||||
names[nvar++] = "ffdir";
|
||||
names[nvar++] = "outdir";
|
||||
names[nvar++] = "angdir";
|
||||
names[nvar++] = "moveflag";
|
||||
names[nvar++] = "lock";
|
||||
commands.push_back("port");
|
||||
commands.push_back("stopport");
|
||||
commands.push_back("settingsdir");
|
||||
commands.push_back("caldir");
|
||||
commands.push_back("ffdir");
|
||||
commands.push_back("outdir");
|
||||
commands.push_back("angdir");
|
||||
commands.push_back("moveflag");
|
||||
commands.push_back("lock");
|
||||
|
||||
// receiver config
|
||||
if (type != MYTHEN) {
|
||||
names[nvar++] = "detectormac";
|
||||
names[nvar++] = "detectorip";
|
||||
names[nvar++] = "zmqport";
|
||||
names[nvar++] = "rx_zmqport";
|
||||
names[nvar++] = "zmqip";
|
||||
names[nvar++] = "rx_zmqip";
|
||||
names[nvar++] = "rx_tcpport";
|
||||
names[nvar++] = "rx_udpport";
|
||||
names[nvar++] = "rx_udpport2";
|
||||
names[nvar++] = "rx_udpip";
|
||||
names[nvar++] = "rx_hostname";
|
||||
names[nvar++] = "r_readfreq";
|
||||
if (thisDetector->myDetectorType != MYTHEN) {
|
||||
commands.push_back("detectormac");
|
||||
commands.push_back("detectorip");
|
||||
commands.push_back("zmqport");
|
||||
commands.push_back("rx_zmqport");
|
||||
commands.push_back("zmqip");
|
||||
commands.push_back("rx_zmqip");
|
||||
commands.push_back("rx_tcpport");
|
||||
commands.push_back("rx_udpport");
|
||||
commands.push_back("rx_udpport2");
|
||||
commands.push_back("rx_udpip");
|
||||
commands.push_back("rx_hostname");
|
||||
commands.push_back("r_readfreq");
|
||||
}
|
||||
|
||||
// detector specific config
|
||||
switch (type) {
|
||||
switch (thisDetector->myDetectorType) {
|
||||
case MYTHEN:
|
||||
names[nvar++] = "nmod";
|
||||
names[nvar++] = "waitstates";
|
||||
names[nvar++] = "setlength";
|
||||
names[nvar++] = "clkdivider";
|
||||
names[nvar++] = "extsig";
|
||||
commands.push_back("waitstates");
|
||||
commands.push_back("setlength");
|
||||
commands.push_back("clkdivider");
|
||||
commands.push_back("extsig");
|
||||
break;
|
||||
case GOTTHARD:
|
||||
case PROPIX:
|
||||
names[nvar++] = "extsig";
|
||||
names[nvar++] = "vhighvoltage";
|
||||
break;
|
||||
break;
|
||||
case MOENCH:
|
||||
names[nvar++] = "extsig";
|
||||
names[nvar++] = "vhighvoltage";
|
||||
commands.push_back("vhighvoltage");
|
||||
break;
|
||||
case EIGER:
|
||||
names[nvar++] = "vhighvoltage";
|
||||
names[nvar++] = "trimen";
|
||||
names[nvar++] = "iodelay";
|
||||
names[nvar++] = "tengiga";
|
||||
commands.push_back("vhighvoltage");
|
||||
commands.push_back("trimen");
|
||||
commands.push_back("iodelay");
|
||||
commands.push_back("tengiga");
|
||||
break;
|
||||
case JUNGFRAU:
|
||||
names[nvar++] = "powerchip";
|
||||
names[nvar++] = "vhighvoltage";
|
||||
break;
|
||||
case JUNGFRAUCTB:
|
||||
names[nvar++] = "powerchip";
|
||||
names[nvar++] = "vhighvoltage";
|
||||
commands.push_back("powerchip");
|
||||
commands.push_back("vhighvoltage");
|
||||
break;
|
||||
default:
|
||||
std::cout << "detector type " <<
|
||||
getDetectorType(thisDetector->myDetectorType) << " not implemented in "
|
||||
"writing config file" << std::endl;
|
||||
nvar = 0;
|
||||
break;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int nsig=4;
|
||||
int iv=0;
|
||||
char *args[100];
|
||||
char myargs[100][1000];
|
||||
|
||||
for (int ia=0; ia<100; ++ia) {
|
||||
args[ia]=myargs[ia];
|
||||
}
|
||||
|
||||
|
||||
for (iv=0; iv<nvar; ++iv) {
|
||||
cout << iv << " " << names[iv] << endl;
|
||||
if (names[iv]=="extsig") {
|
||||
for (int is=0; is<nsig; ++is) {
|
||||
sprintf(args[0],"%s:%d",names[iv].c_str(),is);
|
||||
|
||||
if (id>=0)
|
||||
slsDetectorCommand *cmd = new slsDetectorCommand(this);
|
||||
char* args[2];
|
||||
args[0] = new char[MAX_STR_LENGTH];
|
||||
for (unsigned int i = 0; i < commands.size(); ++i) {
|
||||
if (commands[i] == "extsig") {
|
||||
for (int is = 0; is < 4; ++is) {
|
||||
if (id >= 0) {
|
||||
outfile << id << ":";
|
||||
|
||||
outfile << args[0] << " " << cmd->executeLine(1,args,GET_ACTION)
|
||||
<< std::endl;
|
||||
}
|
||||
memset(args[0], 0, MAX_STR_LENGTH);
|
||||
sprintf(args[0],"extsig:%d", is);
|
||||
outfile << args[0] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||
}
|
||||
} else {
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
if (id>=0)
|
||||
if (id >= 0) {
|
||||
outfile << id << ":";
|
||||
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION)
|
||||
<< std::endl;
|
||||
}
|
||||
memset(args[0], 0, MAX_STR_LENGTH);
|
||||
strcpy(args[0], commands[i].c_str());
|
||||
outfile << commands[i] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
delete cmd;
|
||||
delete args[0];
|
||||
delete cmd;
|
||||
|
||||
if (getErrorMask()) {
|
||||
int c = 0;
|
||||
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
|
||||
getErrorMessage(c).c_str());
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int slsDetector::retrieveDetectorSetup(std::string const fname, int level) {
|
||||
std::cout << "Cannot read parameter file from slsDetector level" << std::endl;
|
||||
setErrorMask((getErrorMask())|(CONFIG_FILE));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
int slsDetector::dumpDetectorSetup(std::string const fname, int level) {
|
||||
std::cout << "Cannot write parameter file from slsDetector level" << std::endl;
|
||||
setErrorMask((getErrorMask())|(CONFIG_FILE));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
string slsDetector::getSettingsFile() {
|
||||
@ -3695,16 +3567,16 @@ int slsDetector::sendSoftwareTrigger() {
|
||||
#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;
|
||||
if (stopSocket) {
|
||||
if (connectStop() == OK){
|
||||
stopSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
stopSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
stopSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
disconnectStop();
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -852,20 +852,11 @@ public:
|
||||
int updateDetector();
|
||||
|
||||
/**
|
||||
* Load configuration from a configuration File
|
||||
* calls readConfigurationFile and gives it the stream
|
||||
* @param fname configuration file name
|
||||
* @return OK or FAIL
|
||||
* should not be called at this level
|
||||
* @return FAIL
|
||||
*/
|
||||
int readConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Load configuration from a stream
|
||||
* @param infile stream
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(std::ifstream &infile);
|
||||
|
||||
/**
|
||||
* Write current configuration to a file
|
||||
* calls writeConfigurationFile giving it a stream to write to
|
||||
@ -882,6 +873,26 @@ public:
|
||||
*/
|
||||
int writeConfigurationFile(std::ofstream &outfile, int id=-1);
|
||||
|
||||
/**
|
||||
* Loads the detector setup from file
|
||||
* @param fname file to read from
|
||||
* @param level if 2 reads also reads trimbits, angular
|
||||
* conversion coefficients etc. from files with default
|
||||
* extensions as generated by dumpDetectorSetup
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int retrieveDetectorSetup(std::string const fname, int level=0);
|
||||
|
||||
/**
|
||||
* Saves the detector setup to file
|
||||
* @param fname file to write to
|
||||
* @param level if 2 reads also trimbits, flat field, angular
|
||||
* correction etc. and writes them to files with automatically
|
||||
* added extension
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int dumpDetectorSetup(std::string const fname, int level=0);
|
||||
|
||||
/**
|
||||
* Returns the trimfile or settings file name (Useless??)
|
||||
* @returns the trimfile or settings file name
|
||||
|
@ -540,10 +540,8 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int readConfigurationFile(std::string const fname)=0;
|
||||
|
||||
virtual int dumpDetectorSetup(std::string const fname, int level)=0;
|
||||
int dumpDetectorSetup(std::string const fname){return dumpDetectorSetup(fname,0);};
|
||||
virtual int retrieveDetectorSetup(std::string const fname, int level)=0;
|
||||
int retrieveDetectorSetup(std::string const fname){return retrieveDetectorSetup(fname,0);};
|
||||
virtual int dumpDetectorSetup(std::string const fname, int level = 0)=0;
|
||||
virtual int retrieveDetectorSetup(std::string const fname, int level = 0)=0;
|
||||
/**
|
||||
@short
|
||||
\returns the default output file index
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <sys/shm.h>
|
||||
#include <time.h> //clock()
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
using namespace std;
|
||||
|
||||
slsDetectorUtils::slsDetectorUtils() {
|
||||
@ -64,9 +65,12 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
if(!receiver){
|
||||
setDetectorIndex(-1);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&mg);
|
||||
int nc=setTimer(CYCLES_NUMBER,-1);
|
||||
int nf=setTimer(FRAME_NUMBER,-1);
|
||||
pthread_mutex_unlock(&mg);
|
||||
|
||||
|
||||
if (nc==0) nc=1;
|
||||
if (nf==0) nf=1;
|
||||
int multiframe = nc*nf;
|
||||
@ -635,316 +639,5 @@ void slsDetectorUtils::setCurrentProgress(int i){
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
|
||||
|
||||
|
||||
|
||||
slsDetectorCommand *cmd;
|
||||
|
||||
|
||||
// char ext[100];
|
||||
int skip=0;
|
||||
string fname;
|
||||
string str;
|
||||
ifstream infile;
|
||||
int iargval;
|
||||
int interrupt=0;
|
||||
char *args[10];
|
||||
|
||||
char myargs[10][1000];
|
||||
|
||||
//args[0]=myargs[0];
|
||||
//args[1]=myargs[1];
|
||||
|
||||
string sargname, sargval;
|
||||
int iline=0;
|
||||
|
||||
if (level==2) {
|
||||
// fname=fname1+string(".config");
|
||||
// readConfigurationFile(fname);
|
||||
#ifdef VERBOSE
|
||||
cout << "config file read" << endl;
|
||||
#endif
|
||||
fname=fname1+string(".det");
|
||||
} else
|
||||
fname=fname1;
|
||||
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
cmd=new slsDetectorCommand(this);
|
||||
while (infile.good() and interrupt==0) {
|
||||
sargname="none";
|
||||
sargval="0";
|
||||
getline(infile,str);
|
||||
iline++;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< str << std::endl;
|
||||
#endif
|
||||
if (str.find('#')!=string::npos) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Line is a comment " << std::endl;
|
||||
std::cout<< str << std::endl;
|
||||
#endif
|
||||
continue;
|
||||
} else {
|
||||
istringstream ssstr(str);
|
||||
iargval=0;
|
||||
while (ssstr.good()) {
|
||||
ssstr >> sargname;
|
||||
// if (ssstr.good()) {
|
||||
strcpy(myargs[iargval],sargname.c_str());
|
||||
args[iargval]=myargs[iargval];
|
||||
#ifdef VERBOSE
|
||||
std::cout<< args[iargval] << std::endl;
|
||||
#endif
|
||||
iargval++;
|
||||
// }
|
||||
skip=0;
|
||||
}
|
||||
|
||||
if (level!=2) {
|
||||
if (string(args[0])==string("flatfield"))
|
||||
skip=1;
|
||||
else if (string(args[0])==string("badchannels"))
|
||||
skip=1;
|
||||
else if (string(args[0])==string("trimbits"))
|
||||
skip=1;
|
||||
}
|
||||
if (skip==0)
|
||||
cmd->executeLine(iargval,args,PUT_ACTION);
|
||||
}
|
||||
iline++;
|
||||
}
|
||||
delete cmd;
|
||||
infile.close();
|
||||
|
||||
} else {
|
||||
std::cout<< "Error opening " << fname << " for reading" << std::endl;
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Read " << iline << " lines" << std::endl;
|
||||
#endif
|
||||
|
||||
if (getErrorMask())
|
||||
return FAIL;
|
||||
|
||||
return OK;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
||||
|
||||
slsDetectorCommand *cmd;
|
||||
detectorType type = getDetectorsType();
|
||||
string names[100];
|
||||
int nvar=0;
|
||||
|
||||
// common config
|
||||
names[nvar++]="fname";
|
||||
names[nvar++]="index";
|
||||
names[nvar++]="enablefwrite";
|
||||
names[nvar++]="overwrite";
|
||||
names[nvar++]="dr";
|
||||
names[nvar++]="settings";
|
||||
names[nvar++]="exptime";
|
||||
names[nvar++]="period";
|
||||
names[nvar++]="frames";
|
||||
names[nvar++]="cycles";
|
||||
names[nvar++]="measurements";
|
||||
names[nvar++]="timing";
|
||||
names[nvar++]="flatfield";
|
||||
names[nvar++]="badchannels";
|
||||
|
||||
switch (type) {
|
||||
case EIGER:
|
||||
names[nvar++]="flags";
|
||||
names[nvar++]="clkdivider";
|
||||
names[nvar++]="threshold";
|
||||
names[nvar++]="ratecorr";
|
||||
names[nvar++]="trimbits";
|
||||
break;
|
||||
case GOTTHARD:
|
||||
case PROPIX:
|
||||
names[nvar++]="flags";
|
||||
names[nvar++]="delay";
|
||||
names[nvar++]="gates";
|
||||
names[nvar++]="ratecorr";
|
||||
break;
|
||||
case JUNGFRAU:
|
||||
names[nvar++]="flags";
|
||||
names[nvar++]="delay";
|
||||
names[nvar++]="gates";
|
||||
names[nvar++]="ratecorr";
|
||||
names[nvar++]="clkdivider";
|
||||
break;
|
||||
case MYTHEN:
|
||||
names[nvar++]="flags";
|
||||
names[nvar++]="threshold";
|
||||
names[nvar++]="delay";
|
||||
names[nvar++]="gates";
|
||||
names[nvar++]="probes";
|
||||
names[nvar++]="fineoff";
|
||||
names[nvar++]="ratecorr";
|
||||
names[nvar++]="trimbits";
|
||||
break;
|
||||
case JUNGFRAUCTB:
|
||||
names[nvar++]="dac:0";
|
||||
names[nvar++]="dac:1";
|
||||
names[nvar++]="dac:2";
|
||||
names[nvar++]="dac:3";
|
||||
names[nvar++]="dac:4";
|
||||
names[nvar++]="dac:5";
|
||||
names[nvar++]="dac:6";
|
||||
names[nvar++]="dac:7";
|
||||
names[nvar++]="dac:8";
|
||||
names[nvar++]="dac:9";
|
||||
names[nvar++]="dac:10";
|
||||
names[nvar++]="dac:11";
|
||||
names[nvar++]="dac:12";
|
||||
names[nvar++]="dac:13";
|
||||
names[nvar++]="dac:14";
|
||||
names[nvar++]="dac:15";
|
||||
names[nvar++]="adcvpp";
|
||||
|
||||
|
||||
|
||||
names[nvar++]="adcclk";
|
||||
names[nvar++]="clkdivider";
|
||||
names[nvar++]="adcphase";
|
||||
names[nvar++]="adcpipeline";
|
||||
names[nvar++]="adcinvert"; //
|
||||
names[nvar++]="adcdisable";
|
||||
names[nvar++]="patioctrl";
|
||||
names[nvar++]="patclkctrl";
|
||||
names[nvar++]="patlimits";
|
||||
names[nvar++]="patloop0";
|
||||
names[nvar++]="patnloop0";
|
||||
names[nvar++]="patwait0";
|
||||
names[nvar++]="patwaittime0";
|
||||
names[nvar++]="patloop1";
|
||||
names[nvar++]="patnloop1";
|
||||
names[nvar++]="patwait1";
|
||||
names[nvar++]="patwaittime1";
|
||||
names[nvar++]="patloop2";
|
||||
names[nvar++]="patnloop2";
|
||||
names[nvar++]="patwait2";
|
||||
names[nvar++]="patwaittime2";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
names[nvar++]="startscript";
|
||||
names[nvar++]="startscriptpar";
|
||||
names[nvar++]="stopscript";
|
||||
names[nvar++]="stopscriptpar";
|
||||
names[nvar++]="scriptbefore";
|
||||
names[nvar++]="scriptbeforepar";
|
||||
names[nvar++]="scriptafter";
|
||||
names[nvar++]="scriptafterpar";
|
||||
names[nvar++]="scan0script";
|
||||
names[nvar++]="scan0par";
|
||||
names[nvar++]="scan0prec";
|
||||
names[nvar++]="scan0steps";
|
||||
names[nvar++]="scan1script";
|
||||
names[nvar++]="scan1par";
|
||||
names[nvar++]="scan1prec";
|
||||
names[nvar++]="scan1steps";
|
||||
|
||||
|
||||
int iv=0;
|
||||
string fname1;
|
||||
|
||||
|
||||
|
||||
ofstream outfile;
|
||||
char *args[4];
|
||||
for (int ia=0; ia<4; ia++) {
|
||||
args[ia]=new char[1000];
|
||||
}
|
||||
|
||||
|
||||
int nargs;
|
||||
if (level==2)
|
||||
nargs=2;
|
||||
else
|
||||
nargs=1;
|
||||
|
||||
|
||||
if (level==2) {
|
||||
fname1=fname+string(".config");
|
||||
writeConfigurationFile(fname1);
|
||||
fname1=fname+string(".det");
|
||||
} else
|
||||
fname1=fname;
|
||||
|
||||
|
||||
|
||||
outfile.open(fname1.c_str(),ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
cmd=new slsDetectorCommand(this);
|
||||
for (iv=0; iv<nvar-3; iv++) {
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
|
||||
}
|
||||
|
||||
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
if (level==2) {
|
||||
fname1=fname+string(".ff");
|
||||
strcpy(args[1],fname1.c_str());
|
||||
}
|
||||
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
|
||||
iv++;
|
||||
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
if (level==2) {
|
||||
fname1=fname+string(".bad");
|
||||
strcpy(args[1],fname1.c_str());
|
||||
}
|
||||
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
|
||||
iv++;
|
||||
|
||||
|
||||
|
||||
if (level==2) {
|
||||
strcpy(args[0],names[iv].c_str());
|
||||
size_t c=fname.rfind('/');
|
||||
if (c<string::npos) {
|
||||
fname1=fname.substr(0,c+1)+string("trim_")+fname.substr(c+1);
|
||||
} else {
|
||||
fname1=string("trim_")+fname;
|
||||
}
|
||||
strcpy(args[1],fname1.c_str());
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "writing to file " << fname1 << std::endl;
|
||||
#endif
|
||||
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
|
||||
iv++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
delete cmd;
|
||||
|
||||
outfile.close();
|
||||
}
|
||||
else {
|
||||
std::cout<< "Error opening parameters file " << fname1 << " for writing" << std::endl;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "wrote " <<iv << " lines to "<< fname1 << std::endl;
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -709,25 +709,6 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
void registerProgressCallback(int( *func)(double,void*), void *pArg){progress_call=func; pProgressCallArg=pArg;};
|
||||
|
||||
|
||||
/**
|
||||
Saves the detector setup to file
|
||||
\param fname file to write to
|
||||
\param level if 2 reads also trimbits, flat field, angular correction etc. and writes them to files with automatically added extension
|
||||
\returns OK or FAIL
|
||||
|
||||
*/
|
||||
int dumpDetectorSetup(std::string const fname, int level=0);
|
||||
|
||||
|
||||
/**
|
||||
Loads the detector setup from file
|
||||
\param fname file to read from
|
||||
\param level if 2 reads also reads trimbits, angular conversion coefficients etc. from files with default extensions as generated by dumpDetectorSetup
|
||||
\returns OK or FAIL
|
||||
|
||||
*/
|
||||
int retrieveDetectorSetup(std::string const fname, int level=0);
|
||||
|
||||
static int dummyAcquisitionFinished(double prog,int status,void* p){cout <<"Acquisition finished callback! " << prog << " " << status << endl; return 0;}
|
||||
static int dummyMeasurementFinished(int im,int findex,void* p){cout <<"Measurement finished callback! " << im << " " << findex << endl; return 0;}
|
||||
|
||||
|
@ -239,10 +239,7 @@ s
|
||||
void registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg) { \
|
||||
dataReady = userCallback; \
|
||||
pCallbackArg = pArg; \
|
||||
if (setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) { \
|
||||
enableDataStreamingToClient(1); \
|
||||
enableDataStreamingFromReceiver(1);}}; \
|
||||
|
||||
enableDataStreamingToClient(dataReady == NULL ? 0 : 1);}; \
|
||||
|
||||
void registerRawDataCallback(int( *userCallback)(double*, int, void*), void *pArg) {rawDataReady = userCallback; pRawDataArg = pArg;};
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsReceiverSoftware
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
|
||||
Revision: 870
|
||||
Branch: 4.1.0
|
||||
Repsitory UUID: b0fd4f4c44ac378744e724cce684aca4a56fe0fc
|
||||
Revision: 872
|
||||
Branch: 4.1.1
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4141
|
||||
Last Changed Date: 2019-10-04 09:28:28.000000001 +0200 ./updateAPIVersion.sh
|
||||
Last Changed Rev: 4153
|
||||
Last Changed Date: 2020-01-14 15:47:26.000000001 +0100 ./updateAPIVersion.sh
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
|
||||
#define GITREPUUID "b0fd4f4c44ac378744e724cce684aca4a56fe0fc"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4141
|
||||
#define GITDATE 0x20191004
|
||||
#define GITBRANCH "4.1.0"
|
||||
#define GITREV 0x4153
|
||||
#define GITDATE 0x20200114
|
||||
#define GITBRANCH "4.1.1"
|
||||
|
Reference in New Issue
Block a user