mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 15:27:13 +02:00
Compare commits
38 Commits
2020.03.17
...
udp
Author | SHA1 | Date | |
---|---|---|---|
f08006db46 | |||
d5df63ce49 | |||
64d59b1dff | |||
a0bc843018 | |||
6126a401d0 | |||
7665d7b33a | |||
d3d8d7ba8e | |||
938d90bfb8 | |||
990f32397b | |||
53b1456f1a | |||
fbb901c8cc | |||
7b7641fb53 | |||
4de49906d4 | |||
c9b5db4d7f | |||
2e6378f241 | |||
692584ced8 | |||
4ae93dbc73 | |||
f37ceaf517 | |||
75a9002f2c | |||
cfec18e441 | |||
3ff7654c29 | |||
9781dbe49e | |||
e777c0fa79 | |||
9981632b2d | |||
d8436da540 | |||
4dc4c1ec0a | |||
6537aa1ceb | |||
467be41ccb | |||
73a39fcafe | |||
041c9fefa0 | |||
4f4f3baefc | |||
3523de8ba9 | |||
e77a93021d | |||
4dc14bf9d6 | |||
a5cdd687e6 | |||
89175586b4 | |||
c3bbe45b68 | |||
8f64449117 |
@ -17,8 +17,7 @@ Checks: '*,
|
||||
-google-runtime-references,
|
||||
-google-readability-todo,
|
||||
-google-readability-braces-around-statements,
|
||||
-modernize-use-trailing-return-type,
|
||||
-readability-isolate-declaration'
|
||||
-modernize-use-trailing-return-type'
|
||||
|
||||
HeaderFilterRegex: \.h
|
||||
AnalyzeTemporaryDtors: false
|
||||
|
@ -4,6 +4,12 @@ language: cpp
|
||||
|
||||
os: linux
|
||||
|
||||
# env:
|
||||
# matrix:
|
||||
# - CONDA_PY="3.7"
|
||||
|
||||
|
||||
|
||||
dist: bionic
|
||||
|
||||
install:
|
||||
@ -33,6 +39,5 @@ deploy:
|
||||
provider: script
|
||||
script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||
on:
|
||||
branch: developer
|
||||
tags: true
|
||||
branch: udp
|
||||
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
|
||||
project(slsDetectorPackage)
|
||||
set(PROJECT_VERSION 5.0.0)
|
||||
include(CheckIPOSupported)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
|
||||
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
include(cmake/project_version.cmake)
|
||||
@ -44,9 +44,6 @@ option(SLS_USE_PYTHON "Python bindings" OFF)
|
||||
option(SLS_USE_CTBGUI "ctb GUI" OFF)
|
||||
option(SLS_BUILD_DOCS "docs" OFF)
|
||||
option(SLS_BUILD_EXAMPLES "examples" OFF)
|
||||
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
|
||||
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
@ -114,11 +111,6 @@ if(SLS_USE_SANITIZER)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
endif()
|
||||
|
||||
if(SLS_TUNE_LOCAL)
|
||||
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
|
||||
endif()
|
||||
|
||||
|
||||
#rapidjson
|
||||
add_library(rapidjson INTERFACE)
|
||||
target_include_directories(rapidjson INTERFACE
|
||||
@ -167,7 +159,7 @@ endif (SLS_USE_RECEIVER)
|
||||
|
||||
if (SLS_USE_GUI)
|
||||
find_package(Qt4 REQUIRED)
|
||||
find_package(Qwt 6.1 REQUIRED)
|
||||
find_package(Qwt 6 REQUIRED)
|
||||
if (QT4_FOUND AND QWT_FOUND)
|
||||
add_subdirectory(slsDetectorGui)
|
||||
endif()
|
||||
@ -203,9 +195,11 @@ if(SLS_BUILD_DOCS)
|
||||
add_subdirectory(docs)
|
||||
endif(SLS_BUILD_DOCS)
|
||||
|
||||
|
||||
|
||||
if(SLS_MASTER_PROJECT)
|
||||
# Set install dir CMake packages
|
||||
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")
|
||||
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/sls)
|
||||
# Set the list of exported targets
|
||||
set(PROJECT_LIBRARIES slsSupportLib slsDetectorShared slsReceiverShared)
|
||||
# Generate and install package config file and version
|
||||
|
113
README.md
113
README.md
@ -2,67 +2,90 @@
|
||||
Detailed documentation can be found on the [official site.](https://www.psi.ch/detectors/users-support)
|
||||
|
||||
### Binaries
|
||||
Binaries for the slsDetectorPackage are available through conda.
|
||||
```
|
||||
#Add conda channels
|
||||
conda config --add channels conda-forge
|
||||
conda config --add channels slsdetectorgroup
|
||||
|
||||
conda install slsdetlib #only shared lib and command line
|
||||
conda install slsdet #python bindings (includes slsdetlib)
|
||||
conda install slsdetgui #gui (includes qt4)
|
||||
|
||||
#Install specific version
|
||||
conda install slsdet=2020.03.02.dev0 #developer version from 3 March 2020
|
||||
|
||||
```
|
||||
Documentation to obtain the binaries via the conda package is available for [lib](https://github.com/slsdetectorgroup/sls_detector_lib) and [gui](https://github.com/slsdetectorgroup/sls_detector_gui)
|
||||
|
||||
### Source code
|
||||
One can also obtain the source code from this repository and compile.
|
||||
One can also obtain the source code from this repository and compile while realizing the setup dependencies as required.
|
||||
```
|
||||
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git
|
||||
|
||||
```
|
||||
#### Dependencies
|
||||
* Lib: c++11 compiler (gcc=>4.8), ZeroMQ 4
|
||||
* Gui: Qt 4.8 and Qwt 6.0
|
||||
* Calibration wizards and ctbGUI: ROOT
|
||||
* Optional: HDF5
|
||||
#### Setup dependencies
|
||||
* Gui Client <br>
|
||||
Requirements: Qt 4.8 and Qwt 6.0
|
||||
```
|
||||
export QTDIR=/usr/local/Trolltech/
|
||||
export QWTDIR=/usr/local/qwt-6.0.1/
|
||||
```
|
||||
If either of them does not exist, the GUI client will not be built.
|
||||
|
||||
* Advanced user Calibration wizards<br>
|
||||
Requirements: ROOT
|
||||
```
|
||||
export ROOTSYS=/usr/local/root-5.34
|
||||
```
|
||||
|
||||
#### Compilation
|
||||
|
||||
Compiling can be done in two ways. Either with the convenience script
|
||||
cmk.sh or directly with cmake for more control.
|
||||
Compiling can be done in two ways.
|
||||
|
||||
**1. Compile using script cmk.sh**<br>
|
||||
|
||||
After compiling, the libraries and executables will be found in `slsDetectorPackage/build/bin` directory<br>
|
||||
|
||||
Usage: [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
-[no option]: only make
|
||||
-c: Clean
|
||||
-b: Builds/Rebuilds CMake files normal mode
|
||||
-p: Builds/Rebuilds Python API
|
||||
-h: Builds/Rebuilds Cmake files with HDF5 package
|
||||
-d: HDF5 Custom Directory
|
||||
-t: Build/Rebuilds only text client
|
||||
-r: Build/Rebuilds only receiver
|
||||
-g: Build/Rebuilds only gui
|
||||
-s: Simulator
|
||||
-u: Chip Test Gui
|
||||
-j: Number of threads to compile through
|
||||
-e: Debug mode
|
||||
-i: Builds tests
|
||||
|
||||
eg. Rebuild when you switch to a new build and compile in parallel:
|
||||
./cmk.sh -bj5
|
||||
Usage: [-c] [-b] [-h] [-d HDF5 directory] [-j]<br>
|
||||
* -[no option]: only make<br>
|
||||
* -c: Clean<br>
|
||||
* -b: Builds/Rebuilds CMake files normal mode<br>
|
||||
* -h: Builds/Rebuilds Cmake files with HDF5 package<br>
|
||||
* -d: HDF5 Custom Directory<br>
|
||||
* -t: Build/Rebuilds only text client<br>
|
||||
* -r: Build/Rebuilds only receiver<br>
|
||||
* -g: Build/Rebuilds only gui<br>
|
||||
* -j: Number of threads to compile through<br>
|
||||
* -e: Debug mode
|
||||
|
||||
Basic Option:
|
||||
./cmk.sh -b
|
||||
|
||||
For only make:
|
||||
./cmk.sh
|
||||
|
||||
For make clean;make:
|
||||
./cmk.sh -c
|
||||
|
||||
For using hdf5 without custom dir /blabla:
|
||||
./cmk.sh -h -d /blabla
|
||||
|
||||
For rebuilding cmake without hdf5
|
||||
./cmk.sh -b
|
||||
|
||||
For using multiple cores to compile faster:
|
||||
./cmk.sh -j9<br>
|
||||
|
||||
|
||||
For rebuilding only certain sections<br>
|
||||
./cmk.sh -tg #only text client and gui<br>
|
||||
./cmk.sh -r #only receiver<br>
|
||||
|
||||
|
||||
**2. Compile without script**<br>
|
||||
Use cmake to create out-of-source builds, by creating a build folder parallel to source directory. This would create a debug build with address sanitizers.
|
||||
Use cmake to create out-of-source builds, by creating a build folder parallel to source directory.
|
||||
```
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON
|
||||
$ make -j12 #or whatever number of threads wanted
|
||||
$ cd ..
|
||||
$ mkdir slsDetectorPackage-build
|
||||
$ cd slsDetectorPackage-build
|
||||
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
|
||||
$ make
|
||||
```
|
||||
|
||||
Use the following as an example to compile statically and using specific hdf5 folder
|
||||
```
|
||||
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
|
||||
```
|
||||
After compiling, the libraries and executables will be found at `bin` directory
|
||||
```
|
||||
$ ls bin/
|
||||
gui_client libSlsDetector.a libSlsDetector.so libSlsReceiver.a libSlsReceiver.so
|
||||
sls_detector_acquire sls_detector_get slsDetectorGui sls_detector_help sls_detector_put slsReceiver slsMultiReceiver
|
||||
```
|
||||
|
@ -15,20 +15,17 @@ configure_package_config_file(
|
||||
write_basic_package_version_file(
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
install(FILES
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
|
||||
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
|
||||
COMPONENT devel
|
||||
DESTINATION ${CMAKE_INSTALL_DIR}
|
||||
)
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
|
||||
|
||||
if (PROJECT_LIBRARIES OR PROJECT_STATIC_LIBRARIES)
|
||||
install(
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
FILE ${PROJECT_NAME_LOWER}-targets.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_DIR}
|
||||
)
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
|
||||
endif ()
|
||||
|
4
cmk.sh
4
cmk.sh
@ -187,8 +187,8 @@ fi
|
||||
|
||||
#Debug
|
||||
if [ $DEBUG -eq 1 ]; then
|
||||
# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
|
||||
# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
|
||||
echo "Debug Option enabled"
|
||||
fi
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
||||
version: "udp"
|
||||
|
||||
source:
|
||||
- path: ..
|
||||
|
||||
build:
|
||||
number: 2
|
||||
number: 1
|
||||
binary_relocation: True
|
||||
rpaths:
|
||||
- lib/
|
||||
|
@ -29,10 +29,9 @@
|
||||
#include "sls_detector_defs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "moench03CtbData.h"
|
||||
//#include "moench03TCtbData.h"
|
||||
//#include "moench03T1CtbData.h"
|
||||
#include "moench03TCtbData.h"
|
||||
#include "moench03T1CtbData.h"
|
||||
#include "moench03CommonMode.h"
|
||||
#include "moench03T1ZmqDataNew.h"
|
||||
#include "moench02CtbData.h"
|
||||
//#include "jungfrau10ModuleData.h"
|
||||
#include "moenchCommonMode.h"
|
||||
@ -44,9 +43,6 @@
|
||||
#include "moench04CtbZmq10GbData.h"
|
||||
#include "deserializer.h"
|
||||
#include "detectorData.h"
|
||||
#include "imageZmq16bit.h"
|
||||
#include "imageZmq32bit.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -236,10 +232,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
cbDetType->AddEntry("MOENCH02", MOENCH02);
|
||||
cbDetType->AddEntry("MOENCH04", MOENCH04);
|
||||
// cbDetType->AddEntry("JUNGFRAU1.0", 2);
|
||||
cbDetType->AddEntry("MOENCH03",MOENCH03);
|
||||
cbDetType->AddEntry("IMAGE32BIT",IMAGE32B);
|
||||
cbDetType->AddEntry("IMAGE16BIT",IMAGE16B);
|
||||
|
||||
//cbDetType->AddEntry("MOENCH03 T", iiii++);
|
||||
//cbDetType->AddEntry("MOENCH03", iiii++);
|
||||
// cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301);
|
||||
// cbDetType->AddEntry("ADCSAR2", ADCSAR2);
|
||||
@ -278,7 +271,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
|
||||
|
||||
// cout << "off "<< endl;
|
||||
cout << "off "<< endl;
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
@ -297,8 +290,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eSerOff->MapWindow();
|
||||
eSerOff->SetNumber(0);
|
||||
eSerOff->MapWindow();;
|
||||
eSerOff->SetNumber(5);
|
||||
e= eSerOff->TGNumberEntry::GetNumberEntry();
|
||||
eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeSerialOffset()");
|
||||
@ -344,53 +337,6 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
hframe->MapWindow();
|
||||
|
||||
|
||||
|
||||
label=new TGLabel(hframe,"Image Pixels");
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
|
||||
label->MapWindow();
|
||||
label->SetTextJustify(kTextLeft);
|
||||
|
||||
|
||||
label=new TGLabel(hframe,"X: ");
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
|
||||
label->MapWindow();
|
||||
label->SetTextJustify(kTextRight);
|
||||
|
||||
|
||||
ePixX=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(ePixX,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
ePixX->MapWindow();
|
||||
ePixX->SetNumber(400);
|
||||
e= ePixX->TGNumberEntry::GetNumberEntry();
|
||||
ePixX->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()");
|
||||
|
||||
|
||||
|
||||
label=new TGLabel(hframe,"Y: ");
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
|
||||
label->MapWindow();
|
||||
label->SetTextJustify(kTextRight);
|
||||
|
||||
|
||||
ePixY=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(ePixY,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
ePixY->MapWindow();
|
||||
ePixY->SetNumber(400);
|
||||
e= ePixY->TGNumberEntry::GetNumberEntry();
|
||||
ePixY->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()");
|
||||
|
||||
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
@ -663,10 +609,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
cout <<"Registering data callback" << endl;
|
||||
try {
|
||||
myDet->registerDataCallback(&dataCallback, (void*)this);
|
||||
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||
try {
|
||||
myDet->setRxZmqDataStream(true);
|
||||
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
|
||||
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||
|
||||
cout <<"Done" << endl;
|
||||
|
||||
// mgAdcs=new TMultiGraph();
|
||||
@ -888,7 +832,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
// cout <<"global plot is " << globalPlot << endl;
|
||||
// cout << "*******************************************" <<endl;
|
||||
cout <<"------Plot: "<< index << " prog:" << data->progressIndex << " nx:" << data->nx << " ny: " << data->ny << " " << data->fileName << " bytes: " << data->databytes << " dr:"<< data->dynamicRange << " fi: " << data ->fileIndex << endl;
|
||||
// cout <<"------Plot: "<< index << " prog:" << data->progressIndex << " npoints:" << data->npoints << " npy: " << data->npy << " " << data->fileName << " bytes: " << data->databytes << " dr:"<< data->dynamicRange << " fi: " << data ->fileIndex << endl;
|
||||
if (globalPlot || cbGetPedestal->IsOn()) {
|
||||
//#ifdef TESTADC
|
||||
// cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
|
||||
@ -915,11 +859,6 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
nx=eNumCount->GetIntNumber();
|
||||
dr=eDynRange->GetIntNumber();
|
||||
soff=eSerOff->GetIntNumber();
|
||||
// cout <<"deserializer: " << endl;
|
||||
// cout << "Number of chans:\t" << nx << endl;
|
||||
// cout << "Serial Offset:\t" << soff << endl;
|
||||
// cout << "Dynamic range:\t" << dr << endl;
|
||||
|
||||
}
|
||||
|
||||
i=0;
|
||||
@ -984,8 +923,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
for (int y=0; y<ny; y++) {
|
||||
ped=0;
|
||||
aval=dataStructure->getValue(data->data,x,y);
|
||||
//aval=dataStructure->getChannel(data->data,x,y);
|
||||
cout << x << " " <<y << " "<< aval << endl;
|
||||
|
||||
if (cbGetPedestal->IsOn()) {
|
||||
if (photonFinder) {
|
||||
photonFinder->addToPedestal(aval,x,y);
|
||||
@ -1156,20 +1094,8 @@ void ctbAcquisition::Draw(){
|
||||
void ctbAcquisition::changePlot(){
|
||||
if (rbPlotOff->IsOn()) {
|
||||
adcPlot=0;
|
||||
dbitPlot=0;
|
||||
try {
|
||||
myDet->registerDataCallback(nullptr, this);
|
||||
} CATCH_DISPLAY ("Could not get unregister call back.", "ctbAcquisition::ctbAcquisition")
|
||||
try {
|
||||
myDet->setRxZmqDataStream(false);
|
||||
} CATCH_DISPLAY ("Could not get unset RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
|
||||
dbitPlot=0;
|
||||
} else {
|
||||
try {
|
||||
myDet->registerDataCallback(&dataCallback, (void*)this);
|
||||
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||
try {
|
||||
myDet->setRxZmqDataStream(true);
|
||||
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
|
||||
adcPlot=0;
|
||||
dbitPlot=0;
|
||||
for (int ii=0; ii<NADCS; ii++)
|
||||
@ -1274,9 +1200,6 @@ void ctbAcquisition::changeDetector(){
|
||||
eNumCount->SetState(kFALSE);
|
||||
eDynRange->SetState(kFALSE);
|
||||
eSerOff->SetState(kFALSE);
|
||||
ePixX->SetState(kFALSE);
|
||||
ePixY->SetState(kFALSE);
|
||||
|
||||
deserializer=0;
|
||||
if (rb2D->IsOn() ) {//|| rbScan->IsOn()
|
||||
switch (cbDetType->GetSelected()) {
|
||||
@ -1287,6 +1210,7 @@ void ctbAcquisition::changeDetector(){
|
||||
// commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH04:
|
||||
|
||||
try {
|
||||
auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
if (retval) {
|
||||
@ -1299,54 +1223,6 @@ void ctbAcquisition::changeDetector(){
|
||||
cout << "MOENCH 0.4!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH03:
|
||||
//try {
|
||||
// auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
// if (retval) {
|
||||
dataStructure=new moench03T1ZmqDataNew(nAnalogSamples);
|
||||
// } else {
|
||||
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
// }
|
||||
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "MOENCH 0.3! USE JUNGFRAU MODULE!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case IMAGE32B:
|
||||
//try {
|
||||
// auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
// if (retval) {
|
||||
// if (deserializer) {
|
||||
ePixX->SetState(kTRUE);
|
||||
ePixY->SetState(kTRUE);
|
||||
// }
|
||||
dataStructure=new imageZmq32bit(ePixX->GetIntNumber(),ePixY->GetIntNumber());
|
||||
// } else {
|
||||
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
// }
|
||||
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "Image 32bit, no channel shuffling" << endl;
|
||||
commonMode=NULL;
|
||||
break;
|
||||
|
||||
case IMAGE16B:
|
||||
//try {
|
||||
// auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
// if (retval) {
|
||||
// if (deserializer) {
|
||||
ePixX->SetState(kTRUE);
|
||||
ePixY->SetState(kTRUE);
|
||||
// }
|
||||
dataStructure=new imageZmq16bit(ePixX->GetIntNumber(),ePixY->GetIntNumber());
|
||||
// } else {
|
||||
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
// }
|
||||
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "Image 16bit, no channel shuffling" << endl;
|
||||
commonMode=NULL;
|
||||
break;
|
||||
|
||||
// case 1:
|
||||
// cout << "************** T!!!!!!!!!!" << endl;
|
||||
@ -1410,7 +1286,6 @@ void ctbAcquisition::changeDetector(){
|
||||
photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode
|
||||
//photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode
|
||||
dataStructure->getDetectorSize(nx,ny);
|
||||
|
||||
}
|
||||
if (deserializer) {
|
||||
ny=1;
|
||||
@ -1636,13 +1511,13 @@ void ctbAcquisition::update() {
|
||||
|
||||
if (dataStructure) {
|
||||
cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
// cout << "settings deserialiation parameters for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// eSerOff->SetNumber( ms->setSerialOffset(-1));
|
||||
// eDynRange->SetNumber( ms->setDynamicRange(-1));
|
||||
// eNumCount->SetNumber( ms->setNumberOfCounters(-1));
|
||||
// }
|
||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
cout << "settings deserialiation parameters for MYTHEN" << endl;
|
||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
eSerOff->SetNumber( ms->setSerialOffset(-1));
|
||||
eDynRange->SetNumber( ms->setDynamicRange(-1));
|
||||
eNumCount->SetNumber( ms->setNumberOfCounters(-1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2102,22 +1977,20 @@ void ctbAcquisition::ChangeNumberOfChannels(Long_t a){
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeSerialOffset(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
// cout << "settings offsets for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
// // cout << cbDetType->GetSelected()<< endl;
|
||||
// // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
// // cout << "settings offsets for MYTHEN" << endl;
|
||||
// // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// // ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
|
||||
// }
|
||||
// // }
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeDynamicRange(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
@ -2131,7 +2004,6 @@ void ctbAcquisition::ChangeDynamicRange(){
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeNumberOfChannels(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
@ -2145,24 +2017,6 @@ void ctbAcquisition::ChangeNumberOfChannels(){
|
||||
changePlot();
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeImagePixels(Long_t a){
|
||||
ChangeImagePixels();
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeImagePixels(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
// cout << "settings number of channels for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// ms->setNumberOfCounters(eNumCount->GetIntNumber());
|
||||
|
||||
// }
|
||||
// }
|
||||
// if (deserializer)
|
||||
// changePlot();
|
||||
};
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeHistoLimitsPedSub(Long_t a){
|
||||
|
@ -42,7 +42,7 @@ using namespace std;
|
||||
class ctbAcquisition : public TGGroupFrame {
|
||||
|
||||
|
||||
enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE32B, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
|
||||
|
||||
private:
|
||||
@ -57,9 +57,6 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
TGNumberEntry *eNumCount;
|
||||
|
||||
|
||||
TGNumberEntry *ePixX;
|
||||
TGNumberEntry *ePixY;
|
||||
|
||||
TGNumberEntry *eFitADC;
|
||||
TGNumberEntry *eBitPlot;
|
||||
TGNumberEntry *eMinRaw;
|
||||
@ -234,8 +231,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
void ChangeNumberOfChannels(Long_t);
|
||||
void ChangeDynamicRange();
|
||||
void ChangeDynamicRange(Long_t);
|
||||
void ChangeImagePixels();
|
||||
void ChangeImagePixels(Long_t);
|
||||
|
||||
|
||||
void canvasClicked();
|
||||
void FitADC();
|
||||
|
@ -108,26 +108,15 @@ string ctbDac::getLabel() {
|
||||
|
||||
}
|
||||
|
||||
int ctbDac::getMoenchDacId() {
|
||||
slsDetectorDefs::dacIndex moenchDacIndices[8] = {slsDetectorDefs::VBP_COLBUF, slsDetectorDefs::VIPRE, slsDetectorDefs::VIN_CM, slsDetectorDefs::VB_SDA, slsDetectorDefs::VCASC_SFP, slsDetectorDefs::VOUT_CM, slsDetectorDefs::VIPRE_CDS, slsDetectorDefs::IBIAS_SFP};
|
||||
|
||||
if (id >= 8) {
|
||||
return id;
|
||||
}
|
||||
return static_cast<int>(moenchDacIndices[id]);
|
||||
}
|
||||
|
||||
void ctbDac::setValue(Long_t a) {setValue();}
|
||||
|
||||
void ctbDac::setValue() {
|
||||
|
||||
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
|
||||
|
||||
try {
|
||||
int sid = id;
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
sid = getMoenchDacId();
|
||||
}
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(sid), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
|
||||
} CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue")
|
||||
|
||||
getValue();
|
||||
@ -139,11 +128,7 @@ void ctbDac::setOn(Bool_t b) {
|
||||
setValue();
|
||||
} else {
|
||||
try {
|
||||
int sid = id;
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
sid = getMoenchDacId();
|
||||
}
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(sid), -100, false);
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), -100, false);
|
||||
} CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn")
|
||||
}
|
||||
getValue();
|
||||
@ -151,11 +136,7 @@ void ctbDac::setOn(Bool_t b) {
|
||||
|
||||
int ctbDac::getValue() {
|
||||
try {
|
||||
int sid = id;
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
|
||||
sid = getMoenchDacId();
|
||||
}
|
||||
int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(sid), dacsUnit->IsOn()).tsquash("Different values");
|
||||
int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn()).tsquash("Different values");
|
||||
cout << "dac " << id << " " << val << endl;
|
||||
dacsValue->SetText(to_string(val).c_str());
|
||||
if (val >= 0) {
|
||||
|
@ -45,7 +45,7 @@ class ctbDac : public TGHorizontalFrame {
|
||||
|
||||
int setLabel(char *tit, int mv);
|
||||
string getLabel();
|
||||
int getMoenchDacId();
|
||||
|
||||
|
||||
|
||||
ClassDef(ctbDac,0)
|
||||
@ -54,6 +54,8 @@ int getMoenchDacId();
|
||||
class ctbDacs : public TGGroupFrame {
|
||||
private:
|
||||
|
||||
|
||||
|
||||
ctbDac *dacs[NDACS+2];
|
||||
|
||||
sls::Detector* myDet;
|
||||
|
@ -71,14 +71,14 @@ class ctbDefs {
|
||||
std::string exceptionMessage,
|
||||
std::string source) {
|
||||
// because sls_detector_exceptions cannot be included
|
||||
if (exceptionMessage.find("hared memory") != std::string::npos) {
|
||||
if (exceptionMessage.find("hared memory")) {
|
||||
throw;
|
||||
}
|
||||
if (exceptionMessage.find("annot connect") != std::string::npos) {
|
||||
if (exceptionMessage.find("annot connect")) {
|
||||
throw;
|
||||
}
|
||||
cprintf(RED, "Warning (%s): %s [Caught Exception: %s]\n", source.c_str(), message.c_str(), exceptionMessage.c_str());
|
||||
//return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
|
||||
};
|
||||
|
||||
};
|
||||
};
|
@ -259,10 +259,8 @@ ctbMain::ctbMain(const TGWindow *p, sls::Detector *det)
|
||||
|
||||
cout << "connect mtab" << endl;
|
||||
|
||||
try{
|
||||
setReadoutMode(pat->getReadoutMode());
|
||||
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||
|
||||
|
||||
setReadoutMode(pat->getReadoutMode());
|
||||
setADCEnable(adcs->setEnable());
|
||||
setAnalogSamples(pat->getAnalogSamples());
|
||||
setDigitalSamples(pat->getDigitalSamples());
|
||||
|
@ -1035,42 +1035,33 @@ void ctbPattern::readoutModeChanged(int flags) {
|
||||
|
||||
}
|
||||
|
||||
int ctbPattern::getReadoutMode() {
|
||||
int retval=slsDetectorDefs::ANALOG_ONLY;
|
||||
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
try{
|
||||
retval = myDet->getReadoutMode().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::ANALOG_AND_DIGITAL:
|
||||
cout << "analog and digital" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::DIGITAL_ONLY:
|
||||
cout << "digital only" << endl;
|
||||
cbAnalog->SetOn(kFALSE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::ANALOG_ONLY:
|
||||
cout << "analog only" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kFALSE);
|
||||
break;
|
||||
default:
|
||||
throw("unknown readout flag");
|
||||
}
|
||||
} else {
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kFALSE);
|
||||
}
|
||||
|
||||
int ctbPattern::getReadoutMode() {
|
||||
try{
|
||||
auto retval = myDet->getReadoutMode().tsquash("Different values");
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::ANALOG_AND_DIGITAL:
|
||||
cout << "analog and digital" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::DIGITAL_ONLY:
|
||||
cout << "digital only" << endl;
|
||||
cbAnalog->SetOn(kFALSE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::ANALOG_ONLY:
|
||||
cout << "analog only" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kFALSE);
|
||||
break;
|
||||
default:
|
||||
throw("unknown readout flag");
|
||||
}
|
||||
Emit("readoutModeChanged(int)",static_cast<int>(retval));
|
||||
return retval;
|
||||
|
||||
|
||||
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbPattern::getAnalogSamples() {
|
||||
@ -1084,17 +1075,13 @@ int ctbPattern::getAnalogSamples() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbPattern::getDigitalSamples() {
|
||||
int retval=0;
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
try{
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get number of digital samples.", "ctbPattern::getDigitalSamples")
|
||||
}
|
||||
eDigitalSamples->SetNumber((Double_t)retval);
|
||||
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
|
||||
return eDigitalSamples->GetNumber();
|
||||
|
||||
int ctbPattern::getDigitalSamples() {
|
||||
try{
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
eDigitalSamples->SetNumber((Double_t)retval);
|
||||
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
|
||||
return eDigitalSamples->GetNumber();
|
||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ find_package(Sphinx)
|
||||
|
||||
|
||||
if (DOXYGEN_FOUND AND SPHINX_FOUND)
|
||||
# message(${CMAKE_PROJECT_SORURCE_DIR}/slsDetectorSoftware/src)
|
||||
message(${CMAKE_PROJECT_SORURCE_DIR}/slsDetectorSoftware/src)
|
||||
# Utility to generate command line documentation
|
||||
add_executable(gendoc src/gendoc.cpp)
|
||||
# This is a bit hacky, but better than exposing stuff?
|
||||
@ -30,7 +30,6 @@ if (DOXYGEN_FOUND AND SPHINX_FOUND)
|
||||
set(SPHINX_SOURCE_FILES
|
||||
src/commandline.rst
|
||||
src/container_utils.rst
|
||||
src/consuming.rst
|
||||
src/dependencies.rst
|
||||
src/detector.rst
|
||||
src/index.rst
|
||||
@ -42,7 +41,6 @@ if (DOXYGEN_FOUND AND SPHINX_FOUND)
|
||||
src/result.rst
|
||||
src/type_traits.rst
|
||||
src/ToString.rst
|
||||
src/examples.rst
|
||||
|
||||
)
|
||||
|
||||
|
@ -1,95 +0,0 @@
|
||||
Consuming slsDetectorPackage
|
||||
===============================
|
||||
|
||||
Depending on how you want to build your integration with
|
||||
slsDetectorPackage there are a few different ways to
|
||||
consume our package. The recommended way is to use one of the
|
||||
CMake approaches.
|
||||
|
||||
|
||||
|
||||
CMake: slsDetectorPackage as submodule in your project
|
||||
---------------------------------------
|
||||
|
||||
If you are using CMake to build your integration and want to build everything
|
||||
in one go, we support adding slsDetectorPackage as a subfolder in your cmake project.
|
||||
|
||||
A minimal CMakeLists.txt could look like this:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
project(myDetectorIntegration)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
add_subdirectory(slsDetectorPackage)
|
||||
|
||||
#Add your executable
|
||||
add_executable(example main.cpp)
|
||||
target_compile_features(example PRIVATE cxx_std_11)
|
||||
|
||||
#Link towards slsDetectorShared
|
||||
target_link_libraries(example slsDetectorShared)
|
||||
|
||||
A fully working example can be found at:
|
||||
|
||||
https://github.com/slsdetectorgroup/cmake-subfolder-example
|
||||
|
||||
|
||||
CMake: find_package(slsDetectorPackage)
|
||||
------------------------------------------
|
||||
|
||||
If you have compiled and installed slsDetectorPackage we also support
|
||||
find_package in CMake. If installed in a system wide location no path
|
||||
should be needed, otherwise specify cmake prefix path.
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(myintegration)
|
||||
|
||||
find_package(slsDetectorPackage 5.0 REQUIRED)
|
||||
add_executable(example main.cpp)
|
||||
target_link_libraries(example slsDetectorShared)
|
||||
|
||||
|
||||
Then assuming the slsDetectorPackage is installed in /path/to/sls/install
|
||||
you should be able to configure and build your project in this way.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
cmake ../path/to/your/source -DCMAKE_PREFIX_PATH=/path/to/sls/install
|
||||
make
|
||||
|
||||
|
||||
A minimal example is available at: https://github.com/slsdetectorgroup/minimal-cmake
|
||||
|
||||
No tools minimal approach
|
||||
-----------------------------
|
||||
|
||||
While not recommended it is still possible to specify the include and library paths
|
||||
manually when invoking g++. This can sometimes be handy for a quick try.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include "Detector.h"
|
||||
#include <iostream>
|
||||
int main(){
|
||||
|
||||
sls::Detector det;
|
||||
|
||||
//Get all values and print them
|
||||
std::cout << "Hostname: " << det.getHostname() << "\n";
|
||||
std::cout << "Type: " << det.getDetectorType() << "\n";
|
||||
std::cout << "Udp ip: " << det.getSourceUDPIP() << "\n";
|
||||
|
||||
|
||||
//Get mac addr
|
||||
const int module = 0;
|
||||
auto mac = det.getSourceUDPMAC()[module];
|
||||
std::cout << "Mac addr of module "<< module << " is " << mac.str() << '\n';
|
||||
|
||||
}
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
g++ -I/install/path/include/ -L/install/path/lib64/ myapp.cpp -lSlsDetector -lSlsSupport -Wl,-rpath=../install/path/lib64
|
@ -13,7 +13,7 @@ To use the basic building blocks, meaning sls_detector_get/put and
|
||||
the shared libraries these are needed:
|
||||
|
||||
* Linux, preferably recent kernel (currently no cross platform support)
|
||||
* CMake > 3.12
|
||||
* CMake > 3.9
|
||||
* C++11 compatible compiler. (We test with gcc and clang)
|
||||
* ZeroMQ version 4
|
||||
|
||||
@ -24,7 +24,7 @@ GUI
|
||||
The GUI is currently using Qt4 but watch out for an upgrade to 5.
|
||||
|
||||
* Qt 4.8
|
||||
* Qwt 6.1
|
||||
* Qwt 6
|
||||
|
||||
-----------------------
|
||||
Python bindings
|
||||
|
@ -1,115 +0,0 @@
|
||||
|
||||
|
||||
|
||||
Examples
|
||||
===========
|
||||
|
||||
Setup
|
||||
------------
|
||||
|
||||
The examples here assume that you have compiled and installed slsDetectorPackage
|
||||
to ~/sls/install and that the option for SLS_USE_SIMULATOR was enabled. This also builds
|
||||
the virtual detector servers that we will be using for testing.
|
||||
|
||||
We also add ~/sls/detector/install/bin to the path for convenience.
|
||||
|
||||
Compile examples
|
||||
-------------------
|
||||
|
||||
The source code of the examples is available at:
|
||||
https://github.com/slsdetectorgroup/api-examples
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/slsdetectorgroup/api-examples.git
|
||||
mkdir build && cd build
|
||||
cmake ../api-examples -DCMAKE_PREFIX_PATH=~/sls/detector/install
|
||||
make
|
||||
|
||||
Below follows a short description of what is included in the examples.
|
||||
|
||||
|
||||
Running a config file [e1]
|
||||
-----------------------------
|
||||
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include "Detector.h"
|
||||
...
|
||||
sls::Detector det;
|
||||
det.loadConfig("path/to/config/file.config");
|
||||
|
||||
|
||||
|
||||
To configure the connection between PC and detector the easiest
|
||||
is to run a config file. For this example we first launch a virtual Jungfrau server and
|
||||
then set up the detector.
|
||||
|
||||
**Launch a virtual detector server**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
jungfrauDetectorServer_virtual
|
||||
|
||||
This launches a virtual Jungfrau detector server. As default is uses port 1952 and 1953
|
||||
for communication over TCP. Most commands go on 1952 and only stop and status on 1953.
|
||||
|
||||
**Run example to configure**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./e1-config one_det_no_receiver.config
|
||||
- 12:01:06.371 INFO: Shared memory deleted /slsDetectorPackage_multi_0_sls_0
|
||||
- 12:01:06.371 INFO: Shared memory deleted /slsDetectorPackage_multi_0
|
||||
- 12:01:06.372 INFO: Shared memory created /slsDetectorPackage_multi_0
|
||||
- 12:01:06.376 INFO: Loading configuration file: one_det_no_receiver.config
|
||||
- 12:01:06.376 INFO: Adding detector localhost
|
||||
- 12:01:06.377 INFO: Shared memory created /slsDetectorPackage_multi_0_sls_0
|
||||
- 12:01:06.377 INFO: Checking Detector Version Compatibility
|
||||
- 12:01:06.378 INFO: Detector connecting - updating!
|
||||
hostname [localhost]
|
||||
|
||||
|
||||
Jungfrau detector with 1 modules configured
|
||||
|
||||
|
||||
Using the return type sls::Result [e2]
|
||||
-----------------------------------------
|
||||
|
||||
Since many our detectors have multiple modules we cannot return
|
||||
a single value when reading from the Detector. Hostname, Ip and also
|
||||
for example exposure time can differ between modules.
|
||||
|
||||
Therefore we return Result<T> which is a thin wrapper around
|
||||
std::vector.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
sls::Result<int> res1{1, 1, 1};
|
||||
std::cout << "res1: " << res1 << '\n';
|
||||
res1.squash();
|
||||
res1.squash(-1);
|
||||
|
||||
|
||||
|
||||
Setting exposure time [e3]
|
||||
-----------------------------------------
|
||||
|
||||
For setting times, like exposure time, period, delay etc.
|
||||
we use std::chrono::duration.
|
||||
|
||||
Example 3 shows how to set and read exposure time as well
|
||||
as converting to floating point.
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
#include "Detector.h"
|
||||
#include <chrono>
|
||||
...
|
||||
std::chrono::microseconds t0{500};
|
||||
det.setExptime(t0);
|
||||
|
||||
|
||||
|
@ -6,18 +6,12 @@
|
||||
Welcome to slsDetectorPackage's documentation!
|
||||
==============================================
|
||||
|
||||
.. note ::
|
||||
|
||||
This is the documentation for the latest development version of slsDetectorPackage
|
||||
For documentation on current and previous releases visit the official page: https://www.psi.ch/en/detectors/documentation
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Installation:
|
||||
|
||||
installation
|
||||
dependencies
|
||||
consuming
|
||||
|
||||
.. toctree::
|
||||
:caption: C++ API
|
||||
@ -26,7 +20,6 @@ Welcome to slsDetectorPackage's documentation!
|
||||
detector
|
||||
result
|
||||
receiver
|
||||
examples
|
||||
|
||||
.. toctree::
|
||||
:caption: Python API
|
||||
|
@ -2,24 +2,4 @@
|
||||
Installation
|
||||
==============================================
|
||||
|
||||
Build from source using CMake
|
||||
---------------------------------
|
||||
|
||||
.. note ::
|
||||
|
||||
The default branch of our git repository is developer. It contains the
|
||||
latest development version. It is expected to compile and work but
|
||||
features might be added or tweaked. In some cases the API might also change
|
||||
without being communicated. If absolute stability of the API is needed please
|
||||
use one of the release versions.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git
|
||||
mkdir build && cd build
|
||||
cmake ../slsDetectorPackage -DCMAKE_INSTALL_PREFIX=/your/install/path
|
||||
make -j12
|
||||
make install
|
||||
|
||||
|
||||
|
||||
get the source etc.
|
@ -1,9 +1,9 @@
|
||||
Detector
|
||||
=====================================================
|
||||
|
||||
.. py:currentmodule:: slsdet
|
||||
.. py:currentmodule:: sls_detector
|
||||
|
||||
.. autoclass:: Detector
|
||||
.. autoclass:: ExperimentalDetector
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
140
examples/jctb_moench03_T1.config → examples/moench01_T1_lab.config
Normal file → Executable file
140
examples/jctb_moench03_T1.config → examples/moench01_T1_lab.config
Normal file → Executable file
@ -1,14 +1,4 @@
|
||||
initialchecks 0
|
||||
#############################################
|
||||
### edit with hostname or IP address of your detector
|
||||
############################################
|
||||
hostname bchip181+
|
||||
runclk 40
|
||||
adcclk 20
|
||||
dbitclk 40
|
||||
|
||||
|
||||
|
||||
hostname bchip085+
|
||||
|
||||
patword 0000 0000000000000000
|
||||
patword 0001 0000000000000000
|
||||
@ -418,84 +408,84 @@ patnloop1 0
|
||||
patloop2 0400 0400
|
||||
patnloop2 0
|
||||
patwait0 00aa
|
||||
patwaittime0 10000
|
||||
patwaittime0 40000
|
||||
patwait1 0400
|
||||
patwaittime1 0
|
||||
patwait2 0400
|
||||
patwaittime2 0
|
||||
|
||||
|
||||
#0:rx_tcpport 1977
|
||||
####mcp2011
|
||||
#0:rx_udpip 10.1.1.102
|
||||
#0:detectorip 10.1.1.19
|
||||
#0:rx_udpport 32410
|
||||
####gui listening to
|
||||
#zmqip 129.129.202.131
|
||||
#zmqport 30001
|
||||
####data streaming out of
|
||||
#rx_zmqip 10.1.2.103
|
||||
#rx_zmqport 30003
|
||||
#0:rx_hostname mpc2011
|
||||
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
#0:udp_dstip 10.1.1.102
|
||||
0:udp_dstip 129.129.202.136
|
||||
#############################################
|
||||
### edit with any number in the subnet of your server (first 3 numbers as above)
|
||||
############################################
|
||||
#0:udp_srcip 10.1.1.19
|
||||
0:udp_srcip 129.129.202.13
|
||||
|
||||
0:udp_dstport 33410
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
#zmqip 129.129.202.110
|
||||
#rx_zmqip 10.1.1.102
|
||||
#rx_zmqport 30001
|
||||
#############################################
|
||||
### edit with 1 Gbs IP of PC where you will run the GUI
|
||||
############################################
|
||||
#zmqip 129.129.202.110
|
||||
#zmqport 50001
|
||||
####mx-test-1
|
||||
0:rx_udpip 10.1.1.100
|
||||
0:detectorip 10.1.1.19
|
||||
0:rx_udpport 32410
|
||||
####gui listening to (on receiver pc)
|
||||
zmqip 129.129.202.92
|
||||
zmqport 30001
|
||||
####data streaming out of
|
||||
rx_zmqip 10.1.1.100
|
||||
rx_zmqport 30003
|
||||
0:rx_hostname pcmoench01
|
||||
|
||||
|
||||
#############################################
|
||||
### edit with hostname or 1Gbs IP address of your server
|
||||
############################################
|
||||
rx_hostname mpc2011
|
||||
|
||||
tengiga 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#turn on datastream from commandline
|
||||
rx_datastream 1
|
||||
rx_readfreq 1
|
||||
|
||||
r_readfreq 1
|
||||
|
||||
#0:configuremac -1
|
||||
rx_datastream 1
|
||||
|
||||
r_readfreq 1
|
||||
|
||||
|
||||
dac 6 800
|
||||
dac 0 1300
|
||||
dac 4 1428
|
||||
dac 1 1000
|
||||
dac 7 900
|
||||
dac 3 680
|
||||
dac 2 1400
|
||||
dac 5 1200
|
||||
dac:6 800
|
||||
dac:0 1300
|
||||
dac:4 1428
|
||||
dac:1 1000
|
||||
dac:7 900
|
||||
dac:3 680
|
||||
dac:2 1400
|
||||
dac:5 1200
|
||||
adcinvert 4a342593
|
||||
#0xb5cbda6c
|
||||
asamples 5000
|
||||
dsamples 0
|
||||
adcphase 30 deg
|
||||
adcpipeline 14
|
||||
samples 5000
|
||||
adcphase 90
|
||||
adcpipeline 15
|
||||
adcreg 14 40
|
||||
|
||||
|
||||
frames 1000
|
||||
period 0.001
|
||||
#############################################
|
||||
### edit with directory you want to write to
|
||||
############################################
|
||||
fpath /tmp/
|
||||
fwrite 0
|
||||
|
||||
romode analog
|
||||
#rx_jsonaddheader frameMode
|
||||
rx_jsonpara frameMode newpedestal
|
||||
#rx_jsonaddheader detectorMode
|
||||
rx_jsonpara detectorMode analog
|
||||
#flags newpedestal
|
||||
#flags analog
|
||||
|
||||
reg 0x5e 0x00010000
|
||||
#powerchip 1
|
||||
powerchip 1
|
||||
vhighvoltage 90
|
||||
period 0.005
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
frames 100
|
||||
period 0.1
|
||||
outdir /scratch/
|
||||
enablefwrite 0
|
||||
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
#initialchecks 0
|
||||
#############################################
|
||||
### edit with hostname or IP address of your detector
|
||||
############################################
|
||||
hostname bchip181+
|
||||
|
||||
|
||||
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
udp_dstip 10.1.1.102
|
||||
#############################################
|
||||
### edit with any number in the subnet of your server (first 3 numbers as above)
|
||||
############################################
|
||||
udp_srcip 10.1.1.19
|
||||
udp_dstport 33410
|
||||
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
#rx_zmqip 10.1.1.102
|
||||
#rx_zmqport 30001
|
||||
#############################################
|
||||
### edit with 1 Gbs IP of PC where you will run the GUI
|
||||
############################################
|
||||
#zmqip 129.129.202.136
|
||||
#zmqport 40001
|
||||
|
||||
|
||||
#############################################
|
||||
### edit with hostname or 1Gbs IP address of your server
|
||||
############################################
|
||||
rx_hostname mpc2011
|
||||
|
||||
|
||||
tengiga 1
|
||||
rx_datastream 1
|
||||
|
||||
|
||||
|
||||
frames 1
|
||||
period 0.001
|
||||
#############################################
|
||||
### edit with directory you want to write to
|
||||
############################################
|
||||
fpath /mnt/moench_data/scratch/
|
||||
fwrite 0
|
||||
rx_datastream 1
|
||||
|
||||
rx_jsonpara frameMode newpedestal
|
||||
rx_jsonpara detectorMode analog
|
||||
rx_discardpolicy discardpartial
|
||||
|
||||
|
||||
adcpipeline 15
|
||||
|
||||
powerchip 1
|
||||
vhighvoltage 90
|
||||
|
||||
adcreg 14 40
|
@ -4,7 +4,7 @@
|
||||
#include "ClientSocket.h"
|
||||
#include "logger.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "Module.h"
|
||||
#include "slsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include "Timer.h"
|
||||
@ -23,10 +23,10 @@
|
||||
// extern dt type;
|
||||
|
||||
TEST_CASE("Single detector no receiver", "[.integration][.single]") {
|
||||
auto t = Module::getTypeFromDetector(test::hostname);
|
||||
auto t = slsDetector::getTypeFromDetector(test::hostname);
|
||||
CHECK(t == test::type);
|
||||
|
||||
Module d(t);
|
||||
slsDetector d(t);
|
||||
CHECK(d.getDetectorTypeAsEnum() == t);
|
||||
CHECK(d.getDetectorTypeAsString() == test::detector_type);
|
||||
|
||||
@ -51,7 +51,7 @@ TEST_CASE("Set control port then create a new object with this control port",
|
||||
int new_cport = 1993;
|
||||
int new_sport = 2000;
|
||||
{
|
||||
Module d(test::type);
|
||||
slsDetector d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
CHECK(d.getControlPort() == old_cport);
|
||||
d.setControlPort(new_cport);
|
||||
@ -60,7 +60,7 @@ TEST_CASE("Set control port then create a new object with this control port",
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
{
|
||||
Module d(test::type);
|
||||
slsDetector d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
d.setControlPort(new_cport);
|
||||
d.setStopPort(new_sport);
|
||||
@ -73,7 +73,7 @@ TEST_CASE("Set control port then create a new object with this control port",
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
Module d(test::type);
|
||||
slsDetector d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
CHECK(d.getStopPort() == DEFAULT_PORTNO + 1);
|
||||
d.freeSharedMemory();
|
||||
@ -86,11 +86,11 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// Read type by connecting to the detector
|
||||
auto type = Module::getTypeFromDetector(c.hostname);
|
||||
auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||
CHECK(type == c.type_enum);
|
||||
|
||||
// Create Module of said type and set hostname and detector online
|
||||
Module d(type);
|
||||
// Create slsDetector of said type and set hostname and detector online
|
||||
slsDetector d(type);
|
||||
CHECK(d.getDetectorTypeAsEnum() == type);
|
||||
CHECK(d.getDetectorTypeAsString() == c.type_string);
|
||||
|
||||
@ -133,7 +133,7 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||
|
||||
|
||||
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||
Module d(test::type);
|
||||
slsDetector d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
|
||||
// Check that detector server is unlocked then lock
|
||||
@ -155,7 +155,7 @@ TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||
}
|
||||
|
||||
TEST_CASE("Set settings", "[.integration][.single]"){
|
||||
Module d(test::type);
|
||||
slsDetector d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
|
||||
}
|
||||
@ -185,7 +185,7 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
// MEASURED_SUBPERIOD, /**< measured subperiod */
|
||||
// MAX_TIMERS
|
||||
|
||||
Module d(test::type);
|
||||
slsDetector d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
|
||||
// Number of frames
|
||||
@ -226,8 +226,8 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
|
||||
// TEST_CASE("Aquire", "[.integration][eiger]"){
|
||||
// SingleDetectorConfig c;
|
||||
// auto type = Module::getTypeFromDetector(c.hostname);
|
||||
// Module d(type);
|
||||
// auto type = slsDetector::getTypeFromDetector(c.hostname);
|
||||
// slsDetector d(type);
|
||||
// d.setHostname(c.hostname);
|
||||
|
||||
// auto period = 1000000000;
|
||||
|
@ -176,7 +176,6 @@ 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:
|
||||
@ -610,19 +609,18 @@ The detector can be setup such to receive external triggers. Connect a LEMO sign
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_acquire 0-
|
||||
\end{verbatim}
|
||||
No timeout is expected between the start of the acquisition and the arrival of the first trigger.
|
||||
|
||||
Here are the implemented options so far:
|
||||
\begin{itemize}
|
||||
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of cycles (i.e. triggers) to 1 using {\tt{cycles}}. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{cycles}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\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{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of triggers (i.e. triggers) to 1 using {\tt{triggers}}. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{triggers}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\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{triggers}} 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{triggers}} 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}}.
|
||||
|
||||
@ -630,13 +628,13 @@ However, from 4.1.0, in gating mode, an option to immediately terminate the subf
|
||||
|
||||
Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be output in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal.
|
||||
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{triggers}} configurable at the same time.
|
||||
|
||||
There is the possibility to use {\tt{timing trigger/burst\_trigger}} and send software single commands to fake the trigger. This is done with:
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [trigger/burst_trigger]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_status trigger
|
||||
\end{verbatim}
|
||||
Note that this functionality is very (!) useful if you need to do something between and acquisition and the next. This can be used to do a fast threshold scan for example. See section~\ref{sec:fastthresholdscan}.
|
||||
@ -717,7 +715,7 @@ If \textbf{dr} is 32 and \textbf{clkdivider} is not 2, whatever the detector get
|
||||
Here is a list of parameters that should be reset:
|
||||
\begin{enumerate}
|
||||
\item \textbf{resetframescaught} should be reset to zero after every acquisition taken with {\tt{receiver start}},{\tt{status start}},{\tt{receiver stop}}. If the acquisition is taken with {\tt{sls\_detector\_acquire}}, there is no need to reset this.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{cycles}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{cycles} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{triggers}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{triggers} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
@ -990,14 +988,13 @@ Packets Caught Mask : 64 bytes
|
||||
Note that if one wants to reconstruct the real time the detector was acquiring in 32 bit (autosumming mode), one would have to multiply the SubExptime (ns) for the SubFrame Number.
|
||||
|
||||
\subsection{Offline image reconstruction}
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. However, it can be retrieved from \\
|
||||
{\tt{git clone https://github.com/slsdetectorgroup/slsImageReconstruction.git slsImageReconstruction}}.\\
|
||||
Checkout the {\tt{v3.1}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code. There is a {\tt{developer}} branch that has newer updates but needs to be tested.
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\
|
||||
{\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}.
|
||||
Checkout the {\tt{developer}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code.
|
||||
|
||||
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5}. \textbf{tiff} and \textbf{root} format. The detector writes 2 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
|
||||
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5} and \textbf{root} format. The detector writes 4 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
|
||||
|
||||
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in \\
|
||||
{\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
|
||||
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
|
||||
\begin{verbatim}
|
||||
#define EIGER_MAX_FRAMES_PER_FILE 2000
|
||||
\end{verbatim}
|
||||
@ -1046,12 +1043,11 @@ cbfMaker9M [file_name_with_dir]
|
||||
contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side), the 1.5M OMNY geometry (3 modules next to each other on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\
|
||||
Missing packets in a frame and border pixels ($\times 2$ and $\times 4$ are given with value $-1$ at the present time.
|
||||
|
||||
From the new {{v4.1.1}} all the define that you see below need only to be modified in the Makefile.
|
||||
|
||||
Make sure the following options are uncommented in the {\tt{slsImageReconstruction/src/main\_csaxs.cpp}} file.
|
||||
\begin{verbatim}
|
||||
#define MYCBF
|
||||
##following line only if you need to process with BUBBLE
|
||||
##following line only if you need to process with
|
||||
##BUBBLE (Material Science / uXAS beamlines).
|
||||
#define MSHeader
|
||||
\end{verbatim}
|
||||
Compile it with:
|
||||
@ -1100,10 +1096,6 @@ To use it any geometry:\\
|
||||
eg.
|
||||
{\tt image /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
|
||||
|
||||
With new new software, the new options to run the cbfMaker/hdf5Maker executablesare:
|
||||
|
||||
./hdf5Maker -f [filename] -d [outdirname] -x [npix\_x] -y [npix\_y] -v (v flags that longedge is vertical, no argument) -n [name\_of\_hdf5\_dataset] -m (mask\_hot\_pixels, need to be in file maskpix.txt in the samedir as executable, no argument) -g [0,no filling/1,division/2,interpolation/3,interpolate,alternative]
|
||||
|
||||
\subsection{Read temperatures/HV from boards}
|
||||
|
||||
With an updated kernel on the linux boards (ask to the SLS detector group for specifications), it is possible to monitor the temperature on the boards:
|
||||
@ -1265,7 +1257,7 @@ We have also been requested if we could speed up the threshold scan. At the mome
|
||||
./sls_detector_put enablefwrite 0
|
||||
./sls_detector_put resetframescaught 0
|
||||
./sls_detector_put index 0
|
||||
./sls_detector_put cycles 21
|
||||
./sls_detector_put triggers 21
|
||||
./sls_detector_put receiver start
|
||||
./sls_detector_put status start
|
||||
for i in $(seq 0 20);
|
||||
@ -1523,8 +1515,8 @@ frames number
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
\item \begin{verbatim}
|
||||
sls_detector_get cycles
|
||||
cycles number
|
||||
sls_detector_get triggers
|
||||
triggers number
|
||||
\end{verbatim}
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
|
@ -3,9 +3,9 @@ import sys
|
||||
import numpy as np
|
||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||
|
||||
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||
from slsdet import dacIndex, readoutMode
|
||||
from slsdet.lookup import view, find
|
||||
from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||
from sls_detector import dacIndex, readoutMode
|
||||
from sls_detector.lookup import view, find
|
||||
|
||||
d = Detector()
|
||||
# e = Eiger()
|
||||
|
@ -4,11 +4,10 @@ out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.ge
|
||||
cmd = out.stdout.splitlines()
|
||||
cmd.pop(0)
|
||||
|
||||
from slsdet import Detector, Eiger, Ctb
|
||||
from sls_detector import Detector, Eiger, Ctb
|
||||
|
||||
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
|
||||
|
||||
#Add commands that we should not expect as direct commands in python
|
||||
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
||||
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
||||
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
|
||||
|
@ -1,19 +1,11 @@
|
||||
"""
|
||||
Utility to find and list which command line functions have tests and
|
||||
where the tests are located
|
||||
"""
|
||||
#local import for for parsing c++
|
||||
import parse
|
||||
|
||||
#General python stuff
|
||||
from pathlib import Path
|
||||
import os
|
||||
import locale
|
||||
import argparse
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
#Realative path from this dir
|
||||
path = Path('../../slsDetectorSoftware/tests/')
|
||||
import subprocess
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None)
|
||||
args = parser.parse_args()
|
||||
@ -23,12 +15,15 @@ tested = []
|
||||
for fname in files:
|
||||
with open(path/fname) as f:
|
||||
data = f.read()
|
||||
|
||||
data = parse.remove_comments(data)
|
||||
data = data.splitlines()
|
||||
|
||||
|
||||
for line in data:
|
||||
if 'TEST_CASE' in line or 'SECTION' in line:
|
||||
cmd = line.split("\"")[1]
|
||||
tested.append([cmd, fname])
|
||||
tested.append(cmd)
|
||||
|
||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||
all_cmd = out.stdout.splitlines()
|
||||
@ -38,18 +33,18 @@ all_cmd.pop(0)
|
||||
|
||||
if args.startswith is not None:
|
||||
all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)]
|
||||
tested = [cmd for cmd in tested if cmd[0].startswith(args.startswith)]
|
||||
tested = [cmd for cmd in tested if cmd.startswith(args.startswith)]
|
||||
|
||||
tn = [cmd[0] for cmd in tested]
|
||||
|
||||
not_tested = [cmd for cmd in all_cmd if cmd not in tn]
|
||||
misnamed = [cmd for cmd in tn if cmd not in all_cmd]
|
||||
tested = [cmd for cmd in tested if cmd[0] in all_cmd]
|
||||
|
||||
not_tested = [cmd for cmd in all_cmd if cmd not in tested]
|
||||
misnamed = [cmd for cmd in tested if cmd not in all_cmd]
|
||||
tested = [cmd for cmd in tested if cmd in all_cmd]
|
||||
|
||||
|
||||
print("\nThe following commands are tested:")
|
||||
for cmd in tested:
|
||||
print(f'{cmd[0]:>18} : {cmd[1]}')
|
||||
print(cmd)
|
||||
|
||||
print("\nThe following commands are NOT tested:")
|
||||
for cmd in not_tested:
|
||||
|
@ -8,7 +8,7 @@ import sys
|
||||
import setuptools
|
||||
import os
|
||||
|
||||
__version__ = os.environ.get('GIT_DESCRIBE_TAG', 'developer')
|
||||
__version__ = 'udp'
|
||||
|
||||
|
||||
def get_conda_path():
|
||||
|
@ -1,9 +1,9 @@
|
||||
from .detector import Detector
|
||||
|
||||
def view(name, det = Detector):
|
||||
names = find(name, det)
|
||||
def view(name):
|
||||
names = find(name)
|
||||
for n in names:
|
||||
print(n)
|
||||
|
||||
def find(name, det = Detector):
|
||||
return [n for n in dir(det) if name.lower() in n.lower()]
|
||||
def find(name):
|
||||
return [n for n in dir(Detector) if name in n]
|
@ -428,13 +428,6 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setImageTestMode", &Detector::setImageTestMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getNumberOfBursts", &Detector::getNumberOfBursts,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfBursts", &Detector::setNumberOfBursts, py::arg())
|
||||
.def("getBurstPeriod", &Detector::getBurstPeriod,
|
||||
py::arg() = Positions{})
|
||||
.def("setBurstPeriod", &Detector::setBurstPeriod, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getInjectChannel", &Detector::getInjectChannel,
|
||||
py::arg() = Positions{})
|
||||
.def("setInjectChannel", &Detector::setInjectChannel, py::arg(),
|
||||
@ -448,14 +441,6 @@ void init_det(py::module &m) {
|
||||
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
||||
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getCurrentSource", &Detector::getCurrentSource,
|
||||
py::arg() = Positions{})
|
||||
.def("setCurrentSource", &Detector::setCurrentSource, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getTimingSource", &Detector::getTimingSource,
|
||||
py::arg() = Positions{})
|
||||
.def("setTimingSource", &Detector::setTimingSource, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getCounterMask", &Detector::getCounterMask,
|
||||
py::arg() = Positions{})
|
||||
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
||||
|
@ -284,11 +284,4 @@ void init_enums(py::module &m) {
|
||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
|
||||
.value("TIMING_INTERNAL",
|
||||
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
|
||||
.value("TIMING_EXTERNAL",
|
||||
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
|
||||
.export_values();
|
||||
}
|
||||
|
@ -1,35 +1,36 @@
|
||||
add_executable(using_logger using_logger.cpp)
|
||||
target_link_libraries(using_logger
|
||||
add_executable(a api.cpp)
|
||||
target_link_libraries(a
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
pthread
|
||||
rt
|
||||
)
|
||||
|
||||
set_target_properties(using_logger PROPERTIES
|
||||
set_target_properties(a PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
|
||||
# add_executable(result useResult.cpp)
|
||||
# target_link_libraries(result
|
||||
# slsDetectorShared
|
||||
# )
|
||||
add_executable(result useResult.cpp)
|
||||
target_link_libraries(result
|
||||
slsDetectorShared
|
||||
)
|
||||
|
||||
# set_target_properties(result PROPERTIES
|
||||
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
# )
|
||||
set_target_properties(result PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
# add_executable(udp udp.cpp)
|
||||
# target_link_libraries(udp
|
||||
# slsDetectorShared
|
||||
# slsSupportLib
|
||||
# pthread
|
||||
# rt
|
||||
# fmt
|
||||
# )
|
||||
add_executable(udp udp.cpp)
|
||||
target_link_libraries(udp
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
pthread
|
||||
rt
|
||||
fmt
|
||||
)
|
||||
|
||||
# set_target_properties(udp PROPERTIES
|
||||
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
# )
|
||||
set_target_properties(udp PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
#include "logger.h"
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
int main() {
|
||||
|
||||
//compare old and new
|
||||
std::cout << "Compare output between old and new:\n";
|
||||
LOG(logINFO) << "Some info message";
|
||||
LOG(logERROR) << "This is an error";
|
||||
LOG(logWARNING) << "While this is only a warning";
|
||||
|
||||
//Logging level can be configure at runtime
|
||||
std::cout << "\n\n";
|
||||
std::cout << "The default macro controlled level is: "
|
||||
<< sls::Logger::ToString(LOG_MAX_REPORTING_LEVEL) << '\n';
|
||||
|
||||
sls::Logger::ReportingLevel() = logERROR;
|
||||
LOG(logINFO) << "Now this is not written";
|
||||
LOG(logWARNING) << "and also not this";
|
||||
|
||||
sls::Logger::ReportingLevel() = logINFO;
|
||||
LOG(logINFO) << "But now we can see it";
|
||||
|
||||
|
||||
//The output can be redirected to another buffer
|
||||
std::ostringstream local;
|
||||
auto clog_buff = std::clog.rdbuf();
|
||||
std::clog.rdbuf(local.rdbuf());
|
||||
|
||||
LOG(logINFOBLUE) << "A message";
|
||||
LOG(logWARNING) << "And another one";
|
||||
|
||||
std::clog.rdbuf(clog_buff); // restore
|
||||
|
||||
std::cout << "local buf:\n" << local.str();
|
||||
|
||||
LOG(logINFO) << "After reset we should print directly";
|
||||
LOG(logINFOBLUE) << "some infoBLUE text";
|
||||
LOG(logINFOGREEN) << "some infoGREEN text";
|
||||
LOG(logINFORED) << "some infoRED text";
|
||||
|
||||
}
|
@ -423,7 +423,7 @@ template <class dataType> class analogDetector {
|
||||
if (g==0) g=-1.;
|
||||
}
|
||||
|
||||
return stat[iy][ix].getPedestalRMS();//divide by gain?
|
||||
return stat[iy][ix].getPedestalRMS()/g;//divide by gain?
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef DESERIALIZER_H
|
||||
#define DESERIALIZER_H
|
||||
#include <vector>
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
class deserializer : public slsDetectorData<int> {
|
||||
|
||||
@ -53,13 +52,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||
// off=0;
|
||||
//int iarg;
|
||||
|
||||
|
||||
cout <<"** deserializer: " << endl;
|
||||
cout << "** Number of chans:\t" << nch << endl;
|
||||
cout << "** Serial Offset:\t" << off << endl;
|
||||
cout << "** Dynamic range:\t" << dr << endl;
|
||||
int64_t word, *wp, ww,one=1, bit ;
|
||||
int64_t word, *wp;
|
||||
int* val=new int[nch];
|
||||
int ioff=0;
|
||||
int idr=0;
|
||||
@ -73,62 +66,39 @@ class deserializer : public slsDetectorData<int> {
|
||||
val[ib]=0;
|
||||
}
|
||||
wp=(int64_t*)ptr;
|
||||
|
||||
int nw=nch/nb;
|
||||
|
||||
cout << "** Number of bits:\t" << nb << endl;
|
||||
cout << "** Samples:\t" << nw << endl;
|
||||
|
||||
for (ib=0; ib<nb; ib++) {
|
||||
cout << dbl[ib] << " " ;
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
for (ib=0; ib<nch; ib++) {
|
||||
val[ib]=0;
|
||||
}
|
||||
|
||||
for (iw=0; iw<nw; iw) {
|
||||
for (iw=0; iw<nch/nb; iw) {
|
||||
word=*wp;;
|
||||
if (ioff<off) {
|
||||
ioff++;
|
||||
// cout <<"*";
|
||||
} else {
|
||||
//if (idr<16) {
|
||||
//ib=0;
|
||||
// cout << hex << "*************" << word << endl;
|
||||
for (ib=0; ib<nb; ib++) {
|
||||
// for (const auto &bit : dbl) {
|
||||
ich=iw+nch*ib/nb;
|
||||
/* if (ich>1060) */
|
||||
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
|
||||
bit=dbl[ib];
|
||||
ww=one<<bit;
|
||||
if (word&(ww) && ich<nch) {
|
||||
ib=0;
|
||||
for (const auto &bit : dbl) {
|
||||
ich=iw+nch/nb*(ib);
|
||||
if (word&(1<<bit) && ich<nch) {
|
||||
//cout << "+" ;
|
||||
val[ich]|=(1<<idr);
|
||||
}
|
||||
/* if (ich>1060) */
|
||||
/* cout << val[ich] << " " << hex << word << " " << ww << " " << (word&(ww)) << dec <<endl; */
|
||||
/* //else { */
|
||||
} //else {
|
||||
//cout << "-" ;
|
||||
//}
|
||||
//ib++;
|
||||
ib++;
|
||||
}
|
||||
|
||||
idr++;
|
||||
}
|
||||
|
||||
idr++;
|
||||
if (idr==dr) {
|
||||
idr=0;
|
||||
// cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl;
|
||||
// cout <<dec << iw<<endl;
|
||||
cout <<dec << iw<<endl;
|
||||
iw++;
|
||||
}//end if()
|
||||
|
||||
//end else()
|
||||
wp+=1;
|
||||
// ii++;
|
||||
ii++;
|
||||
}//end for
|
||||
|
||||
|
||||
@ -147,7 +117,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
int ii=0;
|
||||
int ich;
|
||||
int nb=dbl.size();
|
||||
int bit;
|
||||
|
||||
char *dval;
|
||||
|
||||
idr=0;
|
||||
@ -157,13 +127,8 @@ class deserializer : public slsDetectorData<int> {
|
||||
dval=ptr;
|
||||
|
||||
ib=0;
|
||||
ich=0;
|
||||
for (ib=0; ib<nb; ib++) {
|
||||
// for (const auto &bit : dbl) {
|
||||
|
||||
/* if (ich>1060) */
|
||||
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
|
||||
bit=dbl[ib];
|
||||
ich=0;
|
||||
for (const auto &bit : dbl) {
|
||||
//ioff=off;
|
||||
idr=0;
|
||||
for (iw=0; iw<(nch*dr/nb)/8; iw++) {
|
||||
@ -176,7 +141,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
}
|
||||
}
|
||||
ii++;
|
||||
// ib++;
|
||||
ib++;
|
||||
}//end for
|
||||
|
||||
|
||||
|
@ -1,125 +0,0 @@
|
||||
#ifndef IMAGEZMQ16BIT_H
|
||||
#define IMAGEZMQ16BIT_H
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
|
||||
class imageZmq16bit : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
|
||||
// int iframe;
|
||||
public:
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||
(160x160 pixels, 40 packets 1286 large etc.)
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||
imageZmq16bit(int nnx=400, int nny=400): slsDetectorData<uint16_t>(nnx, nny, 2*nnx*nny) {
|
||||
cout << "* " << nx << " " << ny << endl;
|
||||
int is=0;
|
||||
for (int row=0; row<ny; row++){
|
||||
for(int col=0;col<nx;col++){
|
||||
dataMap[row][col]=is*2;
|
||||
is++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
virtual double getValue(char *data, int ix, int iy=0) {
|
||||
|
||||
cout << ix << " " << ix << dataMap[iy][ix] << 2*nx*ny << " "<< endl;
|
||||
uint16_t val=getChannel(data, ix, iy)&0x3fff;
|
||||
return val;
|
||||
};
|
||||
|
||||
|
||||
int getFrameNumber(char *buff){return *((int*)buff);};//*((int*)(buff+5))&0xffffff;};
|
||||
|
||||
|
||||
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin) {
|
||||
int ff=-1, np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int &ff) {
|
||||
int np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||
char *data=new char[2*nx*ny];
|
||||
char *d=readNextFrame(filebin, ff, np, data);
|
||||
if (d==NULL) {delete [] data; data=NULL;}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||
//char *retval=0;
|
||||
// int nd;
|
||||
//int fnum = -1;
|
||||
np=0;
|
||||
// int pn;
|
||||
|
||||
|
||||
// if (ff>=0)
|
||||
// fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, 2*nx*ny) ){
|
||||
// iframe++;
|
||||
//ff=iframe;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||
if (dsize<2*nx*ny) ndata=dsize;
|
||||
else ndata=2*nx*ny;
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// virtual int setFrameNumber(int ff){iframe=ff};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int getPacketNumber(int x, int y) {return 0;};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,125 +0,0 @@
|
||||
#ifndef IMAGEZMQ32BIT_H
|
||||
#define IMAGEZMQ32BIT_H
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
|
||||
class imageZmq32bit : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
|
||||
// int iframe;
|
||||
public:
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||
(160x160 pixels, 40 packets 1286 large etc.)
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||
imageZmq32bit(int nnx=400, int nny=400): slsDetectorData<uint16_t>(nnx, nny, sizeof(uint32_t)*nnx*nny) {
|
||||
cout << "* " << nx << " " << ny << endl;
|
||||
int is=0;
|
||||
for (int row=0; row<ny; row++){
|
||||
for(int col=0;col<nx;col++){
|
||||
dataMap[row][col]=is*sizeof(uint32_t);
|
||||
is++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
/* virtual double getValue(char *data, int ix, int iy=0) { */
|
||||
|
||||
/* //cout << ix << " " << ix << dataMap[iy][ix] << 2*nx*ny << " "<< endl; */
|
||||
/* uint16_t val=getChannel(data, ix, iy); */
|
||||
/* return val; */
|
||||
/* }; */
|
||||
|
||||
|
||||
int getFrameNumber(char *buff){return *((int*)buff);};//*((int*)(buff+5))&0xffffff;};
|
||||
|
||||
|
||||
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin) {
|
||||
int ff=-1, np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int &ff) {
|
||||
int np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||
char *data=new char[2*nx*ny];
|
||||
char *d=readNextFrame(filebin, ff, np, data);
|
||||
if (d==NULL) {delete [] data; data=NULL;}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||
//char *retval=0;
|
||||
// int nd;
|
||||
//int fnum = -1;
|
||||
np=0;
|
||||
// int pn;
|
||||
|
||||
|
||||
// if (ff>=0)
|
||||
// fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, 2*nx*ny) ){
|
||||
// iframe++;
|
||||
//ff=iframe;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||
if (dsize<2*nx*ny) ndata=dsize;
|
||||
else ndata=2*nx*ny;
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// virtual int setFrameNumber(int ff){iframe=ff};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int getPacketNumber(int x, int y) {return 0;};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -28,8 +28,7 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||
moench03T1ZmqDataNew(int ns=5000, int oo=0): slsDetectorData<uint16_t>(400, 400, ns*32*2+oo), nSamples(ns), offset(oo), xtalk(0.00021) {
|
||||
moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||
|
||||
int nadc=32;
|
||||
int sc_width=25;
|
||||
@ -138,7 +137,6 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
/* vout+=0.0008*val-6224; */
|
||||
/* return vout; //(double)getChannel(data, ix, iy);
|
||||
*/
|
||||
// cout << ix << " "<< iy << " " << dataMap[iy][ix] << endl;
|
||||
return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy);
|
||||
};
|
||||
|
||||
|
@ -1,19 +1,15 @@
|
||||
|
||||
INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ -I../../libs/rapidjson/
|
||||
INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/
|
||||
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -g -std=c++11 -Wall
|
||||
#-L../../bin -lhdf5 -L.
|
||||
|
||||
#DESTDIR?=../bin
|
||||
|
||||
all: moenchZmqProcess moenchZmqProcessCtbGui
|
||||
|
||||
all: moenchZmqProcess
|
||||
|
||||
moenchZmqProcess: moenchZmqProcess.cpp clean
|
||||
g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP
|
||||
|
||||
moenchZmqProcessCtbGui: moenchZmqProcess.cpp clean
|
||||
g++ -o moenchZmqProcessCtbGui moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DCTBGUI
|
||||
|
||||
clean:
|
||||
rm -f moenchZmqProcess
|
||||
|
||||
|
@ -149,7 +149,6 @@ int main(int argc, char *argv[]) {
|
||||
if (argc>=9) {
|
||||
nframes=atoi(argv[8]);
|
||||
}
|
||||
|
||||
int xmin=0, xmax=nx, ymin=0, ymax=ny;
|
||||
if (argc>=13) {
|
||||
xmin=atoi(argv[9]);
|
||||
@ -186,7 +185,6 @@ int main(int argc, char *argv[]) {
|
||||
cout << "pedestal file is " << pedfile << endl;
|
||||
if (thr>0)
|
||||
cout << "threshold is " << thr << endl;
|
||||
cout << "Nframes is " << nframes << endl;
|
||||
|
||||
uint32 nnx, nny;
|
||||
double *gmap;
|
||||
|
@ -74,14 +74,6 @@ int main(int argc, char *argv[]) {
|
||||
// high_resolution_clock::time_point t1;
|
||||
// high_resolution_clock::time_point t2 ;
|
||||
time_t begin,end,finished;
|
||||
int rms=0;
|
||||
|
||||
int nped=1000, nped0=100;
|
||||
|
||||
#ifdef PTC
|
||||
nped=10000;
|
||||
nped0=10000;
|
||||
#endif
|
||||
|
||||
|
||||
if (argc > 4) {
|
||||
@ -119,7 +111,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
//slsDetectorData *det=new moench03T1ZmqDataNew();
|
||||
moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew(5000,sizeof(int));
|
||||
moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew();
|
||||
cout << endl << " det" <<endl;
|
||||
int npx, npy;
|
||||
det->getDetectorSize(npx, npy);
|
||||
@ -137,15 +129,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int ncol_cm=CM_ROWS;
|
||||
double xt_ghost=C_GHOST;
|
||||
|
||||
|
||||
moench03CommonMode *cm=NULL;
|
||||
moench03GhostSummation *gs=NULL;
|
||||
#ifdef CORR
|
||||
cm=new moench03CommonMode(ncol_cm);
|
||||
gs=new moench03GhostSummation(det, xt_ghost);
|
||||
#endif
|
||||
|
||||
moench03CommonMode *cm=new moench03CommonMode(ncol_cm);
|
||||
moench03GhostSummation *gs=new moench03GhostSummation(det, xt_ghost);
|
||||
double *gainmap=NULL;
|
||||
float *gm;
|
||||
double *gmap=NULL;
|
||||
@ -173,7 +158,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
//analogDetector<uint16_t> *filter=new analogDetector<uint16_t>(det,1,NULL,1000);
|
||||
#ifndef INTERP
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, nSigma, 1, cm, nped, nped0, -1, -1, gainmap, gs);
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
|
||||
multiThreadedCountingDetector *mt=new multiThreadedCountingDetector(filter,nthreads,fifosize);
|
||||
|
||||
@ -184,7 +169,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (etafname) interp->readFlatField(etafname);
|
||||
|
||||
interpolatingDetector *filter=new interpolatingDetector(det,interp, nSigma, 1, cm, nped, nped0, -1, -1, gainmap, gs);
|
||||
interpolatingDetector *filter=new interpolatingDetector(det,interp, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
multiThreadedInterpolatingDetector *mt=new multiThreadedInterpolatingDetector(filter,nthreads,fifosize);
|
||||
#endif
|
||||
|
||||
@ -308,8 +293,7 @@ int main(int argc, char *argv[]) {
|
||||
uint8_t detType = 0;
|
||||
uint8_t version = 0;
|
||||
// int* flippedData = 0;
|
||||
string* additionalJsonHeader = 0;
|
||||
//char* additionalJsonHeader = 0;
|
||||
char* additionalJsonHeader = 0;
|
||||
|
||||
int32_t threshold=0;
|
||||
|
||||
@ -372,11 +356,6 @@ int main(int argc, char *argv[]) {
|
||||
sprintf(ofname,"%s_%ld_ped.tiff",fname,fileindex);
|
||||
mt->writePedestal(ofname);
|
||||
cout << "Writing pedestal to " << ofname << endl;
|
||||
if (rms) {
|
||||
sprintf(ofname,"%s_%ld_var.tiff",fname,fileindex);
|
||||
mt->writePedestalRMS(ofname);
|
||||
cout << "Writing pedestal variance to " << ofname << endl;
|
||||
}
|
||||
}
|
||||
#ifdef INTERP
|
||||
else if (fMode==eFlat) {
|
||||
@ -409,7 +388,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
dout[ix]=ped[ix];
|
||||
// if (ix<100*400)
|
||||
// cout << ix << " " << ped[ix] << " "<< dout[ix] << endl;
|
||||
// cout << ix << " " << ped[ix] << endl;
|
||||
}
|
||||
|
||||
}
|
||||
@ -447,9 +426,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// }
|
||||
// }
|
||||
dout[ix]=detimage[ix];
|
||||
if (dout[ix]<0) dout[ix]=0;
|
||||
//cout << ix << " " << dout[ix] << endl;
|
||||
dout[ix]=detimage[ix];
|
||||
if (dout[ix]<0) dout[ix]=0;
|
||||
// cout << ix << " " << dout[ix] << endl;
|
||||
// }
|
||||
}
|
||||
}
|
||||
@ -469,21 +448,44 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// cout << "Sending image size " << nnx << " " << nny << endl;
|
||||
|
||||
// #ifndef DEVELOPER
|
||||
// #ifndef MOENCH_BRANCH
|
||||
// zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 1,1, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader);
|
||||
// #endif
|
||||
// #endif
|
||||
#ifndef DEVELOPER
|
||||
#ifndef MOENCH_BRANCH
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 0,0, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
#endif
|
||||
#ifdef MOENCH_BRANCH
|
||||
/*
|
||||
int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0,
|
||||
uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0,
|
||||
uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL,
|
||||
uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0,
|
||||
uint64_t bunchId = 0, uint64_t timestamp = 0,
|
||||
uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0,
|
||||
uint32_t debug = 0, uint16_t roundRNumber = 0,
|
||||
uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0,
|
||||
char* additionalJsonHeader = 0) {
|
||||
int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEADER_VERSION , uint32_t dr, uint64_t fileindex, uint32_t 0, uint32_t 0, uint32_t, uint64_t, uint64_t, char*, uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t, int*, char*)
|
||||
|
||||
*/
|
||||
//zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version);//, 0,additionalJsonHeader);
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
|
||||
/* old
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
*/
|
||||
/*
|
||||
|
||||
|
||||
// #ifdef DEVELOPER
|
||||
// #ifdef CTBGUI
|
||||
// zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
// #endif
|
||||
// #ifndef CTBGUI
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
//#endif
|
||||
|
||||
new
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,additionalJsonHeader);
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
zmqsocket2->SendData((char*)dout,nnx*nny*dr/8);
|
||||
cprintf(GREEN, "Sent Data\n");
|
||||
@ -575,7 +577,6 @@ int main(int argc, char *argv[]) {
|
||||
/* Analog detector commands */
|
||||
//isPedestal=0;
|
||||
//isFlat=0;
|
||||
rms=0;
|
||||
fMode=eFrame;
|
||||
frameMode_s="frame";
|
||||
cprintf(MAGENTA, "Frame mode: ");
|
||||
@ -585,17 +586,11 @@ int main(int argc, char *argv[]) {
|
||||
if (frameMode_s == "pedestal"){
|
||||
fMode=ePedestal;
|
||||
//isPedestal=1;
|
||||
} else if (frameMode_s == "newpedestal"){
|
||||
} else if (frameMode_s == "newPedestal"){
|
||||
mt->newDataSet(); //resets pedestal
|
||||
// cprintf(MAGENTA, "Resetting pedestal\n");
|
||||
fMode=ePedestal;
|
||||
//isPedestal=1;
|
||||
} else if (frameMode_s == "variance"){
|
||||
mt->newDataSet(); //resets pedestal
|
||||
// cprintf(MAGENTA, "Resetting pedestal\n");
|
||||
fMode=ePedestal;
|
||||
rms=1;
|
||||
//isPedestal=1;
|
||||
}
|
||||
#ifdef INTERP
|
||||
else if (frameMode_s == "flatfield") {
|
||||
@ -616,13 +611,11 @@ int main(int argc, char *argv[]) {
|
||||
frameMode_s="frame";
|
||||
}
|
||||
}
|
||||
cprintf(MAGENTA, "%s\n" , frameMode_s.c_str());
|
||||
} else
|
||||
cprintf(RED, "%s\n" , frameMode_s.c_str());
|
||||
|
||||
}
|
||||
cprintf(MAGENTA, "%s\n" , frameMode_s.c_str());
|
||||
mt->setFrameMode(fMode);
|
||||
|
||||
threshold=0;
|
||||
// threshold=0;
|
||||
cprintf(MAGENTA, "Threshold: ");
|
||||
if (doc.HasMember("threshold")) {
|
||||
if (doc["threshold"].IsInt()) {
|
||||
@ -690,11 +683,10 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str());
|
||||
} else
|
||||
cprintf(RED, "%s\n" , frameMode_s.c_str());
|
||||
}
|
||||
|
||||
mt->setDetectorMode(dMode);
|
||||
cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str());
|
||||
|
||||
// cout << "done " << endl;
|
||||
|
||||
@ -745,7 +737,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// cout << "file" << endl;
|
||||
// cout << "data " << endl;
|
||||
if (of==NULL && dMode!=eAnalog && fMode!=ePedestal && threshold<=0) {
|
||||
if (of==NULL) {
|
||||
#ifdef WRITE_QUAD
|
||||
sprintf(ofname,"%s_%ld.clust2",filename.c_str(),fileindex);
|
||||
#endif
|
||||
@ -780,13 +772,15 @@ int main(int argc, char *argv[]) {
|
||||
mt->pushData(buff);
|
||||
mt->nextThread();
|
||||
mt->popFree(buff);
|
||||
cprintf(GREEN, "Frame\n");
|
||||
} else {
|
||||
cprintf(RED, "Incomplete frame: received only %d packet\n", packetNumber);
|
||||
//length =
|
||||
zmqsocket->ReceiveData(0, dummybuff, size);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
iframe++;
|
||||
|
||||
} // exiting infinite loop
|
||||
|
@ -461,50 +461,6 @@ public:
|
||||
return ped;
|
||||
};
|
||||
|
||||
|
||||
virtual double *getPedestalRMS(){
|
||||
int nx, ny;
|
||||
dets[0]->getDetectorSize(nx,ny);
|
||||
// if (ped) delete [] ped;
|
||||
double *rms=new double[nx*ny];
|
||||
double *p0=new double[nx*ny];
|
||||
|
||||
for (int i=0; i<nThreads; i++) {
|
||||
//inte=(slsInterpolation*)dets[i]->getInterpolation(nb,emi,ema);
|
||||
// cout << i << endl;
|
||||
p0=dets[i]->getPedestalRMS(p0);
|
||||
if (p0) {
|
||||
if (i==0) {
|
||||
|
||||
for (int ib=0; ib<nx*ny; ib++) {
|
||||
rms[ib]=p0[ib]*p0[ib]/((double)nThreads);
|
||||
// cout << p0[ib] << " ";
|
||||
}
|
||||
} else {
|
||||
for (int ib=0; ib<nx*ny; ib++) {
|
||||
rms[ib]+=p0[ib]*p0[ib]/((double)nThreads);
|
||||
// cout << p0[ib] << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
delete [] p0;
|
||||
|
||||
/* for (int ib=0; ib<nx*ny; ib++) { */
|
||||
/* if (rms[ib]>0) */
|
||||
/* rms[ib]=sqrt(ped[ib]); */
|
||||
/* else */
|
||||
/* rms[ib]=0; */
|
||||
/* } */
|
||||
|
||||
|
||||
return rms;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual double *setPedestal(double *h=NULL){
|
||||
//int nb=0;
|
||||
@ -542,27 +498,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
virtual void *writePedestalRMS(const char * imgname){
|
||||
|
||||
int nx, ny;
|
||||
dets[0]->getDetectorSize(nx,ny);
|
||||
|
||||
double *rms=getPedestalRMS();
|
||||
float *gm=new float[nx*ny];
|
||||
if (gm) {
|
||||
for (int ix=0; ix<nx*ny; ix++) {
|
||||
gm[ix]=rms[ix];
|
||||
}
|
||||
WriteToTiff(gm,imgname ,nx, ny);
|
||||
delete [] gm;
|
||||
delete [] rms;
|
||||
} else cout << "Could not allocate float image " << endl;
|
||||
|
||||
return NULL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
virtual void *readPedestal(const char * imgname, int nb=-1, double emin=1, double emax=0){
|
||||
|
||||
int nx, ny;
|
||||
|
@ -4,10 +4,10 @@ find_package(PNG REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
set(SOURCES
|
||||
slsDetectorPlotting/src/SlsQt1DPlot.cpp
|
||||
slsDetectorPlotting/src/SlsQt1DZoomer.cpp
|
||||
slsDetectorPlotting/src/SlsQt2DHist.cpp
|
||||
slsDetectorPlotting/src/SlsQt2DPlot.cpp
|
||||
slsDetectorPlotting/src/SlsQt1DPlot.cxx
|
||||
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
|
||||
slsDetectorPlotting/src/SlsQt2DHist.cxx
|
||||
slsDetectorPlotting/src/SlsQt2DPlot.cxx
|
||||
src/qDetectorMain.cpp
|
||||
src/qDrawPlot.cpp
|
||||
src/qCloneWidget.cpp
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>376</width>
|
||||
<height>425</height>
|
||||
<width>500</width>
|
||||
<height>350</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@ -240,7 +240,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>376</width>
|
||||
<width>500</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -145,10 +145,6 @@
|
||||
<property name="windowTitle">
|
||||
<string>SLS Detector GUI</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/mountain.png</normaloff>:/icons/images/mountain.png</iconset>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhNone</set>
|
||||
</property>
|
||||
@ -375,6 +371,101 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionOpenSetup">
|
||||
<property name="text">
|
||||
<string>&Load &Setup</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveSetup">
|
||||
<property name="text">
|
||||
<string>&Save &Setup</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMeasurementWizard">
|
||||
<property name="text">
|
||||
<string>&Measurement Wizard</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenConfiguration">
|
||||
<property name="text">
|
||||
<string>&Load &Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveConfiguration">
|
||||
<property name="text">
|
||||
<string>&Save &Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnergyCalibration">
|
||||
<property name="text">
|
||||
<string>&Energy Calibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAngularCalibration">
|
||||
<property name="text">
|
||||
<string>&Angular Calibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Debug</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionBeamline">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Beamline</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExpert">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Expert</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionConfiguration">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionVersion">
|
||||
<property name="text">
|
||||
<string>&Version</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadConfiguration">
|
||||
<property name="text">
|
||||
<string>Load Configuration</string>
|
||||
@ -385,11 +476,6 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Load Trimbits</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadParameters">
|
||||
<property name="text">
|
||||
<string>Load Parameters</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@ -414,14 +500,12 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Dockable Windows</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<action name="actionLoadParameters">
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
<string>Load Parameters</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -432,6 +432,19 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Triggers:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QComboBox" name="comboPeriodUnit">
|
||||
<property name="enabled">
|
||||
@ -653,6 +666,108 @@ Frame period between exposures.
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delay After Trigger:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinExpTime">
|
||||
<property name="enabled">
|
||||
@ -788,6 +903,65 @@ Exposure Time of a frame.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QComboBox" name="comboDelayUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="comboExpUnit">
|
||||
<property name="enabled">
|
||||
@ -910,577 +1084,6 @@ Frame period between exposures.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageLblTrigger">
|
||||
<layout class="QGridLayout" name="gridLblTrigger">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Triggers:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLblBurst">
|
||||
<layout class="QGridLayout" name="gridLblBurst">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumBursts">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Bursts:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QStackedWidget" name="stackedSpinTriggerBurst">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSpinTrigger">
|
||||
<layout class="QGridLayout" name="gridSpinTrigger">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSpinBox" name="spinNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageSpinBurst">
|
||||
<layout class="QGridLayout" name="gridSpinBurst">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSpinBox" name="spinNumBursts">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QStackedWidget" name="stackedLblDelayBurstPeriod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageLblDelay">
|
||||
<layout class="QGridLayout" name="gridLblDelay">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delay After Trigger:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLblBurstPeriod">
|
||||
<layout class="QGridLayout" name="gridLblBurstPeriod">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblBurstPeriod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Burst Period:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QStackedWidget" name="stackedSpinDelayBurstPeriod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>152</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>152</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSpinDelay">
|
||||
<layout class="QGridLayout" name="gridSpinDelay">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QDoubleSpinBox" name="spinDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageSpinBurstPeriod">
|
||||
<layout class="QGridLayout" name="gridSpinBurstPeriod">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QDoubleSpinBox" name="spinBurstPeriod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QStackedWidget" name="stackedComboDelayBurstPeriod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageComboDelay">
|
||||
<layout class="QGridLayout" name="gridComboDelay">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboDelayUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageComboBurstPeriod">
|
||||
<layout class="QGridLayout" name="gridComboBurstPeriod">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBurstPeriodUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1513,6 +1116,9 @@ Frame period between exposures.
|
||||
<tabstop>comboExpUnit</tabstop>
|
||||
<tabstop>spinPeriod</tabstop>
|
||||
<tabstop>comboPeriodUnit</tabstop>
|
||||
<tabstop>spinNumTriggers</tabstop>
|
||||
<tabstop>spinDelay</tabstop>
|
||||
<tabstop>comboDelayUnit</tabstop>
|
||||
<tabstop>spinNumSamples</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
@ -822,7 +822,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="stackedWidget1D">
|
||||
<property name="currentIndex">
|
||||
<number>5</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSuperImpose">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@ -1360,27 +1360,6 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkGainPlot1D">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Displays minimum, maximum and sum of values for each plot.
|
||||
<nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gain Plot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -2368,6 +2347,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<zorder>box1D</zorder>
|
||||
<zorder>boxFrequency</zorder>
|
||||
<zorder>box2D</zorder>
|
||||
<zorder>horizontalSpacer_6</zorder>
|
||||
<zorder>boxPlotAxis</zorder>
|
||||
<zorder>boxSave</zorder>
|
||||
</widget>
|
||||
|
@ -214,46 +214,6 @@
|
||||
<string>Very Low Gain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G1_HG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G1_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G2_HC_HG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G2_HC_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G2_LC_HG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G2_LC_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G4_HG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G4_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Undefined</string>
|
||||
|
20
slsDetectorGui/include/qCloneWidget.h
Normal file → Executable file
20
slsDetectorGui/include/qCloneWidget.h
Normal file → Executable file
@ -1,20 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_cloneplot.h"
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
|
||||
class SlsQtH1D;
|
||||
class SlsQt1DPlot;
|
||||
class SlsQt2DPlot;
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
|
||||
SlsQt1DPlot *gp1, SlsQt2DPlot *gp, QString title,
|
||||
QString filePath, QString fileName, int64_t aIndex,
|
||||
bool displayStats, QString min, QString max, QString sum);
|
||||
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt2DPlot *gp,
|
||||
QString title, QString filePath, QString fileName,
|
||||
int64_t aIndex, bool displayStats, QString min, QString max,
|
||||
QString sum);
|
||||
|
||||
~qCloneWidget();
|
||||
|
||||
@ -23,7 +28,7 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow(QString title);
|
||||
void DisplayStats(bool enable, QString min, QString max, QString sum);
|
||||
@ -32,7 +37,6 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
||||
int id;
|
||||
SlsQt1DPlot *plot1d{nullptr};
|
||||
SlsQt2DPlot *plot2d{nullptr};
|
||||
SlsQt1DPlot *gainplot1d{nullptr};
|
||||
SlsQt2DPlot *gainplot2d{nullptr};
|
||||
QString filePath{"/"};
|
||||
QString fileName{"run"};
|
||||
|
41
slsDetectorGui/include/qDacWidget.h
Normal file → Executable file
41
slsDetectorGui/include/qDacWidget.h
Normal file → Executable file
@ -1,30 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_dac.h"
|
||||
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class qDacWidget : public QWidget, private Ui::WidgetDacObject {
|
||||
Q_OBJECT
|
||||
class qDacWidget:public QWidget, private Ui::WidgetDacObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n,
|
||||
slsDetectorDefs::dacIndex i);
|
||||
~qDacWidget();
|
||||
void SetDetectorIndex(int id);
|
||||
public:
|
||||
qDacWidget(QWidget *parent, sls::Detector* detector, bool d, std::string n, slsDetectorDefs::dacIndex i);
|
||||
~qDacWidget();
|
||||
void SetDetectorIndex(int id);
|
||||
|
||||
private slots:
|
||||
void SetDac();
|
||||
private slots:
|
||||
void SetDac();
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow(std::string name);
|
||||
void Initialization();
|
||||
void GetDac();
|
||||
void GetAdc();
|
||||
void Refresh();
|
||||
private:
|
||||
void SetupWidgetWindow(std::string name);
|
||||
void Initialization();
|
||||
void GetDac();
|
||||
void GetAdc();
|
||||
void Refresh();
|
||||
|
||||
sls::Detector *det;
|
||||
bool isDac{true};
|
||||
slsDetectorDefs::dacIndex index;
|
||||
int detectorIndex{-1};
|
||||
sls::Detector *det;
|
||||
bool isDac{true};
|
||||
slsDetectorDefs::dacIndex index;
|
||||
int detectorIndex{-1};
|
||||
};
|
||||
|
||||
|
85
slsDetectorGui/include/qDefs.h
Normal file → Executable file
85
slsDetectorGui/include/qDefs.h
Normal file → Executable file
@ -5,29 +5,22 @@
|
||||
#include <QAbstractButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <cstdint>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#include <chrono>
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::hours;
|
||||
using std::chrono::nanoseconds;
|
||||
using std::chrono::microseconds;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::minutes;
|
||||
using std::chrono::nanoseconds;
|
||||
using std::chrono::seconds;
|
||||
using std::chrono::minutes;
|
||||
using std::chrono::hours;
|
||||
|
||||
#define CATCH_DISPLAY(m, s) \
|
||||
catch (...) { \
|
||||
qDefs::DisplayExceptions(m, s); \
|
||||
}
|
||||
#define CATCH_HANDLE(...) \
|
||||
catch (...) { \
|
||||
qDefs::HandleExceptions(__VA_ARGS__); \
|
||||
}
|
||||
#define CATCH_DISPLAY(m, s) catch(...) { qDefs::DisplayExceptions(m, s); }
|
||||
#define CATCH_HANDLE(...) catch(...) { qDefs::HandleExceptions(__VA_ARGS__); }
|
||||
|
||||
class qDefs : public QWidget {
|
||||
public:
|
||||
@ -36,9 +29,8 @@ class qDefs : public QWidget {
|
||||
*/
|
||||
qDefs(){};
|
||||
|
||||
static const int Q_FONT_SIZE = 9;
|
||||
static const int DATA_GAIN_PLOT_RATIO = 5;
|
||||
static const int MIN_HEIGHT_GAIN_PLOT_1D = 75;
|
||||
static const int Q_FONT_SIZE=9;
|
||||
static const int DATA_GAIN_PLOT_RATIO=5;
|
||||
|
||||
static void DisplayExceptions(std::string emsg, std::string src) {
|
||||
try {
|
||||
@ -54,8 +46,8 @@ class qDefs : public QWidget {
|
||||
|
||||
template <class CT> struct NonDeduced { using type = CT; };
|
||||
template <class S, typename RT, typename... CT>
|
||||
static void HandleExceptions(const std::string emsg, const std::string src,
|
||||
S *s, RT (S::*somefunc)(CT...),
|
||||
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
|
||||
RT (S::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
throw;
|
||||
@ -79,22 +71,15 @@ class qDefs : public QWidget {
|
||||
QF_NUM_FUNCTIONS
|
||||
};
|
||||
|
||||
static const char *getQFunctionNameFromEnum(enum qFuncNames func) {
|
||||
static const char* getQFunctionNameFromEnum(enum qFuncNames func) {
|
||||
switch (func) {
|
||||
case QF_GET_DETECTOR_STATUS:
|
||||
return "QF_GET_DETECTOR_STATUS";
|
||||
case QF_START_ACQUISITION:
|
||||
return "QF_START_ACQUISITION";
|
||||
case QF_STOP_ACQUISITION:
|
||||
return "QF_STOP_ACQUISITION";
|
||||
case QF_START_AND_READ_ALL:
|
||||
return "QF_START_AND_READ_ALL";
|
||||
case QF_EXIT_SERVER:
|
||||
return "QF_EXIT_SERVER";
|
||||
case QF_NUM_FUNCTIONS:
|
||||
return "QF_NUM_FUNCTIONS";
|
||||
default:
|
||||
return "Unknown Function";
|
||||
case QF_GET_DETECTOR_STATUS: return "QF_GET_DETECTOR_STATUS";
|
||||
case QF_START_ACQUISITION: return "QF_START_ACQUISITION";
|
||||
case QF_STOP_ACQUISITION: return "QF_STOP_ACQUISITION";
|
||||
case QF_START_AND_READ_ALL: return "QF_START_AND_READ_ALL";
|
||||
case QF_EXIT_SERVER: return "QF_EXIT_SERVER";
|
||||
case QF_NUM_FUNCTIONS: return "QF_NUM_FUNCTIONS";
|
||||
default: return "Unknown Function";
|
||||
}
|
||||
};
|
||||
|
||||
@ -125,16 +110,11 @@ class qDefs : public QWidget {
|
||||
|
||||
static std::string getRangeAsString(enum range r) {
|
||||
switch (r) {
|
||||
case XMIN:
|
||||
return "XMIN";
|
||||
case XMAX:
|
||||
return "XMAX";
|
||||
case YMIN:
|
||||
return "YMIN";
|
||||
case YMAX:
|
||||
return "YMAX";
|
||||
default:
|
||||
return "Unknown";
|
||||
case XMIN: return "XMIN";
|
||||
case XMAX: return "XMAX";
|
||||
case YMIN: return "YMIN";
|
||||
case YMAX: return "YMAX";
|
||||
default: return "Unknown";
|
||||
}
|
||||
};
|
||||
|
||||
@ -209,8 +189,7 @@ class qDefs : public QWidget {
|
||||
MINUTES);
|
||||
}
|
||||
return std::make_pair(
|
||||
duration_cast<duration<double, std::ratio<3600>>>(tns).count(),
|
||||
HOURS);
|
||||
duration_cast<duration<double, std::ratio<3600>>>(tns).count(), HOURS);
|
||||
}
|
||||
|
||||
/** returns the value in ns */
|
||||
@ -316,12 +295,10 @@ class qDefs : public QWidget {
|
||||
/**
|
||||
* Wrap exception message
|
||||
*/
|
||||
static int ExceptionMessage(std::string message,
|
||||
std::string exceptionMessage,
|
||||
std::string source) {
|
||||
return Message(qDefs::WARNING,
|
||||
message + std::string("\nCaught exception:\n") +
|
||||
exceptionMessage,
|
||||
source);
|
||||
}
|
||||
static int ExceptionMessage(std::string message,
|
||||
std::string exceptionMessage,
|
||||
std::string source) {
|
||||
return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
|
||||
}
|
||||
|
||||
};
|
||||
|
45
slsDetectorGui/include/qDetectorMain.h
Normal file → Executable file
45
slsDetectorGui/include/qDetectorMain.h
Normal file → Executable file
@ -1,9 +1,8 @@
|
||||
#pragma once
|
||||
#include "ui_form_detectormain.h"
|
||||
#include "qDefs.h"
|
||||
#include "Detector.h"
|
||||
#include <QTabWidget>
|
||||
|
||||
#include "ui_form_detectormain.h"
|
||||
|
||||
#include "qDefs.h"
|
||||
class qDrawPlot;
|
||||
class qTabMeasurement;
|
||||
class qTabDataOutput;
|
||||
@ -13,15 +12,17 @@ class qTabSettings;
|
||||
class qTabDebugging;
|
||||
class qTabDeveloper;
|
||||
class qTabMessages;
|
||||
class QScrollArea;
|
||||
|
||||
#include "Detector.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
class QResizeEvent;
|
||||
|
||||
/** To Over-ride the QTabWidget class to get the tabBar protected
|
||||
* methodTabWidget */
|
||||
/** To Over-ride the QTabWidget class to get the tabBar */
|
||||
class MyTabWidget : public QTabWidget {
|
||||
public:
|
||||
MyTabWidget(QWidget *parent = 0) { setParent(parent); }
|
||||
/** Overridden protected method from QTabWidget */
|
||||
/** Overridden method from QTabWidget */
|
||||
QTabBar *tabBar() { return QTabWidget::tabBar(); }
|
||||
};
|
||||
|
||||
@ -29,7 +30,8 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qDetectorMain(int multiId, const std::string& fname, bool isDevel);
|
||||
qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
QWidget *parent = 0);
|
||||
~qDetectorMain();
|
||||
|
||||
private slots:
|
||||
@ -51,9 +53,9 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
||||
|
||||
private:
|
||||
void SetUpWidgetWindow();
|
||||
void SetUpDetector(const std::string& config_file, int multiID);
|
||||
void SetUpDetector(const std::string fName, int multiID);
|
||||
void Initialization();
|
||||
void LoadConfigFile(const std::string& config_file);
|
||||
void LoadConfigFile(const std::string fName);
|
||||
|
||||
/** enumeration of the tabs */
|
||||
enum {
|
||||
@ -69,17 +71,16 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
||||
};
|
||||
slsDetectorDefs::detectorType detType;
|
||||
std::unique_ptr<sls::Detector> det;
|
||||
qDrawPlot *plot;
|
||||
MyTabWidget* tabs;
|
||||
std::unique_ptr<QScrollArea> scroll[NumberOfTabs];
|
||||
qTabMeasurement *tabMeasurement;
|
||||
qTabDataOutput *tabDataOutput;
|
||||
qTabPlot *tabPlot;
|
||||
qTabSettings *tabSettings;
|
||||
qTabAdvanced *tabAdvanced;
|
||||
qTabDebugging *tabDebugging;
|
||||
qTabDeveloper *tabDeveloper;
|
||||
qTabMessages *tabMessages;
|
||||
std::unique_ptr<qDrawPlot> plot;
|
||||
std::unique_ptr<MyTabWidget> tabs;
|
||||
std::unique_ptr<qTabMeasurement> tabMeasurement;
|
||||
std::unique_ptr<qTabDataOutput> tabDataOutput;
|
||||
std::unique_ptr<qTabPlot> tabPlot;
|
||||
std::unique_ptr<qTabSettings> tabSettings;
|
||||
std::unique_ptr<qTabAdvanced> tabAdvanced;
|
||||
std::unique_ptr<qTabDebugging> tabDebugging;
|
||||
std::unique_ptr<qTabDeveloper> tabDeveloper;
|
||||
std::unique_ptr<qTabMessages> tabMessages;
|
||||
int isDeveloper;
|
||||
int heightPlotWindow;
|
||||
int heightCentralWidget;
|
||||
|
71
slsDetectorGui/include/qDrawPlot.h
Normal file → Executable file
71
slsDetectorGui/include/qDrawPlot.h
Normal file → Executable file
@ -1,21 +1,26 @@
|
||||
#pragma once
|
||||
#include "ui_form_plot.h"
|
||||
#include "qDefs.h"
|
||||
#include "Detector.h"
|
||||
#include <mutex>
|
||||
|
||||
#include "ui_form_plot.h"
|
||||
|
||||
#include "qDefs.h"
|
||||
class SlsQt1DPlot;
|
||||
class SlsQtH1D;
|
||||
class SlsQt2DPlot;
|
||||
class qCloneWidget;
|
||||
|
||||
class detectorData;
|
||||
#include "Detector.h"
|
||||
|
||||
class QResizeEvent;
|
||||
#include <QFutureWatcher>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qDrawPlot(QWidget *parent, sls::Detector *detector);
|
||||
qDrawPlot(QWidget *parent, sls::Detector *detector);
|
||||
~qDrawPlot();
|
||||
bool GetIsRunning();
|
||||
void SetRunning(bool enable);
|
||||
@ -26,8 +31,8 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
void SetXAxisTitle(QString title);
|
||||
void SetYAxisTitle(QString title);
|
||||
void SetZAxisTitle(QString title);
|
||||
void SetXYRangeChanged(bool disable, double *xy, bool *isXY);
|
||||
void SetZRange(double *z, bool *isZ);
|
||||
void SetXYRangeChanged(bool disable, double* xy, bool* isXY);
|
||||
void SetZRange(double* z, bool* isZ);
|
||||
double GetXMinimum();
|
||||
double GetXMaximum();
|
||||
double GetYMinimum();
|
||||
@ -52,18 +57,18 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
void SetNumDiscardBits(int value);
|
||||
void EnableGainPlot(bool enable);
|
||||
void ClonePlot();
|
||||
void SavePlot();
|
||||
void SavePlot();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private slots:
|
||||
void SetSaveFileName(QString val);
|
||||
void AcquireThread();
|
||||
void AcquireFinished();
|
||||
void UpdatePlot();
|
||||
|
||||
|
||||
signals:
|
||||
void StartAcquireSignal();
|
||||
void AcquireFinishedSignal();
|
||||
void AbortSignal();
|
||||
void UpdateSignal();
|
||||
@ -71,45 +76,40 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void SetupPlots();
|
||||
void SetupPlots();
|
||||
void GetStatistics(double &min, double &max, double &sum);
|
||||
void DetachHists();
|
||||
static void GetAcquisitionFinishedCallBack(double currentProgress,
|
||||
int detectorStatus,
|
||||
void *this_pointer);
|
||||
static void GetDataCallBack(detectorData *data, uint64_t frameIndex,
|
||||
uint32_t subFrameIndex, void *this_pointer);
|
||||
static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer);
|
||||
static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer);
|
||||
std::string AcquireThread();
|
||||
void AcquisitionFinished(double currentProgress, int detectorStatus);
|
||||
void GetData(detectorData *data, uint64_t frameIndex,
|
||||
uint32_t subFrameIndex);
|
||||
void toDoublePixelData(double *dest, char *source, int size, int databytes,
|
||||
int dr, double *gaindest = NULL);
|
||||
void Get1dData(double *rawData);
|
||||
void Get2dData(double *rawData);
|
||||
void GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex);
|
||||
void toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest = NULL);
|
||||
void Get1dData(double* rawData);
|
||||
void Get2dData(double* rawData);
|
||||
void Update1dPlot();
|
||||
void Update2dPlot();
|
||||
void Update1dXYRange();
|
||||
void Update2dXYRange();
|
||||
|
||||
static const int NUM_PEDESTAL_FRAMES = 20;
|
||||
|
||||
static const int NUM_PEDESTAL_FRAMES = 20;
|
||||
sls::Detector *det;
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
SlsQt1DPlot *plot1d{nullptr};
|
||||
QVector<SlsQtH1D *> hists1d;
|
||||
SlsQt1DPlot *gainplot1d{nullptr};
|
||||
SlsQtH1D *gainhist1d{nullptr};
|
||||
QVector<SlsQtH1D *> hists1d;
|
||||
SlsQt2DPlot *plot2d{nullptr};
|
||||
SlsQt2DPlot *gainplot2d{nullptr};
|
||||
QFutureWatcher<std::string> *acqResultWatcher;
|
||||
|
||||
bool is1d{true};
|
||||
bool isRunning{false};
|
||||
|
||||
// titles
|
||||
|
||||
// titles
|
||||
QString plotTitlePrefix{""};
|
||||
QString xTitle1d{"Channel Number"};
|
||||
QString yTitle1d{"Counts"};
|
||||
QString xTitle2d{"Pixel"};
|
||||
QString xTitle2d{"Pixel"};
|
||||
QString yTitle2d{"Pixel"};
|
||||
QString zTitle2d{"Intensity"};
|
||||
QString plotTitle{""};
|
||||
@ -120,17 +120,16 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
double zRange[2]{0, 1};
|
||||
bool isZRange[2]{false, false};
|
||||
|
||||
// data
|
||||
// data
|
||||
int nHists{1};
|
||||
double *datax1d{nullptr};
|
||||
std::vector<double *> datay1d;
|
||||
double *gainDatay1d{nullptr};
|
||||
double *data2d{nullptr};
|
||||
double *gainData{nullptr};
|
||||
|
||||
// options
|
||||
//options
|
||||
bool isPlot{true};
|
||||
bool isBinary{false};
|
||||
bool isBinary{false};
|
||||
int binaryFrom{0};
|
||||
int binaryTo{0};
|
||||
int persistency{0};
|
||||
@ -159,7 +158,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
|
||||
unsigned int nPixelsX{0};
|
||||
unsigned int nPixelsY{0};
|
||||
const static int npixelsx_jctb = 400;
|
||||
int npixelsy_jctb{0};
|
||||
uint32_t pixelMask{0};
|
||||
uint32_t gainMask{0};
|
||||
int gainOffset{0};
|
||||
};
|
||||
|
110
slsDetectorGui/include/qTabAdvanced.h
Normal file → Executable file
110
slsDetectorGui/include/qTabAdvanced.h
Normal file → Executable file
@ -1,65 +1,69 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_tab_advanced.h"
|
||||
#include "Detector.h"
|
||||
|
||||
class qDrawPlot;
|
||||
|
||||
class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
||||
Q_OBJECT
|
||||
#include "Detector.h"
|
||||
|
||||
public:
|
||||
qTabAdvanced(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
||||
~qTabAdvanced();
|
||||
class qTabAdvanced:public QWidget, private Ui::TabAdvancedObject{
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
void Refresh();
|
||||
public:
|
||||
qTabAdvanced(QWidget *parent, sls::Detector* detector, qDrawPlot* p);
|
||||
~qTabAdvanced();
|
||||
|
||||
private slots:
|
||||
void SetDetector();
|
||||
void SetControlPort(int port);
|
||||
void SetStopPort(int port);
|
||||
void SetDetectorUDPIP();
|
||||
void SetDetectorUDPMAC();
|
||||
void SetCltZMQPort(int port);
|
||||
void SetCltZMQIP();
|
||||
void SetRxrHostname();
|
||||
void SetRxrTCPPort(int port);
|
||||
void SetRxrUDPPort(int port);
|
||||
void SetRxrUDPIP();
|
||||
void SetRxrUDPMAC();
|
||||
void SetRxrZMQPort(int port);
|
||||
void SetRxrZMQIP();
|
||||
void GetROI();
|
||||
void ClearROI();
|
||||
void SetROI();
|
||||
void SetAllTrimbits();
|
||||
void SetNumStoragecells(int value);
|
||||
void SetSubExposureTime();
|
||||
void SetSubDeadTime();
|
||||
public slots:
|
||||
void Refresh();
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
private slots:
|
||||
void SetDetector();
|
||||
void SetControlPort(int port);
|
||||
void SetStopPort(int port);
|
||||
void SetDetectorUDPIP();
|
||||
void SetDetectorUDPMAC();
|
||||
void SetCltZMQPort(int port);
|
||||
void SetCltZMQIP();
|
||||
void SetRxrHostname();
|
||||
void SetRxrTCPPort(int port);
|
||||
void SetRxrUDPPort(int port);
|
||||
void SetRxrUDPIP();
|
||||
void SetRxrUDPMAC();
|
||||
void SetRxrZMQPort(int port);
|
||||
void SetRxrZMQIP();
|
||||
void GetROI();
|
||||
void ClearROI();
|
||||
void SetROI();
|
||||
void SetAllTrimbits();
|
||||
void SetNumStoragecells(int value);
|
||||
void SetSubExposureTime();
|
||||
void SetSubDeadTime();
|
||||
|
||||
void GetControlPort();
|
||||
void GetStopPort();
|
||||
void GetDetectorUDPIP();
|
||||
void GetDetectorUDPMAC();
|
||||
void GetCltZMQPort();
|
||||
void GetCltZMQIP();
|
||||
void GetRxrHostname();
|
||||
void GetRxrTCPPort();
|
||||
void GetRxrUDPPort();
|
||||
void GetRxrUDPIP();
|
||||
void GetRxrUDPMAC();
|
||||
void GetRxrZMQPort();
|
||||
void GetRxrZMQIP();
|
||||
void GetAllTrimbits();
|
||||
void GetNumStoragecells();
|
||||
void GetSubExposureTime();
|
||||
void GetSubDeadTime();
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
void GetControlPort();
|
||||
void GetStopPort();
|
||||
void GetDetectorUDPIP();
|
||||
void GetDetectorUDPMAC();
|
||||
void GetCltZMQPort();
|
||||
void GetCltZMQIP();
|
||||
void GetRxrHostname();
|
||||
void GetRxrTCPPort();
|
||||
void GetRxrUDPPort();
|
||||
void GetRxrUDPIP();
|
||||
void GetRxrUDPMAC();
|
||||
void GetRxrZMQPort();
|
||||
void GetRxrZMQIP();
|
||||
void GetAllTrimbits();
|
||||
void GetNumStoragecells();
|
||||
void GetSubExposureTime();
|
||||
void GetSubDeadTime();
|
||||
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
};
|
||||
|
||||
|
||||
|
76
slsDetectorGui/include/qTabDataOutput.h
Normal file → Executable file
76
slsDetectorGui/include/qTabDataOutput.h
Normal file → Executable file
@ -1,44 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_tab_dataoutput.h"
|
||||
|
||||
#include "Detector.h"
|
||||
|
||||
class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
||||
Q_OBJECT
|
||||
class qTabDataOutput:public QWidget, private Ui::TabDataOutputObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabDataOutput(QWidget *parent, sls::Detector *detector);
|
||||
~qTabDataOutput();
|
||||
void Refresh();
|
||||
public:
|
||||
qTabDataOutput(QWidget *parent, sls::Detector* detector);
|
||||
~qTabDataOutput();
|
||||
void Refresh();
|
||||
|
||||
private slots:
|
||||
void GetOutputDir();
|
||||
void BrowseOutputDir();
|
||||
void SetOutputDir();
|
||||
void SetFileFormat(int format);
|
||||
void SetOverwriteEnable(bool enable);
|
||||
void SetTenGigaEnable(bool enable);
|
||||
void EnableRateCorrection();
|
||||
void SetRateCorrection();
|
||||
void SetSpeed(int speed);
|
||||
void SetFlags();
|
||||
private slots:
|
||||
void GetOutputDir();
|
||||
void BrowseOutputDir();
|
||||
void SetOutputDir();
|
||||
void SetFileFormat(int format);
|
||||
void SetOverwriteEnable(bool enable);
|
||||
void SetTenGigaEnable(bool enable);
|
||||
void EnableRateCorrection();
|
||||
void SetRateCorrection();
|
||||
void SetSpeed(int speed);
|
||||
void SetFlags();
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
void EnableBrowse();
|
||||
void GetFileWrite();
|
||||
void GetFileName();
|
||||
void GetFileFormat();
|
||||
void GetFileOverwrite();
|
||||
void GetTenGigaEnable();
|
||||
void GetRateCorrection();
|
||||
void GetSpeed();
|
||||
void GetFlags();
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
void EnableBrowse();
|
||||
void GetFileWrite();
|
||||
void GetFileName();
|
||||
void GetFileFormat();
|
||||
void GetFileOverwrite();
|
||||
void GetTenGigaEnable();
|
||||
void GetRateCorrection();
|
||||
void GetSpeed();
|
||||
void GetFlags();
|
||||
|
||||
sls::Detector *det;
|
||||
// Button group for radiobuttons for rate
|
||||
QButtonGroup *btnGroupRate;
|
||||
// enum for the Eiger Parallel flag
|
||||
enum { PARALLEL, NONPARALLEL };
|
||||
sls::Detector *det;
|
||||
// Button group for radiobuttons for rate
|
||||
QButtonGroup *btnGroupRate;
|
||||
// enum for the Eiger Parallel flag
|
||||
enum {
|
||||
PARALLEL,
|
||||
NONPARALLEL
|
||||
};
|
||||
};
|
||||
|
||||
|
45
slsDetectorGui/include/qTabDebugging.h
Normal file → Executable file
45
slsDetectorGui/include/qTabDebugging.h
Normal file → Executable file
@ -1,33 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_tab_debugging.h"
|
||||
|
||||
#include "Detector.h"
|
||||
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
class qTabDebugging : public QWidget, private Ui::TabDebuggingObject {
|
||||
Q_OBJECT
|
||||
class qTabDebugging:public QWidget, private Ui::TabDebuggingObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabDebugging(QWidget *parent, sls::Detector *detector);
|
||||
~qTabDebugging();
|
||||
void Refresh();
|
||||
public:
|
||||
qTabDebugging(QWidget *parent, sls::Detector* detector);
|
||||
~qTabDebugging();
|
||||
void Refresh();
|
||||
|
||||
private slots:
|
||||
void GetDetectorStatus();
|
||||
void GetInfo();
|
||||
void SetParameters(QTreeWidgetItem *item);
|
||||
void TestDetector();
|
||||
private slots:
|
||||
void GetDetectorStatus();
|
||||
void GetInfo();
|
||||
void SetParameters(QTreeWidgetItem *item);
|
||||
void TestDetector();
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
|
||||
sls::Detector *det;
|
||||
/** Tree Widget displaying the detectors, modules */
|
||||
QTreeWidget *treeDet;
|
||||
QLabel *lblDetectorHostname;
|
||||
QLabel *lblDetectorFirmware;
|
||||
QLabel *lblDetectorSoftware;
|
||||
sls::Detector *det;
|
||||
/** Tree Widget displaying the detectors, modules */
|
||||
QTreeWidget *treeDet;
|
||||
QLabel *lblDetectorHostname;
|
||||
QLabel *lblDetectorFirmware;
|
||||
QLabel *lblDetectorSoftware;
|
||||
};
|
||||
|
||||
|
65
slsDetectorGui/include/qTabDeveloper.h
Normal file → Executable file
65
slsDetectorGui/include/qTabDeveloper.h
Normal file → Executable file
@ -1,38 +1,49 @@
|
||||
#pragma once
|
||||
#include "ui_form_tab_developer.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include <vector>
|
||||
|
||||
#include "ui_form_tab_developer.h"
|
||||
class qDacWidget;
|
||||
|
||||
class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject {
|
||||
Q_OBJECT
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
public:
|
||||
qTabDeveloper(QWidget *parent, sls::Detector *detector);
|
||||
~qTabDeveloper();
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
public slots:
|
||||
void Refresh();
|
||||
class qTabDeveloper:public QWidget, private Ui::TabDeveloperObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void SetHighVoltage();
|
||||
public:
|
||||
qTabDeveloper(QWidget *parent, sls::Detector* detector);
|
||||
~qTabDeveloper();
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
void GetHighVoltage();
|
||||
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType,
|
||||
int index);
|
||||
public slots:
|
||||
void Refresh();
|
||||
|
||||
sls::Detector *det;
|
||||
std::vector<qDacWidget *> dacWidgets;
|
||||
std::vector<qDacWidget *> adcWidgets;
|
||||
private slots:
|
||||
void SetHighVoltage();
|
||||
|
||||
enum hvVals { HV_0, HV_90, HV_110, HV_120, HV_150, HV_180, HV_200 };
|
||||
int hvmin;
|
||||
static const int HV_MIN = 60;
|
||||
static const int HV_MAX = 200;
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
void GetHighVoltage();
|
||||
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType, int index);
|
||||
|
||||
sls::Detector *det;
|
||||
std::vector<qDacWidget*> dacWidgets;
|
||||
std::vector<qDacWidget*> adcWidgets;
|
||||
|
||||
enum hvVals {
|
||||
HV_0,
|
||||
HV_90,
|
||||
HV_110,
|
||||
HV_120,
|
||||
HV_150,
|
||||
HV_180,
|
||||
HV_200
|
||||
};
|
||||
int hvmin;
|
||||
static const int HV_MIN = 60;
|
||||
static const int HV_MAX = 200;
|
||||
};
|
||||
|
||||
|
149
slsDetectorGui/include/qTabMeasurement.h
Normal file → Executable file
149
slsDetectorGui/include/qTabMeasurement.h
Normal file → Executable file
@ -1,91 +1,90 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_tab_measurement.h"
|
||||
#include "Detector.h"
|
||||
|
||||
class qDrawPlot;
|
||||
|
||||
#include "Detector.h"
|
||||
|
||||
class QStandardItemModel;
|
||||
|
||||
class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
||||
Q_OBJECT
|
||||
class qTabMeasurement:public QWidget, private Ui::TabMeasurementObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabMeasurement(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
||||
~qTabMeasurement();
|
||||
public:
|
||||
qTabMeasurement(QWidget *parent, sls::Detector* detector, qDrawPlot* p);
|
||||
~qTabMeasurement();
|
||||
|
||||
void Refresh();
|
||||
void Refresh();
|
||||
|
||||
public slots:
|
||||
void AcquireFinished();
|
||||
void AbortAcquire();
|
||||
public slots:
|
||||
void AcquireFinished();
|
||||
void AbortAcquire();
|
||||
|
||||
private slots:
|
||||
void SetTimingMode(int val);
|
||||
void SetNumMeasurements(int val);
|
||||
void SetNumFrames(int val);
|
||||
void SetNumTriggers(int val);
|
||||
void SetNumBursts(int val);
|
||||
void SetNumSamples(int val);
|
||||
void SetExposureTime();
|
||||
void SetAcquisitionPeriod();
|
||||
void SetDelay();
|
||||
void SetBurstPeriod();
|
||||
void SetFileWrite(bool val);
|
||||
void SetFileName();
|
||||
void SetRunIndex(int val);
|
||||
void SetStartingFrameNumber(int val);
|
||||
void UpdateProgress();
|
||||
void StartAcquisition();
|
||||
void StopAcquisition();
|
||||
private slots:
|
||||
void SetTimingMode(int val);
|
||||
void SetNumMeasurements(int val);
|
||||
void SetNumFrames(int val);
|
||||
void SetNumTriggers(int val);
|
||||
void SetNumSamples(int val);
|
||||
void SetExposureTime();
|
||||
void SetAcquisitionPeriod();
|
||||
void SetDelay();
|
||||
void SetFileWrite(bool val);
|
||||
void SetFileName();
|
||||
void SetRunIndex(int val);
|
||||
void SetStartingFrameNumber(int val);
|
||||
void UpdateProgress();
|
||||
void StartAcquisition();
|
||||
void StopAcquisition();
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
/** default, show trigger and delay,
|
||||
* otherwise for gotthard2 in auto timing mode and burst mode,
|
||||
* show bursts and burst period
|
||||
*/
|
||||
void ShowTriggerDelay();
|
||||
void SetupTimingMode();
|
||||
void EnableWidgetsforTimingMode();
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void SetupTimingMode();
|
||||
void EnableWidgetsforTimingMode();
|
||||
|
||||
void GetTimingMode();
|
||||
void GetNumFrames();
|
||||
void GetNumTriggers();
|
||||
void GetNumBursts();
|
||||
void GetNumSamples();
|
||||
void GetExposureTime();
|
||||
void GetAcquisitionPeriod();
|
||||
void CheckAcqPeriodGreaterThanExp();
|
||||
void GetDelay();
|
||||
void GetBurstPeriod();
|
||||
void GetFileWrite();
|
||||
void GetFileName();
|
||||
void GetRunIndex();
|
||||
void GetStartingFrameNumber();
|
||||
void GetTimingMode();
|
||||
void GetNumFrames();
|
||||
void GetNumTriggers();
|
||||
void GetNumSamples();
|
||||
void GetExposureTime();
|
||||
void GetAcquisitionPeriod();
|
||||
void CheckAcqPeriodGreaterThanExp();
|
||||
void GetDelay();
|
||||
void GetFileWrite();
|
||||
void GetFileName();
|
||||
void GetRunIndex();
|
||||
void GetStartingFrameNumber();
|
||||
|
||||
void ResetProgress();
|
||||
void ResetProgress();
|
||||
|
||||
void Enable(bool enable);
|
||||
int VerifyOutputDirectoryError();
|
||||
void Enable(bool enable);
|
||||
int VerifyOutputDirectoryError();
|
||||
|
||||
signals:
|
||||
void EnableTabsSignal(bool);
|
||||
void FileNameChangedSignal(QString);
|
||||
|
||||
private:
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
// enum for the timing mode
|
||||
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, NUMTIMINGMODES };
|
||||
QTimer *progressTimer;
|
||||
// tool tip variables
|
||||
QString acqPeriodTip;
|
||||
QString errPeriodTip;
|
||||
QPalette red;
|
||||
bool delayImplemented;
|
||||
bool sampleImplemented;
|
||||
bool startingFnumImplemented;
|
||||
bool isAcquisitionStopped{false};
|
||||
int numMeasurements{1};
|
||||
int currentMeasurement{0};
|
||||
signals:
|
||||
void EnableTabsSignal(bool);
|
||||
void FileNameChangedSignal(QString);
|
||||
private:
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
// enum for the timing mode
|
||||
enum{
|
||||
AUTO,
|
||||
TRIGGER,
|
||||
GATED,
|
||||
BURST_TRIGGER,
|
||||
NUMTIMINGMODES
|
||||
};
|
||||
QTimer *progressTimer;
|
||||
//tool tip variables
|
||||
QString acqPeriodTip;
|
||||
QString errPeriodTip;
|
||||
QPalette red;
|
||||
bool delayImplemented;
|
||||
bool sampleImplemented;
|
||||
bool startingFnumImplemented;
|
||||
bool isAcquisitionStopped{false};
|
||||
int numMeasurements{1};
|
||||
int currentMeasurement{0};
|
||||
};
|
||||
|
46
slsDetectorGui/include/qTabMessages.h
Normal file → Executable file
46
slsDetectorGui/include/qTabMessages.h
Normal file → Executable file
@ -1,34 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_tab_messages.h"
|
||||
|
||||
class QProcess;
|
||||
class QKeyEvent;
|
||||
|
||||
class qTabMessages : public QWidget, private Ui::TabMessagesObject {
|
||||
Q_OBJECT
|
||||
class qTabMessages:public QWidget, private Ui::TabMessagesObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabMessages(QWidget *parent);
|
||||
~qTabMessages();
|
||||
void Refresh();
|
||||
public:
|
||||
qTabMessages(QWidget* parent);
|
||||
~qTabMessages();
|
||||
void Refresh();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
|
||||
private slots:
|
||||
void ExecuteCommand();
|
||||
void SaveLog();
|
||||
void ClearLog();
|
||||
private slots:
|
||||
void ExecuteCommand();
|
||||
void SaveLog();
|
||||
void ClearLog();
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PrintNextLine();
|
||||
void GetLastCommand();
|
||||
void ClearCommand();
|
||||
void AppendOutput();
|
||||
void AppendError();
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void PrintNextLine();
|
||||
void GetLastCommand();
|
||||
void ClearCommand();
|
||||
void AppendOutput();
|
||||
void AppendError();
|
||||
|
||||
QProcess *process;
|
||||
QStringList lastCommand;
|
||||
QProcess* process;
|
||||
QStringList lastCommand;
|
||||
};
|
||||
|
||||
|
93
slsDetectorGui/include/qTabPlot.h
Normal file → Executable file
93
slsDetectorGui/include/qTabPlot.h
Normal file → Executable file
@ -1,58 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_tab_plot.h"
|
||||
#include "Detector.h"
|
||||
|
||||
class qDrawPlot;
|
||||
|
||||
#include "Detector.h"
|
||||
|
||||
class QButtonGroup;
|
||||
|
||||
class qTabPlot : public QWidget, private Ui::TabPlotObject {
|
||||
Q_OBJECT
|
||||
class qTabPlot:public QWidget, private Ui::TabPlotObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
||||
~qTabPlot();
|
||||
void SetScanArgument();
|
||||
void Refresh();
|
||||
public:
|
||||
qTabPlot(QWidget *parent, sls::Detector* detector, qDrawPlot* p);
|
||||
~qTabPlot();
|
||||
void SetScanArgument();
|
||||
void Refresh();
|
||||
|
||||
private slots:
|
||||
void SetPlot();
|
||||
void Set1DPlotOptionsRight();
|
||||
void Set1DPlotOptionsLeft();
|
||||
void Set2DPlotOptionsRight();
|
||||
void Set2DPlotOptionsLeft();
|
||||
void EnablePersistency(bool enable);
|
||||
void SetBinary();
|
||||
void SetGapPixels(bool enable);
|
||||
void SetTitles();
|
||||
void SetXRange();
|
||||
void SetYRange();
|
||||
void CheckAspectRatio();
|
||||
void SetZRange();
|
||||
void SetStreamingFrequency();
|
||||
private slots:
|
||||
void SetPlot();
|
||||
void Set1DPlotOptionsRight();
|
||||
void Set1DPlotOptionsLeft();
|
||||
void Set2DPlotOptionsRight();
|
||||
void Set2DPlotOptionsLeft();
|
||||
void EnablePersistency(bool enable);
|
||||
void SetBinary();
|
||||
void SetGapPixels(bool enable);
|
||||
void SetTitles();
|
||||
void SetXRange();
|
||||
void SetYRange();
|
||||
void CheckAspectRatio();
|
||||
void SetZRange();
|
||||
void SetStreamingFrequency();
|
||||
|
||||
signals:
|
||||
void DisableZoomSignal(bool);
|
||||
signals:
|
||||
void DisableZoomSignal(bool);
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void Select1DPlot(bool enable);
|
||||
void GetGapPixels();
|
||||
void GetStreamingFrequency();
|
||||
void SetXYRange();
|
||||
void MaintainAspectRatio(int dimension);
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
void Select1DPlot(bool enable);
|
||||
void GetGapPixels();
|
||||
void GetStreamingFrequency();
|
||||
void SetXYRange();
|
||||
void MaintainAspectRatio(int dimension);
|
||||
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
bool is1d;
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
bool is1d;
|
||||
|
||||
QButtonGroup *btnGroupPlotType{nullptr};
|
||||
QButtonGroup *btnGroupPlotType{nullptr};
|
||||
|
||||
/** default plot and axis titles */
|
||||
static QString defaultPlotTitle;
|
||||
static QString defaultHistXAxisTitle;
|
||||
static QString defaultHistYAxisTitle;
|
||||
static QString defaultImageXAxisTitle;
|
||||
static QString defaultImageYAxisTitle;
|
||||
static QString defaultImageZAxisTitle;
|
||||
/** default plot and axis titles */
|
||||
static QString defaultPlotTitle;
|
||||
static QString defaultHistXAxisTitle;
|
||||
static QString defaultHistYAxisTitle;
|
||||
static QString defaultImageXAxisTitle;
|
||||
static QString defaultImageYAxisTitle;
|
||||
static QString defaultImageZAxisTitle;
|
||||
};
|
||||
|
||||
|
||||
|
89
slsDetectorGui/include/qTabSettings.h
Normal file → Executable file
89
slsDetectorGui/include/qTabSettings.h
Normal file → Executable file
@ -1,55 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui_form_tab_settings.h"
|
||||
|
||||
#include "Detector.h"
|
||||
|
||||
class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||
Q_OBJECT
|
||||
class qTabSettings: public QWidget, private Ui::TabSettingsObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabSettings(QWidget *parent, sls::Detector *detector);
|
||||
~qTabSettings();
|
||||
void Refresh();
|
||||
public:
|
||||
qTabSettings(QWidget *parent, sls::Detector* detector);
|
||||
~qTabSettings();
|
||||
void Refresh();
|
||||
|
||||
private slots:
|
||||
void SetSettings(int index);
|
||||
void SetDynamicRange(int index);
|
||||
void SetThresholdEnergy(int index);
|
||||
private slots:
|
||||
void SetSettings(int index);
|
||||
void SetDynamicRange(int index);
|
||||
void SetThresholdEnergy(int index);
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void SetupDetectorSettings();
|
||||
void Initialization();
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void SetupDetectorSettings();
|
||||
void Initialization();
|
||||
|
||||
void GetSettings();
|
||||
void GetDynamicRange();
|
||||
void GetThresholdEnergy();
|
||||
void GetSettings();
|
||||
void GetDynamicRange();
|
||||
void GetThresholdEnergy();
|
||||
|
||||
sls::Detector *det;
|
||||
enum {
|
||||
STANDARD,
|
||||
FAST,
|
||||
HIGHGAIN,
|
||||
DYNAMICGAIN,
|
||||
LOWGAIN,
|
||||
MEDIUMGAIN,
|
||||
VERYHIGHGAIN,
|
||||
DYNAMICHG0,
|
||||
FIXGAIN1,
|
||||
FIXGAIN2,
|
||||
FORCESWITCHG1,
|
||||
FORCESWITCHG2,
|
||||
VERLOWGAIN,
|
||||
G1_HIGHGAIN,
|
||||
G1_LOWGAIN,
|
||||
G2_HIGHCAP_HIGHGAIN,
|
||||
G2_HIGHCAP_LOWGAIN,
|
||||
G2_LOWCAP_HIGHGAIN,
|
||||
G2_LOWCAP_LOWGAIN,
|
||||
G4_HIGHGAIN,
|
||||
G4_LOWGAIN,
|
||||
UNDEFINED,
|
||||
UNINITIALIZED,
|
||||
NUMSETTINGS
|
||||
};
|
||||
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
||||
sls::Detector *det;
|
||||
enum {
|
||||
STANDARD,
|
||||
FAST,
|
||||
HIGHGAIN,
|
||||
DYNAMICGAIN,
|
||||
LOWGAIN,
|
||||
MEDIUMGAIN,
|
||||
VERYHIGHGAIN,
|
||||
DYNAMICHG0,
|
||||
FIXGAIN1,
|
||||
FIXGAIN2,
|
||||
FORCESWITCHG1,
|
||||
FORCESWITCHG2,
|
||||
VERLOWGAIN,
|
||||
UNDEFINED,
|
||||
UNINITIALIZED,
|
||||
NUMSETTINGS
|
||||
};
|
||||
enum {
|
||||
DYNAMICRANGE_32,
|
||||
DYNAMICRANGE_16,
|
||||
DYNAMICRANGE_8,
|
||||
DYNAMICRANGE_4
|
||||
};
|
||||
};
|
||||
|
260
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
Normal file → Executable file
260
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
Normal file → Executable file
@ -1,165 +1,181 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
* Modifications:
|
||||
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in and out
|
||||
* without using mouse control:
|
||||
* DisableZoom,
|
||||
* SetXMinMax,SetYMinMax,
|
||||
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
||||
* */
|
||||
|
||||
#ifndef SLSQT1DPLOT_H
|
||||
#define SLSQT1DPLOT_H
|
||||
|
||||
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
|
||||
#include "ansi.h"
|
||||
#include "SlsQt1DZoomer.h"
|
||||
|
||||
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_plot_curve.h>
|
||||
#include <qwt_plot_marker.h>
|
||||
#include <qwt_scale_div.h>
|
||||
#include "SlsQt1DZoomer.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
class QPen;
|
||||
class SlsQt1DPlot;
|
||||
class QwtSymbol;
|
||||
|
||||
class SlsQtH1D : public QwtPlotCurve {
|
||||
class SlsQtH1D:public QwtPlotCurve{
|
||||
|
||||
public:
|
||||
SlsQtH1D(QString title, int n, double xmin, double xmax, double *data = 0);
|
||||
SlsQtH1D(QString title, int n, double *data_x, double *data_y);
|
||||
~SlsQtH1D();
|
||||
public:
|
||||
SlsQtH1D(QString title, int n, double xmin, double xmax, double* data=0);
|
||||
SlsQtH1D(QString title, int n, double* data_x, double* data_y);
|
||||
~SlsQtH1D();
|
||||
|
||||
void Attach(SlsQt1DPlot *p);
|
||||
void Detach(SlsQt1DPlot *p);
|
||||
void Attach(SlsQt1DPlot* p);
|
||||
void Detach(SlsQt1DPlot* p);
|
||||
|
||||
int SetLineColor(int c = -1);
|
||||
int SetLineWidth(int w = 1);
|
||||
void SetLineStyle(int s = 0);
|
||||
void setStyleLinesorDots(bool isLines);
|
||||
void setSymbolMarkers(bool isMarker);
|
||||
int SetLineColor(int c=-1);
|
||||
int SetLineWidth(int w=1);
|
||||
void SetLineStyle(int s=0);
|
||||
void setStyleLinesorDots(bool isLines);
|
||||
void setSymbolMarkers(bool isMarker);
|
||||
|
||||
void SetData(int n, double xmin, double xmax, double *d = 0);
|
||||
void SetData(int n, double *dx, double *dy);
|
||||
void SetData(int n, double xmin, double xmax, double* d=0);
|
||||
void SetData(int n, double* dx, double* dy);
|
||||
|
||||
double *GetX() { return x; }
|
||||
double *GetY() { return y; }
|
||||
int GetNBinsX() { return ndata; }
|
||||
double* GetX() {return x;}
|
||||
double* GetY() {return y;}
|
||||
int GetNBinsX() {return ndata;}
|
||||
|
||||
double FillBin(int bx, double v = 1);
|
||||
double Fill(double x, double v = 1);
|
||||
double SetBinContent(int bx, double v);
|
||||
double SetContent(double x, double v);
|
||||
int FindBinIndex(double px);
|
||||
double FillBin(int bx, double v=1);
|
||||
double Fill(double x, double v=1);
|
||||
double SetBinContent(int bx,double v);
|
||||
double SetContent(double x,double v);
|
||||
int FindBinIndex(double px);
|
||||
|
||||
double GetXMin() { return x[0]; }
|
||||
double GetFirstXgtZero() { return firstXgt0; }
|
||||
double GetXMax() { return x[ndata - 1]; }
|
||||
double GetYMin() { return ymin; }
|
||||
double GetFirstYgtZero() { return firstYgt0; }
|
||||
double GetYMax() { return ymax; }
|
||||
double GetXMin() {return x[0];}
|
||||
double GetFirstXgtZero() {return firstXgt0;}
|
||||
double GetXMax() {return x[ndata-1];}
|
||||
double GetYMin() {return ymin;}
|
||||
double GetFirstYgtZero() {return firstYgt0;}
|
||||
double GetYMax() {return ymax;}
|
||||
|
||||
SlsQtH1D *Add(double v);
|
||||
SlsQtH1D* Add(double v);
|
||||
|
||||
private:
|
||||
int ndata;
|
||||
int n_array;
|
||||
double dx;
|
||||
double *x{nullptr}, *y{nullptr};
|
||||
double ymin, ymax;
|
||||
double firstXgt0, firstYgt0;
|
||||
void Initailize();
|
||||
int SetUpArrays(int n);
|
||||
int CheckIndex(int bx);
|
||||
|
||||
QPen *pen_ptr{nullptr};
|
||||
|
||||
private:
|
||||
int ndata;
|
||||
int n_array;
|
||||
double dx;
|
||||
double *x,*y;
|
||||
double ymin,ymax;
|
||||
double firstXgt0,firstYgt0;
|
||||
void Initailize();
|
||||
int SetUpArrays(int n);
|
||||
int CheckIndex(int bx);
|
||||
|
||||
QPen* pen_ptr;
|
||||
};
|
||||
|
||||
class SlsQtH1DList {
|
||||
public:
|
||||
SlsQtH1DList(SlsQtH1D *hist = 0);
|
||||
~SlsQtH1DList();
|
||||
|
||||
SlsQtH1D *Add(SlsQtH1D *h);
|
||||
void Remove(SlsQtH1D *h);
|
||||
void Print();
|
||||
class SlsQtH1DList{
|
||||
public:
|
||||
SlsQtH1DList(SlsQtH1D* hist=0);
|
||||
~SlsQtH1DList();
|
||||
|
||||
SlsQtH1D *Hist() { return the_hist; } // if no hist returns 0
|
||||
SlsQtH1DList *Next() { return the_next; }
|
||||
SlsQtH1D* Add(SlsQtH1D* h);
|
||||
void Remove(SlsQtH1D* h);
|
||||
void Print();
|
||||
|
||||
private:
|
||||
SlsQtH1DList *the_next;
|
||||
SlsQtH1D *the_hist;
|
||||
SlsQtH1D* Hist() {return the_hist;} //if no hist returns 0
|
||||
SlsQtH1DList* Next() {return the_next;}
|
||||
|
||||
|
||||
private:
|
||||
SlsQtH1DList* the_next;
|
||||
SlsQtH1D* the_hist;
|
||||
};
|
||||
|
||||
|
||||
class SlsQt1DPlot : public QwtPlot {
|
||||
Q_OBJECT
|
||||
class SlsQt1DPlot:public QwtPlot{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SlsQt1DPlot(QWidget * = NULL);
|
||||
~SlsQt1DPlot();
|
||||
public:
|
||||
SlsQt1DPlot(QWidget* = NULL);
|
||||
~SlsQt1DPlot();
|
||||
|
||||
void SetTitle(QString title);
|
||||
void SetXTitle(QString title);
|
||||
void SetYTitle(QString title);
|
||||
void SetTitleFont(const QFont& f);
|
||||
void SetXFont(const QFont& f);
|
||||
void SetYFont(const QFont& f);
|
||||
|
||||
void InsertHLine(double y);
|
||||
void RemoveHLine();
|
||||
void InsertVLine(double v);
|
||||
void RemoveVLine();
|
||||
|
||||
void SetTitle(QString title);
|
||||
void SetXTitle(QString title);
|
||||
void SetYTitle(QString title);
|
||||
void SetTitleFont(const QFont &f);
|
||||
void SetXFont(const QFont &f);
|
||||
void SetYFont(const QFont &f);
|
||||
|
||||
void InsertHLine(double y);
|
||||
void RemoveHLine();
|
||||
void InsertVLine(double v);
|
||||
void RemoveVLine();
|
||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
||||
use zooming functionality without mouse control*/
|
||||
void DisableZoom(bool disable);
|
||||
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);Update();};
|
||||
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);Update();};
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
double GetXMinimum(){return hist_list->Hist()->GetXMin();};
|
||||
double GetXMaximum(){return hist_list->Hist()->GetXMax();};
|
||||
double GetYMinimum(){return hist_list->Hist()->GetYMin();};
|
||||
double GetYMaximum(){return hist_list->Hist()->GetYMax();};
|
||||
/**---*/
|
||||
|
||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be
|
||||
able to use zooming functionality without mouse control*/
|
||||
void DisableZoom(bool disable);
|
||||
void EnableXAutoScaling() {
|
||||
setAxisAutoScale(QwtPlot::xBottom, true);
|
||||
Update();
|
||||
};
|
||||
void EnableYAutoScaling() {
|
||||
setAxisAutoScale(QwtPlot::yLeft, true);
|
||||
Update();
|
||||
};
|
||||
void SetYStep(int step) { ystep = step; };
|
||||
void SetXMinMax(double min, double max) {
|
||||
setAxisScale(QwtPlot::xBottom, min, max);
|
||||
};
|
||||
void SetYMinMax(double min, double max) {
|
||||
setAxisScale(QwtPlot::yLeft, min, max);
|
||||
};
|
||||
double GetXMinimum() { return hist_list->Hist()->GetXMin(); };
|
||||
double GetXMaximum() { return hist_list->Hist()->GetXMax(); };
|
||||
double GetYMinimum() { return hist_list->Hist()->GetYMin(); };
|
||||
double GetYMaximum() { return hist_list->Hist()->GetYMax(); };
|
||||
/**---*/
|
||||
|
||||
void SetZoom(double xmin, double ymin, double x_width, double y_width);
|
||||
void SetZoomBase(double xmin, double ymin, double x_width, double y_width) {
|
||||
zoomer->SetZoomBase(xmin, ymin, x_width, y_width);
|
||||
}
|
||||
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);}
|
||||
|
||||
void alignScales();
|
||||
void alignScales();
|
||||
|
||||
void SetLogX(bool yes = 1);
|
||||
void SetLogY(bool yes = 1);
|
||||
void SetLogX(bool yes=1);
|
||||
void SetLogY(bool yes=1);
|
||||
private:
|
||||
|
||||
SlsQtH1DList* hist_list;
|
||||
SlsQt1DZoomer* zoomer;
|
||||
QwtPlotPanner* panner;
|
||||
|
||||
private:
|
||||
SlsQtH1DList *hist_list{nullptr};
|
||||
SlsQt1DZoomer *zoomer{nullptr};
|
||||
QwtPlotPanner *panner{nullptr};
|
||||
QwtPlotMarker *hline;
|
||||
QwtPlotMarker *vline;
|
||||
bool disableZoom{false};
|
||||
|
||||
void SetupZoom();
|
||||
void UnknownStuff();
|
||||
//void alignScales();
|
||||
|
||||
void CalculateNResetZoomBase();
|
||||
void NewHistogramAttached(SlsQtH1D* h);
|
||||
void HistogramDetached(SlsQtH1D* h);
|
||||
|
||||
QwtPlotMarker *hline{nullptr};
|
||||
QwtPlotMarker *vline{nullptr};
|
||||
bool disableZoom{false};
|
||||
int ystep{0};
|
||||
void SetLog(int axisId, bool yes);
|
||||
|
||||
friend void SlsQtH1D::Attach(SlsQt1DPlot* p);
|
||||
friend void SlsQtH1D::Detach(SlsQt1DPlot* p);
|
||||
|
||||
|
||||
public slots:
|
||||
void UnZoom();
|
||||
void Update();
|
||||
|
||||
void SetupZoom();
|
||||
void UnknownStuff();
|
||||
// void alignScales();
|
||||
|
||||
void CalculateNResetZoomBase();
|
||||
void NewHistogramAttached(SlsQtH1D *h);
|
||||
void HistogramDetached(SlsQtH1D *h);
|
||||
|
||||
void SetLog(int axisId, bool yes);
|
||||
|
||||
friend void SlsQtH1D::Attach(SlsQt1DPlot *p);
|
||||
friend void SlsQtH1D::Detach(SlsQt1DPlot *p);
|
||||
|
||||
public slots:
|
||||
void UnZoom();
|
||||
void Update();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
90
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
Normal file → Executable file
90
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
Normal file → Executable file
@ -1,52 +1,74 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#ifndef SLSQT1DZOOMER_H
|
||||
#define SLSQT1DZOOMER_H
|
||||
|
||||
#include <qwt_global.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
#include <qwt_plot_zoomer.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
#include <qwt_global.h>
|
||||
|
||||
class SlsQtH1D;
|
||||
|
||||
class SlsQt1DZoomer : public QwtPlotZoomer {
|
||||
private:
|
||||
double x0, x1, y0, y1;
|
||||
double firstXgt0, firstYgt0;
|
||||
bool xIsLog, yIsLog;
|
||||
class SlsQt1DZoomer:public QwtPlotZoomer{
|
||||
private:
|
||||
double x0,x1,y0,y1;
|
||||
double firstXgt0,firstYgt0;
|
||||
bool xIsLog,yIsLog;
|
||||
|
||||
public:
|
||||
SlsQt1DZoomer(QWidget *canvas) : QwtPlotZoomer(canvas) {
|
||||
setTrackerMode(AlwaysOn);
|
||||
xIsLog = yIsLog = 0;
|
||||
}
|
||||
public:
|
||||
#if QWT_VERSION < 0x060100
|
||||
SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
|
||||
#else
|
||||
SlsQt1DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
|
||||
#endif
|
||||
setTrackerMode(AlwaysOn);
|
||||
xIsLog=yIsLog=0;
|
||||
}
|
||||
|
||||
double x() { return x0; }
|
||||
double x_firstGreaterThan0() { return firstXgt0; }
|
||||
double w() { return x1 - x0; }
|
||||
double x() {return x0;}
|
||||
double x_firstGreaterThan0() {return firstXgt0;}
|
||||
double w() {return x1-x0;}
|
||||
|
||||
double y() { return y0; }
|
||||
double y_firstGreaterThan0() { return firstYgt0; }
|
||||
double h() { return y1 - y0; }
|
||||
double y() {return y0;}
|
||||
double y_firstGreaterThan0() {return firstYgt0;}
|
||||
double h() {return y1-y0;}
|
||||
|
||||
void SetZoomBase(double xmin, double ymin, double x_width, double y_width);
|
||||
void SetZoomBase(SlsQtH1D *h);
|
||||
void ExtendZoomBase(SlsQtH1D *h);
|
||||
void ResetZoomBase();
|
||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width);
|
||||
void SetZoomBase(SlsQtH1D* h);
|
||||
void ExtendZoomBase(SlsQtH1D* h);
|
||||
void ResetZoomBase();
|
||||
|
||||
bool IsLogX() { return xIsLog; }
|
||||
bool IsLogY() { return yIsLog; }
|
||||
bool SetLogX(bool yes) { return xIsLog = yes; }
|
||||
bool SetLogY(bool yes) { return yIsLog = yes; }
|
||||
bool IsLogX(){ return xIsLog;}
|
||||
bool IsLogY(){ return yIsLog;}
|
||||
bool SetLogX(bool yes) { return xIsLog=yes;}
|
||||
bool SetLogY(bool yes) { return yIsLog=yes;}
|
||||
|
||||
using QwtPlotPicker::trackerText;
|
||||
virtual QwtText trackerText(const QPoint &pos) const {
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
|
||||
#else
|
||||
using QwtPlotPicker::trackerText;
|
||||
virtual QwtText trackerText(const QPoint &pos) const{
|
||||
#endif
|
||||
QColor bg(Qt::white);
|
||||
|
||||
#if QT_VERSION >= 0x040300
|
||||
bg.setAlpha(200);
|
||||
#endif
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
#else
|
||||
QwtText text = QwtPlotPicker::trackerText(pos);
|
||||
#endif
|
||||
text.setBackgroundBrush( QBrush( bg ));
|
||||
return text;
|
||||
}
|
||||
|
||||
QColor bg(Qt::white);
|
||||
bg.setAlpha(200);
|
||||
QwtText text = QwtPlotPicker::trackerText(pos);
|
||||
text.setBackgroundBrush(QBrush(bg));
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
201
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
Normal file → Executable file
201
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
Normal file → Executable file
@ -1,126 +1,137 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SLSQT2DHIST_H
|
||||
#define SLSQT2DHIST_H
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
#include <qprintdialog.h>
|
||||
#endif
|
||||
#include <qwt_color_map.h>
|
||||
#include <qwt_plot_spectrogram.h>
|
||||
#include <qwt_scale_draw.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
#include <qwt_scale_draw.h>
|
||||
|
||||
class SlsQt2DHist : public QwtRasterData {
|
||||
|
||||
private:
|
||||
double x_min, x_max, y_min, y_max;
|
||||
double x_width, y_width;
|
||||
class SlsQt2DHist: public QwtRasterData{
|
||||
|
||||
private:
|
||||
|
||||
int nx, ny, nb;
|
||||
double *data{nullptr};
|
||||
double z_min, z_mean, z_max;
|
||||
bool z_mean_has_been_calculated;
|
||||
double x_min,x_max,y_min,y_max;
|
||||
double x_width,y_width;
|
||||
|
||||
int nx_array, ny_array;
|
||||
int nx,ny,nb;
|
||||
double *data;
|
||||
double z_min,z_mean,z_max;
|
||||
bool z_mean_has_been_calculated;
|
||||
|
||||
int nx_array,ny_array;
|
||||
|
||||
bool interp;
|
||||
bool interp;
|
||||
|
||||
static double value_between_points(double p1, double v1, double p2,
|
||||
double v2, double p) { // linear extrap
|
||||
return (v2 - v1) / (p2 - p1) * (p - p1) + v1;
|
||||
}
|
||||
static double value_between_points(double p1,double v1,double p2,double v2,double p){ //linear extrap
|
||||
return (v2-v1)/(p2-p1)*(p-p1)+v1;
|
||||
}
|
||||
|
||||
public:
|
||||
SlsQt2DHist(int nbinsx=10, double xmin=0, double xmax=10, int nbinsy=10, double ymin=0, double ymax=10, double* d=0,double zmin=0,double zmax=-1);
|
||||
virtual ~SlsQt2DHist();
|
||||
|
||||
public:
|
||||
SlsQt2DHist(int nbinsx = 10, double xmin = 0, double xmax = 10,
|
||||
int nbinsy = 10, double ymin = 0, double ymax = 10,
|
||||
double *d = 0, double zmin = 0, double zmax = -1);
|
||||
virtual ~SlsQt2DHist();
|
||||
double GetXMin() {return x_min;}
|
||||
double GetXMax() {return x_max;}
|
||||
double GetXBinWidth() {return x_width;}
|
||||
double GetYMin() {return y_min;}
|
||||
double GetYMax() {return y_max;}
|
||||
double GetYBinWidth() {return y_width;}
|
||||
double GetMinimum() {return z_min;}
|
||||
double GetMaximum() {return z_max;}
|
||||
double GetMean();
|
||||
|
||||
double GetXMin() { return x_min; }
|
||||
double GetXMax() { return x_max; }
|
||||
double GetXBinWidth() { return x_width; }
|
||||
double GetYMin() { return y_min; }
|
||||
double GetYMax() { return y_max; }
|
||||
double GetYBinWidth() { return y_width; }
|
||||
double GetMinimum() { return z_min; }
|
||||
double GetMaximum() { return z_max; }
|
||||
double GetMean();
|
||||
int GetNBinsX(){return nx;}
|
||||
int GetNBinsY(){return ny;}
|
||||
double GetBinValue(int bx,int by);
|
||||
int GetBinIndex(int bx,int by);
|
||||
double* GetDataPtr(){return data;}
|
||||
|
||||
int GetNBinsX() { return nx; }
|
||||
int GetNBinsY() { return ny; }
|
||||
double GetBinValue(int bx, int by);
|
||||
int GetBinIndex(int bx, int by);
|
||||
double *GetDataPtr() { return data; }
|
||||
void Interpolate(bool on=1) {interp=on;}
|
||||
void SetBinValue(int bx,int by,double v);
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1);
|
||||
|
||||
double SetMinimumToFirstGreaterThanZero();
|
||||
void SetMinimum(double zmin) {z_min=zmin;}
|
||||
void SetMaximum(double zmax) {z_max=zmax;}
|
||||
void SetMinMax(double zmin=0,double zmax=-1);
|
||||
|
||||
void Interpolate(bool on = 1) { interp = on; }
|
||||
void SetBinValue(int bx, int by, double v);
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy, double ymin,
|
||||
double ymax, double *d, double zmin = 0, double zmax = -1);
|
||||
int FindBinIndex(double x, double y);
|
||||
|
||||
double SetMinimumToFirstGreaterThanZero();
|
||||
void SetMinimum(double zmin) { z_min = zmin; }
|
||||
void SetMaximum(double zmax) { z_max = zmax; }
|
||||
void SetMinMax(double zmin = 0, double zmax = -1);
|
||||
|
||||
int FindBinIndex(double x, double y);
|
||||
|
||||
virtual QwtRasterData *copy() const {
|
||||
// this function does not create a new SlsQt2DHistData instance,
|
||||
// just passes a pointer so that data is common to both the copy and the
|
||||
// original instance
|
||||
return (QwtRasterData *)this;
|
||||
}
|
||||
virtual QwtRasterData *copy() const{
|
||||
//this function does not create a new SlsQt2DHistData instance,
|
||||
//just passes a pointer so that data is common to both the copy and the original instance
|
||||
return (QwtRasterData*) this;
|
||||
}
|
||||
|
||||
virtual QwtInterval range() const { return QwtInterval(z_min, z_max); }
|
||||
virtual QwtInterval interval(Qt::Axis axis) const {
|
||||
switch (axis) {
|
||||
case Qt::ZAxis:
|
||||
return QwtInterval(z_min, z_max);
|
||||
case Qt::XAxis:
|
||||
return QwtInterval(x_min, x_max);
|
||||
case Qt::YAxis:
|
||||
return QwtInterval(y_min, y_max);
|
||||
default:
|
||||
return QwtInterval(z_min, z_max);
|
||||
};
|
||||
#if QWT_VERSION<0x060000
|
||||
virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);}
|
||||
#else
|
||||
virtual QwtInterval range() const{ return QwtInterval(z_min,z_max);}
|
||||
virtual QwtInterval interval(Qt::Axis axis) const {
|
||||
switch (axis){
|
||||
case Qt::ZAxis:
|
||||
return QwtInterval(z_min,z_max);
|
||||
case Qt::XAxis:
|
||||
return QwtInterval(x_min,x_max);
|
||||
case Qt::YAxis:
|
||||
return QwtInterval(y_min,y_max);
|
||||
default:
|
||||
return QwtInterval(z_min,z_max);
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
virtual double value(double x, double y) const {
|
||||
// if(!interp){ //default is box like plot
|
||||
int index =
|
||||
int((x - x_min) / x_width) + int((y - y_min) / y_width) * nx;
|
||||
if (index < 0 || index > nb)
|
||||
index = nb;
|
||||
if (!interp)
|
||||
return data[index];
|
||||
//}
|
||||
|
||||
int x_int = int((x - x_min) / x_width - 0.5);
|
||||
if (x_int < 0)
|
||||
x_int = 0;
|
||||
else if (x_int > nx - 2)
|
||||
x_int = nx - 2;
|
||||
int y_int = int((y - y_min) / y_width - 0.5);
|
||||
if (y_int < 0)
|
||||
y_int = 0;
|
||||
else if (y_int > ny - 2)
|
||||
y_int = ny - 2;
|
||||
|
||||
int b00 = x_int * ny + y_int;
|
||||
int b01 = x_int * ny + y_int + 1;
|
||||
int b10 = (x_int + 1) * ny + y_int;
|
||||
int b11 = (x_int + 1) * ny + y_int + 1;
|
||||
virtual double value(double x, double y) const{
|
||||
//if(!interp){ //default is box like plot
|
||||
int index = int((x-x_min)/x_width) + int((y-y_min)/y_width)*nx;
|
||||
if(index<0||index>nb) index = nb;
|
||||
if(!interp) return data[index];
|
||||
//}
|
||||
|
||||
// vertical extrap
|
||||
double y0 = y_min + (y_int + 0.5) * y_width;
|
||||
double y1 = y_min + (y_int + 1.5) * y_width;
|
||||
double left_v = value_between_points(y0, data[b00], y1, data[b01], y);
|
||||
double right_v = value_between_points(y0, data[b10], y1, data[b11], y);
|
||||
// horazontal extrap
|
||||
|
||||
int x_int = int((x-x_min)/x_width-0.5);
|
||||
if(x_int<0) x_int = 0; else if(x_int>nx-2) x_int = nx-2;
|
||||
int y_int = int((y-y_min)/y_width-0.5);
|
||||
if(y_int<0) y_int = 0; else if(y_int>ny-2) y_int = ny-2;
|
||||
|
||||
return 0.5;
|
||||
int b00 = x_int*ny + y_int;
|
||||
int b01 = x_int*ny + y_int+1;
|
||||
int b10 = (x_int+1)*ny + y_int;
|
||||
int b11 = (x_int+1)*ny + y_int+1;
|
||||
|
||||
return value_between_points(x_min + (x_int + 0.5) * x_width, left_v,
|
||||
x_min + (x_int + 1.5) * x_width, right_v,
|
||||
x);
|
||||
}
|
||||
//vertical extrap
|
||||
double y0 = y_min+(y_int+0.5)*y_width;
|
||||
double y1 = y_min+(y_int+1.5)*y_width;
|
||||
double left_v = value_between_points(y0,data[b00],y1,data[b01],y);
|
||||
double right_v = value_between_points(y0,data[b10],y1,data[b11],y);
|
||||
//horazontal extrap
|
||||
|
||||
|
||||
|
||||
return 0.5;
|
||||
|
||||
|
||||
return value_between_points(x_min+(x_int+0.5)*x_width,left_v,
|
||||
x_min+(x_int+1.5)*x_width,right_v,x);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
117
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
Normal file → Executable file
117
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
Normal file → Executable file
@ -1,87 +1,98 @@
|
||||
#pragma once
|
||||
#include "SlsQt2DHist.h"
|
||||
#include "SlsQt2DZoomer.h"
|
||||
#include <qlist.h>
|
||||
|
||||
|
||||
|
||||
#include <qwt_plot.h>
|
||||
#include <qlist.h>
|
||||
#include <qwt_plot_spectrogram.h>
|
||||
|
||||
class QwtPlotPanner;
|
||||
class QwtScaleWidget;
|
||||
class QwtLinearColorMap;
|
||||
#include "SlsQt2DZoomer.h"
|
||||
#include "SlsQt2DHist.h"
|
||||
|
||||
class SlsQt2DPlot : public QwtPlot {
|
||||
|
||||
class QwtPlotPanner;
|
||||
class QwtScaleWidget;
|
||||
class QwtLinearColorMap;
|
||||
|
||||
|
||||
class SlsQt2DPlot: public QwtPlot{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
public:
|
||||
SlsQt2DPlot(QWidget * = NULL);
|
||||
~SlsQt2DPlot();
|
||||
|
||||
void SetTitle(QString title);
|
||||
void SetXTitle(QString title);
|
||||
void SetYTitle(QString title);
|
||||
void SetZTitle(QString title);
|
||||
void SetTitleFont(const QFont &f);
|
||||
void SetXFont(const QFont &f);
|
||||
void SetYFont(const QFont &f);
|
||||
void SetZFont(const QFont &f);
|
||||
void SetTitleFont(const QFont& f);
|
||||
void SetXFont(const QFont& f);
|
||||
void SetYFont(const QFont& f);
|
||||
void SetZFont(const QFont& f);
|
||||
|
||||
void UnZoom(bool replot = true);
|
||||
void SetZoom(double xmin, double ymin, double x_width, double y_width);
|
||||
void UnZoom(bool replot=true);
|
||||
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
||||
void DisableZoom(bool disable);
|
||||
void EnableXAutoScaling() { setAxisAutoScale(QwtPlot::xBottom, true); };
|
||||
void EnableYAutoScaling() { setAxisAutoScale(QwtPlot::yLeft, true); };
|
||||
void SetXMinMax(double min, double max) {
|
||||
setAxisScale(QwtPlot::xBottom, min, max);
|
||||
};
|
||||
void SetYMinMax(double min, double max) {
|
||||
setAxisScale(QwtPlot::yLeft, min, max);
|
||||
};
|
||||
double GetXMinimum() { return hist->GetXMin(); };
|
||||
double GetXMaximum() { return hist->GetXMax(); };
|
||||
double GetYMinimum() { return hist->GetYMin(); };
|
||||
double GetYMaximum() { return hist->GetYMax(); };
|
||||
double GetZMinimum() { return hist->GetMinimum(); }
|
||||
double GetZMaximum() { return hist->GetMaximum(); }
|
||||
void SetZMinMax(double zmin = 0, double zmax = -1);
|
||||
void SetZMinimumToFirstGreaterThanZero() {
|
||||
hist->SetMinimumToFirstGreaterThanZero();
|
||||
}
|
||||
double GetZMean() { return hist->GetMean(); }
|
||||
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);};
|
||||
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);};
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
double GetXMinimum(){return hist->GetXMin();};
|
||||
double GetXMaximum(){return hist->GetXMax();};
|
||||
double GetYMinimum(){return hist->GetYMin();};
|
||||
double GetYMaximum(){return hist->GetYMax();};
|
||||
double GetZMinimum(){ return hist->GetMinimum();}
|
||||
double GetZMaximum(){ return hist->GetMaximum();}
|
||||
void SetZMinMax(double zmin=0,double zmax=-1);
|
||||
void SetZMinimumToFirstGreaterThanZero(){hist->SetMinimumToFirstGreaterThanZero();}
|
||||
double GetZMean() { return hist->GetMean();}
|
||||
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy, double ymin,
|
||||
double ymax, double *d, double zmin = 0, double zmax = -1) {
|
||||
hist->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d, zmin, zmax);
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){
|
||||
hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax);
|
||||
}
|
||||
|
||||
double *GetDataPtr() { return hist->GetDataPtr(); }
|
||||
int GetBinIndex(int bx, int by) { return hist->GetBinIndex(bx, by); }
|
||||
int FindBinIndex(double x, double y) { return hist->FindBinIndex(x, y); }
|
||||
void SetBinValue(int bx, int by, double v) { hist->SetBinValue(bx, by, v); }
|
||||
double GetBinValue(int bx, int by) { return hist->GetBinValue(bx, by); }
|
||||
void FillTestPlot(int i = 0);
|
||||
double* GetDataPtr() {return hist->GetDataPtr();}
|
||||
int GetBinIndex(int bx,int by) {return hist->GetBinIndex(bx,by);}
|
||||
int FindBinIndex(double x,double y) {return hist->FindBinIndex(x,y);}
|
||||
void SetBinValue(int bx,int by,double v) { hist->SetBinValue(bx,by,v);}
|
||||
double GetBinValue(int bx,int by) {return hist->GetBinValue(bx,by);}
|
||||
void FillTestPlot(int i=0);
|
||||
void Update();
|
||||
|
||||
void SetInterpolate(bool enable);
|
||||
void SetContour(bool enable);
|
||||
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
|
||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||
void LogZ(bool on = 1);
|
||||
void LogZ(bool on=1);
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
void showSpectrogram(bool on);
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
void SetupZoom();
|
||||
void SetupColorMap();
|
||||
QwtLinearColorMap *myColourMap(QVector<double> colourStops);
|
||||
QwtLinearColorMap *myColourMap(int log = 0);
|
||||
QwtLinearColorMap* myColourMap(QVector<double> colourStops);
|
||||
QwtLinearColorMap* myColourMap(int log=0);
|
||||
|
||||
QwtPlotSpectrogram *d_spectrogram{nullptr};
|
||||
SlsQt2DHist *hist{nullptr};
|
||||
SlsQt2DZoomer *zoomer{nullptr};
|
||||
QwtPlotPanner *panner{nullptr};
|
||||
QwtScaleWidget *rightAxis{nullptr};
|
||||
QwtPlotSpectrogram *d_spectrogram;
|
||||
SlsQt2DHist* hist;
|
||||
SlsQt2DZoomer* zoomer;
|
||||
QwtPlotPanner* panner;
|
||||
QwtScaleWidget *rightAxis;
|
||||
|
||||
QwtLinearColorMap* colorMapLinearScale;
|
||||
QwtLinearColorMap* colorMapLogScale;
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtValueList* contourLevelsLinear;
|
||||
QwtValueList* contourLevelsLog;
|
||||
#else
|
||||
QList<double> contourLevelsLinear;
|
||||
QList<double> contourLevelsLog;
|
||||
#endif
|
||||
bool disableZoom{false};
|
||||
int isLog;
|
||||
};
|
||||
|
||||
|
96
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
Normal file → Executable file
96
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
Normal file → Executable file
@ -1,41 +1,73 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
* Dhanya-05.12.2012- included an additional header
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SLSQT2DZOOMER_H
|
||||
#define SLSQT2DZOOMER_H
|
||||
#include "SlsQt2DHist.h"
|
||||
#include <qwt_plot_panner.h>
|
||||
#include <qwt_plot_zoomer.h>
|
||||
|
||||
|
||||
|
||||
/**included by Dhanya on 05.12.2012 to avoid compile time errors with the latest gcc*/
|
||||
#include <cstdio>
|
||||
/**end of Change by Dhanya*/
|
||||
|
||||
class SlsQt2DZoomer : public QwtPlotZoomer {
|
||||
private:
|
||||
SlsQt2DHist *hist;
|
||||
#include <qwt_plot_zoomer.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
|
||||
#include "SlsQt2DHist.h"
|
||||
|
||||
class SlsQt2DZoomer:public QwtPlotZoomer{
|
||||
private:
|
||||
SlsQt2DHist* hist;
|
||||
|
||||
public:
|
||||
#if QWT_VERSION < 0x060100
|
||||
SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
|
||||
#else
|
||||
SlsQt2DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
|
||||
#endif
|
||||
setTrackerMode(AlwaysOn);
|
||||
}
|
||||
|
||||
void SetHist(SlsQt2DHist* h){
|
||||
hist=h;
|
||||
}
|
||||
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
|
||||
#else
|
||||
virtual QwtText trackerTextF(const QPointF &pos) const{
|
||||
#endif
|
||||
QColor bg(Qt::white);
|
||||
#if QT_VERSION >= 0x040300
|
||||
bg.setAlpha(200);
|
||||
#endif
|
||||
|
||||
|
||||
//QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
|
||||
static QwtText text;
|
||||
if(hist){
|
||||
static char t[200];
|
||||
sprintf(t,"%3.2f, %3.2f, %3.2f",pos.x(),pos.y(),hist->value(pos.x(),pos.y()));
|
||||
text.setText(t);
|
||||
}else {
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
#else
|
||||
QPoint p=pos.toPoint();
|
||||
QwtText text = QwtPlotZoomer::trackerText(p);
|
||||
#endif
|
||||
|
||||
public:
|
||||
SlsQt2DZoomer(QWidget *canvas) : QwtPlotZoomer(canvas) {
|
||||
setTrackerMode(AlwaysOn);
|
||||
}
|
||||
|
||||
void SetHist(SlsQt2DHist *h) { hist = h; }
|
||||
|
||||
virtual QwtText trackerTextF(const QPointF &pos) const {
|
||||
QColor bg(Qt::white);
|
||||
bg.setAlpha(200);
|
||||
|
||||
// QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
|
||||
static QwtText text;
|
||||
if (hist) {
|
||||
static char t[200];
|
||||
sprintf(t, "%3.2f, %3.2f, %3.2f", pos.x(), pos.y(),
|
||||
hist->value(pos.x(), pos.y()));
|
||||
text.setText(t);
|
||||
} else {
|
||||
|
||||
QPoint p = pos.toPoint();
|
||||
QwtText text = QwtPlotZoomer::trackerText(p);
|
||||
}
|
||||
text.setBackgroundBrush(QBrush(bg));
|
||||
return text;
|
||||
}
|
||||
text.setBackgroundBrush( QBrush( bg ));
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
204
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cpp → slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx
Normal file → Executable file
204
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cpp → slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx
Normal file → Executable file
@ -1,7 +1,11 @@
|
||||
|
||||
/* TODO! short description */
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include <qwt_symbol.h>
|
||||
#include <iostream>
|
||||
#include <qwt_legend.h>
|
||||
#include <qwt_math.h>
|
||||
#include <qwt_painter.h>
|
||||
@ -10,36 +14,33 @@
|
||||
#include <qwt_scale_draw.h>
|
||||
#include <qwt_scale_engine.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
#include "qwt_symbol.h"
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
|
||||
#if QWT_VERSION >= 0x060100
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||
#endif
|
||||
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data)
|
||||
: QwtPlotCurve(title), x(nullptr), y(nullptr), pen_ptr(nullptr) {
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title) {
|
||||
Initailize();
|
||||
SetData(n, min, max, data);
|
||||
}
|
||||
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double *data_x, double *data_y)
|
||||
: QwtPlotCurve(title) {
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double *data_x, double *data_y) : QwtPlotCurve(title) {
|
||||
Initailize();
|
||||
SetData(n, data_x, data_y);
|
||||
}
|
||||
|
||||
void SlsQtH1D::Initailize() {
|
||||
ndata = n_array = 0;
|
||||
x = y = nullptr;
|
||||
x = y = 0;
|
||||
pen_ptr = new QPen();
|
||||
SetLineColor();
|
||||
}
|
||||
|
||||
SlsQtH1D::~SlsQtH1D() {
|
||||
|
||||
delete[] x;
|
||||
|
||||
delete[] y;
|
||||
|
||||
delete x;
|
||||
delete y;
|
||||
delete pen_ptr;
|
||||
}
|
||||
|
||||
@ -124,17 +125,21 @@ void SlsQtH1D::SetLineStyle(int s) {
|
||||
setPen(*pen_ptr);
|
||||
}
|
||||
|
||||
void SlsQtH1D::setStyleLinesorDots(bool isLines) {
|
||||
void SlsQtH1D::setStyleLinesorDots(bool isLines) {
|
||||
setStyle(isLines ? QwtPlotCurve::Lines : QwtPlotCurve::Dots);
|
||||
}
|
||||
|
||||
void SlsQtH1D::setSymbolMarkers(bool isMarker) {
|
||||
QwtSymbol *marker = new QwtSymbol();
|
||||
void SlsQtH1D::setSymbolMarkers(bool isMarker) {
|
||||
QwtSymbol* marker = new QwtSymbol();
|
||||
if (isMarker) {
|
||||
marker->setStyle(QwtSymbol::Cross);
|
||||
marker->setSize(5, 5);
|
||||
}
|
||||
#if QWT_VERSION < 0x060000
|
||||
setSymbol(*marker);
|
||||
#else
|
||||
setSymbol(marker);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
|
||||
@ -165,7 +170,11 @@ void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
|
||||
firstYgt0 = y[i];
|
||||
}
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
setRawData(x, y, ndata);
|
||||
#else
|
||||
setRawSamples(x, y, ndata);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
||||
@ -174,7 +183,7 @@ void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
||||
n = SetUpArrays(n);
|
||||
|
||||
ndata = n;
|
||||
dx = -1; // signifies not regular intervals
|
||||
dx = -1; //signifies not regular intervals
|
||||
|
||||
ymin = ymax = data_y ? data_y[0] : 0;
|
||||
|
||||
@ -194,18 +203,23 @@ void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
||||
if (y[b] > 0 && (firstYgt0 < 0 || firstYgt0 > y[b]))
|
||||
firstYgt0 = y[b];
|
||||
}
|
||||
|
||||
// #if QWT_VERSION<0x060000
|
||||
// setRawData(x,y,ndata);
|
||||
// #else
|
||||
setRawSamples(x, y, ndata);
|
||||
// #endif
|
||||
}
|
||||
|
||||
int SlsQtH1D::SetUpArrays(int n) {
|
||||
n = n < 1 ? 1 : n; // overflow bin
|
||||
n = n < 1 ? 1 : n; //overflow bin
|
||||
|
||||
if (n + 1 > n_array) {
|
||||
n_array = n + 1;
|
||||
|
||||
delete x;
|
||||
|
||||
delete y;
|
||||
if (x)
|
||||
delete x;
|
||||
if (y)
|
||||
delete y;
|
||||
x = new double[n_array];
|
||||
y = new double[n_array];
|
||||
}
|
||||
@ -217,9 +231,7 @@ double SlsQtH1D::FillBin(int bx, double v) {
|
||||
bx = CheckIndex(bx);
|
||||
return SetBinContent(bx, y[bx] + v);
|
||||
}
|
||||
double SlsQtH1D::Fill(double x, double v) {
|
||||
return FillBin(FindBinIndex(x), v);
|
||||
}
|
||||
double SlsQtH1D::Fill(double x, double v) { return FillBin(FindBinIndex(x), v); }
|
||||
|
||||
double SlsQtH1D::SetBinContent(int bx, double v) {
|
||||
bx = CheckIndex(bx);
|
||||
@ -235,15 +247,13 @@ double SlsQtH1D::SetBinContent(int bx, double v) {
|
||||
return y[bx];
|
||||
}
|
||||
|
||||
double SlsQtH1D::SetContent(double x, double v) {
|
||||
return SetBinContent(FindBinIndex(x), v);
|
||||
}
|
||||
double SlsQtH1D::SetContent(double x, double v) { return SetBinContent(FindBinIndex(x), v); }
|
||||
|
||||
int SlsQtH1D::FindBinIndex(double px) {
|
||||
if (dx > 0)
|
||||
CheckIndex(int((px - x[0]) / dx));
|
||||
|
||||
// find closest bin
|
||||
//find closest bin
|
||||
int b = 0;
|
||||
for (; b < ndata; b++)
|
||||
if (x[b] > px)
|
||||
@ -257,9 +267,7 @@ int SlsQtH1D::FindBinIndex(double px) {
|
||||
return b;
|
||||
}
|
||||
|
||||
int SlsQtH1D::CheckIndex(int bx) {
|
||||
return (bx < 0 || bx > ndata) ? ndata : bx;
|
||||
} // ndata is the overflow bin
|
||||
int SlsQtH1D::CheckIndex(int bx) { return (bx < 0 || bx > ndata) ? ndata : bx; } //ndata is the overflow bin
|
||||
|
||||
SlsQtH1D *SlsQtH1D::Add(double v) {
|
||||
for (int bx = 0; bx < ndata; bx++)
|
||||
@ -267,20 +275,23 @@ SlsQtH1D *SlsQtH1D::Add(double v) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// 1d hist list stuff
|
||||
//1d hist list stuff
|
||||
SlsQtH1DList::SlsQtH1DList(SlsQtH1D *hist) {
|
||||
the_hist = hist;
|
||||
the_next = nullptr;
|
||||
the_next = 0;
|
||||
}
|
||||
|
||||
SlsQtH1DList::~SlsQtH1DList() { delete the_next; }
|
||||
SlsQtH1DList::~SlsQtH1DList() {
|
||||
if (the_next)
|
||||
delete the_next;
|
||||
}
|
||||
|
||||
SlsQtH1D *SlsQtH1DList::Add(SlsQtH1D *hist) {
|
||||
SlsQtH1DList *hl = this;
|
||||
|
||||
while (hl) {
|
||||
if (hist == hl->the_hist)
|
||||
return hist; // already added
|
||||
return hist; //already added
|
||||
if (!hl->the_next)
|
||||
break;
|
||||
hl = hl->the_next;
|
||||
@ -299,8 +310,7 @@ void SlsQtH1DList::Print() {
|
||||
SlsQtH1DList *hl = this;
|
||||
int i = 0;
|
||||
while (hl) {
|
||||
std::cout << " " << i++ << ") " << hl << " " << hl->the_hist << " "
|
||||
<< hl->the_next << '\n';
|
||||
std::cout << " " << i++ << ") " << hl << " " << hl->the_hist << " " << hl->the_next << '\n';
|
||||
hl = hl->the_next;
|
||||
if (i > 10)
|
||||
break;
|
||||
@ -309,27 +319,27 @@ void SlsQtH1DList::Print() {
|
||||
|
||||
void SlsQtH1DList::Remove(SlsQtH1D *hist) {
|
||||
SlsQtH1DList *hl = this;
|
||||
while (hl) { // every match will be removed
|
||||
while (hl) { //every match will be removed
|
||||
if (hl->the_hist != hist)
|
||||
hl = hl->the_next;
|
||||
else { // match
|
||||
else { //match
|
||||
if (!hl->the_next)
|
||||
hl->the_hist = nullptr; // first the_hist is zero when there's no next
|
||||
hl->the_hist = 0; // first the_hist is zero when there's no next
|
||||
else {
|
||||
SlsQtH1DList *t = hl->the_next;
|
||||
hl->the_hist = t->the_hist;
|
||||
hl->the_next = t->the_next;
|
||||
t->the_next = nullptr;
|
||||
t->the_next = 0;
|
||||
delete t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 1d plot stuff
|
||||
//1d plot stuff
|
||||
SlsQt1DPlot::SlsQt1DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
// n_histograms_attached=0;
|
||||
hline = vline = nullptr;
|
||||
hline = vline = 0;
|
||||
hist_list = new SlsQtH1DList();
|
||||
|
||||
UnknownStuff();
|
||||
@ -348,16 +358,12 @@ SlsQt1DPlot::SlsQt1DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
}
|
||||
|
||||
SlsQt1DPlot::~SlsQt1DPlot() {
|
||||
|
||||
delete hist_list;
|
||||
|
||||
delete hline;
|
||||
|
||||
delete vline;
|
||||
|
||||
delete zoomer;
|
||||
|
||||
delete panner;
|
||||
if (hline)
|
||||
delete hline;
|
||||
if (vline)
|
||||
delete vline;
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::CalculateNResetZoomBase() {
|
||||
@ -374,8 +380,8 @@ void SlsQt1DPlot::CalculateNResetZoomBase() {
|
||||
void SlsQt1DPlot::NewHistogramAttached(SlsQtH1D *h) {
|
||||
hist_list->Add(h);
|
||||
CalculateNResetZoomBase();
|
||||
// commented out by dhanya to take off zooming every hist in 1d plots
|
||||
// if(!hist_list->Next()) UnZoom();
|
||||
//commented out by dhanya to take off zooming every hist in 1d plots
|
||||
//if(!hist_list->Next()) UnZoom();
|
||||
Update();
|
||||
}
|
||||
|
||||
@ -385,9 +391,13 @@ void SlsQt1DPlot::HistogramDetached(SlsQtH1D *h) {
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::Update() { replot(); }
|
||||
void SlsQt1DPlot::Update() {
|
||||
replot();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetTitle(QString title) { setTitle(title); }
|
||||
void SlsQt1DPlot::SetTitle(QString title) {
|
||||
setTitle(title);
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetXTitle(QString title) {
|
||||
setAxisTitle(QwtPlot::xBottom, title);
|
||||
@ -397,20 +407,20 @@ void SlsQt1DPlot::SetYTitle(QString title) {
|
||||
setAxisTitle(QwtPlot::yLeft, title);
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetTitleFont(const QFont &f) {
|
||||
void SlsQt1DPlot::SetTitleFont(const QFont& f) {
|
||||
QwtText t("");
|
||||
t.setFont(f);
|
||||
t.setRenderFlags(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
t.setRenderFlags( Qt::AlignLeft | Qt::AlignVCenter);
|
||||
setTitle(t);
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetXFont(const QFont &f) {
|
||||
void SlsQt1DPlot::SetXFont(const QFont& f) {
|
||||
QwtText t("");
|
||||
t.setFont(f);
|
||||
setAxisTitle(QwtPlot::xBottom, t);
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetYFont(const QFont &f) {
|
||||
void SlsQt1DPlot::SetYFont(const QFont& f) {
|
||||
QwtText t("");
|
||||
t.setFont(f);
|
||||
setAxisTitle(QwtPlot::yLeft, t);
|
||||
@ -424,10 +434,9 @@ void SlsQt1DPlot::SetLog(int axisId, bool yes) {
|
||||
if (axisId == QwtPlot::yLeft)
|
||||
zoomer->SetLogY(yes);
|
||||
|
||||
zoomer->ResetZoomBase(); // needs to be done before setting Engine
|
||||
zoomer->ResetZoomBase(); //needs to be done before setting Engine
|
||||
|
||||
// the old ones are deleted by in the setAxisScaleFunction() function see:
|
||||
// 128 of file qwt_plot_axis.cpp
|
||||
//the old ones are deleted by in the setAxisScaleFunction() function see: 128 of file qwt_plot_axis.cpp
|
||||
if (yes)
|
||||
setAxisScaleEngine(axisId, new QwtLog10ScaleEngine());
|
||||
else
|
||||
@ -443,13 +452,11 @@ void SlsQt1DPlot::UnZoom() {
|
||||
setAxisScale(QwtPlot::xBottom, zoomer->x(), zoomer->x() + zoomer->w());
|
||||
setAxisScale(QwtPlot::yLeft, zoomer->y(), zoomer->y() + zoomer->h());
|
||||
|
||||
zoomer->setZoomBase(); // Call replot for the attached plot before
|
||||
// initializing the zoomer with its scales.
|
||||
zoomer->setZoomBase(); //Call replot for the attached plot before initializing the zoomer with its scales.
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetZoom(double xmin, double ymin, double x_width,
|
||||
double y_width) {
|
||||
void SlsQt1DPlot::SetZoom(double xmin, double ymin, double x_width, double y_width) {
|
||||
setAxisScale(QwtPlot::xBottom, xmin, xmin + x_width);
|
||||
setAxisScale(QwtPlot::yLeft, ymin, ymin + y_width);
|
||||
Update();
|
||||
@ -459,7 +466,7 @@ void SlsQt1DPlot::RemoveHLine() {
|
||||
if (hline)
|
||||
hline->detach();
|
||||
delete hline;
|
||||
hline = nullptr;
|
||||
hline = 0;
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::InsertHLine(double y) {
|
||||
@ -476,7 +483,7 @@ void SlsQt1DPlot::RemoveVLine() {
|
||||
if (vline)
|
||||
vline->detach();
|
||||
delete vline;
|
||||
vline = nullptr;
|
||||
vline = 0;
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::InsertVLine(double x) {
|
||||
@ -496,9 +503,12 @@ void SlsQt1DPlot::SetupZoom() {
|
||||
// Ctrl+RighButton: zoom out to full size
|
||||
|
||||
zoomer = new SlsQt1DZoomer(canvas());
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||
Qt::ControlModifier);
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
|
||||
panner = new QwtPlotPanner((QwtPlotCanvas *)canvas());
|
||||
@ -537,40 +547,58 @@ void SlsQt1DPlot::alignScales() {
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::UnknownStuff() {
|
||||
#if QWT_VERSION < 0x060000
|
||||
// Disable polygon clipping
|
||||
//not supported for version 6
|
||||
QwtPainter::setDeviceClipping(false);
|
||||
canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
|
||||
canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
|
||||
#else
|
||||
// We don't need the cache here
|
||||
((QwtPlotCanvas *)canvas())
|
||||
->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
|
||||
((QwtPlotCanvas *)canvas())->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
|
||||
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
#ifdef Q_WS_X11
|
||||
// Qt::WA_PaintOnScreen is only supported for X11, but leads
|
||||
// to substantial bugs with Qt 4.2.x/Windows
|
||||
canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range
|
||||
// has been set
|
||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
||||
void SlsQt1DPlot::DisableZoom(bool disable) {
|
||||
if (disableZoom != disable) {
|
||||
disableZoom = disable;
|
||||
#ifdef VERBOSE
|
||||
if (disable)
|
||||
std::cout << "Disabling zoom\n";
|
||||
else
|
||||
std::cout << "Enabling zoom\n";
|
||||
#endif
|
||||
if (disable) {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||
Qt::NoButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::NoButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||
Qt::NoButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::NoButton);
|
||||
} else {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||
Qt::LeftButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||
Qt::RightButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::MidButton);
|
@ -1,93 +0,0 @@
|
||||
/* TODO! short description */
|
||||
#include "SlsQt1DZoomer.h"
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_scale_div.h>
|
||||
#include <iostream>
|
||||
|
||||
void SlsQt1DZoomer::ResetZoomBase() {
|
||||
SetZoomBase(x0, y0, x1 - x0,
|
||||
y1 - y0); // for going between log and nonlog plots
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::SetZoomBase(double xmin, double ymin, double x_width,
|
||||
double y_width) {
|
||||
if (xIsLog && xmin <= 0) {
|
||||
double xmax = xmin + x_width;
|
||||
xmin = firstXgt0 * 0.98;
|
||||
if (xmax <= xmin)
|
||||
x_width = firstXgt0;
|
||||
else
|
||||
x_width = xmax - xmin;
|
||||
}
|
||||
if (yIsLog && ymin <= 0) {
|
||||
double ymax = ymin + y_width;
|
||||
ymin = firstYgt0 * 0.98;
|
||||
if (ymax <= ymin)
|
||||
y_width = firstYgt0;
|
||||
else
|
||||
y_width = ymax - ymin;
|
||||
}
|
||||
|
||||
if (plot()) {
|
||||
if (xIsLog) {
|
||||
double xmin_curr =
|
||||
plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
|
||||
double xmax_curr =
|
||||
plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
|
||||
if (xmin_curr < xmin)
|
||||
xmin_curr = xmin;
|
||||
if (xmax_curr > xmin + x_width)
|
||||
xmax_curr = xmin + x_width;
|
||||
plot()->setAxisScale(QwtPlot::xBottom, xmin_curr, xmax_curr);
|
||||
}
|
||||
if (yIsLog) {
|
||||
double ymin_curr =
|
||||
plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
|
||||
double ymax_curr =
|
||||
plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
|
||||
if (ymin_curr < ymin)
|
||||
ymin_curr = ymin;
|
||||
if (ymax_curr > ymin + y_width)
|
||||
ymax_curr = ymin + y_width;
|
||||
plot()->setAxisScale(QwtPlot::yLeft, ymin_curr, ymax_curr);
|
||||
}
|
||||
plot()->replot();
|
||||
}
|
||||
setZoomBase(QRectF(xmin, ymin, x_width, y_width));
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::SetZoomBase(SlsQtH1D *h) {
|
||||
x0 = h->GetXMin() < 0 ? h->GetXMin() * 1.02 : h->GetXMin() / 1.02;
|
||||
x1 = h->GetXMax() < 0 ? h->GetXMax() / 1.02 : h->GetXMax() * 1.02;
|
||||
y0 = h->GetYMin() < 0 ? h->GetYMin() * 1.02 : h->GetYMin() / 1.02;
|
||||
y1 = h->GetYMax() < 0 ? h->GetYMax() / 1.02 : h->GetYMax() * 1.02;
|
||||
|
||||
firstXgt0 = h->GetFirstXgtZero(); // for log plots
|
||||
firstYgt0 = h->GetFirstYgtZero(); // for log plots
|
||||
|
||||
ResetZoomBase();
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D *h) {
|
||||
double h_x0 = h->GetXMin() < 0 ? h->GetXMin() * 1.02 : h->GetXMin() / 1.02;
|
||||
double h_x1 = h->GetXMax() < 0 ? h->GetXMax() / 1.02 : h->GetXMax() * 1.02;
|
||||
double h_y0 = h->GetYMin() < 0 ? h->GetYMin() * 1.02 : h->GetYMin() / 1.02;
|
||||
double h_y1 = h->GetYMax() < 0 ? h->GetYMax() / 1.02 : h->GetYMax() * 1.02;
|
||||
|
||||
if (h_x0 < x0)
|
||||
x0 = h_x0;
|
||||
if (h_x1 > x1)
|
||||
x1 = h_x1;
|
||||
if (h_y0 < y0)
|
||||
y0 = h_y0;
|
||||
if (h_y1 > y1)
|
||||
y1 = h_y1;
|
||||
|
||||
if (h->GetFirstXgtZero() < firstXgt0)
|
||||
firstXgt0 = h->GetFirstXgtZero();
|
||||
if (h->GetFirstYgtZero() < firstYgt0)
|
||||
firstYgt0 = h->GetFirstYgtZero();
|
||||
|
||||
ResetZoomBase();
|
||||
}
|
106
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx
Executable file
106
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx
Executable file
@ -0,0 +1,106 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_scale_div.h>
|
||||
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt1DZoomer.h"
|
||||
|
||||
|
||||
void SlsQt1DZoomer::ResetZoomBase(){
|
||||
SetZoomBase(x0,y0,x1-x0,y1-y0); //for going between log and nonlog plots
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y_width){
|
||||
if(xIsLog&&xmin<=0){
|
||||
double xmax = xmin+x_width;
|
||||
xmin = firstXgt0*0.98;
|
||||
if(xmax<=xmin) x_width=firstXgt0;
|
||||
else x_width=xmax-xmin;
|
||||
}
|
||||
if(yIsLog&&ymin<=0){
|
||||
double ymax = ymin+y_width;
|
||||
ymin = firstYgt0*0.98;
|
||||
if(ymax<=ymin) y_width=firstYgt0;
|
||||
else y_width=ymax-ymin;
|
||||
}
|
||||
|
||||
if(plot()){
|
||||
if(xIsLog){
|
||||
#if QWT_VERSION < 0x50200
|
||||
double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound();
|
||||
double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound();
|
||||
#elif QWT_VERSION < 0x060100
|
||||
double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound();
|
||||
double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound();
|
||||
#else
|
||||
double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
|
||||
double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
|
||||
#endif
|
||||
if(xmin_curr<xmin) xmin_curr=xmin;
|
||||
if(xmax_curr>xmin+x_width) xmax_curr=xmin+x_width;
|
||||
plot()->setAxisScale(QwtPlot::xBottom,xmin_curr,xmax_curr);
|
||||
}
|
||||
if(yIsLog){
|
||||
#if QWT_VERSION < 0x50200
|
||||
double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound();
|
||||
double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound();
|
||||
#elif QWT_VERSION < 0x060100
|
||||
double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound();
|
||||
double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound();
|
||||
#else
|
||||
double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
|
||||
double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
|
||||
#endif
|
||||
if(ymin_curr<ymin) ymin_curr=ymin;
|
||||
if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width;
|
||||
plot()->setAxisScale(QwtPlot::yLeft,ymin_curr,ymax_curr);
|
||||
}
|
||||
plot()->replot();
|
||||
}
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
setZoomBase(QwtDoubleRect(xmin,ymin,x_width,y_width));
|
||||
#else
|
||||
setZoomBase(QRectF(xmin,ymin,x_width,y_width));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::SetZoomBase(SlsQtH1D* h){
|
||||
x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02;
|
||||
x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02;
|
||||
y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02;
|
||||
y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02;
|
||||
|
||||
firstXgt0 = h->GetFirstXgtZero(); //for log plots
|
||||
firstYgt0 = h->GetFirstYgtZero(); //for log plots
|
||||
|
||||
ResetZoomBase();
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D* h){
|
||||
double h_x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02;
|
||||
double h_x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02;
|
||||
double h_y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02;
|
||||
double h_y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02;
|
||||
|
||||
if(h_x0<x0) x0 = h_x0;
|
||||
if(h_x1>x1) x1 = h_x1;
|
||||
if(h_y0<y0) y0 = h_y0;
|
||||
if(h_y1>y1) y1 = h_y1;
|
||||
|
||||
if(h->GetFirstXgtZero()<firstXgt0) firstXgt0 = h->GetFirstXgtZero();
|
||||
if(h->GetFirstYgtZero()<firstYgt0) firstYgt0 = h->GetFirstYgtZero();
|
||||
|
||||
ResetZoomBase();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,143 +0,0 @@
|
||||
/* TODO! short description */
|
||||
#include "SlsQt2DHist.h"
|
||||
#include "ansi.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy,
|
||||
double ymin, double ymax, double *d, double zmin,
|
||||
double zmax)
|
||||
: QwtRasterData() {
|
||||
x_min = 0;
|
||||
x_max = 0;
|
||||
y_min = 0;
|
||||
y_max = 0;
|
||||
interp = 0;
|
||||
nx_array = ny_array = 0;
|
||||
data = nullptr;
|
||||
SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d, zmin, zmax);
|
||||
}
|
||||
|
||||
SlsQt2DHist::~SlsQt2DHist() { delete[] data; }
|
||||
|
||||
int SlsQt2DHist::GetBinIndex(int bx, int by) {
|
||||
int b = bx * ny + by;
|
||||
if (b < 0 || b >= nb) {
|
||||
cout << "GetBinIndex:: Incorrect indicies bx and by returning overflow "
|
||||
"bin;"
|
||||
<< endl;
|
||||
return nb;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
int SlsQt2DHist::FindBinIndex(double x, double y) {
|
||||
return GetBinIndex(int((x - x_min) / x_width), int((y - y_min) / y_width));
|
||||
}
|
||||
|
||||
double SlsQt2DHist::GetBinValue(int bx, int by) {
|
||||
return data[GetBinIndex(bx, by)];
|
||||
}
|
||||
|
||||
void SlsQt2DHist::SetBinValue(int bx, int by, double v) {
|
||||
z_mean_has_been_calculated = 0;
|
||||
data[GetBinIndex(bx, by)] = v;
|
||||
}
|
||||
|
||||
void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,
|
||||
double ymin, double ymax, double *d, double zmin,
|
||||
double zmax) {
|
||||
z_mean_has_been_calculated = 0;
|
||||
if (xmax < xmin || ymax < ymin)
|
||||
cout << "Warning input range invalid." << endl;
|
||||
|
||||
x_width = (xmax - xmin) / nbinsx;
|
||||
y_width = (ymax - ymin) / nbinsy;
|
||||
|
||||
if (x_min != xmin || x_max != xmax || y_min != ymin || y_max != ymax) {
|
||||
x_min = xmin;
|
||||
x_max = xmax;
|
||||
y_min = ymin;
|
||||
y_max = ymax;
|
||||
setInterval(Qt::XAxis, QwtInterval(xmin, xmax));
|
||||
setInterval(Qt::YAxis, QwtInterval(ymin, ymax));
|
||||
}
|
||||
|
||||
if (nbinsx * nbinsy < 1) {
|
||||
cout << "Exitting: SlsQt2DHist::SetData() number of bins must be "
|
||||
"greater than zero."
|
||||
<< endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (nbinsx * nbinsy > nx_array * ny_array) {
|
||||
delete[] data;
|
||||
data = new double[nbinsx * nbinsy + 1]; // one for under/overflow bin
|
||||
nx_array = nbinsx;
|
||||
ny_array = nbinsy;
|
||||
}
|
||||
nx = nbinsx;
|
||||
ny = nbinsy;
|
||||
nb = nx * ny;
|
||||
data[nb] = 0; // set over flow to zero
|
||||
if (d) {
|
||||
memcpy(data, d, nb * sizeof(double));
|
||||
SetMinMax(zmin, zmax);
|
||||
}
|
||||
}
|
||||
|
||||
void SlsQt2DHist::SetMinMax(double zmin, double zmax) {
|
||||
/* if(zmin<zmax){ edited out to test*/
|
||||
if (zmax != -1) {
|
||||
z_min = zmin;
|
||||
z_max = zmax;
|
||||
} else {
|
||||
z_mean_has_been_calculated = 1;
|
||||
z_min = data[0];
|
||||
z_mean = 0;
|
||||
z_max = data[0];
|
||||
for (int i = 0; i < nb; i++) {
|
||||
if (data[i] < z_min)
|
||||
z_min = data[i];
|
||||
if (data[i] > z_max)
|
||||
z_max = data[i];
|
||||
z_mean += data[i];
|
||||
}
|
||||
z_mean /= nb;
|
||||
if (z_min > 0)
|
||||
z_min /= 1.02;
|
||||
else
|
||||
z_min *= 1.02;
|
||||
if (z_max > 0)
|
||||
z_max *= 1.02;
|
||||
else
|
||||
z_max /= 1.02;
|
||||
}
|
||||
setInterval(Qt::ZAxis, QwtInterval(z_min, z_max));
|
||||
}
|
||||
|
||||
double SlsQt2DHist::GetMean() {
|
||||
if (!z_mean_has_been_calculated) {
|
||||
z_mean_has_been_calculated = 1;
|
||||
z_mean = 0;
|
||||
for (int i = 0; i < nb; i++)
|
||||
z_mean += data[i];
|
||||
z_mean /= nb;
|
||||
}
|
||||
|
||||
return z_mean;
|
||||
}
|
||||
|
||||
double SlsQt2DHist::SetMinimumToFirstGreaterThanZero() {
|
||||
z_min = fabs(z_max) + 1;
|
||||
for (int i = 0; i < nb; i++) {
|
||||
if (data[i] > 0 && data[i] < z_min)
|
||||
z_min = data[i];
|
||||
}
|
||||
setInterval(Qt::ZAxis, QwtInterval(z_min, z_max));
|
||||
|
||||
return z_min;
|
||||
}
|
144
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx
Executable file
144
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx
Executable file
@ -0,0 +1,144 @@
|
||||
|
||||
/**
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "ansi.h"
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "SlsQt2DHist.h"
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double* d,double zmin,double zmax):QwtRasterData(){
|
||||
x_min=0;x_max=0;y_min=0;y_max=0;
|
||||
interp=0;
|
||||
nx_array=ny_array=0;data=0;
|
||||
SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax);
|
||||
}
|
||||
|
||||
|
||||
SlsQt2DHist::~SlsQt2DHist(){if(data) delete [] data;}
|
||||
|
||||
int SlsQt2DHist::GetBinIndex(int bx, int by){
|
||||
int b = bx*ny+by;
|
||||
if(b<0 || b>=nb){
|
||||
cout<<"GetBinIndex:: Incorrect indicies bx and by returning overflow bin;"<<endl;
|
||||
return nb;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
int SlsQt2DHist::FindBinIndex(double x, double y){
|
||||
return GetBinIndex(int((x-x_min)/x_width),int((y-y_min)/y_width));
|
||||
}
|
||||
|
||||
double SlsQt2DHist::GetBinValue(int bx,int by){
|
||||
return data[GetBinIndex(bx,by)];
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DHist::SetBinValue(int bx,int by,double v){
|
||||
z_mean_has_been_calculated = 0;
|
||||
data[GetBinIndex(bx,by)] = v;
|
||||
}
|
||||
|
||||
void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax, double *d,double zmin,double zmax){
|
||||
z_mean_has_been_calculated = 0;
|
||||
if(xmax<xmin||ymax<ymin) cout<<"Warning input range invalid."<<endl;
|
||||
|
||||
x_width = (xmax - xmin)/nbinsx;
|
||||
y_width = (ymax - ymin)/nbinsy;
|
||||
|
||||
if(x_min!=xmin||x_max!=xmax||y_min!=ymin||y_max!=ymax){
|
||||
x_min=xmin;x_max=xmax;
|
||||
y_min=ymin;y_max=ymax;
|
||||
|
||||
#if QWT_VERSION<0x060000
|
||||
setBoundingRect(QRectF(xmin,ymin,x_max-x_min,y_max-y_min));
|
||||
#else
|
||||
setInterval( Qt::XAxis,QwtInterval(xmin,xmax));
|
||||
setInterval( Qt::YAxis,QwtInterval(ymin,ymax));
|
||||
// setInterval( Qt::ZAxis,QwtInterval(zmin,zmax));
|
||||
//setInterval( Qt::ZAxis,QwtInterval(0.,1.));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if(nbinsx*nbinsy<1){
|
||||
cout<<"Exitting: SlsQt2DHist::SetData() number of bins must be greater than zero."<<endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(nbinsx*nbinsy>nx_array*ny_array){
|
||||
if(data) delete [] data;
|
||||
data = new double [nbinsx*nbinsy+1]; //one for under/overflow bin
|
||||
nx_array = nbinsx;
|
||||
ny_array = nbinsy;
|
||||
}
|
||||
nx=nbinsx;
|
||||
ny=nbinsy;
|
||||
nb=nx*ny;
|
||||
data[nb]=0;//set over flow to zero
|
||||
if(d){
|
||||
memcpy(data,d,nb*sizeof(double));
|
||||
SetMinMax(zmin,zmax);
|
||||
}
|
||||
}
|
||||
|
||||
void SlsQt2DHist::SetMinMax(double zmin,double zmax){
|
||||
/* if(zmin<zmax){ edited out to test*/
|
||||
if(zmax != -1){
|
||||
z_min=zmin;
|
||||
z_max=zmax;
|
||||
}else{
|
||||
z_mean_has_been_calculated = 1;
|
||||
z_min=data[0];
|
||||
z_mean=0;
|
||||
z_max=data[0];
|
||||
for(int i=0;i<nb;i++){
|
||||
if(data[i]<z_min) z_min=data[i];
|
||||
if(data[i]>z_max) z_max=data[i];
|
||||
z_mean+=data[i];
|
||||
}
|
||||
z_mean/=nb;
|
||||
if(z_min>0) z_min/=1.02; else z_min*=1.02;
|
||||
if(z_max>0) z_max*=1.02; else z_max/=1.02;
|
||||
}
|
||||
#if QWT_VERSION<0x060000
|
||||
;
|
||||
#else
|
||||
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
double SlsQt2DHist::GetMean(){
|
||||
if(!z_mean_has_been_calculated){
|
||||
z_mean_has_been_calculated = 1;
|
||||
z_mean=0;
|
||||
for(int i=0;i<nb;i++) z_mean+=data[i];
|
||||
z_mean/=nb;
|
||||
}
|
||||
|
||||
return z_mean;
|
||||
}
|
||||
|
||||
double SlsQt2DHist::SetMinimumToFirstGreaterThanZero(){
|
||||
z_min=fabs(z_max)+1;
|
||||
for(int i=0;i<nb;i++){
|
||||
if(data[i]>0 && data[i]<z_min) z_min=data[i];
|
||||
}
|
||||
#if QWT_VERSION<0x060000
|
||||
;
|
||||
#else
|
||||
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
||||
#endif
|
||||
|
||||
return z_min;
|
||||
}
|
||||
|
||||
|
||||
|
270
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cpp → slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx
Normal file → Executable file
270
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cpp → slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx
Normal file → Executable file
@ -1,9 +1,15 @@
|
||||
#include "SlsQt2DPlot.h"
|
||||
#include "ansi.h"
|
||||
|
||||
#include "ansi.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <qlist.h>
|
||||
#include <qprinter.h>
|
||||
#include <qtoolbutton.h>
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
#include <qprintdialog.h>
|
||||
#endif
|
||||
#include <qwt_color_map.h>
|
||||
#include <qwt_plot_layout.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
@ -13,73 +19,115 @@
|
||||
#include <qwt_scale_engine.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#if QWT_VERSION >= 0x060100
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||
#endif
|
||||
|
||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
isLog = 0;
|
||||
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
axisScaleEngine(QwtPlot::xBottom)->setAttribute(QwtScaleEngine::Floating);
|
||||
|
||||
d_spectrogram = new QwtPlotSpectrogram();
|
||||
|
||||
hist = new SlsQt2DHist();
|
||||
SetupZoom();
|
||||
SetupColorMap();
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setData(*hist);
|
||||
#else
|
||||
d_spectrogram->setData(hist);
|
||||
#endif
|
||||
|
||||
d_spectrogram->attach(this);
|
||||
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
|
||||
FillTestPlot();
|
||||
Update();
|
||||
}
|
||||
|
||||
SlsQt2DPlot::~SlsQt2DPlot() = default;
|
||||
|
||||
void SlsQt2DPlot::SetTitle(QString title) { setTitle(title); }
|
||||
void SlsQt2DPlot::SetTitle(QString title) {
|
||||
setTitle(title);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetXTitle(QString title) {
|
||||
setAxisTitle(QwtPlot::xBottom, title);
|
||||
setAxisTitle(QwtPlot::xBottom, title);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetYTitle(QString title) {
|
||||
setAxisTitle(QwtPlot::yLeft, title);
|
||||
setAxisTitle(QwtPlot::yLeft, title);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetZTitle(QString title) {
|
||||
setAxisTitle(QwtPlot::yRight, title);
|
||||
setAxisTitle(QwtPlot::yRight, title);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetTitleFont(const QFont &f) {
|
||||
void SlsQt2DPlot::SetTitleFont(const QFont& f) {
|
||||
QwtText t("");
|
||||
t.setFont(f);
|
||||
t.setRenderFlags(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
t.setRenderFlags( Qt::AlignLeft | Qt::AlignVCenter);
|
||||
setTitle(t);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetXFont(const QFont &f) {
|
||||
void SlsQt2DPlot::SetXFont(const QFont& f) {
|
||||
QwtText t("");
|
||||
t.setFont(f);
|
||||
setAxisTitle(QwtPlot::xBottom, t);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetYFont(const QFont &f) {
|
||||
void SlsQt2DPlot::SetYFont(const QFont& f) {
|
||||
QwtText t("");
|
||||
t.setFont(f);
|
||||
setAxisTitle(QwtPlot::yLeft, t);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetZFont(const QFont &f) {
|
||||
void SlsQt2DPlot::SetZFont(const QFont& f) {
|
||||
QwtText t("");
|
||||
t.setFont(f);
|
||||
setAxisTitle(QwtPlot::yRight, t);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetupColorMap() {
|
||||
d_spectrogram->setColorMap(myColourMap(0));
|
||||
|
||||
colorMapLinearScale = myColourMap(0);
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(colorMapLinearScale);
|
||||
#endif
|
||||
|
||||
colorMapLogScale = myColourMap(1);
|
||||
#if QWT_VERSION < 0x060000
|
||||
contourLevelsLinear = new QwtValueList();
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(*contourLevelsLinear) += level;
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
#else
|
||||
;
|
||||
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(contourLevelsLinear) += level;
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
|
||||
//
|
||||
#if QWT_VERSION < 0x060000
|
||||
contourLevelsLog = new QwtValueList();
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(*contourLevelsLog) += (pow(10, 2 * level / 10.0) - 1) / 99.0 * 10;
|
||||
|
||||
#else
|
||||
;
|
||||
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(contourLevelsLog) += (pow(10, 2 * level / 10.0) - 1) / 99.0 * 10;
|
||||
#endif
|
||||
|
||||
// A color bar on the right axis
|
||||
rightAxis = axisWidget(QwtPlot::yRight);
|
||||
@ -92,15 +140,14 @@ void SlsQt2DPlot::SetupColorMap() {
|
||||
void SlsQt2DPlot::FillTestPlot(int mode) {
|
||||
static int nx = 50;
|
||||
static int ny = 50;
|
||||
static double *the_data = nullptr;
|
||||
if (the_data == nullptr)
|
||||
static double *the_data = 0;
|
||||
if (the_data == 0)
|
||||
the_data = new double[nx * ny];
|
||||
|
||||
double dmax = sqrt(pow(nx / 2.0 - 0.5, 2) + pow(ny / 2.0 - 0.5, 2));
|
||||
for (int i = 0; i < nx; i++) {
|
||||
for (int j = 0; j < ny; j++) {
|
||||
double d = sqrt(pow(nx / 2.0 - (i + 0.5), 2) +
|
||||
pow(ny / 2.0 - (j + 0.5), 2));
|
||||
double d = sqrt(pow(nx / 2.0 - (i + 0.5), 2) + pow(ny / 2.0 - (j + 0.5), 2));
|
||||
|
||||
if (mode % 3)
|
||||
the_data[i + j * nx] = 10 * d / dmax;
|
||||
@ -120,9 +167,14 @@ void SlsQt2DPlot::SetupZoom() {
|
||||
|
||||
zoomer = new SlsQt2DZoomer(canvas());
|
||||
zoomer->SetHist(hist);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||
Qt::ControlModifier);
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
|
||||
panner = new QwtPlotPanner(canvas());
|
||||
panner->setAxisEnabled(QwtPlot::yRight, false);
|
||||
panner->setMouseButton(Qt::MidButton);
|
||||
@ -139,25 +191,37 @@ void SlsQt2DPlot::SetupZoom() {
|
||||
zoomer->setTrackerPen(c);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::UnZoom(bool replot) {
|
||||
/*void SlsQt2DPlot::CompletelyUnZoom(){
|
||||
setAxisScale(QwtPlot::xBottom,hist->GetXMin(),hist->GetXMin()+(hist->GetXMax()-hist->GetXMin()));
|
||||
setAxisScale(QwtPlot::yLeft,hist->GetYMin(),hist->GetYMin()+(hist->GetYMax()-hist->GetYMin()));
|
||||
zoomer->setZoomBase();
|
||||
//replot();
|
||||
}*/
|
||||
|
||||
zoomer->setZoomBase(QRectF(hist->GetXMin(), hist->GetYMin(),
|
||||
hist->GetXMax() - hist->GetXMin(),
|
||||
hist->GetYMax() - hist->GetYMin()));
|
||||
zoomer->setZoomBase(replot); // Call replot for the attached plot before
|
||||
// initializing the zoomer with its scales.
|
||||
void SlsQt2DPlot::UnZoom(bool replot) {
|
||||
#if QWT_VERSION < 0x060000
|
||||
zoomer->setZoomBase(QwtDoubleRect(hist->GetXMin(), hist->GetYMin(), hist->GetXMax() - hist->GetXMin(), hist->GetYMax() - hist->GetYMin()));
|
||||
#else
|
||||
zoomer->setZoomBase(QRectF(hist->GetXMin(), hist->GetYMin(), hist->GetXMax() - hist->GetXMin(), hist->GetYMax() - hist->GetYMin()));
|
||||
#endif
|
||||
zoomer->setZoomBase(replot); //Call replot for the attached plot before initializing the zoomer with its scales.
|
||||
// zoomer->zoom(0);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetZoom(double xmin, double ymin, double x_width,
|
||||
double y_width) {
|
||||
void SlsQt2DPlot::SetZoom(double xmin, double ymin, double x_width, double y_width) {
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
zoomer->setZoomBase(QwtDoubleRect(xmin, ymin, x_width, y_width));
|
||||
|
||||
#else
|
||||
zoomer->setZoomBase(QRectF(xmin, ymin, x_width, y_width));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::DisableZoom(bool disable) {
|
||||
if (disableZoom != disable) {
|
||||
disableZoom = disable;
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
if (disable)
|
||||
std::cout << "Disabling zoom\n";
|
||||
@ -166,23 +230,25 @@ void SlsQt2DPlot::DisableZoom(bool disable) {
|
||||
#endif
|
||||
if (disable) {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||
Qt::NoButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::NoButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||
Qt::NoButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::NoButton);
|
||||
} else {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||
Qt::LeftButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||
Qt::RightButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::MidButton);
|
||||
@ -190,6 +256,7 @@ void SlsQt2DPlot::DisableZoom(bool disable) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlot::SetZMinMax(double zmin, double zmax) {
|
||||
hist->SetMinMax(zmin, zmax);
|
||||
}
|
||||
@ -202,40 +269,63 @@ QwtLinearColorMap *SlsQt2DPlot::myColourMap(QVector<double> colourStops) {
|
||||
double g[] = {0.00, 0.81, 1.00, 0.20, 0.00};
|
||||
double b[] = {0.51, 1.00, 0.12, 0.00, 0.00};
|
||||
|
||||
// QColor c1, c2, c;
|
||||
QColor c2, c;
|
||||
QColor c1, c2, c;
|
||||
c1.setRgbF(r[0], g[0], b[0], 0);
|
||||
c2.setRgbF(r[ns - 1], g[ns - 1], b[ns - 1]);
|
||||
QwtLinearColorMap *copyMap = new QwtLinearColorMap(Qt::lightGray, c2);
|
||||
|
||||
for (int is = 0; is < ns - 1; is++) {
|
||||
c.setRgbF(r[is], g[is], b[is]);
|
||||
copyMap->addColorStop(colourStops[is], c);
|
||||
copyMap->addColorStop(colourStops.value(is), c);
|
||||
}
|
||||
|
||||
return copyMap;
|
||||
}
|
||||
|
||||
QwtLinearColorMap *SlsQt2DPlot::myColourMap(int log) {
|
||||
QVector<double> cs{0.0, 0.34, 0.61 ,0.84, 1.0};
|
||||
|
||||
int ns = 5;
|
||||
|
||||
QVector<double> cs1(0);
|
||||
QVector<double> lcs1(0);
|
||||
|
||||
cs1.append(0.);
|
||||
cs1.append(0.34);
|
||||
cs1.append(0.61);
|
||||
cs1.append(0.84);
|
||||
cs1.append(1.);
|
||||
if (log) {
|
||||
for (int i = 0; i < cs.size(); ++i)
|
||||
cs[i] = (pow(10, 2 * cs[i]) - 1) / 99.0;
|
||||
for (int is = 0; is < ns; is++) {
|
||||
lcs1.append((pow(10, 2 * cs1.value(is)) - 1) / 99.0);
|
||||
}
|
||||
return myColourMap(lcs1);
|
||||
}
|
||||
return myColourMap(cs);
|
||||
|
||||
return myColourMap(cs1);
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlot::Update() {
|
||||
#if QWT_VERSION < 0x060000
|
||||
rightAxis->setColorMap(d_spectrogram->data().range(), d_spectrogram->colorMap());
|
||||
#else
|
||||
if (isLog)
|
||||
hist->SetMinimumToFirstGreaterThanZero();
|
||||
const QwtInterval zInterval = d_spectrogram->data()->interval(Qt::ZAxis);
|
||||
rightAxis->setColorMap(zInterval, myColourMap(isLog));
|
||||
|
||||
const QwtInterval zInterval = d_spectrogram->data()->interval(Qt::ZAxis);
|
||||
|
||||
rightAxis->setColorMap(zInterval, myColourMap(isLog));
|
||||
#endif
|
||||
if (!zoomer->zoomRectIndex())
|
||||
UnZoom();
|
||||
#if QWT_VERSION < 0x060000
|
||||
setAxisScale(QwtPlot::yRight, d_spectrogram->data().range().minValue(),
|
||||
d_spectrogram->data().range().maxValue());
|
||||
#else
|
||||
//cprintf(MAGENTA, "zmin:%f zmax:%f\n", zInterval.minValue(), zInterval.maxValue());
|
||||
setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue());
|
||||
plotLayout()->setAlignCanvasToScales(true);
|
||||
#endif
|
||||
replot();
|
||||
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetInterpolate(bool enable) {
|
||||
@ -248,44 +338,86 @@ void SlsQt2DPlot::SetContour(bool enable) {
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetLogz(bool enable, bool isMin, bool isMax, double min,
|
||||
double max) {
|
||||
LogZ(enable);
|
||||
SetZRange(isMin, isMax, min, max);
|
||||
void SlsQt2DPlot::SetLogz(bool enable, bool isMin, bool isMax, double min, double max) {
|
||||
LogZ(enable);
|
||||
SetZRange(isMin, isMax, min, max);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetZRange(bool isMin, bool isMax, double min, double max) {
|
||||
if (isLog) {
|
||||
SetZMinimumToFirstGreaterThanZero();
|
||||
}
|
||||
void SlsQt2DPlot::SetZRange(bool isMin, bool isMax, double min, double max){
|
||||
if(isLog) {
|
||||
SetZMinimumToFirstGreaterThanZero();
|
||||
}
|
||||
|
||||
// set zmin and zmax
|
||||
if (isMin || isMax) {
|
||||
double zmin = (isMin ? min : GetZMinimum());
|
||||
double zmax = (isMax ? max : GetZMaximum());
|
||||
SetZMinMax(zmin, zmax);
|
||||
}
|
||||
// set zmin and zmax
|
||||
if (isMin || isMax) {
|
||||
double zmin = (isMin ? min : GetZMinimum());
|
||||
double zmax = (isMax ? max : GetZMaximum());
|
||||
SetZMinMax(zmin, zmax);
|
||||
}
|
||||
|
||||
Update();
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::LogZ(bool on) {
|
||||
if (on) {
|
||||
isLog = 1;
|
||||
//if(hist->GetMinimum()<=0) hist->SetMinimumToFirstGreaterThanZero();
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLogScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(myColourMap(isLog));
|
||||
setAxisScaleEngine(QwtPlot::yRight, new QwtLogScaleEngine);
|
||||
#endif
|
||||
setAxisScaleEngine(QwtPlot::yRight, new QwtLog10ScaleEngine);
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLog);
|
||||
#else
|
||||
d_spectrogram->setContourLevels(contourLevelsLog);
|
||||
#endif
|
||||
} else {
|
||||
isLog = 0;
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
#else
|
||||
d_spectrogram->setColorMap(myColourMap(isLog));
|
||||
#endif
|
||||
|
||||
setAxisScaleEngine(QwtPlot::yRight, new QwtLinearScaleEngine);
|
||||
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setContourLevels(*contourLevelsLinear);
|
||||
#else
|
||||
d_spectrogram->setContourLevels(contourLevelsLinear);
|
||||
#endif
|
||||
}
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::showSpectrogram(bool on) {
|
||||
// static int io=0;
|
||||
// FillTestPlot(io++);
|
||||
d_spectrogram->setDisplayMode(QwtPlotSpectrogram::ImageMode, on);
|
||||
d_spectrogram->setDefaultContourPen(on ? QPen() : QPen(Qt::NoPen));
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void SlsQt2DPlot::printPlot(){
|
||||
QPrinter printer;
|
||||
printer.setOrientation(QPrinter::Landscape);
|
||||
#if QT_VERSION < 0x040000
|
||||
printer.setColorMode(QPrinter::Color);
|
||||
printer.setOutputFileName("spectrogram.ps");
|
||||
if (printer.setup())
|
||||
#else
|
||||
printer.setOutputFileName("spectrogram.pdf");
|
||||
QPrintDialog dialog(&printer);
|
||||
if ( dialog.exec() )
|
||||
#endif
|
||||
{
|
||||
print(printer);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
108
slsDetectorGui/src/qCloneWidget.cpp
Normal file → Executable file
108
slsDetectorGui/src/qCloneWidget.cpp
Normal file → Executable file
@ -1,7 +1,7 @@
|
||||
#include "qCloneWidget.h"
|
||||
#include "qDefs.h"
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt2DPlot.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QFileDialog>
|
||||
@ -11,75 +11,53 @@
|
||||
|
||||
int qCloneWidget::NumClones{0};
|
||||
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
|
||||
SlsQt1DPlot *gp1, SlsQt2DPlot *gp, QString title,
|
||||
QString fPath, QString fName, int64_t aIndex,
|
||||
bool displayStats, QString min, QString max,
|
||||
QString sum)
|
||||
: QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot1d(gp1),
|
||||
gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||
setupUi(this);
|
||||
id = qCloneWidget::NumClones++;
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt2DPlot* gp,
|
||||
QString title, QString fPath, QString fName, int64_t aIndex,
|
||||
bool displayStats, QString min, QString max, QString sum):
|
||||
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||
setupUi(this);
|
||||
id = qCloneWidget::NumClones++;
|
||||
SetupWidgetWindow(title);
|
||||
DisplayStats(displayStats, min, max, sum);
|
||||
}
|
||||
|
||||
qCloneWidget::~qCloneWidget() {
|
||||
|
||||
delete plot1d;
|
||||
delete plot2d;
|
||||
delete gainplot1d;
|
||||
delete gainplot2d;
|
||||
if (plot1d)
|
||||
delete plot1d;
|
||||
if (plot2d)
|
||||
delete plot2d;
|
||||
if (gainplot2d)
|
||||
delete gainplot2d;
|
||||
}
|
||||
|
||||
void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||
|
||||
std::string winTitle = std::string("Snapshot:") + std::to_string(id) +
|
||||
std::string(" - ") + sls::Logger::Timestamp();
|
||||
std::string winTitle = std::string("Snapshot:") + std::to_string(id) + std::string(" - ") + NowTime();
|
||||
setWindowTitle(QString(winTitle.c_str()));
|
||||
|
||||
|
||||
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
boxPlot->setTitle(title);
|
||||
|
||||
|
||||
// 1d
|
||||
if (plot1d != nullptr) {
|
||||
if (gainplot1d == nullptr) {
|
||||
plotLayout->addWidget(plot1d);
|
||||
} else {
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop);
|
||||
}
|
||||
}
|
||||
plotLayout->addWidget(plot1d);
|
||||
}
|
||||
// 2d
|
||||
else {
|
||||
if (gainplot2d == nullptr) {
|
||||
plotLayout->addWidget(plot2d);
|
||||
} else {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1,
|
||||
Qt::AlignRight | Qt::AlignTop);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
}
|
||||
connect(actionSaveClone, SIGNAL(triggered()), this, SLOT(SavePlot()));
|
||||
this->show();
|
||||
if (gainplot1d != nullptr) {
|
||||
gainplot1d->setMinimumHeight(qDefs::MIN_HEIGHT_GAIN_PLOT_1D);
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
// gainplot1d->setFixedHeight(plot1d->height() /
|
||||
// qDefs::DATA_GAIN_PLOT_RATIO - 1);
|
||||
}
|
||||
if (gainplot2d != nullptr) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
}
|
||||
|
||||
void qCloneWidget::DisplayStats(bool enable, QString min, QString max,
|
||||
QString sum) {
|
||||
void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString sum) {
|
||||
if (enable) {
|
||||
lblMinDisp->setText(QString("%1").arg(min));
|
||||
lblMaxDisp->setText(QString("%1").arg(max));
|
||||
@ -93,48 +71,30 @@ void qCloneWidget::DisplayStats(bool enable, QString min, QString max,
|
||||
void qCloneWidget::SavePlot() {
|
||||
char cID[10];
|
||||
sprintf(cID, "%d", id);
|
||||
// title
|
||||
QString fName = filePath + QString('/') + fileName + QString("_clone") +
|
||||
QString("%1").arg(id) + QString("_acq") +
|
||||
QString("%1").arg(acqIndex) + QString(".png");
|
||||
LOG(logINFO) << "Saving Clone:" << fName.toAscii().constData();
|
||||
// save
|
||||
QImage img(centralwidget->size().width(), centralwidget->size().height(),
|
||||
QImage::Format_RGB32);
|
||||
//title
|
||||
QString fName = filePath + QString('/') + fileName + QString("_clone") + QString("%1").arg(id) + QString("_acq") + QString("%1").arg(acqIndex) + QString(".png");
|
||||
FILE_LOG(logINFO) << "Saving Clone:" << fName.toAscii().constData();
|
||||
//save
|
||||
QImage img(centralwidget->size().width(), centralwidget->size().height(), QImage::Format_RGB32);
|
||||
QPainter painter(&img);
|
||||
centralwidget->render(&painter);
|
||||
|
||||
fName = QFileDialog::getSaveFileName(
|
||||
this, tr("Save Snapshot "), fName,
|
||||
tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), nullptr,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
fName = QFileDialog::getSaveFileName(this, tr("Save Snapshot "), fName, tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), 0, QFileDialog::ShowDirsOnly);
|
||||
if (!fName.isEmpty()) {
|
||||
if ((img.save(fName))) {
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The SnapShot has been successfully saved",
|
||||
"qCloneWidget::SavePlot");
|
||||
LOG(logINFO) << "The SnapShot has been successfully saved";
|
||||
qDefs::Message(qDefs::INFORMATION, "The SnapShot has been successfully saved", "qCloneWidget::SavePlot");
|
||||
FILE_LOG(logINFO) << "The SnapShot has been successfully saved";
|
||||
} else {
|
||||
qDefs::Message(
|
||||
qDefs::WARNING,
|
||||
"Attempt to save snapshot failed.\n Formats: .png, .jpg, .xpm.",
|
||||
"qCloneWidget::SavePlot");
|
||||
LOG(logWARNING) << "Attempt to save snapshot failed";
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save snapshot failed.\n Formats: .png, .jpg, .xpm.", "qCloneWidget::SavePlot");
|
||||
FILE_LOG(logWARNING) << "Attempt to save snapshot failed";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
||||
if (gainplot1d != nullptr) {
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
gainplot1d->setFixedHeight(plot1d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
if (gainplot2d != nullptr) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
event->accept();
|
||||
}
|
117
slsDetectorGui/src/qDacWidget.cpp
Normal file → Executable file
117
slsDetectorGui/src/qDacWidget.cpp
Normal file → Executable file
@ -1,93 +1,90 @@
|
||||
#include "qDacWidget.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d,
|
||||
std::string n, slsDetectorDefs::dacIndex i)
|
||||
: QWidget(parent), det(detector), isDac(d), index(i) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow(n);
|
||||
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n, slsDetectorDefs::dacIndex i) :
|
||||
QWidget(parent), det(detector), isDac(d), index(i){
|
||||
setupUi(this);
|
||||
SetupWidgetWindow(n);
|
||||
}
|
||||
|
||||
qDacWidget::~qDacWidget() {}
|
||||
|
||||
void qDacWidget::SetupWidgetWindow(std::string name) {
|
||||
lblDac->setText(name.c_str());
|
||||
if (isDac) {
|
||||
spinDac->setDecimals(0);
|
||||
} else {
|
||||
spinDac->setSuffix(0x00b0 + QString("C"));
|
||||
spinDac->setReadOnly(true);
|
||||
lblDacmV->setMinimumWidth(0);
|
||||
lblDacmV->setMaximumWidth(0);
|
||||
}
|
||||
Initialization();
|
||||
Refresh();
|
||||
lblDac->setText(name.c_str());
|
||||
if (isDac) {
|
||||
spinDac->setDecimals(0);
|
||||
} else {
|
||||
spinDac->setSuffix(0x00b0 + QString("C"));
|
||||
spinDac->setReadOnly(true);
|
||||
lblDacmV->setMinimumWidth(0);
|
||||
lblDacmV->setMaximumWidth(0);
|
||||
}
|
||||
Initialization();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void qDacWidget::Initialization() {
|
||||
if (isDac) {
|
||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||
}
|
||||
if (isDac) {
|
||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||
}
|
||||
}
|
||||
|
||||
void qDacWidget::SetDetectorIndex(int id) {
|
||||
detectorIndex = id;
|
||||
Refresh();
|
||||
detectorIndex = id;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void qDacWidget::GetDac() {
|
||||
LOG(logDEBUG) << "Getting Dac " << index;
|
||||
FILE_LOG(logDEBUG) << "Getting Dac " << index;
|
||||
|
||||
disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||
try {
|
||||
// dac units
|
||||
auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1);
|
||||
spinDac->setValue(retval);
|
||||
// mv
|
||||
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
|
||||
lblDacmV->setText(QString("%1mV").arg(retval - 10));
|
||||
}
|
||||
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
|
||||
"qDacWidget::GetDac")
|
||||
disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||
try {
|
||||
// dac units
|
||||
auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1);
|
||||
spinDac->setValue(retval);
|
||||
// mv
|
||||
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
|
||||
lblDacmV->setText(QString("%1mV").arg(retval -10));
|
||||
} CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index), "qDacWidget::GetDac")
|
||||
|
||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||
}
|
||||
|
||||
|
||||
void qDacWidget::SetDac() {
|
||||
int val = (int)spinDac->value();
|
||||
LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data()
|
||||
<< " : " << val;
|
||||
int val = (int)spinDac->value();
|
||||
FILE_LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() << " : " << val;
|
||||
|
||||
try {
|
||||
det->setDAC(index, val, 0, {detectorIndex});
|
||||
}
|
||||
CATCH_DISPLAY(std::string("Could not set dac ") + std::to_string(index),
|
||||
"qDacWidget::SetDac")
|
||||
|
||||
// update mV anyway
|
||||
try {
|
||||
det->setDAC(index, val, 0, {detectorIndex});
|
||||
} CATCH_DISPLAY (std::string("Could not set dac ") + std::to_string(index), "qDacWidget::SetDac")
|
||||
|
||||
// update mV anyway
|
||||
GetDac();
|
||||
}
|
||||
|
||||
void qDacWidget::GetAdc() {
|
||||
LOG(logDEBUG) << "Getting ADC " << index;
|
||||
FILE_LOG(logDEBUG) << "Getting ADC " << index;
|
||||
|
||||
try {
|
||||
auto retval = det->getTemperature(index, {detectorIndex}).squash(-1);
|
||||
if (retval == -1 && detectorIndex == -1) {
|
||||
spinDac->setValue(-1);
|
||||
} else {
|
||||
spinDac->setValue(retval);
|
||||
}
|
||||
} CATCH_DISPLAY (std::string("Could not get adc ") + std::to_string(index), "qDacWidget::GetAdc")
|
||||
|
||||
try {
|
||||
auto retval = det->getTemperature(index, {detectorIndex}).squash(-1);
|
||||
if (retval == -1 && detectorIndex == -1) {
|
||||
spinDac->setValue(-1);
|
||||
} else {
|
||||
spinDac->setValue(retval);
|
||||
}
|
||||
}
|
||||
CATCH_DISPLAY(std::string("Could not get adc ") + std::to_string(index),
|
||||
"qDacWidget::GetAdc")
|
||||
}
|
||||
|
||||
void qDacWidget::Refresh() {
|
||||
if (isDac) {
|
||||
GetDac();
|
||||
} else {
|
||||
GetAdc();
|
||||
}
|
||||
if (isDac) {
|
||||
GetDac();
|
||||
} else {
|
||||
GetAdc();
|
||||
}
|
||||
}
|
||||
|
||||
|
316
slsDetectorGui/src/qDetectorMain.cpp
Normal file → Executable file
316
slsDetectorGui/src/qDetectorMain.cpp
Normal file → Executable file
@ -1,33 +1,52 @@
|
||||
#include "qDetectorMain.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
#include "qTabAdvanced.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qTabPlot.h"
|
||||
#include "qTabAdvanced.h"
|
||||
#include "qTabSettings.h"
|
||||
#include "qTabDebugging.h"
|
||||
#include "qTabDeveloper.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qTabMessages.h"
|
||||
#include "qTabPlot.h"
|
||||
#include "qTabSettings.h"
|
||||
|
||||
#include "ToString.h"
|
||||
#include "versionAPI.h"
|
||||
#include "ToString.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QPlastiqueStyle>
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QFileDialog>
|
||||
#include <QPlastiqueStyle>
|
||||
#include <QSizePolicy>
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <getopt.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
QApplication *theApp = new QApplication(argc, argv);
|
||||
theApp->setStyle(new QPlastiqueStyle);
|
||||
theApp->setWindowIcon(QIcon(":/icons/images/mountain.png"));
|
||||
try {
|
||||
qDetectorMain *det = new qDetectorMain(argc, argv, theApp, 0);
|
||||
det->show();
|
||||
theApp->exec();
|
||||
} catch (const std::exception &e) {
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
std::string(e.what()) + "\nExiting Gui :'( ", "main");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
QWidget *parent)
|
||||
: QMainWindow(parent), detType(slsDetectorDefs::GENERIC), isDeveloper(0),
|
||||
heightPlotWindow(0), heightCentralWidget(0) {
|
||||
|
||||
// options
|
||||
std::string fname;
|
||||
bool isDeveloper = false;
|
||||
std::string fname = "";
|
||||
int64_t tempval = 0;
|
||||
int multiId = 0;
|
||||
|
||||
@ -36,12 +55,12 @@ int main(int argc, char **argv) {
|
||||
// These options set a flag.
|
||||
//{"verbose", no_argument, &verbose_flag, 1},
|
||||
// These options don’t set a flag. We distinguish them by their indices.
|
||||
{"developer", no_argument, nullptr, 'd'},
|
||||
{"config", required_argument, nullptr, 'f'},
|
||||
{"id", required_argument, nullptr, 'i'},
|
||||
{"version", no_argument, nullptr, 'v'},
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{nullptr, 0, nullptr, 0}};
|
||||
{"developer", no_argument, 0, 'd'},
|
||||
{"config", required_argument, 0, 'f'},
|
||||
{"id", required_argument, 0, 'i'},
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{0, 0, 0, 0}};
|
||||
|
||||
// getopt_long stores the option index here
|
||||
optind = 1;
|
||||
@ -57,12 +76,12 @@ int main(int argc, char **argv) {
|
||||
|
||||
case 'f':
|
||||
fname = optarg;
|
||||
LOG(logDEBUG)
|
||||
FILE_LOG(logDEBUG)
|
||||
<< long_options[option_index].name << " " << optarg;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
isDeveloper = true;
|
||||
isDeveloper = 1;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
@ -71,9 +90,9 @@ int main(int argc, char **argv) {
|
||||
|
||||
case 'v':
|
||||
tempval = APIGUI;
|
||||
LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
|
||||
FILE_LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
|
||||
<< std::hex << tempval << ")";
|
||||
return 0;
|
||||
return;
|
||||
|
||||
case 'h':
|
||||
default:
|
||||
@ -87,93 +106,73 @@ int main(int argc, char **argv) {
|
||||
"i. Default: 0. Required \n" +
|
||||
"\t only when more than one multi "
|
||||
"detector object is needed.\n\n";
|
||||
LOG(logERROR) << help_message;
|
||||
return -1;
|
||||
FILE_LOG(logERROR) << help_message;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
QApplication app(argc, argv);
|
||||
app.setStyle(new QPlastiqueStyle); //style is deleted by QApplication
|
||||
try {
|
||||
qDetectorMain det(multiId, fname, isDeveloper);
|
||||
det.show();
|
||||
app.exec();
|
||||
} catch (const std::exception &e) {
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
std::string(e.what()) + "\nExiting Gui :'( ", "main");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
qDetectorMain::qDetectorMain(int multiId, const std::string& fname, bool isDevel)
|
||||
: QMainWindow(nullptr), detType(slsDetectorDefs::GENERIC), isDeveloper(isDevel),
|
||||
heightPlotWindow(0), heightCentralWidget(0) {
|
||||
|
||||
setupUi(this);
|
||||
SetUpDetector(fname, multiId);
|
||||
SetUpWidgetWindow();
|
||||
}
|
||||
|
||||
qDetectorMain::~qDetectorMain(){
|
||||
disconnect(tabs, SIGNAL(currentChanged(int)), this,
|
||||
SLOT(Refresh(int)));
|
||||
}
|
||||
qDetectorMain::~qDetectorMain() {}
|
||||
|
||||
void qDetectorMain::SetUpWidgetWindow() {
|
||||
setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
|
||||
// plot setup
|
||||
plot = new qDrawPlot(dockWidgetPlot, det.get());
|
||||
LOG(logDEBUG) << "DockPlot ready";
|
||||
dockWidgetPlot->setWidget(plot);
|
||||
plot = sls::make_unique<qDrawPlot>(dockWidgetPlot, det.get());
|
||||
FILE_LOG(logDEBUG) << "DockPlot ready";
|
||||
dockWidgetPlot->setWidget(plot.get());
|
||||
|
||||
// tabs setup
|
||||
tabs = new MyTabWidget(this);
|
||||
layoutTabs->addWidget(tabs);
|
||||
tabs = sls::make_unique<MyTabWidget>(this);
|
||||
layoutTabs->addWidget(tabs.get());
|
||||
|
||||
// creating all the other tab widgets
|
||||
tabMeasurement =
|
||||
new qTabMeasurement(this, det.get(), plot);
|
||||
tabDataOutput = new qTabDataOutput(this, det.get());
|
||||
tabPlot = new qTabPlot(this, det.get(), plot);
|
||||
tabSettings = new qTabSettings(this, det.get());
|
||||
tabAdvanced = new qTabAdvanced(this, det.get(), plot);
|
||||
tabDebugging = new qTabDebugging(this, det.get());
|
||||
tabDeveloper = new qTabDeveloper(this, det.get());
|
||||
tabMeasurement = sls::make_unique<qTabMeasurement>(this, det.get(), plot.get());
|
||||
tabDataOutput = sls::make_unique<qTabDataOutput>(this, det.get());
|
||||
tabPlot = sls::make_unique<qTabPlot>(this, det.get(), plot.get());
|
||||
tabSettings = sls::make_unique<qTabSettings>(this, det.get());
|
||||
tabAdvanced = sls::make_unique<qTabAdvanced>(this, det.get(), plot.get());
|
||||
tabDebugging = sls::make_unique<qTabDebugging>(this, det.get());
|
||||
tabDeveloper = sls::make_unique<qTabDeveloper>(this, det.get());
|
||||
|
||||
// creating the scroll area widgets for the tabs
|
||||
QScrollArea *scroll[NumberOfTabs];
|
||||
for (int i = 0; i < NumberOfTabs; ++i) {
|
||||
scroll[i] = sls::make_unique<QScrollArea>();
|
||||
scroll[i] = new QScrollArea;
|
||||
scroll[i]->setFrameShape(QFrame::NoFrame);
|
||||
}
|
||||
// setting the tab widgets to the scrollareas
|
||||
scroll[MEASUREMENT]->setWidget(tabMeasurement);
|
||||
scroll[DATAOUTPUT]->setWidget(tabDataOutput);
|
||||
scroll[PLOT]->setWidget(tabPlot);
|
||||
scroll[SETTINGS]->setWidget(tabSettings);
|
||||
scroll[ADVANCED]->setWidget(tabAdvanced);
|
||||
scroll[DEBUGGING]->setWidget(tabDebugging);
|
||||
scroll[DEVELOPER]->setWidget(tabDeveloper);
|
||||
scroll[MEASUREMENT]->setWidget(tabMeasurement.get());
|
||||
scroll[DATAOUTPUT]->setWidget(tabDataOutput.get());
|
||||
scroll[PLOT]->setWidget(tabPlot.get());
|
||||
scroll[SETTINGS]->setWidget(tabSettings.get());
|
||||
scroll[ADVANCED]->setWidget(tabAdvanced.get());
|
||||
scroll[DEBUGGING]->setWidget(tabDebugging.get());
|
||||
scroll[DEVELOPER]->setWidget(tabDeveloper.get());
|
||||
// inserting all the tabs
|
||||
tabs->insertTab(MEASUREMENT, scroll[MEASUREMENT].get(), "Measurement");
|
||||
tabs->insertTab(DATAOUTPUT, scroll[DATAOUTPUT].get(), "Data Output");
|
||||
tabs->insertTab(PLOT, scroll[PLOT].get(), "Plot");
|
||||
tabs->insertTab(SETTINGS, scroll[SETTINGS].get(), "Settings");
|
||||
tabs->insertTab(ADVANCED, scroll[ADVANCED].get(), "Advanced");
|
||||
tabs->insertTab(DEBUGGING, scroll[DEBUGGING].get(), "Debugging");
|
||||
tabs->insertTab(DEVELOPER, scroll[DEVELOPER].get(), "Developer");
|
||||
tabs->insertTab(MEASUREMENT, scroll[MEASUREMENT], "Measurement");
|
||||
tabs->insertTab(DATAOUTPUT, scroll[DATAOUTPUT], "Data Output");
|
||||
tabs->insertTab(PLOT, scroll[PLOT], "Plot");
|
||||
tabs->insertTab(SETTINGS, scroll[SETTINGS], "Settings");
|
||||
tabs->insertTab(ADVANCED, scroll[ADVANCED], "Advanced");
|
||||
tabs->insertTab(DEBUGGING, scroll[DEBUGGING], "Debugging");
|
||||
tabs->insertTab(DEVELOPER, scroll[DEVELOPER], "Developer");
|
||||
// no scroll buttons this way
|
||||
tabs->insertTab(MESSAGES, tabMessages, "Terminal");
|
||||
tabs->insertTab(MESSAGES, tabMessages.get(), "Terminal");
|
||||
|
||||
// swap tabs so that messages is last tab
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMeasurement), MEASUREMENT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabSettings), SETTINGS);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDataOutput), DATAOUTPUT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabPlot), PLOT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabAdvanced), ADVANCED);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDebugging), DEBUGGING);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDeveloper), DEVELOPER);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMessages), MESSAGES);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMeasurement.get()), MEASUREMENT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabSettings.get()), SETTINGS);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDataOutput.get()), DATAOUTPUT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabPlot.get()), PLOT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabAdvanced.get()), ADVANCED);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDebugging.get()), DEBUGGING);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDeveloper.get()), DEVELOPER);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMessages.get()), MESSAGES);
|
||||
tabs->setCurrentIndex(MEASUREMENT);
|
||||
|
||||
// other tab properties
|
||||
@ -181,11 +180,12 @@ void qDetectorMain::SetUpWidgetWindow() {
|
||||
defaultTabColor = tabs->tabBar()->tabTextColor(DATAOUTPUT);
|
||||
// Set the current tab(measurement) to blue as it is the current one
|
||||
tabs->tabBar()->setTabTextColor(0, QColor(0, 0, 200, 255));
|
||||
tabs->tabBar()->setExpanding(true);
|
||||
// increase the width so it uses all the empty space for the tab titles
|
||||
tabs->tabBar()->setFixedWidth(width() + 61);
|
||||
|
||||
// mode setup - to set up the tabs initially as disabled, not in form so
|
||||
// done here
|
||||
LOG(logINFO)
|
||||
FILE_LOG(logINFO)
|
||||
<< "Dockable Mode: 0, Debug Mode: 0, Expert Mode: 0, Developer Mode: "
|
||||
<< isDeveloper;
|
||||
tabs->setTabEnabled(DEBUGGING, false);
|
||||
@ -206,21 +206,20 @@ void qDetectorMain::SetUpWidgetWindow() {
|
||||
Initialization();
|
||||
}
|
||||
|
||||
void qDetectorMain::SetUpDetector(const std::string& config_file, int multiID) {
|
||||
void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
||||
|
||||
// instantiate detector and set window title
|
||||
det = sls::make_unique<sls::Detector>(multiID);
|
||||
|
||||
// create messages tab to capture config file loading logs
|
||||
tabMessages = new qTabMessages(this);
|
||||
tabMessages = sls::make_unique<qTabMessages>(this);
|
||||
|
||||
// loads the config file at startup
|
||||
if (!config_file.empty())
|
||||
LoadConfigFile(config_file);
|
||||
if (!fName.empty())
|
||||
LoadConfigFile(fName);
|
||||
|
||||
// validate detector type (for GUI) and update menu
|
||||
detType = det->getDetectorType().tsquash(
|
||||
"Different detector type for all modules.");
|
||||
detType = det->getDetectorType().tsquash("Different detector type for all modules.");
|
||||
actionLoadTrimbits->setEnabled(false);
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
@ -231,75 +230,64 @@ void qDetectorMain::SetUpDetector(const std::string& config_file, int multiID) {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
std::ostringstream os;
|
||||
os << det->getHostname() << " has "
|
||||
<< sls::ToString(det->getDetectorType().squash())
|
||||
<< " detector type (" << std::to_string(detType)
|
||||
<< "). Exiting GUI.";
|
||||
os << det->getHostname() << " has " <<
|
||||
sls::ToString(det->getDetectorType().squash()) << " detector type (" <<
|
||||
std::to_string(detType) << "). Exiting GUI.";
|
||||
std::string errorMess = os.str();
|
||||
throw sls::RuntimeError(errorMess.c_str());
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << "SLS Detector GUI : "
|
||||
<< sls::ToString(det->getDetectorType().squash()) << " - "
|
||||
<< det->getHostname();
|
||||
os << "SLS Detector GUI : " << sls::ToString(det->getDetectorType().squash())
|
||||
<< " - " << det->getHostname();
|
||||
std::string title = os.str();
|
||||
LOG(logINFO) << title;
|
||||
FILE_LOG(logINFO) << title;
|
||||
setWindowTitle(QString(title.c_str()));
|
||||
}
|
||||
|
||||
void qDetectorMain::Initialization() {
|
||||
// Dockable Plot
|
||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,
|
||||
SLOT(ResizeMainWindow(bool)));
|
||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this, SLOT(ResizeMainWindow(bool)));
|
||||
// tabs
|
||||
connect(tabs, SIGNAL(currentChanged(int)), this,
|
||||
SLOT(Refresh(int))); //( QWidget*)));
|
||||
connect(tabs.get(),SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||
// Measurement tab
|
||||
connect(tabMeasurement, SIGNAL(EnableTabsSignal(bool)), this,
|
||||
SLOT(EnableTabs(bool)));
|
||||
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)),
|
||||
plot, SLOT(SetSaveFileName(QString)));
|
||||
connect(tabMeasurement.get(), SIGNAL(EnableTabsSignal(bool)), this, SLOT(EnableTabs(bool)));
|
||||
connect(tabMeasurement.get(), SIGNAL(FileNameChangedSignal(QString)), plot.get(), SLOT(SetSaveFileName(QString)));
|
||||
// Plot tab
|
||||
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this,
|
||||
SLOT(SetZoomToolTip(bool)));
|
||||
connect(tabPlot.get(), SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
||||
|
||||
// Plotting
|
||||
connect(plot, SIGNAL(AcquireFinishedSignal()), tabMeasurement,
|
||||
SLOT(AcquireFinished()));
|
||||
connect(plot, SIGNAL(AbortSignal()), tabMeasurement,
|
||||
SLOT(AbortAcquire()));
|
||||
connect(plot.get(), SIGNAL(AcquireFinishedSignal()), tabMeasurement.get(), SLOT(AcquireFinished()));
|
||||
connect(plot.get(), SIGNAL(AbortSignal()), tabMeasurement.get(), SLOT(AbortAcquire()));
|
||||
|
||||
// menubar
|
||||
// Modes Menu
|
||||
connect(menuModes, SIGNAL(triggered(QAction *)), this,
|
||||
SLOT(EnableModes(QAction *)));
|
||||
connect(menuModes, SIGNAL(triggered(QAction *)), this, SLOT(EnableModes(QAction *)));
|
||||
// Utilities Menu
|
||||
connect(menuUtilities, SIGNAL(triggered(QAction *)), this,
|
||||
SLOT(ExecuteUtilities(QAction *)));
|
||||
connect(menuUtilities, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteUtilities(QAction *)));
|
||||
// Help Menu
|
||||
connect(menuHelp, SIGNAL(triggered(QAction *)), this,
|
||||
SLOT(ExecuteHelp(QAction *)));
|
||||
connect(menuHelp, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteHelp(QAction *)));
|
||||
|
||||
}
|
||||
|
||||
void qDetectorMain::LoadConfigFile(const std::string& config_file) {
|
||||
void qDetectorMain::LoadConfigFile(const std::string fName) {
|
||||
|
||||
LOG(logINFO) << "Loading config file at start up:" << config_file;
|
||||
FILE_LOG(logINFO) << "Loading config file at start up:" << fName;
|
||||
|
||||
struct stat st_buf;
|
||||
QString file = QString(config_file.c_str());
|
||||
QString file = QString(fName.c_str());
|
||||
|
||||
// path doesnt exist
|
||||
if (stat(config_file.c_str(), &st_buf)) {
|
||||
if (stat(fName.c_str(), &st_buf)) {
|
||||
qDefs::Message(
|
||||
qDefs::WARNING,
|
||||
std::string("<nobr>Start up configuration failed to load. The "
|
||||
"following file does not exist:</nobr><br><nobr>") +
|
||||
config_file,
|
||||
fName,
|
||||
"qDetectorMain::LoadConfigFile");
|
||||
LOG(logWARNING) << "Config file does not exist";
|
||||
FILE_LOG(logWARNING) << "Config file does not exist";
|
||||
}
|
||||
// not a file
|
||||
else if (!S_ISREG(st_buf.st_mode)) {
|
||||
@ -308,15 +296,13 @@ void qDetectorMain::LoadConfigFile(const std::string& config_file) {
|
||||
std::string(
|
||||
"<nobr>Start up configuration failed to load. The following "
|
||||
"file is not a recognized file format:</nobr><br><nobr>") +
|
||||
config_file,
|
||||
fName,
|
||||
"qDetectorMain::LoadConfigFile");
|
||||
LOG(logWARNING) << "File not recognized";
|
||||
FILE_LOG(logWARNING) << "File not recognized";
|
||||
} else {
|
||||
try {
|
||||
det->loadConfig(config_file);
|
||||
}
|
||||
CATCH_DISPLAY("Could not load config file.",
|
||||
"qDetectorMain::LoadConfigFile")
|
||||
det->loadConfig(fName);
|
||||
} CATCH_DISPLAY ("Could not load config file.", "qDetectorMain::LoadConfigFile")
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,7 +313,8 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
if (action == actionDebug) {
|
||||
enable = actionDebug->isChecked();
|
||||
tabs->setTabEnabled(DEBUGGING, enable);
|
||||
LOG(logINFO) << "Debug Mode: " << qDefs::stringEnable(enable);
|
||||
FILE_LOG(logINFO) << "Debug Mode: "
|
||||
<< qDefs::stringEnable(enable);
|
||||
|
||||
}
|
||||
|
||||
@ -336,9 +323,9 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
enable = actionExpert->isChecked();
|
||||
|
||||
tabs->setTabEnabled(ADVANCED, enable);
|
||||
actionLoadTrimbits->setVisible(enable &&
|
||||
detType == slsDetectorDefs::EIGER);
|
||||
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||
actionLoadTrimbits->setVisible(enable && detType == slsDetectorDefs::EIGER);
|
||||
FILE_LOG(logINFO) << "Expert Mode: "
|
||||
<< qDefs::stringEnable(enable);
|
||||
}
|
||||
|
||||
// Set DockableMode
|
||||
@ -350,7 +337,8 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
dockWidgetPlot->setFloating(false);
|
||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
}
|
||||
LOG(logINFO) << "Dockable Mode: " << qDefs::stringEnable(enable);
|
||||
FILE_LOG(logINFO) << "Dockable Mode: "
|
||||
<< qDefs::stringEnable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,7 +347,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
try {
|
||||
|
||||
if (action == actionLoadConfiguration) {
|
||||
LOG(logDEBUG) << "Loading Configuration";
|
||||
FILE_LOG(logDEBUG) << "Loading Configuration";
|
||||
QString fName = QString(det->getFilePath().squash("/tmp/").c_str());
|
||||
fName = QFileDialog::getOpenFileName(
|
||||
this, tr("Load Detector Configuration"), fName,
|
||||
@ -367,18 +355,19 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
refreshTabs = true;
|
||||
det->loadConfig(std::string(fName.toAscii().constData()));
|
||||
det->loadConfig(
|
||||
std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Configuration Parameters have been "
|
||||
"configured successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
LOG(logINFO)
|
||||
FILE_LOG(logINFO)
|
||||
<< "Configuration Parameters loaded successfully";
|
||||
}
|
||||
}
|
||||
|
||||
else if (action == actionLoadParameters) {
|
||||
LOG(logDEBUG) << "Loading Parameters";
|
||||
FILE_LOG(logDEBUG) << "Loading Parameters";
|
||||
QString fName = QString(det->getFilePath().squash("/tmp/").c_str());
|
||||
fName = QFileDialog::getOpenFileName(
|
||||
this, tr("Load Measurement Setup"), fName,
|
||||
@ -386,19 +375,20 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
refreshTabs = true;
|
||||
det->loadParameters(std::string(fName.toAscii().constData()));
|
||||
det->loadParameters(
|
||||
std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Detector Parameters have been "
|
||||
"configured successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
LOG(logINFO) << "Parameters loaded successfully";
|
||||
FILE_LOG(logINFO)
|
||||
<< "Parameters loaded successfully";
|
||||
}
|
||||
}
|
||||
|
||||
else if (action == actionLoadTrimbits) {
|
||||
QString fName =
|
||||
QString((det->getSettingsPath().squash("/tmp/")).c_str());
|
||||
LOG(logDEBUG) << "Loading Trimbits";
|
||||
QString fName = QString((det->getSettingsPath().squash("/tmp/")).c_str());
|
||||
FILE_LOG(logDEBUG) << "Loading Trimbits";
|
||||
// so that even nonexisting files can be selected
|
||||
QFileDialog *fileDialog = new QFileDialog(
|
||||
this, tr("Load Detector Trimbits"), fName,
|
||||
@ -409,16 +399,18 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
det->loadTrimbits(std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Trimbits have been loaded successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
LOG(logINFO) << "Trimbits loaded successfully";
|
||||
det->loadTrimbits(
|
||||
std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(
|
||||
qDefs::INFORMATION,
|
||||
"The Trimbits have been loaded successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO) << "Trimbits loaded successfully";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
CATCH_DISPLAY("Could not execute utilities.",
|
||||
"qDetectorMain::ExecuteUtilities")
|
||||
|
||||
} CATCH_DISPLAY ("Could not execute utilities.", "qDetectorMain::ExecuteUtilities")
|
||||
|
||||
Refresh(tabs->currentIndex());
|
||||
if (refreshTabs) {
|
||||
@ -437,16 +429,14 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
|
||||
void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
if (action == actionAbout) {
|
||||
LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, "
|
||||
"Gotthard, Gotthard2 and Moench detectors";
|
||||
FILE_LOG(logINFO) << "About Common GUI for Eiger, Gotthard, Jungfrau "
|
||||
"and Moench detectors";
|
||||
|
||||
std::string guiVersion = std::to_string(APIGUI);
|
||||
std::string clientVersion = "unknown";
|
||||
try {
|
||||
clientVersion = std::to_string(det->getClientVersion());
|
||||
}
|
||||
CATCH_DISPLAY("Could not get client version.",
|
||||
"qDetectorMain::ExecuteHelp")
|
||||
} CATCH_DISPLAY ("Could not get client version.", "qDetectorMain::ExecuteHelp")
|
||||
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"<p style=\"font-family:verdana;\">"
|
||||
@ -457,8 +447,7 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
clientVersion +
|
||||
"<br><br>"
|
||||
"Common GUI to control the SLS Detectors: "
|
||||
"Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and "
|
||||
"Moench.<br><br>"
|
||||
"Eiger, Jungfrau, Mythen3, Gotthard, Gotthard2 and Moench.<br><br>"
|
||||
"It can be operated in parallel with the command "
|
||||
"line interface:<br>"
|
||||
"sls_detector_put,<br>sls_detector_get,<br>sls_"
|
||||
@ -472,7 +461,7 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
}
|
||||
|
||||
void qDetectorMain::Refresh(int index) {
|
||||
LOG(logDEBUG) << "Refresh Main Tab";
|
||||
FILE_LOG(logDEBUG) << "Refresh Main Tab";
|
||||
|
||||
if (!tabs->isTabEnabled(index))
|
||||
tabs->setCurrentIndex((index++) < (tabs->count() - 1) ? index
|
||||
@ -511,14 +500,14 @@ void qDetectorMain::Refresh(int index) {
|
||||
}
|
||||
|
||||
void qDetectorMain::ResizeMainWindow(bool b) {
|
||||
LOG(logDEBUG1) << "Resizing Main Window: height:" << height();
|
||||
FILE_LOG(logDEBUG1) << "Resizing Main Window: height:" << height();
|
||||
|
||||
// undocked from the main window
|
||||
if (b) {
|
||||
// sets the main window height to a smaller maximum to get rid of space
|
||||
setMaximumHeight(height() - heightPlotWindow - 9);
|
||||
dockWidgetPlot->setMinimumHeight(0);
|
||||
LOG(logINFO) << "Undocking from main window";
|
||||
FILE_LOG(logINFO) << "Undocking from main window";
|
||||
} else {
|
||||
setMaximumHeight(QWIDGETSIZE_MAX);
|
||||
// the minimum for plot will be set when the widget gets resized
|
||||
@ -546,7 +535,7 @@ void qDetectorMain::resizeEvent(QResizeEvent *event) {
|
||||
}
|
||||
|
||||
void qDetectorMain::EnableTabs(bool enable) {
|
||||
LOG(logDEBUG) << "qDetectorMain::EnableTabs";
|
||||
FILE_LOG(logDEBUG) << "qDetectorMain::EnableTabs";
|
||||
|
||||
// normal tabs
|
||||
tabs->setTabEnabled(DATAOUTPUT, enable);
|
||||
@ -565,8 +554,7 @@ void qDetectorMain::EnableTabs(bool enable) {
|
||||
// expert
|
||||
bool expertTab = enable && (actionExpert->isChecked());
|
||||
tabs->setTabEnabled(ADVANCED, expertTab);
|
||||
actionLoadTrimbits->setVisible(expertTab &&
|
||||
detType == slsDetectorDefs::EIGER);
|
||||
actionLoadTrimbits->setVisible(expertTab && detType == slsDetectorDefs::EIGER);
|
||||
|
||||
// moved to here, so that its all in order, instead of signals and different
|
||||
// threads
|
||||
|
717
slsDetectorGui/src/qDrawPlot.cpp
Normal file → Executable file
717
slsDetectorGui/src/qDrawPlot.cpp
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
344
slsDetectorGui/src/qTabAdvanced.cpp
Normal file → Executable file
344
slsDetectorGui/src/qTabAdvanced.cpp
Normal file → Executable file
@ -1,14 +1,15 @@
|
||||
#include "qTabAdvanced.h"
|
||||
#include "network_utils.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
#include "network_utils.h"
|
||||
|
||||
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector,
|
||||
qDrawPlot *p)
|
||||
#include <iostream>
|
||||
|
||||
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector, qDrawPlot *p)
|
||||
: QWidget(parent), det(detector), plot(p) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
LOG(logDEBUG) << "Advanced ready";
|
||||
FILE_LOG(logDEBUG) << "Advanced ready";
|
||||
}
|
||||
|
||||
qTabAdvanced::~qTabAdvanced() {}
|
||||
@ -87,8 +88,7 @@ void qTabAdvanced::Initialization() {
|
||||
|
||||
// roi
|
||||
if (tab_roi->isEnabled()) {
|
||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetROI()));
|
||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI()));
|
||||
connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(ClearROI()));
|
||||
}
|
||||
@ -114,16 +114,15 @@ void qTabAdvanced::Initialization() {
|
||||
// throw bits
|
||||
if (lblDiscardBits->isEnabled()) {
|
||||
connect(spinDiscardBits, SIGNAL(valueChanged(int)), plot,
|
||||
SLOT(SetNumDiscardBits(int)));
|
||||
SLOT(SetNumDiscardBits(int)));
|
||||
}
|
||||
}
|
||||
|
||||
void qTabAdvanced::PopulateDetectors() {
|
||||
LOG(logDEBUG) << "Populating detectors";
|
||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDetector()));
|
||||
disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetROI()));
|
||||
disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||
|
||||
comboDetector->clear();
|
||||
comboReadout->clear();
|
||||
@ -133,223 +132,197 @@ void qTabAdvanced::PopulateDetectors() {
|
||||
comboReadout->addItem(QString(it.c_str()));
|
||||
}
|
||||
comboDetector->setCurrentIndex(0);
|
||||
comboReadout->setCurrentIndex(0);
|
||||
comboReadout->setCurrentIndex(0);
|
||||
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDetector()));
|
||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetROI()));
|
||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetControlPort() {
|
||||
LOG(logDEBUG) << "Getting control port ";
|
||||
FILE_LOG(logDEBUG) << "Getting control port ";
|
||||
disconnect(spinControlPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetControlPort(int)));
|
||||
|
||||
try {
|
||||
int retval = det->getControlPort({comboDetector->currentIndex()})[0];
|
||||
spinControlPort->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector control port.",
|
||||
"qTabAdvanced::GetControlPort")
|
||||
} CATCH_DISPLAY ("Could not get detector control port.", "qTabAdvanced::GetControlPort")
|
||||
|
||||
connect(spinControlPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetControlPort(int)));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetStopPort() {
|
||||
LOG(logDEBUG) << "Getting stop port";
|
||||
FILE_LOG(logDEBUG) << "Getting stop port";
|
||||
disconnect(spinStopPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetStopPort(int)));
|
||||
|
||||
try {
|
||||
int retval = det->getStopPort({comboDetector->currentIndex()})[0];
|
||||
spinStopPort->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector stop port.",
|
||||
"qTabAdvanced::GetStopPort")
|
||||
} CATCH_DISPLAY ("Could not get detector stop port.", "qTabAdvanced::GetStopPort")
|
||||
|
||||
connect(spinStopPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetStopPort(int)));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetDetectorUDPIP() {
|
||||
LOG(logDEBUG) << "Getting Detector UDP IP";
|
||||
FILE_LOG(logDEBUG) << "Getting Detector UDP IP";
|
||||
disconnect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetDetectorUDPIP()));
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
det->getSourceUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
auto retval = det->getSourceUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
dispDetectorUDPIP->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector UDP IP.",
|
||||
"qTabAdvanced::GetDetectorUDPIP")
|
||||
} CATCH_DISPLAY ("Could not get detector UDP IP.", "qTabAdvanced::GetDetectorUDPIP")
|
||||
|
||||
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetDetectorUDPIP()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetDetectorUDPMAC() {
|
||||
LOG(logDEBUG) << "Getting Detector UDP MAC";
|
||||
FILE_LOG(logDEBUG) << "Getting Detector UDP MAC";
|
||||
disconnect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetDetectorUDPMAC()));
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
det->getSourceUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
auto retval = det->getSourceUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
dispDetectorUDPMAC->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector UDP MAC.",
|
||||
"qTabAdvanced::GetDetectorUDPMAC")
|
||||
} CATCH_DISPLAY ("Could not get detector UDP MAC.", "qTabAdvanced::GetDetectorUDPMAC")
|
||||
|
||||
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetDetectorUDPMAC()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetCltZMQPort() {
|
||||
LOG(logDEBUG) << "Getting Client ZMQ port";
|
||||
FILE_LOG(logDEBUG) << "Getting Client ZMQ port";
|
||||
disconnect(spinZMQPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetCltZMQPort(int)));
|
||||
|
||||
try {
|
||||
int retval = det->getClientZmqPort({comboDetector->currentIndex()})[0];
|
||||
int retval =
|
||||
det->getClientZmqPort({comboDetector->currentIndex()})[0];
|
||||
spinZMQPort->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get client zmq port.",
|
||||
"qTabAdvanced::GetCltZMQPort")
|
||||
} CATCH_DISPLAY ("Could not get client zmq port.", "qTabAdvanced::GetCltZMQPort")
|
||||
|
||||
connect(spinZMQPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetCltZMQPort(int)));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetCltZMQIP() {
|
||||
LOG(logDEBUG) << "Getting Client ZMQ IP";
|
||||
FILE_LOG(logDEBUG) << "Getting Client ZMQ IP";
|
||||
disconnect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
det->getClientZmqIp({comboDetector->currentIndex()})[0].str();
|
||||
dispZMQIP->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get client zmq ip.", "qTabAdvanced::GetCltZMQIP")
|
||||
} CATCH_DISPLAY ("Could not get client zmq ip.", "qTabAdvanced::GetCltZMQIP")
|
||||
|
||||
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetRxrHostname() {
|
||||
LOG(logDEBUG) << "Getting Receiver Hostname";
|
||||
FILE_LOG(logDEBUG) << "Getting Receiver Hostname";
|
||||
disconnect(dispRxrHostname, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRxrHostname()));
|
||||
|
||||
try {
|
||||
auto retval = det->getRxHostname({comboDetector->currentIndex()})[0];
|
||||
dispRxrHostname->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver hostname.",
|
||||
"qTabAdvanced::GetRxrHostname")
|
||||
} CATCH_DISPLAY ("Could not get receiver hostname.", "qTabAdvanced::GetRxrHostname")
|
||||
|
||||
connect(dispRxrHostname, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRxrHostname()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetRxrTCPPort() {
|
||||
LOG(logDEBUG) << "Getting Receiver TCP port";
|
||||
FILE_LOG(logDEBUG) << "Getting Receiver TCP port";
|
||||
disconnect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRxrTCPPort(int)));
|
||||
|
||||
try {
|
||||
int retval = det->getRxPort({comboDetector->currentIndex()})[0];
|
||||
spinRxrTCPPort->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver tcp port.",
|
||||
"qTabAdvanced::GetRxrTCPPort")
|
||||
} CATCH_DISPLAY ("Could not get receiver tcp port.", "qTabAdvanced::GetRxrTCPPort")
|
||||
|
||||
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRxrTCPPort(int)));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetRxrUDPPort() {
|
||||
LOG(logDEBUG) << "Getting Receiver UDP port";
|
||||
FILE_LOG(logDEBUG) << "Getting Receiver UDP port";
|
||||
disconnect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRxrUDPPort(int)));
|
||||
|
||||
try {
|
||||
int retval =
|
||||
det->getDestinationUDPPort({comboDetector->currentIndex()})[0];
|
||||
int retval = det->getDestinationUDPPort({comboDetector->currentIndex()})[0];
|
||||
spinRxrUDPPort->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver udp port.",
|
||||
"qTabAdvanced::GetRxrUDPPort")
|
||||
} CATCH_DISPLAY ("Could not get receiver udp port.", "qTabAdvanced::GetRxrUDPPort")
|
||||
|
||||
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRxrUDPPort(int)));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetRxrUDPIP() {
|
||||
LOG(logDEBUG) << "Getting Receiver UDP IP";
|
||||
FILE_LOG(logDEBUG) << "Getting Receiver UDP IP";
|
||||
disconnect(dispRxrUDPIP, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRxrUDPIP()));
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
det->getDestinationUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
auto retval = det->getDestinationUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
dispRxrUDPIP->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver udp ip.", "qTabAdvanced::GetRxrUDPIP")
|
||||
} CATCH_DISPLAY ("Could not get receiver udp ip.", "qTabAdvanced::GetRxrUDPIP")
|
||||
|
||||
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetRxrUDPMAC() {
|
||||
LOG(logDEBUG) << "Getting Receiver UDP MAC";
|
||||
FILE_LOG(logDEBUG) << "Getting Receiver UDP MAC";
|
||||
disconnect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRxrUDPMAC()));
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
det->getDestinationUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
auto retval = det->getDestinationUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
dispRxrUDPMAC->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver udp mac.",
|
||||
"qTabAdvanced::GetRxrUDPMAC")
|
||||
} CATCH_DISPLAY ("Could not get receiver udp mac.", "qTabAdvanced::GetRxrUDPMAC")
|
||||
|
||||
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRxrUDPMAC()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetRxrZMQPort() {
|
||||
LOG(logDEBUG) << "Getting Receiver ZMQ port";
|
||||
FILE_LOG(logDEBUG) << "Getting Receiver ZMQ port";
|
||||
disconnect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRxrZMQPort(int)));
|
||||
|
||||
try {
|
||||
int retval = det->getRxZmqPort({comboDetector->currentIndex()})[0];
|
||||
int retval =
|
||||
det->getRxZmqPort({comboDetector->currentIndex()})[0];
|
||||
spinRxrZMQPort->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver zmq port.",
|
||||
"qTabAdvanced::GetRxrZMQPort")
|
||||
} CATCH_DISPLAY ("Could not get receiver zmq port.", "qTabAdvanced::GetRxrZMQPort")
|
||||
|
||||
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRxrZMQPort(int)));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetRxrZMQIP() {
|
||||
LOG(logDEBUG) << "Getting Receiver ZMQ IP";
|
||||
FILE_LOG(logDEBUG) << "Getting Receiver ZMQ IP";
|
||||
disconnect(dispRxrZMQIP, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRxrZMQIP()));
|
||||
|
||||
try {
|
||||
auto retval = det->getRxZmqIP({comboDetector->currentIndex()})[0].str();
|
||||
auto retval =
|
||||
det->getRxZmqIP({comboDetector->currentIndex()})[0].str();
|
||||
dispRxrZMQIP->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
|
||||
} CATCH_DISPLAY ("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
|
||||
|
||||
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetDetector() {
|
||||
LOG(logDEBUG) << "Set Detector: "
|
||||
FILE_LOG(logDEBUG) << "Set Detector: "
|
||||
<< comboDetector->currentText().toAscii().data();
|
||||
|
||||
GetControlPort();
|
||||
@ -366,162 +339,149 @@ void qTabAdvanced::SetDetector() {
|
||||
GetRxrZMQPort();
|
||||
GetRxrZMQIP();
|
||||
|
||||
LOG(logDEBUG) << det->printRxConfiguration();
|
||||
FILE_LOG(logDEBUG) << det->printRxConfiguration();
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetControlPort(int port) {
|
||||
LOG(logINFO) << "Setting Control Port:" << port;
|
||||
FILE_LOG(logINFO) << "Setting Control Port:" << port;
|
||||
try {
|
||||
det->setControlPort(port, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set control port.", "qTabAdvanced::SetControlPort",
|
||||
} CATCH_HANDLE("Could not set control port.", "qTabAdvanced::SetControlPort",
|
||||
this, &qTabAdvanced::GetControlPort)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetStopPort(int port) {
|
||||
LOG(logINFO) << "Setting Stop Port:" << port;
|
||||
FILE_LOG(logINFO) << "Setting Stop Port:" << port;
|
||||
try {
|
||||
det->setStopPort(port, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set stop port.", "qTabAdvanced::SetStopPort", this,
|
||||
&qTabAdvanced::GetStopPort)
|
||||
} CATCH_HANDLE ("Could not set stop port.", "qTabAdvanced::SetStopPort", this,
|
||||
&qTabAdvanced::GetStopPort)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetDetectorUDPIP() {
|
||||
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
||||
LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||
FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||
try {
|
||||
det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Detector UDP IP.",
|
||||
"qTabAdvanced::SetDetectorUDPIP", this,
|
||||
&qTabAdvanced::GetDetectorUDPIP)
|
||||
} CATCH_HANDLE ("Could not set Detector UDP IP.",
|
||||
"qTabAdvanced::SetDetectorUDPIP", this,
|
||||
&qTabAdvanced::GetDetectorUDPIP)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetDetectorUDPMAC() {
|
||||
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
||||
LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||
FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||
try {
|
||||
det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Detector UDP MAC.",
|
||||
"qTabAdvanced::SetDetectorUDPMAC", this,
|
||||
&qTabAdvanced::GetDetectorUDPMAC)
|
||||
} CATCH_HANDLE ("Could not set Detector UDP MAC.",
|
||||
"qTabAdvanced::SetDetectorUDPMAC", this,
|
||||
&qTabAdvanced::GetDetectorUDPMAC)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetCltZMQPort(int port) {
|
||||
LOG(logINFO) << "Setting Client ZMQ Port:" << port;
|
||||
FILE_LOG(logINFO) << "Setting Client ZMQ Port:" << port;
|
||||
try {
|
||||
det->setClientZmqPort(port, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Client ZMQ port.",
|
||||
"qTabAdvanced::SetCltZMQPort", this,
|
||||
&qTabAdvanced::GetCltZMQPort)
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ port.",
|
||||
"qTabAdvanced::SetCltZMQPort", this,
|
||||
&qTabAdvanced::GetCltZMQPort)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetCltZMQIP() {
|
||||
std::string s = dispZMQIP->text().toAscii().constData();
|
||||
LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||
FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||
try {
|
||||
det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetCltZMQIP",
|
||||
this, &qTabAdvanced::GetCltZMQIP)
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
||||
"qTabAdvanced::SetCltZMQIP", this,
|
||||
&qTabAdvanced::GetCltZMQIP)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrHostname() {
|
||||
std::string s = dispZMQIP->text().toAscii().constData();
|
||||
LOG(logINFO) << "Setting Receiver Hostname:" << s;
|
||||
FILE_LOG(logINFO) << "Setting Receiver Hostname:" << s;
|
||||
try {
|
||||
det->setRxHostname(s, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetRxrHostname",
|
||||
this, &qTabAdvanced::GetRxrHostname)
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
||||
"qTabAdvanced::SetRxrHostname", this,
|
||||
&qTabAdvanced::GetRxrHostname)
|
||||
|
||||
// update all network widgets (receiver mainly)
|
||||
SetDetector();
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrTCPPort(int port) {
|
||||
LOG(logINFO) << "Setting Receiver TCP Port:" << port;
|
||||
FILE_LOG(logINFO) << "Setting Receiver TCP Port:" << port;
|
||||
try {
|
||||
det->setRxPort(port, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver TCP port.",
|
||||
"qTabAdvanced::SetRxrTCPPort", this,
|
||||
&qTabAdvanced::GetRxrTCPPort)
|
||||
} CATCH_HANDLE ("Could not set Receiver TCP port.",
|
||||
"qTabAdvanced::SetRxrTCPPort", this,
|
||||
&qTabAdvanced::GetRxrTCPPort)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrUDPPort(int port) {
|
||||
LOG(logINFO) << "Setting Receiver UDP Port:" << port;
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP Port:" << port;
|
||||
try {
|
||||
det->setRxPort(port, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver UDP port.",
|
||||
"qTabAdvanced::SetRxrUDPPort", this,
|
||||
&qTabAdvanced::GetRxrUDPPort)
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP port.",
|
||||
"qTabAdvanced::SetRxrUDPPort", this,
|
||||
&qTabAdvanced::GetRxrUDPPort)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrUDPIP() {
|
||||
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
||||
LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||
try {
|
||||
det->setDestinationUDPIP(sls::IpAddr{s},
|
||||
{comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver UDP IP.", "qTabAdvanced::SetRxrUDPIP",
|
||||
this, &qTabAdvanced::GetRxrUDPIP)
|
||||
det->setDestinationUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP IP.",
|
||||
"qTabAdvanced::SetRxrUDPIP", this,
|
||||
&qTabAdvanced::GetRxrUDPIP)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrUDPMAC() {
|
||||
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
||||
LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||
try {
|
||||
det->setDestinationUDPMAC(sls::MacAddr{s},
|
||||
{comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver UDP MAC.",
|
||||
"qTabAdvanced::SetRxrUDPMAC", this,
|
||||
&qTabAdvanced::GetRxrUDPMAC)
|
||||
det->setDestinationUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP MAC.",
|
||||
"qTabAdvanced::SetRxrUDPMAC", this,
|
||||
&qTabAdvanced::GetRxrUDPMAC)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrZMQPort(int port) {
|
||||
LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
|
||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
|
||||
try {
|
||||
det->setRxZmqPort(port, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver ZMQ port.",
|
||||
"qTabAdvanced::SetRxrZMQPort", this,
|
||||
&qTabAdvanced::GetRxrZMQPort)
|
||||
} CATCH_HANDLE ("Could not set Receiver ZMQ port.",
|
||||
"qTabAdvanced::SetRxrZMQPort", this,
|
||||
&qTabAdvanced::GetRxrZMQPort)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrZMQIP() {
|
||||
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
||||
LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||
try {
|
||||
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver ZMQ IP.", "qTabAdvanced::SetRxrZMQIP",
|
||||
this, &qTabAdvanced::GetRxrZMQIP)
|
||||
} CATCH_HANDLE ("Could not set Receiver ZMQ IP.",
|
||||
"qTabAdvanced::SetRxrZMQIP", this,
|
||||
&qTabAdvanced::GetRxrZMQIP)
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetROI() {
|
||||
LOG(logDEBUG) << "Getting ROI";
|
||||
FILE_LOG(logDEBUG) << "Getting ROI";
|
||||
try {
|
||||
slsDetectorDefs::ROI roi =
|
||||
det->getROI({comboReadout->currentIndex()})[0];
|
||||
slsDetectorDefs::ROI roi = det->getROI({comboReadout->currentIndex()})[0];
|
||||
spinXmin->setValue(roi.xmin);
|
||||
spinXmax->setValue(roi.xmax);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get ROI.", "qTabAdvanced::GetROI")
|
||||
spinXmax->setValue(roi.xmax);
|
||||
} CATCH_DISPLAY ("Could not get ROI.", "qTabAdvanced::GetROI")
|
||||
}
|
||||
|
||||
void qTabAdvanced::ClearROI() {
|
||||
LOG(logINFO) << "Clearing ROI";
|
||||
FILE_LOG(logINFO) << "Clearing ROI";
|
||||
spinXmin->setValue(-1);
|
||||
spinXmax->setValue(-1);
|
||||
spinXmax->setValue(-1);
|
||||
SetROI();
|
||||
LOG(logDEBUG) << "ROIs cleared";
|
||||
FILE_LOG(logDEBUG) << "ROIs cleared";
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetROI() {
|
||||
@ -531,27 +491,25 @@ void qTabAdvanced::SetROI() {
|
||||
roi.xmax = spinXmax->value();
|
||||
|
||||
// set roi
|
||||
LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax
|
||||
<< "]";
|
||||
FILE_LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
|
||||
try {
|
||||
det->setROI(roi, {comboReadout->currentIndex()});
|
||||
}
|
||||
CATCH_DISPLAY("Could not set these ROIs.", "qTabAdvanced::SetROI")
|
||||
} CATCH_DISPLAY ("Could not set these ROIs.",
|
||||
"qTabAdvanced::SetROI")
|
||||
|
||||
// update corrected list
|
||||
GetROI();
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetAllTrimbits() {
|
||||
LOG(logDEBUG) << "Getting all trimbits value";
|
||||
FILE_LOG(logDEBUG) << "Getting all trimbits value";
|
||||
disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetAllTrimbits()));
|
||||
|
||||
try {
|
||||
int retval = det->getAllTrimbits().squash(-1);
|
||||
spinSetAllTrimbits->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
|
||||
} CATCH_DISPLAY ("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
|
||||
|
||||
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetAllTrimbits()));
|
||||
@ -559,58 +517,55 @@ void qTabAdvanced::GetAllTrimbits() {
|
||||
|
||||
void qTabAdvanced::SetAllTrimbits() {
|
||||
int value = spinSetAllTrimbits->value();
|
||||
LOG(logINFO) << "Setting all trimbits:" << value;
|
||||
FILE_LOG(logINFO) << "Setting all trimbits:" << value;
|
||||
|
||||
try {
|
||||
det->setAllTrimbits(value);
|
||||
}
|
||||
CATCH_HANDLE("Could not set all trimbits.", "qTabAdvanced::SetAllTrimbits",
|
||||
} CATCH_HANDLE("Could not set all trimbits.", "qTabAdvanced::SetAllTrimbits",
|
||||
this, &qTabAdvanced::GetAllTrimbits)
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetNumStoragecells() {
|
||||
LOG(logDEBUG) << "Getting number of additional storage cells";
|
||||
FILE_LOG(logDEBUG) << "Getting number of additional storage cells";
|
||||
disconnect(spinNumStoragecells, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumStoragecells(int)));
|
||||
|
||||
try {
|
||||
auto retval = det->getNumberOfAdditionalStorageCells().tsquash(
|
||||
"Inconsistent values for number of addditional storage cells.");
|
||||
auto retval = det->getNumberOfAdditionalStorageCells().tsquash("Inconsistent values for number of addditional storage cells.");
|
||||
spinNumStoragecells->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get number of additional storage cells.",
|
||||
"qTabAdvanced::GetNumStoragecells")
|
||||
} CATCH_DISPLAY (
|
||||
"Could not get number of additional storage cells.",
|
||||
"qTabAdvanced::GetNumStoragecells")
|
||||
|
||||
connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumStoragecells(int)));
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetNumStoragecells(int value) {
|
||||
LOG(logINFO) << "Setting number of additional stoarge cells: "
|
||||
FILE_LOG(logINFO) << "Setting number of additional stoarge cells: "
|
||||
<< value;
|
||||
try {
|
||||
det->setNumberOfAdditionalStorageCells(value);
|
||||
}
|
||||
CATCH_HANDLE("Could not set number of additional storage cells.",
|
||||
"qTabAdvanced::SetNumStoragecells", this,
|
||||
&qTabAdvanced::GetNumStoragecells)
|
||||
} CATCH_HANDLE (
|
||||
"Could not set number of additional storage cells.",
|
||||
"qTabAdvanced::SetNumStoragecells", this,
|
||||
&qTabAdvanced::GetNumStoragecells)
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetSubExposureTime() {
|
||||
LOG(logDEBUG) << "Getting sub exposure time";
|
||||
FILE_LOG(logDEBUG) << "Getting sub exposure time";
|
||||
disconnect(spinSubExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetSubExposureTime()));
|
||||
disconnect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSubExposureTime()));
|
||||
try {
|
||||
auto retval = det->getSubExptime().tsquash(
|
||||
"Subexptime is inconsistent for all detectors.");
|
||||
auto retval =
|
||||
det->getSubExptime().tsquash("Subexptime is inconsistent for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinSubExpTime->setValue(time.first);
|
||||
comboSubExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get sub exposure time.",
|
||||
"qTabSettings::GetSubExposureTime")
|
||||
} CATCH_DISPLAY ("Could not get sub exposure time.",
|
||||
"qTabSettings::GetSubExposureTime")
|
||||
connect(spinSubExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetSubExposureTime()));
|
||||
connect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
@ -618,38 +573,34 @@ void qTabAdvanced::GetSubExposureTime() {
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetSubExposureTime() {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||
spinSubExpTime->value(),
|
||||
static_cast<qDefs::timeUnit>(comboSubExpTimeUnit->currentIndex())));
|
||||
LOG(logINFO)
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(spinSubExpTime->value(), static_cast<qDefs::timeUnit>(comboSubExpTimeUnit->currentIndex())));
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting sub frame acquisition time to " << timeNS.count() << " ns"
|
||||
<< "/" << spinSubExpTime->value()
|
||||
<< qDefs::getUnitString(
|
||||
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex());
|
||||
try {
|
||||
det->setSubExptime(timeNS);
|
||||
}
|
||||
CATCH_DISPLAY("Could not set sub exposure time.",
|
||||
"qTabAdvanced::SetSubExposureTime")
|
||||
} CATCH_DISPLAY ("Could not set sub exposure time.",
|
||||
"qTabAdvanced::SetSubExposureTime")
|
||||
|
||||
GetSubExposureTime();
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetSubDeadTime() {
|
||||
LOG(logDEBUG) << "Getting sub dead time";
|
||||
FILE_LOG(logDEBUG) << "Getting sub dead time";
|
||||
disconnect(spinSubDeadTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetSubDeadTime()));
|
||||
disconnect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSubDeadTime()));
|
||||
try {
|
||||
auto retval = det->getSubDeadTime().tsquash(
|
||||
"Sub dead time is inconsistent for all detectors.");
|
||||
auto retval = det->getSubDeadTime().tsquash("Sub dead time is inconsistent for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinSubDeadTime->setValue(time.first);
|
||||
comboSubDeadTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get sub dead time.",
|
||||
"qTabSettings::GetSubDeadTime")
|
||||
comboSubDeadTimeUnit->setCurrentIndex(
|
||||
static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get sub dead time.",
|
||||
"qTabSettings::GetSubDeadTime")
|
||||
connect(spinSubDeadTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetSubDeadTime()));
|
||||
connect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
@ -657,25 +608,22 @@ void qTabAdvanced::GetSubDeadTime() {
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetSubDeadTime() {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||
spinSubDeadTime->value(),
|
||||
static_cast<qDefs::timeUnit>(comboSubDeadTimeUnit->currentIndex())));
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(spinSubDeadTime->value(), static_cast<qDefs::timeUnit>(comboSubDeadTimeUnit->currentIndex())));
|
||||
|
||||
LOG(logINFO)
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting sub frame dead time to " << timeNS.count() << " ns"
|
||||
<< "/" << spinSubDeadTime->value()
|
||||
<< qDefs::getUnitString(
|
||||
(qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex());
|
||||
try {
|
||||
det->setSubDeadTime(timeNS);
|
||||
}
|
||||
CATCH_DISPLAY("Could not set sub dead time.",
|
||||
"qTabAdvanced::SetSubDeadTime")
|
||||
} CATCH_DISPLAY ("Could not set sub dead time.",
|
||||
"qTabAdvanced::SetSubDeadTime")
|
||||
GetSubDeadTime();
|
||||
}
|
||||
|
||||
void qTabAdvanced::Refresh() {
|
||||
LOG(logDEBUG) << "**Updating Advanced Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updating Advanced Tab";
|
||||
|
||||
// trimming
|
||||
if (tab_trimming->isEnabled()) {
|
||||
@ -701,5 +649,5 @@ void qTabAdvanced::Refresh() {
|
||||
GetSubDeadTime();
|
||||
}
|
||||
|
||||
LOG(logDEBUG) << "**Updated Advanced Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updated Advanced Tab";
|
||||
}
|
||||
|
590
slsDetectorGui/src/qTabDataOutput.cpp
Normal file → Executable file
590
slsDetectorGui/src/qTabDataOutput.cpp
Normal file → Executable file
@ -1,431 +1,343 @@
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QFileDialog>
|
||||
#include <QStandardItemModel>
|
||||
#include <QButtonGroup>
|
||||
#include <QString>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector)
|
||||
: QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
LOG(logDEBUG) << "DataOutput ready";
|
||||
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "DataOutput ready";
|
||||
}
|
||||
|
||||
qTabDataOutput::~qTabDataOutput() { delete btnGroupRate; }
|
||||
qTabDataOutput::~qTabDataOutput() {
|
||||
if (btnGroupRate)
|
||||
delete btnGroupRate;
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetupWidgetWindow() {
|
||||
// button group for rate
|
||||
btnGroupRate = new QButtonGroup(this);
|
||||
btnGroupRate->addButton(radioDefaultDeadtime, 0);
|
||||
btnGroupRate->addButton(radioCustomDeadtime, 1);
|
||||
// button group for rate
|
||||
btnGroupRate = new QButtonGroup(this);
|
||||
btnGroupRate->addButton(radioDefaultDeadtime, 0);
|
||||
btnGroupRate->addButton(radioCustomDeadtime, 1);
|
||||
|
||||
// enabling according to det type
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkTenGiga->setEnabled(true);
|
||||
chkRate->setEnabled(true);
|
||||
radioDefaultDeadtime->setEnabled(true);
|
||||
radioCustomDeadtime->setEnabled(true);
|
||||
// flags and speed
|
||||
widgetEiger->setVisible(true);
|
||||
widgetEiger->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
chkTenGiga->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
PopulateDetectors();
|
||||
// enabling according to det type
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkTenGiga->setEnabled(true);
|
||||
chkRate->setEnabled(true);
|
||||
radioDefaultDeadtime->setEnabled(true);
|
||||
radioCustomDeadtime->setEnabled(true);
|
||||
// flags and speed
|
||||
widgetEiger->setVisible(true);
|
||||
widgetEiger->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
chkTenGiga->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
PopulateDetectors();
|
||||
|
||||
Initialization();
|
||||
Initialization();
|
||||
|
||||
Refresh();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void qTabDataOutput::Initialization() {
|
||||
// ourdir, fileformat, overwrite enable
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetOutputDir()));
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetOutputDir()));
|
||||
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir()));
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFileFormat(int)));
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetOverwriteEnable(bool)));
|
||||
if (chkTenGiga->isEnabled()) {
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
// rate
|
||||
if (chkRate->isEnabled()) {
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this,
|
||||
SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
}
|
||||
// flags, speed
|
||||
if (widgetEiger->isEnabled()) {
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSpeed(int)));
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFlags()));
|
||||
}
|
||||
// ourdir, fileformat, overwrite enable
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir()));
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir()));
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
if (chkTenGiga->isEnabled()) {
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
// rate
|
||||
if (chkRate->isEnabled()) {
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
}
|
||||
// flags, speed
|
||||
if (widgetEiger->isEnabled()) {
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::PopulateDetectors() {
|
||||
LOG(logDEBUG) << "Populating detectors";
|
||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||
|
||||
comboDetector->clear();
|
||||
comboDetector->addItem("All");
|
||||
if (det->size() > 1) {
|
||||
auto res = det->getHostname();
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
}
|
||||
}
|
||||
comboDetector->clear();
|
||||
comboDetector->addItem("All");
|
||||
if (det->size() > 1) {
|
||||
auto res = det->getHostname();
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::EnableBrowse() {
|
||||
LOG(logDEBUG) << "Getting browse enable";
|
||||
try {
|
||||
btnOutputBrowse->setEnabled(false); // exception default
|
||||
std::string rxHostname =
|
||||
det->getRxHostname({comboDetector->currentIndex() - 1})
|
||||
.squash("none");
|
||||
if (rxHostname == "none") {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
} else if (rxHostname == "localhost") {
|
||||
btnOutputBrowse->setEnabled(true);
|
||||
} else {
|
||||
std::string hostname;
|
||||
const size_t len = 15;
|
||||
char host[len]{};
|
||||
if (gethostname(host, len) == 0) {
|
||||
hostname.assign(host);
|
||||
}
|
||||
// client pc (hostname) same as reciever hostname
|
||||
if (hostname == rxHostname) {
|
||||
btnOutputBrowse->setEnabled(true);
|
||||
} else {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver hostname.",
|
||||
"qTabDataOutput::EnableBrowse")
|
||||
FILE_LOG(logDEBUG) << "Getting browse enable";
|
||||
try {
|
||||
btnOutputBrowse->setEnabled(false); // exception default
|
||||
std::string rxHostname = det->getRxHostname({comboDetector->currentIndex() - 1}).squash("none");
|
||||
if (rxHostname == "none") {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
} else if (rxHostname == "localhost") {
|
||||
btnOutputBrowse->setEnabled(true);
|
||||
} else {
|
||||
std::string hostname;
|
||||
const size_t len = 15;
|
||||
char host[len]{};
|
||||
if (gethostname(host, len) == 0) {
|
||||
hostname.assign(host);
|
||||
}
|
||||
// client pc (hostname) same as reciever hostname
|
||||
if (hostname == rxHostname) {
|
||||
btnOutputBrowse->setEnabled(true);
|
||||
} else {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
}
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get receiver hostname.", "qTabDataOutput::EnableBrowse")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileWrite() {
|
||||
LOG(logDEBUG) << "Getting file write enable";
|
||||
try {
|
||||
boxFileWriteEnabled->setEnabled(true); // exception default
|
||||
auto retval = det->getFileWrite().tsquash(
|
||||
"File write is inconsistent for all detectors.");
|
||||
boxFileWriteEnabled->setEnabled(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file enable.", "qTabDataOutput::GetFileWrite")
|
||||
FILE_LOG(logDEBUG) << "Getting file write enable";
|
||||
try {
|
||||
boxFileWriteEnabled->setEnabled(true); // exception default
|
||||
auto retval = det->getFileWrite().tsquash("File write is inconsistent for all detectors.");
|
||||
boxFileWriteEnabled->setEnabled(retval);
|
||||
} CATCH_DISPLAY("Could not get file enable.", "qTabDataOutput::GetFileWrite")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileName() {
|
||||
LOG(logDEBUG) << "Getting file name";
|
||||
try {
|
||||
auto retval = det->getFileNamePrefix().tsquash(
|
||||
"File name is inconsistent for all detectors.");
|
||||
dispFileName->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file name prefix.",
|
||||
"qTabDataOutput::GetFileName")
|
||||
FILE_LOG(logDEBUG) << "Getting file name";
|
||||
try {
|
||||
auto retval = det->getFileNamePrefix().tsquash("File name is inconsistent for all detectors.");
|
||||
dispFileName->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get file name prefix.", "qTabDataOutput::GetFileName")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetOutputDir() {
|
||||
LOG(logDEBUG) << "Getting file path";
|
||||
disconnect(dispOutputDir, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetOutputDir()));
|
||||
try {
|
||||
std::string path =
|
||||
det->getFilePath({comboDetector->currentIndex() - 1})
|
||||
.tsquash("File path is different for all detectors.");
|
||||
dispOutputDir->setText(QString(path.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file path.", "qTabDataOutput::GetOutputDir")
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetOutputDir()));
|
||||
FILE_LOG(logDEBUG) << "Getting file path";
|
||||
disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
try {
|
||||
std::string path = det->getFilePath({comboDetector->currentIndex() - 1}).tsquash("File path is different for all detectors.");
|
||||
dispOutputDir->setText(QString(path.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get file path.", "qTabDataOutput::GetOutputDir")
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
}
|
||||
|
||||
void qTabDataOutput::BrowseOutputDir() {
|
||||
LOG(logDEBUG) << "Browsing output directory";
|
||||
QString directory = QFileDialog::getExistingDirectory(
|
||||
this, tr("Choose Output Directory "), dispOutputDir->text());
|
||||
if (!directory.isEmpty())
|
||||
dispOutputDir->setText(directory);
|
||||
FILE_LOG(logDEBUG) << "Browsing output directory";
|
||||
QString directory = QFileDialog::getExistingDirectory(this, tr("Choose Output Directory "), dispOutputDir->text());
|
||||
if (!directory.isEmpty())
|
||||
dispOutputDir->setText(directory);
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetOutputDir() {
|
||||
QString path = dispOutputDir->text();
|
||||
LOG(logDEBUG) << "Setting output directory to "
|
||||
<< path.toAscii().constData();
|
||||
QString path = dispOutputDir->text();
|
||||
FILE_LOG(logDEBUG) << "Setting output directory to " << path.toAscii().constData();
|
||||
|
||||
// empty
|
||||
if (path.isEmpty()) {
|
||||
qDefs::Message(qDefs::WARNING,
|
||||
"Invalid Output Path. Must not be empty.",
|
||||
"qTabDataOutput::SetOutputDir");
|
||||
LOG(logWARNING) << "Invalid Output Path. Must not be empty.";
|
||||
GetOutputDir();
|
||||
} else {
|
||||
// chop off trailing '/'
|
||||
if (path.endsWith('/')) {
|
||||
while (path.endsWith('/')) {
|
||||
path.chop(1);
|
||||
}
|
||||
}
|
||||
std::string spath = std::string(path.toAscii().constData());
|
||||
try {
|
||||
det->setFilePath(spath, {comboDetector->currentIndex() - 1});
|
||||
}
|
||||
CATCH_HANDLE("Could not set output file path.",
|
||||
"qTabDataOutput::SetOutputDir", this,
|
||||
&qTabDataOutput::GetOutputDir)
|
||||
}
|
||||
// empty
|
||||
if (path.isEmpty()) {
|
||||
qDefs::Message(qDefs::WARNING, "Invalid Output Path. Must not be empty.", "qTabDataOutput::SetOutputDir");
|
||||
FILE_LOG(logWARNING) << "Invalid Output Path. Must not be empty.";
|
||||
GetOutputDir();
|
||||
} else {
|
||||
// chop off trailing '/'
|
||||
if (path.endsWith('/')) {
|
||||
while (path.endsWith('/')) {
|
||||
path.chop(1);
|
||||
}
|
||||
}
|
||||
std::string spath = std::string(path.toAscii().constData());
|
||||
try {
|
||||
det->setFilePath(spath, {comboDetector->currentIndex() - 1});
|
||||
} CATCH_HANDLE ("Could not set output file path.", "qTabDataOutput::SetOutputDir", this, &qTabDataOutput::GetOutputDir)
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileFormat() {
|
||||
LOG(logDEBUG) << "Getting File Format";
|
||||
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFileFormat(int)));
|
||||
try {
|
||||
auto retval = det->getFileFormat().tsquash(
|
||||
"File format is inconsistent for all detectors.");
|
||||
switch (retval) {
|
||||
case slsDetectorDefs::BINARY:
|
||||
case slsDetectorDefs::HDF5:
|
||||
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown file format: ") +
|
||||
std::to_string(static_cast<int>(retval)));
|
||||
FILE_LOG(logDEBUG) << "Getting File Format";
|
||||
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
try {
|
||||
auto retval = det->getFileFormat().tsquash("File format is inconsistent for all detectors.");
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::BINARY:
|
||||
case slsDetectorDefs::HDF5:
|
||||
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown file format: ") + std::to_string(static_cast<int>(retval)));
|
||||
}
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file format.", "qTabDataOutput::GetFileFormat")
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFileFormat(int)));
|
||||
} CATCH_DISPLAY("Could not get file format.", "qTabDataOutput::GetFileFormat")
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetFileFormat(int format) {
|
||||
LOG(logINFO) << "Setting File Format to "
|
||||
<< comboFileFormat->currentText().toAscii().data();
|
||||
try {
|
||||
det->setFileFormat(static_cast<slsDetectorDefs::fileFormat>(
|
||||
comboFileFormat->currentIndex()));
|
||||
}
|
||||
CATCH_HANDLE("Could not set file format.", "qTabDataOutput::SetFileFormat",
|
||||
this, &qTabDataOutput::GetFileFormat)
|
||||
FILE_LOG(logINFO) << "Setting File Format to " << comboFileFormat->currentText().toAscii().data();
|
||||
try {
|
||||
det->setFileFormat(static_cast<slsDetectorDefs::fileFormat>(comboFileFormat->currentIndex()));
|
||||
} CATCH_HANDLE ("Could not set file format.", "qTabDataOutput::SetFileFormat", this, &qTabDataOutput::GetFileFormat)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileOverwrite() {
|
||||
LOG(logDEBUG) << "Getting File Over Write Enable";
|
||||
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetOverwriteEnable(bool)));
|
||||
try {
|
||||
auto retval = det->getFileOverWrite().tsquash(
|
||||
"File over write is inconsistent for all detectors.");
|
||||
chkOverwriteEnable->setChecked(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file over write enable.",
|
||||
"qTabDataOutput::GetFileOverwrite")
|
||||
FILE_LOG(logDEBUG) << "Getting File Over Write Enable";
|
||||
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
try {
|
||||
auto retval = det->getFileOverWrite().tsquash("File over write is inconsistent for all detectors.");
|
||||
chkOverwriteEnable->setChecked(retval);
|
||||
} CATCH_DISPLAY ("Could not get file over write enable.", "qTabDataOutput::GetFileOverwrite")
|
||||
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetOverwriteEnable(bool)));
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetOverwriteEnable(bool enable) {
|
||||
LOG(logINFO) << "Setting File Over Write Enable to " << enable;
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting File Over Write Enable to " << enable;
|
||||
try {
|
||||
det->setFileOverWrite(enable);
|
||||
}
|
||||
CATCH_HANDLE("Could not set file over write enable.",
|
||||
"qTabDataOutput::SetOverwriteEnable", this,
|
||||
&qTabDataOutput::GetFileOverwrite)
|
||||
} CATCH_HANDLE ("Could not set file over write enable.", "qTabDataOutput::SetOverwriteEnable", this, &qTabDataOutput::GetFileOverwrite)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetTenGigaEnable() {
|
||||
LOG(logDEBUG) << "Getting 10GbE enable";
|
||||
disconnect(chkTenGiga, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetTenGigaEnable(bool)));
|
||||
try {
|
||||
auto retval = det->getTenGiga().tsquash(
|
||||
"10GbE enable is inconsistent for all detectors.");
|
||||
chkTenGiga->setChecked(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get 10GbE enable.",
|
||||
"qTabDataOutput::GetTenGigaEnable")
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetTenGigaEnable(bool)));
|
||||
FILE_LOG(logDEBUG) << "Getting 10GbE enable";
|
||||
disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
try {
|
||||
auto retval = det->getTenGiga().tsquash("10GbE enable is inconsistent for all detectors.");
|
||||
chkTenGiga->setChecked(retval);
|
||||
} CATCH_DISPLAY ("Could not get 10GbE enable.", "qTabDataOutput::GetTenGigaEnable")
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetTenGigaEnable(bool enable) {
|
||||
LOG(logINFO) << "Setting 10GbE to " << enable;
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting 10GbE to " << enable;
|
||||
try {
|
||||
det->setTenGiga(enable);
|
||||
}
|
||||
CATCH_HANDLE("Could not set 10GbE enable.",
|
||||
"qTabDataOutput::SetTenGigaEnable", this,
|
||||
&qTabDataOutput::GetTenGigaEnable)
|
||||
} CATCH_HANDLE ("Could not set 10GbE enable.", "qTabDataOutput::SetTenGigaEnable", this, &qTabDataOutput::GetTenGigaEnable)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetRateCorrection() {
|
||||
LOG(logDEBUG) << "Getting Rate Correction";
|
||||
disconnect(chkRate, SIGNAL(toggled(bool)), this,
|
||||
SLOT(EnableRateCorrection()));
|
||||
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
try {
|
||||
spinCustomDeadTime->setValue(-1);
|
||||
int64_t retval = det->getRateCorrection()
|
||||
.tsquash("Rate correction (enable/tau) is "
|
||||
"inconsistent for all detectors.")
|
||||
.count();
|
||||
chkRate->setChecked(retval == 0 ? false : true);
|
||||
if (retval != 0)
|
||||
spinCustomDeadTime->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get rate correction.",
|
||||
"qTabDataOutput::GetRateCorrection")
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
FILE_LOG(logDEBUG) << "Getting Rate Correction";
|
||||
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
try {
|
||||
spinCustomDeadTime->setValue(-1);
|
||||
int64_t retval = det->getRateCorrection().tsquash("Rate correction (enable/tau) is inconsistent for all detectors.").count();
|
||||
chkRate->setChecked(retval == 0 ? false : true);
|
||||
if (retval != 0)
|
||||
spinCustomDeadTime->setValue(retval);
|
||||
} CATCH_DISPLAY("Could not get rate correction.", "qTabDataOutput::GetRateCorrection")
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
}
|
||||
|
||||
void qTabDataOutput::EnableRateCorrection() {
|
||||
// enable
|
||||
if (chkRate->isChecked()) {
|
||||
SetRateCorrection();
|
||||
return;
|
||||
}
|
||||
LOG(logINFO) << "Disabling Rate correction";
|
||||
// disable
|
||||
try {
|
||||
det->setRateCorrection(sls::ns(0));
|
||||
}
|
||||
CATCH_HANDLE("Could not switch off rate correction.",
|
||||
"qTabDataOutput::EnableRateCorrection", this,
|
||||
&qTabDataOutput::GetRateCorrection)
|
||||
// enable
|
||||
if (chkRate->isChecked()) {
|
||||
SetRateCorrection();
|
||||
return;
|
||||
}
|
||||
FILE_LOG(logINFO) << "Disabling Rate correction";
|
||||
// disable
|
||||
try {
|
||||
det->setRateCorrection(sls::ns(0));
|
||||
} CATCH_HANDLE ("Could not switch off rate correction.", "qTabDataOutput::EnableRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetRateCorrection() {
|
||||
// do nothing if rate correction is disabled
|
||||
if (!chkRate->isChecked()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// custom dead time
|
||||
if (radioCustomDeadtime->isChecked()) {
|
||||
int64_t deadtime = spinCustomDeadTime->value();
|
||||
LOG(logINFO)
|
||||
<< "Setting Rate Correction with custom dead time: "
|
||||
<< deadtime;
|
||||
det->setRateCorrection(sls::ns(deadtime));
|
||||
}
|
||||
// default dead time
|
||||
else {
|
||||
LOG(logINFO)
|
||||
<< "Setting Rate Correction with default dead time";
|
||||
det->setDefaultRateCorrection();
|
||||
}
|
||||
}
|
||||
CATCH_HANDLE("Could not set rate correction.",
|
||||
"qTabDataOutput::SetRateCorrection", this,
|
||||
&qTabDataOutput::GetRateCorrection)
|
||||
// do nothing if rate correction is disabled
|
||||
if (!chkRate->isChecked()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// custom dead time
|
||||
if (radioCustomDeadtime->isChecked()) {
|
||||
int64_t deadtime = spinCustomDeadTime->value();
|
||||
FILE_LOG(logINFO) << "Setting Rate Correction with custom dead time: " << deadtime;
|
||||
det->setRateCorrection(sls::ns(deadtime));
|
||||
}
|
||||
// default dead time
|
||||
else {
|
||||
FILE_LOG(logINFO) << "Setting Rate Correction with default dead time";
|
||||
det->setDefaultRateCorrection();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set rate correction.", "qTabDataOutput::SetRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetSpeed() {
|
||||
LOG(logDEBUG) << "Getting Speed";
|
||||
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSpeed(int)));
|
||||
try {
|
||||
auto retval =
|
||||
det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
|
||||
comboEigerClkDivider->setCurrentIndex(static_cast<int>(retval));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSpeed(int)));
|
||||
FILE_LOG(logDEBUG) << "Getting Speed";
|
||||
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
try {
|
||||
auto retval = det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
|
||||
comboEigerClkDivider->setCurrentIndex(static_cast<int>(retval));
|
||||
} CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetSpeed(int speed) {
|
||||
LOG(logINFO) << "Setting Speed to "
|
||||
<< comboEigerClkDivider->currentText().toAscii().data();
|
||||
;
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting Speed to " << comboEigerClkDivider->currentText().toAscii().data();;
|
||||
try {
|
||||
det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
|
||||
}
|
||||
CATCH_HANDLE("Could not set speed.", "qTabDataOutput::SetSpeed", this,
|
||||
&qTabDataOutput::GetSpeed)
|
||||
} CATCH_HANDLE ("Could not set speed.", "qTabDataOutput::SetSpeed", this, &qTabDataOutput::GetSpeed)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFlags() {
|
||||
LOG(logDEBUG) << "Getting readout flags";
|
||||
disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFlags()));
|
||||
try {
|
||||
auto retval = det->getParallelMode().tsquash(
|
||||
"Parallel Flag is inconsistent for all detectors.");
|
||||
// parallel or non parallel
|
||||
if (retval)
|
||||
comboEigerParallelFlag->setCurrentIndex(PARALLEL);
|
||||
else
|
||||
comboEigerParallelFlag->setCurrentIndex(NONPARALLEL);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get flags.", "qTabDataOutput::GetFlags")
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFlags()));
|
||||
FILE_LOG(logDEBUG) << "Getting readout flags";
|
||||
disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
try {
|
||||
auto retval = det->getParallelMode().tsquash("Parallel Flag is inconsistent for all detectors.");
|
||||
// parallel or non parallel
|
||||
if (retval)
|
||||
comboEigerParallelFlag->setCurrentIndex(PARALLEL);
|
||||
else
|
||||
comboEigerParallelFlag->setCurrentIndex(NONPARALLEL);
|
||||
} CATCH_DISPLAY ("Could not get flags.", "qTabDataOutput::GetFlags")
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::SetFlags() {
|
||||
auto mode =
|
||||
comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
|
||||
try {
|
||||
LOG(logINFO)
|
||||
<< "Setting Readout Flags to "
|
||||
<< comboEigerParallelFlag->currentText().toAscii().data();
|
||||
det->setParallelMode(mode);
|
||||
}
|
||||
CATCH_HANDLE("Could not set readout flags.", "qTabDataOutput::SetFlags",
|
||||
this, &qTabDataOutput::GetFlags)
|
||||
auto mode = comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerParallelFlag->currentText().toAscii().data();
|
||||
det->setParallelMode(mode);
|
||||
} CATCH_HANDLE ("Could not set readout flags.", "qTabDataOutput::SetFlags", this, &qTabDataOutput::GetFlags)
|
||||
}
|
||||
|
||||
void qTabDataOutput::Refresh() {
|
||||
LOG(logDEBUG) << "**Updating DataOutput Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updating DataOutput Tab";
|
||||
|
||||
EnableBrowse();
|
||||
GetFileWrite();
|
||||
GetFileName();
|
||||
GetOutputDir();
|
||||
GetFileOverwrite();
|
||||
GetFileFormat();
|
||||
if (chkRate->isEnabled()) {
|
||||
GetRateCorrection();
|
||||
}
|
||||
if (chkTenGiga->isEnabled()) {
|
||||
GetTenGigaEnable();
|
||||
}
|
||||
if (widgetEiger->isEnabled()) {
|
||||
GetSpeed();
|
||||
GetFlags();
|
||||
}
|
||||
EnableBrowse();
|
||||
GetFileWrite();
|
||||
GetFileName();
|
||||
GetOutputDir();
|
||||
GetFileOverwrite();
|
||||
GetFileFormat();
|
||||
if (chkRate->isEnabled()) {
|
||||
GetRateCorrection();
|
||||
}
|
||||
if (chkTenGiga->isEnabled()) {
|
||||
GetTenGigaEnable();
|
||||
}
|
||||
if (widgetEiger->isEnabled()) {
|
||||
GetSpeed();
|
||||
GetFlags();
|
||||
}
|
||||
|
||||
LOG(logDEBUG) << "**Updated DataOutput Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updated DataOutput Tab";
|
||||
}
|
||||
|
158
slsDetectorGui/src/qTabDebugging.cpp
Normal file → Executable file
158
slsDetectorGui/src/qTabDebugging.cpp
Normal file → Executable file
@ -1,28 +1,35 @@
|
||||
#include "qTabDebugging.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include "ToString.h"
|
||||
|
||||
#include <QDesktopWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QTreeWidget>
|
||||
|
||||
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector)
|
||||
: QWidget(parent), det(detector), treeDet(nullptr),
|
||||
lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr),
|
||||
lblDetectorSoftware(nullptr) {
|
||||
#include <iostream>
|
||||
|
||||
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector) :
|
||||
QWidget(parent), det(detector), treeDet(nullptr), lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr), lblDetectorSoftware(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
LOG(logDEBUG) << "Debugging ready";
|
||||
FILE_LOG(logDEBUG) << "Debugging ready";
|
||||
}
|
||||
|
||||
qTabDebugging::~qTabDebugging() {
|
||||
delete treeDet;
|
||||
delete lblDetectorHostname;
|
||||
delete lblDetectorFirmware;
|
||||
delete lblDetectorSoftware;
|
||||
if (treeDet)
|
||||
delete treeDet;
|
||||
if (lblDetectorHostname)
|
||||
delete lblDetectorHostname;
|
||||
if (lblDetectorFirmware)
|
||||
delete lblDetectorFirmware;
|
||||
if (lblDetectorSoftware)
|
||||
delete lblDetectorSoftware;
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::SetupWidgetWindow() {
|
||||
// enabling according to det type
|
||||
// enabling according to det type
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
lblDetector->setText("Half Module:");
|
||||
chkDetectorFirmware->setEnabled(false);
|
||||
@ -37,19 +44,19 @@ void qTabDebugging::SetupWidgetWindow() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::Initialization() {
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetDetectorStatus()));
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetDetectorStatus()));
|
||||
connect(btnGetInfo, SIGNAL(clicked()), this, SLOT(GetInfo()));
|
||||
if (btnTest->isEnabled()) {
|
||||
connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector()));
|
||||
if (btnTest ->isEnabled()) {
|
||||
connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector()));
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDebugging::PopulateDetectors() {
|
||||
LOG(logDEBUG) << "Populating detectors";
|
||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||
|
||||
comboDetector->clear();
|
||||
comboDetector->clear();
|
||||
auto res = det->getHostname();
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
@ -57,19 +64,17 @@ void qTabDebugging::PopulateDetectors() {
|
||||
}
|
||||
|
||||
void qTabDebugging::GetDetectorStatus() {
|
||||
LOG(logDEBUG) << "Getting Status";
|
||||
FILE_LOG(logDEBUG) << "Getting Status";
|
||||
|
||||
try {
|
||||
std::string status = sls::ToString(
|
||||
det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||
try {
|
||||
std::string status = sls::ToString(det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector status.",
|
||||
"qTabDebugging::GetDetectorStatus")
|
||||
} CATCH_DISPLAY ("Could not get detector status.", "qTabDebugging::GetDetectorStatus")
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::GetInfo() {
|
||||
LOG(logDEBUG) << "Getting Readout Info";
|
||||
FILE_LOG(logDEBUG) << "Getting Readout Info";
|
||||
|
||||
// open info in a new popup
|
||||
QFrame *popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow);
|
||||
@ -82,83 +87,67 @@ void qTabDebugging::GetInfo() {
|
||||
lblDetectorHostname = new QLabel("");
|
||||
lblDetectorFirmware = new QLabel("");
|
||||
lblDetectorSoftware = new QLabel("");
|
||||
// to make sure the size is constant
|
||||
//to make sure the size is constant
|
||||
lblDetectorFirmware->setFixedWidth(100);
|
||||
layout->addWidget(dispFrame, 0, 1);
|
||||
QString detName =
|
||||
QString(sls::ToString(det->getDetectorType().squash()).c_str());
|
||||
QString detName = QString(sls::ToString(det->getDetectorType().squash()).c_str());
|
||||
|
||||
switch (det->getDetectorType().squash()) {
|
||||
|
||||
case slsDetectorDefs::EIGER:
|
||||
formLayout->addWidget(new QLabel("Half Module:"), 0, 0);
|
||||
formLayout->addItem(
|
||||
new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0,
|
||||
1);
|
||||
formLayout->addItem(new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 1);
|
||||
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
||||
formLayout->addWidget(new QLabel("Half Module Firmware Version:"), 1,
|
||||
0);
|
||||
formLayout->addWidget(new QLabel("Half Module Firmware Version:"), 1, 0);
|
||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||
formLayout->addWidget(new QLabel("Half Module Software Version:"), 2,
|
||||
0);
|
||||
formLayout->addWidget(new QLabel("Half Module Software Version:"), 2, 0);
|
||||
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
||||
treeDet->setHeaderLabel("Eiger Detector");
|
||||
// get num modules
|
||||
//get num modules
|
||||
for (int i = 0; i < comboDetector->count() / 2; ++i)
|
||||
items.append(new QTreeWidgetItem(
|
||||
(QTreeWidget *)nullptr, QStringList(QString("Module %1").arg(i))));
|
||||
items.append(new QTreeWidgetItem((QTreeWidget *)0, QStringList(QString("Module %1").arg(i))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
// gets det names
|
||||
//gets det names
|
||||
for (int i = 0; i < comboDetector->count(); ++i) {
|
||||
QList<QTreeWidgetItem *> childItems;
|
||||
childItems.append(new QTreeWidgetItem(
|
||||
(QTreeWidget *)nullptr,
|
||||
QStringList(QString("Half Module (%1)")
|
||||
.arg(comboDetector->itemText(i)))));
|
||||
childItems.append(new QTreeWidgetItem((QTreeWidget *)0, QStringList(QString("Half Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->topLevelItem(i * 2)->insertChildren(0, childItems);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
formLayout->addWidget(new QLabel("Module:"), 0, 0);
|
||||
formLayout->addItem(
|
||||
new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0,
|
||||
1);
|
||||
formLayout->addItem(new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 1);
|
||||
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
||||
formLayout->addWidget(new QLabel("Module Firmware Version:"), 1, 0);
|
||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||
formLayout->addWidget(new QLabel("Module Software Version:"), 2, 0);
|
||||
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
||||
treeDet->setHeaderLabel(QString(detName + " Detector"));
|
||||
// gets det names
|
||||
//gets det names
|
||||
for (int i = 0; i < comboDetector->count(); ++i)
|
||||
items.append(new QTreeWidgetItem(
|
||||
(QTreeWidget *)nullptr,
|
||||
QStringList(
|
||||
QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
items.append(new QTreeWidgetItem((QTreeWidget *)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
break;
|
||||
}
|
||||
|
||||
// show and center widget
|
||||
//show and center widget
|
||||
int x = ((parentWidget()->width()) - (popup1->frameGeometry().width())) / 2;
|
||||
int y =
|
||||
((parentWidget()->height()) - (popup1->frameGeometry().height())) / 2;
|
||||
int y = ((parentWidget()->height()) - (popup1->frameGeometry().height())) / 2;
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
int screen = desktop->screenNumber(this);
|
||||
popup1->setWindowModality(Qt::WindowModal);
|
||||
popup1->move((desktop->screenGeometry(screen).x()) + x,
|
||||
(desktop->screenGeometry(screen).y()) + y);
|
||||
popup1->move((desktop->screenGeometry(screen).x()) + x, (desktop->screenGeometry(screen).y()) + y);
|
||||
popup1->show();
|
||||
|
||||
// put the first parameters
|
||||
//put the first parameters
|
||||
SetParameters(treeDet->topLevelItem(0));
|
||||
|
||||
// connect to slots
|
||||
connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
|
||||
SLOT(SetParameters(QTreeWidgetItem *)));
|
||||
connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(SetParameters(QTreeWidgetItem *)));
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||
// eiger: if half module clicked, others: true always
|
||||
bool ignoreOrHalfModuleClicked = true;
|
||||
@ -175,22 +164,16 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
auto retval = std::string("0x") +
|
||||
std::to_string((unsigned long)det->getFirmwareVersion(
|
||||
{comboDetector->currentIndex()})[0]);
|
||||
auto retval = std::string("0x") + std::to_string((unsigned long)det->getFirmwareVersion({comboDetector->currentIndex()})[0]);
|
||||
lblDetectorFirmware->setText(QString(retval.c_str()));
|
||||
retval =
|
||||
std::string("0x") +
|
||||
std::to_string((unsigned long)det->getDetectorServerVersion(
|
||||
{comboDetector->currentIndex()})[0]);
|
||||
retval = std::string("0x") + std::to_string((unsigned long)det->getDetectorServerVersion({comboDetector->currentIndex()})[0]);
|
||||
lblDetectorSoftware->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get versions.", "qTabDebugging::SetParameters")
|
||||
} CATCH_DISPLAY ("Could not get versions.", "qTabDebugging::SetParameters")
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDebugging::TestDetector() {
|
||||
LOG(logINFO) << "Testing Readout";
|
||||
FILE_LOG(logINFO) << "Testing Readout";
|
||||
|
||||
try {
|
||||
QString moduleName = "Module";
|
||||
@ -199,42 +182,35 @@ void qTabDebugging::TestDetector() {
|
||||
}
|
||||
|
||||
// construct message
|
||||
QString message = QString("<nobr>Test Results for %1:</nobr><br><br>")
|
||||
.arg(comboDetector->currentText());
|
||||
QString message = QString("<nobr>Test Results for %1:</nobr><br><br>").arg(comboDetector->currentText());
|
||||
|
||||
// detector firmware
|
||||
//detector firmware
|
||||
if (chkDetectorFirmware->isChecked()) {
|
||||
try {
|
||||
det->executeFirmwareTest({comboDetector->currentIndex()});
|
||||
message.append(QString("<nobr>%1 Firmware: PASS</nobr><br>")
|
||||
.arg(moduleName));
|
||||
LOG(logINFO) << "Detector Firmware Test: Pass";
|
||||
}
|
||||
CATCH_DISPLAY("Firmware test failed.",
|
||||
"qTabDebugging::TestDetector")
|
||||
message.append(QString("<nobr>%1 Firmware: PASS</nobr><br>").arg(moduleName));
|
||||
FILE_LOG(logINFO) << "Detector Firmware Test: Pass";
|
||||
} CATCH_DISPLAY ("Firmware test failed.", "qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
// detector CPU-FPGA bus
|
||||
//detector CPU-FPGA bus
|
||||
if (chkDetectorBus->isChecked()) {
|
||||
try {
|
||||
det->executeBusTest({comboDetector->currentIndex()});
|
||||
message.append(
|
||||
QString("<nobr>%1 Bus: PASS</nobr><br>").arg(moduleName));
|
||||
LOG(logINFO) << "Detector Bus Test: Pass";
|
||||
}
|
||||
CATCH_DISPLAY("Bus test failed.", "qTabDebugging::TestDetector")
|
||||
message.append(QString("<nobr>%1 Bus: PASS</nobr><br>").arg(moduleName));
|
||||
FILE_LOG(logINFO) << "Detector Bus Test: Pass";
|
||||
} CATCH_DISPLAY ("Bus test failed.", "qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
// display message
|
||||
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(),
|
||||
"qTabDebugging::TestDetector");
|
||||
}
|
||||
CATCH_DISPLAY("Could not execute digital test.",
|
||||
"qTabDebugging::TestDetector")
|
||||
//display message
|
||||
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(), "qTabDebugging::TestDetector");
|
||||
} CATCH_DISPLAY ("Could not execute digital test.", "qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::Refresh() {
|
||||
LOG(logDEBUG) << "**Updating Debugging Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updating Debugging Tab";
|
||||
GetDetectorStatus();
|
||||
LOG(logDEBUG) << "**Updated Debugging Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updated Debugging Tab";
|
||||
}
|
||||
|
||||
|
961
slsDetectorGui/src/qTabDeveloper.cpp
Normal file → Executable file
961
slsDetectorGui/src/qTabDeveloper.cpp
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
1147
slsDetectorGui/src/qTabMeasurement.cpp
Normal file → Executable file
1147
slsDetectorGui/src/qTabMeasurement.cpp
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
87
slsDetectorGui/src/qTabMessages.cpp
Normal file → Executable file
87
slsDetectorGui/src/qTabMessages.cpp
Normal file → Executable file
@ -1,23 +1,26 @@
|
||||
#include "qTabMessages.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QKeyEvent>
|
||||
#include <QProcess>
|
||||
#include <QTextStream>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
LOG(logDEBUG) << "Messages ready";
|
||||
FILE_LOG(logDEBUG) << "Messages ready";
|
||||
}
|
||||
|
||||
qTabMessages::~qTabMessages() {
|
||||
process->close();
|
||||
delete process;
|
||||
if (process)
|
||||
delete process;
|
||||
}
|
||||
|
||||
void qTabMessages::SetupWidgetWindow() {
|
||||
@ -35,32 +38,32 @@ void qTabMessages::Initialization() {
|
||||
connect(dispCommand, SIGNAL(returnPressed()), this, SLOT(ExecuteCommand()));
|
||||
}
|
||||
|
||||
void qTabMessages::keyPressEvent(QKeyEvent *event) {
|
||||
// cout<<"inside KeyPressEvent()\n";
|
||||
if (event->key() == Qt::Key_Up) {
|
||||
void qTabMessages::keyPressEvent(QKeyEvent* event) {
|
||||
//cout<<"inside KeyPressEvent()\n";
|
||||
if (event->key() == Qt::Key_Up) {
|
||||
GetLastCommand();
|
||||
} else if (event->key() == Qt::Key_Down) {
|
||||
ClearCommand();
|
||||
}
|
||||
/* else if((event->key() == Qt::Key_Return) ||(event->key() ==
|
||||
Qt::Key_Enter)) { ExecuteCommand();
|
||||
}*/
|
||||
else {
|
||||
event->ignore();
|
||||
else if (event->key() == Qt::Key_Down) {
|
||||
ClearCommand();
|
||||
}
|
||||
/* else if((event->key() == Qt::Key_Return) ||(event->key() == Qt::Key_Enter)) {
|
||||
ExecuteCommand();
|
||||
}*/ else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void qTabMessages::PrintNextLine() {
|
||||
dispLog->append(QString("<font color = \"DarkGrey\">") +
|
||||
QDir::current().dirName() + QString("$ ") +
|
||||
QString("</font>"));
|
||||
dispLog->append(QString("<font color = \"DarkGrey\">") + QDir::current().dirName() + QString("$ ") + QString("</font>"));
|
||||
}
|
||||
|
||||
void qTabMessages::GetLastCommand() {
|
||||
dispCommand->setText(lastCommand.join(" "));
|
||||
dispCommand->setText(lastCommand.join(" "));
|
||||
}
|
||||
|
||||
void qTabMessages::ClearCommand() { dispCommand->setText(""); }
|
||||
void qTabMessages::ClearCommand() {
|
||||
dispCommand->setText("");
|
||||
}
|
||||
|
||||
void qTabMessages::ExecuteCommand() {
|
||||
QStringList param = dispCommand->text().split(" ");
|
||||
@ -68,19 +71,16 @@ void qTabMessages::ExecuteCommand() {
|
||||
lastCommand += param;
|
||||
dispCommand->clear();
|
||||
// appending command to log without newline
|
||||
dispLog->moveCursor(QTextCursor::End);
|
||||
dispLog->insertHtml(QString("<font color = \"DarkBlue\">") +
|
||||
param.join(" ") + QString("</font>"));
|
||||
|
||||
dispLog->moveCursor (QTextCursor::End);
|
||||
dispLog->insertHtml(QString("<font color = \"DarkBlue\">") + param.join(" ") + QString("</font>"));
|
||||
|
||||
QString command = param.at(0);
|
||||
param.removeFirst();
|
||||
LOG(logINFO) << "Executing Command:[" << command.toAscii().constData()
|
||||
<< "] with Arguments:["
|
||||
<< param.join(" ").toAscii().constData() << "]";
|
||||
FILE_LOG(logINFO) << "Executing Command:[" << command.toAscii().constData() << "] with Arguments:[" << param.join(" ").toAscii().constData() << "]";
|
||||
|
||||
process->setProcessChannelMode(QProcess::MergedChannels);
|
||||
process->start(command, param);
|
||||
if (!process->waitForFinished()) {
|
||||
if(!process->waitForFinished()) {
|
||||
AppendError();
|
||||
} else {
|
||||
AppendOutput();
|
||||
@ -90,40 +90,34 @@ void qTabMessages::ExecuteCommand() {
|
||||
void qTabMessages::AppendOutput() {
|
||||
QByteArray result = process->readAll();
|
||||
result.replace("\n", "<br>");
|
||||
dispLog->append(QString("<font color = \"DarkBlue\">") + result +
|
||||
QString("</font>"));
|
||||
LOG(logDEBUG) << "Command executed successfully";
|
||||
dispLog->append(QString("<font color = \"DarkBlue\">") + result + QString("</font>"));
|
||||
FILE_LOG(logDEBUG) << "Command executed successfully";
|
||||
PrintNextLine();
|
||||
}
|
||||
|
||||
void qTabMessages::AppendError() {
|
||||
dispLog->append(QString("<font color = \"Red\">") + process->errorString() +
|
||||
QString("</font>"));
|
||||
LOG(logERROR) << "Error executing command";
|
||||
dispLog->append(QString("<font color = \"Red\">") + process->errorString() + QString("</font>"));
|
||||
FILE_LOG(logERROR) << "Error executing command";
|
||||
PrintNextLine();
|
||||
}
|
||||
|
||||
|
||||
void qTabMessages::SaveLog() {
|
||||
QString fName = QDir::cleanPath(QDir::currentPath()) + "/LogFile.txt";
|
||||
fName =
|
||||
QFileDialog::getSaveFileName(this, tr("Save Snapshot "), fName,
|
||||
tr("Text files (*.txt);;All Files(*)"));
|
||||
fName = QFileDialog::getSaveFileName(this, tr("Save Snapshot "),
|
||||
fName, tr("Text files (*.txt);;All Files(*)"));
|
||||
if (!fName.isEmpty()) {
|
||||
QFile outfile;
|
||||
outfile.setFileName(fName);
|
||||
if (outfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream out(&outfile);
|
||||
out << dispLog->toPlainText() << endl;
|
||||
std::string mess =
|
||||
std::string("The Log has been successfully saved to ") +
|
||||
fName.toAscii().constData();
|
||||
std::string mess = std::string("The Log has been successfully saved to ") + fName.toAscii().constData();
|
||||
qDefs::Message(qDefs::INFORMATION, mess, "TabMessages::SaveLog");
|
||||
LOG(logINFO) << mess;
|
||||
FILE_LOG(logINFO) << mess;
|
||||
} else {
|
||||
LOG(logWARNING) << "Attempt to save log file failed: "
|
||||
<< fName.toAscii().constData();
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.",
|
||||
"qTabMessages::SaveLog");
|
||||
FILE_LOG(logWARNING) << "Attempt to save log file failed: " << fName.toAscii().constData();
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.", "qTabMessages::SaveLog");
|
||||
}
|
||||
}
|
||||
dispCommand->setFocus();
|
||||
@ -131,7 +125,7 @@ void qTabMessages::SaveLog() {
|
||||
|
||||
void qTabMessages::ClearLog() {
|
||||
dispLog->clear();
|
||||
LOG(logINFO) << "Log Cleared";
|
||||
FILE_LOG(logINFO) << "Log Cleared";
|
||||
PrintNextLine();
|
||||
dispCommand->setFocus();
|
||||
}
|
||||
@ -140,3 +134,4 @@ void qTabMessages::Refresh() {
|
||||
dispCommand->clear();
|
||||
dispCommand->setFocus();
|
||||
}
|
||||
|
||||
|
438
slsDetectorGui/src/qTabPlot.cpp
Normal file → Executable file
438
slsDetectorGui/src/qTabPlot.cpp
Normal file → Executable file
@ -1,11 +1,15 @@
|
||||
#include "qTabPlot.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
#include <QAbstractButton>
|
||||
#include <QButtonGroup>
|
||||
#include <QStackedLayout>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QStackedLayout>
|
||||
#include <QButtonGroup>
|
||||
#include <QAbstractButton>
|
||||
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
#include <string>
|
||||
|
||||
QString qTabPlot::defaultPlotTitle("");
|
||||
QString qTabPlot::defaultHistXAxisTitle("Channel Number");
|
||||
@ -14,14 +18,18 @@ QString qTabPlot::defaultImageXAxisTitle("Pixel");
|
||||
QString qTabPlot::defaultImageYAxisTitle("Pixel");
|
||||
QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
||||
|
||||
qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p)
|
||||
: QWidget(parent), det(detector), plot(p), is1d(false) {
|
||||
|
||||
qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p) :
|
||||
QWidget(parent), det(detector), plot(p), is1d(false) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
LOG(logDEBUG) << "Plot ready";
|
||||
FILE_LOG(logDEBUG) << "Plot ready";
|
||||
}
|
||||
|
||||
qTabPlot::~qTabPlot() { delete btnGroupPlotType; }
|
||||
qTabPlot::~qTabPlot() {
|
||||
if (btnGroupPlotType)
|
||||
delete btnGroupPlotType;
|
||||
}
|
||||
|
||||
void qTabPlot::SetupWidgetWindow() {
|
||||
// button group for plot type
|
||||
@ -49,27 +57,21 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
|
||||
// enabling according to det type
|
||||
is1d = false;
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
is1d = true;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
is1d = true;
|
||||
chkGainPlot1D->setEnabled(true);
|
||||
chkGainPlot1D->setChecked(true);
|
||||
plot->EnableGainPlot(true);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkGapPixels->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
chkGainPlot->setEnabled(true);
|
||||
chkGainPlot->setChecked(true);
|
||||
plot->EnableGainPlot(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
is1d = true;
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkGapPixels->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
chkGainPlot->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Select1DPlot(is1d);
|
||||
@ -79,78 +81,56 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
|
||||
void qTabPlot::Initialization() {
|
||||
// Plot arguments box
|
||||
connect(btnGroupPlotType, SIGNAL(buttonClicked(int)), this,
|
||||
SLOT(SetPlot()));
|
||||
connect(btnGroupPlotType, SIGNAL(buttonClicked(int)), this, SLOT(SetPlot()));
|
||||
|
||||
// Plotting frequency box
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
|
||||
// navigation buttons for options
|
||||
connect(btnRight1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsRight()));
|
||||
connect(btnLeft1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsLeft()));
|
||||
connect(btnRight2D, SIGNAL(clicked()), this, SLOT(Set2DPlotOptionsRight()));
|
||||
connect(btnLeft2D, SIGNAL(clicked()), this, SLOT(Set2DPlotOptionsLeft()));
|
||||
|
||||
|
||||
// 1D options
|
||||
connect(chkSuperimpose, SIGNAL(toggled(bool)), this,
|
||||
SLOT(EnablePersistency(bool)));
|
||||
connect(spinPersistency, SIGNAL(valueChanged(int)), plot,
|
||||
SLOT(SetPersistency(int)));
|
||||
connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool)));
|
||||
connect(spinPersistency, SIGNAL(valueChanged(int)), plot, SLOT(SetPersistency(int)));
|
||||
connect(chkPoints, SIGNAL(toggled(bool)), plot, SLOT(SetMarkers(bool)));
|
||||
connect(chkLines, SIGNAL(toggled(bool)), plot, SLOT(SetLines(bool)));
|
||||
connect(chk1DLog, SIGNAL(toggled(bool)), plot, SLOT(Set1dLogY(bool)));
|
||||
connect(chkStatistics, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(DisplayStatistics(bool)));
|
||||
connect(chkStatistics, SIGNAL(toggled(bool)), plot, SLOT(DisplayStatistics(bool)));
|
||||
|
||||
// 2D Plot box
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(SetInterpolate(bool)));
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)), plot, SLOT(SetInterpolate(bool)));
|
||||
connect(chkContour, SIGNAL(toggled(bool)), plot, SLOT(SetContour(bool)));
|
||||
connect(chkLogz, SIGNAL(toggled(bool)), plot, SLOT(SetLogz(bool)));
|
||||
connect(chkStatistics_2, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(DisplayStatistics(bool)));
|
||||
// pedstal
|
||||
connect(chkStatistics_2, SIGNAL(toggled(bool)), plot, SLOT(DisplayStatistics(bool)));
|
||||
//pedstal
|
||||
connect(chkPedestal, SIGNAL(toggled(bool)), plot, SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal, SIGNAL(clicked()), plot,
|
||||
SLOT(RecalculatePedestal()));
|
||||
connect(chkPedestal_2, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal_2, SIGNAL(clicked()), plot,
|
||||
SLOT(RecalculatePedestal()));
|
||||
// accumulate
|
||||
connect(chkAccumulate, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate, SIGNAL(clicked()), plot,
|
||||
SLOT(ResetAccumulate()));
|
||||
connect(chkAccumulate_2, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate_2, SIGNAL(clicked()), plot,
|
||||
SLOT(ResetAccumulate()));
|
||||
// binary
|
||||
connect(btnRecalPedestal, SIGNAL(clicked()), plot, SLOT(RecalculatePedestal()));
|
||||
connect(chkPedestal_2, SIGNAL(toggled(bool)), plot, SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal_2, SIGNAL(clicked()), plot, SLOT(RecalculatePedestal()));
|
||||
//accumulate
|
||||
connect(chkAccumulate, SIGNAL(toggled(bool)), plot, SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate, SIGNAL(clicked()), plot, SLOT(ResetAccumulate()));
|
||||
connect(chkAccumulate_2, SIGNAL(toggled(bool)), plot, SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate_2, SIGNAL(clicked()), plot, SLOT(ResetAccumulate()));
|
||||
//binary
|
||||
connect(chkBinary, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
|
||||
connect(chkBinary_2, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
|
||||
connect(spinFrom, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||
connect(spinFrom_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||
connect(spinTo, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||
// gainplot
|
||||
//gainplot
|
||||
if (chkGainPlot->isEnabled())
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(EnableGainPlot(bool)));
|
||||
if (chkGainPlot1D->isEnabled())
|
||||
connect(chkGainPlot1D, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(EnableGainPlot(bool)));
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
// gap pixels
|
||||
if (chkGapPixels->isEnabled())
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetGapPixels(bool)));
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
|
||||
// Save, clone
|
||||
connect(btnSave, SIGNAL(clicked()), plot, SLOT(SavePlot()));
|
||||
@ -161,14 +141,10 @@ void qTabPlot::Initialization() {
|
||||
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
|
||||
connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||
@ -178,8 +154,7 @@ void qTabPlot::Initialization() {
|
||||
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
connect(chkAspectRatio, SIGNAL(toggled(bool)), this,
|
||||
SLOT(CheckAspectRatio()));
|
||||
connect(chkAspectRatio, SIGNAL(toggled(bool)), this, SLOT(CheckAspectRatio()));
|
||||
|
||||
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||
@ -188,7 +163,7 @@ void qTabPlot::Initialization() {
|
||||
}
|
||||
|
||||
void qTabPlot::Select1DPlot(bool enable) {
|
||||
LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
|
||||
FILE_LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
|
||||
is1d = enable;
|
||||
box1D->setEnabled(enable);
|
||||
box2D->setEnabled(!enable);
|
||||
@ -209,9 +184,9 @@ void qTabPlot::Select1DPlot(bool enable) {
|
||||
void qTabPlot::SetPlot() {
|
||||
bool plotEnable = false;
|
||||
if (radioNoPlot->isChecked()) {
|
||||
LOG(logINFO) << "Setting Plot Type: No Plot";
|
||||
FILE_LOG(logINFO) << "Setting Plot Type: No Plot";
|
||||
} else if (radioDataGraph->isChecked()) {
|
||||
LOG(logINFO) << "Setting Plot Type: Datagraph";
|
||||
FILE_LOG(logINFO) << "Setting Plot Type: Datagraph";
|
||||
plotEnable = true;
|
||||
}
|
||||
boxFrequency->setEnabled(plotEnable);
|
||||
@ -227,56 +202,52 @@ void qTabPlot::SetPlot() {
|
||||
SetZRange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
plot->SetDataCallBack(plotEnable);
|
||||
}
|
||||
|
||||
void qTabPlot::Set1DPlotOptionsRight() {
|
||||
LOG(logDEBUG) << "1D Options Right";
|
||||
FILE_LOG(logDEBUG) << "1D Options Right";
|
||||
int i = stackedWidget1D->currentIndex();
|
||||
if (i == (stackedWidget1D->count() - 1))
|
||||
stackedWidget1D->setCurrentIndex(0);
|
||||
else
|
||||
stackedWidget1D->setCurrentIndex(i + 1);
|
||||
box1D->setTitle(
|
||||
QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set1DPlotOptionsLeft() {
|
||||
LOG(logDEBUG) << "1D Options Left";
|
||||
FILE_LOG(logDEBUG) << "1D Options Left";
|
||||
int i = stackedWidget1D->currentIndex();
|
||||
if (i == 0)
|
||||
stackedWidget1D->setCurrentIndex(stackedWidget1D->count() - 1);
|
||||
else
|
||||
stackedWidget1D->setCurrentIndex(i - 1);
|
||||
box1D->setTitle(
|
||||
QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set2DPlotOptionsRight() {
|
||||
LOG(logDEBUG) << "2D Options Right";
|
||||
FILE_LOG(logDEBUG) << "2D Options Right";
|
||||
int i = stackedWidget2D->currentIndex();
|
||||
if (i == (stackedWidget2D->count() - 1))
|
||||
stackedWidget2D->setCurrentIndex(0);
|
||||
else
|
||||
stackedWidget2D->setCurrentIndex(i + 1);
|
||||
box2D->setTitle(
|
||||
QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set2DPlotOptionsLeft() {
|
||||
LOG(logDEBUG) << "2D Options Left";
|
||||
FILE_LOG(logDEBUG) << "2D Options Left";
|
||||
int i = stackedWidget2D->currentIndex();
|
||||
if (i == 0)
|
||||
stackedWidget2D->setCurrentIndex(stackedWidget2D->count() - 1);
|
||||
else
|
||||
stackedWidget2D->setCurrentIndex(i - 1);
|
||||
box2D->setTitle(
|
||||
QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::EnablePersistency(bool enable) {
|
||||
LOG(logINFO) << "Superimpose " << (enable ? "enabled" : "disabled");
|
||||
FILE_LOG(logINFO) << "Superimpose " << (enable ? "enabled" : "disabled");
|
||||
lblPersistency->setEnabled(enable);
|
||||
spinPersistency->setEnabled(enable);
|
||||
if (enable)
|
||||
@ -287,18 +258,16 @@ void qTabPlot::EnablePersistency(bool enable) {
|
||||
|
||||
void qTabPlot::SetBinary() {
|
||||
bool binary1D = chkBinary->isChecked();
|
||||
bool binary2D = chkBinary_2->isChecked();
|
||||
bool binary2D = chkBinary_2->isChecked();
|
||||
if (is1d) {
|
||||
LOG(logINFO) << "Binary Plot "
|
||||
<< (binary1D ? "enabled" : "disabled");
|
||||
FILE_LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled");
|
||||
lblFrom->setEnabled(binary1D);
|
||||
lblTo->setEnabled(binary1D);
|
||||
spinFrom->setEnabled(binary1D);
|
||||
spinTo->setEnabled(binary1D);
|
||||
plot->SetBinary(binary1D, spinFrom->value(), spinTo->value());
|
||||
} else {
|
||||
LOG(logINFO) << "Binary Plot "
|
||||
<< (binary2D ? "enabled" : "disabled");
|
||||
FILE_LOG(logINFO) << "Binary Plot " << (binary2D ? "enabled" : "disabled");
|
||||
lblFrom_2->setEnabled(binary2D);
|
||||
lblTo_2->setEnabled(binary2D);
|
||||
spinFrom_2->setEnabled(binary2D);
|
||||
@ -308,68 +277,54 @@ void qTabPlot::SetBinary() {
|
||||
}
|
||||
|
||||
void qTabPlot::GetGapPixels() {
|
||||
LOG(logDEBUG) << "Getting gap pixels";
|
||||
disconnect(chkGapPixels, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetGapPixels(bool)));
|
||||
try {
|
||||
auto retval = det->getRxAddGapPixels().tsquash(
|
||||
"Inconsistent gap pixels enabled for all detectors.");
|
||||
chkGapPixels->setChecked(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get gap pixels enable.", "qTabPlot::GetGapPixels")
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetGapPixels(bool)));
|
||||
FILE_LOG(logDEBUG) << "Getting gap pixels";
|
||||
disconnect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
try {
|
||||
auto retval = det->getRxAddGapPixels().tsquash("Inconsistent gap pixels enabled for all detectors.");
|
||||
chkGapPixels->setChecked(retval);
|
||||
} CATCH_DISPLAY ("Could not get gap pixels enable.", "qTabPlot::GetGapPixels")
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
}
|
||||
|
||||
void qTabPlot::SetGapPixels(bool enable) {
|
||||
LOG(logINFO) << "Setting Gap Pixels Enable to " << enable;
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting Gap Pixels Enable to " << enable;
|
||||
try {
|
||||
det->setRxAddGapPixels(enable);
|
||||
}
|
||||
CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels",
|
||||
this, &qTabPlot::GetGapPixels)
|
||||
} CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels", this, &qTabPlot::GetGapPixels)
|
||||
}
|
||||
|
||||
void qTabPlot::SetTitles() {
|
||||
LOG(logDEBUG) << "Setting Plot Titles";
|
||||
FILE_LOG(logDEBUG) << "Setting Plot Titles";
|
||||
disconnect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
disconnect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
disconnect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
disconnect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
disconnect(dispTitle, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
disconnect(dispXAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
disconnect(dispYAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
disconnect(dispZAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
disconnect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
disconnect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
disconnect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
disconnect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
|
||||
// title
|
||||
if (!chkTitle->isChecked() || dispTitle->text().isEmpty()) {
|
||||
plot->SetPlotTitlePrefix("");
|
||||
dispTitle->setText("");
|
||||
dispTitle->setText("");
|
||||
} else {
|
||||
plot->SetPlotTitlePrefix(dispTitle->text());
|
||||
}
|
||||
// x
|
||||
if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
|
||||
dispXAxis->setText(is1d ? defaultHistXAxisTitle
|
||||
: defaultImageXAxisTitle);
|
||||
plot->SetXAxisTitle(is1d ? defaultHistXAxisTitle
|
||||
: defaultImageXAxisTitle);
|
||||
dispXAxis->setText(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
plot->SetXAxisTitle(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
} else {
|
||||
plot->SetXAxisTitle(dispXAxis->text());
|
||||
}
|
||||
}
|
||||
// y
|
||||
if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
|
||||
dispYAxis->setText(is1d ? defaultHistYAxisTitle
|
||||
: defaultImageYAxisTitle);
|
||||
plot->SetYAxisTitle(is1d ? defaultHistYAxisTitle
|
||||
: defaultImageYAxisTitle);
|
||||
dispYAxis->setText(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
plot->SetYAxisTitle(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
} else {
|
||||
plot->SetYAxisTitle(dispYAxis->text());
|
||||
}
|
||||
}
|
||||
// z
|
||||
if (!chkZAxis->isChecked() || dispZAxis->text().isEmpty()) {
|
||||
plot->SetZAxisTitle(defaultImageZAxisTitle);
|
||||
@ -382,18 +337,14 @@ void qTabPlot::SetTitles() {
|
||||
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
}
|
||||
|
||||
void qTabPlot::SetXRange() {
|
||||
LOG(logDEBUG) << "Enable X axis range";
|
||||
FILE_LOG(logDEBUG) << "Enable X axis range";
|
||||
|
||||
if (chkAspectRatio->isChecked()) {
|
||||
MaintainAspectRatio(static_cast<int>(slsDetectorDefs::Y));
|
||||
@ -403,7 +354,7 @@ void qTabPlot::SetXRange() {
|
||||
}
|
||||
|
||||
void qTabPlot::SetYRange() {
|
||||
LOG(logDEBUG) << "Enable Y axis range";
|
||||
FILE_LOG(logDEBUG) << "Enable Y axis range";
|
||||
|
||||
if (chkAspectRatio->isChecked()) {
|
||||
MaintainAspectRatio(static_cast<int>(slsDetectorDefs::X));
|
||||
@ -421,23 +372,18 @@ void qTabPlot::CheckAspectRatio() {
|
||||
}
|
||||
|
||||
void qTabPlot::SetXYRange() {
|
||||
LOG(logDEBUG) << "Set XY Range";
|
||||
FILE_LOG(logDEBUG) << "Set XY Range";
|
||||
bool disablezoom = false;
|
||||
bool isRange[4]{false, false, false, false};
|
||||
double xyRange[4]{0, 0, 0, 0};
|
||||
|
||||
QString dispVal[4]{dispXMin->text(), dispXMax->text(), dispYMin->text(),
|
||||
dispYMax->text()};
|
||||
bool chkVal[4]{chkXMin->isChecked(), chkXMax->isChecked(),
|
||||
chkYMin->isChecked(), chkYMax->isChecked()};
|
||||
QString dispVal[4] {dispXMin->text(), dispXMax->text(), dispYMin->text(), dispYMax->text()};
|
||||
bool chkVal[4] {chkXMin->isChecked(), chkXMax->isChecked(), chkYMin->isChecked(), chkYMax->isChecked()};
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (chkVal[i] && !dispVal[i].isEmpty()) {
|
||||
double val = dispVal[i].toDouble();
|
||||
LOG(logDEBUG)
|
||||
<< "Setting "
|
||||
<< qDefs::getRangeAsString(static_cast<qDefs::range>(i))
|
||||
<< " to " << val;
|
||||
FILE_LOG(logDEBUG) << "Setting " << qDefs::getRangeAsString(static_cast<qDefs::range>(i)) << " to " << val;
|
||||
xyRange[i] = val;
|
||||
isRange[i] = true;
|
||||
disablezoom = true;
|
||||
@ -449,7 +395,7 @@ void qTabPlot::SetXYRange() {
|
||||
}
|
||||
|
||||
void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
LOG(logDEBUG) << "Maintaining Aspect Ratio";
|
||||
FILE_LOG(logDEBUG) << "Maintaining Aspect Ratio";
|
||||
|
||||
disconnect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||
disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||
@ -465,13 +411,13 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
chkXMax->setChecked(true);
|
||||
chkYMin->setChecked(true);
|
||||
chkYMax->setChecked(true);
|
||||
if (dispXMin->text().isEmpty())
|
||||
if (dispXMin->text().isEmpty())
|
||||
dispXMin->setText(QString::number(plot->GetXMinimum()));
|
||||
if (dispXMax->text().isEmpty())
|
||||
if (dispXMax->text().isEmpty())
|
||||
dispXMax->setText(QString::number(plot->GetXMaximum()));
|
||||
if (dispYMin->text().isEmpty())
|
||||
if (dispYMin->text().isEmpty())
|
||||
dispYMin->setText(QString::number(plot->GetYMinimum()));
|
||||
if (dispYMax->text().isEmpty())
|
||||
if (dispYMax->text().isEmpty())
|
||||
dispYMax->setText(QString::number(plot->GetYMaximum()));
|
||||
|
||||
// calculate ideal aspect ratio with previous limits
|
||||
@ -480,71 +426,52 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
ranges[qDefs::XMAX] = plot->GetXMaximum();
|
||||
ranges[qDefs::YMIN] = plot->GetYMinimum();
|
||||
ranges[qDefs::YMAX] = plot->GetYMaximum();
|
||||
double idealAspectratio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||
LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio
|
||||
<< " for x(" << ranges[qDefs::XMIN] << " - "
|
||||
<< ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN]
|
||||
<< " - " << ranges[qDefs::YMAX] << ")";
|
||||
|
||||
double idealAspectratio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||
FILE_LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio << " for x(" << ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN] << " - " << ranges[qDefs::YMAX] << ")";
|
||||
|
||||
// calculate current aspect ratio
|
||||
ranges[qDefs::XMIN] = dispXMin->text().toDouble();
|
||||
ranges[qDefs::XMAX] = dispXMax->text().toDouble();
|
||||
ranges[qDefs::YMIN] = dispYMin->text().toDouble();
|
||||
ranges[qDefs::YMAX] = dispYMax->text().toDouble();
|
||||
double currentAspectRatio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||
LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio
|
||||
<< " for x(" << ranges[qDefs::XMIN] << " - "
|
||||
<< ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN]
|
||||
<< " - " << ranges[qDefs::YMAX] << ")";
|
||||
|
||||
double currentAspectRatio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||
FILE_LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio << " for x(" << ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN] << " - " << ranges[qDefs::YMAX] << ")";
|
||||
|
||||
if (currentAspectRatio != idealAspectratio) {
|
||||
// dimension: 1(x changed: y adjusted), 0(y changed: x adjusted),
|
||||
// -1(aspect ratio clicked: larger one adjusted)
|
||||
// dimension: 1(x changed: y adjusted), 0(y changed: x adjusted), -1(aspect ratio clicked: larger one adjusted)
|
||||
if (dimension == -1) {
|
||||
dimension = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) >
|
||||
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]))
|
||||
? static_cast<int>(slsDetectorDefs::X)
|
||||
: static_cast<int>(slsDetectorDefs::Y);
|
||||
dimension = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) > (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]))
|
||||
? static_cast<int>(slsDetectorDefs::X) : static_cast<int>(slsDetectorDefs::Y);
|
||||
}
|
||||
|
||||
// calculate new value to maintain aspect ratio
|
||||
// adjust x
|
||||
double newval = 0;
|
||||
if (dimension == static_cast<int>(slsDetectorDefs::X)) {
|
||||
newval =
|
||||
idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]) +
|
||||
ranges[qDefs::XMIN];
|
||||
newval = idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]) + ranges[qDefs::XMIN];
|
||||
if (newval <= plot->GetXMaximum()) {
|
||||
ranges[qDefs::XMAX] = newval;
|
||||
dispXMax->setText(QString::number(newval));
|
||||
LOG(logDEBUG) << "New XMax: " << newval;
|
||||
FILE_LOG(logDEBUG) << "New XMax: " << newval;
|
||||
} else {
|
||||
newval = ranges[qDefs::XMAX] -
|
||||
(idealAspectratio *
|
||||
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]));
|
||||
newval = ranges[qDefs::XMAX] - (idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]));
|
||||
ranges[qDefs::XMIN] = newval;
|
||||
dispXMin->setText(QString::number(newval));
|
||||
LOG(logDEBUG) << "New XMin: " << newval;
|
||||
FILE_LOG(logDEBUG) << "New XMin: " << newval;
|
||||
}
|
||||
}
|
||||
// adjust y
|
||||
else {
|
||||
newval = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||
idealAspectratio) +
|
||||
ranges[qDefs::YMIN];
|
||||
else {
|
||||
newval = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio) + ranges[qDefs::YMIN];
|
||||
if (newval <= plot->GetYMaximum()) {
|
||||
ranges[qDefs::YMAX] = newval;
|
||||
dispYMax->setText(QString::number(newval));
|
||||
LOG(logDEBUG) << "New YMax: " << newval;
|
||||
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
||||
} else {
|
||||
newval = ranges[qDefs::YMAX] -
|
||||
((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||
idealAspectratio);
|
||||
newval = ranges[qDefs::YMAX] - ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio);
|
||||
ranges[qDefs::YMIN] = newval;
|
||||
dispYMin->setText(QString::number(newval));
|
||||
LOG(logDEBUG) << "New YMax: " << newval;
|
||||
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -558,58 +485,47 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
|
||||
bool isRange[4]{true, true, true, true};
|
||||
bool isRange[4] {true, true, true, true};
|
||||
plot->SetXYRangeChanged(true, ranges, isRange);
|
||||
emit DisableZoomSignal(true);
|
||||
}
|
||||
|
||||
void qTabPlot::SetZRange() {
|
||||
bool isZRange[2]{chkZMin->isChecked(), chkZMax->isChecked()};
|
||||
double zRange[2]{0, 0};
|
||||
bool isZRange[2] {chkZMin->isChecked(), chkZMax->isChecked()};
|
||||
double zRange[2] {0 , 0};
|
||||
|
||||
if (isZRange[0] && !dispZMin->text().isEmpty()) {
|
||||
double val = dispZMin->text().toDouble();
|
||||
LOG(logDEBUG) << "Setting zmin to " << val;
|
||||
FILE_LOG(logDEBUG) << "Setting zmin to " << val;
|
||||
zRange[0] = val;
|
||||
}
|
||||
if (isZRange[1] && !dispZMax->text().isEmpty()) {
|
||||
double val = dispZMax->text().toDouble();
|
||||
LOG(logDEBUG) << "Setting zmax to " << val;
|
||||
FILE_LOG(logDEBUG) << "Setting zmax to " << val;
|
||||
zRange[1] = val;
|
||||
}
|
||||
plot->SetZRange(zRange, isZRange);
|
||||
}
|
||||
|
||||
void qTabPlot::GetStreamingFrequency() {
|
||||
LOG(logDEBUG) << "Getting Streaming Frequency";
|
||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinTimeGap, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
try {
|
||||
int freq = det->getRxZmqFrequency().tsquash(
|
||||
"Inconsistent receiver zmq streaming frequency for all detectors.");
|
||||
FILE_LOG(logDEBUG) << "Getting Streaming Frequency";
|
||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
try {
|
||||
int freq = det->getRxZmqFrequency().tsquash("Inconsistent receiver zmq streaming frequency for all detectors.");
|
||||
// time interval
|
||||
if (freq == 0) {
|
||||
comboFrequency->setCurrentIndex(0);
|
||||
stackedTimeInterval->setCurrentIndex(0);
|
||||
try {
|
||||
int timeMs = det->getRxZmqTimer().tsquash(
|
||||
"Inconsistent receiver zmq streaming timer for all "
|
||||
"detectors.");
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||
static_cast<double>(timeMs), qDefs::MILLISECONDS));
|
||||
int timeMs = det->getRxZmqTimer().tsquash("Inconsistent receiver zmq streaming timer for all detectors.");
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(static_cast<double>(timeMs), qDefs::MILLISECONDS));
|
||||
auto time = qDefs::getUserFriendlyTime(timeNS);
|
||||
spinTimeGap->setValue(time.first);
|
||||
comboTimeGapUnit->setCurrentIndex(
|
||||
static_cast<int>(time.second));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get streaming timer.",
|
||||
"qTabPlot::GetStreamingFrequency")
|
||||
comboTimeGapUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get streaming timer.", "qTabPlot::GetStreamingFrequency")
|
||||
}
|
||||
// every nth frame
|
||||
else {
|
||||
@ -617,44 +533,33 @@ void qTabPlot::GetStreamingFrequency() {
|
||||
stackedTimeInterval->setCurrentIndex(1);
|
||||
spinNthFrame->setValue(freq);
|
||||
}
|
||||
}
|
||||
CATCH_DISPLAY("Could not get streaming frequency.",
|
||||
"qTabPlot::GetStreamingFrequency")
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
} CATCH_DISPLAY ("Could not get streaming frequency.", "qTabPlot::GetStreamingFrequency")
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
}
|
||||
|
||||
void qTabPlot::SetStreamingFrequency() {
|
||||
bool frequency = (comboFrequency->currentIndex() == 0) ? 0 : 1;
|
||||
auto freqVal = spinNthFrame->value();
|
||||
auto timeVal = spinTimeGap->value();
|
||||
auto timeUnit =
|
||||
static_cast<qDefs::timeUnit>(comboTimeGapUnit->currentIndex());
|
||||
auto timeUnit = static_cast<qDefs::timeUnit>(comboTimeGapUnit->currentIndex());
|
||||
stackedTimeInterval->setCurrentIndex(comboFrequency->currentIndex());
|
||||
try {
|
||||
try {
|
||||
if (frequency) {
|
||||
LOG(logINFO) << "Setting Streaming Frequency to " << freqVal;
|
||||
FILE_LOG(logINFO) << "Setting Streaming Frequency to " << freqVal;
|
||||
det->setRxZmqFrequency(freqVal);
|
||||
} else {
|
||||
LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " "
|
||||
<< qDefs::getUnitString(timeUnit);
|
||||
FILE_LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " " << qDefs::getUnitString(timeUnit);
|
||||
auto timeMS = qDefs::getMSTime(std::make_pair(timeVal, timeUnit));
|
||||
det->setRxZmqTimer(timeMS.count());
|
||||
}
|
||||
}
|
||||
CATCH_HANDLE("Could not set streaming frequency/ timer.",
|
||||
"qTabPlot::SetStreamingFrequency", this,
|
||||
&qTabPlot::GetStreamingFrequency)
|
||||
} CATCH_HANDLE("Could not set streaming frequency/ timer.", "qTabPlot::SetStreamingFrequency", this, &qTabPlot::GetStreamingFrequency)
|
||||
}
|
||||
|
||||
void qTabPlot::Refresh() {
|
||||
LOG(logDEBUG) << "**Updating Plot Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updating Plot Tab";
|
||||
|
||||
if (!plot->GetIsRunning()) {
|
||||
boxPlotType->setEnabled(true);
|
||||
@ -665,27 +570,24 @@ void qTabPlot::Refresh() {
|
||||
}
|
||||
GetStreamingFrequency();
|
||||
// gain plot, gap pixels enable
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkGapPixels->setEnabled(true);
|
||||
GetGapPixels();
|
||||
break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
chkGainPlot->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
chkGainPlot1D->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkGapPixels->setEnabled(true);
|
||||
GetGapPixels();
|
||||
break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
chkGainPlot->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
boxPlotType->setEnabled(false);
|
||||
boxFrequency->setEnabled(false);
|
||||
chkGainPlot->setEnabled(false);
|
||||
chkGainPlot1D->setEnabled(false);
|
||||
chkGapPixels->setEnabled(false);
|
||||
}
|
||||
|
||||
LOG(logDEBUG) << "**Updated Plot Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updated Plot Tab";
|
||||
}
|
||||
|
187
slsDetectorGui/src/qTabSettings.cpp
Normal file → Executable file
187
slsDetectorGui/src/qTabSettings.cpp
Normal file → Executable file
@ -1,33 +1,38 @@
|
||||
#include "qTabSettings.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include "ToString.h"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector)
|
||||
: QWidget(parent), det(detector) {
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector): QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
LOG(logDEBUG) << "Settings ready";
|
||||
FILE_LOG(logDEBUG) << "Settings ready";
|
||||
}
|
||||
|
||||
qTabSettings::~qTabSettings() {}
|
||||
|
||||
void qTabSettings::SetupWidgetWindow() {
|
||||
|
||||
// enabling according to det type
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
lblSettings->setEnabled(false);
|
||||
comboSettings->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
lblDynamicRange->setEnabled(true);
|
||||
comboDynamicRange->setEnabled(true);
|
||||
lblThreshold->setEnabled(true);
|
||||
spinThreshold->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
// enabling according to det type
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
lblSettings->setEnabled(false);
|
||||
comboSettings->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
lblDynamicRange->setEnabled(true);
|
||||
comboDynamicRange->setEnabled(true);
|
||||
lblThreshold->setEnabled(true);
|
||||
spinThreshold->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// default settings for the disabled
|
||||
@ -36,23 +41,24 @@ void qTabSettings::SetupWidgetWindow() {
|
||||
SetupDetectorSettings();
|
||||
}
|
||||
spinThreshold->setValue(-1);
|
||||
|
||||
Initialization();
|
||||
|
||||
// default for the disabled
|
||||
GetDynamicRange();
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void qTabSettings::SetupDetectorSettings() {
|
||||
QStandardItemModel *model =
|
||||
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||
if (model) {
|
||||
QModelIndex index[NUMSETTINGS];
|
||||
QStandardItem *item[NUMSETTINGS];
|
||||
for (int i = 0; i < NUMSETTINGS; ++i) {
|
||||
index[i] = model->index(i, comboSettings->modelColumn(),
|
||||
comboSettings->rootModelIndex());
|
||||
index[i] = model->index(i, comboSettings->modelColumn(), comboSettings->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
item[i]->setEnabled(false);
|
||||
item[i]->setEnabled(false);
|
||||
}
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
@ -77,26 +83,15 @@ void qTabSettings::SetupDetectorSettings() {
|
||||
item[(int)FORCESWITCHG1]->setEnabled(true);
|
||||
item[(int)FORCESWITCHG2]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
||||
item[(int)FIXGAIN1]->setEnabled(true);
|
||||
item[(int)FIXGAIN2]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
item[(int)G1_HIGHGAIN]->setEnabled(true);
|
||||
item[(int)G1_LOWGAIN]->setEnabled(true);
|
||||
item[(int)G2_HIGHCAP_HIGHGAIN]->setEnabled(true);
|
||||
item[(int)G2_HIGHCAP_LOWGAIN]->setEnabled(true);
|
||||
item[(int)G2_LOWCAP_HIGHGAIN]->setEnabled(true);
|
||||
item[(int)G2_LOWCAP_LOWGAIN]->setEnabled(true);
|
||||
item[(int)G4_HIGHGAIN]->setEnabled(true);
|
||||
item[(int)G4_LOWGAIN]->setEnabled(true);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
||||
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
"Unknown detector type. Exiting GUI.",
|
||||
"qTabSettings::SetupDetectorSettings");
|
||||
"Unknown detector type. Exiting GUI.", "qTabSettings::SetupDetectorSettings");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
@ -105,57 +100,47 @@ void qTabSettings::SetupDetectorSettings() {
|
||||
void qTabSettings::Initialization() {
|
||||
// Settings
|
||||
if (comboSettings->isEnabled())
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
|
||||
// Dynamic Range
|
||||
if (comboDynamicRange->isEnabled())
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
|
||||
// Threshold
|
||||
if (spinThreshold->isEnabled())
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetThresholdEnergy(int)));
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::GetSettings() {
|
||||
LOG(logDEBUG) << "Getting settings";
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
try {
|
||||
auto retval = det->getSettings().tsquash(
|
||||
"Inconsistent settings for all detectors.");
|
||||
FILE_LOG(logDEBUG) << "Getting settings";
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
try{
|
||||
auto retval = det->getSettings().tsquash("Inconsistent settings for all detectors.");
|
||||
switch (retval) {
|
||||
case slsDetectorDefs::UNDEFINED:
|
||||
comboSettings->setCurrentIndex(UNDEFINED);
|
||||
break;
|
||||
case slsDetectorDefs::UNINITIALIZED:
|
||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||
break;
|
||||
default:
|
||||
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
||||
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
||||
std::to_string(retval));
|
||||
}
|
||||
comboSettings->setCurrentIndex(retval);
|
||||
break;
|
||||
case slsDetectorDefs::UNDEFINED:
|
||||
comboSettings->setCurrentIndex(UNDEFINED);
|
||||
break;
|
||||
case slsDetectorDefs::UNINITIALIZED:
|
||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||
break;
|
||||
default:
|
||||
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
||||
throw sls::RuntimeError(std::string("Unknown settings: ") + std::to_string(retval));
|
||||
}
|
||||
comboSettings->setCurrentIndex(retval);
|
||||
break;
|
||||
}
|
||||
}
|
||||
CATCH_DISPLAY("Could not get settings.", "qTabSettings::GetSettings")
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
} CATCH_DISPLAY ("Could not get settings.", "qTabSettings::GetSettings")
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetSettings(int index) {
|
||||
// settings
|
||||
auto val = static_cast<slsDetectorDefs::detectorSettings>(index);
|
||||
try {
|
||||
LOG(logINFO) << "Setting Settings to " << sls::ToString(val);
|
||||
FILE_LOG(logINFO) << "Setting Settings to " << sls::ToString(val);
|
||||
det->setSettings(val);
|
||||
}
|
||||
CATCH_HANDLE("Could not set settings.", "qTabSettings::SetSettings", this,
|
||||
&qTabSettings::GetSettings)
|
||||
} CATCH_HANDLE ("Could not set settings.", "qTabSettings::SetSettings", this, &qTabSettings::GetSettings)
|
||||
// threshold
|
||||
if (spinThreshold->isEnabled()) {
|
||||
SetThresholdEnergy(spinThreshold->value());
|
||||
@ -163,12 +148,10 @@ void qTabSettings::SetSettings(int index) {
|
||||
}
|
||||
|
||||
void qTabSettings::GetDynamicRange() {
|
||||
LOG(logDEBUG) << "Getting dynamic range";
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
try {
|
||||
auto retval = det->getDynamicRange().tsquash(
|
||||
"Inconsistent dynamic range for all detectors.");
|
||||
FILE_LOG(logDEBUG) << "Getting dynamic range";
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
try {
|
||||
auto retval = det->getDynamicRange().tsquash("Inconsistent dynamic range for all detectors.");
|
||||
// set the final value on gui
|
||||
switch (retval) {
|
||||
case 32:
|
||||
@ -184,19 +167,14 @@ void qTabSettings::GetDynamicRange() {
|
||||
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
|
||||
std::to_string(retval));
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") + std::to_string(retval));
|
||||
}
|
||||
}
|
||||
CATCH_DISPLAY("Could not get dynamic range.",
|
||||
"qTabSettings::GetDynamicRange")
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
} CATCH_DISPLAY ("Could not get dynamic range.", "qTabSettings::GetDynamicRange")
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,SLOT(SetDynamicRange(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetDynamicRange(int index) {
|
||||
LOG(logINFO) << "Setting dynamic range to "
|
||||
<< comboDynamicRange->currentText().toAscii().data();
|
||||
FILE_LOG(logINFO) << "Setting dynamic range to " << comboDynamicRange->currentText().toAscii().data();
|
||||
try {
|
||||
switch (index) {
|
||||
case DYNAMICRANGE_32:
|
||||
@ -212,43 +190,32 @@ void qTabSettings::SetDynamicRange(int index) {
|
||||
det->setDynamicRange(4);
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
|
||||
std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") + std::to_string(index));
|
||||
}
|
||||
}
|
||||
CATCH_HANDLE("Could not set dynamic range.",
|
||||
"qTabSettings::SetDynamicRange", this,
|
||||
&qTabSettings::GetDynamicRange)
|
||||
} CATCH_HANDLE ("Could not set dynamic range.", "qTabSettings::SetDynamicRange", this, &qTabSettings::GetDynamicRange)
|
||||
}
|
||||
|
||||
void qTabSettings::GetThresholdEnergy() {
|
||||
LOG(logDEBUG) << "Getting theshold energy";
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetThresholdEnergy(int)));
|
||||
FILE_LOG(logDEBUG) << "Getting theshold energy";
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
||||
try {
|
||||
auto retval = det->getThresholdEnergy().tsquash(
|
||||
"Inconsistent threhsold energy for all detectors.");
|
||||
auto retval = det->getThresholdEnergy().tsquash("Inconsistent threhsold energy for all detectors.");
|
||||
spinThreshold->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get threshold energy.",
|
||||
"qTabDataOutput::GetThresholdEnergy")
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetThresholdEnergy(int)));
|
||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabDataOutput::GetThresholdEnergy")
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetThresholdEnergy(int index) {
|
||||
LOG(logINFO) << "Setting Threshold Energy to " << index << " eV";
|
||||
FILE_LOG(logINFO) << "Setting Threshold Energy to " << index << " eV";
|
||||
try {
|
||||
det->setThresholdEnergy(index);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get threshold energy.",
|
||||
"qTabSettings::SetThresholdEnergy")
|
||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabSettings::SetThresholdEnergy")
|
||||
// set the right value anyway (due to tolerance)
|
||||
GetThresholdEnergy();
|
||||
GetThresholdEnergy();
|
||||
}
|
||||
|
||||
void qTabSettings::Refresh() {
|
||||
LOG(logDEBUG) << "**Updating Settings Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updating Settings Tab";
|
||||
|
||||
if (comboSettings->isEnabled()) {
|
||||
GetSettings();
|
||||
@ -257,9 +224,9 @@ void qTabSettings::Refresh() {
|
||||
if (comboDynamicRange->isEnabled()) {
|
||||
GetDynamicRange();
|
||||
}
|
||||
|
||||
|
||||
if (spinThreshold->isEnabled())
|
||||
GetThresholdEnergy();
|
||||
|
||||
LOG(logDEBUG) << "**Updated Settings Tab";
|
||||
FILE_LOG(logDEBUG) << "**Updated Settings Tab";
|
||||
}
|
||||
|
@ -1,28 +1,7 @@
|
||||
|
||||
add_library(slsProjectCWarnings INTERFACE)
|
||||
target_compile_options(slsProjectCWarnings INTERFACE
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-unused-parameter #Needs to be slowly mitigated
|
||||
-Wdouble-promotion
|
||||
-Wformat=2
|
||||
-Wredundant-decls
|
||||
# -Wconversion
|
||||
-Wdouble-promotion
|
||||
-Werror=return-type
|
||||
)
|
||||
|
||||
# Install fake the library
|
||||
install(TARGETS slsProjectCWarnings
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
add_subdirectory(ctbDetectorServer)
|
||||
add_subdirectory(eigerDetectorServer)
|
||||
add_subdirectory(gotthardDetectorServer)
|
||||
add_subdirectory(jungfrauDetectorServer)
|
||||
#add_subdirectory(moenchDetectorServer)
|
||||
add_subdirectory(mythen3DetectorServer)
|
||||
add_subdirectory(gotthard2DetectorServer)
|
||||
add_subdirectory(moenchDetectorServer)
|
||||
add_subdirectory(gotthard2DetectorServer)
|
@ -4,14 +4,13 @@ if [ $# -eq 0 ]; then
|
||||
"gotthard2DetectorServer"
|
||||
"jungfrauDetectorServer"
|
||||
"mythen3DetectorServer"
|
||||
"moenchDetectorServer"
|
||||
)
|
||||
else
|
||||
declare -a det=("${1}")
|
||||
echo "got something"
|
||||
fi
|
||||
|
||||
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")
|
||||
declare -a deterror=("OK" "OK" "OK" "OK")
|
||||
|
||||
for ((i=0;i<${#det[@]};++i))
|
||||
do
|
||||
|
@ -32,7 +32,7 @@ target_compile_definitions(ctbDetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(ctbDetectorServer_virtual
|
||||
PUBLIC pthread rt slsProjectCWarnings
|
||||
PUBLIC pthread rt
|
||||
)
|
||||
|
||||
set_target_properties(ctbDetectorServer_virtual PROPERTIES
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -36,7 +36,7 @@ typedef struct udp_header_struct {
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
|
||||
/* Enums */
|
||||
enum ADCINDEX {V_PWR_IO, V_PWR_A, V_PWR_B, V_PWR_C, V_PWR_D, I_PWR_IO, I_PWR_A, I_PWR_B, I_PWR_C, I_PWR_D, S_ADC0, S_ADC1, S_ADC2, S_ADC3, S_ADC4, S_ADC5, S_ADC6, S_ADC7, S_TMP};
|
||||
enum ADCINDEX {V_PWR_IO, V_PWR_A, V_PWR_B, V_PWR_C, V_PWR_D, I_PWR_IO, I_PWR_A, I_PWR_B, I_PWR_C, I_PWR_D};
|
||||
enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
|
||||
D10, D11, D12, D13, D14, D15, D16, D17,
|
||||
D_PWR_D, D_PWR_CHIP, D_PWR_C, D_PWR_B, D_PWR_A, D_PWR_IO};
|
||||
@ -107,6 +107,7 @@ enum CLKINDEX {RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS};
|
||||
#define BIT32_MSK (0xFFFFFFFF)
|
||||
#define BIT16_MASK (0xFFFF)
|
||||
|
||||
#define ADC_PORT_INVERT_VAL (0x453b2593)
|
||||
#define MAXIMUM_ADC_CLK (65)
|
||||
#define PLL_VCO_FREQ_MHZ (800)
|
||||
|
||||
|
@ -25,13 +25,13 @@ int i2c_open(const char* file,unsigned int addr){
|
||||
//device file
|
||||
int fd = open( file, O_RDWR );
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Warning: Unable to open file %s\n",file));
|
||||
FILE_LOG(logERROR, ("Warning: Unable to open file %s\n",file));
|
||||
return -1;
|
||||
}
|
||||
|
||||
//device address
|
||||
if( ioctl( fd, I2C_SLAVE, addr&0x7F ) < 0 ) {
|
||||
LOG(logERROR, ("Warning: Unable to set slave address:0x%x \n",addr));
|
||||
FILE_LOG(logERROR, ("Warning: Unable to set slave address:0x%x \n",addr));
|
||||
return -2;
|
||||
}
|
||||
return fd;
|
||||
@ -45,17 +45,17 @@ int i2c_read(){
|
||||
|
||||
unsigned char buf = reg;
|
||||
if (write(fd, &buf, 1)!= 1){
|
||||
LOG(logERROR, ("Warning: Unable to write read request to register %d\n", reg));
|
||||
FILE_LOG(logERROR, ("Warning: Unable to write read request to register %d\n", reg));
|
||||
return -1;
|
||||
}
|
||||
//read and update value (but old value read out)
|
||||
if(read(fd, &buf, 1) != 1){
|
||||
LOG(logERROR, ("Warning: Unable to read register %d\n", reg));
|
||||
FILE_LOG(logERROR, ("Warning: Unable to read register %d\n", reg));
|
||||
return -2;
|
||||
}
|
||||
//read again to read the updated value
|
||||
if(read(fd, &buf, 1) != 1){
|
||||
LOG(logERROR, ("Warning: Unable to read register %d\n", reg));
|
||||
FILE_LOG(logERROR, ("Warning: Unable to read register %d\n", reg));
|
||||
return -2;
|
||||
}
|
||||
close(fd);
|
||||
@ -76,7 +76,7 @@ int i2c_write(unsigned int value){
|
||||
buf[0] = reg;
|
||||
buf[1] = val;
|
||||
if (write(fd, buf, 2) != 2) {
|
||||
LOG(logERROR, ("Warning: Unable to write %d to register %d\n",val, reg));
|
||||
FILE_LOG(logERROR, ("Warning: Unable to write %d to register %d\n",val, reg));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -92,10 +92,10 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
int fd = open(PORTNAME, O_RDWR | O_NOCTTY | O_SYNC);
|
||||
if(fd < 0){
|
||||
LOG(logERROR, ("Warning: Unable to open port %s\n", PORTNAME));
|
||||
FILE_LOG(logERROR, ("Warning: Unable to open port %s\n", PORTNAME));
|
||||
return -1;
|
||||
}
|
||||
LOG(logINFO, ("opened port at %s\n",PORTNAME));
|
||||
FILE_LOG(logINFO, ("opened port at %s\n",PORTNAME));
|
||||
|
||||
struct termios serial_conf;
|
||||
// reset structure
|
||||
@ -110,17 +110,17 @@ int main(int argc, char* argv[]) {
|
||||
serial_conf.c_lflag = ICANON;
|
||||
// flush input
|
||||
if(tcflush(fd, TCIOFLUSH) < 0){
|
||||
LOG(logERROR, ("Warning: error form tcflush %d\n", errno));
|
||||
FILE_LOG(logERROR, ("Warning: error form tcflush %d\n", errno));
|
||||
return 0;
|
||||
}
|
||||
// set new options for the port, TCSANOW:changes occur immediately without waiting for data to complete
|
||||
if(tcsetattr(fd, TCSANOW, &serial_conf) < 0){
|
||||
LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno));
|
||||
FILE_LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(tcsetattr(fd, TCSAFLUSH, &serial_conf) < 0){
|
||||
LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno));
|
||||
FILE_LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -130,25 +130,25 @@ int main(int argc, char* argv[]) {
|
||||
char buffer[BUFFERSIZE];
|
||||
memset(buffer,0,BUFFERSIZE);
|
||||
buffer[BUFFERSIZE-1] = '\n';
|
||||
LOG(logINFO, ("Ready...\n"));
|
||||
FILE_LOG(logINFO, ("Ready...\n"));
|
||||
|
||||
|
||||
while(ret != GOODBYE){
|
||||
memset(buffer,0,BUFFERSIZE);
|
||||
n = read(fd,buffer,BUFFERSIZE);
|
||||
LOG(logDEBUG1, ("Received %d Bytes\n", n));
|
||||
LOG(logINFO, ("Got message: '%s'\n",buffer));
|
||||
FILE_LOG(logDEBUG1, ("Received %d Bytes\n", n));
|
||||
FILE_LOG(logINFO, ("Got message: '%s'\n",buffer));
|
||||
|
||||
switch(buffer[0]){
|
||||
case '\0':
|
||||
LOG(logINFO, ("Got Start (Detector restart)\n"));
|
||||
FILE_LOG(logINFO, ("Got Start (Detector restart)\n"));
|
||||
break;
|
||||
case 's':
|
||||
LOG(logINFO, ("Got Start \n"));
|
||||
FILE_LOG(logINFO, ("Got Start \n"));
|
||||
break;
|
||||
case 'p':
|
||||
if (!sscanf(&buffer[1],"%d",&ival)){
|
||||
LOG(logERROR, ("Warning: cannot scan voltage value\n"));
|
||||
FILE_LOG(logERROR, ("Warning: cannot scan voltage value\n"));
|
||||
break;
|
||||
}
|
||||
// ok/ fail
|
||||
@ -158,9 +158,9 @@ int main(int argc, char* argv[]) {
|
||||
strcpy(buffer,"fail ");
|
||||
else
|
||||
strcpy(buffer,"success ");
|
||||
LOG(logINFO, ("Sending: '%s'\n",buffer));
|
||||
FILE_LOG(logINFO, ("Sending: '%s'\n",buffer));
|
||||
n = write(fd, buffer, BUFFERSIZE);
|
||||
LOG(logDEBUG1, ("Sent %d Bytes\n", n));
|
||||
FILE_LOG(logDEBUG1, ("Sent %d Bytes\n", n));
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
@ -173,17 +173,17 @@ int main(int argc, char* argv[]) {
|
||||
else
|
||||
strcpy(buffer,"success ");
|
||||
n = write(fd, buffer, BUFFERSIZE);
|
||||
LOG(logINFO, ("Sending: '%s'\n",buffer));
|
||||
LOG(logDEBUG1, ("Sent %d Bytes\n", n));
|
||||
FILE_LOG(logINFO, ("Sending: '%s'\n",buffer));
|
||||
FILE_LOG(logDEBUG1, ("Sent %d Bytes\n", n));
|
||||
//value
|
||||
memset(buffer,0,BUFFERSIZE);
|
||||
buffer[BUFFERSIZE-1] = '\n';
|
||||
if(ival >= 0){
|
||||
LOG(logINFO, ("Sending: '%d'\n",ival));
|
||||
FILE_LOG(logINFO, ("Sending: '%d'\n",ival));
|
||||
sprintf(buffer,"%d ",ival);
|
||||
n = write(fd, buffer, BUFFERSIZE);
|
||||
LOG(logINFO, ("Sent %d Bytes\n", n));
|
||||
}else LOG(logERROR, ("%s\n",buffer));
|
||||
FILE_LOG(logINFO, ("Sent %d Bytes\n", n));
|
||||
}else FILE_LOG(logERROR, ("%s\n",buffer));
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
@ -191,7 +191,7 @@ int main(int argc, char* argv[]) {
|
||||
ret = GOODBYE;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("Unknown Command. buffer:'%s'\n",buffer));
|
||||
FILE_LOG(logERROR, ("Unknown Command. buffer:'%s'\n",buffer));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ unsigned int BebInfo_GetSrcPort(struct BebInfo* bebInfo, int ten_gig) {return te
|
||||
|
||||
|
||||
void BebInfo_Print(struct BebInfo* bebInfo) {
|
||||
LOG(logINFO, (
|
||||
FILE_LOG(logINFO, (
|
||||
"%d) Beb Info:\n"
|
||||
"\tSerial Add: 0x%x\n"
|
||||
"\tMAC 1GbE: %s\n"
|
||||
@ -133,7 +133,7 @@ void Beb_Beb(int id) {
|
||||
|
||||
if (!Beb_InitBebInfos()) exit(1);
|
||||
|
||||
LOG(logDEBUG1, ("Printing Beb infos:\n"));
|
||||
FILE_LOG(logDEBUG1, ("Printing Beb infos:\n"));
|
||||
unsigned int i;
|
||||
for(i=1;i<bebInfoSize;i++) BebInfo_Print(&beb_infos[i]);
|
||||
|
||||
@ -157,12 +157,12 @@ void Beb_GetModuleConfiguration(int* master, int* top, int* normal) {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Module Configuration FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Module Configuration FAIL\n"));
|
||||
} else {
|
||||
//read data
|
||||
ret = Beb_Read32(csp0base, MODULE_CONFIGURATION_MASK);
|
||||
LOG(logDEBUG1, ("Module Configuration OK\n"));
|
||||
LOG(logDEBUG1, ("Beb: value =0x%x\n",ret));
|
||||
FILE_LOG(logDEBUG1, ("Module Configuration OK\n"));
|
||||
FILE_LOG(logDEBUG1, ("Beb: value =0x%x\n",ret));
|
||||
if (ret&TOP_BIT_MASK) {
|
||||
*top = 1;
|
||||
Beb_top = 1;
|
||||
@ -215,7 +215,7 @@ void Beb_EndofDataSend(int tengiga) {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_COUNTER_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Delay read counter fail\n"));
|
||||
FILE_LOG(logERROR, ("Delay read counter fail\n"));
|
||||
return;
|
||||
} else {
|
||||
//read data first time
|
||||
@ -227,7 +227,7 @@ void Beb_EndofDataSend(int tengiga) {
|
||||
r_framepktMsbcounter = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
|
||||
r_txndelaycounter = Beb_Read32(csp0base, addr_r_txndelaycounter);
|
||||
r_framedelaycounter = Beb_Read32(csp0base, addr_r_framedelaycounter);
|
||||
LOG(logDEBUG1, ("\nLeft\n"
|
||||
FILE_LOG(logDEBUG1, ("\nLeft\n"
|
||||
"FramepacketLsbcounter: %d\n"
|
||||
"FramepacketMsbcounter: %d\n"
|
||||
"Txndelaycounter:%d\n"
|
||||
@ -245,7 +245,7 @@ void Beb_EndofDataSend(int tengiga) {
|
||||
while(1) {
|
||||
maxtimer = MAX(MAX(l_txndelaycounter,l_framedelaycounter),MAX(r_txndelaycounter,r_framedelaycounter));
|
||||
maxtimer /= 100;
|
||||
LOG(logDEBUG1, ("Will wait for %d us\n",maxtimer));
|
||||
FILE_LOG(logDEBUG1, ("Will wait for %d us\n",maxtimer));
|
||||
usleep(maxtimer);
|
||||
|
||||
//read new values
|
||||
@ -257,7 +257,7 @@ void Beb_EndofDataSend(int tengiga) {
|
||||
r_framepktMsbcounter_new = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
|
||||
r_txndelaycounter_new = Beb_Read32(csp0base, addr_r_txndelaycounter);
|
||||
r_framedelaycounter_new = Beb_Read32(csp0base, addr_r_framedelaycounter);
|
||||
LOG(logDEBUG1, ("\nLeft\n"
|
||||
FILE_LOG(logDEBUG1, ("\nLeft\n"
|
||||
"FramepacketLsbcounter: %d\n"
|
||||
"FramepacketMsbcounter: %d\n"
|
||||
"Txndelaycounter:%d\n"
|
||||
@ -288,7 +288,7 @@ void Beb_EndofDataSend(int tengiga) {
|
||||
|
||||
}
|
||||
|
||||
LOG(logINFO, ("Detector has sent all data\n"));
|
||||
FILE_LOG(logINFO, ("Detector has sent all data\n"));
|
||||
//close file pointer
|
||||
Beb_close(fd,csp0base);
|
||||
}
|
||||
@ -310,14 +310,14 @@ int Beb_SetMasterViaSoftware() {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Set Master FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Set Master FAIL\n"));
|
||||
} else {
|
||||
value = Beb_Read32(csp0base, MASTERCONFIG_OFFSET);
|
||||
value|=MASTER_BIT;
|
||||
value|=OVERWRITE_HARDWARE_BIT;
|
||||
int newval = Beb_Write32(csp0base, MASTERCONFIG_OFFSET,value);
|
||||
if (newval!=value) {
|
||||
LOG(logERROR, ("Could not set Master via Software\n"));
|
||||
FILE_LOG(logERROR, ("Could not set Master via Software\n"));
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
@ -343,14 +343,14 @@ int Beb_SetSlaveViaSoftware() {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Set Slave FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Set Slave FAIL\n"));
|
||||
} else {
|
||||
value = Beb_Read32(csp0base, MASTERCONFIG_OFFSET);
|
||||
value&=~MASTER_BIT;
|
||||
value|=OVERWRITE_HARDWARE_BIT;
|
||||
int newval = Beb_Write32(csp0base, MASTERCONFIG_OFFSET,value);
|
||||
if (newval!=value) {
|
||||
LOG(logERROR, ("Could not set Slave via Software\n"));
|
||||
FILE_LOG(logERROR, ("Could not set Slave via Software\n"));
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
@ -371,11 +371,11 @@ int Beb_Activate(int enable) {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Deactivate FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Deactivate FAIL\n"));
|
||||
} else {
|
||||
if (enable > -1) {
|
||||
value = Beb_Read32(csp0base, MASTERCONFIG_OFFSET);
|
||||
LOG(logINFO, ("Deactivate register value before:%d\n",value));
|
||||
FILE_LOG(logINFO, ("Deactivate register value before:%d\n",value));
|
||||
if (enable)
|
||||
value&=~DEACTIVATE_BIT;
|
||||
else
|
||||
@ -384,9 +384,9 @@ int Beb_Activate(int enable) {
|
||||
int newval = Beb_Write32(csp0base, MASTERCONFIG_OFFSET,value);
|
||||
if (newval!=value) {
|
||||
if (enable) {
|
||||
LOG(logERROR, ("Could not activate via Software\n"));
|
||||
FILE_LOG(logERROR, ("Could not activate via Software\n"));
|
||||
} else {
|
||||
LOG(logERROR, ("Could not deactivate via Software\n"));
|
||||
FILE_LOG(logERROR, ("Could not deactivate via Software\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -396,9 +396,9 @@ int Beb_Activate(int enable) {
|
||||
else ret = 1;
|
||||
if (enable == -1) {
|
||||
if (ret) {
|
||||
LOG(logINFOBLUE, ("Detector is active. Register value:%d\n", value));
|
||||
FILE_LOG(logINFOBLUE, ("Detector is active. Register value:%d\n", value));
|
||||
} else {
|
||||
LOG(logERROR, ("Detector is deactivated! Register value:%d\n", value));
|
||||
FILE_LOG(logERROR, ("Detector is deactivated! Register value:%d\n", value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ int Beb_Set32bitOverflow(int val) {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Could not read register to set overflow flag in 32 bit mode. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to set overflow flag in 32 bit mode. FAIL\n"));
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
@ -459,7 +459,7 @@ int Beb_GetTenGigaFlowControl() {
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
LOG(logERROR, ("Could not read register to get ten giga flow control. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to get ten giga flow control. FAIL\n"));
|
||||
return -1;
|
||||
} else {
|
||||
u_int32_t retval = Beb_Read32(csp0base, offset);
|
||||
@ -471,13 +471,13 @@ int Beb_GetTenGigaFlowControl() {
|
||||
}
|
||||
|
||||
int Beb_SetTenGigaFlowControl(int value) {
|
||||
LOG(logINFO, ("Setting ten giga flow control to %d\n", value));
|
||||
FILE_LOG(logINFO, ("Setting ten giga flow control to %d\n", value));
|
||||
value = value == 0 ? 0 : 1;
|
||||
u_int32_t offset = FLOW_REG_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
LOG(logERROR, ("Could not read register to set ten giga flow control. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to set ten giga flow control. FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
// reset bit
|
||||
@ -499,7 +499,7 @@ int Beb_GetTransmissionDelayFrame() {
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
LOG(logERROR, ("Could not read register to get transmission delay frame. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to get transmission delay frame. FAIL\n"));
|
||||
return -1;
|
||||
} else {
|
||||
u_int32_t retval = Beb_Read32(csp0base, offset);
|
||||
@ -509,16 +509,16 @@ int Beb_GetTransmissionDelayFrame() {
|
||||
}
|
||||
|
||||
int Beb_SetTransmissionDelayFrame(int value) {
|
||||
LOG(logINFO, ("Setting transmission delay frame to %d\n", value));
|
||||
FILE_LOG(logINFO, ("Setting transmission delay frame to %d\n", value));
|
||||
if (value < 0) {
|
||||
LOG(logERROR, ("Invalid transmission delay frame value %d\n", value));
|
||||
FILE_LOG(logERROR, ("Invalid transmission delay frame value %d\n", value));
|
||||
return 0;
|
||||
}
|
||||
u_int32_t offset = TXM_DELAY_FRAME_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
LOG(logERROR, ("Could not read register to set transmission delay frame. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to set transmission delay frame. FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
Beb_Write32(csp0base, offset, value);
|
||||
@ -532,7 +532,7 @@ int Beb_GetTransmissionDelayLeft() {
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
LOG(logERROR, ("Could not read register to get transmission delay left. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to get transmission delay left. FAIL\n"));
|
||||
return -1;
|
||||
} else {
|
||||
u_int32_t retval = Beb_Read32(csp0base, offset);
|
||||
@ -542,16 +542,16 @@ int Beb_GetTransmissionDelayLeft() {
|
||||
}
|
||||
|
||||
int Beb_SetTransmissionDelayLeft(int value) {
|
||||
LOG(logINFO, ("Setting transmission delay left to %d\n", value));
|
||||
FILE_LOG(logINFO, ("Setting transmission delay left to %d\n", value));
|
||||
if (value < 0) {
|
||||
LOG(logERROR, ("Invalid transmission delay left value %d\n", value));
|
||||
FILE_LOG(logERROR, ("Invalid transmission delay left value %d\n", value));
|
||||
return 0;
|
||||
}
|
||||
u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
LOG(logERROR, ("Could not read register to set transmission delay left. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to set transmission delay left. FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
Beb_Write32(csp0base, offset, value);
|
||||
@ -565,7 +565,7 @@ int Beb_GetTransmissionDelayRight() {
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
LOG(logERROR, ("Could not read register to get transmission delay right. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to get transmission delay right. FAIL\n"));
|
||||
return -1;
|
||||
} else {
|
||||
u_int32_t retval = Beb_Read32(csp0base, offset);
|
||||
@ -575,16 +575,16 @@ int Beb_GetTransmissionDelayRight() {
|
||||
}
|
||||
|
||||
int Beb_SetTransmissionDelayRight(int value) {
|
||||
LOG(logINFO, ("Setting transmission delay right to %d\n", value));
|
||||
FILE_LOG(logINFO, ("Setting transmission delay right to %d\n", value));
|
||||
if (value < 0) {
|
||||
LOG(logERROR, ("Invalid transmission delay right value %d\n", value));
|
||||
FILE_LOG(logERROR, ("Invalid transmission delay right value %d\n", value));
|
||||
return 0;
|
||||
}
|
||||
u_int32_t offset = TXM_DELAY_RIGHT_OFFSET;
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd <= 0) {
|
||||
LOG(logERROR, ("Could not read register to set transmission delay right. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to set transmission delay right. FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
Beb_Write32(csp0base, offset, value);
|
||||
@ -617,12 +617,12 @@ int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val) {
|
||||
break;
|
||||
|
||||
|
||||
default: LOG(logERROR, ("Unrecognized mode in network parameter: %d\n",mode)); return -1;
|
||||
default: FILE_LOG(logERROR, ("Unrecognized mode in network parameter: %d\n",mode)); return -1;
|
||||
}
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Could not read register to set network parameter. FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Could not read register to set network parameter. FAIL\n"));
|
||||
return -1;
|
||||
} else {
|
||||
if (val > -1) {
|
||||
@ -655,11 +655,11 @@ int Beb_ResetToHardwareSettings() {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Reset to Hardware Settings FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Reset to Hardware Settings FAIL\n"));
|
||||
} else {
|
||||
value = Beb_Write32(csp0base, MASTERCONFIG_OFFSET,0);
|
||||
if (value) {
|
||||
LOG(logERROR, ("Could not reset to hardware settings\n"));
|
||||
FILE_LOG(logERROR, ("Could not reset to hardware settings\n"));
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
@ -682,11 +682,11 @@ u_int32_t Beb_GetFirmwareRevision() {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_VERSION);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Firmware Revision Read FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Firmware Revision Read FAIL\n"));
|
||||
} else {
|
||||
value = Beb_Read32(csp0base, FIRMWARE_VERSION_OFFSET);
|
||||
if (!value) {
|
||||
LOG(logERROR, ("Firmware Revision Number does not exist in this version\n"));
|
||||
FILE_LOG(logERROR, ("Firmware Revision Number does not exist in this version\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -706,11 +706,11 @@ u_int32_t Beb_GetFirmwareSoftwareAPIVersion() {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_VERSION);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Firmware Software API Version Read FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Firmware Software API Version Read FAIL\n"));
|
||||
} else {
|
||||
value = Beb_Read32(csp0base, FIRMWARESOFTWARE_API_OFFSET);
|
||||
if (!value) {
|
||||
LOG(logERROR, ("Firmware Software API Version does not exist in this version\n"));
|
||||
FILE_LOG(logERROR, ("Firmware Software API Version does not exist in this version\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -731,14 +731,14 @@ void Beb_ResetFrameNumber() {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Reset Frame Number FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Reset Frame Number FAIL\n"));
|
||||
} else {
|
||||
//write a 1
|
||||
Beb_Write32(csp0base, FRAME_NUM_RESET_OFFSET, 1);
|
||||
usleep(100000); //100ms
|
||||
//write a 0
|
||||
Beb_Write32(csp0base, FRAME_NUM_RESET_OFFSET, 0);
|
||||
LOG(logINFO, ("Frame Number Reset OK\n"));
|
||||
FILE_LOG(logINFO, ("Frame Number Reset OK\n"));
|
||||
//close file pointer
|
||||
Beb_close(fd,csp0base);
|
||||
}
|
||||
@ -764,7 +764,7 @@ int Beb_InitBebInfos() {//file name at some point
|
||||
|
||||
int i0=Beb_detid,i1=0;
|
||||
if (Beb_GetBebInfoIndex(i0)) {
|
||||
LOG(logERROR, ("cant add beb. adding beb %d, beb number %d already added.\n",Beb_detid, i0));
|
||||
FILE_LOG(logERROR, ("cant add beb. adding beb %d, beb number %d already added.\n",Beb_detid, i0));
|
||||
exit(0);
|
||||
}
|
||||
struct BebInfo b1;
|
||||
@ -798,7 +798,7 @@ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig, char* src_mac
|
||||
/******* if (!i) return 0;****************************/ //i must be greater than 0, zero is the global send
|
||||
BebInfo_SetHeaderInfo(&beb_infos[i],ten_gig,src_mac,src_ip,src_port);
|
||||
|
||||
LOG(logINFO, ("Printing Beb info number (%d) :\n",i));
|
||||
FILE_LOG(logINFO, ("Printing Beb info number (%d) :\n",i));
|
||||
BebInfo_Print(&beb_infos[i]);
|
||||
|
||||
return 1;
|
||||
@ -813,7 +813,7 @@ int Beb_CheckSourceStuffBebInfo() {
|
||||
if (!Beb_SetHeaderData(
|
||||
BebInfo_GetBebNumber(&beb_infos[i]),0,"00:00:00:00:00:00","10.0.0.1",20000)||
|
||||
!Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]),1,"00:00:00:00:00:00","10.0.0.1",20000)) {
|
||||
LOG(logINFO, ("Error in BebInfo for module number %d.\n",BebInfo_GetBebNumber(&beb_infos[i])));
|
||||
FILE_LOG(logINFO, ("Error in BebInfo for module number %d.\n",BebInfo_GetBebNumber(&beb_infos[i])));
|
||||
BebInfo_Print(&beb_infos[i]);
|
||||
return 0;
|
||||
}
|
||||
@ -826,10 +826,10 @@ unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb) {
|
||||
unsigned int i;
|
||||
for(i=1;i<bebInfoSize;i++)
|
||||
if (beb_numb==BebInfo_GetBebNumber(&beb_infos[i])) {
|
||||
LOG(logDEBUG1, ("*****found beb index:%d, for beb number:%d\n",i,beb_numb));
|
||||
FILE_LOG(logDEBUG1, ("*****found beb index:%d, for beb number:%d\n",i,beb_numb));
|
||||
return i;
|
||||
}
|
||||
LOG(logDEBUG1, ("*****Returning 0\n"));
|
||||
FILE_LOG(logDEBUG1, ("*****Returning 0\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -841,7 +841,7 @@ int Beb_WriteTo(unsigned int index) {
|
||||
return 1;
|
||||
|
||||
if (index>=bebInfoSize) {
|
||||
LOG(logERROR, ("WriteTo index error.\n"));
|
||||
FILE_LOG(logERROR, ("WriteTo index error.\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -886,7 +886,7 @@ int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header
|
||||
|
||||
int fd = Beb_open(&csp0base,bram_phy_addr);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Set up UDP Header FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Set up UDP Header FAIL\n"));
|
||||
} else {
|
||||
//read data
|
||||
memcpy(csp0base+header_number*16, &udp_header, sizeof(udp_header));
|
||||
@ -932,18 +932,18 @@ int Beb_SetHeaderData1(char* src_mac, char* src_ip, unsigned int src_port, char*
|
||||
*/
|
||||
|
||||
if (!Beb_SetMAC(src_mac,&(udp_header.src_mac[0]))) return 0;
|
||||
LOG(logINFO, ("Setting Source MAC to %s\n",src_mac));
|
||||
FILE_LOG(logINFO, ("Setting Source MAC to %s\n",src_mac));
|
||||
if (!Beb_SetIP(src_ip,&(udp_header.src_ip[0]))) return 0;
|
||||
LOG(logINFO, ("Setting Source IP to %s\n",src_ip));
|
||||
FILE_LOG(logINFO, ("Setting Source IP to %s\n",src_ip));
|
||||
if (!Beb_SetPortNumber(src_port,&(udp_header.src_port[0]))) return 0;
|
||||
LOG(logINFO, ("Setting Source port to %d\n",src_port));
|
||||
FILE_LOG(logINFO, ("Setting Source port to %d\n",src_port));
|
||||
|
||||
if (!Beb_SetMAC(dst_mac,&(udp_header.dst_mac[0]))) return 0;
|
||||
LOG(logINFO, ("Setting Destination MAC to %s\n",dst_mac));
|
||||
FILE_LOG(logINFO, ("Setting Destination MAC to %s\n",dst_mac));
|
||||
if (!Beb_SetIP(dst_ip,&(udp_header.dst_ip[0]))) return 0;
|
||||
LOG(logINFO, ("Setting Destination IP to %s\n",dst_ip));
|
||||
FILE_LOG(logINFO, ("Setting Destination IP to %s\n",dst_ip));
|
||||
if (!Beb_SetPortNumber(dst_port,&(udp_header.dst_port[0]))) return 0;
|
||||
LOG(logINFO, ("Setting Destination port to %d\n",dst_port));
|
||||
FILE_LOG(logINFO, ("Setting Destination port to %d\n",dst_port));
|
||||
|
||||
|
||||
Beb_AdjustIPChecksum(&udp_header);
|
||||
@ -968,7 +968,7 @@ int Beb_SetMAC(char* mac, uint8_t* dst_ptr) {
|
||||
char *pch = strtok (macVal,":");
|
||||
while (pch != NULL) {
|
||||
if (strlen(pch)!=2) {
|
||||
LOG(logERROR, ("Error: in mac address -> %s\n",macVal));
|
||||
FILE_LOG(logERROR, ("Error: in mac address -> %s\n",macVal));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -987,7 +987,7 @@ int Beb_SetIP(char* ip, uint8_t* dst_ptr) {
|
||||
char *pch = strtok (ipVal,".");
|
||||
while (pch != NULL) {
|
||||
if (((i!=3) && ((strlen(pch)>3) || (strlen(pch)<1))) || ((i==3)&&((strlen(pch)<1) || (strlen(pch) > 3)))) {
|
||||
LOG(logERROR, ("Error: in ip address -> %s\n",ipVal));
|
||||
FILE_LOG(logERROR, ("Error: in ip address -> %s\n",ipVal));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1050,11 +1050,11 @@ int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, i
|
||||
|
||||
|
||||
Beb_send_data[1] = 0x62000000 | (!stop_read_when_fifo_empty) << 27 | (ten_gig==1) << 24 | packet_size << 14 | dst_number << 8 | npackets;
|
||||
LOG(logDEBUG1, ("Beb_send_data[1]:%X\n",Beb_send_data[1]));
|
||||
FILE_LOG(logDEBUG1, ("Beb_send_data[1]:%X\n",Beb_send_data[1]));
|
||||
Beb_send_data[2] = 0;
|
||||
|
||||
Beb_SwapDataFun(0,2,&(Beb_send_data[1]));
|
||||
LOG(logDEBUG1, ("Beb_send_data[1] Swapped:%X\n",Beb_send_data[1]));
|
||||
FILE_LOG(logDEBUG1, ("Beb_send_data[1] Swapped:%X\n",Beb_send_data[1]));
|
||||
|
||||
if (Beb_activated) {
|
||||
if (!Beb_WriteTo(i)) return 0;
|
||||
@ -1085,7 +1085,7 @@ int Beb_StopAcquisition()
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_CMD_GENERATOR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Beb Stop Acquisition FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Beb Stop Acquisition FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
//find value
|
||||
@ -1098,7 +1098,7 @@ int Beb_StopAcquisition()
|
||||
Beb_Write32(csp0base, (LEFT_OFFSET + STOP_ACQ_OFFSET),(valuel&(~STOP_ACQ_BIT)));
|
||||
Beb_Write32(csp0base, (RIGHT_OFFSET + STOP_ACQ_OFFSET),(valuer&(~STOP_ACQ_BIT)));
|
||||
|
||||
LOG(logINFO, ("Beb Stop Acquisition OK\n"));
|
||||
FILE_LOG(logINFO, ("Beb Stop Acquisition OK\n"));
|
||||
//close file pointer
|
||||
Beb_close(fd,csp0base);
|
||||
}
|
||||
@ -1116,7 +1116,7 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
unsigned int nl = Beb_readNLines;
|
||||
unsigned int npackets = (nl * maxnp) / maxnl;
|
||||
if ((nl * maxnp) % maxnl) {
|
||||
LOG(logERROR, ("Read N Lines is incorrect. Switching to Full Image Readout\n"));
|
||||
FILE_LOG(logERROR, ("Read N Lines is incorrect. Switching to Full Image Readout\n"));
|
||||
npackets = maxnp;
|
||||
}
|
||||
int in_two_requests = (npackets > MAX_PACKETS_PER_REQUEST) ? 1 : 0;
|
||||
@ -1126,8 +1126,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
unsigned int header_size = 4; //4*64 bits
|
||||
unsigned int packet_size = ten_gig ? 0x200 : 0x80; // 4k or 1k packets
|
||||
|
||||
LOG(logDEBUG1, ("----Beb_RequestNImages Start----\n"));
|
||||
LOG(logINFO, ("beb_number:%d, ten_gig:%d,dst_number:%d, npackets:%d, "
|
||||
FILE_LOG(logDEBUG1, ("----Beb_RequestNImages Start----\n"));
|
||||
FILE_LOG(logINFO, ("beb_number:%d, ten_gig:%d,dst_number:%d, npackets:%d, "
|
||||
"Beb_bit_mode:%d, header_size:%d, nimages:%d, test_just_send_out_packets_no_wait:%d\n",
|
||||
beb_number, ten_gig, dst_number, npackets, Beb_bit_mode, header_size,
|
||||
nimages, test_just_send_out_packets_no_wait));
|
||||
@ -1138,13 +1138,13 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_CMD_GENERATOR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Beb Request N Images FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Beb Request N Images FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 10; i++)
|
||||
LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4))));
|
||||
FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4))));
|
||||
}
|
||||
// Generating commands
|
||||
u_int32_t send_header_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | header_size << 14 | 0;
|
||||
@ -1152,8 +1152,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 10; i++)
|
||||
LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4))));
|
||||
LOG(logDEBUG1, ("%d\n",in_two_requests));
|
||||
FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4))));
|
||||
FILE_LOG(logDEBUG1, ("%d\n",in_two_requests));
|
||||
}
|
||||
//"0x20 << 8" is dst_number (0x00 for left, 0x20 for right)
|
||||
//Left
|
||||
@ -1181,12 +1181,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < 10; i++)
|
||||
LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); //*(ptrl+i));
|
||||
LOG(logDEBUG1, ("%d\n",in_two_requests));
|
||||
FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); //*(ptrl+i));
|
||||
FILE_LOG(logDEBUG1, ("%d\n",in_two_requests));
|
||||
}
|
||||
Beb_close(fd,csp0base);
|
||||
|
||||
LOG(logDEBUG1, ("----Beb_RequestNImages----\n"));
|
||||
FILE_LOG(logDEBUG1, ("----Beb_RequestNImages----\n"));
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -1194,7 +1194,7 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
|
||||
|
||||
int Beb_Test(unsigned int beb_number) {
|
||||
LOG(logINFO, ("Testing module number: %d\n",beb_number));
|
||||
FILE_LOG(logINFO, ("Testing module number: %d\n",beb_number));
|
||||
|
||||
|
||||
//int SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header_number, string dst_mac, string dst_ip, unsigned int dst_port) {
|
||||
@ -1202,14 +1202,14 @@ int Beb_Test(unsigned int beb_number) {
|
||||
|
||||
unsigned int index = Beb_GetBebInfoIndex(beb_number);
|
||||
if (!index) {
|
||||
LOG(logERROR, ("Error beb number (%d)not in list????\n",beb_number));
|
||||
FILE_LOG(logERROR, ("Error beb number (%d)not in list????\n",beb_number));
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int i;
|
||||
for(i=0;i<64;i++) {
|
||||
if (!Beb_SetUpUDPHeader(beb_number,0,i,"60:fb:42:f4:e3:d2","129.129.205.186",22000+i)) {
|
||||
LOG(logERROR, ("Error setting up header table....\n"));
|
||||
FILE_LOG(logERROR, ("Error setting up header table....\n"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -1217,7 +1217,7 @@ int Beb_Test(unsigned int beb_number) {
|
||||
// SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, int stop_read_when_fifo_empty=1);
|
||||
for(i=0;i<64;i++) {
|
||||
if (!Beb_SendMultiReadRequest(beb_number,i%3+1,0,i,1,0,1)) {
|
||||
LOG(logERROR, ("Error requesting data....\n"));
|
||||
FILE_LOG(logERROR, ("Error requesting data....\n"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -1237,7 +1237,7 @@ int Beb_GetBebFPGATemp()
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_SYSMON_0_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Module Configuration FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Module Configuration FAIL\n"));
|
||||
} else {
|
||||
//read data
|
||||
ret = Beb_Read32(csp0base, FPGA_TEMP_OFFSET);
|
||||
@ -1255,11 +1255,11 @@ void Beb_SetDetectorNumber(uint32_t detid) {
|
||||
return;
|
||||
|
||||
uint32_t swapid = Beb_swap_uint16(detid);
|
||||
//LOG(logINFO, "detector id %d swapped %d\n", detid, swapid));
|
||||
//FILE_LOG(logINFO, "detector id %d swapped %d\n", detid, swapid));
|
||||
u_int32_t* csp0base=0;
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_TEST_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Set Detector ID FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Set Detector ID FAIL\n"));
|
||||
return;
|
||||
} else {
|
||||
uint32_t value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||
@ -1267,24 +1267,24 @@ void Beb_SetDetectorNumber(uint32_t detid) {
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||
if ((value & UDP_HEADER_ID_MSK) != ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK)) {
|
||||
LOG(logERROR, ("Set Detector ID FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Set Detector ID FAIL\n"));
|
||||
}
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||
value &= UDP_HEADER_X_MSK; // to keep previous x value
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||
if ((value & UDP_HEADER_ID_MSK) != ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK)) {
|
||||
LOG(logERROR, ("Set Detector ID FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Set Detector ID FAIL\n"));
|
||||
}
|
||||
Beb_close(fd,csp0base);
|
||||
}
|
||||
LOG(logINFO, ("Detector id %d set in UDP Header\n\n", detid));
|
||||
FILE_LOG(logINFO, ("Detector id %d set in UDP Header\n\n", detid));
|
||||
}
|
||||
|
||||
int Beb_SetQuad(int value) {
|
||||
if (value < 0)
|
||||
return OK;
|
||||
LOG(logINFO, ("Setting Quad to %d in Beb\n", value));
|
||||
FILE_LOG(logINFO, ("Setting Quad to %d in Beb\n", value));
|
||||
Beb_quadEnable = (value == 0 ? 0 : 1);
|
||||
return Beb_SetDetectorPosition(Beb_positions);
|
||||
}
|
||||
@ -1300,7 +1300,7 @@ int* Beb_GetDetectorPosition() {
|
||||
int Beb_SetDetectorPosition(int pos[]) {
|
||||
if (!Beb_activated)
|
||||
return OK;
|
||||
LOG(logINFO, ("Got Position values %d %d...\n", pos[0],pos[1]));
|
||||
FILE_LOG(logINFO, ("Got Position values %d %d...\n", pos[0],pos[1]));
|
||||
|
||||
// save positions
|
||||
Beb_positions[0] = pos[0];
|
||||
@ -1321,7 +1321,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
//open file pointer
|
||||
int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_TEST_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Set Detector Position FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Set Detector Position FAIL\n"));
|
||||
return FAIL;
|
||||
} else {
|
||||
uint32_t value = 0;
|
||||
@ -1333,7 +1333,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||
if ((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)) {
|
||||
LOG(logERROR, ("Could not set row position for left port\n"));
|
||||
FILE_LOG(logERROR, ("Could not set row position for left port\n"));
|
||||
ret = FAIL;
|
||||
}
|
||||
// x right
|
||||
@ -1343,7 +1343,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||
if ((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)) {
|
||||
LOG(logERROR, ("Could not set row position for right port\n"));
|
||||
FILE_LOG(logERROR, ("Could not set row position for right port\n"));
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
@ -1356,7 +1356,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, value | ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
|
||||
if ((value & UDP_HEADER_Y_MSK) != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) {
|
||||
LOG(logERROR, ("Could not set column position for left port\n"));
|
||||
FILE_LOG(logERROR, ("Could not set column position for left port\n"));
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
@ -1367,7 +1367,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, value | ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
|
||||
if ((value & UDP_HEADER_Y_MSK) != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) {
|
||||
LOG(logERROR, ("Could not set column position for right port\n"));
|
||||
FILE_LOG(logERROR, ("Could not set column position for right port\n"));
|
||||
ret = FAIL;
|
||||
}
|
||||
|
||||
@ -1376,7 +1376,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
Beb_close(fd,csp0base);
|
||||
}
|
||||
if (ret == OK) {
|
||||
LOG(logINFO, ("Position set to...\n"
|
||||
FILE_LOG(logINFO, ("Position set to...\n"
|
||||
"\tLeft: [%d, %d]\n"
|
||||
"\tRight:[%d, %d]\n",
|
||||
posLeft[0], posLeft[1], posRight[0], posRight[1]));
|
||||
@ -1390,12 +1390,12 @@ int Beb_SetStartingFrameNumber(uint64_t value) {
|
||||
Beb_deactivatedStartFrameNumber = value;
|
||||
return OK;
|
||||
}
|
||||
LOG(logINFO, ("Setting start frame number: %llu\n", (long long unsigned int)value));
|
||||
FILE_LOG(logINFO, ("Setting start frame number: %llu\n", (long long unsigned int)value));
|
||||
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_TEST_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Set Start Frame Number FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Set Start Frame Number FAIL\n"));
|
||||
return FAIL;
|
||||
}
|
||||
// since the read is not implemented in firmware yet
|
||||
@ -1407,7 +1407,7 @@ int Beb_SetStartingFrameNumber(uint64_t value) {
|
||||
Beb_Write32(csp0base, UDP_HEADER_FRAME_NUMBER_MSB_OFST, (valueInFirmware >> 32) & (0xffffffff));
|
||||
Beb_close(fd,csp0base);
|
||||
|
||||
LOG(logINFO, ("Going to reset Frame Number\n"));
|
||||
FILE_LOG(logINFO, ("Going to reset Frame Number\n"));
|
||||
Beb_ResetFrameNumber();
|
||||
return OK;
|
||||
}
|
||||
@ -1418,11 +1418,11 @@ int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOG(logDEBUG1, ("Getting start frame number\n"));
|
||||
FILE_LOG(logDEBUG1, ("Getting start frame number\n"));
|
||||
u_int32_t* csp0base = 0;
|
||||
int fd = Beb_open(&csp0base, XPAR_COUNTER_BASEADDR);
|
||||
if (fd < 0) {
|
||||
LOG(logERROR, ("Get Start Frame Number FAIL\n"));
|
||||
FILE_LOG(logERROR, ("Get Start Frame Number FAIL\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -1440,7 +1440,7 @@ int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable) {
|
||||
|
||||
Beb_close(fd,csp0base);
|
||||
if (left1g != right1g) {
|
||||
LOG(logERROR, ("Retrieved inconsistent frame numbers from 1g left %llu and right %llu\n",
|
||||
FILE_LOG(logERROR, ("Retrieved inconsistent frame numbers from 1g left %llu and right %llu\n",
|
||||
(long long int)left1g, (long long int)right1g));
|
||||
*retval = (left1g > right1g) ? left1g : right1g; // give max to set it to when stopping acq & different value
|
||||
return -2; // to differentiate between failed address mapping
|
||||
@ -1461,7 +1461,7 @@ int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable) {
|
||||
++right10g; // increment for firmware
|
||||
|
||||
if (left10g != right10g) {
|
||||
LOG(logERROR, ("Retrieved inconsistent frame numbers from `0g left %llu and right %llu\n",
|
||||
FILE_LOG(logERROR, ("Retrieved inconsistent frame numbers from `0g left %llu and right %llu\n",
|
||||
(long long int)left10g, (long long int)right10g));
|
||||
*retval = (left10g > right10g) ? left10g : right10g; // give max to set it to when stopping acq & different value
|
||||
return -2; // to differentiate between failed address mapping
|
||||
@ -1484,15 +1484,15 @@ int Beb_open(u_int32_t** csp0base, u_int32_t offset) {
|
||||
|
||||
int fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
||||
if (fd == -1) {
|
||||
LOG(logERROR, ("\nCan't find /dev/mem!\n"));
|
||||
FILE_LOG(logERROR, ("\nCan't find /dev/mem!\n"));
|
||||
} else {
|
||||
LOG(logDEBUG1, ("/dev/mem opened\n"));
|
||||
FILE_LOG(logDEBUG1, ("/dev/mem opened\n"));
|
||||
*csp0base = (u_int32_t*)mmap(0, BEB_MMAP_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, offset);
|
||||
if (*csp0base == MAP_FAILED) {
|
||||
LOG(logERROR, ("\nCan't map memmory area!!\n"));
|
||||
FILE_LOG(logERROR, ("\nCan't map memmory area!!\n"));
|
||||
fd = -1;
|
||||
}
|
||||
else LOG(logDEBUG1, ("CSP0 mapped %p\n",(void*)*csp0base));
|
||||
else FILE_LOG(logDEBUG1, ("CSP0 mapped %p\n",(void*)*csp0base));
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ target_compile_definitions(eigerDetectorServerMaster_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(eigerDetectorServerMaster_virtual
|
||||
PUBLIC pthread rt slsProjectCWarnings
|
||||
PUBLIC pthread rt
|
||||
)
|
||||
|
||||
set_target_properties(eigerDetectorServerMaster_virtual PROPERTIES
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -55,7 +55,7 @@ void Feb_Interface_SendCompleteList(unsigned int n,unsigned int* list) {
|
||||
int Feb_Interface_WriteTo(unsigned int ch) {
|
||||
if (ch>0xfff) return 0;
|
||||
|
||||
LOG(logDEBUG1, ("FIW ch %d\n", ch));
|
||||
FILE_LOG(logDEBUG1, ("FIW ch %d\n", ch));
|
||||
|
||||
Feb_Interface_send_data_raw[0] = 0x8fff0000;
|
||||
if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
|
||||
@ -176,7 +176,7 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsign
|
||||
start_address &= 0x3fff;
|
||||
nwrites &= 0x3ff;
|
||||
if (!nwrites||nwrites>Feb_Interface_send_buffer_size-2) {
|
||||
LOG(logERROR, ("invalid nwrites:%d\n",nwrites));
|
||||
FILE_LOG(logERROR, ("invalid nwrites:%d\n",nwrites));
|
||||
return 0;
|
||||
}//*d-1026
|
||||
|
||||
|
@ -8,18 +8,18 @@
|
||||
|
||||
|
||||
void Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr) {
|
||||
LOG(logDEBUG1, ("Initialize PLB LL FIFOs\n"));
|
||||
FILE_LOG(logDEBUG1, ("Initialize PLB LL FIFOs\n"));
|
||||
ll->ll_fifo_base=0;
|
||||
ll->ll_fifo_ctrl_reg=0;
|
||||
if (Local_Init(ll,ll_fifo_badr)) {
|
||||
Local_Reset(ll);
|
||||
LOG(logDEBUG1, ("\tFIFO Status : 0x%08x\n\n\n", Local_StatusVector(ll)));
|
||||
} else LOG(logERROR, ("\tCould not map LocalLink : 0x%08x\n\n\n", ll_fifo_badr));
|
||||
FILE_LOG(logDEBUG1, ("\tFIFO Status : 0x%08x\n\n\n", Local_StatusVector(ll)));
|
||||
} else FILE_LOG(logERROR, ("\tCould not map LocalLink : 0x%08x\n\n\n", ll_fifo_badr));
|
||||
}
|
||||
|
||||
|
||||
void Local_LocalLinkInterface(struct LocalLinkInterface* ll) {
|
||||
LOG(logDEBUG1, ("Initializing new memory\n"));
|
||||
FILE_LOG(logDEBUG1, ("Initializing new memory\n"));
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ int Local_Reset(struct LocalLinkInterface* ll) {
|
||||
|
||||
int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask) {
|
||||
ll->ll_fifo_ctrl_reg |= rst_mask;
|
||||
LOG(logDEBUG1, ("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg));
|
||||
FILE_LOG(logDEBUG1, ("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg));
|
||||
|
||||
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
||||
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
||||
@ -90,9 +90,9 @@ int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buf
|
||||
last_word = (buffer_len-1)/4;
|
||||
word_ptr = (unsigned int *)buffer;
|
||||
|
||||
LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base));
|
||||
FILE_LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base));
|
||||
for (i=0; i < buffer_len/4; i++)
|
||||
LOG(logDEBUG1, ("%.8X ",*(((unsigned *) buffer)+i)));
|
||||
FILE_LOG(logDEBUG1, ("%.8X ",*(((unsigned *) buffer)+i)));
|
||||
|
||||
while (words_send <= last_word)
|
||||
{
|
||||
@ -101,7 +101,7 @@ int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buf
|
||||
status = HWIO_xfs_in32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_STATUS);
|
||||
if ((status & PLB_LL_FIFO_STATUS_ALMOSTFULL) == 0) vacancy = 1;
|
||||
if (vacancy == 0) {
|
||||
LOG(logERROR, ("Fifo full!\n"));
|
||||
FILE_LOG(logERROR, ("Fifo full!\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
volatile unsigned int fifo_val;
|
||||
int sof = 0;
|
||||
|
||||
LOG(logDEBUG1, ("LL Read - If: %X - Data: ",ll->ll_fifo_base));
|
||||
FILE_LOG(logDEBUG1, ("LL Read - If: %X - Data: ",ll->ll_fifo_base));
|
||||
|
||||
word_ptr = (unsigned int *)buffer;
|
||||
do
|
||||
@ -162,7 +162,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
{
|
||||
if ( (buffer_len >> 2) > buffer_ptr)
|
||||
{
|
||||
LOG(logDEBUG1, ("%.8X ", fifo_val));
|
||||
FILE_LOG(logDEBUG1, ("%.8X ", fifo_val));
|
||||
word_ptr[buffer_ptr++] = fifo_val; //write to buffer
|
||||
}
|
||||
else
|
||||
@ -174,7 +174,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
if (status & PLB_LL_FIFO_STATUS_LL_EOF)
|
||||
{
|
||||
len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT );
|
||||
LOG(logDEBUG1, ("Len: %d\n",len));
|
||||
FILE_LOG(logDEBUG1, ("Len: %d\n",len));
|
||||
buffer_ptr = 0;
|
||||
return len;
|
||||
}
|
||||
@ -207,11 +207,11 @@ int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
||||
|
||||
do{
|
||||
len = Local_Read(ll,rec_buff_len,rec_buffer);
|
||||
LOG(logDEBUG1, ("receive length: %i\n",len));
|
||||
FILE_LOG(logDEBUG1, ("receive length: %i\n",len));
|
||||
|
||||
if (len > 0) {
|
||||
rec_buffer[len]=0;
|
||||
LOG(logINFO, ("%s\n", (char*) rec_buffer));
|
||||
FILE_LOG(logINFO, ("%s\n", (char*) rec_buffer));
|
||||
}
|
||||
} while(len > 0);
|
||||
|
||||
|
Binary file not shown.
@ -11,7 +11,6 @@
|
||||
#include <unistd.h> //to gethostname
|
||||
#include <string.h>
|
||||
#ifdef VIRTUAL
|
||||
#include <netinet/in.h>
|
||||
#include "communication_funcs_UDP.h"
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
@ -107,7 +106,7 @@ void basictests() {
|
||||
initCheckDone = 0;
|
||||
memset(initErrorMessage, 0, MAX_STR_LENGTH);
|
||||
#ifdef VIRTUAL
|
||||
LOG(logINFOBLUE, ("************ EIGER Virtual Server *****************\n\n"));
|
||||
FILE_LOG(logINFOBLUE, ("************ EIGER Virtual Server *****************\n\n"));
|
||||
#endif
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
@ -116,7 +115,7 @@ void basictests() {
|
||||
int64_t sw_fw_apiversion = getFirmwareAPIVersion();
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
|
||||
LOG(logINFOBLUE, ("**************** EIGER Server *********************\n\n"
|
||||
FILE_LOG(logINFOBLUE, ("**************** EIGER Server *********************\n\n"
|
||||
"Detector IP Addr:\t\t 0x%x\n"
|
||||
"Detector MAC Addr:\t\t 0x%llx\n"
|
||||
|
||||
@ -150,7 +149,7 @@ void basictests() {
|
||||
//cant read versions
|
||||
if (!fwversion || !sw_fw_apiversion) {
|
||||
strcpy(initErrorMessage, "Cant read versions from FPGA. Please update firmware.\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
FILE_LOG(logERROR, (initErrorMessage));
|
||||
initError = FAIL;
|
||||
return;
|
||||
}
|
||||
@ -161,7 +160,7 @@ void basictests() {
|
||||
"Please update detector software (min. %lld) to be compatible with this firmware.\n",
|
||||
(long long int)sw_fw_apiversion,
|
||||
(long long int)REQUIRED_FIRMWARE_VERSION);
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
FILE_LOG(logERROR, (initErrorMessage));
|
||||
initError = FAIL;
|
||||
return;
|
||||
}
|
||||
@ -172,11 +171,11 @@ void basictests() {
|
||||
"Please update firmware (min. %lld) to be compatible with this server.\n",
|
||||
(long long int)fwversion,
|
||||
(long long int)REQUIRED_FIRMWARE_VERSION);
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
FILE_LOG(logERROR, (initErrorMessage));
|
||||
initError = FAIL;
|
||||
return;
|
||||
}
|
||||
LOG(logINFO, ("Compatibility - success\n"));
|
||||
FILE_LOG(logINFO, ("Compatibility - success\n"));
|
||||
}
|
||||
|
||||
|
||||
@ -242,15 +241,11 @@ u_int64_t getDetectorMAC() {
|
||||
strcat(mac,pch);
|
||||
pch = strtok (NULL, ":");
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sscanf(mac,"%lx",&res);
|
||||
#else
|
||||
sscanf(mac, "%llx", &res);
|
||||
#endif
|
||||
sscanf(mac,"%llx",&res);
|
||||
//increment by 1 for 10g
|
||||
if (send_to_ten_gig)
|
||||
res++;
|
||||
//LOG(logINFO, ("mac:%llx\n",res));
|
||||
//FILE_LOG(logINFO, ("mac:%llx\n",res));
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -268,9 +263,6 @@ u_int32_t getDetectorIP() {
|
||||
#endif
|
||||
fgets(output, sizeof(output), sysFile);
|
||||
pclose(sysFile);
|
||||
if (strlen(output) <= 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//converting IPaddress to hex.
|
||||
char* pcword = strtok (output,".");
|
||||
@ -281,7 +273,7 @@ u_int32_t getDetectorIP() {
|
||||
}
|
||||
strcpy(output,temp);
|
||||
sscanf(output, "%x", &res);
|
||||
//LOG(logINFO, ("ip:%x\n",res));
|
||||
//FILE_LOG(logINFO, ("ip:%x\n",res));
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -312,20 +304,12 @@ void initControlServer() {
|
||||
if (Feb_Control_OpenSerialCommunication())
|
||||
;// Feb_Control_CloseSerialCommunication();
|
||||
}
|
||||
LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
|
||||
FILE_LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
|
||||
Beb_Beb(detid);
|
||||
Beb_SetDetectorNumber(getDetectorNumber());
|
||||
LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
|
||||
FILE_LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
|
||||
|
||||
setupDetector();
|
||||
// activate (if it gets ip) (later FW will deactivate at startup)
|
||||
if (getDetectorIP() != 0) {
|
||||
Beb_Activate(1);
|
||||
Feb_Control_activate(1);
|
||||
} else {
|
||||
Beb_Activate(0);
|
||||
Feb_Control_activate(0);
|
||||
}
|
||||
}
|
||||
initCheckDone = 1;
|
||||
#endif
|
||||
@ -340,16 +324,7 @@ void initStopServer() {
|
||||
Feb_Interface_FebInterface();
|
||||
Feb_Control_FebControl();
|
||||
Feb_Control_Init(master,top,normal,getDetectorNumber());
|
||||
LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
|
||||
// activate (if it gets ip) (later FW will deactivate at startup)
|
||||
// also needed for stop server for status
|
||||
if (getDetectorIP() != 0) {
|
||||
Beb_Activate(1);
|
||||
Feb_Control_activate(1);
|
||||
} else {
|
||||
Beb_Activate(0);
|
||||
Feb_Control_activate(0);
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -368,7 +343,7 @@ void getModuleConfiguration() {
|
||||
#else
|
||||
normal = 1;
|
||||
#endif
|
||||
LOG(logINFOBLUE, ("Module: %s %s %s\n",
|
||||
FILE_LOG(logINFOBLUE, ("Module: %s %s %s\n",
|
||||
(top ? "TOP" : "BOTTOM"),
|
||||
(master ? "MASTER" : "SLAVE"),
|
||||
(normal ? "NORMAL" : "SPECIAL")));
|
||||
@ -379,7 +354,7 @@ void getModuleConfiguration() {
|
||||
int *n=&normal;
|
||||
Beb_GetModuleConfiguration(m,t,n);
|
||||
if (isControlServer) {
|
||||
LOG(logINFOBLUE, ("Module: %s %s %s\n",
|
||||
FILE_LOG(logINFOBLUE, ("Module: %s %s %s\n",
|
||||
(top ? "TOP" : "BOTTOM"),
|
||||
(master ? "MASTER" : "SLAVE"),
|
||||
(normal ? "NORMAL" : "SPECIAL")));
|
||||
@ -392,7 +367,7 @@ void getModuleConfiguration() {
|
||||
pclose(sysFile);
|
||||
sscanf(output,"%u",&detid);
|
||||
if (isControlServer) {
|
||||
LOG(logINFOBLUE, ("Detector ID: %u\n\n", detid));
|
||||
FILE_LOG(logINFOBLUE, ("Detector ID: %u\n\n", detid));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -402,15 +377,15 @@ void getModuleConfiguration() {
|
||||
/* set up detector */
|
||||
|
||||
void allocateDetectorStructureMemory() {
|
||||
LOG(logINFO, ("This Server is for 1 Eiger half module (250k)\n\n"));
|
||||
FILE_LOG(logINFO, ("This Server is for 1 Eiger half module (250k)\n\n"));
|
||||
|
||||
//Allocation of memory
|
||||
detectorModules = malloc(sizeof(sls_detector_module));
|
||||
detectorChans = malloc(NCHIP*NCHAN*sizeof(int));
|
||||
detectorDacs = malloc(NDAC*sizeof(int));
|
||||
LOG(logDEBUG1, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules));
|
||||
LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans));
|
||||
LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs));
|
||||
FILE_LOG(logDEBUG1, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules));
|
||||
FILE_LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans));
|
||||
FILE_LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs));
|
||||
(detectorModules)->dacs = detectorDacs;
|
||||
(detectorModules)->chanregs = detectorChans;
|
||||
(detectorModules)->ndac = NDAC;
|
||||
@ -435,19 +410,19 @@ void setupDetector() {
|
||||
|
||||
allocateDetectorStructureMemory();
|
||||
//set dacs
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
FILE_LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
int i = 0;
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for(i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i,defaultvals[i],0);
|
||||
if ((detectorModules)->dacs[i] != defaultvals[i]) {
|
||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n",i ,defaultvals[i], (detectorModules)->dacs[i]));
|
||||
FILE_LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n",i ,defaultvals[i], (detectorModules)->dacs[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG(logINFOBLUE, ("Setting Default Parameters\n"));
|
||||
FILE_LOG(logINFOBLUE, ("Setting Default Parameters\n"));
|
||||
//setting default measurement parameters
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
@ -476,7 +451,7 @@ void setupDetector() {
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_CheckSetup();
|
||||
#endif
|
||||
LOG(logDEBUG1, ("Setup detector done\n\n"));
|
||||
FILE_LOG(logDEBUG1, ("Setup detector done\n\n"));
|
||||
}
|
||||
|
||||
|
||||
@ -512,13 +487,13 @@ int readRegister(uint32_t offset, uint32_t* retval) {
|
||||
int setDynamicRange(int dr) {
|
||||
#ifdef VIRTUAL
|
||||
if (dr > 0) {
|
||||
LOG(logINFO, ("Setting dynamic range: %d\n", dr));
|
||||
FILE_LOG(logINFO, ("Setting dynamic range: %d\n", dr));
|
||||
eiger_dynamicrange = dr;
|
||||
}
|
||||
return eiger_dynamicrange;
|
||||
#else
|
||||
if (dr > 0) {
|
||||
LOG(logDEBUG1, ("Setting dynamic range: %d\n", dr));
|
||||
FILE_LOG(logDEBUG1, ("Setting dynamic range: %d\n", dr));
|
||||
if (Feb_Control_SetDynamicRange(dr)) {
|
||||
|
||||
//EigerSetBitMode(dr);
|
||||
@ -527,7 +502,7 @@ int setDynamicRange(int dr) {
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
if (Beb_SetUpTransferParameters(dr))
|
||||
eiger_dynamicrange = dr;
|
||||
else LOG(logERROR, ("Could not set bit mode in the back end\n"));
|
||||
else FILE_LOG(logERROR, ("Could not set bit mode in the back end\n"));
|
||||
}
|
||||
}
|
||||
//make sure back end and front end have the same bit mode
|
||||
@ -574,7 +549,7 @@ int getOverFlowMode() {
|
||||
|
||||
void setStoreInRamMode(int mode) {
|
||||
mode = (mode == 0 ? 0 : 1);
|
||||
LOG(logINFO, ("Setting Store in Ram mode to %d\n", mode));
|
||||
FILE_LOG(logINFO, ("Setting Store in Ram mode to %d\n", mode));
|
||||
eiger_storeinmem = mode;
|
||||
}
|
||||
|
||||
@ -608,7 +583,7 @@ int getStartingFrameNumber(uint64_t* retval) {
|
||||
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_ntriggers)) {
|
||||
eiger_nexposures = val;
|
||||
@ -631,7 +606,7 @@ int64_t getNumFrames() {
|
||||
|
||||
void setNumTriggers(int64_t val) {
|
||||
if (val > 0) {
|
||||
LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_nexposures)) {
|
||||
eiger_ntriggers = val;
|
||||
@ -652,7 +627,7 @@ int64_t getNumTriggers() {
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetExposureTime(val/(1E9));
|
||||
#else
|
||||
@ -670,7 +645,7 @@ int64_t getExpTime() {
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetExposurePeriod(val/(1E9));
|
||||
#else
|
||||
@ -688,7 +663,7 @@ int64_t getPeriod() {
|
||||
}
|
||||
|
||||
int setSubExpTime(int64_t val) {
|
||||
LOG(logINFO, ("Setting subexptime %lld ns\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting subexptime %lld ns\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
// calculate subdeadtime before settings subexptime
|
||||
int64_t subdeadtime = Feb_Control_GetSubFramePeriod() - Feb_Control_GetSubFrameExposureTime();
|
||||
@ -713,14 +688,14 @@ int64_t getSubExpTime() {
|
||||
}
|
||||
|
||||
int setDeadTime(int64_t val) {
|
||||
LOG(logINFO, ("Setting subdeadtime %lld ns\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting subdeadtime %lld ns\n", (long long int)val));
|
||||
#ifndef VIRTUAL
|
||||
// get subexptime
|
||||
int64_t subexptime = Feb_Control_GetSubFrameExposureTime();
|
||||
#else
|
||||
int64_t subexptime = eiger_virtual_subexptime * 10;
|
||||
#endif
|
||||
LOG(logINFO, ("Setting sub period (subdeadtime(%lld)): %lldns\n",
|
||||
FILE_LOG(logINFO, ("Setting sub period (subdeadtime(%lld)): %lldns\n",
|
||||
(long long int)subexptime,
|
||||
(long long int)val),
|
||||
(long long int)(val + subexptime));
|
||||
@ -771,7 +746,7 @@ int64_t getMeasuredSubPeriod() {
|
||||
int setModule(sls_detector_module myMod, char* mess) {
|
||||
|
||||
|
||||
LOG(logINFO, ("Setting module with settings %d\n",myMod.reg));
|
||||
FILE_LOG(logINFO, ("Setting module with settings %d\n",myMod.reg));
|
||||
|
||||
// settings
|
||||
setSettings( (enum detectorSettings)myMod.reg);
|
||||
@ -781,9 +756,9 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
if (detectorModules) {
|
||||
if (copyModule(detectorModules,&myMod) == FAIL) {
|
||||
sprintf(mess, "Could not copy module\n");
|
||||
LOG(logERROR, (mess));
|
||||
FILE_LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
FILE_LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@ -791,9 +766,9 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
// iodelay
|
||||
if (setIODelay(myMod.iodelay)!= myMod.iodelay) {
|
||||
sprintf(mess, "Could not set module. Could not set iodelay %d\n", myMod.iodelay);
|
||||
LOG(logERROR, (mess));
|
||||
FILE_LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
FILE_LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -803,7 +778,7 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
else {
|
||||
// (loading a random trim file) (dont return fail)
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
FILE_LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
}
|
||||
|
||||
// dacs
|
||||
@ -813,9 +788,9 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i] , 0);
|
||||
if (myMod.dacs[i] != (detectorModules)->dacs[i]) {
|
||||
sprintf(mess, "Could not set module. Could not set dac %d\n", i);
|
||||
LOG(logERROR, (mess));
|
||||
FILE_LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
FILE_LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@ -823,9 +798,9 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
// trimbits
|
||||
#ifndef VIRTUAL
|
||||
if (myMod.nchan == 0) {
|
||||
LOG(logINFO, ("Setting module without trimbits\n"));
|
||||
FILE_LOG(logINFO, ("Setting module without trimbits\n"));
|
||||
} else {
|
||||
LOG(logINFO, ("Setting module with trimbits\n"));
|
||||
FILE_LOG(logINFO, ("Setting module with trimbits\n"));
|
||||
//includ gap pixels
|
||||
unsigned int tt[263680];
|
||||
int iy, ichip, ix, ip = 0, ich = 0;
|
||||
@ -844,9 +819,9 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
//set trimbits
|
||||
if (!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(), tt)) {
|
||||
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
||||
LOG(logERROR, (mess));
|
||||
FILE_LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
FILE_LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@ -859,9 +834,9 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
setRateCorrection(0);
|
||||
sprintf(mess,"Cannot set module. Cannot set Rate correction. "
|
||||
"No default tau provided. Deactivating Rate Correction\n");
|
||||
LOG(logERROR, (mess));
|
||||
FILE_LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
FILE_LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@ -872,9 +847,9 @@ int setModule(sls_detector_module myMod, char* mess) {
|
||||
int64_t retvalTau = setRateCorrection(myMod.tau);
|
||||
if (myMod.tau != retvalTau) {
|
||||
sprintf(mess, "Cannot set module. Could not set rate correction\n");
|
||||
LOG(logERROR, (mess));
|
||||
FILE_LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
FILE_LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@ -923,7 +898,7 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
return thisSettings;
|
||||
}if (sett != GET_SETTINGS)
|
||||
thisSettings = sett;
|
||||
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
||||
FILE_LOG(logINFO, ("Settings: %d\n", thisSettings));
|
||||
return thisSettings;
|
||||
}
|
||||
|
||||
@ -939,13 +914,13 @@ enum detectorSettings getSettings() {
|
||||
/* parameters - threshold */
|
||||
|
||||
int getThresholdEnergy() {
|
||||
LOG(logDEBUG1, ("Getting Threshold energy\n"));
|
||||
FILE_LOG(logDEBUG1, ("Getting Threshold energy\n"));
|
||||
return eiger_photonenergy;
|
||||
}
|
||||
|
||||
|
||||
int setThresholdEnergy(int ev) {
|
||||
LOG(logINFO, ("Setting threshold energy:%d\n",ev));
|
||||
FILE_LOG(logINFO, ("Setting threshold energy:%d\n",ev));
|
||||
if (ev >= 0)
|
||||
eiger_photonenergy = ev;
|
||||
return getThresholdEnergy();
|
||||
@ -962,7 +937,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
if (val < 0)
|
||||
return;
|
||||
|
||||
LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units")));
|
||||
FILE_LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units")));
|
||||
|
||||
if (ind == E_VTHRESHOLD) {
|
||||
setDAC(E_VCMP_LL, val, mV);
|
||||
@ -975,7 +950,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
|
||||
// validate index
|
||||
if (ind < 0 || ind >= NDAC) {
|
||||
LOG(logERROR, ("\tDac index %d is out of bounds (0 to %d)\n", ind, NDAC - 1));
|
||||
FILE_LOG(logERROR, ("\tDac index %d is out of bounds (0 to %d)\n", ind, NDAC - 1));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1013,24 +988,24 @@ int getDAC(enum DACINDEX ind, int mV) {
|
||||
(ret[1]==ret[2])&&
|
||||
(ret[2]==ret[3]) &&
|
||||
(ret[3]==ret[4])) {
|
||||
LOG(logINFO, ("\tvthreshold match\n"));
|
||||
FILE_LOG(logINFO, ("\tvthreshold match\n"));
|
||||
return ret[0];
|
||||
} else {
|
||||
LOG(logERROR, ("\tvthreshold mismatch vcmp_ll:%d vcmp_lr:%d vcmp_rl:%d vcmp_rr:%d vcp:%d\n",
|
||||
FILE_LOG(logERROR, ("\tvthreshold mismatch vcmp_ll:%d vcmp_lr:%d vcmp_rl:%d vcmp_rr:%d vcp:%d\n",
|
||||
ret[0],ret[1],ret[2],ret[3], ret[4]));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mV) {
|
||||
LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, (detectorModules)->dacs[ind]));
|
||||
FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, (detectorModules)->dacs[ind]));
|
||||
return (detectorModules)->dacs[ind];
|
||||
}
|
||||
int voltage = -1;
|
||||
// dac units to voltage
|
||||
ConvertToDifferentRange(LTC2620_MIN_VAL, LTC2620_MAX_VAL, DAC_MIN_MV, DAC_MAX_MV,
|
||||
(detectorModules)->dacs[ind], &voltage);
|
||||
LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, (detectorModules)->dacs[ind], voltage));
|
||||
FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, (detectorModules)->dacs[ind], voltage));
|
||||
return voltage;
|
||||
}
|
||||
|
||||
@ -1072,7 +1047,7 @@ int getADC(enum ADCINDEX ind) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG(logINFO, ("Temperature %s: %f°C\n", tempnames[ind], (double)retval/1000.00));
|
||||
FILE_LOG(logINFO, ("Temperature %s: %f°C\n", tempnames[ind], (double)retval/1000.00));
|
||||
|
||||
return retval;
|
||||
#endif
|
||||
@ -1106,13 +1081,13 @@ int setHighVoltage(int val) {
|
||||
|
||||
// get
|
||||
if (!Feb_Control_GetHighVoltage(&eiger_highvoltage)) {
|
||||
LOG(logERROR, ("Could not read high voltage\n"));
|
||||
FILE_LOG(logERROR, ("Could not read high voltage\n"));
|
||||
return -3;
|
||||
}
|
||||
|
||||
// tolerance of 5
|
||||
if (abs(eiger_theo_highvoltage-eiger_highvoltage) > HIGH_VOLTAGE_TOLERANCE) {
|
||||
LOG(logINFO, ("High voltage still ramping: %d\n", eiger_highvoltage));
|
||||
FILE_LOG(logINFO, ("High voltage still ramping: %d\n", eiger_highvoltage));
|
||||
return eiger_highvoltage;
|
||||
}
|
||||
return eiger_theo_highvoltage;
|
||||
@ -1146,10 +1121,10 @@ void setTiming( enum timingMode arg) {
|
||||
ret = 3;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||
return;
|
||||
}
|
||||
LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
||||
FILE_LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetTriggerMode(ret,1))
|
||||
#endif
|
||||
@ -1168,7 +1143,7 @@ enum timingMode getTiming() {
|
||||
case 3:
|
||||
return GATED;
|
||||
default:
|
||||
LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode));
|
||||
FILE_LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode));
|
||||
return GET_TIMING_MODE;
|
||||
}
|
||||
}
|
||||
@ -1186,7 +1161,22 @@ int configureMAC() {
|
||||
int destport = udpDetails.dstport;
|
||||
int destport2 = udpDetails.dstport2;
|
||||
|
||||
LOG(logINFO, ("Configuring MAC\n"));
|
||||
#ifdef VIRTUAL
|
||||
char cDestIp[MAX_STR_LENGTH];
|
||||
memset(cDestIp, 0, MAX_STR_LENGTH);
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff);
|
||||
FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d, port2:%d)\n", cDestIp, destport, destport2));
|
||||
if (setUDPDestinationDetails(0, cDestIp, destport) == FAIL) {
|
||||
FILE_LOG(logERROR, ("could not set udp destination IP and port\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if (setUDPDestinationDetails(1, cDestIp, destport2) == FAIL) {
|
||||
FILE_LOG(logERROR, ("could not set udp destination IP and port2\n"));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
#else
|
||||
FILE_LOG(logINFO, ("Configuring MAC\n"));
|
||||
|
||||
char src_mac[50], src_ip[INET_ADDRSTRLEN],dst_mac[50], dst_ip[INET_ADDRSTRLEN];
|
||||
getMacAddressinString(src_mac, 50, sourcemac);
|
||||
@ -1194,32 +1184,15 @@ int configureMAC() {
|
||||
getIpAddressinString(src_ip, sourceip);
|
||||
getIpAddressinString(dst_ip, destip);
|
||||
|
||||
LOG(logINFO, (
|
||||
FILE_LOG(logINFO, (
|
||||
"\tSource IP : %s\n"
|
||||
"\tSource MAC : %s\n"
|
||||
"\tSource Port : %d\n"
|
||||
"\tDest IP : %s\n"
|
||||
"\tDest MAC : %s\n"
|
||||
"\tDest Port : %d\n"
|
||||
"\tDest Port2 : %d\n",
|
||||
"\tDest MAC : %s\n",
|
||||
src_ip, src_mac, src_port,
|
||||
dst_ip, dst_mac, destport, destport2));
|
||||
dst_ip, dst_mac));
|
||||
|
||||
#ifdef VIRTUAL
|
||||
char cDestIp[MAX_STR_LENGTH];
|
||||
memset(cDestIp, 0, MAX_STR_LENGTH);
|
||||
sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff);
|
||||
LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d, port2:%d)\n", cDestIp, destport, destport2));
|
||||
if (setUDPDestinationDetails(0, cDestIp, destport) == FAIL) {
|
||||
LOG(logERROR, ("could not set udp destination IP and port\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if (setUDPDestinationDetails(1, cDestIp, destport2) == FAIL) {
|
||||
LOG(logERROR, ("could not set udp destination IP and port2\n"));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
#else
|
||||
|
||||
int beb_num = detid;
|
||||
int header_number = 0;
|
||||
@ -1227,13 +1200,13 @@ int configureMAC() {
|
||||
if (!top)
|
||||
dst_port = destport2;
|
||||
|
||||
LOG(logINFO, ("\tDest Port : %d\n", dst_port));
|
||||
FILE_LOG(logINFO, ("\tDest Port : %d\n", dst_port));
|
||||
|
||||
int i=0;
|
||||
/* for(i=0;i<32;i++) { modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
||||
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port)) {
|
||||
LOG(logDEBUG1, ("\tset up left ok\n"));
|
||||
FILE_LOG(logDEBUG1, ("\tset up left ok\n"));
|
||||
} else {
|
||||
return FAIL;
|
||||
}
|
||||
@ -1243,12 +1216,12 @@ int configureMAC() {
|
||||
dst_port = destport2;
|
||||
if (!top)
|
||||
dst_port = destport;
|
||||
LOG(logINFO, ("\tDest Port : %d\n",dst_port));
|
||||
FILE_LOG(logINFO, ("\tDest Port : %d\n",dst_port));
|
||||
|
||||
/*for(i=0;i<32;i++) {*//** modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
||||
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port)) {
|
||||
LOG(logDEBUG1, (" set up right ok\n"));
|
||||
FILE_LOG(logDEBUG1, (" set up right ok\n"));
|
||||
} else {
|
||||
return FAIL;
|
||||
}
|
||||
@ -1310,8 +1283,8 @@ int setInterruptSubframe(int value) {
|
||||
if(!Feb_Control_SetInterruptSubframe(value)) {
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
int getInterruptSubframe() {
|
||||
@ -1330,8 +1303,8 @@ int setReadNLines(int value) {
|
||||
return FAIL;
|
||||
}
|
||||
Beb_SetReadNLines(value);
|
||||
#endif
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
int getReadNLines() {
|
||||
@ -1344,7 +1317,7 @@ int getReadNLines() {
|
||||
|
||||
int enableTenGigabitEthernet(int val) {
|
||||
if (val!=-1) {
|
||||
LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0));
|
||||
FILE_LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0));
|
||||
if (val>0)
|
||||
send_to_ten_gig = 1;
|
||||
else
|
||||
@ -1359,11 +1332,11 @@ int enableTenGigabitEthernet(int val) {
|
||||
/* eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter */
|
||||
int setClockDivider(enum CLKINDEX ind, int val) {
|
||||
if (ind != RUN_CLK) {
|
||||
LOG(logERROR, ("Unknown clock index: %d\n", ind));
|
||||
FILE_LOG(logERROR, ("Unknown clock index: %d\n", ind));
|
||||
return FAIL;
|
||||
}
|
||||
if (val >= 0) {
|
||||
LOG(logINFO, ("Setting Read out Speed: %d\n", val));
|
||||
FILE_LOG(logINFO, ("Setting Read out Speed: %d\n", val));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetReadoutSpeed(val))
|
||||
#endif
|
||||
@ -1374,7 +1347,7 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
||||
|
||||
int getClockDivider(enum CLKINDEX ind) {
|
||||
if (ind != RUN_CLK) {
|
||||
LOG(logERROR, ("Unknown clock index: %d\n", ind));
|
||||
FILE_LOG(logERROR, ("Unknown clock index: %d\n", ind));
|
||||
return FAIL;
|
||||
}
|
||||
return eiger_readoutspeed;
|
||||
@ -1382,7 +1355,7 @@ int getClockDivider(enum CLKINDEX ind) {
|
||||
|
||||
int setIODelay(int val) {
|
||||
if (val!=-1) {
|
||||
LOG(logDEBUG1, ("Setting IO Delay: %d\n",val));
|
||||
FILE_LOG(logDEBUG1, ("Setting IO Delay: %d\n",val));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetIDelays(Feb_Control_GetModuleNumber(),val))
|
||||
#endif
|
||||
@ -1394,7 +1367,7 @@ int setIODelay(int val) {
|
||||
|
||||
int setCounterBit(int val) {
|
||||
if (val!=-1) {
|
||||
LOG(logINFO, ("Setting Counter Bit: %d\n",val));
|
||||
FILE_LOG(logINFO, ("Setting Counter Bit: %d\n",val));
|
||||
#ifdef VIRTUAL
|
||||
eiger_virtual_counter_bit = val;
|
||||
#else
|
||||
@ -1458,10 +1431,10 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never
|
||||
//same setting
|
||||
if ((tau_in_nsec == custom_tau_in_nsec) && (ratetable_period_in_nsec == actual_period)) {
|
||||
if (eiger_dynamicrange == 32) {
|
||||
LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n",
|
||||
FILE_LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n",
|
||||
(long long int)tau_in_nsec,(long long int)ratetable_period_in_nsec));
|
||||
} else {
|
||||
LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n",
|
||||
FILE_LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n",
|
||||
(long long int)tau_in_nsec,(long long int)ratetable_period_in_nsec));
|
||||
}
|
||||
}
|
||||
@ -1475,7 +1448,7 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never
|
||||
}
|
||||
//activating rate correction
|
||||
eiger_virtual_ratecorrection_variable = 1;
|
||||
LOG(logINFO, ("Rate Correction Value set to %lld ns\n",(long long int)eiger_virtual_ratetable_tau_in_ns));
|
||||
FILE_LOG(logINFO, ("Rate Correction Value set to %lld ns\n",(long long int)eiger_virtual_ratetable_tau_in_ns));
|
||||
|
||||
return eiger_virtual_ratetable_tau_in_ns;
|
||||
#else
|
||||
@ -1504,10 +1477,10 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never
|
||||
//same setting
|
||||
if ((tau_in_nsec == custom_tau_in_nsec) && (ratetable_period_in_nsec == actual_period)) {
|
||||
if (dr == 32) {
|
||||
LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n",
|
||||
FILE_LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n",
|
||||
tau_in_nsec,ratetable_period_in_nsec));
|
||||
} else {
|
||||
LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n",
|
||||
FILE_LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n",
|
||||
tau_in_nsec,ratetable_period_in_nsec));
|
||||
}
|
||||
}
|
||||
@ -1515,14 +1488,14 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never
|
||||
else {
|
||||
int ret = Feb_Control_SetRateCorrectionTau(custom_tau_in_nsec);
|
||||
if (ret<=0) {
|
||||
LOG(logERROR, ("Rate correction failed. Deactivating rate correction\n"));
|
||||
FILE_LOG(logERROR, ("Rate correction failed. Deactivating rate correction\n"));
|
||||
Feb_Control_SetRateCorrectionVariable(0);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
//activating rate correction
|
||||
Feb_Control_SetRateCorrectionVariable(1);
|
||||
LOG(logINFO, ("Rate Correction Value set to %lld ns\n", (long long int)Feb_Control_Get_RateTable_Tau_in_nsec()));
|
||||
FILE_LOG(logINFO, ("Rate Correction Value set to %lld ns\n", (long long int)Feb_Control_Get_RateTable_Tau_in_nsec()));
|
||||
Feb_Control_PrintCorrectedValues();
|
||||
|
||||
return Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||
@ -1543,7 +1516,7 @@ int getDefaultSettingsTau_in_nsec() {
|
||||
|
||||
void setDefaultSettingsTau_in_nsec(int t) {
|
||||
default_tau_from_file = t;
|
||||
LOG(logINFO, ("Default tau set to %d\n", default_tau_from_file));
|
||||
FILE_LOG(logINFO, ("Default tau set to %d\n", default_tau_from_file));
|
||||
}
|
||||
|
||||
int64_t getCurrentTau() {
|
||||
@ -1558,7 +1531,7 @@ int64_t getCurrentTau() {
|
||||
}
|
||||
|
||||
void setExternalGating(int enable[]) {
|
||||
if (enable[0]>=0 && enable[1]>=0) {
|
||||
if (enable>=0) {
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetExternalEnableMode(enable[0], enable[1]);//enable = 0 or 1, polarity = 0 or 1 , where 1 is positive
|
||||
#endif
|
||||
@ -1572,7 +1545,7 @@ void setExternalGating(int enable[]) {
|
||||
int setAllTrimbits(int val) {
|
||||
#ifndef VIRTUAL
|
||||
if (!Feb_Control_SaveAllTrimbitsTo(val)) {
|
||||
LOG(logERROR, ("Could not set all trimbits\n"));
|
||||
FILE_LOG(logERROR, ("Could not set all trimbits\n"));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
@ -1583,7 +1556,7 @@ int setAllTrimbits(int val) {
|
||||
}
|
||||
}
|
||||
|
||||
LOG(logINFO, ("All trimbits have been set to %d\n", val));
|
||||
FILE_LOG(logINFO, ("All trimbits have been set to %d\n", val));
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -1599,7 +1572,7 @@ int getAllTrimbits() {
|
||||
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Value of all Trimbits: %d\n", value));
|
||||
FILE_LOG(logINFO, ("Value of all Trimbits: %d\n", value));
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -1711,7 +1684,7 @@ int setTransmissionDelayRight(int value) {
|
||||
|
||||
int prepareAcquisition() {
|
||||
#ifndef VIRTUAL
|
||||
LOG(logINFO, ("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit()));
|
||||
FILE_LOG(logINFO, ("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit()));
|
||||
Feb_Control_PrepareForAcquisition();
|
||||
#endif
|
||||
return OK;
|
||||
@ -1728,15 +1701,15 @@ int startStateMachine() {
|
||||
if(createUDPSocket(1) != OK) {
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOBLUE, ("starting state machine\n"));
|
||||
FILE_LOG(logINFOBLUE, ("starting state machine\n"));
|
||||
eiger_virtual_status = 1;
|
||||
eiger_virtual_stop = 0;
|
||||
if (pthread_create(&eiger_virtual_tid, NULL, &start_timer, NULL)) {
|
||||
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
|
||||
FILE_LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
|
||||
eiger_virtual_status = 0;
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO ,("Virtual Acquisition started\n"));
|
||||
FILE_LOG(logINFO ,("Virtual Acquisition started\n"));
|
||||
return OK;
|
||||
#else
|
||||
|
||||
@ -1744,21 +1717,21 @@ int startStateMachine() {
|
||||
//get the DAQ toggle bit
|
||||
prev_flag = Feb_Control_AcquisitionStartedBit();
|
||||
|
||||
LOG(logINFO, ("Going to start acquisition\n"));
|
||||
FILE_LOG(logINFO, ("Going to start acquisition\n"));
|
||||
Feb_Control_StartAcquisition();
|
||||
|
||||
if (!eiger_storeinmem) {
|
||||
LOG(logINFO, ("requesting images right after start\n"));
|
||||
FILE_LOG(logINFO, ("requesting images right after start\n"));
|
||||
ret = startReadOut();
|
||||
}
|
||||
|
||||
//wait for acquisition start
|
||||
if (ret == OK) {
|
||||
if (!Feb_Control_WaitForStartedFlag(5000, prev_flag)) {
|
||||
LOG(logERROR, ("Acquisition did not LOG(logERROR ouble reading register\n"));
|
||||
FILE_LOG(logERROR, ("Acquisition did not FILE_LOG(logERROR ouble reading register\n"));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOGREEN, ("Acquisition started\n"));
|
||||
FILE_LOG(logINFOGREEN, ("Acquisition started\n"));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1779,7 +1752,7 @@ void* start_timer(void* arg) {
|
||||
int numPacketsPerFrame = (tgEnable ? 4 : 16) * dr;
|
||||
int npixelsx = 256 * 2 * bytesPerPixel;
|
||||
int databytes = 256 * 256 * 2 * bytesPerPixel;
|
||||
LOG(logINFO, (" dr:%f\n bytesperpixel:%d\n tgenable:%d\n datasize:%d\n packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n",
|
||||
FILE_LOG(logINFO, (" dr:%f\n bytesperpixel:%d\n tgenable:%d\n datasize:%d\n packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n",
|
||||
dr, bytesPerPixel, tgEnable, datasize, packetsize, numPacketsPerFrame, npixelsx, databytes));
|
||||
|
||||
|
||||
@ -1855,7 +1828,7 @@ void* start_timer(void* arg) {
|
||||
sendUDPPacket(1, packetData2, packetsize);
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||
FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||
(end.tv_nsec - begin.tv_nsec));
|
||||
@ -1873,7 +1846,7 @@ void* start_timer(void* arg) {
|
||||
closeUDPSocket(1);
|
||||
|
||||
eiger_virtual_status = 0;
|
||||
LOG(logINFOBLUE, ("Finished Acquiring\n"));
|
||||
FILE_LOG(logINFOBLUE, ("Finished Acquiring\n"));
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
@ -1882,13 +1855,13 @@ void* start_timer(void* arg) {
|
||||
|
||||
|
||||
int stopStateMachine() {
|
||||
LOG(logINFORED, ("Going to stop acquisition\n"));
|
||||
FILE_LOG(logINFORED, ("Going to stop acquisition\n"));
|
||||
#ifdef VIRTUAL
|
||||
eiger_virtual_stop = 0;
|
||||
return OK;
|
||||
#else
|
||||
if ((Feb_Control_StopAcquisition() != STATUS_IDLE) || (!Beb_StopAcquisition()) ) {
|
||||
LOG(logERROR, ("failed to stop acquisition\n"));
|
||||
FILE_LOG(logERROR, ("failed to stop acquisition\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -1914,7 +1887,7 @@ int softwareTrigger() {
|
||||
|
||||
int startReadOut() {
|
||||
|
||||
LOG(logINFO, ("Requesting images...\n"));
|
||||
FILE_LOG(logINFO, ("Requesting images...\n"));
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#else
|
||||
@ -1945,10 +1918,10 @@ int startReadOut() {
|
||||
enum runStatus getRunStatus() {
|
||||
#ifdef VIRTUAL
|
||||
if (eiger_virtual_status == 0) {
|
||||
LOG(logINFO, ("Status: IDLE\n"));
|
||||
FILE_LOG(logINFO, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
} else {
|
||||
LOG(logINFO, ("Status: RUNNING...\n"));
|
||||
FILE_LOG(logINFO, ("Status: RUNNING...\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
#else
|
||||
@ -1956,13 +1929,13 @@ enum runStatus getRunStatus() {
|
||||
int i = Feb_Control_AcquisitionInProgress();
|
||||
switch (i) {
|
||||
case STATUS_ERROR:
|
||||
LOG(logERROR, ("Status: ERROR reading status register\n"));
|
||||
FILE_LOG(logERROR, ("Status: ERROR reading status register\n"));
|
||||
return ERROR;
|
||||
case STATUS_IDLE:
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
FILE_LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
default:
|
||||
LOG(logINFOBLUE, ("Status: RUNNING...\n"));
|
||||
FILE_LOG(logINFOBLUE, ("Status: RUNNING...\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
|
||||
@ -1978,22 +1951,22 @@ void readFrame(int *ret, char *mess) {
|
||||
while(eiger_virtual_status == 1){
|
||||
usleep(500);
|
||||
}
|
||||
LOG(logINFOGREEN, ("acquisition successfully finished\n"));
|
||||
FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n"));
|
||||
return;
|
||||
#else
|
||||
|
||||
if (Feb_Control_WaitForFinishedFlag(5000) == STATUS_ERROR) {
|
||||
LOG(logERROR, ("Waiting for finished flag\n"));
|
||||
FILE_LOG(logERROR, ("Waiting for finished flag\n"));
|
||||
*ret = FAIL;
|
||||
return;
|
||||
}
|
||||
LOG(logINFOGREEN, ("Acquisition finished\n"));
|
||||
FILE_LOG(logINFOGREEN, ("Acquisition finished\n"));
|
||||
|
||||
if (eiger_storeinmem) {
|
||||
LOG(logINFO, ("requesting images after storing in memory\n"));
|
||||
FILE_LOG(logINFO, ("requesting images after storing in memory\n"));
|
||||
if (startReadOut() == FAIL) {
|
||||
strcpy(mess,"Could not execute read image requests\n");
|
||||
LOG(logERROR, (mess));
|
||||
FILE_LOG(logERROR, (mess));
|
||||
*ret = (int)FAIL;
|
||||
return;
|
||||
}
|
||||
@ -2001,7 +1974,7 @@ void readFrame(int *ret, char *mess) {
|
||||
|
||||
//wait for detector to send
|
||||
Beb_EndofDataSend(send_to_ten_gig);
|
||||
LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
||||
FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2020,7 +1993,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
int idac, ichan;
|
||||
int ret=OK;
|
||||
|
||||
LOG(logDEBUG1, ("Copying module\n"));
|
||||
FILE_LOG(logDEBUG1, ("Copying module\n"));
|
||||
|
||||
if (srcMod->serialnumber>=0) {
|
||||
|
||||
@ -2028,16 +2001,16 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
}
|
||||
//no trimbit feature
|
||||
if (destMod->nchan && ((srcMod->nchan)>(destMod->nchan))) {
|
||||
LOG(logINFO, ("Number of channels of source is larger than number of channels of destination\n"));
|
||||
FILE_LOG(logINFO, ("Number of channels of source is larger than number of channels of destination\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if ((srcMod->ndac)>(destMod->ndac)) {
|
||||
LOG(logINFO, ("Number of dacs of source is larger than number of dacs of destination\n"));
|
||||
FILE_LOG(logINFO, ("Number of dacs of source is larger than number of dacs of destination\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
LOG(logDEBUG1, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac));
|
||||
LOG(logDEBUG1, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan));
|
||||
FILE_LOG(logDEBUG1, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac));
|
||||
FILE_LOG(logDEBUG1, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan));
|
||||
destMod->ndac=srcMod->ndac;
|
||||
destMod->nchip=srcMod->nchip;
|
||||
destMod->nchan=srcMod->nchan;
|
||||
@ -2049,7 +2022,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
destMod->tau=srcMod->tau;
|
||||
if (srcMod->eV>=0)
|
||||
destMod->eV=srcMod->eV;
|
||||
LOG(logDEBUG1, ("Copying register %x (%x)\n",destMod->reg,srcMod->reg ));
|
||||
FILE_LOG(logDEBUG1, ("Copying register %x (%x)\n",destMod->reg,srcMod->reg ));
|
||||
|
||||
if (destMod->nchan!=0) {
|
||||
for (ichan=0; ichan<(srcMod->nchan); ichan++) {
|
||||
@ -2057,7 +2030,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan);
|
||||
}
|
||||
}
|
||||
else LOG(logINFO, ("Not Copying trimbits\n"));
|
||||
else FILE_LOG(logINFO, ("Not Copying trimbits\n"));
|
||||
|
||||
for (idac=0; idac<(srcMod->ndac); idac++) {
|
||||
if (*((srcMod->dacs)+idac)>=0) {
|
||||
|
@ -76,8 +76,6 @@ enum CLKINDEX {RUN_CLK, NUM_CLOCKS};
|
||||
#define DEFAULT_TEST_MODE (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
|
||||
#define MAX_TRIMBITS_VALUE (63)
|
||||
|
||||
#define MAX_ROWS_PER_READOUT (256)
|
||||
#define MAX_PACKETS_PER_REQUEST (256)
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user