mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-04 18:31:18 +01: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
|
provider: script
|
||||||
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||||
on:
|
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
|
CONTENTS
|
||||||
--------
|
--------
|
||||||
@@ -17,12 +17,14 @@ This document describes the differences between 4.1.0 and 4.0.2 releases.
|
|||||||
1. Topics Concerning
|
1. Topics Concerning
|
||||||
====================
|
====================
|
||||||
|
|
||||||
- software for eiger quad hardware integrated
|
- detangled receiver streaming from data call back in client
|
||||||
- command line framesl, cyclesl was printing in float (jungfrau, gotthard)
|
and allow for unregister data call back in client
|
||||||
- eiger interrupt subframe flag
|
- (eiger) software trigger made to work along with blocking acquire
|
||||||
- eiger server reg command (+0x100 for left and +0x200 for right)
|
- bug fix for locks in blocking acquire
|
||||||
- additional eiger parameters included i master file
|
- 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
|
2. Resolved Issues
|
||||||
@@ -31,36 +33,21 @@ This document describes the differences between 4.1.0 and 4.0.2 releases.
|
|||||||
Client
|
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
|
3. Known Issues
|
||||||
===============
|
===============
|
||||||
@@ -69,7 +56,7 @@ This document describes the differences between 4.1.0 and 4.0.2 releases.
|
|||||||
|
|
||||||
4. Firmware Requirements
|
4. Firmware Requirements
|
||||||
========================
|
========================
|
||||||
|
|
||||||
Gotthard
|
Gotthard
|
||||||
========
|
========
|
||||||
Minimum compatible version : 11.01.2013
|
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}
|
\begin{verbatim}
|
||||||
sls_detector_put 0-parameters setup.det
|
sls_detector_put 0-parameters setup.det
|
||||||
\end{verbatim}
|
\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.
|
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:
|
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{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.
|
\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.
|
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}}.
|
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:
|
package:
|
||||||
name: sls_detector_software
|
name: sls_detector_software
|
||||||
version: 4.1.0
|
version: 4.1.1
|
||||||
|
|
||||||
source:
|
source:
|
||||||
- path: ..
|
- path: ..
|
||||||
@@ -50,14 +50,14 @@ requirements:
|
|||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
- name: sls_detector_lib
|
- name: sls_detector_lib
|
||||||
version: 4.1.0
|
version: 4.1.1
|
||||||
script: copy_lib.sh
|
script: copy_lib.sh
|
||||||
requirements:
|
requirements:
|
||||||
build:
|
build:
|
||||||
- {{ compiler('c') }}
|
- {{ compiler('c') }}
|
||||||
- {{compiler('cxx')}}
|
- {{compiler('cxx')}}
|
||||||
- name: sls_detector_gui
|
- name: sls_detector_gui
|
||||||
version: 4.1.0
|
version: 4.1.1
|
||||||
script: copy_gui.sh
|
script: copy_gui.sh
|
||||||
requirements:
|
requirements:
|
||||||
build:
|
build:
|
||||||
@@ -81,5 +81,5 @@ outputs:
|
|||||||
- {{ cdt('libxdamage') }} # [linux]
|
- {{ cdt('libxdamage') }} # [linux]
|
||||||
- {{ cdt('libxxf86vm') }} # [linux]
|
- {{ cdt('libxxf86vm') }} # [linux]
|
||||||
run:
|
run:
|
||||||
- sls_detector_lib=4.1.0
|
- sls_detector_lib=4.1.1
|
||||||
- qwt 6.1.4=hf484d3e_1001
|
- qwt 6.1.4=hf484d3e_1001
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorGui
|
Path: slsDetectorsPackage/slsDetectorGui
|
||||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
|
Repsitory UUID: b0fd4f4c44ac378744e724cce684aca4a56fe0fc
|
||||||
Revision: 532
|
Revision: 536
|
||||||
Branch: 4.1.0
|
Branch: 4.1.1
|
||||||
Last Changed Author: Dhanya_Thattil
|
Last Changed Author: Dhanya_Thattil
|
||||||
Last Changed Rev: 4141
|
Last Changed Rev: 4153
|
||||||
Last Changed Date: 2019-10-04 09:28:27.000000001 +0200 ./src/qTabSettings.cpp
|
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 GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||||
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
|
#define GITREPUUID "b0fd4f4c44ac378744e724cce684aca4a56fe0fc"
|
||||||
#define GITAUTH "Dhanya_Thattil"
|
#define GITAUTH "Dhanya_Thattil"
|
||||||
#define GITREV 0x4141
|
#define GITREV 0x4153
|
||||||
#define GITDATE 0x20191004
|
#define GITDATE 0x20200114
|
||||||
#define GITBRANCH "4.1.0"
|
#define GITBRANCH "4.1.1"
|
||||||
|
|||||||
@@ -373,6 +373,9 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
// Setting the callback function to get data from detector class
|
// 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)
|
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
|
//Setting the callback function to alert when acquisition finished from detector class
|
||||||
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this);
|
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this);
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#define MULTI_DETECTORS_NOT_ADDED 0x8000000000000000ULL
|
#define MULTI_DETECTORS_NOT_ADDED 0x8000000000000000ULL
|
||||||
#define MULTI_HAVE_DIFFERENT_VALUES 0x4000000000000000ULL
|
#define MULTI_HAVE_DIFFERENT_VALUES 0x4000000000000000ULL
|
||||||
#define MULTI_CONFIG_FILE_ERROR 0x2000000000000000ULL
|
#define MULTI_CONFIG_FILE_ERROR 0x2000000000000000ULL
|
||||||
|
#define MULTI_PARM_FILE_ERROR 0x1000000000000000ULL
|
||||||
|
|
||||||
|
|
||||||
// sls errors
|
// sls errors
|
||||||
#define CRITICAL_ERROR_MASK 0xFFFFFFF
|
#define CRITICAL_ERROR_MASK 0xFFFFFFF
|
||||||
@@ -302,7 +304,7 @@ public:
|
|||||||
retval.append("Could not set/get auto comparator disable\n");
|
retval.append("Could not set/get auto comparator disable\n");
|
||||||
|
|
||||||
if(slsErrorMask&CONFIG_FILE)
|
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
|
//------------------------------------------------------ length of message
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
|
Repsitory UUID: b0fd4f4c44ac378744e724cce684aca4a56fe0fc
|
||||||
Revision: 2094
|
Revision: 2101
|
||||||
Branch: 4.1.0
|
Branch: 4.1.1
|
||||||
Last Changed Author: Dhanya_Thattil
|
Last Changed Author: Dhanya_Thattil
|
||||||
Last Changed Rev: 4141
|
Last Changed Rev: 4153
|
||||||
Last Changed Date: 2019-10-04 10:33:35.000000001 +0200 ./threadFiles/ThreadPool.o
|
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 <rapidjson/document.h> //json header in zmq stream
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#include <sys/shm.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");
|
retval.append("Could not load Config File\n");
|
||||||
critical = 0;
|
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) {
|
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||||
//if the detector has error
|
//if the detector has error
|
||||||
if (multiMask & (1 << idet)) {
|
if (multiMask & (1 << idet)) {
|
||||||
@@ -1441,176 +1445,382 @@ int multiSlsDetector::readConfigurationFile(std::string const fname) {
|
|||||||
freeSharedMemory();
|
freeSharedMemory();
|
||||||
setupMultiDetector();
|
setupMultiDetector();
|
||||||
|
|
||||||
|
std::ifstream inFile;
|
||||||
multiSlsDetectorClient* cmd;
|
inFile.open(fname.c_str(), std::ifstream::in);
|
||||||
std::string ans;
|
if (!inFile.is_open()) {
|
||||||
std::string str;
|
cprintf(RED, "Cannot open config file %s\n", fname.c_str());
|
||||||
std::ifstream infile;
|
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
|
||||||
int iargval;
|
return FAIL;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
|
||||||
std::cout << "Read configuration file of " << iline << " lines" << std::endl;
|
while(inFile.good()) {
|
||||||
#endif
|
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);
|
setNumberOfModules(-1);
|
||||||
getMaxNumberOfModules();
|
getMaxNumberOfModules();
|
||||||
|
|
||||||
|
// check error
|
||||||
if (getErrorMask()) {
|
if (getErrorMask()) {
|
||||||
int c;
|
int c;
|
||||||
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
|
cprintf(RED, "\n----------------\n Error Messages\n----------------\n%s\n",
|
||||||
getErrorMessage(c).c_str());
|
getErrorMessage(c).c_str());
|
||||||
return FAIL;
|
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;
|
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[] = {
|
std::ifstream inFile;
|
||||||
"detsizechan",
|
inFile.open(fname.c_str(), std::ifstream::in);
|
||||||
"hostname",
|
if (!inFile.is_open()) {
|
||||||
"master",
|
cprintf(RED, "Cannot open parameter file %s\n", fname.c_str());
|
||||||
"sync",
|
setErrorMask(getErrorMask() | MULTI_PARM_FILE_ERROR);
|
||||||
"outdir",
|
return FAIL;
|
||||||
"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];
|
|
||||||
}
|
}
|
||||||
int ret = OK, ret1 = OK;
|
|
||||||
|
|
||||||
std::ofstream outfile;
|
while(inFile.good()) {
|
||||||
int iline = 0;
|
std::string sLine;
|
||||||
|
getline(inFile,sLine);
|
||||||
outfile.open(fname.c_str(), std::ios_base::out);
|
// delete lines after comments
|
||||||
if (outfile.is_open()) {
|
if (sLine.find('#') != std::string::npos) {
|
||||||
|
sLine.erase(sLine.find('#'));
|
||||||
slsDetectorCommand* cmd = new slsDetectorCommand(this);
|
}
|
||||||
|
// scan arguments
|
||||||
// complete size of detector
|
std::istringstream iss(sLine);
|
||||||
cout << iline << " " << names[iline] << endl;
|
std::vector<std::string> vec = std::vector<std::string>(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>());
|
||||||
strcpy(args[0], names[iline].c_str());
|
// blank lines
|
||||||
outfile << names[iline] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
if (vec.size() == 0 || vec[0].empty()) {
|
||||||
++iline;
|
continue;
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outfile << endl;
|
// skip commands according to level (setup=2)
|
||||||
//other configurations
|
if (level!=2) {
|
||||||
while (iline < nvar) {
|
if (vec[0] == "flatfield" ||
|
||||||
cout << iline << " " << names[iline] << endl;
|
vec[0] == "badchannels" ||
|
||||||
strcpy(args[0], names[iline].c_str());
|
vec[0] == "trimbits") {
|
||||||
outfile << names[iline] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
continue;
|
||||||
++iline;
|
}
|
||||||
}
|
}
|
||||||
|
int iarg = vec.size();
|
||||||
delete cmd;
|
// copy to char array
|
||||||
outfile.close();
|
char arr[iarg][MAX_STR_LENGTH];
|
||||||
#ifdef VERBOSE
|
memset(arr, 0, sizeof(arr));
|
||||||
std::cout << "wrote " << iline << " lines to configuration file " << std::endl;
|
char* args[iarg];
|
||||||
#endif
|
for (int i = 0; i < iarg; ++i) {
|
||||||
} else {
|
args[i] = arr[i];
|
||||||
std::cout << "Error opening configuration file " << fname << " for writing" << std::endl;
|
strcpy(args[i], vec[i].c_str());
|
||||||
setErrorMask(getErrorMask() | MULTI_CONFIG_FILE_ERROR);
|
}
|
||||||
ret = FAIL;
|
// execute command
|
||||||
|
multiSlsDetectorClient(iarg, args, PUT_ACTION, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int ia = 0; ia < 100; ++ia) {
|
inFile.close();
|
||||||
delete[] args[ia];
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
std::string multiSlsDetector::getSettingsFile() {
|
||||||
return callDetectorMember(&slsDetector::getSettingsFile);
|
return callDetectorMember(&slsDetector::getSettingsFile);
|
||||||
|
|||||||
@@ -795,6 +795,26 @@ public:
|
|||||||
*/
|
*/
|
||||||
int writeConfigurationFile(std::string const fname);
|
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 (Useless??)
|
||||||
* @returns the trimfile or settings file name
|
* @returns the trimfile or settings file name
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||||
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
|
#define GITREPUUID "b0fd4f4c44ac378744e724cce684aca4a56fe0fc"
|
||||||
#define GITAUTH "Dhanya_Thattil"
|
#define GITAUTH "Dhanya_Thattil"
|
||||||
#define GITREV 0x4141
|
#define GITREV 0x4153
|
||||||
#define GITDATE 0x20191004
|
#define GITDATE 0x20200114
|
||||||
#define GITBRANCH "4.1.0"
|
#define GITBRANCH "4.1.1"
|
||||||
|
|||||||
@@ -2407,254 +2407,126 @@ int slsDetector::updateDetector() {
|
|||||||
|
|
||||||
|
|
||||||
int slsDetector::readConfigurationFile(string const fname) {
|
int slsDetector::readConfigurationFile(string const fname) {
|
||||||
|
std::cout << "Cannot read config file from slsDetector level" << std::endl;
|
||||||
|
setErrorMask((getErrorMask())|(CONFIG_FILE));
|
||||||
|
return FAIL;
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) {
|
int slsDetector::writeConfigurationFile(string const fname) {
|
||||||
|
std::cout << "Cannot write config file from slsDetector level" << std::endl;
|
||||||
ofstream outfile;
|
setErrorMask((getErrorMask())|(CONFIG_FILE));
|
||||||
#ifdef VERBOSE
|
return FAIL;
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::writeConfigurationFile(ofstream &outfile, int id) {
|
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
|
// common config
|
||||||
names[nvar++] = "hostname";
|
commands.push_back("port");
|
||||||
names[nvar++] = "port";
|
commands.push_back("stopport");
|
||||||
names[nvar++] = "stopport";
|
commands.push_back("settingsdir");
|
||||||
names[nvar++] = "settingsdir";
|
commands.push_back("caldir");
|
||||||
names[nvar++] = "caldir";
|
commands.push_back("ffdir");
|
||||||
names[nvar++] = "ffdir";
|
commands.push_back("outdir");
|
||||||
names[nvar++] = "outdir";
|
commands.push_back("angdir");
|
||||||
names[nvar++] = "angdir";
|
commands.push_back("moveflag");
|
||||||
names[nvar++] = "moveflag";
|
commands.push_back("lock");
|
||||||
names[nvar++] = "lock";
|
|
||||||
|
|
||||||
// receiver config
|
// receiver config
|
||||||
if (type != MYTHEN) {
|
if (thisDetector->myDetectorType != MYTHEN) {
|
||||||
names[nvar++] = "detectormac";
|
commands.push_back("detectormac");
|
||||||
names[nvar++] = "detectorip";
|
commands.push_back("detectorip");
|
||||||
names[nvar++] = "zmqport";
|
commands.push_back("zmqport");
|
||||||
names[nvar++] = "rx_zmqport";
|
commands.push_back("rx_zmqport");
|
||||||
names[nvar++] = "zmqip";
|
commands.push_back("zmqip");
|
||||||
names[nvar++] = "rx_zmqip";
|
commands.push_back("rx_zmqip");
|
||||||
names[nvar++] = "rx_tcpport";
|
commands.push_back("rx_tcpport");
|
||||||
names[nvar++] = "rx_udpport";
|
commands.push_back("rx_udpport");
|
||||||
names[nvar++] = "rx_udpport2";
|
commands.push_back("rx_udpport2");
|
||||||
names[nvar++] = "rx_udpip";
|
commands.push_back("rx_udpip");
|
||||||
names[nvar++] = "rx_hostname";
|
commands.push_back("rx_hostname");
|
||||||
names[nvar++] = "r_readfreq";
|
commands.push_back("r_readfreq");
|
||||||
}
|
}
|
||||||
|
|
||||||
// detector specific config
|
// detector specific config
|
||||||
switch (type) {
|
switch (thisDetector->myDetectorType) {
|
||||||
case MYTHEN:
|
case MYTHEN:
|
||||||
names[nvar++] = "nmod";
|
commands.push_back("waitstates");
|
||||||
names[nvar++] = "waitstates";
|
commands.push_back("setlength");
|
||||||
names[nvar++] = "setlength";
|
commands.push_back("clkdivider");
|
||||||
names[nvar++] = "clkdivider";
|
commands.push_back("extsig");
|
||||||
names[nvar++] = "extsig";
|
|
||||||
break;
|
break;
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
case PROPIX:
|
case PROPIX:
|
||||||
names[nvar++] = "extsig";
|
|
||||||
names[nvar++] = "vhighvoltage";
|
|
||||||
break;
|
|
||||||
break;
|
|
||||||
case MOENCH:
|
case MOENCH:
|
||||||
names[nvar++] = "extsig";
|
commands.push_back("vhighvoltage");
|
||||||
names[nvar++] = "vhighvoltage";
|
|
||||||
break;
|
break;
|
||||||
case EIGER:
|
case EIGER:
|
||||||
names[nvar++] = "vhighvoltage";
|
commands.push_back("vhighvoltage");
|
||||||
names[nvar++] = "trimen";
|
commands.push_back("trimen");
|
||||||
names[nvar++] = "iodelay";
|
commands.push_back("iodelay");
|
||||||
names[nvar++] = "tengiga";
|
commands.push_back("tengiga");
|
||||||
break;
|
break;
|
||||||
case JUNGFRAU:
|
case JUNGFRAU:
|
||||||
names[nvar++] = "powerchip";
|
|
||||||
names[nvar++] = "vhighvoltage";
|
|
||||||
break;
|
|
||||||
case JUNGFRAUCTB:
|
case JUNGFRAUCTB:
|
||||||
names[nvar++] = "powerchip";
|
commands.push_back("powerchip");
|
||||||
names[nvar++] = "vhighvoltage";
|
commands.push_back("vhighvoltage");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cout << "detector type " <<
|
std::cout << "detector type " <<
|
||||||
getDetectorType(thisDetector->myDetectorType) << " not implemented in "
|
getDetectorType(thisDetector->myDetectorType) << " not implemented in "
|
||||||
"writing config file" << std::endl;
|
"writing config file" << std::endl;
|
||||||
nvar = 0;
|
return FAIL;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
slsDetectorCommand *cmd = new slsDetectorCommand(this);
|
||||||
int nsig=4;
|
char* args[2];
|
||||||
int iv=0;
|
args[0] = new char[MAX_STR_LENGTH];
|
||||||
char *args[100];
|
for (unsigned int i = 0; i < commands.size(); ++i) {
|
||||||
char myargs[100][1000];
|
if (commands[i] == "extsig") {
|
||||||
|
for (int is = 0; is < 4; ++is) {
|
||||||
for (int ia=0; ia<100; ++ia) {
|
if (id >= 0) {
|
||||||
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)
|
|
||||||
outfile << id << ":";
|
outfile << id << ":";
|
||||||
|
}
|
||||||
outfile << args[0] << " " << cmd->executeLine(1,args,GET_ACTION)
|
memset(args[0], 0, MAX_STR_LENGTH);
|
||||||
<< std::endl;
|
sprintf(args[0],"extsig:%d", is);
|
||||||
|
outfile << args[0] << " " << cmd->executeLine(1, args, GET_ACTION) << std::endl;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strcpy(args[0],names[iv].c_str());
|
if (id >= 0) {
|
||||||
if (id>=0)
|
|
||||||
outfile << id << ":";
|
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;
|
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() {
|
string slsDetector::getSettingsFile() {
|
||||||
@@ -3695,16 +3567,16 @@ int slsDetector::sendSoftwareTrigger() {
|
|||||||
#endif
|
#endif
|
||||||
thisDetector->stoppedFlag=0;
|
thisDetector->stoppedFlag=0;
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (connectControl() == OK){
|
if (stopSocket) {
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
if (connectStop() == OK){
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
stopSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
if (ret==FAIL) {
|
stopSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
if (ret==FAIL) {
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
stopSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
|
}
|
||||||
|
disconnectStop();
|
||||||
}
|
}
|
||||||
disconnectControl();
|
|
||||||
if (ret==FORCE_UPDATE)
|
|
||||||
updateDetector();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -852,20 +852,11 @@ public:
|
|||||||
int updateDetector();
|
int updateDetector();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load configuration from a configuration File
|
* should not be called at this level
|
||||||
* calls readConfigurationFile and gives it the stream
|
* @return FAIL
|
||||||
* @param fname configuration file name
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
*/
|
||||||
int readConfigurationFile(std::string const fname);
|
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
|
* Write current configuration to a file
|
||||||
* calls writeConfigurationFile giving it a stream to write to
|
* calls writeConfigurationFile giving it a stream to write to
|
||||||
@@ -882,6 +873,26 @@ public:
|
|||||||
*/
|
*/
|
||||||
int writeConfigurationFile(std::ofstream &outfile, int id=-1);
|
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 (Useless??)
|
||||||
* @returns the trimfile or settings file name
|
* @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 readConfigurationFile(std::string const fname)=0;
|
||||||
|
|
||||||
virtual int dumpDetectorSetup(std::string const fname, int level)=0;
|
virtual int dumpDetectorSetup(std::string const fname, int level = 0)=0;
|
||||||
int dumpDetectorSetup(std::string const fname){return dumpDetectorSetup(fname,0);};
|
virtual int retrieveDetectorSetup(std::string const fname, int level = 0)=0;
|
||||||
virtual int retrieveDetectorSetup(std::string const fname, int level)=0;
|
|
||||||
int retrieveDetectorSetup(std::string const fname){return retrieveDetectorSetup(fname,0);};
|
|
||||||
/**
|
/**
|
||||||
@short
|
@short
|
||||||
\returns the default output file index
|
\returns the default output file index
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#include <time.h> //clock()
|
#include <time.h> //clock()
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iterator>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
slsDetectorUtils::slsDetectorUtils() {
|
slsDetectorUtils::slsDetectorUtils() {
|
||||||
@@ -64,9 +65,12 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
if(!receiver){
|
if(!receiver){
|
||||||
setDetectorIndex(-1);
|
setDetectorIndex(-1);
|
||||||
}
|
}
|
||||||
|
pthread_mutex_lock(&mg);
|
||||||
int nc=setTimer(CYCLES_NUMBER,-1);
|
int nc=setTimer(CYCLES_NUMBER,-1);
|
||||||
int nf=setTimer(FRAME_NUMBER,-1);
|
int nf=setTimer(FRAME_NUMBER,-1);
|
||||||
|
pthread_mutex_unlock(&mg);
|
||||||
|
|
||||||
|
|
||||||
if (nc==0) nc=1;
|
if (nc==0) nc=1;
|
||||||
if (nf==0) nf=1;
|
if (nf==0) nf=1;
|
||||||
int multiframe = nc*nf;
|
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;};
|
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 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;}
|
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) { \
|
void registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg) { \
|
||||||
dataReady = userCallback; \
|
dataReady = userCallback; \
|
||||||
pCallbackArg = pArg; \
|
pCallbackArg = pArg; \
|
||||||
if (setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) { \
|
enableDataStreamingToClient(dataReady == NULL ? 0 : 1);}; \
|
||||||
enableDataStreamingToClient(1); \
|
|
||||||
enableDataStreamingFromReceiver(1);}}; \
|
|
||||||
|
|
||||||
|
|
||||||
void registerRawDataCallback(int( *userCallback)(double*, int, void*), void *pArg) {rawDataReady = userCallback; pRawDataArg = pArg;};
|
void registerRawDataCallback(int( *userCallback)(double*, int, void*), void *pArg) {rawDataReady = userCallback; pRawDataArg = pArg;};
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsReceiverSoftware
|
Path: slsDetectorsPackage/slsReceiverSoftware
|
||||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
|
Repsitory UUID: b0fd4f4c44ac378744e724cce684aca4a56fe0fc
|
||||||
Revision: 870
|
Revision: 872
|
||||||
Branch: 4.1.0
|
Branch: 4.1.1
|
||||||
Last Changed Author: Dhanya_Thattil
|
Last Changed Author: Dhanya_Thattil
|
||||||
Last Changed Rev: 4141
|
Last Changed Rev: 4153
|
||||||
Last Changed Date: 2019-10-04 09:28:28.000000001 +0200 ./updateAPIVersion.sh
|
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 GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||||
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
|
#define GITREPUUID "b0fd4f4c44ac378744e724cce684aca4a56fe0fc"
|
||||||
#define GITAUTH "Dhanya_Thattil"
|
#define GITAUTH "Dhanya_Thattil"
|
||||||
#define GITREV 0x4141
|
#define GITREV 0x4153
|
||||||
#define GITDATE 0x20191004
|
#define GITDATE 0x20200114
|
||||||
#define GITBRANCH "4.1.0"
|
#define GITBRANCH "4.1.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user