diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
index ee5446272..107e1c436 100644
--- a/.github/workflows/cmake.yml
+++ b/.github/workflows/cmake.yml
@@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
- packages: libzmq3-dev libhdf5-dev qtbase5-dev qt5-qmake libqt5svg5-dev
+ packages: libhdf5-dev qtbase5-dev qt5-qmake libqt5svg5-dev
version: 1.0
- name: Configure CMake
diff --git a/CMakeFiles/cmake.check_cache b/CMakeFiles/cmake.check_cache
new file mode 100644
index 000000000..3dccd7317
--- /dev/null
+++ b/CMakeFiles/cmake.check_cache
@@ -0,0 +1 @@
+# This file is generated by cmake for dependency checking of the CMakeCache.txt file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39103a84b..1313c48bb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,15 @@
# Copyright (C) 2021 Contributors to the SLS Detector Package
cmake_minimum_required(VERSION 3.14)
project(slsDetectorPackage)
-set(PROJECT_VERSION 8.0.2)
+
+# Read VERSION file into project version
+set(VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/VERSION")
+file(READ "${VERSION_FILE}" VERSION_CONTENT)
+string(STRIP "${VERSION_CONTENT}" PROJECT_VERSION_STRING)
+set(PROJECT_VERSION ${PROJECT_VERSION_STRING})
+
+# Pass it to the compiler
+add_compile_definitions(SLS_DET_VERSION="${PROJECT_VERSION}")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
@@ -148,7 +156,6 @@ set(SLS_INTERNAL_QWT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/qwt-6.1.5)
set(ClangFormat_EXCLUDE_PATTERNS "build/"
"libs/"
"slsDetectorCalibration/"
- "ctbGui/"
"manual/"
"python/"
"sample/"
@@ -232,6 +239,8 @@ if (NOT TARGET slsProjectCSettings)
-Wredundant-decls
-Wdouble-promotion
-Werror=return-type
+ -Wno-format-overflow
+ -Wno-format-truncation
)
sls_disable_c_warning("-Wstringop-truncation")
endif()
@@ -244,6 +253,7 @@ 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()
@@ -294,19 +304,20 @@ if (SLS_USE_INTEGRATION_TESTS)
endif (SLS_USE_INTEGRATION_TESTS)
if (SLS_USE_PYTHON)
- find_package (Python 3.6 COMPONENTS Interpreter Development)
+ find_package (Python 3.8 COMPONENTS Interpreter Development)
if(SLS_FETCH_PYBIND11_FROM_GITHUB)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
- GIT_TAG v2.11.0
+ GIT_TAG v2.13.6
)
else()
+ # https://github.com/pybind/pybind11/releases
FetchContent_Declare(
pybind11
- URL ${CMAKE_SOURCE_DIR}/libs/pybind11/v2.11.0.tar.gz
- URL_HASH MD5=90c4946e87c64d8d8fc0ae4edf35d780
+ URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/pybind11/v2.13.6.tar.gz
+ URL_HASH MD5=a04dead9c83edae6d84e2e343da7feeb
)
endif()
FetchContent_MakeAvailable(pybind11)
@@ -315,7 +326,7 @@ if (SLS_USE_PYTHON)
endif(SLS_USE_PYTHON)
if (SLS_USE_CTBGUI)
- add_subdirectory(ctbGui)
+ add_subdirectory(pyctbgui)
endif(SLS_USE_CTBGUI)
configure_file( .clang-tidy
@@ -344,4 +355,4 @@ if(SLS_MASTER_PROJECT)
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")
set(PROJECT_LIBRARIES slsSupportShared slsDetectorShared slsReceiverShared)
include(cmake/package_config.cmake)
-endif()
+endif()
\ No newline at end of file
diff --git a/README.md b/README.md
index abee0e773..ebd84e4d0 100755
--- a/README.md
+++ b/README.md
@@ -2,7 +2,11 @@
Before building from source make sure that you have the [software wiki](https://slsdetectorgroup.github.io/devdoc/dependencies.html) installed. If installing using conda, conda will manage the dependencies. Avoid also installing packages with pip.
## Documentaion
-Detailed documentation can be found in the [software wiki](https://slsdetectorgroup.github.io/devdoc/index.html) and on the [official site](https://www.psi.ch/en/detectors/software).
+Detailed documentation including installation can be found in the [software wiki](https://slsdetectorgroup.github.io/devdoc/index.html).
+
+Different releases can be found on the [official site](https://www.psi.ch/en/lxn/software-releases).
+
+Firmware compatiblity can be found in [firmware page](https://github.com/slsdetectorgroup/slsDetectorFirmware)
## Installation
@@ -42,33 +46,20 @@ conda search slsdet
conda search slsdetgui
```
-### 2. Build from source
+## 2. Build from source
-##### 2.1 Download Source Code from github
+### 2.1 Download Source Code from github
```
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git --branch 7.0.0
```
-**Pybind for Python**
-* **v7.0.0+**:
-pybind11 packaged into 'libs/pybind'. No longer a submodule. No need for "recursive" or "submodule update".
-
-* **Older versions**:
- pybind11 is a submodule. Must be cloned using "recursive" and updated when switching between versions using the following commands.
-
-```
-# clone using recursive to get pybind11 submodule
-git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
-
-# update submodule when switching between releases
-cd slsDetectorPackage
-git submodule update --init
-```
-
-##### 2.2 Build from source
+> **Note:** For v6.x.x of slsDetectorPackage and older, refer [pybind11 notes on cloning](#Pybind-and-Zeromq).
-###### Build using CMake
+### 2.2 Build from source
+
+
+### Build using CMake
```
# outside slsDetecorPackage folder
@@ -94,26 +85,28 @@ Instead of the cmake command, one can use ccmake to get a list of options to con
ccmake ..
# choose the options
-# first press [c] - configure
+# first press [c] - configure (unil you see [g])
# then press [g] - generate
```
|Example cmake options|Comment|
|---|---|
| -DSLS_USE_PYTHON=ON | Python |
-| -DPython_FIND_VIRTUALENV=ONLY | Python from only the conda environment |
-| -DZeroMQ_HINT=/usr/lib64 | Use system zmq instead |
+| -DPython_FIND_VIRTUALENV=ONLY | Python from only the conda env |
| -DSLS_USE_GUI=ON | GUI |
+| -DSLS_USE_HDF5=ON | HDF5 |
+| -DSLS_USE_SIMULATOR=ON | Simulator |
+> **Note:** For v7.x.x of slsDetectorPackage and older, refer [zeromq notes for cmake option to hint library location](#Pybind-and-Zeromq).
-###### Build using in-built cmk.sh script
+### Build using in-built cmk.sh script
```
The binaries are generated in slsDetectorPackage/build/bin directory.
-Usage: ./cmk.sh [-b] [-c] [-d ] [e] [g] [-h] [i] [-j ]
-[-k ] [-l ] [m] [n] [-p] [-q ]
-[r] [s] [t] [u] [z]
+Usage: $0 [-b] [-c] [-d ] [-e] [-g] [-h] [-i]
+[-j ] [-k ] [-l ]
+[-m] [-n] [-p] [-r] [-s] [-t] [-u] [-z]
-[no option]: only make
-b: Builds/Rebuilds CMake files normal mode
-c: Clean
@@ -128,14 +121,13 @@ Usage: ./cmk.sh [-b] [-c] [-d ] [e] [g] [-h] [i] [-j ] [e] [g] [-h] [i] [-j **Note:** For v7.x.x of slsDetectorPackage and older, refer [zeromq notes for cmk script option to hint library location](#Pybind-and-Zeromq).
+
+### Build on old distributions
If your linux distribution doesn't come with a C++11 compiler (gcc>4.8) then
it's possible to install a newer gcc using conda and build the slsDetectorPackage
@@ -166,7 +161,10 @@ cmake ../slsDetectorPackage -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
make -j12
```
-###### Build slsDetectorGui (Qt5)
+> **Note:** For v7.x.x of slsDetectorPackage and older, refer [zeromq notes for dependencies for conda](#Pybind-and-Zeromq).
+
+
+### Build slsDetectorGui (Qt5)
1. Using pre-built binary on conda
```
@@ -180,7 +178,14 @@ yum install qt5-qtbase-devel.x86_64
yum install qt5-qtsvg-devel.x86_64
```
-3. Using conda
+3. Using system installation on RHEL8
+```
+yum install qt5-qtbase-devel.x86_64
+yum install qt5-qtsvg-devel.x86_64
+yum install expat-devel.x86_64
+```
+
+4. Using conda
```
#Add channels for dependencies and our library
conda config --add channels conda-forge
@@ -208,13 +213,15 @@ cd slsDetectorPackage
./cmk.sh -cbgj9
```
-###### Build documentation from package
+> **Note:** For v7.x.x of slsDetectorPackage and older, refer [zeromq notes for dependencies for conda](#Pybind-and-Zeromq).
+
+### Build documentation from package
The documentation for the slsDetectorPackage is build using a combination
of Doxygen, Sphinx and Breathe. The easiest way to install the dependencies
is to use conda
```
-conda create -n myenv python sphinx_rtd_theme breathe
+conda create -n myenv python=3.12 sphinx sphinx_rtd_theme breathe doxygen numpy
```
```
@@ -228,6 +235,47 @@ make rst # rst only, saves time in case the API did not change
```
+
+## Pybind and Zeromq
+
+### Pybind11 for Python
+**v8.0.0+**:
+pybind11 is built
+* by default from tar file in repo (libs/pybind/v2.1x.0.tar.gz)
+* or use advanced option SLS_FETCH_PYBIND11_FROM_GITHUB [link].
+ * v9.0.0+: pybind11 (v2.13.6)
+ * v8.x.x : pybind11 (v2.11.0)
+
+**v7.x.x**:
+pybind11 packaged into ‘libs/pybind’. No longer a submodule. No need for “recursive” or “submodule update”.
+
+**Older versions**:
+pybind11 is a submodule. Must be cloned using “recursive” and updated when switching between versions using the following commands.
+
+```
+# Note: Only for v6.x.x versions and older
+
+# clone using recursive to get pybind11 submodule
+git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
+
+# update submodule when switching between releases
+cd slsDetectorPackage
+git submodule update --init
+```
+
+### Zeromq
+**v8.0.0+**:
+zeromq (v4.3.4) is built
+* by default from tar file in repo (libs/libzmq/libzmq-4.3.4.tar.gz)
+* or use advanced option SLS_FETCH_ZMQ_FROM_GITHUB [link].
+
+**v7.x.x and older**:
+zeromq-devel must be installed and one can hint its location using
+* cmake option:’-DZeroMQ_HINT=/usr/lib64’ or
+* option ‘-q’ in cmk.sh script: : ./cmk.sh -cbj5 -q /usr/lib64
+* ‘zeromq’ dependency added when installing using conda
+
+
## Support
dhanya.thattil@psi.ch
- erik.frojdh@psi.ch
+ erik.frojdh@psi.ch
\ No newline at end of file
diff --git a/RELEASE.txt b/RELEASE.txt
index 390880d9e..3d6916213 100644
--- a/RELEASE.txt
+++ b/RELEASE.txt
@@ -1,123 +1,284 @@
-SLS Detector Package Bug Fix Release 8.0.2 released on 18.09.2024
-=================================================================
+SLS Detector Package Major Release 9.0.0 released on 25.11.2024
+===============================================================
-This document describes the differences between v8.0.2 and v8.0.1
+This document describes the differences between v9.0.0 and v8.0.2
CONTENTS
--------
- 1 Resolved Issues
- 2 On-board Detector Server Compatibility
- 3 Firmware Requirements
- 4 Kernel Requirements
- 5 Download, Documentation & Support
+ 1 Compilation Changes
+ 2 New or Changed Features
+ 2.1 Breaking API
+ 2.2 Resolved or Changed Features
+ 2.3 New Features
+ 3 On-board Detector Server Compatibility
+ 4 Firmware Requirements
+ 5 Kernel Requirements
+ 6 Download, Documentation & Support
-1 Resolved Issues
-=================
+2 Compilation Changes
+=====================
- Compilation
- -----------
+ * Python version
+ Minimum python version is changed from 3.6 to 3.8
- * Rapidjson compilation with gcc 14
- Fixed a compile issue with gcc 14. Same fix in later commits to rapidjson.
+ * Pybind11 version
+ In-built version and the one picked up from github
+ updated from v2.11.0 to v2.13.6
- Client
- ------
+ * Python lib versioning
+ slsdet.__version__ now returns the package release version.
- * getenv("HOME") returning nullptr
- When this happens, especially for systemd, it segfaults. Protection
- provided by using empty string in this case.
+ * Python version in conda build
+ Added python 3.13 also to conda build
- * [Mythen3] Bad channel list for multi module
- Exception thrown when loading multi module bad channel file skipping
- modules in between. Fixed.
+
+2 New, Changed or Resolved Features
+=====================================
- * [Gotthard2] Stopping a blocking acquisition
- A check added in v8.0.0 to catch slaves that might be in waiting forever
- also catches Gotthard2 25um slaves that might only be in waiting
- temporarily. This is fixed with a 50ms sleep before checking again
- (upto 1s).
-
- * [Moench] Acquire finished processing call back
- New executable 'sls_detector_acquire_zmq' added to listen to all zmq
- packets from post processor or external process to signal end of post
- processing. Post processor refactoring of zmq socket creation added.
-
-
- Gui / Callback
- --------------
-
-
- * [Gotthard2] Stopping a blocking acquisition
- From the previous issue, call back for acquisition finished status gives
- error for inconsistent states. Again, a check every 50ms upto 1s is
- added to let go the temporarily waiting slave.
-
-
- * Different file paths
- Fixes file path resetting when different modules have different fpath set.
+2.1 Breaking API
+==================
Receiver
--------
- * HDF5 fill value
- Fix the fill value to accomodate all datatypes.
+ * Receiver callbacks
+ Brought much more metadata to receiver callbacks to construct the image.
+ Update MultiReceiverApp to reflect this change.
-
- Firmware
+
+ * File path
+ At start of acquisition or at rx_start command, the file path is only
+ then verified if it exists and created if it does not.
+
+
+ Client
+ ------
+
+
+ * Removed receiver/publisher ZMQ IP
+ Command line: rx_zmqip gives a warning and does nothing
+ Python : rx_zmqip removed
+ C++ API: get/setRxZmqIP removed
+
+ Publisher zmq IP set to '0.0.0.0' or to listen on all interfaces.
+ The publisher will determine which interface to stream out from based on
+ the network route to the subscriber IP. Hence, receiver zmq IP is not
+ required.
+
+
+ * Write register, Set or Clear bit
+ Validation for this advanced feature has been removed by default.
+ One can force validation by using --validate in the command line or by
+ setting the validate option in the API.
+
+
+ ZMQ
+ ---
+
+
+ * Publisher socket constructor does not take an IP anymore.
+ The details are above under 'Removed receiver/publisher ZMQ IP'.
+
+
+ GUI/ Client Callback
+ --------------------
+
+
+ * completeImage member in detectorData attribute now returns false only
+ if any the sub images (from different udp ports) have completeImage
+ set to false in the JSON header. This is set if therea are any missing
+ packets for that udp port on slsReceiver/slsMultiReceiver.
+
+ The different subimages are anyway not synchronized. This errs when
+ there are different missing images across multiple UDP ports.
+
+ The Gui does not show "complete image" in the status bar anymore.
+ If any of the udp ports have missing packets for that current disaplayed
+ image, then the "missing packets" will show in red in the status bar.
+
+
+ Detector Server
+ ---------------
+
+
+ * [Mythen3] Only run clock can be set
+ Clock 0 is now the run clock and the only one that can be set.
+ The others are be read only.
+ This affects the following commands:
+ Command line or python API: clkdiv, clkfreq, clkphase, maxclkphaseshift
+ C++ API: get/setClockDivider, getClockFrequency, get/setClockPhase,
+ getMaxClockPhaseShift
+
+
+ * [Jungfrau] Temperature Control
+ Temperature control is enabled by default at on-board detector server
+ startup.
+ As before, the default temperature threshold is 65°C and crossing this
+ value will set a temperature event.
+
+
+
+2.2 Resolved or Changed Features
+================================
+
+
+ Compilation
+ -----------
+
+
+ * cmake_source_dir
+ Fixed compilation error when using python and adding the slsDetectorPackage
+ as a subfolder due to cmake source directory changing.
+
+
+ Client
+ ------
+
+
+ * Command line Code Generation
+ The command line parsing code is now generated from a yaml file. This is
+ transparent to the user.
+
+
+ * Clearer error message about freeing shared memory.
+
+
+ Detector Server
+ ---------------
+
+
+ * [Gotthard2] Chip reconfiguration
+
+ - Powering off/on the chip will now switch off chip configuration
+ property/ configure the chip every time.
+
+ - Switching off high voltage from a non zero value will now wait
+ 10s to return for safety reasons.
+
+ - Powering off the chip requires high voltage to have been
+ switched off prior.
+
+ - Acquisition requires chip to have been configured prior.
+
+
+ * [Gotthard2] Burst mode options restricted
+ Burst mode external and continuous mode internal are not allowed to be set
+ anymore as they are anyway not implemented.
+
+
+ Receiver
--------
- * [Moench] Overflow with exptime of 0
- Fixed overflow when subtracting 1 clock cycle from exptime.
+ * [Gotthard I] fixed header stripping fixing segfault.
- On-board Detector Server
- ------------------------
+ * Error or help message for invalid arguments to slsMultiReceiver.
- * [Moench] Few changes in Server:
- - Max shifts of adc clock changed from 240 to 200.
-
- - Fixed overflow when subtracting 2 clock cycles from exptime of 0ms.
-
- - Default readout speed to half speed from quarter.
-
- - Change default ADC phase to 150 for full readout speed.
-
- - Change default vipre_cds dac from 800 to 1280.
+ Simulator
+ ---------
- * [Mythen3] Change Clk divider from 10 (100MHz) to 20 (50MHz) at startup.
+ * Refactored stop server to have better start up.
- * [Jungfrau] Fix for HW v1.0 boards for unreliable ADC 2
- Issues sometimes seen on some HW v 1.0 boards are fixed with phase
- relationship of 120 degrees. HW v2.0 boards are not affected.
+ * Fixed possible memory leak when taking non blocking acquisitions.
+
+
+ * [Jungfrau] Valid gain values in data sent out. Previously, 2 was also sent out.
+
+
+ ZMQ
+ ---
+
+
+ * Publiser socket constructor
+
+ - enables keep alive socket options to send heartbeat messages to prevent
+ discarded TCP flows if there is no packet for a longer period.
+
+ - enables IPv6 interfaces
+
+ * Prints specific error for ENOENT (endpoint does not exist)
+
+
+
+2.3 New Features
+================
+
+
+ Client
+ ------
+
+
+ * Auto completion
+ bash_autocomplete.sh or zsh_autocomplete.sh must be sourced from the
+ main package folder to enable auto completion of commands and arguments
+ for the command line on that shell.
+
+
+ * sls_detector
+ New executable that can be used instead of 'sls_detector_get' and
+ 'sls_detector_put' for most commands. It will infer from the number of
+ arguments, which executable (sls_detector_put or sls_detector_get) to use.
+ For the rare commands that cannot be inferred from the number of arguments,
+ it will complain accordingly.
+
+
+ * [Jungfrau] Timing Info Decoder (Advanced configuration)
+ Command line or python API: timing_info_decoder
+ C++ API: get/setTimingInfoDecoder. Options: SWISSFEL (Default), SHINE
+
+
+ * [Jungfrau] Collection Mode (Advanced configuration)
+ Command line or python API: collectionmode
+ C++ API: get/setCollectionMode. Options: ELECTRON, HOLE (Default)
+ If chip v1.1, also configures the chip afterwards.
+
+ * [Gotthard2] Next frame number
+ 'Stop' in G2 25um is not synchronous and hence might trigger an extra set
+ of frames in the slave module, resulting in the next acquiistion starting
+ with inconsistent frame numbers between master and slave. Solved by
+ setting next frame number to the larger value (max + 1) after a stop command.
+ Requires a firmware update.
- Documentation
- -------------
+ Command line or python API: nextframenumber
+ C++ API: get/setNextFrameNumber
+ Can set/get the starting frame number for the next acquistion.
- * Updated troubleshooting documentaion to check links and disable firewall
+ * [Mythen3] Readout speed
+ Command line, python API: readoutspeed. Options: full_speed (10MHz),
+ half_speed (20MHz, default), quarter_speed (40MHz)
+ C++ API: get/setReadoutSpeed
+ Also affect:
+ Command line, python API: readoutspeedlist
+ C++ API: getReadoutSpeedList
- * Excluded non UTF-8 encoded libzmq documents due to machine dependent
- compilation issues.
+ * Sleep
+ Command line, python/ C++ API: sleep
+ Client sleeps for required time. Advanced command mainly for firmware
+ developers to use in config files.
+
+
+ * Xilinx Chip Test Board added
@@ -125,20 +286,24 @@ This document describes the differences between v8.0.2 and v8.0.1
==========================================
- Eiger 8.0.0
- Jungfrau 8.0.2
- Mythen3 8.0.2
- Gotthard2 8.0.0
- Gotthard 8.0.0
- Moench 8.0.2
- Ctb 8.0.0
-
+ Eiger 9.0.0
+ Jungfrau 9.0.0
+ Mythen3 9.0.0
+ Gotthard2 9.0.0
+ Gotthard 9.0.0
+ Moench 9.0.0
+
On-board Detector Server Upgrade
--------------------------------
From v6.1.0 (without tftp):
- Using command 'updatedetectorserver'
+ update only on-board detector server
+ Using command 'updatedetectorserver'
+
+
+ udpate both on-board detector server and firmware simultaneously
+ Using command 'update'
Instructions available at
https://slsdetectorgroup.github.io/devdoc/serverupgrade.html
@@ -155,18 +320,15 @@ This document describes the differences between v8.0.2 and v8.0.1
Jungfrau 20.09.2023 (v1.5, HW v1.0) (updated in 8.0.0)
21.09.2023 (v2.5, HW v2.0) (updated in 8.0.0)
- Mythen3 24.01.2023 (v1.4) (updated in 7.0.0)
+ Mythen3 13.11.2024 (v2.0) (updated in 9.0.0)
- Gotthard2 23.11.2022 (v0.3) (updated in 7.0.0)
+ Gotthard2 03.10.2024 (v1.0) (updated in 9.0.0)
+
+ Moench 26.10.2023 (v2.0) (updated in 8.0.2)
Gotthard 08.02.2018 (50um and 25um Master)
09.02.2018 (25 um Slave)
- Moench 26.10.2023 (v0.3.2) (updated in 8.0.2,
- under development)
-
- Ctb 28.08.2023 (v1.2) (updated in 8.0.0)
-
Detector Upgrade
----------------
@@ -178,16 +340,15 @@ This document describes the differences between v8.0.2 and v8.0.1
Mythen3 via command <.rbf>
Gotthard2 via command <.rbf>
Moench via command <.pof>
- Ctb via command <.pof>
Gotthard cannot be upgraded remotely
Except Eiger,
upgrade
- using command 'programfpga' or
+ Using command 'programfpga' or
- udpate both server and firmware simultaneously
- using command 'update'
+ udpate both on-board detector server and firmware simultaneously
+ Using command 'update'
Instructions available at
diff --git a/VERSION b/VERSION
new file mode 100644
index 000000000..c9277c5a6
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+9.0.0
\ No newline at end of file
diff --git a/bash_autocomplete.sh b/bash_autocomplete.sh
new file mode 120000
index 000000000..f79749d0d
--- /dev/null
+++ b/bash_autocomplete.sh
@@ -0,0 +1 @@
+slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh
\ No newline at end of file
diff --git a/conda-recepie/build_pylib.sh b/conda-recepie/build_pylib.sh
deleted file mode 100755
index f7cbdc496..000000000
--- a/conda-recepie/build_pylib.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: LGPL-3.0-or-other
-# Copyright (C) 2021 Contributors to the SLS Detector Package
-
-echo "|<-------- starting python build"
-cd python
-${PYTHON} setup.py install
diff --git a/conda-recepie/build.sh b/conda-recipe/build.sh
similarity index 86%
rename from conda-recepie/build.sh
rename to conda-recipe/build.sh
index b8f77843e..251b04477 100755
--- a/conda-recepie/build.sh
+++ b/conda-recipe/build.sh
@@ -1,8 +1,12 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
-mkdir build
-mkdir install
+if [ ! -d "build" ]; then
+ mkdir build
+fi
+if [ ! -d "install" ]; then
+ mkdir install
+fi
cd build
cmake .. \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
diff --git a/conda-recipe/build_pylib.sh b/conda-recipe/build_pylib.sh
new file mode 100755
index 000000000..b2a2fb05f
--- /dev/null
+++ b/conda-recipe/build_pylib.sh
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
+
+echo "|<-------- starting python build"
+
+cd python
+
+# copy VERSION into slsdet for installation
+cp ../VERSION slsdet/VERSION
+
+# to be used to get project version in meta.yaml
+export SLS_DET_VERSION=$(cat python/slsdet/VERSION)
+
+${PYTHON} setup.py install
diff --git a/conda-recepie/conda_build_config.yaml b/conda-recipe/conda_build_config.yaml
similarity index 83%
rename from conda-recepie/conda_build_config.yaml
rename to conda-recipe/conda_build_config.yaml
index b1396f187..0f51da017 100644
--- a/conda-recepie/conda_build_config.yaml
+++ b/conda-recipe/conda_build_config.yaml
@@ -4,4 +4,5 @@ python:
- 3.10
- 3.11
- 3.12
-
+ - 3.13
+
diff --git a/conda-recepie/copy_ctbgui.sh b/conda-recipe/copy_ctbgui.sh
similarity index 100%
rename from conda-recepie/copy_ctbgui.sh
rename to conda-recipe/copy_ctbgui.sh
diff --git a/conda-recepie/copy_gui.sh b/conda-recipe/copy_gui.sh
similarity index 100%
rename from conda-recepie/copy_gui.sh
rename to conda-recipe/copy_gui.sh
diff --git a/conda-recepie/copy_lib.sh b/conda-recipe/copy_lib.sh
similarity index 100%
rename from conda-recepie/copy_lib.sh
rename to conda-recipe/copy_lib.sh
diff --git a/conda-recepie/copy_moench.sh b/conda-recipe/copy_moench.sh
similarity index 100%
rename from conda-recepie/copy_moench.sh
rename to conda-recipe/copy_moench.sh
diff --git a/conda-recepie/meta.yaml b/conda-recipe/meta.yaml
similarity index 92%
rename from conda-recepie/meta.yaml
rename to conda-recipe/meta.yaml
index da620c859..ca770779d 100755
--- a/conda-recepie/meta.yaml
+++ b/conda-recipe/meta.yaml
@@ -1,15 +1,19 @@
+{% set version = environ.get('SLS_DET_VERSION', '0.0.0') %}
+
+
package:
name: sls_detector_software
- version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
+ version: "{{ version }}"
+
source:
- - path: ..
+ path: ..
build:
number: 0
binary_relocation: True
- rpaths:
+ rpaths:
- lib/
requirements:
@@ -61,13 +65,11 @@ outputs:
- libstdcxx-ng
- libgcc-ng
-
run:
- libstdcxx-ng
- libgcc-ng
- name: slsdet
-
script: build_pylib.sh
requirements:
@@ -77,12 +79,13 @@ outputs:
- {{compiler('cxx')}}
- {{ pin_subpackage('slsdetlib', exact=True) }}
- setuptools
- - pybind11=2.11
+ - pybind11=2.13
host:
- python
- {{ pin_subpackage('slsdetlib', exact=True) }}
- - pybind11=2.11
+ - setuptools
+ - pybind11=2.13
run:
@@ -92,11 +95,11 @@ outputs:
- numpy
- {{ pin_subpackage('slsdetlib', exact=True) }}
-
test:
imports:
- slsdet
+
- name: slsdetgui
script: copy_gui.sh
requirements:
diff --git a/conda-recepie/run_test.sh b/conda-recipe/run_test.sh
similarity index 100%
rename from conda-recepie/run_test.sh
rename to conda-recipe/run_test.sh
diff --git a/ctbGui/CMakeLists.txt b/ctbGui/CMakeLists.txt
deleted file mode 100644
index 1799bddc5..000000000
--- a/ctbGui/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-# SPDX-License-Identifier: LGPL-3.0-or-other
-# Copyright (C) 2021 Contributors to the SLS Detector Package
-
-
-find_package(ROOT CONFIG REQUIRED COMPONENTS Core Gui)
-find_package(TIFF REQUIRED)
-
-target_include_directories(ROOT::Core INTERFACE "${ROOT_INCLUDE_DIRS}")
-add_library(ROOT::Flags_CXX IMPORTED INTERFACE)
-separate_arguments(ROOT_CXX_FLAGS)
-target_compile_options(ROOT::Flags_CXX INTERFACE ${ROOT_CXX_FLAGS})
-separate_arguments(ROOT_DEFINITIONS)
-target_compile_definitions(ROOT::Flags_CXX INTERFACE ${ROOT_DEFINITIONS})
-
-# This fixes a bug in the linker flags
-string(REPLACE "-L " "-L" ROOT_EXE_LINKER_FLAGS "${ROOT_EXE_LINKER_FLAGS}")
-separate_arguments(ROOT_EXE_LINKER_FLAGS)
-
-# Stuck into using old property method due to separate -L and -l arguments
-# (A full path to -l is better!)
-set_property(TARGET ROOT::Flags_CXX PROPERTY
- INTERFACE_LINK_LIBRARIES ${ROOT_EXE_LINKER_FLAGS})
-set_property(TARGET ROOT::Core PROPERTY
- INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}")
-
-
-add_executable(ctbGui
- ctbGui.cpp
- ctbMain.cpp
- ctbDacs.cpp
- ctbPowers.cpp
- ctbSlowAdcs.cpp
- ctbSignals.cpp
- ctbAdcs.cpp
- ctbPattern.cpp
- ctbAcquisition.cpp
- ${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffio/src/tiffIO.cpp
-)
-
-
-#TODO! Replace with target
-target_include_directories(ctbGui PRIVATE
- ${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
- ${CMAKE_SOURCE_DIR}/slsDetectorCalibration/interpolations
- ${CMAKE_SOURCE_DIR}/slsDetectorCalibration/
- ${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffio/include/
-)
-
-# Headders needed for ROOT dictionary generation
-set( HEADERS
- ctbDefs.h
- ctbMain.h
- ctbDacs.h
- ctbPattern.h
- ctbSignals.h
- ctbAdcs.h
- ctbAcquisition.h
- ctbPowers.h
- ctbSlowAdcs.h
-)
-
-#set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
-
-# ROOT dictionary generation
-root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h)
-add_library(ctbRootLib SHARED ctbDict.cxx)
-target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
-target_link_libraries(ctbRootLib PUBLIC
- ROOT::Core
- slsDetectorShared
- ${ROOT_LIBRARIES}
- ${ROOT_EXE_LINKER_FLAGS}
-)
-
-set_target_properties(
- ctbRootLib PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
-)
-
-target_link_libraries(ctbGui PUBLIC
- slsDetectorShared
- ctbRootLib
- ${TIFF_LIBRARIES}
-)
-
-set_target_properties(ctbGui PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
-
-)
-
diff --git a/ctbGui/Makefile.root5 b/ctbGui/Makefile.root5
deleted file mode 100644
index 050acbc17..000000000
--- a/ctbGui/Makefile.root5
+++ /dev/null
@@ -1,46 +0,0 @@
-# SPDX-License-Identifier: LGPL-3.0-or-other
-# Copyright (C) 2021 Contributors to the SLS Detector Package
-
-
-INCS=ctbMain.h ctbDacs.h ctbPattern.h ctbSignals.h ctbAdcs.h ctbAcquisition.h ctbPowers.h ctbSlowAdcs.h
-SRC= $(INCS:.h=.cpp) ctbDict.cpp
-LINKDEF=ctbLinkDef.h
-ZMQLIB=../slsReceiverSoftware/include
-LIBRARYCBF=$(CBFLIBDIR)/lib/*.o
-
-INCDIR=-I../slsReceiverSoftware/include/ -I../slsDetectorSoftware/include/ -I../slsSupportLib/include/ -I../slsDetectorCalibration -I../slsDetectorCalibration/dataStructures -I$(CBFLIBDIR)/include -I../slsDetectorCalibration/interpolations
-LDFLAG=-L../build/bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
-#
-MAIN=ctbGui.cpp
-
-DESTDIR?=../build/bin
-
-
-OBJS = $(SRC:.cpp=.o) $(MAIN:.cpp=.o)
-
-all: $(DESTDIR)/ctbGui
-
-
-doc:
- cd manual && make DESTDIR=$(DESTDIR)
-
-htmldoc:
- cd manual && make html DESTDIR=$(DESTDIR)
-
-ctbDict.cpp: $(INCS) $(LINKDEF)
- rootcint -f ctbDict.cpp -c $(INCS) $(LINKDEF)
-
-%.o : %.cpp
- echo $@
- g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
-#$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread #$(FLAGS)
-
-
-
-$(DESTDIR)/ctbGui: $(OBJS) $(LINKDEF)
- g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
- mv ctbGui $(DESTDIR)
-
-clean:
- rm -f $(DESTDIR)/ctbGui *.o ctbDict.* $(OBJS)
-
diff --git a/ctbGui/Makefile.root6 b/ctbGui/Makefile.root6
deleted file mode 100644
index 338949617..000000000
--- a/ctbGui/Makefile.root6
+++ /dev/null
@@ -1,48 +0,0 @@
-# SPDX-License-Identifier: LGPL-3.0-or-other
-# Copyright (C) 2021 Contributors to the SLS Detector Package
-
-
-INCS=ctbMain.h ctbDacs.h ctbPattern.h ctbSignals.h ctbAdcs.h ctbAcquisition.h ctbPowers.h ctbSlowAdcs.h
-SRC= $(INCS:.h=.cpp) ctbDict.cpp
-LINKDEF=ctbLinkDef.h
-#ctbActions.h
-ZMQLIB=../slsReceiverSoftware/include
-LIBRARYCBF=$(CBFLIBDIR)/lib/*.o
-
-INCDIR=-I../slsReceiverSoftware/include/ -I../slsDetectorSoftware/include/ -I../slsSupportLib/include/ -I../slsDetectorCalibration -I../slsDetectorCalibration/dataStructures -I$(CBFLIBDIR)/include -I../slsDetectorCalibration/interpolations
-
-LDFLAG=-L../build/bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
-#
-MAIN=ctbGui.cpp
-
-DESTDIR?=../build/bin
-
-
-OBJS = $(SRC:.cpp=.o) $(MAIN:.cpp=.o)
-
-all: $(DESTDIR)/ctbGui
-
-
-doc:
- cd manual && make DESTDIR=$(DESTDIR)
-
-htmldoc:
- cd manual && make html DESTDIR=$(DESTDIR)
-
-ctbDict.cpp: $(INCS) $(LINKDEF)
- rootcling -f ctbDict.cpp -c $(INCS) $(LINKDEF)
-
-%.o : %.cpp
- echo $@
- g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
-#$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread #$(FLAGS)
-
-
-
-$(DESTDIR)/ctbGui: $(OBJS) $(LINKDEF)
- g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
- mv ctbGui $(DESTDIR)
-
-clean:
- rm -f $(DESTDIR)/ctbGui *.o ctbDict.* $(OBJS)
-
diff --git a/ctbGui/ctbAcquisition.cpp b/ctbGui/ctbAcquisition.cpp
deleted file mode 100644
index 8de365271..000000000
--- a/ctbGui/ctbAcquisition.cpp
+++ /dev/null
@@ -1,2277 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-//#define TESTADC
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-#include
-#include
-#include
-#include
-
-#include "ctbAcquisition.h"
-#include "ctbDefs.h"
-#include "sls/Detector.h"
-#include "sls/sls_detector_defs.h"
-#include "ctbMain.h"
-#include "moench03CtbData.h"
-//#include "moench03TCtbData.h"
-//#include "moench03T1CtbData.h"
-#include "moench03CommonMode.h"
-#include "moench03T1ZmqDataNew.h"
-#include "moench02CtbData.h"
-//#include "jungfrau10ModuleData.h"
-#include "moenchCommonMode.h"
-#include "singlePhotonDetector.h"
-#include "Mythen3_01_jctbData.h"
-#include "Mythen3_02_jctbData.h"
-#include "adcSar2_jctbData.h"
-#include "moench04CtbZmqData.h"
-#include "moench04CtbZmq10GbData.h"
-#include "deserializer.h"
-#include "sls/detectorData.h"
-#include "imageZmq16bit.h"
-#include "imageZmq32bit.h"
-
-
-using namespace std;
-
-
-
-
-ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), tenG(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) {
-
- adcFit=NULL;
- bitPlot=NULL;
- countsFit=NULL;
-
- page->AddFrame(this,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- MapWindow();
-
- TGHorizontalFrame *hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
- char tit[100];
-
- cout << "outfile "<< endl;
-
- cFileSave= new TGCheckButton(hframe, "Output file: ");
- hframe->AddFrame(cFileSave,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
- cFileSave->MapWindow();
- cFileSave->SetTextJustify(kTextRight);
- cFileSave->Connect("Toggled(Bool_t)","ctbAcquisition",this,"setFsave(Bool_t)");
-
- std::string temp = "run";
- try {
- temp = myDet->getFileNamePrefix().tsquash("Different values");
- } CATCH_DISPLAY ("Could not get file name prefix.", "ctbAcquisition::ctbAcquisition")
- eFname = new TGTextEntry(hframe, temp.c_str());
-
- hframe->AddFrame(eFname,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
- eFname->MapWindow();
- eFname->Resize(150,30);
-
- eFname->Connect("ReturnPressed()","ctbAcquisition",this,"setFname()");
-
-
- TGLabel *label=new TGLabel(hframe,"index: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
- eFindex = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELNoLimits);
- hframe->AddFrame( eFindex,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eFindex->MapWindow();
- eFindex->Resize(150,30);
- TGTextEntry *e= eFindex->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbAcquisition",this,"setFindex()");
-
-
-
-
- cout << "outdir "<< endl;
-
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
- label=new TGLabel(hframe,"Output directory: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
-
- temp = "/tmp/";
- try {
- temp = myDet->getFilePath().tsquash("Different values");
- } CATCH_DISPLAY ("Could not get file path.", "ctbAcquisition::ctbAcquisition")
- eOutdir = new TGTextEntry(hframe, temp.c_str());
-
- hframe->AddFrame(eOutdir,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
- eOutdir->MapWindow();
- eOutdir->Resize(150,30);
-
-
- eOutdir->Connect("ReturnPressed()","ctbAcquisition",this,"setOutdir()");
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
- cout << "meas "<< endl;
-label=new TGLabel(hframe,"Number of Measurements (fake): ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
- eMeasurements = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELNoLimits);
- hframe->AddFrame( eMeasurements,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eMeasurements->MapWindow();
- eMeasurements->Resize(150,30);
- eMeasurements->SetNumber(1);
- e= eMeasurements->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbAcquisition",this,"setMeasurements()");
-
-
-
-
-hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
-
-
- cout << "pattern "<< endl;
-
-
-
-
- cCompile= new TGCheckButton(hframe, "Compile");
- hframe->AddFrame(cCompile,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
- cCompile->MapWindow();
- cCompile->SetOn();
- // cCompile->Connect("Toggled(Bool_t)","ctbAcquisition",this,"setFsave(Bool_t)");
-
-
- cLoad= new TGTextButton(hframe, "Load");
- hframe->AddFrame(cLoad,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
- cLoad->MapWindow();
- cLoad->Connect("Clicked()","ctbAcquisition",this,"loadPattern()");
-
-
-// cRun= new TGCheckButton(hframe, "Run");
-// hframe->AddFrame(cRun,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
-// cRun->MapWindow();
-// // cCompile->Connect("Toggled(Bool_t)","ctbAcquisition",this,"setFsave(Bool_t)");
-
-
-
-
-
-
- bStatus=new TGTextButton(hframe, "Start");
- hframe->AddFrame(bStatus,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
- bStatus->MapWindow();
- bStatus->Connect("Clicked()","ctbAcquisition",this,"toggleAcquisition()");
-
-
-
-
-
- cout << "plot "<< endl;
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
-
-
- label=new TGLabel(hframe,"Plot: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
-
-
-
-
- TGButtonGroup *bgPlot = new TGButtonGroup(hframe);
- // horizontal->SetTitlePos(TGGroupFrame::kCenter);
- rbPlotOff=new TGRadioButton(hframe, "No plot");
- rbWaveform=new TGRadioButton(hframe, "Waveform");
- rbDistribution=new TGRadioButton(hframe, "Distribution");
- rb2D=new TGRadioButton(hframe, "Image");
- // rbScan=new TGRadioButton(hframe, "Scan");
-
- cbDetType=new TGComboBox(hframe);
- // enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302, MAXDET};
- cbDetType->AddEntry("Deserializer", DESERIALIZER);
- 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", iiii++);
- // cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301);
- // cbDetType->AddEntry("ADCSAR2", ADCSAR2);
- // cbDetType->AddEntry("MYTHEN3 0.2", MYTHEN302);
-
- cbDetType->SetHeight(20);
- cbDetType->Select(0);
-
- bgPlot->Insert(rbPlotOff,0);
- bgPlot->Insert(rbWaveform,1);
- bgPlot->Insert(rbDistribution,2);
- bgPlot->Insert(rb2D,3);
- // bgPlot->Insert(rbScan,4);
-
- bgPlot->Connect("Clicked(Int_t)", "ctbAcquisition", this, "changePlot(Int_t)");
- // hframe->AddFrame(bgPlot, new TGLayoutHints(kLHintsExpandX));
-
- cbDetType->Connect("Selected(Int_t)", "ctbAcquisition",this, "changeDetector(Int_t)");
- hframe->AddFrame(rbPlotOff, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
- hframe->AddFrame(rbWaveform, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
- hframe->AddFrame(rbDistribution, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
- hframe->AddFrame(rb2D, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
- // hframe->AddFrame(rbScan, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
- hframe->AddFrame(cbDetType, new TGLayoutHints(kLHintsTop | kLHintsExpandX| kLHintsExpandY));
-
-
- bgPlot->SetExclusive(kTRUE);
- rbWaveform->SetOn();
- rbPlotOff->MapWindow();
- rbWaveform->MapWindow();
- rbDistribution->MapWindow();
- rb2D->MapWindow();
- // rbScan->MapWindow();
- cbDetType->MapWindow();
-
-
-
-
- // cout << "off "<< endl;
-
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
-
- label=new TGLabel(hframe,"Serial offset:");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
- eSerOff=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,0,16535);
- hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eSerOff->MapWindow();
- eSerOff->SetNumber(0);
- e= eSerOff->TGNumberEntry::GetNumberEntry();
- eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)");
- e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeSerialOffset()");
-
-
- label=new TGLabel(hframe,"N counters:");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
- eNumCount=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,0,16535);
- hframe->AddFrame(eNumCount,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eNumCount->MapWindow();;
- eNumCount->SetNumber(128*3);
- e= eNumCount->TGNumberEntry::GetNumberEntry();
- eNumCount->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeNumberOfChannels(Long_t)");
- e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeNumberOfChannels()");
-
-
-
- cout << "dr "<< endl;
-
- label=new TGLabel(hframe,"Dynamic Range:");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
- eDynRange=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,0,16535);
- hframe->AddFrame(eDynRange,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eDynRange->MapWindow();;
- eDynRange->SetNumber(24);
- e= eDynRange->TGNumberEntry::GetNumberEntry();
- eDynRange->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeDynamicRange(Long_t)");
- e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeDynamicRange()");
-
-
-
-
-
- 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);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
-
- label=new TGLabel(hframe,"Pedestal ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
-
- cbGetPedestal= new TGCheckButton(hframe, "Acquire");
- hframe->AddFrame(cbGetPedestal,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- cbGetPedestal->MapWindow();
-
- cbSubtractPedestal= new TGCheckButton(hframe, "Subtract");
- hframe->AddFrame(cbSubtractPedestal,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- cbSubtractPedestal->MapWindow();
-
-
- cbSubtractPedestal->Connect("Toggled(Bool_t)","ctbAcquisition",this,"TogglePedSub(Bool_t)");
-
- cbCommonMode= new TGCheckButton(hframe, "Common Mode");
- hframe->AddFrame(cbCommonMode,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- cbCommonMode->MapWindow();
-
-
- cbCommonMode->Connect("Toggled(Bool_t)","ctbAcquisition",this,"ToggleCommonMode(Bool_t)");
-
-
- bResetPedestal= new TGTextButton(hframe, "Reset");
- hframe->AddFrame(bResetPedestal,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- bResetPedestal->MapWindow();
-
-
- bResetPedestal->Connect("Clicked()","ctbAcquisition",this,"resetPedestal()");
-
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
- cMinMaxRaw=new TGCheckButton(hframe,"Raw data ");
- hframe->AddFrame(cMinMaxRaw,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- cMinMaxRaw->MapWindow();
- cMinMaxRaw->Connect("Toggled(Bool_t)","ctbAcquisition",this,"ChangeHistoLimitsRaw(Bool_t)");
-
-
-
-
- label=new TGLabel(hframe,"Min: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
- eMinRaw=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,0,16535);
- hframe->AddFrame(eMinRaw,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eMinRaw->MapWindow();;
- eMinRaw->SetNumber(0);
- e= eMinRaw->TGNumberEntry::GetNumberEntry();
- eMinRaw->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeHistoLimitsRaw(Long_t)");
- e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeHistoLimitsRaw()");
-
-
- label=new TGLabel(hframe,"Max: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
-
-
- eMaxRaw=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,0,16535);
- hframe->AddFrame(eMaxRaw,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eMaxRaw->MapWindow();;
- eMaxRaw->SetNumber(16535);
-
- e= eMaxRaw->TGNumberEntry::GetNumberEntry();
- eMaxRaw->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeHistoLimitsRaw(Long_t)");
- e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeHistoLimitsRaw()");
-
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
-
- cMinMaxPedSub=new TGCheckButton(hframe,"Pedestal Subtracted ");
- hframe->AddFrame(cMinMaxPedSub,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- cMinMaxPedSub->MapWindow();
- cMinMaxPedSub->Connect("Toggled(Bool_t)","ctbAcquisition",this,"ChangeHistoLimitsPedSub(Bool_t)");
-
-
- label=new TGLabel(hframe,"Min: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
- eMinPedSub=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEAAnyNumber,
- TGNumberFormat::kNELLimitMinMax,-16535,16535);
- hframe->AddFrame(eMinPedSub,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eMinPedSub->MapWindow();;
- eMinPedSub->SetNumber(-100);
-
- e= eMinPedSub->TGNumberEntry::GetNumberEntry();
-
- eMinPedSub->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeHistoLimitsPedSub(Long_t)");
- e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeHistoLimitsPedSub()");
-
-
- label=new TGLabel(hframe,"Max: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
- eMaxPedSub=new TGNumberEntry(hframe,0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEAAnyNumber,
- TGNumberFormat::kNELLimitMinMax,-16535,16535);
- hframe->AddFrame(eMaxPedSub,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eMaxPedSub->MapWindow();;
- eMaxPedSub->SetNumber(100);
-
-
- e= eMaxPedSub->TGNumberEntry::GetNumberEntry();
- eMaxPedSub->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeHistoLimitsPedSub(Long_t)");
- e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeHistoLimitsPedSub()");
-
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
-
-
-
- TGTextButton *b= new TGTextButton(hframe, "Fit Panel ADC:");
- hframe->AddFrame(b,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- b->MapWindow();
-
-
- b->Connect("Clicked()","ctbAcquisition",this,"FitADC()");
-
-
- eFitADC=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,0,31);
- hframe->AddFrame( eFitADC,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eFitADC->MapWindow();;
-
-
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
-
-
-
- b= new TGTextButton(hframe, "Plot bit:");
- hframe->AddFrame(b,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- b->MapWindow();
-
-
- b->Connect("Clicked()","ctbAcquisition",this,"plotBit()");
-
-
- eBitPlot=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,0,64);
- hframe->AddFrame( eBitPlot,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eBitPlot->MapWindow();;
-
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
- hframe->MapWindow();
-
-
-
- label=new TGLabel(hframe,"X ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
- label=new TGLabel(hframe," ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
- lClickX=label;
-
-
-
- label=new TGLabel(hframe,"Y ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
-
- label=new TGLabel(hframe," ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
- lClickY=label;
-
-
- label=new TGLabel(hframe,"Value ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextRight);
-
-
-
-
-
- label=new TGLabel(hframe," ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
- lClickValue=label;
-
-
-
-
-
-
-
- b= new TGTextButton(hframe, "Refresh");
- hframe->AddFrame(b,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- b->MapWindow();
-
-
- b->Connect("Clicked()","ctbAcquisition",this,"Draw()");
-
-
-
-
-
-
-
-
-
-
- acqThread = new TThread("acqThread",
- ctbAcquisition::ThreadHandle,(void*)this);
-
- 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")
- cout <<"Done" << endl;
-
- // mgAdcs=new TMultiGraph();
- adcStack=new THStack();
- TH1F *h;
- int nSamples=nAnalogSamples;
-
- for (int i=0; iSetLineColor(i+1);
- h->SetLineWidth(2);
- adcStack->Add(h);
- adcHisto[i]=h;
- plotFlag[i]=0;
- // h->SetMinimum(-1);
- // h->SetMaximum(16385);
- }
-
-
- // mgAdcs=new TMultiGraph();
- bitStack=new THStack();
- // bitStack=adcStack;
- TH1F *hb;
- for (int i=0; iSetLineColor(i+1);
- hb->SetLineWidth(2);
- bitStack->Add(hb);
- bitHisto[i]=hb;
- bitOffset[i]=0;
- bitPlotFlag[i]=0;
- // h->SetMinimum(-1);
- // h->SetMaximum(16385);
- }
-
-
- countsStack=new THStack();
- TH1F *h1;
- for (int i=0; iSetLineColor(i+1);
- h1->SetFillColor(i+1);
- h1->SetLineWidth(2);
- countsStack->Add(h1);
- countsHisto[i]=h1;
- }
-
- dataStructure=NULL;
- commonMode=NULL;
- photonFinder=NULL;
- h2DMapAn=NULL;
- h2DMapDig=NULL;
- //h2Scan=NULL;
- h1DMap=NULL;
-
- changeDetector(cbDetType->GetSelected());
-
-
-
- // display could be updated with TTimer instead of with histogramfillthread:
- // plotTimer= new TTimer("ctbAcquisition::Draw()",100);
-
-
- // plotTimer->Connect("TurnOff()", "ctbAcquisition", this, "Draw()");
-}
-
-
-
-
-void ctbAcquisition::canvasClicked() {
- int event = gPad->GetEvent();
- if (event != 11) return;
- TObject *select = gPad->GetSelected();
- if (!select) return;
-
- if (select->InheritsFrom("TH2")) {
- TH2* hh=(TH2*)select;
-
-
-
-
- int px = gPad->GetEventX();
- int py = gPad->GetEventY();
- Float_t upy = gPad->AbsPixeltoY(py);
- Float_t y = gPad->PadtoY(upy);
- Float_t upx = gPad->AbsPixeltoX(px);
- Float_t x = gPad->PadtoY(upx);
-
-
- // cout << "x: " << x << " y: " << y << " " << hh->GetBinContent(hh->GetXaxis()->FindBin(x), hh->GetYaxis()->FindBin(y)) << endl;
-
-
- lClickX->SetText(hh->GetXaxis()->FindBin(x)-1);
- lClickY->SetText( hh->GetYaxis()->FindBin(y)-1);
- lClickValue->SetText(hh->GetBinContent(hh->GetXaxis()->FindBin(x), hh->GetYaxis()->FindBin(y)));
-
-
-
-
-
-
- } else if (select->InheritsFrom("TH1")) {
-
- TH1* h1=(TH1*)select;
- int px = gPad->GetEventX();
- Float_t upx = gPad->AbsPixeltoX(px);
- Float_t x = gPad->PadtoY(upx);
-
-
- // cout << "x: " << x << " y: " << y << " " << hh->GetBinContent(hh->GetXaxis()->FindBin(x), hh->GetYaxis()->FindBin(y)) << endl;
-
-
- lClickX->SetText(h1->GetXaxis()->FindBin(x)-1);
- lClickY->SetText(" ");
- lClickValue->SetText(h1->GetBinContent(h1->GetXaxis()->FindBin(x)));
-
-
-
-
-
- } else// if ((select->ClassName())=="THStack") {
- {
-
-
- int px = gPad->GetEventX();
- int py = gPad->GetEventY();
- Float_t upy = gPad->AbsPixeltoY(py);
- Float_t y = gPad->PadtoY(upy);
- Float_t upx = gPad->AbsPixeltoX(px);
- Float_t x = gPad->PadtoY(upx);
-
-
- lClickX->SetText(x);
- lClickY->SetText(y);
- lClickValue->SetText("");
-
-
-
- }
-
-}
-
-
-
-
-
-
-void ctbAcquisition::setCanvas(TCanvas* c) {
- myCanvas=c;
- myCanvas->cd();
- myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
- // myCanvas->AddExec("ex","canvasClicked()");
-}
-void ctbAcquisition::dataCallback(sls::detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
-
- // return
- ((ctbAcquisition*)pArgs)->plotData(data,index);
-}
-
-
-int ctbAcquisition::plotData(sls::detectorData *data, int index) {
-
- /*
-******************************************************************
-When selecting dbit
-amount of data is nadc * nasamples * 16 bit + ndbitlist * ndsamples (bits)
-order of data
-analog:
-sample0 (adc0 + adc1 +...)
-sample1 (adc0 + adc1 +...)
-digital:
-dbit0 (sample0 + sample1 ...)
-dbit1 (sample0 + sample1..)
-
-when setting dbit to all
-amount of data: nadc * nasamples * 16 bit + 8 * ndsamples * 64 bit
-what you had before..
-except analog first, then digital
-analog:
-sample0 (adc0 + adc1 +...)
-sample1 (adc0 + adc1 +...)
-digital:
-sample0 (dbit0 + dbit1 +...)
-sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
-
- if (action == PUT_ACTION) {
- std::vector dbitlist;
-
- // if not all digital bits enabled
- if (std::string(args[1]) != "all") {
- for (int i = 1; i < narg; ++i) {
- int temp = 0;
- if (!sscanf(args[i], "%d", &temp))
- return std::string("Could not scan dbitlist value ") +
- std::string(args[i]);
- if (temp < 0 || temp > 63)
- return std::string("dbitlist value should be between 0 and 63 ") +
- std::string(args[i]);
- dbitlist.push_back(temp);
- }
- if (dbitlist.size() > 64) {
- return std::string("Max number of values for dbitlist is 64 ");
- }
- }
-
- myDet->setReceiverDbitList(dbitlist, detPos);
- }
-
-******************************************************************
-*/
-
- // cout << "plot data" << endl;
-
-
- // cout <<"global plot is " << globalPlot << endl;
- // cout << "*******************************************" <progressIndex << " nx:" << data->nx << " ny: " << data->ny << " " << data->fileName << " bytes: " << data->databytes << " dr:"<< data->dynamicRange << " fi: " << data ->fileIndex << endl;
- if (globalPlot || cbGetPedestal->IsOn()) {
- //#ifdef TESTADC
- // cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
- //#endif
- int ig=0;
- int i, ii, ib;
- // TList *l= adcStack->GetHists();
- // TList *l1= countsStack->GetHists();
- TH1F *h;
- TH1F *h1;
- TH1F *hb;
- int x;
- double ped=0;
- int dsize=-1;
- int *val=NULL;
- int nx=1, ny=1;
-
- if (dataStructure) {
- dataStructure->getDetectorSize(nx,ny);
- cout << "Data structure: " << dataStructure << " size " << nx << " " << ny << endl;
- }
- int dr=24, soff=2;
- if (deserializer) {
- 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;
- int nadc;
- int ndbit;
-
- tenG = 0;
-
-
-
-
- if (adclist.empty())
- nadc=32;
- else
- nadc=adclist.size();
-
- std::vector plotlist;
- if (dbitlist.empty()) {
- ndbit=64;
- dBitOffset=0;
- for (ib=0; ib<64; ib++){
- if (bitPlotFlag[ib]) {
- plotlist.push_back(ib);
- }
- }
- } else
- ndbit=dbitlist.size();
- if (tenG){
-
- if (nDigitalSamples && nAnalogSamples){
- if (nDigitalSamples>nAnalogSamples)
- dsize=nDigitalSamples*(32*2+8);
- else
- dsize=nAnalogSamples*(32*2+8);
- } else
- dsize=32*2*nAnalogSamples+8*nDigitalSamples;
-
- } else
- dsize=nadc*2*nAnalogSamples+ndbit*(nDigitalSamples-dBitOffset/8)/8;
-
- cout << "dataBytes is " << data->databytes << " expected " << dsize << endl;
-
- cout << "*******************************************" <data;
- else
- d_data = data->data+2*nadc*nAnalogSamples;
- char dval;
-
-
- if (dataStructure) {
-
-
- for (int x=0; xgetValue(data->data,x,y);
- //aval=dataStructure->getChannel(data->data,x,y);
- // cout << x << " " <IsOn()) {
- if (photonFinder) {
- photonFinder->addToPedestal(aval,x,y);
- }
- }
-
- if (cbSubtractPedestal->IsOn()) {
- if (photonFinder) {
- ped=photonFinder->getPedestal(x,y,cmSub);
- }
- }
- if (h2DMapAn)
- h2DMapAn->SetBinContent(x+1,y+1,aval-ped);
-
-
-
-
- if (h2DMapDig)
- h2DMapDig->SetBinContent(x+1,y+1,dataStructure->getGain(data->data,x,y));
-
-
- }
- }
- } else
- if (deserializer) {
- cout << "deserializer"<< endl;
- if (dbitlist.empty())
- val=deserializer::deserializeAll(d_data,plotlist,dr,nx,soff);//dataStructure->getData(d_data);
- else
- val=deserializer::deserializeList(d_data,dbitlist,dr,nx,soff);//dataStructure->getData(d_data);
-
-
- if (val) {
- if (h1DMap){
- for (x=0; xSetBinContent(x+1,val[x]);
- }
- }
- delete [] val;
- } else
- cout << "get val did not succeed"<getChannel(i);
- // else
- aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
-
- if (plotFlag[ig]) {
-
- //if (enableFlag[ig]) {
- h=adcHisto[ig];
- h1=countsHisto[ig];
- //}
-
- // cout << data->getChannel(i) << endl;
- h->SetBinContent(ip+1,aval);
- h1->Fill(aval);
- }
-
- i++;
- }
- if (tenG) i+=4;
-
- }
-
-
- cout << "bit histo"<< endl;
-
- if (dbitlist.empty()) {
- for (ip=0; ipSetBinContent(ip+1,1+bitOffset[ib]);
- else
- hb->SetBinContent(ip+1,bitOffset[ib]);
- }
- }
-
- }
- }
- } else {
- ii=0;
- int iii=0;
- for (const auto &value : dbitlist) {
- ib=value;
- hb=bitHisto[ib];
- // cout << dec <SetBinContent(iii,1+bitOffset[ib]);
- else
- hb->SetBinContent(iii,bitOffset[ib]);
- iii++;
- }
- }
- }
- ii++;
- }
- }
- }
- Draw();
- // iScanStep++;
- if (photonFinder)
- photonFinder->newFrame();
- }
- return 0;
-
-}
-
-
-
-void ctbAcquisition::Draw(){
- if (globalPlot) {
- // TThread::Lock();
- cout << "Draw" << endl;
- if (myCanvas) {
- if (adcPlot && dbitPlot) {
-
- myCanvas->cd(1);
- // myCanvas->Modified();
- // myCanvas->Update();
- gPad->Modified();
- gPad->Update();
-
- myCanvas->cd(2);
- // myCanvas->Modified();
- // myCanvas->Update();
- gPad->Modified();
- gPad->Update();
-
- } else {
-
- myCanvas->cd();
- myCanvas->Modified();
- myCanvas->Update();
-
- }
- }
- // TThread::UnLock();
- }
-
-}
-
-
-//here!!
-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")
- } 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; iiGetPad(1)==NULL || myCanvas->GetPad(2)==NULL) {
- myCanvas->Clear();
- myCanvas->Divide(1,2);
- } else
- cout << "Pad already there" << endl;
- myCanvas->cd(1);
- } else {
- myCanvas->Clear();
- // myCanvas->Divide(1,1);
- myCanvas->cd();
- }
-
- if (adcPlot) {
- if (rbWaveform->IsOn())
- if (adcStack)
- adcStack->Draw("NOSTACK");
- else
- cout << "adcStack is NULL" << endl;
- else if (rbDistribution->IsOn())
- if (countsStack)
- countsStack->Draw("NOSTACK");
- else
- cout << "countsStack is NULL" << endl;
- else if (rb2D->IsOn()) {
- if (h2DMapAn)
- h2DMapAn->Draw("colz");
- else if (h1DMap)
- h1DMap->Draw();
- else
- cout << "h2DMap and h1DMap are NULL" << endl;
- }
- }
-
- if (dbitPlot) {
- if (adcPlot)
- myCanvas->cd(2);
- if (rb2D->IsOn()) {
- if (h2DMapDig)
- h2DMapDig->Draw("colz");
- else if (h1DMap)
- h1DMap->Draw();
- } else if (bitStack)
- bitStack->Draw("NOSTACK");
- else
- cout << "bitStack is NULL" << endl;
- }
-
-
- // else if (rbScan->IsOn()) {
- // if (h2Scan)
- // h2Scan->Draw("colz");
- // else
- // cout << "h2Scan is NULL" << endl;
- // }
-
- Draw();
-
- }
-}
-
-
-
-
-
-void ctbAcquisition::changeDetector(){
- // cout << "change detector " << i << " old " << cbDetType->GetSelected() << endl;
-
- if (dataStructure) delete dataStructure;
- if (commonMode) delete commonMode;
- if (photonFinder) delete photonFinder;
- if (h2DMapAn) delete h2DMapAn;
- if (h2DMapDig) delete h2DMapDig;
- if (h1DMap) delete h1DMap;
- // if (h2Scan) delete h2Scan;
- h2DMapAn=NULL;
- h2DMapDig=NULL;
- h1DMap=NULL;
- // h2Scan=NULL;
- photonFinder=NULL;
- dataStructure=NULL;
- commonMode=NULL;
-
- // TH2F *h2ScanOld=h2Scan;
-
-
- int nx,ny;
- int csize=3;
- int nsigma=5;
- commonModeSubtraction* cm=0;
- 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()) {
- case DESERIALIZER:
- deserializer=1;
- cout << "DESERIALIZER!" << endl;
- // dataStructure=new moench03T1CtbData();
- // commonMode=new moench03CommonMode();
- break;
- case MOENCH04:
- try {
- auto retval = myDet->getTenGiga().tsquash("Different values");
- if (retval) {
- dataStructure=new moench04CtbZmq10GbData(nAnalogSamples, nDigitalSamples);
- } else {
- dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
- }
- } CATCH_DISPLAY ("Could not get ten giga enable.", "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;
- // dataStructure=new moench03TCtbData();
- // commonMode=new moench03CommonMode();
- // break;
- case MOENCH02:
- cout << "MOENCH 0.2" << endl;
- dataStructure=new moench02CtbData();
- commonMode=new moenchCommonMode();
- break;
- // case 2:
- // dataStructure=new jungfrau10ModuleData();
- // commonMode=new commonModeSubtraction();
- // break;
- // case 3:
- // cout << "************** Flat!!!!!!!!!!" << endl;
- // dataStructure=new moench03CtbData();
- // commonMode=new moench03CommonMode();
- // break;
- // case MYTHEN301:
- // deserializer=1;
- // cout << "MYTHEN 3 0.1" << endl;
- // dataStructure=new mythen3_01_jctbData(eNumCount->GetIntNumber(),eDynRange->GetIntNumber(),eSerOff->GetIntNumber());
- // //( int nch=64*3,int dr=24, int off=5)
- // eNumCount->SetState(kTRUE);
- // eDynRange->SetState(kTRUE);
- // eSerOff->SetState(kTRUE);
- // commonMode=NULL;
- // dim=1;
- // break;
- // case ADCSAR2:
- // deserializer=1;
- // //adcsar2
- // dataStructure=new adcSar2_jctbData();
- // //need to use configurable number of counters, offset or dynamic range?
- // commonMode=NULL;
- // dim=1;
- // break;
-
- // case MYTHEN302:
- // deserializer=1;
- // cout << "MYTHEN 3 0.2" << endl;
- // dataStructure=new mythen3_02_jctbData(eNumCount->GetIntNumber(),eDynRange->GetIntNumber(),eSerOff->GetIntNumber());
- // //( int nch=64*3,int dr=24, int off=5)
- // eNumCount->SetState(kTRUE);
- // eDynRange->SetState(kTRUE);
- // eSerOff->SetState(kTRUE);
- // commonMode=NULL;
- // dim=1;
- // break;
- default:
- dataStructure=NULL;
- commonMode=NULL;
- }
- if (cbCommonMode->IsOn()) cm=commonMode;
- }
-
- if (dataStructure || deserializer) {
- if (dataStructure) {
- 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;
- nx=eNumCount->GetIntNumber();
- eNumCount->SetState(kTRUE);
- eDynRange->SetState(kTRUE);
- eSerOff->SetState(kTRUE);
- }
- // cout << "h size is " << nx << " " << ny << endl;
- int ymax=ny, xmax=nx;
- // if (ny>500) {ny=ny/2;}
- // if (nx>500) {nx=nx/2;}
- cout << "*** " << nx << " " << ny << endl;
- if (rb2D->IsOn()) {
- if (ny>1) {
- h2DMapAn=new TH2F("h2dmapAn","",nx,0,xmax,ny,0,ymax);
- h2DMapAn->SetStats(kFALSE);
- cout << "Created h2DMapAn"<< endl;
- if (dbitPlot && adcPlot){
- h2DMapDig=new TH2F("h2dmapDig","",nx,0,xmax,ny,0,ymax);
- h2DMapDig->SetStats(kFALSE);
- cout << "Created h2DMapDig"<< endl;
- }
- } else {
- h1DMap=new TH1F("h1dmap","",nx,0,xmax);
- h1DMap->SetStats(kFALSE);
- cout << "Created h1DMap"<< endl;
- }
- } // else if (rbScan->IsOn()) {
- // int nsteps=0;//myDet->getScanSteps(0);
- // double stepmin=0, stepmax=1;
- // if (nsteps>0) {
- // stepmin=myDet->getScanStep(0,0);
- // stepmax=myDet->getScanStep(0,nsteps-1);
- // }
- // cout << "************ creating scan histogram " << nx*ny << " " << nsteps << " " << stepmin << " " << stepmax << endl;
- // if (nsteps<1) nsteps=1;
- // double hmin=stepmin, hmax=stepmax;
- // if (stepmin>stepmax) {
- // hmin=stepmax;
- // hmax=stepmin;
- // }
- // h2Scan=new TH2F("h2scan","",nx*ny,0,nx*ny,nsteps,hmin,hmax);
- // }
-
- }
-
-
- cout << "done " << endl;
-}
-
-
-
-void ctbAcquisition::changeDetector(int i){
- changePlot();
- changeDetector();
-}
-
-void ctbAcquisition::changePlot(int i){
- changePlot();
- changeDetector();
-}
-
-
-
-void ctbAcquisition::setGraph(int i ,int en, Pixel_t col) {
- char name[100];
- // TList *l= mgAdcs->GetListOfGraphs();
- sprintf(name,"adc%d",i);
-
- // TList *l= adcStack->GetHists();
- TH1F *h=adcHisto[i];//(TH1F*)l->At(i);;
- TH1F *h1=countsHisto[i];//(TH1F*)(countsStack->GetHists()->At(i));
- if (en) {
- plotFlag[i]=1;
- h->SetLineColor(TColor::GetColor(col));
- h1->SetLineColor(TColor::GetColor(col));
- h1->SetFillColor(TColor::GetColor(col));
-
- if (adcStack->GetHists())
- // if (adcStack->GetHists()->GetEntries())
- if (adcStack->GetHists()->Contains(h)==0)
- adcStack->Add(h);
-
- if (countsStack->GetHists())
- if (countsStack->GetHists()->Contains(h1)==0)
- countsStack->Add(h1);
-
- cout << "Enable plot " << i << " color " << col << endl;
- } else {
- cout << "Disable plot " << i << endl;
- plotFlag[i]=0;
- if (adcStack->GetHists())
- // if (adcStack->GetHists()->GetEntries())
- if (adcStack->GetHists()->Contains(h))
- adcStack->RecursiveRemove(h);
- if (countsStack->GetHists())
- if (countsStack->GetHists()->Contains(h1))
- countsStack->RecursiveRemove(h1);
- }
- cout << countsStack->GetHists()->GetEntries() << endl;
-
- cout << "Number of histos " << adcStack->GetHists()->GetEntries() << endl;
-
- changePlot();
-
- // globalPlot=0;
- // for (int ii=0; iiGetListOfGraphs();
- sprintf(name,"bit%d",i);
- // TList *l= adcStack->GetHists();
- TH1F *h=bitHisto[i];//(TH1F*)l->At(i);;
- if (en) {
- //cout<< "enabling plot of bit "<SetLineColor(TColor::GetColor(col));
- if (bitStack->GetHists())
- //if (bitStack->GetHists()->GetEntries())
- if (bitStack->GetHists()->Contains(h)==0)
- bitStack->Add(h);
-
-
- cout << "Enable bit plot " << i << " color " << col << endl;
- } else {
- cout << "Disable bit plot " << i << endl;
- bitPlotFlag[i]=0;
- if (bitStack->GetHists())
- // if (bitStack->GetHists()->GetEntries())
- if (bitStack->GetHists()->Contains(h))
- bitStack->RecursiveRemove(h);
- }
- cout << "Number of histos " << bitStack->GetHists()->GetEntries() << endl;
-
- changePlot();
-
- float off=0;
- for (int ii=0; ii(1.5);
- cout << "bit " << ii << " offset " << bitOffset[ii] << endl;
- }
- }
-
- // globalPlot=0;
- // for (int ii=0; iisetFilePath(eOutdir->GetText());
- } CATCH_DISPLAY ("Could not set file path", "ctbAcquisition::setOutdir")
-}
-
-void ctbAcquisition::setFname() {
- try {
- myDet->setFileNamePrefix(eFname->GetText());
- } CATCH_DISPLAY ("Could not set file name prefix", "ctbAcquisition::setFname")
-}
-
-void ctbAcquisition::setFindex() {
- try {
- myDet->setAcquisitionIndex(eFindex->GetNumber());
- } CATCH_DISPLAY ("Could not set acquisition index", "ctbAcquisition::setFindex")
-}
-
-void ctbAcquisition::setFsave(Bool_t b) {
- try {
- myDet->setFileWrite(b);
- eFname->SetState(b);
- eOutdir->SetState(b);
- } CATCH_DISPLAY ("Could not set file write", "ctbAcquisition::setFsave")
-}
-
-void ctbAcquisition::update() {
- try {
- auto retval = myDet->getFileNamePrefix().tsquash("Different values");
- eFname->SetText(retval.c_str());
- } CATCH_DISPLAY ("Could not get file name prefix", "ctbAcquisition::update")
-
- try {
- auto retval = myDet->getAcquisitionIndex().tsquash("Different values");
- eFindex->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get acquisition index", "ctbAcquisition::update")
-
- try {
- auto retval = myDet->getFileWrite().tsquash("Different values");
- cFileSave->SetOn(retval);
- } CATCH_DISPLAY ("Could not get file write", "ctbAcquisition::update")
-
- eFname->SetState(cFileSave->IsOn());
- eOutdir->SetState(cFileSave->IsOn());
- eFindex->SetState(cFileSave->IsOn());
-
- try {
- auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
- setAnalogSamples(retval);
- } CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::update")
-
- try {
- auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
- setDigitalSamples(retval);
- } CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::update")
-
- try {
- roMode = static_cast(myDet->getReadoutMode().tsquash("Different values"));
- setReadoutMode(roMode);
- } CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::update")
-
- updateChans();
-
- 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 (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
- dBitOffset = 0;
- } else {
- try {
- dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
- } CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::update")
- }
- try {
- tenG = myDet->getTenGiga().tsquash("Different values");
- } CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::update")
-
- // char aargs[10][100];
- // char *args[10];
- // for (int i=0; i<10; i++)
- // args[i]=aargs[i];
-
- // string retval;
- // sprintf(args[0],"adcdisable");
- // slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
- // retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
- // delete cmd;
- // int mask;
- // sscanf(retval.c_str(),"adcdisable %d",&mask);
- // for (int i=0; iGetState()==1 || acqThread->GetState()==6) {
-
-
- if (cCompile->IsOn()) {
- sprintf(fname,"%s %s",patternCompiler,patternFile);
- cout << "Compile: " << fname << endl;
- strcpy(currdir,gSystem->pwd());
-
- std::size_t found = string(patternCompiler).rfind('/');
- if (found!=std::string::npos)
- gSystem->cd(string(patternCompiler).substr(0,found).c_str());
-
- gSystem->cd(cdir);
- system(fname);
- gSystem->cd(currdir);
- }
-
- if (string(patternCompiler).rfind(".pat")!=std::string::npos)
- strcpy(fname,patternFile);
- else if (string(patternCompiler).rfind(".npat")!=std::string::npos)
- strcpy(fname,patternFile);
- else
- sprintf(fname,"%sat",patternFile);
-
- cout << "Load: " << fname << endl;
- try {
- myDet->loadParameters(fname);
- } CATCH_DISPLAY ("Could not load parameters", "ctbAcquisition::loadPattern")
- }
-}
-
-
-void ctbAcquisition::toggleAcquisition() {
-
-
- if (acqThread->GetState()==1 || acqThread->GetState()==6) {
- /** update all infos useful for the acquisition! */
-
- try {
- auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
- setAnalogSamples(retval);
- } CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::toggleAcquisition")
-
- try {
- auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
- setDigitalSamples(retval);
- } CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::toggleAcquisition")
-
- if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
- dBitOffset = 0;
- } else {
- try {
- dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
- } CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::toggleAcquisition")
- }
-
- try {
- roMode = static_cast(myDet->getReadoutMode().tsquash("Different values"));
- setReadoutMode(roMode);
- } CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::toggleAcquisition")
-
-
- cout << "Run" << endl;
- bStatus->SetText("Stop");
- ip=0;
- for (int i=0; iGetListOfFunctions())
- adcHisto[i]->GetListOfFunctions()->Delete();
-
- adcHisto[i]->Reset();
-
- if (countsHisto[i]->GetListOfFunctions())
- countsHisto[i]->GetListOfFunctions()->Delete();
- countsHisto[i]->Reset();
- // ((TH1F*)adcStack->GetHists()->At(i))->Reset();
- // ((TH1F*)countsStack->GetHists()->At(i))->Reset();
- }
- for (int i=0; iReset();
- }
- cout << "reset 2d an" << endl;;
- if (h2DMapAn) h2DMapAn->Reset();
- cout << "reset 2d dig" << endl;;
- if (h2DMapDig) h2DMapDig->Reset();
- cout << "reset 1d" << endl;;
- if (h1DMap) h1DMap->Reset();
- cout << "done" << endl;;
- // if (h2Scan) h2Scan->Reset();
- // cout << "reset 1d" << endl;;
- // if (rbWaveform->IsOn())
-// adcStack->Draw("NOSTACK");
-// else if (rbDistribution->IsOn())
-// countsStack->Draw("NOSTACK");
-// else if (rb2D->IsOn())
-// h2DMap->Draw("colz");
-
- // cout << "timer" << endl;
- changePlot();
-
- // plotTimer->TurnOn();
- // cout << "thread" << endl;
- acqThread->Run();
- StopFlag=0;
-
-
-
-
-
- } else {
- StopFlag=1;
- try{
- myDet->stopDetector();
- } CATCH_DISPLAY ("Could not stop acquisition", "ctbAcquisition::toggleAcquisition")
- stop=1;
- bStatus->SetText("Start");
- // acqThread->Kill();
- }
-}
-
-void ctbAcquisition::acquisitionFinished() {
- bStatus->SetText("Start");
- cout << "finished " << endl;
- // plotTimer->TurnOff();
- Draw();
-}
-
-void ctbAcquisition::startAcquisition(){
- cout << "Detector started " <GetNumber()<< endl;
- stop=0;
-
- try {
- tenG = myDet->getTenGiga().tsquash("Different values");
- } CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::startAcquisition")
-
- for (int im=0; imGetNumber(); im++) {
- try {
- myDet->acquire();
- } CATCH_DISPLAY ("Could not acquire", "ctbAcquisition::startAcquisition")
-
- cout << im << endl;
- if (stop)
- break;
- }
-}
-
-void* ctbAcquisition::ThreadHandle(void *arg)
-{
- ctbAcquisition *acq = static_cast(arg);
-
- acq->startAcquisition();
- acq->acquisitionFinished();
-
- return nullptr;
-}
-
- void ctbAcquisition::progressCallback(double f,void* arg) {
-
-
- // ctbAcquisition *acq = static_cast(arg);
-
-
- cout << "*********" << f << "*******" << endl;
-
-
-
-
- }
-
-void ctbAcquisition::setPatternFile(const char* t) {
-
-
- cout << "New pattern is " << t << endl;
-
- strcpy(patternFile,t);
- }
-
-void ctbAcquisition::setPatternCompiler(const char* t) {
-
-
- cout << "New compiler is " << t << endl;
- strcpy(patternCompiler,t);
-
- }
-void ctbAcquisition::setMeasurements() {
-
-}
-
-void ctbAcquisition::setAnalogSamples(int n) {
-
-
- cout<< "Set number of analog samples to " << dec<< n << endl;
- if (n>0 && n<8192)
- nAnalogSamples=n;
-
- // TList *l= adcStack->GetHists();
- TH1 *h;
- // if (l) {
- for (int i=0; iAt(i);
- if (h) {
-
- h->SetBins(nAnalogSamples,0,nAnalogSamples);
- }
- }
-
- h=adcStack->GetHistogram();
- if (h)
- h->SetBins(nAnalogSamples,0,nAnalogSamples);
-}
-
-
-
-void ctbAcquisition::setDigitalSamples(int n) {
-
-
- cout<< "Set number of digital samples to " << dec<< n << endl;
- if (n>0 && n<8192)
- nDigitalSamples=n;
-
- TH1 *h;
- for (int i=0; iAt(i);
- if (h) {
-
- h->SetBins(nDigitalSamples,0,nDigitalSamples);
- }
-
- }
- // cout<< "histos resized " << dec<< h->GetNbinsX() << endl;
-
- h=bitStack->GetHistogram();
- if (h)
- h->SetBins(nDigitalSamples,0,nDigitalSamples);
-
-}
-
-void ctbAcquisition::setReadoutMode(int f) {
-
- roMode=f;
- slsDetectorDefs::readoutMode flag=(slsDetectorDefs::readoutMode)f;
- if (flag == slsDetectorDefs::DIGITAL_ONLY) {
- nAnalogSamples=0;
- adclist.clear();
- } else if (flag ==slsDetectorDefs::ANALOG_AND_DIGITAL) {
- ;
- }
- else {
- nDigitalSamples=0;
- dbitlist.clear();
- }
-
- // for (int i=0; igetDetectorType().squash() == slsDetectorDefs::MOENCH) {
- dbitlist.clear();
- } else {
- try {
- auto retval = myDet->getRxDbitList().tsquash("Different values");
- dbitlist.clear();
- if (!retval.empty()) {
- for (const auto &value : retval)
- dbitlist.push_back(value);
- }
- } CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbAcquisition::updateChans")
- }
-
- // adc mask
- try {
- auto retval = myDet->getADCEnableMask().tsquash("Different values");
- adclist.clear();
- if (retval!=0xffffffff) {
- for (int i=0; inewDataSet();
- };
-
-}
-
-void ctbAcquisition::ToggleCommonMode(Bool_t b) {
- if (photonFinder) {
- if (b) {
- photonFinder->setCommonModeSubtraction(commonMode);
- cmSub=1;
- cout << "Enable common mode" << endl;
- } else {
- photonFinder->setCommonModeSubtraction(NULL);
- cmSub=0;
- cout << "Disable common mode" << endl;
- }
- }
-
-}
-
-
-void ctbAcquisition::TogglePedSub(Bool_t b) {
- if (b) {
- ChangeHistoLimitsPedSub();
- } else {
- ChangeHistoLimitsRaw();
- }
-
-}
-
-
-void ctbAcquisition::FitADC() {
- int iadc=eFitADC->GetNumber();
- if (iadc<0 || iadc>=NADCS) return;
- cout << "fit panel for adc " << eFitADC->GetNumber() << endl;
- if (rbWaveform->IsOn()) {
- if (adcHisto[iadc]==NULL) return;
- new TCanvas("Cadcfit");
- if (adcFit) {
- delete adcFit;
- adcFit=NULL;
- }
- adcFit=(TH1F*)(adcHisto[iadc]->Clone("adcfit"));
- adcFit->Draw();
- adcFit->FitPanel();
-
- } else if (rbDistribution->IsOn()) {
- if (countsHisto[iadc]==NULL) return;
- new TCanvas("Ccountsfit");
-
- if (countsFit) {
- delete countsFit;
- countsFit=NULL;
- }
-
- countsFit=(TH1F*)(countsHisto[iadc]->Clone("countsfit"));
- countsFit->Draw();
- countsFit->FitPanel();
- }
-}
-
-
-void ctbAcquisition::plotBit() {
- int iadc=eBitPlot->GetNumber();
- if (iadc<0 || iadc>=NSIGNALS) return;
- cout << "plot panel for bit " << eBitPlot->GetNumber() << endl;
- if (bitHisto[iadc]==NULL) return;
- new TCanvas("Cbitplot");
- if (bitPlot) {
- delete bitPlot;
- bitPlot=NULL;
- }
- bitPlot=(TH1F*)(bitHisto[iadc]->Clone("bitplot"));
- bitPlot->Draw();
-}
-
-
-
-
-
-
-
-
-
-
-void ctbAcquisition::ChangeSerialOffset(Long_t a){
- ChangeSerialOffset();
-};
-
-
-void ctbAcquisition::ChangeDynamicRange(Long_t a){
- ChangeDynamicRange();
-};
-
-void ctbAcquisition::ChangeNumberOfChannels(Long_t a){
- ChangeNumberOfChannels();
-};
-
-
-
-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());
-
- // }
- // }
-};
-
-
-void ctbAcquisition::ChangeDynamicRange(){
- changeDetector();
- // if (dataStructure) {
-
- // cout << cbDetType->GetSelected()<< endl;
- // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
- // cout << "settings dynamic range for MYTHEN" << endl;
- // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
- // ms->setDynamicRange(eDynRange->GetIntNumber());
-
- // }
- // }
-};
-
-void ctbAcquisition::ChangeNumberOfChannels(){
- 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::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){
- ChangeHistoLimitsPedSub();
-};
-
-
-void ctbAcquisition::ChangeHistoLimitsRaw(Long_t a){
- ChangeHistoLimitsRaw();
-}
-
-void ctbAcquisition::ChangeHistoLimitsPedSub(Bool_t a){
- ChangeHistoLimitsPedSub();
-};
-
-
-void ctbAcquisition::ChangeHistoLimitsRaw(Bool_t a){
- ChangeHistoLimitsRaw();
-}
-
-
-void ctbAcquisition::ChangeHistoLimitsPedSub(){
-
- cout << "set Limits ped sub hist " << eMinPedSub->GetNumber() << " " << eMaxPedSub->GetNumber() << endl;
-
- if (eMinPedSub->GetNumber()>eMaxPedSub->GetNumber())
- return;
-
- if (cbSubtractPedestal->IsOn()) {
- if (cMinMaxPedSub->IsOn()) {
- adcStack->SetMaximum( eMaxPedSub->GetNumber());
- adcStack->SetMinimum( eMinPedSub->GetNumber());
- if (h2DMapAn) {
- h2DMapAn->SetMaximum( eMaxPedSub->GetNumber());
- h2DMapAn->SetMinimum( eMinPedSub->GetNumber());
- }
- if (h1DMap) {
- h1DMap->SetMaximum( eMaxPedSub->GetNumber());
- h1DMap->SetMinimum( eMinPedSub->GetNumber());
- }
- if (countsStack->GetHistogram())
- countsStack->GetHistogram()->GetXaxis()->SetRangeUser(eMinPedSub->GetNumber(), eMaxPedSub->GetNumber());
- } else {
- if (adcStack->GetHistogram())
- adcStack->GetHistogram()->GetYaxis()->UnZoom();
- if (h2DMapAn) {
- h2DMapAn->GetZaxis()->UnZoom();
- }
- if (h1DMap) {
- h1DMap->GetYaxis()->UnZoom();
- }
- if (countsStack->GetHistogram())
- countsStack->GetHistogram()->GetXaxis()->UnZoom();
- }
- }
-
-
-};
-
-
-void ctbAcquisition::ChangeHistoLimitsRaw(){
-
- cout << "set Limits raw hist " << eMinRaw->GetNumber() << " " << eMaxRaw->GetNumber() << endl;
- if (eMinRaw->GetNumber()>eMaxRaw->GetNumber())
- return;
-
- if (cbSubtractPedestal->IsOn()==0) {
- if (cMinMaxRaw->IsOn()) {
- adcStack->SetMaximum( eMaxRaw->GetNumber());
- adcStack->SetMinimum( eMinRaw->GetNumber());
- if (h2DMapAn) {
- h2DMapAn->SetMaximum( eMaxRaw->GetNumber());
- h2DMapAn->SetMinimum( eMinRaw->GetNumber());
- }
- if (h1DMap) {
- h1DMap->SetMaximum( eMaxRaw->GetNumber());
- h1DMap->SetMinimum( eMinRaw->GetNumber());
- }
- if (countsStack->GetHistogram())
- countsStack->GetHistogram()->GetXaxis()->SetRangeUser(eMinRaw->GetNumber(), eMaxRaw->GetNumber());
- } else {
-
- if (adcStack->GetHistogram())
- adcStack->GetHistogram()->GetYaxis()->UnZoom();
- if (h2DMapAn) {
- h2DMapAn->GetZaxis()->UnZoom();
- }
-
- if (h1DMap) {
- h1DMap->GetYaxis()->UnZoom();
- }
- if (countsStack->GetHistogram())
- countsStack->GetHistogram()->GetXaxis()->UnZoom();
-
- }
- }
-
-}
diff --git a/ctbGui/ctbAcquisition.h b/ctbGui/ctbAcquisition.h
deleted file mode 100644
index 3d5524eda..000000000
--- a/ctbGui/ctbAcquisition.h
+++ /dev/null
@@ -1,248 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#ifndef CTBACQUISITION_H
-#define CTBACQUISITION_H
-#include
-
-#include "ctbAdcs.h"
-#include "ctbSignals.h"
-#include "ctbPattern.h"
-class TGTextEntry;
-class TGLabel;
-class TGNumberEntry;
-class TGCheckButton;
-class TThread;
-class TGraph;
-class TMultiGraph;
-class THStack;
-class TGButtonGroup;
-class TGRadioButton;
-class TGComboBox;
-class TTimer;
-class TCanvas;
-class TH2F;
-class TH1F;
-class TGLabel;
-class TGTextButton;
-
-namespace sls
-{
- class Detector;
- class detectorData;
-};
-
-template class slsDetectorData;
-
-class singlePhotonDetector;
-//class singlePhotonDetector;
-class commonModeSubtraction;
-
-#include
-#include
-using namespace std;
-
-class ctbAcquisition : public TGGroupFrame {
-
-
- enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE32B, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302};
-
-
- private:
- TGTextEntry *eOutdir;
- TGTextEntry *eFname;
- TGNumberEntry *eFindex;
- TGCheckButton *cFileSave;
-
-
- TGNumberEntry *eSerOff;
- TGNumberEntry *eDynRange;
- TGNumberEntry *eNumCount;
-
-
- TGNumberEntry *ePixX;
- TGNumberEntry *ePixY;
-
- TGNumberEntry *eFitADC;
- TGNumberEntry *eBitPlot;
- TGNumberEntry *eMinRaw;
- TGNumberEntry *eMaxRaw;
- TGNumberEntry *eMinPedSub;
- TGNumberEntry *eMaxPedSub;
- TGCheckButton *cMinMaxRaw;
- TGCheckButton *cMinMaxPedSub;
-
-
-
-
- TGNumberEntry *eMeasurements;
-
-
-
- TGTextButton *bStatus;
- // TGTextButton
- TGCheckButton *cCompile;
- TGTextButton *cLoad;
- // TGCheckButton *cRun;
-
- TThread *acqThread;
-
-
- THStack *adcStack;
- THStack *bitStack;
- THStack *countsStack;
-
-
- TH1F *adcHisto[NADCS];
- TH1F *countsHisto[NADCS];
-
- TH1F *bitHisto[NSIGNALS];
- float bitOffset[NSIGNALS];
-
- // int enableFlag[NADCS+4];
- int roMode;
-
- int dBitOffset;
-
-
-
- TH1F *adcFit;
- TH1F *bitPlot;
- TH1F *countsFit;
-
-
-
- TH2F *h2DMapAn; // for 2D detectors
- TH2F *h2DMapDig; // for 2D detectors
- TH1F *h1DMap; //for 1D detectors
-
- // TH2F *h2Scan; // for 2D detectors
- // TMultiGraph *mgAdcs;
- // TH1I *plotAdc[NADCS];
-
-
- sls::Detector* myDet;
-
- int plotFlag[NADCS];
- int bitPlotFlag[NSIGNALS];
-
- int ip;
- // int nChannels;
- // int chanEnable;
- //int nADCs;
-
- std::vector dbitlist;
- std::vector adclist;
-
- TGButtonGroup *bgPlot;// = new TGVButtonGroup(main_frame);
- TGRadioButton *rbPlotOff;
- TGRadioButton *rbWaveform;
- TGRadioButton *rbDistribution;
- TGRadioButton *rb2D;
- // TGRadioButton *rbScan;
- TGComboBox *cbDetType;
- TGCheckButton *cbGetPedestal;
- TGCheckButton *cbSubtractPedestal;
- TGCheckButton *cbCommonMode;
- TGTextButton *bResetPedestal;
-
- TGLabel *lClickX;
- TGLabel *lClickY;
- TGLabel *lClickValue;
-
-
- TCanvas *myCanvas;
- TTimer *plotTimer;
-
- char patternFile[10000];
- char patternCompiler[10000];
-
- int globalPlot;
- int adcPlot;
- int dbitPlot;
- int tenG;
-
- int nAnalogSamples, nDigitalSamples;
- // int iScanStep;
-
- slsDetectorData *dataStructure;
- singlePhotonDetector *photonFinder;
- //singlePhotonDetector *photonFinder;
- commonModeSubtraction *commonMode;
- int cmSub;
-
- int stop;
-
- uint64_t dBitMask;
-
- int deserializer;
-
- public:
- ctbAcquisition(TGVerticalFrame*, sls::Detector*);
- void setOutdir();
- void setFname();
- void setMeasurements();
- void setFsave(Bool_t);
- void changePlot(Int_t);
- void changeDetector(Int_t);
- void changePlot();
- void changeDetector();
- void setFindex();
- void Draw();
- void setCanvas(TCanvas*);
-
- void toggleAcquisition();
- void loadPattern();
- static void* ThreadHandle(void *arg);
- void update();
- void acquisitionFinished();
- // string getParameters();
-
- void setGraph (int i ,int en, Pixel_t col);
- void setBitGraph (int i ,int en, Pixel_t col);
- void startAcquisition();
- static void progressCallback(double,void*);
- static void dataCallback(sls::detectorData*, long unsigned int, unsigned int, void*);
- int StopFlag;
-
- int plotData(sls::detectorData*, int);
-
- void setPatternFile(const char* t);
-
- void setPatternCompiler(const char* t);
-
- void setAnalogSamples(int);
- void setDigitalSamples(int);
-
- void setADCEnable(Int_t);
- void setDbitEnable(Int_t);
- void setReadoutMode(int);
- void updateChans();
-
- void resetPedestal();
-
- void ToggleCommonMode(Bool_t);
- void TogglePedSub(Bool_t);
- void ChangeHistoLimitsPedSub(Long_t );
- void ChangeHistoLimitsRaw(Long_t);
- void ChangeHistoLimitsPedSub( );
- void ChangeHistoLimitsRaw();
- void ChangeHistoLimitsPedSub(Bool_t );
- void ChangeHistoLimitsRaw(Bool_t);
-
-
- void ChangeSerialOffset();
- void ChangeSerialOffset(Long_t);
- void ChangeNumberOfChannels();
- void ChangeNumberOfChannels(Long_t);
- void ChangeDynamicRange();
- void ChangeDynamicRange(Long_t);
- void ChangeImagePixels();
- void ChangeImagePixels(Long_t);
-
- void canvasClicked();
- void FitADC();
- void plotBit();
- ClassDef(ctbAcquisition,0)
-};
-
-#endif
diff --git a/ctbGui/ctbAdcs.cpp b/ctbGui/ctbAdcs.cpp
deleted file mode 100644
index 694f5ff13..000000000
--- a/ctbGui/ctbAdcs.cpp
+++ /dev/null
@@ -1,616 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "ctbAdcs.h"
-#include "ctbDefs.h"
-#include "sls/Detector.h"
-
-using namespace std;
-
-
-
-ctbAdc::ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det)
- : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
-
- TGHorizontalFrame *hframe=this;
- char tit[100];
-
- page->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
-
-
-
- sprintf(tit, "ADC%d", id);
-
- sAdcLabel= new TGLabel(hframe, tit);
- hframe->AddFrame(sAdcLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- sAdcLabel->MapWindow();
- sAdcLabel->SetTextJustify(kTextLeft);
-
-
-
-
-
-
- sAdcInvert= new TGCheckButton(hframe, "Inv");
- hframe->AddFrame( sAdcInvert,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- sAdcInvert->MapWindow();
- sAdcInvert->Connect("Toggled(Bool_t)","ctbAdc",this,"ToggledInvert(Bool_t)");
-
-
- sAdcEnable= new TGCheckButton(hframe, "En");
- hframe->AddFrame( sAdcEnable,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- sAdcEnable->MapWindow();
- // sAdcEnable->SetOn(kTRUE);
- // sAdcEnable->SetEnabled(kFALSE);
- sAdcEnable->Connect("Toggled(Bool_t)","ctbAdc",this,"ToggledEnable(Bool_t)");
-
-
-
- sAdcPlot= new TGCheckButton(hframe, "Plot");
- hframe->AddFrame( sAdcPlot,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- sAdcPlot->MapWindow();
-
-
- sAdcPlot->Connect("Toggled(Bool_t)","ctbAdc",this,"ToggledPlot(Bool_t)");
-
-
-
- fColorSel = new TGColorSelect(hframe, id+1, 0);
-
- fColorSel->Connect("ColorSelected(Pixel_t)","ctbAdc",this,"ColorChanged(Pixel_t)");
- hframe->AddFrame(fColorSel, new TGLayoutHints(kLHintsTop |
- kLHintsLeft, 2, 0, 2, 2));
-
-
- fColorSel->SetColor(TColor::Number2Pixel(id+1));
- // sprintf(tit,"adc%d",id);
-// gADC=new TGraph();
-// gADC->SetName(tit);
-// gADC->SetLineColor(id+1);
-// gADC->SetMarkerColor(id+1);
-
-
-
-};
-Pixel_t ctbAdc::getColor(){
- return fColorSel->GetColor();
-}
-Bool_t ctbAdc::getEnabled(){
- return getPlot();
-}
-Bool_t ctbAdc::getPlot(){
- return sAdcPlot->IsOn();
-}
-Bool_t ctbAdc::getInverted(){
- return sAdcInvert->IsOn();
-}
-
-Bool_t ctbAdc::getEnable(){
- return sAdcEnable->IsOn();
-}
-
-
-
-void ctbAdc::setInverted(Bool_t b){
- // cout << id << "set enabled " << b << endl;
- if (b)
- sAdcInvert->SetOn(kTRUE,kTRUE);
- else
- sAdcInvert->SetOn(kFALSE,kTRUE);
-
-}
-
-
-void ctbAdc::setEnable(Bool_t b){
- // cout << id << "set enabled " << b << endl;
- if (b)
- sAdcEnable->SetOn(kTRUE,kFALSE);
- else
- sAdcEnable->SetOn(kFALSE,kFALSE);
-
-}
-
-
-
-
-
-void ctbAdc::setAdcAlias(char *tit, int plot, int color) {
- if (tit)
- sAdcLabel->SetText(tit);
- if (plot>0)
- sAdcPlot->SetOn(kTRUE,kTRUE);
- else if (plot==0)
- sAdcPlot->SetOn(kFALSE,kTRUE);
- if (color>=0)
- fColorSel->SetColor(color);
- fColorSel->SetEnabled(sAdcPlot->IsOn());
-}
-
-
-string ctbAdc::getAdcAlias() {
-
- char line[1000];
- sprintf(line,"ADC%d %s %d %lx\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
- return string(line);
-}
-
-void ctbAdc::update() {
-
-
- //Emit("ToggledAdcEnable(Int_t)", id);
-
-}
-
-
-void ctbAdc::ToggledPlot(Bool_t b){
-
- // Long_t mask=b<SetEnabled(kTRUE);
- else
- fColorSel->SetEnabled(kFALSE);
-
- // fColorSel->SetEnabled(sAdcPlot->IsOn());
- Emit("ToggledAdcPlot(Int_t)", id);
-
-}
-
-
-
-void ctbAdc::ToggledInvert(Bool_t b){
-
-
- // fColorSel->SetEnabled(sAdcPlot->IsOn());
- Emit("ToggledAdcInvert(Int_t)", id);
-
-}
-
-
-
-void ctbAdc::ToggledEnable(Bool_t b){
-
-
- fColorSel->SetEnabled(sAdcPlot->IsOn());
- Emit("ToggledAdcEnable(Int_t)", id);
-
-}
-
-
-
-
-
-
-void ctbAdc::ColorChanged(Pixel_t) {
-
- Emit("ToggledAdcPlot(Int_t)", id);
-
-}
-
-void ctbAdc::ToggledAdcPlot(Int_t b){
-
-
- Emit("ToggledAdcPlot(Int_t)", id);
-
-}
-
-void ctbAdc::ToggledAdcInvert(Int_t b){
-
-
- Emit("ToggledAdcInvert(Int_t)", id);
-
-}
-
-void ctbAdc::ToggledAdcEnable(Int_t b){
-
-
- Emit("ToggledAdcEnable(Int_t)", id);
-
-}
-
-
-
-
-void ctbAdc::setEnabled(Bool_t b){
- // cout << id << "set enabled " << b << endl;
- if (b)
- sAdcPlot->SetOn(kTRUE,kFALSE);
- else
- sAdcPlot->SetOn(kFALSE,kFALSE);
-
-}
-
-
-
-void ctbAdc::setPlot(Bool_t b){
- // cout << id << "set enabled " << b << endl;
- if (b)
- sAdcPlot->SetOn(kTRUE,kTRUE);
- else
- sAdcPlot->SetOn(kFALSE,kTRUE);
-
-
-}
-
-
-
-
-
-
-
-ctbAdcs::ctbAdcs(TGVerticalFrame *page, sls::Detector *det)
- : TGGroupFrame(page,"Adcs",kVerticalFrame), myDet(det) {
-
-
- SetTitlePos(TGGroupFrame::kLeft);
- page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
- MapWindow();
-
-
-
- TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
-
-
- int idac=0;
-
-
-
-
-
- TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hhframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hhframe->MapWindow();
-
- TGVerticalFrame *vframe;
-
-
-
-
- for (idac=0; idacAddFrame(vframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- vframe->MapWindow();
-
-
-
- }
-
- sAdc[idac]=new ctbAdc(vframe,idac,myDet);
-
-
- sAdc[idac]->Connect("ToggledAdcPlot(Int_t)","ctbAdcs",this,"ToggledAdcPlot(Int_t)");
- sAdc[idac]->Connect("ToggledAdcInvert(Int_t)","ctbAdcs",this,"ToggledAdcInvert(Int_t)");
- sAdc[idac]->Connect("ToggledAdcEnable(Int_t)","ctbAdcs",this,"ToggledAdcEnable(Int_t)");
-
- }
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- bCheckHalf[0]=new TGTextButton(hframe, "All 0-15");
- hframe->AddFrame(bCheckHalf[0],new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
- bCheckHalf[0]->MapWindow();
- bCheckHalf[0]->Connect("Clicked()","ctbAdcs",this,"CheckHalf0()");
-
-
- bRemoveHalf[0]=new TGTextButton(hframe, "None 0-15");
- hframe->AddFrame(bRemoveHalf[0],new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 5, 5, 5, 5));
- bRemoveHalf[0]->MapWindow();
- bRemoveHalf[0]->Connect("Clicked()","ctbAdcs",this,"RemoveHalf0()");
-
-
- bCheckHalf[1]=new TGTextButton(hframe, "All 16-23");
- hframe->AddFrame(bCheckHalf[1],new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
- bCheckHalf[1]->MapWindow();
- bCheckHalf[1]->Connect("Clicked()","ctbAdcs",this,"CheckHalf1()");
- // bCheckAll->Connect("Clicked()","ctbAdcs",this,"CheckAll()");
-
-
- bRemoveHalf[1]=new TGTextButton(hframe, "None 16-23");
- hframe->AddFrame(bRemoveHalf[1],new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 5, 5, 5, 5));
- bRemoveHalf[1]->MapWindow();
- bRemoveHalf[1]->Connect("Clicked()","ctbAdcs",this,"RemoveHalf1()");
- // bRemoveAll->Connect("Clicked()","ctbAdcs",this,"RemoveAll()");
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- bCheckAll=new TGTextButton(hframe, "All");
- hframe->AddFrame(bCheckAll,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
- bCheckAll->MapWindow();
- bCheckAll->Connect("Clicked()","ctbAdcs",this,"CheckAll()");
-
-
- bRemoveAll=new TGTextButton(hframe, "None");
- hframe->AddFrame(bRemoveAll,new TGLayoutHints(kLHintsBottom | kLHintsExpandX, 5, 5, 5, 5));
- bRemoveAll->MapWindow();
- bRemoveAll->Connect("Clicked()","ctbAdcs",this,"RemoveAll()");
-
-
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- TGLabel *label= new TGLabel(hframe, "Inversion mask: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
- eInversionMask = new TGNumberEntry(hframe, 0, 16,999, TGNumberFormat::kNESHex,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELNoLimits);
-
- hframe->AddFrame(eInversionMask,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eInversionMask->MapWindow();
- eInversionMask->Resize(150,30);
- eInversionMask->SetState(kFALSE);
-
-
- hframe=new TGHorizontalFrame(this, 800,50);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- label= new TGLabel(hframe, "Enable mask: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
- eEnableMask = new TGNumberEntry(hframe, 0, 16,999, TGNumberFormat::kNESHex,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELNoLimits);
-
- hframe->AddFrame(eEnableMask,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eEnableMask->MapWindow();
- eEnableMask->Resize(150,30);
- eEnableMask->SetState(kFALSE);
-
-}
-
-
-int ctbAdcs::setEnable(int reg) {
-
- try {
- if (reg > -1) {
- myDet->setADCEnableMask(reg);
- }
- auto retval = myDet->getADCEnableMask().tsquash("Different values");
- eEnableMask->SetHexNumber(retval);
- return retval;
- } CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
-
- return -1;
-}
-
-int ctbAdcs::setInvert(int reg) {
-
- try {
- if (reg > -1) {
- myDet->setADCInvert(reg);
- }
- auto retval = myDet->getADCInvert().tsquash("Different values");
- eInversionMask->SetHexNumber(retval);
- return retval;
- } CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
-
- return -1;
-}
-
-
-
-void ctbAdcs::update() {
- Int_t invreg;
- Int_t disreg;
-
- disreg=setEnable();
- invreg=setInvert();
-
- for (int is=0; issetAdcAlias(NULL,-1,-1);
- if (invreg & (1<setInverted(kTRUE);
- else
- sAdc[is]->setInverted(kFALSE);
-
- if (disreg & (1<setEnable(kTRUE);
- else
- sAdc[is]->setEnable(kFALSE);
- }
-
- Emit("AdcEnable(Int_t)", disreg);
-
-}
-string ctbAdcs::getAdcParameters() {
- ostringstream line;
- line << "reg "<< hex << setInvert() << "# ADC invert reg" << dec << endl;
- line << "reg "<< hex << setEnable() << " # ADC enable reg"<< dec << endl;
- return line.str();
-
-}
-
-
-void ctbAdcs::CheckAll() {
- for (int is=0; issetPlot(kTRUE);
- }
-}
-
-
-void ctbAdcs::RemoveAll() {
- for (int is=0; issetPlot(kFALSE);
- }
-}
-
-
-
-void ctbAdcs::CheckHalf0() {
- for (int is=0; issetPlot(kTRUE);
- }
-}
-
-
-void ctbAdcs::RemoveHalf0() {
- for (int is=0; issetPlot(kFALSE);
- }
-}
-
-void ctbAdcs::CheckHalf1() {
- for (int is=NADCS/2; issetPlot(kTRUE);
- }
-}
-
-
-void ctbAdcs::RemoveHalf1() {
- for (int is=NADCS/2; issetPlot(kFALSE);
- }
-}
-
-
-int ctbAdcs::setAdcAlias(string line) {
-
- int is=-1, plot=0, color=-1;
- char tit[100];
- int narg=sscanf(line.c_str(),"ADC%d %s %d %x",&is,tit,&plot, &color);
- if (narg<2)
- return -1;
- if (narg!=3)
- color=-1;
- if (is>=0 && issetAdcAlias(tit,plot,color);
- }
- return is;
-
-}
-
-string ctbAdcs::getAdcAlias() {
-
- ostringstream line;
-
- for (int is=0; isgetAdcAlias();
-
- return line.str();
-}
-
-
-void ctbAdcs::ToggledAdcPlot(Int_t b){
-
-
- Emit("ToggledAdcPlot(Int_t)", b);
-
-}
-
-void ctbAdcs::AdcEnable(Int_t b){
- Emit("AdcEnable(Int_t)", b);
-}
-
-
-void ctbAdcs::ToggledAdcEnable(Int_t b){
-
- Int_t oreg=setEnable();
- Int_t m=1<getEnable())
- oreg|=m;
- else
- oreg&=~m;
-
- setEnable(oreg);
-
- Emit("AdcEnable(Int_t)", oreg);
-}
-
-
-void ctbAdcs::ToggledAdcInvert(Int_t b){
-
- Int_t oreg=setInvert();
- Int_t m=1<getInverted())
- oreg|=m;
- else
- oreg&=~m;
-
- setInvert(oreg);
-}
-
-
-
-
-
-Pixel_t ctbAdcs::getColor(int i){
- if (i>=0 && igetColor();
- return static_cast(-1);
-}
-
-Bool_t ctbAdcs::getEnabled(int i){
- if (i>=0 && igetEnabled();
- return static_cast(-1);
-}
-
-Bool_t ctbAdcs::getEnable(int i){
- if (i>=0 && igetEnable();
- return static_cast(-1);
-}
-
-Bool_t ctbAdcs::getPlot(int i){
- if (i>=0 && igetPlot();
- return static_cast(-1);
-}
diff --git a/ctbGui/ctbAdcs.h b/ctbGui/ctbAdcs.h
deleted file mode 100644
index 3a4cf35da..000000000
--- a/ctbGui/ctbAdcs.h
+++ /dev/null
@@ -1,157 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-
-
-
-#ifndef CTBADCS_H
-#define CTBADCS_H
-#include
-
-
-#define NADCS 32
-
-class TRootEmbeddedCanvas;
-class TGButtonGroup;
-class TGVerticalFrame;
-class TGHorizontalFrame;
-class TGTextEntry;
-class TGLabel;
-class TGNumberEntry;
-class TH2F;
-class TGComboBox;
-class TGCheckButton;
-class TGColorSelect;
-class TColor;
-
-class THStack;
-class TGraphErrors;
-class TGTextButton;
-class TGTab;
-
-class TGraph;
-
-namespace sls
-{
- class Detector;
-};
-
-#include
-using namespace std;
-
-class ctbAdc : public TGHorizontalFrame {
-
-
- private:
-
-
- TGLabel *sAdcLabel;
- TGCheckButton *sAdcEnable;
- TGCheckButton *sAdcPlot;
- TGCheckButton *sAdcInvert;
-
- TGColorSelect *fColorSel;
-
- // TGraph *gADC;
-
- int id;
- sls::Detector *myDet;
-
- public:
- ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det);
-
-
- void setAdcAlias(char *tit, int plot, int color);
- string getAdcAlias();
- void ToggledAdcPlot(Int_t b);
- void ToggledAdcEnable(Int_t b);
- void ToggledAdcInvert(Int_t b);
-
-
- void ToggledPlot(Bool_t b);
- void ToggledEnable(Bool_t b);
- void ToggledInvert(Bool_t b);
- void ColorChanged(Pixel_t);
- void setEnabled(Bool_t b);
- Bool_t getEnabled();
- // TGraph *getGraph();
- void update();
-
- Pixel_t getColor();
-
- Bool_t getEnable();
- void setEnable(Bool_t);
- void setPlot(Bool_t);
- Bool_t getInverted();
- Bool_t getPlot();
- void setInverted(Bool_t);
-
- ClassDef(ctbAdc,0)
- };
-
-
-
-class ctbAdcs : public TGGroupFrame {
-private:
-
- ctbAdc *sAdc[NADCS];
- sls::Detector *myDet;
-
-
- TGTextButton *bCheckAll;
- TGTextButton *bRemoveAll;
- TGTextButton *bCheckHalf[2];
- TGTextButton *bRemoveHalf[2];
- TGNumberEntry *eInversionMask;
- TGNumberEntry *eEnableMask;
-
-
-/* TGTextButton *bPlotSelected; */
-/* TGNumberEntry *eMinX; */
-/* TGNumberEntry *eMaxX; */
-/* TGNumberEntry *eMinY; */
-/* TGNumberEntry *eMaxY; */
-
-
-
-/* TGTextButton *bGetPixel; */
-/* TGNumberEntry *ePixelX; */
-/* TGNumberEntry *ePixelY; */
-/* TGLabel *lPixelValue; */
-
-public:
-
- ctbAdcs(TGVerticalFrame *page, sls::Detector *det);
- int setAdcAlias(string line);
- string getAdcAlias();
- string getAdcParameters();
- void ToggledAdcPlot(Int_t);
- void ToggledAdcInvert(Int_t);
- void ToggledAdcEnable(Int_t);
- void AdcEnable(Int_t b);
- // TGraph *getGraph(int i);
- void CheckAll();
- void RemoveAll();
- void update();
-
- int setInvert(int reg=-1);
- int setEnable(int reg=-1);
-
-
- Pixel_t getColor(int i);
- Bool_t getEnabled(int i);
- Bool_t getPlot(int i);
- Bool_t getEnable(int i);
-
- void CheckHalf0();
- void RemoveHalf0();
-
- void CheckHalf1();
- void RemoveHalf1();
-
-
- ClassDef(ctbAdcs,0)
-};
-
-#endif
-
-
diff --git a/ctbGui/ctbDacs.cpp b/ctbGui/ctbDacs.cpp
deleted file mode 100644
index dd2763fdf..000000000
--- a/ctbGui/ctbDacs.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include "ctbDacs.h"
-#include "ctbDefs.h"
-#include "sls/Detector.h"
-#include "sls/sls_detector_defs.h"
-
-using namespace std;
-
-
-ctbDac::ctbDac(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
-
- TGHorizontalFrame *hframe=this;
-
- page->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- MapWindow();
-
- char tit[100];
-
-
- sprintf(tit, "DAC %d:",idac);
-
- dacsLabel= new TGCheckButton(hframe, tit);// new TGLabel(hframe, tit);
- dacsLabel->SetOn(kTRUE, kTRUE);
-
- dacsLabel->Connect("Toggled(Bool_t)","ctbDac",this,"setOn(Bool_t)");
-
-
- hframe->AddFrame(dacsLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- dacsLabel->MapWindow();
- dacsLabel->SetTextJustify(kTextLeft);
-
-
- dacsEntry = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 65535);
-
- hframe->AddFrame(dacsEntry,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
- dacsEntry->MapWindow();
- dacsEntry->Resize(150,30);
-
-
- dacsUnit= new TGCheckButton(hframe, "mV");
- // if (idac!=slsDetectorDefs::ADC_VPP) {
- hframe->AddFrame( dacsUnit,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- dacsUnit->MapWindow();
- if (idac==slsDetectorDefs::ADC_VPP) {
- dacsUnit->SetEnabled(kFALSE);
- hframe->HideFrame(dacsUnit);
- dacsUnit->MapWindow();
- cout << "hiding!" << endl;
- }
- if (idac==slsDetectorDefs::HIGH_VOLTAGE) {
- dacsUnit->SetText("V");
- dacsUnit->SetOn(kTRUE,kTRUE);
- dacsUnit->SetEnabled(kFALSE);
- }
- //}
-
-
-
- sprintf(tit, "xxx");
- dacsValue= new TGLabel(hframe, tit);
- hframe->AddFrame( dacsValue,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
- dacsValue->MapWindow();
- dacsValue->SetTextJustify(kTextLeft);
-
- TGTextEntry *e=dacsEntry->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbDac",this,"setValue()");
- // e->Connect("ValueSet(Long_t)","ctbDac",this,"setValue(Long_t)");
- dacsEntry->Connect("ValueSet(Long_t)","ctbDac",this,"setValue(Long_t)");
- // cout << "(((((((((((((((((((((((((((((((" << dacsEntry->GetListOfSignals()->At(0)->IsA() << endl;
-
-
-}
-
-
-
-int ctbDac::setLabel(char *tit, int mv) {
- if(tit)
- dacsLabel->SetText(tit);
- if (mv==1)
- dacsUnit->SetOn(kTRUE,kTRUE);
- else if (mv==0)
- dacsUnit->SetOn(kFALSE,kTRUE);
- // else if (mv==2) {
- // ;}
- // else if (mv==3)
- // ;
- return id;
-
-}
-
-string ctbDac::getLabel() {
- ostringstream line;
- line << dacsLabel->GetText() << " " << dacsUnit->IsOn() << endl;
- // line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
- return line.str();
-
-}
-
-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(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(sid), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
- } CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue")
-
- getValue();
-}
-
-void ctbDac::setOn(Bool_t b) {
- // cout << "setting dac! "<< id << endl;
- if ( dacsLabel->IsOn()) {
- setValue();
- } else {
- try {
- int sid = id;
- if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
- sid = getMoenchDacId();
- }
- myDet->setDAC(static_cast(sid), -100, false);
- } CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn")
- }
- getValue();
-}
-
-int ctbDac::getValue() {
- try {
- int sid = id;
- if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
- sid = getMoenchDacId();
- }
- int val = myDet->getDAC(static_cast(sid), dacsUnit->IsOn()).tsquash("Different values");
- cout << "dac " << id << " " << val << endl;
- dacsValue->SetText(to_string(val).c_str());
- if (val >= 0) {
- dacsLabel->SetOn(kTRUE);
- } else {
- dacsLabel->SetOn(kFALSE);
- }
- return val;
- } CATCH_DISPLAY ("Could not get dac " + to_string(id) + ".", "ctbDac::getValue")
-
- return -1;
-}
-
-
-ctbDacs::ctbDacs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
-
- SetTitlePos(TGGroupFrame::kLeft);
- page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
- MapWindow();
-
- // cout << "window mapped " << endl;
-
- for (int idac=0; idacsetLabel((char*)"ADC Vpp",2);
- dacs[NDACS+1]->setLabel((char*)"High Voltage",3);
-}
-
-
-int ctbDacs::setDacAlias(string line) {
- int is=-1, mv=0;
- char tit[100];
- int narg=sscanf(line.c_str(),"DAC%d %s %d",&is,tit,&mv);
- if (narg<2)
- return -1;
- if (is>=0 && issetLabel(tit,mv);
- return is;
-
-}
-
-string ctbDacs::getDacAlias() {
- ostringstream line;
-
- for (int i=0; igetLabel() << endl;
- return line.str();
-}
-
-
-
-
-
-string ctbDacs::getDacParameters() {
- ostringstream line;
-
- for (int i=0; igetValue << endl;
- line << "dac:" << i << " " << dacs[i]->getValue() << endl;
- }
- return line.str();
-}
-
-
-
-void ctbDacs::update() {
- for (int idac=0; idacgetValue();
- }
-}
diff --git a/ctbGui/ctbDacs.h b/ctbGui/ctbDacs.h
deleted file mode 100644
index 818c0c42d..000000000
--- a/ctbGui/ctbDacs.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-
-
-#ifndef CTBDACS_H
-#define CTBDACS_H
-#include
-
-
-#define NDACS 18
-//#define NDACS 16
-
-
-class TGTextEntry;
-class TGLabel;
-class TGNumberEntry;
-class TGCheckButton;
-
-
-namespace sls
-{
- class Detector;
-};
-
-#include
-using namespace std;
-
-
-class ctbDac : public TGHorizontalFrame {
-
-
- protected:
- // TGLabel *dacsLabel;
- TGNumberEntry *dacsEntry;
- TGCheckButton *dacsUnit;
- TGCheckButton *dacsLabel;
- TGLabel *dacsValue;
- int id;
-
- sls::Detector* myDet;
- public:
- ctbDac(TGGroupFrame*, int , sls::Detector*);
- void setValue();
- void setValue(Long_t);
- int getValue();
- void setOn(Bool_t);
-
- int setLabel(char *tit, int mv);
- string getLabel();
-int getMoenchDacId();
-
-
- ClassDef(ctbDac,0)
-};
-
-class ctbDacs : public TGGroupFrame {
-private:
-
- ctbDac *dacs[NDACS+2];
-
- sls::Detector* myDet;
-
-public:
- ctbDacs(TGVerticalFrame *page, sls::Detector*);
-
- int setDacAlias(string line);
- // int setDacAlias(string line);
- string getDacAlias();
- string getDacParameters();
-
- void update();
-
- ClassDef(ctbDacs,0)
-};
-
-#endif
-
diff --git a/ctbGui/ctbDefs.h b/ctbGui/ctbDefs.h
deleted file mode 100644
index 85d7e1b8a..000000000
--- a/ctbGui/ctbDefs.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#pragma once
-
-#include
-#include
-#include
-
-//#include "sls/sls_detector_exceptions.h"
-//#include "sls/ansi.h"
-#define RED "\x1b[31m"
-#define RESET "\x1b[0m"
-#define BOLD "\x1b[1m"
-#define cprintf(code, format, ...) printf(code format RESET, ##__VA_ARGS__)
-
-
-#define CATCH_DISPLAY(m, s) catch(...) { ctbDefs::DisplayExceptions(m, s); }
-#define CATCH_HANDLE(...) catch(...) { ctbDefs::HandleExceptions(__VA_ARGS__); }
-
-class ctbDefs {
- public:
- /**
- * Empty Constructor
- */
- ctbDefs(){};
-
- // convert double seconds to chrono ns
- static std::chrono::nanoseconds ConvertDoubleStoChronoNS(double timeS) {
- using std::chrono::duration;
- using std::chrono::duration_cast;
- using std::chrono::nanoseconds;
- return duration_cast(duration(timeS));
- }
-
- // convert chrono ns to doubel s
- static double ConvertChronoNStoDoubleS(std::chrono::nanoseconds timeNs) {
- using std::chrono::duration;
- using std::chrono::duration_cast;
- return duration_cast>(timeNs).count();
- }
-
- static void DisplayExceptions(std::string emsg, std::string src) {
- try {
- throw;
- } /* catch (const sls::SocketError &e) {
- throw;
- } catch (const sls::SharedMemoryError &e) {
- throw;
- } */catch (const std::exception &e) {
- ExceptionMessage(emsg, e.what(), src);
- }
- };
-
- template struct NonDeduced { using type = CT; };
- template
- static void HandleExceptions(const std::string emsg, const std::string src, S* s,
- RT (S::*somefunc)(CT...),
- typename NonDeduced::type... Args) {
- try {
- throw;
- } /*catch (const sls::SocketError &e) {
- throw;
- } catch (const sls::SharedMemoryError &e) {
- throw;
- } */catch (const std::exception &e) {
-
- ExceptionMessage(emsg, e.what(), src);
- (s->*somefunc)(Args...);
- }
- };
-
- static void ExceptionMessage(std::string message,
- std::string exceptionMessage,
- std::string source) {
- // because sls_detector_exceptions cannot be included
- if (exceptionMessage.find("hared memory") != std::string::npos) {
- throw;
- }
- if (exceptionMessage.find("annot connect") != std::string::npos) {
- 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);
- };
-
-};
diff --git a/ctbGui/ctbGui.cpp b/ctbGui/ctbGui.cpp
deleted file mode 100644
index 5c34d8ee0..000000000
--- a/ctbGui/ctbGui.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "sls/Detector.h"
-#include "sls/sls_detector_defs.h"
-//#include "sls_receiver_defs.h"
-#include "ctbMain.h"
-#include "ctbDefs.h"
-using namespace std;
-
-
-int main(int argc, char **argv) {
-
-
- string afname, cfname, pfname;
- int id=0;
-
- int af=0, cf=0, pf=0;
-
-
- cout << " *** " << argc << endl;
- for (int ia=0; ialoadConfig(cfname);
- cout << "Config file loaded successfully" << endl;
- } else {
- cout << "No config file specified" << endl;
- }
- cout << "hostname " << myDet->getHostname() << endl;
-
- if (pf) {
- myDet->loadParameters(pfname);
- cout << "Loaded parameter file successfully" << endl;
- } else{
- cout << "No parameter file specified" << endl;
- }
- } CATCH_DISPLAY ("Could not create detector/ load config/parameters.", "ctbGui::main")
-
- /***********Create GUI stuff *******************/
- TApplication theApp("App",&argc,argv);
-
-
- gStyle->SetDrawBorder(0);
- gStyle->SetCanvasColor(kWhite);
- gStyle->SetCanvasDefH(800);
- gStyle->SetCanvasDefW(800);
- gStyle->SetCanvasBorderMode(0);
- gStyle->SetPadBorderMode(0);
- gStyle->SetPaintTextFormat("5.2f");
- gStyle->SetLineWidth(2);
- gStyle->SetTextSize(1.1);
- gStyle->SetLabelSize(0.04,"xy");
- gStyle->SetTitleSize(0.05,"xy");
- gStyle->SetTitleOffset(1.0,"x");
- gStyle->SetTitleOffset(1.1,"y");
- gStyle->SetPadTopMargin(0.15);
- gStyle->SetPadRightMargin(0.15);
- gStyle->SetPadBottomMargin(0.15);
- gStyle->SetPadLeftMargin(0.15);
- gStyle->SetLegendBorderSize(1);
- gStyle->SetFrameBorderMode(0);
- gStyle->SetFrameFillColor(kWhite);
- // gStyle->SetLegendFillColor(kWhite);
- gStyle->SetTitleFillColor(kWhite);
- gStyle->SetFillColor(kWhite);
- gStyle->SetStatFontSize(0.03);
- gStyle->SetStatBorderSize(1);
- gStyle->SetStatFormat("6.4g");
- gStyle->SetStatX(0.95);
- gStyle->SetStatY(0.95);
- gStyle->SetStatW(0.2);
- gStyle->SetStatH(0.2);
- gStyle->SetTitleX(0.1);
- gStyle->SetTitleY(0.95);
- gStyle->SetTitleBorderSize(0);
- gStyle->SetTitleFontSize(0.05);
- gROOT->SetStyle("Default");
-
-
- TColor::InitializeColors();
- const Int_t NRGBs = 5;
- const Int_t NCont = 90;
-
- Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
- Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
- Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
- Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
- TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
- gStyle->SetNumberContours(NCont);
-
-
- gROOT->ForceStyle();
- ctbMain *mf=new ctbMain(gClient->GetRoot(), myDet);
-
- cout << " *** " << argc << endl;
- for (int ia=0; ialoadAlias(afname);
- else
- cout << "no alias specified" << endl;
-
- theApp.Run();
-
- return 0;
-}
diff --git a/ctbGui/ctbLinkDef.h b/ctbGui/ctbLinkDef.h
deleted file mode 100644
index f041a01fd..000000000
--- a/ctbGui/ctbLinkDef.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#pragma link C++ class ctbMain;
-#pragma link C++ class ctbDacs;
-#pragma link C++ class ctbDac;
-#pragma link C++ class ctbSignals;
-#pragma link C++ class ctbSignal;
-#pragma link C++ class ctbAdc;
-#pragma link C++ class ctbAdcs;
-#pragma link C++ class ctbLoop;
-#pragma link C++ class ctbWait;
-#pragma link C++ class ctbPattern;
-#pragma link C++ class ctbAcquisition;
-#pragma link C++ class ctbPower;
-#pragma link C++ class ctbPowers;
-#pragma link C++ class ctbSlowAdc;
-#pragma link C++ class ctbSlowAdcs;
diff --git a/ctbGui/ctbMain.cpp b/ctbGui/ctbMain.cpp
deleted file mode 100644
index 0308589bb..000000000
--- a/ctbGui/ctbMain.cpp
+++ /dev/null
@@ -1,588 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-//#include
-//#include
-
-
-
-
-#include
-#include
-#include
-#include
-
-#include "sls/Detector.h"
-#include "ctbDefs.h"
-#include "ctbMain.h"
-#include "ctbDacs.h"
-#include "ctbSlowAdcs.h"
-#include "ctbPowers.h"
-#include "ctbSignals.h"
-#include "ctbPattern.h"
-#include "ctbAdcs.h"
-#include "ctbAcquisition.h"
-//#include "ctbActions.h"
-
-using namespace std;
-
-
-
-ctbMain::ctbMain(const TGWindow *p, sls::Detector *det)
- : TGMainFrame(p,800,800), pwrs(NULL), senses(NULL) {
-
- myDet=det;
-
- Connect("CloseWindow()", "ctbMain", this, "CloseWindow()");
-
-
-
-
-
-// fMenuDock = new TGDockableFrame(this);
-// AddFrame(fMenuDock, new TGLayoutHints(kLHintsExpandX, 0, 0, 1, 0));
-// fMenuDock->SetWindowName("GuiTest Menu");
-
- fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX);
- fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
- fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
-
- fMenuFile = new TGPopupMenu(gClient->GetRoot());
- int im=0;
-
- fMenuFile->AddEntry("Open Alias", im++);
- fMenuFile->AddEntry("Save Alias", im++);
- fMenuFile->AddSeparator();
- fMenuFile->AddEntry("Open Parameters", im++);
- fMenuFile->AddEntry("Save Parameters", im++);
- fMenuFile->AddSeparator();
- fMenuFile->AddEntry("Open Configuration", im++);
- fMenuFile->AddEntry("Save Configuration", im++);
- fMenuFile->AddSeparator();
- fMenuFile->AddEntry("Open Pattern", im++);
- fMenuFile->AddEntry("Save Pattern", im++);
- fMenuFile->AddSeparator();
- fMenuFile->AddEntry("Exit", im++);
-
- fMenuFile->Connect("Activated(Int_t)", "ctbMain", this,
- "HandleMenu(Int_t)");
-
-
- i_dacs=-1;
- i_pwrs=-1;
- i_senses=-1;
- i_sig=-1;
- i_adcs=-1;
- i_pat=-1;
- i_acq=-1;
-
- int i_page=0;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TGVerticalFrame *vframe=new TGVerticalFrame(this, 800,1200); //main frame
-
-
-
- fMenuBar = new TGMenuBar(vframe, 1, 1, kHorizontalFrame);
- fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
-// fMenuBar->AddPopup("&Test", fMenuTest, fMenuBarItemLayout);
-// fMenuBar->AddPopup("&View", fMenuView, fMenuBarItemLayout);
-// fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
-
- vframe->AddFrame(fMenuBar, fMenuBarLayout);
-
- TGHorizontalFrame* hpage=new TGHorizontalFrame(vframe, 800,1200); //horizontal frame. Inside there should be the tab and the canvas
- mtab=new TGTab(hpage, 1500, 1200); //tab!
- // page=new TGVerticalFrame(mtab, 1500,1200);
-
- cout << "DACS" << endl;
-
- TGCompositeFrame *tf = mtab->AddTab("DACs");
- TGVerticalFrame *page=new TGVerticalFrame(tf, 1500,1200);
- tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
- dacs=new ctbDacs(page, myDet);
- i_dacs=i_page++;
-
-
- cout << "power " << endl;
- tf = mtab->AddTab("Power Supplies");
- page=new TGVerticalFrame(tf, 1500,1200);
- tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
- pwrs=new ctbPowers(page, myDet);
-
- i_pwrs=i_page++;
-
- cout << "sense " << endl;
- tf = mtab->AddTab("Sense");
- page=new TGVerticalFrame(tf, 1500,1200);
- tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
- senses=new ctbSlowAdcs(page, myDet);
-
- i_senses=i_page++;
-
-
-
- cout << "signals " << endl;
- tf = mtab->AddTab("Signals");
- page=new TGVerticalFrame(tf, 1500,1200);
- tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
- sig=new ctbSignals(page, myDet);
- sig->Connect("ToggledSignalPlot(Int_t)","ctbMain",this,"setSignalPlot(Int_t)");
-
- i_sig=i_page++;
-
- cout << "adcs " << endl;
- tf = mtab->AddTab("ADCs");
- page=new TGVerticalFrame(tf, 1500,1200);
- tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
- adcs=new ctbAdcs(page, myDet);
- adcs->Connect("ToggledAdcPlot(Int_t)","ctbMain",this,"setADCPlot(Int_t)");
- adcs->Connect("AdcEnable(Int_t)","ctbMain",this,"setADCEnable(Int_t)");
- i_adcs=i_page++;
-
-
- cout << "pattern" << endl;
-
- tf = mtab->AddTab("Pattern");
- page=new TGVerticalFrame(tf, 1500,1200);
- tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
- pat=new ctbPattern(page, myDet);
- pat->Connect("patternFileChanged(const char*)","ctbMain",this,"setPatternFile(const char*)");
- pat->Connect("patternCompilerChanged(const char*)","ctbMain",this,"setPatternCompiler(const char*)");
- pat->Connect("analogSamplesChanged(const int)","ctbMain",this,"setAnalogSamples(int)");
- pat->Connect("digitalSamplesChanged(const int)","ctbMain",this,"setDigitalSamples(int)");
- pat->Connect("readoutModeChanged(int)","ctbMain",this,"setReadoutMode(int)");
-
- i_pat=i_page++;
-
- cout << "acquisition" << endl;
-
- tf = mtab->AddTab("Acquisition");
- page=new TGVerticalFrame(tf, 1500,1200);
- tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
- acq=new ctbAcquisition(page, myDet);
-
-
- i_acq=i_page++;
-
-
- // cout << "actions" << endl;
- // tf = mtab->AddTab("Actions");
- // page=new TGVerticalFrame(tf, 1500,1200);
- // tf->AddFrame(page, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
- // actions=new ctbActions(page, myDet);
-
-
- // i_actions=i_page++;
-
-
-
- cout << "tabs finished" << endl;
-
- hpage->AddFrame(mtab,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
-
- vframe->AddFrame(hpage,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
-
- AddFrame(vframe,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));
- vframe->MapWindow();
- hpage->MapWindow();
- mtab->MapWindow();
- page->MapWindow();
-
- // Sets window name and shows the main frame
- cout << "dockabel" << endl;
- TGDockableFrame *fdock=new TGDockableFrame(hpage);
- hpage->AddFrame(fdock, new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX | kLHintsExpandY, 10,10,10,10));
- fdock->MapWindow();
-
- cout << "canvas" << endl;
-// // Creates widgets of the example
-
-
- fEcanvas = new TRootEmbeddedCanvas ("Ecanvas",fdock,800,800);//hpage,800,800);
- //fEcanvas = new TRootEmbeddedCanvas ("Ecanvas",this,800,800);//hpage,800,800);
- // fEcanvas->Resize();
- // fEcanvas->GetCanvas()->Update();
- //AddFrame(fEcanvas, new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX | kLHintsExpandY, 10,10,10,10));
-
- // // hpage->
- fdock->AddFrame(fEcanvas, new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX | kLHintsExpandY, 10,10,10,10));
-
-
- fEcanvas->MapWindow();
-
- acq->setCanvas(getCanvas());
-
-
-
- hpage->MapSubwindows();
- mtab->Connect("Selected(Int_t)","ctbMain",this,"tabSelected(Int_t)");
-
-
-
- cout << "connect mtab" << endl;
-
- try{
- setReadoutMode(pat->getReadoutMode());
- } CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
-
- setADCEnable(adcs->setEnable());
- setAnalogSamples(pat->getAnalogSamples());
- setDigitalSamples(pat->getDigitalSamples());
-
- tabSelected(0);
-
- SetWindowName("CTB Gui");
- MapSubwindows();
- Resize(1500,1200);
-
- MapWindow();
-}
-
-void ctbMain::CloseWindow() {
- gApplication->Terminate();
-}
-
-TCanvas* ctbMain::getCanvas() {
- return fEcanvas->GetCanvas();
-}
-
-
-
-void ctbMain::HandleMenu(Int_t id)
-{
- // Handle menu items.
-
-
-
-
- switch (id) {
-
- case 0: // fMenuFile->AddEntry("Open Alias", im++);
- cout << "Open Alias" << endl;
- {
- static TString dir(".");
- TGFileInfo fi;
- //fi.fFileTypes = filetypes;
- fi.fIniDir = StrDup(dir);
- printf("fIniDir = %s\n", fi.fIniDir);
- new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
- printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
- // dir = fi.fIniDir;
- if (fi.fFilename)
- loadAlias(fi.fFilename);
- }
- break;
-
- case 1: // fMenuFile->AddEntry("Save Alias", im++);
- cout << "Save Alias" << endl;
- {
- static TString dir(".");
- TGFileInfo fi;
- //fi.fFileTypes = filetypes;
- fi.fIniDir = StrDup(dir);
- printf("fIniDir = %s\n", fi.fIniDir);
- new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
- printf("Save file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
- // dir = fi.fIniDir;
- if (fi.fFilename)
- saveAlias(fi.fFilename);
- }
- break;
- case 2: //fMenuFile->AddEntry("Open Parameters", im++);
- cout << "Open Parameters" << endl;
- {
- static TString dir(".");
- TGFileInfo fi;
- //fi.fFileTypes = filetypes;
- fi.fIniDir = StrDup(dir);
- printf("fIniDir = %s\n", fi.fIniDir);
- new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
- printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
- // dir = fi.fIniDir;
- if (fi.fFilename)
- loadParameters(fi.fFilename);
- }
- break;
-
- case 3: // fMenuFile->AddEntry("Open Configuration", im++);
- cout << "Open configuration" << endl;
- {
- static TString dir(".");
- TGFileInfo fi;
- //fi.fFileTypes = filetypes;
- fi.fIniDir = StrDup(dir);
- printf("fIniDir = %s\n", fi.fIniDir);
- new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
- printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
- // dir = fi.fIniDir;
- if (fi.fFilename)
- loadConfiguration(fi.fFilename);
- }
- break;
-
- case 4: //fMenuFile->AddEntry("Open Pattern", im++);
- cout << "Open pattern" << endl;
- {
- static TString dir(".");
- TGFileInfo fi;
- //fi.fFileTypes = filetypes;
- fi.fIniDir = StrDup(dir);
- printf("fIniDir = %s\n", fi.fIniDir);
- new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
- printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
- // dir = fi.fIniDir;
- if (fi.fFilename)
- loadParameters(fi.fFilename);
- }
- break;
-
- case 5: //fMenuFile->AddEntry("Save Pattern", im++);
- cout << "Save pattern" << endl;
- {
- static TString dir(".");
- TGFileInfo fi;
- //fi.fFileTypes = filetypes;
- fi.fIniDir = StrDup(dir);
- printf("fIniDir = %s\n", fi.fIniDir);
- new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
- printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
- // dir = fi.fIniDir;
- if (fi.fFilename)
- savePattern(fi.fFilename);
- }
- break;
-
- case 6: // fMenuFile->AddEntry("Exit", im++);
- CloseWindow();
-
- default:
- printf("Menu item %d selected\n", id);
- break;
- }
-}
-
-
-
-int ctbMain::setADCPlot(Int_t i) {
-
- // cout << "ADC " << i << " plot or color toggled" << endl;
- // acq->setGraph(i,adcs->getGraph(i));
- acq->setGraph(i,adcs->getEnabled(i),adcs->getColor(i));
- return -1;
-}
-
-
-int ctbMain::setSignalPlot(Int_t i) {
-
- // cout << "ADC " << i << " plot or color toggled" << endl;
- // acq->setGraph(i,adcs->getGraph(i));
- acq->setBitGraph(i,sig->getPlot(i),sig->getColor(i));
- return -1;
-}
-
-
-
-void ctbMain::loadConfiguration(string fname) {
- try{
- myDet->loadConfig(fname);
- } CATCH_DISPLAY ("Could not load config.", "ctbMain::loadConfiguration")
-}
-
-void ctbMain::loadParameters(string fname) {
- try{
- myDet->loadParameters(fname);
- } CATCH_DISPLAY ("Could not load parameters.", "ctbMain::loadParameters")
-}
-
-void ctbMain::savePattern(string fname) {
- try{
- myDet->savePattern(fname);
- } CATCH_DISPLAY ("Could not save pattern.", "ctbMain::savePattern")
-}
-
-
-
-int ctbMain::loadAlias(string fname) {
-
-
- string line;
- char aaaa[1000];
- int i;
- ifstream myfile (fname.c_str());
- if (myfile.is_open())
- {
- while ( getline (myfile,line) )
- {
- // cout << line ;
- if (sscanf(line.c_str(),"BIT%d",&i)>0) {
- //cout << "*******" << line<< endl;
- sig->setSignalAlias(line);
- // cout << line ;
- } else if (sscanf(line.c_str(),"DAC%d",&i)>0) {
- dacs->setDacAlias(line);
- // cout << "+++++++++" << line<< endl;
- } else if (sscanf(line.c_str(),"ADC%d",&i)>0) {
- adcs->setAdcAlias(line);
- // cout << "---------" << line<< endl;
- } // else
- // cout << "<<<<<<<" << line << endl;
- else if (sscanf(line.c_str(),"PAT%s",aaaa)>0) {
- pat->setPatternAlias(line);
- // cout << "---------" << line<< endl;
- } else if (sscanf(line.c_str(),"V%s",aaaa)>0) {
- if (pwrs) pwrs->setPwrAlias(line);
- // cout << "+++++++++" << line<< endl;
- } else if (sscanf(line.c_str(),"SENSE%d",&i)>0) {
- if (senses) senses->setSlowAdcAlias(line);
- // cout << "+++++++++" << line<< endl;
- }
-
- }
- myfile.close();
- }
-
- else cout << "Unable to open file";
-
- return 0;
-
-}
-
-
-
-
-
-int ctbMain::saveAlias(string fname) {
-
-
- string line;
- ofstream myfile (fname.c_str());
- if (myfile.is_open())
- {
- //while ( getline (myfile,line) )
- // {
- // cout << line ;
- //if (sscanf(line.c_str(),"BIT%d",&i)>0) {
- //cout << "*******" << line<< endl;
- myfile << sig->getSignalAlias();
- // cout << line ;
- // } else if (sscanf(line.c_str(),"DAC%d",&i)>0) {
- myfile << dacs->getDacAlias();
- if (pwrs) myfile << pwrs->getPwrAlias();
- if (senses) myfile << senses->getSlowAdcAlias();
- // cout << "+++++++++" << line<< endl;
- // } else if (sscanf(line.c_str(),"ADC%d",&i)>0) {
- myfile << adcs->getAdcAlias();
- // cout << "---------" << line<< endl;
- // } // else
- // cout << "<<<<<<<" << line << endl;
- myfile << pat->getPatternAlias();
-
- //}
- myfile.close();
- }
-
- else cout << "Unable to open file";
-
- return 0;
-
-}
-
-
-
-
-
-
-
-
-
-
-
-void ctbMain::tabSelected(Int_t i) {
-
- // cout << "Selected tab " << i << endl;
- // cout << "Current tab is " << mtab->GetCurrent() << endl;
-
- if (i==i_dacs) dacs->update();
- else if (i==i_pwrs) pwrs->update();
- else if (i==i_senses) ;//senses->update();
- else if (i==i_sig) sig->update();
- else if (i==i_adcs) adcs->update();
- else if (i==i_pat) pat->update();
- else if (i==i_acq) acq->update();
- else if (i==i_acq) acq->update();
- // else if (i==i_actions) actions->update();
- else cout << "Unknown tab " << i << endl;
-
-
-}
-
-void ctbMain::setPatternFile(const char* t) {
- acq->setPatternFile(t);
-
-}
-
-void ctbMain::setPatternCompiler(const char* t) {
- acq->setPatternCompiler(t);
-
-
-}
-
-void ctbMain::setAnalogSamples(const int n) {
- acq->setAnalogSamples(n);
-
-
-}
-
-void ctbMain::setDigitalSamples(const int n) {
- acq->setDigitalSamples(n);
-
-
-}
-
-void ctbMain::setReadoutMode(int flags) {
- acq->setReadoutMode(flags);
-}
-
-void ctbMain::setADCEnable(Int_t reg){
- acq->setADCEnable(reg);
-}
diff --git a/ctbGui/ctbMain.h b/ctbGui/ctbMain.h
deleted file mode 100644
index 34ff8d429..000000000
--- a/ctbGui/ctbMain.h
+++ /dev/null
@@ -1,130 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#ifndef CTBMAIN_H
-#define CTBMAIN_H
-#include
-
-
-class TRootEmbeddedCanvas;
-class TGButtonGroup;
-class TGVerticalFrame;
-class TGHorizontalFrame;
-class TGTextEntry;
-class TGLabel;
-class TGNumberEntry;
-class TH2F;
-class TGComboBox;
-class TGCheckButton;
-
-class THStack;
-class TGraphErrors;
-class TGTextButton;
-class TGTab;
-
-class TGMenuBar;
-class TGPopupMenu;
-class TGDockableFrame;
-class TGLayoutHints;
-class TGCanvas;
-class TCanvas;
-
-class ctbDacs;
-class ctbSlowAdcs;
-class ctbPowers;
-
-
-class ctbSignals;
-
-namespace sls
-{
- class Detector;
-};
-
-class ctbPattern;
-class ctbAdcs;
-class ctbAcquisition;
-//class ctbActions;
-
-#include
-using namespace std;
-
-class ctbMain : public TGMainFrame {
-private:
-
-
- sls::Detector *myDet;
-
-
-
- TRootEmbeddedCanvas *fEcanvas;
- TRootEmbeddedCanvas *fModulecanvas;
- TGButtonGroup *br;
-
- TGTab *mtab;
-
-
- ctbDacs *dacs;
- int i_dacs;
-
- ctbPowers *pwrs;
- int i_pwrs;
-
- ctbSlowAdcs *senses;
- int i_senses;
-
-
- ctbSignals *sig;
- int i_sig;
-
-
- ctbAdcs *adcs;
- int i_adcs;
-
-
- ctbPattern *pat;
- int i_pat;
-
- ctbAcquisition *acq;
- int i_acq;
-
- // ctbActions *actions;
- int i_actions;
-
- TGDockableFrame *fMenuDock;
-
- TGMenuBar *fMenuBar;
- TGPopupMenu *fMenuFile, *fMenuTest, *fMenuView, *fMenuHelp;
- TGPopupMenu *fCascadeMenu, *fCascade1Menu, *fCascade2Menu;
- TGPopupMenu *fMenuNew1, *fMenuNew2;
- TGLayoutHints *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout;
- TGCanvas *myCanvas;
-
-
-public:
- ctbMain(const TGWindow *p, sls::Detector *det);
-
-
- int loadAlias(string fname);
- int saveAlias(string fname);
- void loadParameters(string fname);
- void savePattern(string fname);
- void loadConfiguration(string fname);
- void tabSelected(Int_t);
- int setADCPlot(Int_t);
- int setSignalPlot(Int_t);
- void CloseWindow();
-
- void setPatternFile(const char* t);
-
- void setPatternCompiler(const char* t);
- void setAnalogSamples(const int);
- void setDigitalSamples(const int);
- void setReadoutMode(int);
- void setADCEnable(Int_t);
-
- void HandleMenu(Int_t);
- TCanvas* getCanvas();
- ClassDef(ctbMain,0)
-};
-
-#endif
diff --git a/ctbGui/ctbPattern.cpp b/ctbGui/ctbPattern.cpp
deleted file mode 100644
index 5d3d49a5e..000000000
--- a/ctbGui/ctbPattern.cpp
+++ /dev/null
@@ -1,1111 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "ctbPattern.h"
-#include "ctbDefs.h"
-#include "sls/Detector.h"
-#include
-using namespace std;
-
-
-
-
-
-ctbLoop::ctbLoop(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
-
- TGHorizontalFrame *hframe=this;
-
- char tit[100];
-
- page->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- MapWindow();
-
-
-
-
-
- sprintf(tit, "Loop %d Repetitions: ", id);
-
- TGLabel *label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eLoopNumber = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELNoLimits);
- hframe->AddFrame( eLoopNumber,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eLoopNumber->MapWindow();
- eLoopNumber->Resize(150,30);
- TGTextEntry *e= eLoopNumber->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbLoop",this,"setNLoops()");
-
-
-
-
- sprintf(tit, "Start Address: ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eLoopStartAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 1024);
- hframe->AddFrame( eLoopStartAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eLoopStartAddr->MapWindow();
- eLoopStartAddr->Resize(150,30);
-
- // eLoopStartAddr->SetState(kFALSE);
-
- label= new TGLabel(hframe, "Stop Address: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
-
- eLoopStopAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 1024);
- hframe->AddFrame( eLoopStopAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eLoopStopAddr->MapWindow();
- eLoopStopAddr->Resize(150,30);
-
-
-
- // eLoopStopAddr->SetState(kFALSE);
-
-
-
-
-
-
-}
-
-void ctbLoop::setNLoops() {
- try{
- myDet->setPatternLoopCycles(id, eLoopNumber->GetNumber());
- } CATCH_DISPLAY ("Could not set number of pattern loops for level " + to_string(id) + ".", "ctbLoop::setNLoops")
-}
-
-
-
-void ctbLoop::update() {
- try{
-
- auto loop = myDet->getPatternLoopCycles(id).tsquash("Different values");
- eLoopNumber->SetNumber(loop);
- auto loopaddr = myDet->getPatternLoopAddresses(id).tsquash("Different values");
- eLoopStartAddr->SetHexNumber(loopaddr[0]);
- eLoopStopAddr->SetHexNumber(loopaddr[1]);
-
-
- } CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbLoop::update")
-}
-
-
-
-ctbWait::ctbWait(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
-
- char tit[100];
- TGHorizontalFrame *hframe=this;
- page->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- MapWindow();
-
-
-
- sprintf(tit, "Wait %d (run clk): ", id);
-
- TGLabel *label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eWaitTime = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELNoLimits);
- hframe->AddFrame( eWaitTime,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eWaitTime->MapWindow();
- eWaitTime->Resize(150,30);
- TGTextEntry *e= eWaitTime->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbWait",this,"setWaitTime()");
-
-
-
- sprintf(tit, "Wait Address: ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eWaitAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 1024);
- hframe->AddFrame( eWaitAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eWaitAddr->MapWindow();
- eWaitAddr->Resize(150,30);
-
- // eWaitAddr->SetState(kFALSE);
-
-}
-
-
-
-void ctbWait::setWaitTime() {
- try{
-
- myDet->setPatternWaitTime(id, eWaitTime->GetNumber());
-
- } CATCH_DISPLAY ("Could not set pattern wait time for level " + to_string(id) + ".", "ctbWait::setWaitTime")
-}
-
-
-
-void ctbWait::update() {
- try{
-
- auto time = myDet->getPatternWaitTime(id).tsquash("Different values");
- auto addr = myDet->getPatternWaitAddr(id).tsquash("Different values");
-
- eWaitAddr->SetHexNumber(addr);
- eWaitTime->SetNumber(time);
-
- } CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbWait::update")
-}
-
-
-
-
-
-
-
-
-
-ctbPattern::ctbPattern(TGVerticalFrame *page, sls::Detector *det)
- : TGGroupFrame(page,"Pattern",kVerticalFrame), myDet(det) {
-
-
- SetTitlePos(TGGroupFrame::kLeft);
- page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
- MapWindow();
-
-
- char tit[100];
-
-
- TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- sprintf(tit, "Run Clock Frequency (MHz): ");
-
- TGLabel *label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eRunClkFreq = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 400);
- hframe->AddFrame( eRunClkFreq,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eRunClkFreq->MapWindow();
- eRunClkFreq->Resize(150,30);
- TGTextEntry *e= eRunClkFreq->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setRunFreq()");
-
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
-
-
- sprintf(tit, "ADC Clock Frequency (MHz): ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eAdcClkFreq = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 40);
- hframe->AddFrame( eAdcClkFreq,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eAdcClkFreq->MapWindow();
- eAdcClkFreq->Resize(150,30);
- e= eAdcClkFreq->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setAdcFreq()");
-
-
-
-
- sprintf(tit, "DBIT Clock Frequency (MHz): ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eDBitClkFreq = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 400);
- hframe->AddFrame( eDBitClkFreq,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eDBitClkFreq->MapWindow();
- eDBitClkFreq->Resize(150,30);
- e= eDBitClkFreq->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setDBitFreq()");
-
-
-
-
-
-
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
-
-
- label= new TGLabel(hframe, "ADC Clock Phase (a.u.): ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
-
- eAdcClkPhase = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEAAnyNumber,
- TGNumberFormat::kNELLimitMinMax,
- -255, 255);
- hframe->AddFrame( eAdcClkPhase,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eAdcClkPhase->MapWindow();
- eAdcClkPhase->Resize(150,30);
- e= eAdcClkPhase->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setAdcPhase()");
-
-
-
-
- label= new TGLabel(hframe, "DBit Clock Phase (a.u.): ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
-
- eDBitClkPhase = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEAAnyNumber,
- TGNumberFormat::kNELLimitMinMax,
- -255, 255);
- hframe->AddFrame( eDBitClkPhase,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eDBitClkPhase->MapWindow();
- eDBitClkPhase->Resize(150,30);
- e= eDBitClkPhase->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setDBitPhase()");
-
-
-// label= new TGLabel(hframe, " Phase (0.15ns step): ");
-// hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
-// label->MapWindow();
-// label->SetTextJustify(kTextLeft);
-
-
-
-
-
-// eRunClkPhase = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
-// TGNumberFormat::kNEANonNegative,
-// TGNumberFormat::kNELLimitMinMax,
-// 0, 200);
-// hframe->AddFrame( eRunClkPhase,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
-// eRunClkPhase->MapWindow();
-// eRunClkPhase->Resize(150,30);
-// e= eRunClkPhase->TGNumberEntry::GetNumberEntry();
-// e->Connect("ReturnPressed()","ctbPattern",this,"setRunPhase()");
-
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
-
-
- label= new TGLabel(hframe, "Adc pipeline: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
-
- eAdcPipeline = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 64);
- hframe->AddFrame( eAdcPipeline,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eAdcPipeline->MapWindow();
- eAdcPipeline->Resize(150,30);
- e= eAdcPipeline->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setAdcPipeline()");
-
-
-
-
-
-
- label= new TGLabel(hframe, "DBIT pipeline: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
-
- eDBitPipeline = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 64);
- hframe->AddFrame( eDBitPipeline,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eDBitPipeline->MapWindow();
- eDBitPipeline->Resize(150,30);
- e= eDBitPipeline->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setDBitPipeline()");
-
-
-
-
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- sprintf(tit, "Number of triggers: ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eTriggers = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELNoLimits);
- hframe->AddFrame( eTriggers,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eTriggers->MapWindow();
- eTriggers->Resize(150,30);
- e= eTriggers->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setTriggers()");
-
-
- // sprintf(tit, "Number of measurements: ");
-
- // label= new TGLabel(hframe, tit);
- // hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- // label->MapWindow();
- // label->SetTextJustify(kTextLeft);
-
-
-
-
- // eMeasurements = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- // TGNumberFormat::kNEANonNegative,
- // TGNumberFormat::kNELNoLimits);
- // hframe->AddFrame( eMeasurements,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- // eMeasurements->MapWindow();
- // eMeasurements->Resize(150,30);
- // e= eMeasurements->TGNumberEntry::GetNumberEntry();
- // e->Connect("ReturnPressed()","ctbPattern",this,"setMeasurements()");
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- sprintf(tit, "Number of frames: ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eFrames = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELNoLimits);
- hframe->AddFrame( eFrames,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eFrames->MapWindow();
- eFrames->Resize(150,30);
- e= eFrames->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setFrames()");
-
-
- label= new TGLabel(hframe, " Period (s): ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
-
- ePeriod = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESReal,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELNoLimits);
- hframe->AddFrame( ePeriod,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- ePeriod->MapWindow();
- ePeriod->Resize(150,30);
- e= ePeriod->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setPeriod()");
-
-
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- sprintf(tit, "Start Address: ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- eStartAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 1024);
- hframe->AddFrame( eStartAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eStartAddr->MapWindow();
- eStartAddr->Resize(150,30);
-
- eStartAddr->SetState(kFALSE);
-
- label= new TGLabel(hframe, "Stop Address: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
-
- eStopAddr = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESHex,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 0, 1024);
- hframe->AddFrame( eStopAddr,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eStopAddr->MapWindow();
- eStopAddr->Resize(150,30);
-
-
-
-
- eStopAddr->SetState(kFALSE);
-
-
-
-
-
-
- int idac=0;
- for (idac=0; idacMapWindow();
-
-
-
- label= new TGLabel(hframe, "Compiler: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
-
- patternCompiler=new TGTextEntry(hframe,"generate.sh");
- hframe->AddFrame(patternCompiler,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- patternCompiler->MapWindow();
- // patternCompiler->SetTextJustify(kTextLeft);
- patternCompiler->Connect("ReturnPressed()","ctbPattern",this,"setCompiler()");
-
-
- browseCompiler=new TGTextButton(hframe,"Browse");
- hframe->AddFrame(browseCompiler,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- browseCompiler->MapWindow();
- // patternCompiler->SetTextJustify(kTextLeft);
- browseCompiler->Connect("Clicked()","ctbPattern",this,"chooseCompiler()");
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- label= new TGLabel(hframe, "Pattern: ");
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
- patternFile=new TGTextEntry(hframe,"file.p");
- hframe->AddFrame(patternFile,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- patternFile->MapWindow();
- patternFile->Connect("ReturnPressed()","ctbPattern",this,"setFile()");
- // patternFile->SetTextJustify(kTextLeft);
-
-
-
- browseFile=new TGTextButton(hframe,"Browse");
- hframe->AddFrame(browseFile,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- browseFile->MapWindow();
- // patternCompiler->SetTextJustify(kTextLeft);
- browseFile->Connect("Clicked()","ctbPattern",this,"choosePattern()");
-
-
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- sprintf(tit, "Samples per frame - ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
- sprintf(tit, "Analog: ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
- eAnalogSamples = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 1, 8192);
- hframe->AddFrame( eAnalogSamples,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eAnalogSamples->MapWindow();
- eAnalogSamples->Resize(150,30);
- e= eAnalogSamples->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setAnalogSamples()");
-
- sprintf(tit, "Digital: ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
-
- eDigitalSamples = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
- TGNumberFormat::kNEANonNegative,
- TGNumberFormat::kNELLimitMinMax,
- 1, 8192);
- hframe->AddFrame( eDigitalSamples,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
- eDigitalSamples->MapWindow();
- eDigitalSamples->Resize(150,30);
- e= eDigitalSamples->TGNumberEntry::GetNumberEntry();
- e->Connect("ReturnPressed()","ctbPattern",this,"setDigitalSamples()");
-
-
- hframe=new TGHorizontalFrame(this, 800,800);
- AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
- hframe->MapWindow();
-
-
- sprintf(tit, "Read Out Mode: ");
-
- label= new TGLabel(hframe, tit);
- hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
- label->MapWindow();
- label->SetTextJustify(kTextLeft);
-
-
- cbAnalog= new TGCheckButton(hframe, "Analog");
- hframe->AddFrame(cbAnalog,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
- cbAnalog->MapWindow();
- cbAnalog->SetTextJustify(kTextRight);
- cbAnalog->Connect("Toggled(Bool_t)","ctbPattern",this,"setReadoutMode(Bool_t)");
-
- cbDigital= new TGCheckButton(hframe, "Digital");
- hframe->AddFrame(cbDigital,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5));
- cbDigital->MapWindow();
- cbDigital->SetTextJustify(kTextRight);
- cbDigital->Connect("Toggled(Bool_t)","ctbPattern",this,"setReadoutMode(Bool_t)");
-
-
-
-
-}
-
-void ctbPattern::update() {
- try{
- auto retval = myDet->getRUNClock().tsquash("Different values");
- eRunClkFreq->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get run clock.", "ctbPattern::update")
-
- try{
- auto retval = myDet->getADCClock().tsquash("Different values");
- eAdcClkFreq->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get adc clock.", "ctbPattern::update")
-
- try{
- auto retval = myDet->getADCPhase().tsquash("Different values");
- eAdcClkPhase->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get adc phase shift.", "ctbPattern::update")
-
- try{
- auto retval = myDet->getADCPipeline().tsquash("Different values");
- eAdcPipeline->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get adc pipeline.", "ctbPattern::update")
-
- try{
- auto retval = myDet->getDBITClock().tsquash("Different values");
- eDBitClkFreq->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get dbit clock.", "ctbPattern::update")
-
- try{
- auto retval = myDet->getDBITPhase().tsquash("Different values");
- eDBitClkPhase->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
-
- try{
- auto retval = myDet->getDBITPipeline().tsquash("Different values");
- eDBitPipeline->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get dbit pipeline.", "ctbPattern::update")
-
- try{
- auto retval = myDet->getNumberOfFrames().tsquash("Different values");
- eFrames->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get number of frames.", "ctbPattern::update")
-
- try{
- auto timeNs = myDet->getPeriod().tsquash("Different values");
- ePeriod->SetNumber(ctbDefs::ConvertChronoNStoDoubleS(timeNs));
- } CATCH_DISPLAY ("Could not get period.", "ctbPattern::update")
-
- try{
- auto retval = myDet->getNumberOfTriggers().tsquash("Different values");
- eTriggers->SetNumber(retval);
- } CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
-
- try{
- auto retval = myDet->getPatternLoopAddresses(-1).tsquash("Different values");
- eStartAddr->SetHexNumber(retval[0]);
- eStopAddr->SetHexNumber(retval[1]);
- } CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
-
- for (int iloop=0; iloopupdate();
- }
-
- for (int iwait=0; iwaitupdate();
- }
-
- getAnalogSamples();
- getDigitalSamples();
- getReadoutMode();
-}
-
-
-void ctbPattern::setFile() {
- patternFileChanged(patternFile->GetText());
-
-}
-
-
-void ctbPattern::setCompiler() {
- patternCompilerChanged(patternCompiler->GetText());
-}
-
-
-void ctbPattern::patternFileChanged(const char* t){
- Emit("patternFileChanged(const char*)", t);
-}
-
-
-void ctbPattern::patternCompilerChanged(const char* t){
- Emit("patternCompilerChanged(const char*)", t);
-
-}
-
-
-void ctbPattern::setPatternAlias(string line){
- char fname[10000];
- if (sscanf(line.c_str(),"PATCOMPILER %s",fname)) {
- patternCompiler->SetText(fname);
- patternCompilerChanged(patternCompiler->GetText());
- } else if (sscanf(line.c_str(),"PATFILE %s",fname)) {
- patternFile->SetText(fname);
- patternFileChanged(patternFile->GetText());
- }
-}
-
-
-string ctbPattern::getPatternAlias() {
- char line[100000];
- sprintf(line, "PATCOMPILER %s\nPATFILE %s\n",patternCompiler->GetText(),patternFile->GetText());
- return line;
-}
-
-
-void ctbPattern::chooseCompiler() {
- static TString dir(".");
- TGFileInfo fi;
- //fi.fFileTypes = filetypes;
- fi.fIniDir = StrDup(dir);
- printf("fIniDir = %s\n", fi.fIniDir);
- new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
- printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
- // dir = fi.fIniDir;
- if (fi.fFilename) {
- patternCompiler->SetText(fi.fFilename);
- patternCompilerChanged(patternCompiler->GetText());
- }
-}
-
-
-void ctbPattern::choosePattern() {
- static TString dir(".");
- TGFileInfo fi;
- //fi.fFileTypes = filetypes;
- fi.fIniDir = StrDup(dir);
- printf("fIniDir = %s\n", fi.fIniDir);
- new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
- printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
- // dir = fi.fIniDir;
- if (fi.fFilename) {
- patternFile->SetText(fi.fFilename);
- patternFileChanged(patternFile->GetText());
- }
-
-}
-
-
-string ctbPattern::getCompiler() {
- return string(patternCompiler->GetText());
-
-}
-
-string ctbPattern::getPatternFile() {
- return string(patternFile->GetText());
-
-}
-
-void ctbPattern::setFrames() {
- try{
- myDet->setNumberOfFrames(eFrames->GetNumber());
- } CATCH_DISPLAY ("Could not set number of frames", "ctbPattern::setFrames")
-}
-
-void ctbPattern::setTriggers() {
- try{
- myDet->setNumberOfTriggers(eTriggers->GetNumber());
- } CATCH_DISPLAY ("Could not set number of triggers", "ctbPattern::setTriggers")
-}
-
-void ctbPattern::setPeriod() {
- using std::chrono::duration;
- using std::chrono::duration_cast;
- using std::chrono::nanoseconds;
- try{
- auto timeNs = ctbDefs::ConvertDoubleStoChronoNS(ePeriod->GetNumber());
- myDet->setPeriod(timeNs);
- } CATCH_DISPLAY ("Could not set period", "ctbPattern::setPeriod")
-}
-
-void ctbPattern::setAdcFreq() {
- try{
- myDet->setADCClock(eAdcClkFreq->GetNumber());
- } CATCH_DISPLAY ("Could not set adc clock", "ctbPattern::setAdcFreq")
-}
-
-void ctbPattern::setRunFreq() {
- try{
- myDet->setRUNClock(eRunClkFreq->GetNumber());
- } CATCH_DISPLAY ("Could not set run clock", "ctbPattern::setRunFreq")
-}
-
-void ctbPattern::setDBitFreq() {
- try{
- myDet->setDBITClock(eDBitClkFreq->GetNumber());
- } CATCH_DISPLAY ("Could not set dbit clock", "ctbPattern::setDBitFreq")
-}
-
-void ctbPattern::setAdcPhase() {
- try{
- myDet->setADCPhase(eAdcClkPhase->GetNumber());
- } CATCH_DISPLAY ("Could not set adc phase shift", "ctbPattern::setAdcPhase")
-}
-
-void ctbPattern::setDBitPhase() {
- try{
- myDet->setDBITPhase(eDBitClkPhase->GetNumber());
- } CATCH_DISPLAY ("Could not set dbit phase shift", "ctbPattern::setDBitPhase")
-}
-
-void ctbPattern::setAdcPipeline() {
- try{
- myDet->setADCPipeline(eAdcPipeline->GetNumber());
- } CATCH_DISPLAY ("Could not set adc pipeline", "ctbPattern::setAdcPipeline")
-}
-
-void ctbPattern::setDBitPipeline() {
- try{
- myDet->setDBITPipeline(eDBitPipeline->GetNumber());
- } CATCH_DISPLAY ("Could not set dbit pipeline", "ctbPattern::setDBitPipeline")
-}
-
-
-void ctbPattern::setAnalogSamples() {
- try{
- myDet->setNumberOfAnalogSamples(eAnalogSamples->GetNumber());
- } CATCH_DISPLAY ("Could not set number of analog sampels", "ctbPattern::setAnalogSamples")
-
- analogSamplesChanged(eAnalogSamples->GetNumber());
-}
-
-void ctbPattern::setDigitalSamples() {
- try{
- myDet->setNumberOfDigitalSamples(eDigitalSamples->GetNumber());
- } CATCH_DISPLAY ("Could not set number of digital samples", "ctbPattern::setDigitalSamples")
-
- digitalSamplesChanged(eDigitalSamples->GetNumber());
-}
-
-void ctbPattern::setReadoutMode(Bool_t) {
- try {
- slsDetectorDefs::readoutMode flag = slsDetectorDefs::ANALOG_ONLY;
- if (cbAnalog->IsOn() && cbDigital->IsOn())
- flag=slsDetectorDefs::ANALOG_AND_DIGITAL;
- else if (~cbAnalog->IsOn() && cbDigital->IsOn())
- flag=slsDetectorDefs::DIGITAL_ONLY;
- else if (cbAnalog->IsOn() && ~cbDigital->IsOn())
- flag=slsDetectorDefs::ANALOG_ONLY;
- else {
- throw runtime_error("unkown readout flag");
- }
- myDet->setReadoutMode(flag);
- cout << "Set readout flag: " << flag << endl;
- } CATCH_DISPLAY ("Could not set readout flag", "ctbPattern::setReadoutMode")
-
- getReadoutMode();
-}
-
-void ctbPattern::readoutModeChanged(int flags) {
- Emit("readoutModeChanged(Int_t)",(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);
- }
-
- Emit("readoutModeChanged(int)",static_cast(retval));
- return retval;
-
-
-}
-
-int ctbPattern::getAnalogSamples() {
- try{
- auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
- eAnalogSamples->SetNumber((Double_t)retval);
- Emit("analogSamplesChanged(const int)", eAnalogSamples->GetNumber());
- return eAnalogSamples->GetNumber();
- } CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
-
- 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();
-
-
- return -1;
-}
-
-
-void ctbPattern::analogSamplesChanged(const int t){
- Emit("analogSamplesChanged(const int)", t);
-}
-
-void ctbPattern::digitalSamplesChanged(const int t){
- Emit("digitalSamplesChanged(const int)", t);
-}
diff --git a/ctbGui/ctbPattern.h b/ctbGui/ctbPattern.h
deleted file mode 100644
index 6f85974a1..000000000
--- a/ctbGui/ctbPattern.h
+++ /dev/null
@@ -1,181 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#ifndef CTBPATTERN_H
-#define CTBPATTERN_H
-#include
-
-
-#define NLOOPS 3
-#define NWAITS 3
-#define NADCS 32
-#define PATLEN 1024
-
-class TRootEmbeddedCanvas;
-class TGButtonGroup;
-class TGVerticalFrame;
-class TGHorizontalFrame;
-class TGTextEntry;
-class TGLabel;
-class TGNumberEntry;
-class TH2F;
-class TGComboBox;
-class TGCheckButton;
-class TGTextEntry;
-class TGCheckButton;
-
-class THStack;
-class TGraphErrors;
-class energyCalibration;
-class TGTextButton;
-class TGTab;
-
-namespace sls
-{
- class Detector;
-};
-
-
-#include
-using namespace std;
-
-
-
-class ctbLoop : public TGHorizontalFrame {
-
-
- private:
-
- TGNumberEntry *eLoopStartAddr;
- TGNumberEntry *eLoopStopAddr;
- TGNumberEntry *eLoopNumber;
-
- int id;
-
- sls::Detector *myDet;
-
- public:
- ctbLoop(TGGroupFrame *page, int i,sls::Detector *det);
-
- void setNLoops();
- void update();
-
- ClassDef(ctbLoop,0)
- };
-
-class ctbWait : public TGHorizontalFrame {
-
-
- private:
-
- TGNumberEntry *eWaitAddr;
- TGNumberEntry *eWaitTime;
-
- int id;
-
- sls::Detector *myDet;
-
- public:
- ctbWait(TGGroupFrame *page, int i,sls::Detector *det);
-
- void setWaitTime();
- void update();
-
- ClassDef(ctbWait,0)
- };
-
-
-
-
-
-
-
-class ctbPattern : public TGGroupFrame {
-private:
-
-
- TGNumberEntry *eAdcClkFreq;
- TGNumberEntry *eRunClkFreq;
- TGNumberEntry *eDBitClkFreq;
- TGNumberEntry *eAdcClkPhase;
- TGNumberEntry *eDBitClkPhase;
- //TGNumberEntry *eRunClkPhase;
-
- TGNumberEntry *eStartAddr;
- TGNumberEntry *eStopAddr;
- TGNumberEntry *eFrames;
- TGNumberEntry *ePeriod;
- TGNumberEntry *eTriggers;
- // TGNumberEntry *eMeasurements;
- TGNumberEntry *eAdcPipeline;
- TGNumberEntry *eDBitPipeline;
-
- ctbLoop *eLoop[NLOOPS];
- ctbWait *eWait[NWAITS];
-
- TGTextEntry *patternCompiler;
- TGTextEntry *patternFile;
-
- TGTextButton *browseCompiler;
- TGTextButton *browseFile;
-
-
- TGNumberEntry *eAnalogSamples;
- TGNumberEntry *eDigitalSamples;
-
- TGCheckButton *cbAnalog;
- TGCheckButton *cbDigital;
-
- char pat[PATLEN*8];
-
- sls::Detector *myDet;
-
-public:
-
- ctbPattern(TGVerticalFrame *page, sls::Detector *det);
-
- void update();
- void setAdcFreq();
- void setRunFreq();
- void setDBitFreq();
- void setAdcPhase();
- void setDBitPhase();
- // void setRunPhase();
- void setAdcPipeline();
- void setDBitPipeline();
- void setFrames();
- void setTriggers();
- // void setMeasurements();
- void setPeriod();
-
-
- void chooseCompiler();
- void choosePattern();
-
- string getCompiler();
- string getPatternFile();
-
- void setPatternAlias(string);
- string getPatternAlias();
-
-
- int getAnalogSamples();
- void setAnalogSamples();
- int getDigitalSamples();
- void setDigitalSamples();
- void setReadoutMode(Bool_t);
- int getReadoutMode();
-
-
- void setFile();
- void setCompiler();
- void patternFileChanged(const char*);
- void patternCompilerChanged(const char*);
- void analogSamplesChanged(const int t);
- void digitalSamplesChanged(const int t);
- void readoutModeChanged(int);
-
-
- ClassDef(ctbPattern,0)
-};
-
-#endif
diff --git a/ctbGui/ctbPowers.cpp b/ctbGui/ctbPowers.cpp
deleted file mode 100644
index 498ec2c13..000000000
--- a/ctbGui/ctbPowers.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#include
-
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include "ctbDefs.h"
-#include "ctbDacs.h"
-#include "ctbPowers.h"
-#include "sls/Detector.h"
-#include "sls/sls_detector_defs.h"
-
-using namespace std;
-
-
-
-ctbPower::ctbPower(TGGroupFrame* f, int i, sls::Detector* d)
- : ctbDac(f, i, d)
-{
- cout << "****************************************************************power " << i << endl;
- dacsUnit->SetOn(kTRUE);
- dacsUnit->SetEnabled(kFALSE);
-
- switch(i) {
- case slsDetectorDefs::V_POWER_IO:
- dacsLabel->SetText("VIO");
- break;
- case slsDetectorDefs::V_POWER_A:
- dacsLabel->SetText("VA");
- break;
- case slsDetectorDefs::V_POWER_B:
- dacsLabel->SetText("VB");
- break;
- case slsDetectorDefs::V_POWER_C:
- dacsLabel->SetText("VC");
- break;
- case slsDetectorDefs::V_POWER_D:
- dacsLabel->SetText("VD");
- break;
- case slsDetectorDefs::V_POWER_CHIP:
- dacsLabel->SetText("VCHIP");
- dacsLabel->SetEnabled(kFALSE);
- break;
- default:
- dacsLabel->SetText("Bad index");
- break;
- };
-
-
- TGTextEntry *e=dacsEntry->TGNumberEntry::GetNumberEntry();
- e->Disconnect ("ReturnPressed()");
- e->Disconnect ("ValueSet(Long_t)");
-
- e->Connect("ReturnPressed()","ctbPower",this,"setValue()");
- dacsEntry->Connect("ValueSet(Long_t)","ctbPower",this,"setValue(Long_t)");
- };
-
-
-string ctbPower::getLabel() {
-
- ostringstream line;
- switch (id) {
- case slsDetectorDefs::V_POWER_IO:
- line << "VIO";
- break;
- case slsDetectorDefs::V_POWER_A:
- line << "VA";
- break;
- case slsDetectorDefs::V_POWER_B:
- line << "VB";
- break;
- case slsDetectorDefs::V_POWER_C:
- line << "VC";
- break;
- case slsDetectorDefs::V_POWER_D:
- line << "VD";
- break;
- case slsDetectorDefs::V_POWER_CHIP:
- line << "VCHIP";
- break;
- default:
- line << "VBAD";
- break;
-
- }
- line << " " << dacsLabel->GetText() << endl;
- return line.str();
-}
-
-void ctbPower::setValue(Long_t a) {ctbPower::setValue();}
-
-void ctbPower::setValue() {
- cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << id << " " << 1 << endl;
-
- try {
- myDet->setVoltage(static_cast(id), dacsEntry->GetIntNumber());
- } CATCH_DISPLAY ("Could not set power " + to_string(id) + ".", "ctbPower::setValue")
-
- getValue();
-}
-
-
-int ctbPower::getValue() {
- try {
-
- int val = myDet->getVoltage(static_cast(id)).tsquash("Different values");
- cout << "****************************Getting power " << val << " " << id << " " << 1 << endl;
-
- dacsValue->SetText(to_string(val).c_str());
- if (val > 0) {
- if (id != static_cast(slsDetectorDefs::V_POWER_CHIP))
- dacsLabel->SetOn(kTRUE);
- } else {
- dacsLabel->SetOn(kFALSE);
- }
-
- return val;
-
- } CATCH_DISPLAY ("Could not get power " + to_string(id) + ".", "ctbPower::getValue")
-
- return -1;
-}
-
-
-
-ctbPowers::ctbPowers(TGVerticalFrame* page, sls::Detector* det) : TGGroupFrame(page,"Power Supplies",kVerticalFrame) , myDet(det){
-
-
- SetTitlePos(TGGroupFrame::kLeft);
- page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
- MapWindow();
-
- // cout << "window mapped " << endl;
-
- for (int idac=0; idacsetLabel(tit,1);
- is=0;
- }
-
- if (sscanf(line.c_str(),"VB %s",tit)) {
- dacs[1]->setLabel(tit,1);
- is=1;
- }
-
- if (sscanf(line.c_str(),"VC %s",tit)) {
- dacs[2]->setLabel(tit,1);
- is=2;
- }
-
- if (sscanf(line.c_str(),"VD %s",tit)) {
- dacs[3]->setLabel(tit,1);
- is=3;
- }
-
- if (sscanf(line.c_str(),"VIO %s",tit)) {
- dacs[4]->setLabel(tit,1);
- is=4;
- }
-
- if (sscanf(line.c_str(),"VCHIP %s",tit)) {
- dacs[5]->setLabel(tit,1);
- is=5;
- }
-
- return is;
-
-}
-
-string ctbPowers::getPwrAlias() {
-
- ostringstream line;
-
- for (int i=0; igetLabel() << endl;
- return line.str();
-
-}
-
-
-
-
-string ctbPowers::getPwrParameters() {
-
- ostringstream line;
- line << "v_a" << " " << dacs[0]->getValue() << " mv" << endl;
- line << "v_b" << " " << dacs[1]->getValue() << " mv" << endl;
- line << "v_c" << " " << dacs[2]->getValue() << " mv" << endl;
- line << "v_d" << " " << dacs[3]->getValue() << " mv" << endl;
- line << "v_io" << " " << dacs[4]->getValue() << " mv" << endl;
- line << "v_chip" << " " << dacs[5]->getValue() << " mv" << endl;
- // for (int i=0; igetValue << endl;
- // line << "dac:" << i << " " << dacs[i]->getValue() << endl;
- // }
- return line.str();
-}
-
-
-
-void ctbPowers::update() {
- for (int idac=0; idacgetValue();
-
- }
-}
diff --git a/ctbGui/ctbPowers.h b/ctbGui/ctbPowers.h
deleted file mode 100644
index d0c39f1c7..000000000
--- a/ctbGui/ctbPowers.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#ifndef CTBPOWERS_H
-#define CTBPOWERS_H
-
-#include
-
-#define NPOWERS 6
-
-
-
-class TGTextEntry;
-class TGLabel;
-class TGNumberEntry;
-class TGCheckButton;
-
-
-
-
-namespace sls
-{
- class Detector;
-};
-
-#include
-using namespace std;
-
-
-class ctbPower : public ctbDac {
-
-
-
-
- public:
-
- ctbPower(TGGroupFrame* f, int i, sls::Detector* d);
-
- string getLabel();
-
- int getValue();
- void setValue();
- void setValue(Long_t);
-
- ClassDef(ctbPower,0)
-};
-
-
-class ctbPowers : public TGGroupFrame
-{
- private:
-
- ctbPower *dacs[NPOWERS];
-
- sls::Detector* myDet;
-
-public:
- //ctbPowers();
- ctbPowers(TGVerticalFrame*, sls::Detector*);
-
- int setPwrAlias(string);
- string getPwrAlias();
- string getPwrParameters();
-
- void update();
-
- ClassDef(ctbPowers,0)
-};
-
-#endif
diff --git a/ctbGui/ctbSignals.cpp b/ctbGui/ctbSignals.cpp
deleted file mode 100644
index f1e0c840f..000000000
--- a/ctbGui/ctbSignals.cpp
+++ /dev/null
@@ -1,543 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-other
-// Copyright (C) 2021 Contributors to the SLS Detector Package
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include