Compare commits

..

25 Commits

Author SHA1 Message Date
9df1eac3c1 Merge branch 'main-rc' into b2.2.0 2020-11-30 15:46:45 +01:00
5ededf9be4 Merge branch 'main-rc' into b2.1.1 2020-11-30 15:16:57 +01:00
3e8774798a Merge branch 'main-rc' into b2.1.0 2020-11-30 15:13:43 +01:00
0e5d4d1d8e Merge remote branch 'slsDetectorCalibration/2.2' into 2.2 2017-12-12 11:14:01 +01:00
a2986784d3 Merge remote branch 'slsDetectorCalibration/2.1.1' into 2.1.1 2017-12-12 11:13:34 +01:00
975cbb576e Merge remote branch 'slsDetectorCalibration/2.1' into 2.1 2017-12-12 11:06:15 +01:00
e48a92d9cd Merge remote branch 'slsDetectorCalibration/2.0.5' into 2.0.5 2017-12-12 11:02:57 +01:00
025c836e25 Merge remote branch 'slsDetectorGui/2.2' into 2.2 2017-12-04 16:47:28 +01:00
5d5abae3f4 Merge remote branch 'slsReceiverSoftware/2.2' into 2.2 2017-12-04 16:47:28 +01:00
e2ad46386e Merge remote branch 'slsDetectorSoftware/2.2' into 2.2 2017-12-04 16:47:26 +01:00
308d44e452 Merge remote branch 'slsDetectorGui/2.1.1' into 2.1.1 2017-12-04 16:47:22 +01:00
69da61b1fb Merge remote branch 'slsReceiverSoftware/2.1.1' into 2.1.1 2017-12-04 16:47:22 +01:00
460168ce04 Merge remote branch 'slsDetectorSoftware/2.1.1' into 2.1.1 2017-12-04 16:47:21 +01:00
4e429c0d77 Merge remote branch 'slsDetectorGui/2.1' into 2.1 2017-12-04 16:45:34 +01:00
bf4fab549d Merge remote branch 'slsReceiverSoftware/2.1' into 2.1 2017-12-04 16:45:34 +01:00
f7705eb1da Merge remote branch 'slsDetectorSoftware/2.1' into 2.1 2017-12-04 16:45:32 +01:00
a2217e2066 Merge remote branch 'slsReceiverSoftware/2.0.5' into 2.0.5 2017-12-04 15:33:33 +01:00
aaa02706fc Merge remote branch 'slsDetectorSoftware/2.0.5' into 2.0.5 2017-12-04 15:31:52 +01:00
839896c7e6 fixed the print file packet loss progress bug 2016-10-19 15:53:26 +02:00
4a7e246604 removed asking only 1 for framescaugh 2016-10-19 10:21:29 +02:00
7f293115c4 moved f_activate to receiver funcs from detectors funcs 2016-10-10 08:43:18 +02:00
f59f40a659 ask only 1 for frames caught for 9m 2016-10-10 08:41:03 +02:00
64fd82f92c fixed bug in gui that overwrites the individual sls file path values with the multi value, included a febl and febr temp read 2016-10-10 08:39:46 +02:00
cd232fd732 fixed bug in gui that overwrites the individual sls file path values with the multi value 2016-10-10 08:17:34 +02:00
172fa66b1f hotfix for memory leak in server 2016-08-18 11:57:36 +02:00
1329 changed files with 173190 additions and 148662 deletions

View File

@ -1,6 +0,0 @@
BasedOnStyle: LLVM
IndentWidth: 4
UseTab: Never
ColumnLimit: 80
AlignConsecutiveAssignments: false

View File

@ -1,33 +0,0 @@
---
Checks: '*,
-android-cloexec-fopen,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-fuchsia*,
-readability-else-after-return,
-readability-avoid-const-params-in-decls,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-type-reinterpret-cast,
-llvm-header-guard,
-readability-static-accessed-through-instance,
-readability-braces-around-statements,
-hicpp-signed-bitwise,
-hicpp-no-array-decay,
-hicpp-braces-around-statements,
-google-runtime-references,
-google-readability-todo,
-google-readability-braces-around-statements,
-modernize-use-trailing-return-type'
HeaderFilterRegex: \.h
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
# - { key: readability-identifier-naming.FunctionCase, value: lower_case }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
# - { key: readability-identifier-naming.MethodCase, value: CamelCase }
# - { key: readability-identifier-naming.StructCase, value: CamelCase }
# - { key: readability-identifier-naming.VariableCase, value: lower_case }
- { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE }
...

22
.gitignore vendored
View File

@ -1,23 +1,17 @@
.cproject
.project
bin/
calibrationWizards/
slsDetectorGui/
slsDetectorSoftware/
slsReceiverSoftware/
slsDetectorCalibration/
slsImageReconstruction/
.settings
JCTBGui/
*.aux
*.log
*.out
*.toc
*.o
*.so
.*
build
RELEASE.txt
Testing/
ctbDict.cpp
ctbDict.h
*.pyc
*/__pycache__/*
tests

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "python/pybind11"]
path = libs/pybind11
url = https://github.com/pybind/pybind11.git

View File

@ -1,38 +0,0 @@
sudo: false
language: cpp
os: linux
dist: bionic
install:
- sudo apt-get update
- ldd --version
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- source "$HOME/miniconda/etc/profile.d/conda.sh"
- rm -f miniconda.sh
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda config --add channels conda-forge
- conda config --add channels slsdetectorgroup
- conda update -q conda
- conda info -a
# Useful for debugging any issues with conda
- conda create -q -n testenv conda-build anaconda-client conda-verify
- conda activate testenv
- conda-build .
script:
- CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
deploy:
provider: script
script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
on:
branch: developer
tags: true

224
CMakeLists.txt Executable file → Normal file
View File

@ -1,215 +1,21 @@
cmake_minimum_required(VERSION 3.12)
project(slsDetectorPackage)
set(PROJECT_VERSION 5.0.0)
include(CheckIPOSupported)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
cmake_policy(SET CMP0074 NEW)
include(cmake/project_version.cmake)
find_package(Qt4)
find_package(Qwt 6)
find_package(CBF)
find_package(Doxygen)
# Include additional modules that are used unconditionally
include(GNUInstallDirs)
# If conda build, always set lib dir to 'lib'
if($ENV{CONDA_BUILD})
set(CMAKE_INSTALL_LIBDIR "lib")
add_subdirectory(slsDetectorSoftware)
add_subdirectory(slsReceiverSoftware)
add_subdirectory(slsImageReconstruction)
if (QT4_FOUND AND QWT_FOUND)
add_subdirectory(slsDetectorGui)
endif()
# Set lower / upper case project names
string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER)
string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
# Set targets export name (used by slsDetectorPackage and dependencies)
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWER}-targets")
#set(namespace "${PROJECT_NAME}::")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Check if project is being used directly or via add_subdirectory
set(SLS_MASTER_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(SLS_MASTER_PROJECT ON)
endif()
option (SLS_USE_HDF5 "HDF5 File format" OFF)
option (SLS_USE_TEXTCLIENT "Text Client" ON)
option (SLS_USE_RECEIVER "Receiver" ON)
option (SLS_USE_GUI "GUI" OFF)
option (SLS_USE_SIMULATOR "Simulator" OFF)
option (SLS_USE_TESTS "TESTS" OFF)
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF)
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
option(SLS_USE_PYTHON "Python bindings" OFF)
option(SLS_USE_CTBGUI "ctb GUI" OFF)
option(SLS_BUILD_DOCS "docs" OFF)
option(SLS_BUILD_EXAMPLES "examples" OFF)
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
endif()
#Add two fake libraries to manage options
add_library(slsProjectOptions INTERFACE)
add_library(slsProjectWarnings INTERFACE)
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
target_compile_options(slsProjectWarnings INTERFACE
-Wall
-Wextra
-Wno-unused-parameter #Needs to be slowly mitigated
# -Wold-style-cast
-Wnon-virtual-dtor
-Woverloaded-virtual
-Wdouble-promotion
-Wformat=2
-Wredundant-decls
# -Wconversion
-Wdouble-promotion
-Werror=return-type
)
#Testing for minimum version for compilers
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)
message(FATAL_ERROR "Clang version must be at least 3.2!")
endif()
target_compile_options(slsProjectWarnings INTERFACE -Wshadow) #Clag does not warn on constructor
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
message(FATAL_ERROR "GCC version must be at least 4.8!")
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
target_compile_options(slsProjectWarnings INTERFACE
-Wno-missing-field-initializers)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
target_compile_options(slsProjectWarnings INTERFACE
-Wno-misleading-indentation # mostly in rapidjson remove using clang format
-Wduplicated-cond
-Wnull-dereference )
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
target_compile_options(slsProjectWarnings INTERFACE
-Wno-class-memaccess )
if (DEFINED ENV{ROOTSYS})
find_package(ROOT)
if (ROOT_FOUND)
add_subdirectory(calibrationWizards)
endif()
endif()
if(SLS_USE_SANITIZER)
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
endif()
if(SLS_TUNE_LOCAL)
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
endif()
#rapidjson
add_library(rapidjson INTERFACE)
target_include_directories(rapidjson INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libs/rapidjson>
)
# Install fake the libraries
install(TARGETS slsProjectOptions slsProjectWarnings rapidjson
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH $ORIGIN)
# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
find_package(ZeroMQ 4 REQUIRED)
if (SLS_USE_TESTS)
enable_testing()
add_subdirectory(tests)
endif(SLS_USE_TESTS)
# Common functionallity to detector and receiver
add_subdirectory(slsSupportLib)
if (SLS_USE_TEXTCLIENT)
add_subdirectory(slsDetectorSoftware)
endif (SLS_USE_TEXTCLIENT)
if (SLS_USE_RECEIVER)
if (SLS_USE_HDF5)
find_package(HDF5 1.10 COMPONENTS CXX REQUIRED)
endif (SLS_USE_HDF5)
add_subdirectory(slsReceiverSoftware)
endif (SLS_USE_RECEIVER)
if (SLS_USE_GUI)
find_package(Qt4 REQUIRED)
find_package(Qwt 6 REQUIRED)
if (QT4_FOUND AND QWT_FOUND)
add_subdirectory(slsDetectorGui)
endif()
endif (SLS_USE_GUI)
if (SLS_USE_SIMULATOR)
add_subdirectory(slsDetectorServers)
endif (SLS_USE_SIMULATOR)
if (SLS_USE_INTEGRATION_TESTS)
add_subdirectory(integrationTests)
endif (SLS_USE_INTEGRATION_TESTS)
if (SLS_USE_PYTHON)
set(PYBIND11_CPP_STANDARD -std=c++11)
add_subdirectory(libs/pybind11)
add_subdirectory(python)
endif(SLS_USE_PYTHON)
if (SLS_USE_CTBGUI)
add_subdirectory(ctbGui)
endif(SLS_USE_CTBGUI)
configure_file( .clang-tidy
${CMAKE_BINARY_DIR}/.clang-tidy
)
if (SLS_BUILD_EXAMPLES)
add_subdirectory(sample)
endif(SLS_BUILD_EXAMPLES)
if(SLS_BUILD_DOCS)
add_subdirectory(docs)
endif(SLS_BUILD_DOCS)
if(SLS_MASTER_PROJECT)
# Set install dir CMake packages
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/sls)
# Set the list of exported targets
set(PROJECT_LIBRARIES slsSupportLib slsDetectorShared slsReceiverShared)
# Generate and install package config file and version
include(cmake/package_config.cmake)
endif()

186
Makefile Executable file
View File

@ -0,0 +1,186 @@
# do not change below this line#
# Include common definitions
include Makefile.include
INSTALLROOT ?= $(PWD)
BINDIR ?= $(INSTALLROOT)/bin
DOCDIR ?= $(INSTALLROOT)/docs
LIBDIR ?= $(INSTALLROOT)/bin
INCDIR ?= $(INSTALLROOT)/include
WD = $(shell pwd)
LIBRARYDIR = $(WD)/slsDetectorSoftware
LIBRARYRXRDIR = $(WD)/slsReceiverSoftware
CLIENTDIR = $(LIBRARYDIR)/slsDetectorClient
GUIDIR = $(WD)/slsDetectorGui
RECEIVERDIR = $(LIBRARYRXRDIR)
CALWIZDIR = $(WD)/calibrationWizards
MANDIR = $(WD)/manual
CALIBDIR = $(WD)/slsDetectorCalibration
INCLUDES=-I. -I$(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/slsDetectorUtils -I$(LIBRARYDIR)/slsDetectorCommand -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYRXRDIR)/include -I$(LIBRARYDIR)/threadFiles -I$(ASM)
INCLUDESRXR += -I. -I$(LIBRARYRXRDIR)/include -I$(CALIBDIR) -I$(ASM)
#LIBFLAGRXR +=
$(info )
$(info #######################################)
$(info # Compiling slsDetectorsPackage #)
$(info #######################################)
$(info )
.PHONY: all nonstatic static lib libreceiver textclient receiver gui stextclient sreceiver
all: lib textclient receiver gui
nonstatic: lib libreceiver textclient receiver gui
static: lib libreceiver stextclient sreceiver gui
lib:
cd $(LIBRARYDIR) && $(MAKE) FLAGS='$(FLAGS)' DESTDIR='$(LIBDIR)' INCLUDES='$(INCLUDES)'
libreceiver:
cd $(LIBRARYRXRDIR) && $(MAKE) FLAGS='$(FLAGS)' DESTDIR='$(LIBDIR)' INCLUDES='$(INCLUDESRXR)'
stextclient: slsDetectorClient_static
slsDetectorClient: textclient
slsDetectorClient_static: lib
cd $(CLIENTDIR) && $(MAKE) static_clients FLAGS='$(FLAGS)' LIBS='$(LDFLAGDET)' DESTDIR='$(BINDIR)' LIBDIR='$(LIBDIR)' INCLUDES='$(INCLUDES)'
textclient: lib
cd $(CLIENTDIR) && $(MAKE) FLAGS='$(FLAGS)' DESTDIR='$(BINDIR)' LIBDIR='$(LIBDIR)' LIBS='$(LDFLAGDET)' INCLUDES='$(INCLUDES)'
slsReceiver: receiver
slsReceiver_static: receiver
receiver: libreceiver
cd $(RECEIVERDIR) && $(MAKE) receiver FLAGS='$(FLAGS)' DESTDIR='$(BINDIR)' LIBDIR='$(LIBDIR)' LIBS='$(LDFLAGRXR)' INCLUDES='$(INCLUDESRXR)'
sreceiver: libreceiver
cd $(RECEIVERDIR) && $(MAKE) static_receiver FLAGS='$(FLAGS)' DESTDIR='$(BINDIR)' LIBDIR='$(LIBDIR)' LIBS='$(LDFLAGRXR)' INCLUDES='$(INCLUDESRXR)'
slsDetectorGUI: lib
cd $(GUIDIR) && $(MAKE) DESTDIR='$(BINDIR)' LIBDIR='$(LIBDIR)' INCLUDES='$(INCLUDES)' LDFLAGDET='-L$(LIBDIR) -lSlsDetector'
calWiz:
cd $(CALWIZDIR) && $(MAKE) DESTDIR=$(BINDIR) #FLAGS=$(FLAGS) LDFLAGDET=$(LDFLAGDET) INCLUDES=$(INCLUDES)
gui: slsDetectorGUI
doc:
$(shell test -d $(DOCDIR) || mkdir -p $(DOCDIR))
cd manual && make all DESTDIR=$(DOCDIR)
htmldoc:
make doc
$(shell test -d $(DOCDIR) || mkdir -p $(DOCDIR))
cd manual && make html DESTDIR=$(DOCDIR)
clean:
cd $(BINDIR) && rm -rf sls_detector_* slsDetectorGui slsReceiver angularCalibrationWizard energyCalibrationWizard
cd $(LIBDIR) && rm -rf libSlsDetector.so libSlsDetector.a libSlsReceiver.so libSlsReceiver.a
cd $(LIBRARYDIR) && $(MAKE) clean
cd $(LIBRARYRXRDIR) && $(MAKE) clean
cd $(CLIENTDIR) && $(MAKE) clean
cd $(GUIDIR) && $(MAKE) clean
cd $(CALWIZDIR) && $(MAKE) clean
cd manual && $(MAKE) clean
cd $(DOCDIR) && rm -rf *
#install_lib:
# cd $(LIBRARYDIR) && $(MAKE) install DESTDIR=$(LIBDIR) INCLUDES=$(INCLUDES)
# cd $(LIBRARYDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR)
mythen_virtual:
cd $(LIBRARYDIR) && $(MAKE) mythenVirtualServer DESTDIR=$(BINDIR)
gotthard_virtual:
cd $(LIBRARYDIR) && $(MAKE) gotthardVirtualServer DESTDIR=$(BINDIR)
install_client: textclient slsReceiver
install_gui: gui
confinstall:
make conf;\
make install
install_lib:
make lib;\
make libreceiver; \
make textclient; \
make slsReceiver; \
make doc; \
make htmldoc; \
cd $(LIBRARYDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR); \
cd $(LIBRARYRXRDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR);
install:
make install_lib; \
make gui; \
make calWiz; \
cd $(LIBRARYDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR);\
cd $(LIBRARYRXRDIR) && $(MAKE) install_inc DESTDIR=$(INCDIR);
conf:
set -e; \
. ./configure; \
@echo "INSTALLROOT is $(INSTALLROOT)"
@echo "BINDIR is $(BINDIR)"
@echo "LIBDIR is $(LIBDIR)"
@echo "INCDIR is $(INCDIR)"
@echo "DOCDIR is $(DOCDIR)"
help:
@echo "Targets:"
@echo "make all compile library, text clients, data reciever"
@echo "make lib compile library"
@echo "make libreceiver compile receiver library"
@echo "make textclient compile the slsDetectorClient dynamically linking the libraries"
@echo "make stextclient compile slsDetectorClient statically linking the libraries"
@echo "make receiver compile the slsReciever dynamically linking the libraries"
@echo "make sreceiver compile the slsReciever statically linking the libraries"
@echo "make gui compile slsDetectorGUI - requires a working Qt4 and Qwt installation"
@echo "make calWiz compile the calibration wizards - requires a working Root installation"
@echo "make doc compile pdf documentation"
@echo "make htmldoc compile html (and pdf) documentation"
@echo "make install_lib installs the libraries, the text clients, the documentation and the includes for the API"
@echo "make install installs all software, including the gui, the cal wizards and the includes for the API"
@echo "make confinstall installs all software, including the gui, the cal wizards and the includes for the API, prompting for the install paths"
@echo "make clean remove object files and executables"
@echo "make help lists possible targets"
@echo ""
@echo ""
@echo "Makefile variables"
@echo "REST=yes compile REST-aware Receiver (POCO and JsonBox libraries required)"
@echo "DEBUG=1,2 set debug level to 1 (VERBOSE) or 2 (VERYVERBOSE)"
@echo ""
@echo ""
@echo "Variables - to change them run <source configure> :"
@echo "INSTALLROOT=<yourdir>: installation root di r, default $PWD"
@echo "BINDIR=<yourbin>: binary installation dir below INSTALLROOT, default bin"
@echo "LIBDIR=<yourlib>: library installation dir below INSTALLROOT, default lib"
@echo "INCDIR=<yourincludes>: header installation dir below INSTALLROOT, default include"
@echo "DOCDIR=<yourdoc>: documentation installation dir below INSTALLROOT, default doc"

61
Makefile.include Executable file
View File

@ -0,0 +1,61 @@
##############################################################
# Generic
##############################################################
CC = g++
CXX = $(CC)
ASM=$(shell echo "/lib/modules/`uname -r`/build/include")
LDFLAGDET = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread
LDFLAGRXR = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread
FLAGS= -Wall #-DEIGER_DEBUG2 -DEIGER_DEBUG -DEIGER_DEBUG3 #-DFIFO_DEBUG
# -DVERBOSE
# Setting up the verbose flags
ifeq ($(DEBUG),1)
FLAGS = -Wall -DVERBOSE
endif
ifeq ($(DEBUG),2)
FLAGS = -Wall -DVERYVERBOSE
endif
##############################################################
# EigerSLS specific. Set this to yes, if you want to compile
# EigerSLS code: in this case, you need also POCO and JsonBox
# libraries
##############################################################
REST = no
#POCODIR = /afs/psi.ch/user/s/sala/public/poco-slp_5.7-32bit
#JSONBOXDIR = /afs/psi.ch/user/s/sala/public/JsonBox-slp_5.7-32bit
POCODIR = /afs/psi.ch/user/s/sala/public/poco-slp_6.4-64bit
JSONBOXDIR = /afs/psi.ch/user/s/sala/public/JsonBox-slp_6.4-64bit
#POCODIR = /home/sala/Programs/poco-ubuntu_13.10-64bit
#JSONBOXDIR = /home/sala/Programs/JsonBox-ubuntu_13.10-64bit
RESTFLAGS = -L$(POCODIR)/lib -Wl,-rpath=$(POCODIR)/lib -L$(JSONBOXDIR) -Wl,-rpath=$(JSONBOXDIR)/lib -lPocoNet -lPocoFoundation -lJsonBox
ifeq ($(REST),yes)
LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver $(RESTFLAGS) -DREST
INCLUDESRXR = $(EIGERFLAGS) -I$(POCODIR)/include -I$(JSONBOXDIR)/include
endif
##############################################################
# ROOTSLS specific. Set this to yes, if you want to compile
# ROOTSLS code: in this case, you need also root libraries
##############################################################
ROOTSLS = no
ROOTFLAGS = $(shell root-config --cflags --glibs) -DMYROOT1 #-DALLFILE_DEBUG #-DMYROOT1
ifeq ($(ROOTSLS),yes)
LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver $(ROOTFLAGS) -DROOTSLS
endif

92
README.md Executable file → Normal file
View File

@ -1,68 +1,44 @@
### Documentation
Detailed documentation can be found on the [official site.](https://www.psi.ch/detectors/users-support)
# slsDetector package
### Binaries
Binaries for the slsDetectorPackage are available through conda.
```
#Add conda channels
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
conda install slsdetlib #only shared lib and command line
conda install slsdet #python bindings (includes slsdetlib)
conda install slsdetgui #gui (includes qt4)
## Installation
#Install specific version
conda install slsdet=2020.03.02.dev0 #developer version from 3 March 2020
### Get source
The source code is organised into several submodules, and the top level module is
sls_detectors_package.
```
### Source code
One can also obtain the source code from this repository and compile.
$ git clone git@git.psi.ch:sls_detectors_software/sls_detectors_package.git
$ cd sls_detectors_package
$ ./checkout.sh
```
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git
### Setup dependencies
The GUI client requires Qt 4.8 and Qwt 6.0
```
#### Dependencies
* Lib: c++11 compiler (gcc=>4.8), ZeroMQ 4
* Gui: Qt 4.8 and Qwt 6.0
* Calibration wizards and ctbGUI: ROOT
* Optional: HDF5
#### Compilation
Compiling can be done in two ways. Either with the convenience script
cmk.sh or directly with cmake for more control.
**1. Compile using script cmk.sh**<br>
After compiling, the libraries and executables will be found in `slsDetectorPackage/build/bin` directory<br>
Usage: [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
-[no option]: only make
-c: Clean
-b: Builds/Rebuilds CMake files normal mode
-p: Builds/Rebuilds Python API
-h: Builds/Rebuilds Cmake files with HDF5 package
-d: HDF5 Custom Directory
-t: Build/Rebuilds only text client
-r: Build/Rebuilds only receiver
-g: Build/Rebuilds only gui
-s: Simulator
-u: Chip Test Gui
-j: Number of threads to compile through
-e: Debug mode
-i: Builds tests
eg. Rebuild when you switch to a new build and compile in parallel:
./cmk.sh -bj5
**2. Compile without script**<br>
Use cmake to create out-of-source builds, by creating a build folder parallel to source directory. This would create a debug build with address sanitizers.
export QTDIR=/usr/local/Trolltech/
export QWTDIR=/usr/local/qwt-6.0.1/
```
$ mkdir build
$ cd build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON
$ make -j12 #or whatever number of threads wanted
If either of them does not exist, the GUI client will not be built.
The calibration wizards require ROOT
```
export ROOTSYS=/usr/local/root-5.34
```
### Compile
Use cmake to create out-of-source builds, by creating an build folder parallel to source directory.
```
$ cd ..
$ mkdir sls_detectors_package-build
$ cd sls_detectors_package-build
$ cmake ../sls_detectors_package
$ make
```
The libraries and executables will be found at `bin` directory
```
$ ls bin/
gui_client libSlsDetector.a libSlsDetector.so libSlsReceiver.a libSlsReceiver.so
sls_detector_acquire sls_detector_get slsDetectorGui sls_detector_help sls_detector_put slsReceiver
```

View File

@ -1,2 +0,0 @@
Draft
- dr 4, 8, 16 in eiger -> speed 0, 32 stays same (speed 1)

17
checkout.sh Executable file
View File

@ -0,0 +1,17 @@
#git clone $1@git.psi.ch:sls_det_software/sls_detectors_package.git slsDetectorsPackage
#cd slsDetectorsPackage
git clone $1@git.psi.ch:sls_detectors_software/sls_detector_software.git slsDetectorSoftware
git clone $1@git.psi.ch:sls_detectors_software/sls_detector_gui.git slsDetectorGui
git clone $1@git.psi.ch:sls_detectors_software/sls_receiver_software.git slsReceiverSoftware
git clone $1@git.psi.ch:sls_detectors_software/sls_detector_calibration.git slsDetectorCalibration
#git clone $1@git.psi.ch:sls_detectors_software/sls_image_reconstruction.git slsImageReconstruction
git clone $1@git.psi.ch:sls_detectors_software/calibration_wizards.git calibrationWizards
#git clone git@git.psi.ch:sls_detectors_software/tests.git tests

1
cleansharedmemory.sh Normal file
View File

@ -0,0 +1 @@
for i in seq `ipcs -m | cut -d ' ' -f1`; do ipcrm -M $i; done;

View File

@ -1,175 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Catch
-----
This module defines a function to help use the Catch test framework.
The :command:`catch_discover_tests` discovers tests by asking the compiled test
executable to enumerate its tests. This does not require CMake to be re-run
when tests change. However, it may not work in a cross-compiling environment,
and setting test properties is less convenient.
This command is intended to replace use of :command:`add_test` to register
tests, and will create a separate CTest test for each Catch test case. Note
that this is in some cases less efficient, as common set-up and tear-down logic
cannot be shared by multiple test cases executing in the same instance.
However, it provides more fine-grained pass/fail information to CTest, which is
usually considered as more beneficial. By default, the CTest test name is the
same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
.. command:: catch_discover_tests
Automatically add tests with CTest by querying the compiled test executable
for available tests::
catch_discover_tests(target
[TEST_SPEC arg1...]
[EXTRA_ARGS arg1...]
[WORKING_DIRECTORY dir]
[TEST_PREFIX prefix]
[TEST_SUFFIX suffix]
[PROPERTIES name1 value1...]
[TEST_LIST var]
)
``catch_discover_tests`` sets up a post-build command on the test executable
that generates the list of tests by parsing the output from running the test
with the ``--list-test-names-only`` argument. This ensures that the full
list of tests is obtained. Since test discovery occurs at build time, it is
not necessary to re-run CMake when the list of tests changes.
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
in order to function in a cross-compiling environment.
Additionally, setting properties on tests is somewhat less convenient, since
the tests are not available at CMake time. Additional test properties may be
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
more fine-grained test control is needed, custom content may be provided
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
directory property. The set of discovered tests is made accessible to such a
script via the ``<target>_TESTS`` variable.
The options are:
``target``
Specifies the Catch executable, which must be a known CMake executable
target. CMake will substitute the location of the built executable when
running the test.
``TEST_SPEC arg1...``
Specifies test cases, wildcarded test cases, tags and tag expressions to
pass to the Catch executable with the ``--list-test-names-only`` argument.
``EXTRA_ARGS arg1...``
Any extra arguments to pass on the command line to each test case.
``WORKING_DIRECTORY dir``
Specifies the directory in which to run the discovered test cases. If this
option is not provided, the current binary directory is used.
``TEST_PREFIX prefix``
Specifies a ``prefix`` to be prepended to the name of each discovered test
case. This can be useful when the same test executable is being used in
multiple calls to ``catch_discover_tests()`` but with different
``TEST_SPEC`` or ``EXTRA_ARGS``.
``TEST_SUFFIX suffix``
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
be specified.
``PROPERTIES name1 value1...``
Specifies additional properties to be set on all tests discovered by this
invocation of ``catch_discover_tests``.
``TEST_LIST var``
Make the list of tests available in the variable ``var``, rather than the
default ``<target>_TESTS``. This can be useful when the same test
executable is being used in multiple calls to ``catch_discover_tests()``.
Note that this variable is only available in CTest.
#]=======================================================================]
#------------------------------------------------------------------------------
function(catch_discover_tests TARGET)
cmake_parse_arguments(
""
""
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST"
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
${ARGN}
)
if(NOT _WORKING_DIRECTORY)
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
if(NOT _TEST_LIST)
set(_TEST_LIST ${TARGET}_TESTS)
endif()
## Generate a unique name based on the extra arguments
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
string(SUBSTRING ${args_hash} 0 7 args_hash)
# Define rule to generate test list for aforementioned test executable
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
get_property(crosscompiling_emulator
TARGET ${TARGET}
PROPERTY CROSSCOMPILING_EMULATOR
)
add_custom_command(
TARGET ${TARGET} POST_BUILD
BYPRODUCTS "${ctest_tests_file}"
COMMAND "${CMAKE_COMMAND}"
-D "TEST_TARGET=${TARGET}"
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
-D "TEST_SPEC=${_TEST_SPEC}"
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
-D "TEST_PROPERTIES=${_PROPERTIES}"
-D "TEST_PREFIX=${_TEST_PREFIX}"
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
-D "TEST_LIST=${_TEST_LIST}"
-D "CTEST_FILE=${ctest_tests_file}"
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
VERBATIM
)
file(WRITE "${ctest_include_file}"
"if(EXISTS \"${ctest_tests_file}\")\n"
" include(\"${ctest_tests_file}\")\n"
"else()\n"
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
"endif()\n"
)
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
# Add discovered tests to directory TEST_INCLUDE_FILES
set_property(DIRECTORY
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
)
else()
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
if (NOT ${test_include_file_set})
set_property(DIRECTORY
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
)
else()
message(FATAL_ERROR
"Cannot set more than one TEST_INCLUDE_FILE"
)
endif()
endif()
endfunction()
###############################################################################
set(_CATCH_DISCOVER_TESTS_SCRIPT
${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
)

View File

@ -1,78 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
set(prefix "${TEST_PREFIX}")
set(suffix "${TEST_SUFFIX}")
set(spec ${TEST_SPEC})
set(extra_args ${TEST_EXTRA_ARGS})
set(properties ${TEST_PROPERTIES})
set(script)
set(suite)
set(tests)
function(add_command NAME)
set(_args "")
foreach(_arg ${ARGN})
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument
else()
set(_args "${_args} ${_arg}")
endif()
endforeach()
set(script "${script}${NAME}(${_args})\n" PARENT_SCOPE)
endfunction()
# Run test executable to get list of available tests
if(NOT EXISTS "${TEST_EXECUTABLE}")
message(FATAL_ERROR
"Specified test executable '${TEST_EXECUTABLE}' does not exist"
)
endif()
execute_process(
COMMAND ${TEST_EXECUTOR} "${TEST_EXECUTABLE}" ${spec} --list-test-names-only
OUTPUT_VARIABLE output
RESULT_VARIABLE result
)
# Catch --list-test-names-only reports the number of tests, so 0 is... surprising
if(${result} EQUAL 0)
message(WARNING
"Test executable '${TEST_EXECUTABLE}' contains no tests!\n"
)
elseif(${result} LESS 0)
message(FATAL_ERROR
"Error running test executable '${TEST_EXECUTABLE}':\n"
" Result: ${result}\n"
" Output: ${output}\n"
)
endif()
string(REPLACE "\n" ";" output "${output}")
# Parse output
foreach(line ${output})
set(test ${line})
# use escape commas to handle properly test cases with commans inside the name
string(REPLACE "," "\\," test_name ${test})
# ...and add to script
add_command(add_test
"${prefix}${test}${suffix}"
${TEST_EXECUTOR}
"${TEST_EXECUTABLE}"
"${test_name}"
${extra_args}
)
add_command(set_tests_properties
"${prefix}${test}${suffix}"
PROPERTIES
WORKING_DIRECTORY "${TEST_WORKING_DIR}"
${properties}
)
list(APPEND tests "${prefix}${test}${suffix}")
endforeach()
# Create a list of all discovered tests, which users may use to e.g. set
# properties on the tests
add_command(set ${TEST_LIST} ${tests})
# Write CTest script
file(WRITE "${CTEST_FILE}" "${script}")

0
cmake/FindCBF.cmake Executable file → Normal file
View File

0
cmake/FindQwt.cmake Executable file → Normal file
View File

0
cmake/FindROOT.cmake Executable file → Normal file
View File

View File

@ -1,11 +0,0 @@
#Look for an executable called sphinx-build
find_program(SPHINX_EXECUTABLE
NAMES sphinx-build
DOC "Path to sphinx-build executable")
include(FindPackageHandleStandardArgs)
#Handle standard arguments to find_package like REQUIRED and QUIET
find_package_handle_standard_args(Sphinx
"Failed to find sphinx-build executable"
SPHINX_EXECUTABLE)

View File

@ -1,112 +0,0 @@
# This file is originally from https://github.com/zeromq/azmq and distributed
# under Boost Software Lincese 1.0
# Boost Software License - Version 1.0 - August 17th, 2003
# Permission is hereby granted, free of charge, to any person or organization
# obtaining a copy of the software and accompanying documentation covered by
# this license (the "Software") to use, reproduce, display, distribute,
# execute, and transmit the Software, and to prepare derivative works of the
# Software, and to permit third-parties to whom the Software is furnished to
# do so, all subject to the following:
# The copyright notices in the Software and this entire statement, including
# the above license grant, this restriction and the following disclaimer,
# must be included in all copies of the Software, in whole or in part, and
# all derivative works of the Software, unless such copies or derivative
# works are solely in the form of machine-executable object code generated by
# a source language processor.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
# SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
# FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# --------------------------------------------------------------------------------
# Find ZeroMQ Headers/Libs
# Variables
# ZMQ_ROOT - set this to a location where ZeroMQ may be found
#
# ZeroMQ_FOUND - True of ZeroMQ found
# ZeroMQ_INCLUDE_DIRS - Location of ZeroMQ includes
# ZeroMQ_LIBRARIES - ZeroMQ libraries
include(FindPackageHandleStandardArgs)
if (NOT ZMQ_ROOT)
set(ZMQ_ROOT "$ENV{ZMQ_ROOT}")
endif()
if (NOT ZMQ_ROOT)
find_path(_ZeroMQ_ROOT NAMES include/zmq.h)
else()
set(_ZeroMQ_ROOT "${ZMQ_ROOT}")
endif()
find_path(ZeroMQ_INCLUDE_DIRS NAMES zmq.h HINTS ${_ZeroMQ_ROOT}/include)
if (ZeroMQ_INCLUDE_DIRS)
set(_ZeroMQ_H ${ZeroMQ_INCLUDE_DIRS}/zmq.h)
function(_zmqver_EXTRACT _ZeroMQ_VER_COMPONENT _ZeroMQ_VER_OUTPUT)
set(CMAKE_MATCH_1 "0")
set(_ZeroMQ_expr "^[ \\t]*#define[ \\t]+${_ZeroMQ_VER_COMPONENT}[ \\t]+([0-9]+)$")
file(STRINGS "${_ZeroMQ_H}" _ZeroMQ_ver REGEX "${_ZeroMQ_expr}")
string(REGEX MATCH "${_ZeroMQ_expr}" ZeroMQ_ver "${_ZeroMQ_ver}")
set(${_ZeroMQ_VER_OUTPUT} "${CMAKE_MATCH_1}" PARENT_SCOPE)
endfunction()
_zmqver_EXTRACT("ZMQ_VERSION_MAJOR" ZeroMQ_VERSION_MAJOR)
_zmqver_EXTRACT("ZMQ_VERSION_MINOR" ZeroMQ_VERSION_MINOR)
_zmqver_EXTRACT("ZMQ_VERSION_PATCH" ZeroMQ_VERSION_PATCH)
message(STATUS "ZeroMQ version: ${ZeroMQ_VERSION_MAJOR}.${ZeroMQ_VERSION_MINOR}.${ZeroMQ_VERSION_PATCH}")
# We should provide version to find_package_handle_standard_args in the same format as it was requested,
# otherwise it can't check whether version matches exactly.
if (ZeroMQ_FIND_VERSION_COUNT GREATER 2)
set(ZeroMQ_VERSION "${ZeroMQ_VERSION_MAJOR}.${ZeroMQ_VERSION_MINOR}.${ZeroMQ_VERSION_PATCH}")
else()
# User has requested ZeroMQ version without patch part => user is not interested in specific patch =>
# any patch should be an exact match.
set(ZeroMQ_VERSION "${ZeroMQ_VERSION_MAJOR}.${ZeroMQ_VERSION_MINOR}")
endif()
if (NOT ${CMAKE_CXX_PLATFORM_ID} STREQUAL "Windows")
find_library(ZeroMQ_LIBRARIES NAMES zmq HINTS ${_ZeroMQ_ROOT}/lib)
else()
find_library(
ZeroMQ_LIBRARY_RELEASE
NAMES
libzmq
"libzmq-${CMAKE_VS_PLATFORM_TOOLSET}-mt-${ZeroMQ_VERSION_MAJOR}_${ZeroMQ_VERSION_MINOR}_${ZeroMQ_VERSION_PATCH}"
HINTS
${_ZeroMQ_ROOT}/lib
)
find_library(
ZeroMQ_LIBRARY_DEBUG
NAMES
libzmq_d
"libzmq-${CMAKE_VS_PLATFORM_TOOLSET}-mt-gd-${ZeroMQ_VERSION_MAJOR}_${ZeroMQ_VERSION_MINOR}_${ZeroMQ_VERSION_PATCH}"
HINTS
${_ZeroMQ_ROOT}/lib)
# On Windows we have to use corresponding version (i.e. Release or Debug) of ZeroMQ because of `errno` CRT global variable
# See more at http://www.drdobbs.com/avoiding-the-visual-c-runtime-library/184416623
set(ZeroMQ_LIBRARIES optimized "${ZeroMQ_LIBRARY_RELEASE}" debug "${ZeroMQ_LIBRARY_DEBUG}")
endif()
endif()
find_package_handle_standard_args(ZeroMQ FOUND_VAR ZeroMQ_FOUND
REQUIRED_VARS ZeroMQ_INCLUDE_DIRS ZeroMQ_LIBRARIES
VERSION_VAR ZeroMQ_VERSION)
if (ZeroMQ_FOUND)
mark_as_advanced(ZeroMQ_INCLUDE_DIRS ZeroMQ_LIBRARIES ZeroMQ_VERSION
ZeroMQ_VERSION_MAJOR ZeroMQ_VERSION_MINOR ZeroMQ_VERSION_PATCH)
endif()

View File

@ -1,203 +0,0 @@
#==================================================================================================#
# supported macros #
# - TEST_CASE, #
# - SCENARIO, #
# - TEST_CASE_METHOD, #
# - CATCH_TEST_CASE, #
# - CATCH_SCENARIO, #
# - CATCH_TEST_CASE_METHOD. #
# #
# Usage #
# 1. make sure this module is in the path or add this otherwise: #
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
# 2. make sure that you've enabled testing option for the project by the call: #
# enable_testing() #
# 3. add the lines to the script for testing target (sample CMakeLists.txt): #
# project(testing_target) #
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake.modules/") #
# enable_testing() #
# #
# find_path(CATCH_INCLUDE_DIR "catch.hpp") #
# include_directories(${INCLUDE_DIRECTORIES} ${CATCH_INCLUDE_DIR}) #
# #
# file(GLOB SOURCE_FILES "*.cpp") #
# add_executable(${PROJECT_NAME} ${SOURCE_FILES}) #
# #
# include(ParseAndAddCatchTests) #
# ParseAndAddCatchTests(${PROJECT_NAME}) #
# #
# The following variables affect the behavior of the script: #
# #
# PARSE_CATCH_TESTS_VERBOSE (Default OFF) #
# -- enables debug messages #
# PARSE_CATCH_TESTS_NO_HIDDEN_TESTS (Default OFF) #
# -- excludes tests marked with [!hide], [.] or [.foo] tags #
# PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME (Default ON) #
# -- adds fixture class name to the test name #
# PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME (Default ON) #
# -- adds cmake target name to the test name #
# PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS (Default OFF) #
# -- causes CMake to rerun when file with tests changes so that new tests will be discovered #
# #
# One can also set (locally) the optional variable OptionalCatchTestLauncher to precise the way #
# a test should be run. For instance to use test MPI, one can write #
# set(OptionalCatchTestLauncher ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${NUMPROC}) #
# just before calling this ParseAndAddCatchTests function #
# #
#==================================================================================================#
cmake_minimum_required(VERSION 2.8.8)
option(PARSE_CATCH_TESTS_VERBOSE "Print Catch to CTest parser debug messages" OFF)
option(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS "Exclude tests with [!hide], [.] or [.foo] tags" OFF)
option(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME "Add fixture class name to the test name" ON)
option(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME "Add target name to the test name" ON)
option(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS "Add test file to CMAKE_CONFIGURE_DEPENDS property" OFF)
function(PrintDebugMessage)
if(PARSE_CATCH_TESTS_VERBOSE)
message(STATUS "ParseAndAddCatchTests: ${ARGV}")
endif()
endfunction()
# This removes the contents between
# - block comments (i.e. /* ... */)
# - full line comments (i.e. // ... )
# contents have been read into '${CppCode}'.
# !keep partial line comments
function(RemoveComments CppCode)
string(ASCII 2 CMakeBeginBlockComment)
string(ASCII 3 CMakeEndBlockComment)
string(REGEX REPLACE "/\\*" "${CMakeBeginBlockComment}" ${CppCode} "${${CppCode}}")
string(REGEX REPLACE "\\*/" "${CMakeEndBlockComment}" ${CppCode} "${${CppCode}}")
string(REGEX REPLACE "${CMakeBeginBlockComment}[^${CMakeEndBlockComment}]*${CMakeEndBlockComment}" "" ${CppCode} "${${CppCode}}")
string(REGEX REPLACE "\n[ \t]*//+[^\n]+" "\n" ${CppCode} "${${CppCode}}")
set(${CppCode} "${${CppCode}}" PARENT_SCOPE)
endfunction()
# Worker function
function(ParseFile SourceFile TestTarget)
# According to CMake docs EXISTS behavior is well-defined only for full paths.
get_filename_component(SourceFile ${SourceFile} ABSOLUTE)
if(NOT EXISTS ${SourceFile})
message(WARNING "Cannot find source file: ${SourceFile}")
return()
endif()
PrintDebugMessage("parsing ${SourceFile}")
file(STRINGS ${SourceFile} Contents NEWLINE_CONSUME)
# Remove block and fullline comments
RemoveComments(Contents)
# Find definition of test names
string(REGEX MATCHALL "[ \t]*(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^\)]+\\)+[ \t\n]*{+[ \t]*(//[^\n]*[Tt][Ii][Mm][Ee][Oo][Uu][Tt][ \t]*[0-9]+)*" Tests "${Contents}")
if(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS AND Tests)
PrintDebugMessage("Adding ${SourceFile} to CMAKE_CONFIGURE_DEPENDS property")
set_property(
DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS ${SourceFile}
)
endif()
foreach(TestName ${Tests})
# Strip newlines
string(REGEX REPLACE "\\\\\n|\n" "" TestName "${TestName}")
# Get test type and fixture if applicable
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
# Get string parts of test definition
string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")
# Strip wrapping quotation marks
string(REGEX REPLACE "^\"(.*)\"$" "\\1" TestStrings "${TestStrings}")
string(REPLACE "\";\"" ";" TestStrings "${TestStrings}")
# Validate that a test name and tags have been provided
list(LENGTH TestStrings TestStringsLength)
if(TestStringsLength GREATER 2 OR TestStringsLength LESS 1)
message(FATAL_ERROR "You must provide a valid test name and tags for all tests in ${SourceFile}")
endif()
# Assign name and tags
list(GET TestStrings 0 Name)
if("${TestType}" STREQUAL "SCENARIO")
set(Name "Scenario: ${Name}")
endif()
if(PARSE_CATCH_TESTS_ADD_FIXTURE_IN_TEST_NAME AND TestFixture)
set(CTestName "${TestFixture}:${Name}")
else()
set(CTestName "${Name}")
endif()
if(PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME)
set(CTestName "${TestTarget}:${CTestName}")
endif()
# add target to labels to enable running all tests added from this target
set(Labels ${TestTarget})
if(TestStringsLength EQUAL 2)
list(GET TestStrings 1 Tags)
string(TOLOWER "${Tags}" Tags)
# remove target from labels if the test is hidden
if("${Tags}" MATCHES ".*\\[!?(hide|\\.)\\].*")
list(REMOVE_ITEM Labels ${TestTarget})
endif()
string(REPLACE "]" ";" Tags "${Tags}")
string(REPLACE "[" "" Tags "${Tags}")
else()
# unset tags variable from previous loop
unset(Tags)
endif()
list(APPEND Labels ${Tags})
list(FIND Labels "!hide" IndexOfHideLabel)
set(HiddenTagFound OFF)
foreach(label ${Labels})
string(REGEX MATCH "^!hide|^\\." result ${label})
if(result)
set(HiddenTagFound ON)
break()
endif(result)
endforeach(label)
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_LESS "3.9")
PrintDebugMessage("Skipping test \"${CTestName}\" as it has [!hide], [.] or [.foo] label")
else()
PrintDebugMessage("Adding test \"${CTestName}\"")
if(Labels)
PrintDebugMessage("Setting labels to ${Labels}")
endif()
# Escape commas in the test spec
string(REPLACE "," "\\," Name ${Name})
# Add the test and set its properties
add_test(NAME "\"${CTestName}\"" COMMAND ${OptionalCatchTestLauncher} ${TestTarget} ${Name} ${AdditionalCatchParameters})
# Old CMake versions do not document VERSION_GREATER_EQUAL, so we use VERSION_GREATER with 3.8 instead
if(PARSE_CATCH_TESTS_NO_HIDDEN_TESTS AND ${HiddenTagFound} AND ${CMAKE_VERSION} VERSION_GREATER "3.8")
PrintDebugMessage("Setting DISABLED test property")
set_tests_properties("\"${CTestName}\"" PROPERTIES DISABLED ON)
else()
set_tests_properties("\"${CTestName}\"" PROPERTIES FAIL_REGULAR_EXPRESSION "No tests ran"
LABELS "${Labels}")
endif()
endif()
endforeach()
endfunction()
# entry point
function(ParseAndAddCatchTests TestTarget)
PrintDebugMessage("Started parsing ${TestTarget}")
get_target_property(SourceFiles ${TestTarget} SOURCES)
PrintDebugMessage("Found the following sources: ${SourceFiles}")
foreach(SourceFile ${SourceFiles})
ParseFile(${SourceFile} ${TestTarget})
endforeach()
PrintDebugMessage("Finished parsing ${TestTarget}")
endfunction()

View File

@ -1,31 +0,0 @@
# This cmake code creates the configuration that is found and used by
# find_package() of another cmake project
# get lower and upper case project name for the configuration files
# configure and install the configuration files
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${CMAKE_SOURCE_DIR}/cmake/project-config.cmake.in"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER}
PATH_VARS CMAKE_INSTALL_DIR)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
install(FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
COMPONENT devel
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
if (PROJECT_LIBRARIES OR PROJECT_STATIC_LIBRARIES)
install(
EXPORT "${TARGETS_EXPORT_NAME}"
FILE ${PROJECT_NAME_LOWER}-targets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
endif ()

View File

@ -1,24 +0,0 @@
# Config file for @PROJECT_NAME_LOWER@
#
# It defines the following variables:
#
# @PROJECT_NAME_UPPER@_INCLUDE_DIRS - include directory
# @PROJECT_NAME_UPPER@_LIBRARIES - all dynamic libraries
# @PROJECT_NAME_UPPER@_STATIC_LIBRARIES - all static libraries
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
set(SLS_USE_HDF5 "@SLS_USE_HDF5@")
# Add optional dependencies here
find_dependency(Threads)
if (SLS_USE_HDF5)
find_dependency(HDF5)
endif ()
set_and_check(@PROJECT_NAME_UPPER@_CMAKE_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_DIR@")
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")

View File

@ -1,14 +0,0 @@
#include "project_version.h"
/// project version as major.minor.patch string
const char* @PROJECT_NAME@_runtime_project_version(){ return "@PROJECT_VERSION@"; }
/// package version as string, possibly with git commit: v1.2.3+4+g56789abc
const char* @PROJECT_NAME@_runtime_package_version(){ return "@PACKAGE_VERSION@"; }
/// project version as integer: major * 10000 + minor * 100 + patch
int @PROJECT_NAME@_runtime_version_int() { return @PROJECT_VERSION_INT@; }
/// project version as integer: major
int @PROJECT_NAME@_runtime_version_major(){ return @PACKAGE_VERSION_MAJOR@; }
/// project version as integer: minor
int @PROJECT_NAME@_runtime_version_minor(){ return @PACKAGE_VERSION_MINOR@; }
/// project version as integer: patch
int @PROJECT_NAME@_runtime_version_patch(){ return @PACKAGE_VERSION_PATCH@; }

View File

@ -1,154 +0,0 @@
#
# Sets PROJECT_VERSION and PACKAGE_VERSION
#
# Don't set PROJECT_VERSION to empty string when no VERSION is given to project() command.
#if(POLICY CMP0048)
# cmake_policy(SET CMP0048 OLD)
#endif()
# Split a version number into separate components
# version the version number to split
# major variable name to store the major version in
# minor variable name to store the minor version in
# patch variable name to store the patch version in
# extra variable name to store a version suffix in
function(version_split version major minor patch extra)
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" version_valid ${version})
if(version_valid)
string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" "\\1;\\2;\\3;\\4" VERSION_MATCHES ${version})
list(GET VERSION_MATCHES 0 version_major)
set(${major} ${version_major} PARENT_SCOPE)
list(GET VERSION_MATCHES 1 version_minor)
set(${minor} ${version_minor} PARENT_SCOPE)
list(GET VERSION_MATCHES 2 version_patch)
set(${patch} ${version_patch} PARENT_SCOPE)
list(GET VERSION_MATCHES 3 version_extra)
set(${extra} ${version_extra} PARENT_SCOPE)
else(version_valid)
message(AUTHOR_WARNING "Bad version ${version}; falling back to 0 (have you made an initial release?)")
set(${major} "0" PARENT_SCOPE)
set(${minor} "0" PARENT_SCOPE)
set(${patch} "0" PARENT_SCOPE)
set(${extra} "" PARENT_SCOPE)
endif(version_valid)
endfunction(version_split)
##############################
# get PROJECT_VERSION from git
##############################
find_program(GIT_CMD git)
mark_as_advanced(GIT_CMD)
if (GIT_CMD)
execute_process(COMMAND ${GIT_CMD} rev-parse --show-toplevel
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TOPLEVEL
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if (GIT_CMD AND NOT "${GIT_TOPLEVEL}" STREQUAL "")
execute_process(COMMAND ${GIT_CMD} rev-parse --short HEAD
WORKING_DIRECTORY ${GIT_TOPLEVEL}
OUTPUT_VARIABLE GIT_SHA1
OUTPUT_STRIP_TRAILING_WHITESPACE)
#message(STATUS "GIT_SHA1: " ${GIT_SHA1})
execute_process(COMMAND ${GIT_CMD} describe --match "*[0-9].[0-9]*" HEAD
WORKING_DIRECTORY ${GIT_TOPLEVEL}
OUTPUT_VARIABLE GIT_DESCRIBE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
#message(STATUS "GIT_DESCRIBE: " ${GIT_DESCRIBE})
# if (GIT_DESCRIBE)
# string(REGEX REPLACE "v?([0-9.]+).*" "\\1" GIT_VERSION ${GIT_DESCRIBE})
# message(STATUS "GIT_VERSION: " ${GIT_VERSION})
# # as package version we use the full version from git describe: 1.7.1+7+ge324c81
# if (GIT_DESCRIBE MATCHES ".*-g.*")
# # convert a git describe string to usable debian version, e.g. v1.7.1-7-ge324c81 to 1.7.1+7+ge324c81
# string(REGEX REPLACE "v?([0-9]*.[0-9.]*).*-([0-9]*)-([a-g0-9]*)" "\\1+\\2+\\3" GIT_FULL_VERSION ${GIT_DESCRIBE})
# else()
# # current HEAD is git tag (i.e. releaase), directly use the version
# set(GIT_FULL_VERSION ${GIT_VERSION})
# endif()
# else ()
# # no (suitable) tag found
# set(GIT_VERSION "0.0.0")
# # get number of commits in repo
# execute_process(COMMAND ${GIT_CMD} rev-list --count HEAD
# WORKING_DIRECTORY ${GIT_TOPLEVEL}
# OUTPUT_VARIABLE GIT_COMMIT_COUNT
# OUTPUT_STRIP_TRAILING_WHITESPACE)
# set(GIT_FULL_VERSION 0.0.0+${GIT_COMMIT_COUNT}+g${GIT_SHA1})
# endif ()
endif ()
# get version from package.xml if it exists
if (EXISTS "${PROJECT_SOURCE_DIR}/package.xml")
file(STRINGS "${PROJECT_SOURCE_DIR}/package.xml" PACKAGE_XML_VERSION_LINE REGEX <version>[0-9.]*</version>)
string(REGEX REPLACE .*<version>\([0-9.]*\)</version>.* \\1 PACKAGE_XML_VERSION "${PACKAGE_XML_VERSION_LINE}")
MESSAGE(STATUS "PACKAGE_XML_VERSION: " ${PACKAGE_XML_VERSION})
endif ()
# set version (if not already manually specified)
# check versions from different sources and set actually used version
if (NOT PROJECT_VERSION)
# set PROJECT_VERSION to MAJOR.MINOR.PATCH
# PACKAGE_VERSION can have extra info
if (GIT_VERSION)
set(PROJECT_VERSION ${GIT_VERSION})
set(PACKAGE_VERSION ${GIT_FULL_VERSION})
elseif (PACKAGE_XML_VERSION)
set(PROJECT_VERSION ${PACKAGE_XML_VERSION})
set(PACKAGE_VERSION ${PROJECT_VERSION})
else ()
message(WARNING "PROJECT_VERSION not set. Defaulting to 0.0.0")
set(PROJECT_VERSION "0.0.0")
endif ()
endif ()
# if (NOT PACKAGE_VERSION)
# message(WARNING "PACKAGE_VERSION not set! Falling back to (${PROJECT_VERSION})")
set(PACKAGE_VERSION ${PROJECT_VERSION})
# endif ()
# warn if versions don't match
if (GIT_VERSION AND NOT GIT_VERSION MATCHES ${PROJECT_VERSION})
message(WARNING "Version from git (${GIT_VERSION}) doesn't match PROJECT_VERSION (${PROJECT_VERSION})")
endif()
if (PACKAGE_XML_VERSION AND NOT PACKAGE_XML_VERSION MATCHES ${PROJECT_VERSION})
message(WARNING "Version from package.xml (${PACKAGE_XML_VERSION}) doesn't match PROJECT_VERSION (${PROJECT_VERSION})")
endif()
message(STATUS "PROJECT_VERSION: " ${PROJECT_VERSION})
message(STATUS "PACKAGE_VERSION: " ${PACKAGE_VERSION})
version_split(${PROJECT_VERSION} PACKAGE_VERSION_MAJOR PACKAGE_VERSION_MINOR PACKAGE_VERSION_PATCH extra)
#message(STATUS "PACKAGE_VERSION_MAJOR: " ${PACKAGE_VERSION_MAJOR})
#message(STATUS "PACKAGE_VERSION_MINOR: " ${PACKAGE_VERSION_MINOR})
#message(STATUS "PACKAGE_VERSION_PATCH: " ${PACKAGE_VERSION_PATCH})
# generate an integer version number: major * 10000 + minor * 100 + patch
math(EXPR PROJECT_VERSION_INT "${PACKAGE_VERSION_MAJOR} * 10000 + ${PACKAGE_VERSION_MINOR} * 100 + ${PACKAGE_VERSION_PATCH}")
# make PROJECT_VERSION available as define in the project source
#add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
#add_definitions(-DPROJECT_VERSION_INT=${PROJECT_VERSION_INT})
#add_definitions(-DPACKAGE_VERSION="${PACKAGE_VERSION}")
#add_definitions(-DPACKAGE_VERSION_MAJOR=${PACKAGE_VERSION_MAJOR})
#add_definitions(-DPACKAGE_VERSION_MINOR=${PACKAGE_VERSION_MINOR})
#add_definitions(-DPACKAGE_VERSION_PATCH=${PACKAGE_VERSION_PATCH})
# set ABI version to major.minor, which will be used for the SOVERSION
set(abiversion "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
# generate a version.h file in the binary output dir, don't forget to install it...
string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER)
# These files provide compile-time and runtime version information about your project.
# To offer the version info to the users of your library, you need to
# adapt the following lines in your respective CMakeLists.txt:
# add_library(<yourlibraryname> SHARED <your code files> ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/project_version.cc)
# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/project_version.h COMPONENT dev DESTINATION include/<your-include-dir>)
# To use it within your library or tests you need to add the include directory:
# > target_include_directories(yourtarget PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME})
configure_file(${CMAKE_CURRENT_LIST_DIR}/project_version.h.in ${PROJECT_NAME}/project_version.h @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/project_version.cc.in ${PROJECT_NAME}/project_version.cc @ONLY)

View File

@ -1,34 +0,0 @@
#ifndef @PROJECT_NAME_UPPER@_VERSION_H_
#define @PROJECT_NAME_UPPER@_VERSION_H_
/// project version as major.minor.patch string
#define @PROJECT_NAME_UPPER@_VERSION "@PROJECT_VERSION@"
/// project version as integer: major * 10000 + minor * 100 + patch
#define @PROJECT_NAME_UPPER@_VERSION_INT @PROJECT_VERSION_INT@
#define @PROJECT_NAME_UPPER@_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@
#define @PROJECT_NAME_UPPER@_VERSION_MINOR @PACKAGE_VERSION_MINOR@
#define @PROJECT_NAME_UPPER@_VERSION_PATCH @PACKAGE_VERSION_PATCH@
/// package version as string, possibly with git commit: v1.2.3+4+g56789abc
#define @PROJECT_NAME_UPPER@_PACKAGE_VERSION "@PACKAGE_VERSION@"
///runtime versions, where the above values are linked into a lib and therefore reflect the version
///of the library itself (not the version of the header at compile time of the user code)
const char* @PROJECT_NAME@_runtime_project_version();
const char* @PROJECT_NAME@_runtime_package_version();
int @PROJECT_NAME@_runtime_version_int();
int @PROJECT_NAME@_runtime_version_major();
int @PROJECT_NAME@_runtime_version_minor();
int @PROJECT_NAME@_runtime_version_patch();
///Check consistency of runtime vs compile-time version number. I.e. the header used
///for compilation was from the same version as the linked library.
inline bool @PROJECT_NAME@_check_version_consistency(bool major_minor_only)
{
return @PROJECT_NAME@_runtime_version_major() == @PROJECT_NAME_UPPER@_VERSION_MAJOR &&
@PROJECT_NAME@_runtime_version_minor() == @PROJECT_NAME_UPPER@_VERSION_MINOR &&
(major_minor_only ||
@PROJECT_NAME@_runtime_version_patch() == @PROJECT_NAME_UPPER@_VERSION_PATCH);
}
#endif

258
cmk.sh
View File

@ -1,258 +0,0 @@
#!/bin/bash
BUILDDIR="build"
HDF5DIR="/opt/hdf5v1.10.0"
HDF5=0
COMPILERTHREADS=0
TEXTCLIENT=0
RECEIVER=0
GUI=0
DEBUG=0
PYTHON=0
TESTS=0
SIMULATOR=0
CTBGUI=0
CLEAN=0
REBUILD=0
CMAKE_PRE=""
CMAKE_POST=""
usage() { echo -e "
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
-[no option]: only make
-c: Clean
-b: Builds/Rebuilds CMake files normal mode
-p: Builds/Rebuilds Python API
-h: Builds/Rebuilds Cmake files with HDF5 package
-d: HDF5 Custom Directory
-t: Build/Rebuilds only text client
-r: Build/Rebuilds only receiver
-g: Build/Rebuilds only gui
-s: Simulator
-u: Chip Test Gui
-j: Number of threads to compile through
-e: Debug mode
-i: Builds tests
Rebuild when you switch to a new build and compile in parallel:
./cmk.sh -bj5
Rebuild python
./cmk.sh -p
For only make:
./cmk.sh
For make clean;make:
./cmk.sh -c
For using hdf5 without default dir /opt/hdf5v1.10.0:
./cmk.sh -h
For using hdf5 without custom dir /blabla:
./cmk.sh -h -d /blabla
For rebuilding cmake without hdf5 (Use this if you had previously run with hdf5 and now you dont want it)
./cmk.sh -b
For using multiple cores to compile faster:
(all these options work)
./cmk.sh -j9
./cmk.sh -cj9 #with clean
./cmk.sh -hj9 #with hdf5
./cmk.sh -j9 -h #with hdf
For rebuilding only certain sections
./cmk.sh -tg #only text client and gui
./cmk.sh -r #only receiver
" ; exit 1; }
while getopts ":bpchd:j:trgeisu" opt ; do
case $opt in
b)
echo "Building of CMake files Required"
REBUILD=1
;;
p)
echo "Compiling Options: Python"
PYTHON=1
REBUILD=1
;;
c)
echo "Clean Required"
CLEAN=1
;;
h)
echo "Building of CMake files with HDF5 option Required"
HDF5=1
REBUILD=1
;;
d)
echo "New HDF5 directory: $OPTARG"
HDF5DIR=$OPTARG
;;
j)
echo "Number of compiler threads: $OPTARG"
COMPILERTHREADS=$OPTARG
;;
t)
echo "Compiling Options: Text Client"
TEXTCLIENT=1
REBUILD=1
;;
r)
echo "Compiling Options: Receiver"
RECEIVER=1
REBUILD=1
;;
g)
echo "Compiling Options: GUI"
GUI=1
REBUILD=1
;;
e)
echo "Compiling Options: Debug"
DEBUG=1
;;
i)
echo "Compiling Options: Tests"
TESTS=1
;;
s)
echo "Compiling Options: Simulator"
SIMULATOR=1
;;
u)
echo "Compiling Options: Chip Test Gui"
CTBGUI=1
;;
\?)
echo "Invalid option: -$OPTARG"
usage
exit 1
;;
:)
echo "Option -$OPTARG requires an argument."
usage
exit 1
;;
esac
done
#python
if [ $PYTHON -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_PYTHON=ON "
echo "Enabling Compile Option: Python"
fi
if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
#CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=ON "
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=OFF "
echo "Enabling Compile Option: TextClient, Receiver and GUI"
else
if [ $TEXTCLIENT -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=OFF "
echo "Enabling Compile Option: TextClient"
fi
if [ $RECEIVER -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_RECEIVER=ON "
echo "Enabling Compile Option: Receiver"
fi
if [ $GUI -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_GUI=ON "
echo "Enabling Compile Option: GUI"
fi
fi
#build dir doesnt exist
if [ ! -d "$BUILDDIR" ] ; then
echo "No Build Directory. Building of Cmake files required"
mkdir $BUILDDIR;
REBUILD=1
else
#rebuild not requested, but no makefile
if [ $REBUILD -eq 0 ] && [ ! -f "$BUILDDIR/Makefile" ] ; then
echo "No Makefile. Building of Cmake files required"
REBUILD=1
fi
fi
#Debug
if [ $DEBUG -eq 1 ]; then
# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
echo "Debug Option enabled"
fi
#Simulator
if [ $SIMULATOR -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_SIMULATOR=ON "
echo "Simulator Option enabled"
fi
#Chip Test Gui
if [ $CTBGUI -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_CTBGUI=ON "
echo "CTB Gui Option enabled"
fi
#Tests
if [ $TESTS -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_TESTS=ON -DSLS_USE_INTEGRATION_TESTS=ON"
echo "Tests Option enabled"
fi
#hdf5 rebuild
if [ $HDF5 -eq 1 ]; then
# CMAKE_PRE+="HDF5_ROOT="$HDF5DIR
CMAKE_POST+=" -DCMAKE_INSTALL_PREFIX="$HDF5DIR
CMAKE_POST+=" -DSLS_USE_HDF5=ON "
#normal mode rebuild
else
CMAKE_POST+=" -DSLS_USE_HDF5=OFF "
fi
#enter build dir
cd $BUILDDIR;
echo "in "$PWD
#cmake
if [ $REBUILD -eq 1 ]; then
rm -f CMakeCache.txt
BUILDCOMMAND="$CMAKE_PRE cmake3 $CMAKE_POST .."
echo $BUILDCOMMAND
eval $BUILDCOMMAND
fi
#make clean
if [ $CLEAN -eq 1 ]; then
make clean;
fi
#make
if [ $COMPILERTHREADS -gt 0 ]; then
BUILDCOMMAND="make -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
else
make
fi

15
commitVersions.sh Normal file
View File

@ -0,0 +1,15 @@
sh updateSvnVersion.sh
cd slsDetectorGui
git commit -a -m "updating versions"
git push origin developer:developer
cd ../slsDetectorSoftware
git commit -a -m "updating versions"
git push origin developer:developer
cd ../slsReceiverSoftware
git commit -a -m "updating versions"
git push origin developer:developer
cd ..

View File

@ -1,20 +0,0 @@
mkdir build
mkdir install
cd build
cmake .. \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DCMAKE_INSTALL_PREFIX=install \
-DSLS_USE_TEXTCLIENT=ON \
-DSLS_USE_RECEIVER=ON \
-DSLS_USE_GUI=ON \
-DSLS_USE_TESTS=ON \
-DSLS_USE_PYTHON=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DSLS_USE_HDF5=OFF\
cmake --build . -- -j10
cmake --build . --target install
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2

View File

@ -1,4 +0,0 @@
echo "|<-------- starting python build"
cd python
${PYTHON} setup.py install

View File

@ -1,7 +0,0 @@
python:
- 3.6
- 3.7
- 3.8
numpy:
- 1.17

View File

@ -1,9 +0,0 @@
mkdir $PREFIX/lib
mkdir $PREFIX/bin
mkdir $PREFIX/include
cp build/bin/ctbGui $PREFIX/bin/.
cp build/bin/libctbRootLib.so $PREFIX/lib/.

View File

@ -1,3 +0,0 @@
#Copy the GUI
mkdir $PREFIX/bin
cp build/bin/slsDetectorGui $PREFIX/bin/.

View File

@ -1,22 +0,0 @@
mkdir $PREFIX/lib
mkdir $PREFIX/bin
mkdir $PREFIX/include
mkdir $PREFIX/include/slsDetectorPackage
#Shared and static libraries
cp build/bin/libSlsDetector.so $PREFIX/lib/.
cp build/bin/libSlsReceiver.so $PREFIX/lib/.
cp build/bin/libSlsSupport.so $PREFIX/lib/.
#Binaries
cp build/bin/sls_detector_acquire $PREFIX/bin/.
cp build/bin/sls_detector_get $PREFIX/bin/.
cp build/bin/sls_detector_put $PREFIX/bin/.
cp build/bin/sls_detector_help $PREFIX/bin/.
cp build/bin/slsReceiver $PREFIX/bin/.
cp build/bin/slsMultiReceiver $PREFIX/bin/.
#Which headers do we need for development??
cp build/install/include/* $PREFIX/include/slsDetectorPackage/
# cp include/some_lib.h $PREFIX/include/.

View File

@ -1,96 +0,0 @@
package:
name: sls_detector_software
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
source:
- path: ..
build:
number: 2
binary_relocation: True
rpaths:
- lib/
requirements:
build:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- cmake
- qwt 6.*
- qt 4.8.*
- zeromq
- xorg-libx11
- xorg-libice
- xorg-libxext
- xorg-libsm
- xorg-libxau
- xorg-libxrender
- xorg-libxfixes
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-libegl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libselinux') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
host:
- libstdcxx-ng
- libgcc-ng
- xorg-libx11
- xorg-libice
- xorg-libxext
- xorg-libsm
- xorg-libxau
- xorg-libxrender
- xorg-libxfixes
run:
- libstdcxx-ng
- libgcc-ng
outputs:
- name: slsdetlib
script: copy_lib.sh
requirements:
run:
- libstdcxx-ng
- libgcc-ng
- zeromq
- name: slsdet
script: build_pylib.sh
requirements:
build:
- python
- {{ compiler('c') }}
- {{compiler('cxx')}}
- {{ pin_subpackage('slsdetlib', exact=True) }}
- setuptools
host:
- python
run:
- libstdcxx-ng
- libgcc-ng
- python
- numpy
- {{ pin_subpackage('slsdetlib', exact=True) }}
test:
imports:
- slsdet
- name: slsdetgui
script: copy_gui.sh
requirements:
run:
- {{ pin_subpackage('slsdetlib', exact=True) }}
- qwt 6.*
- qt 4.8.*

View File

@ -1 +0,0 @@
ctest -j2

58
configure vendored Executable file
View File

@ -0,0 +1,58 @@
##!/bin/bash
: ${INSTALLROOT=$PWD}
read -p "Installation directory [default:\"$INSTALLROOT\"]:" -e t3
if [ -z "$t3" ]
then
echo
else
INSTALLROOT=$t3
fi
echo "INSTALLROOT will be \"$INSTALLROOT\""
export INSTALLROOT
: ${BINDIR="bin"}
read -p "Binaries directory [default:\"$BINDIR\"]:" -e t4
if [ -z "$t4" ]
then
BINDIR=$INSTALLROOT/$BINDIR
else
BINDIR=$INSTALLROOT/$t4
fi
echo "BINDIR will be \"$BINDIR\""
export BINDIR
: ${LIBDIR="bin"}
read -p "Libraries directory [default:\"$LIBDIR\"]:" -e t5
if [ -z "$t5" ]
then
LIBDIR=$INSTALLROOT/$LIBDIR
else
LIBDIR=$INSTALLROOT/$t5
fi
echo "LIBDIR will be \"$LIBDIR\""
export LIBDIR
: ${INCDIR="include"}
read -p "Includes directory [default:\"$INCDIR\"]:" -e t6
if [ -z "$t6" ]
then
INCDIR=$INSTALLROOT/$INCDIR
else
INCDIR=$INSTALLROOT/$t6
fi
echo "INCDIR will be \"$INCDIR\""
export INCDIR
: ${DOCDIR="doc"}
read -p "Documentation directory [default:\"$DOCDIR\"]:" -e t7
if [ -z "$t7" ]
then
DOCDIR=$INSTALLROOT/$DOCDIR
else
DOCDIR=$INSTALLROOT/$t7
fi
echo "DOCDIR will be \"$DOCDIR\""
export DOCDIR

View File

@ -1,89 +0,0 @@
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.cpp
)
#TODO! Replace with target
target_include_directories(ctbGui PRIVATE
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/interpolations
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/
)
# 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
include("${ROOT_DIR}/modules/RootNewMacros.cmake")
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
slsSupportLib
${ROOT_LIBRARIES}
${ROOT_EXE_LINKER_FLAGS}
)
set_target_properties(
ctbRootLib PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
target_link_libraries(ctbGui PUBLIC
slsDetectorShared
slsSupportLib
ctbRootLib
${TIFF_LIBRARIES}
)
set_target_properties(ctbGui PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

View File

@ -1,44 +0,0 @@
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)

View File

@ -1,46 +0,0 @@
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)

File diff suppressed because it is too large Load Diff

View File

@ -1,246 +0,0 @@
#ifndef CTBACQUISITION_H
#define CTBACQUISITION_H
#include <TGFrame.h>
#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 dataType> class slsDetectorData;
class singlePhotonDetector;
//class singlePhotonDetector;
class commonModeSubtraction;
#include <string>
#include <stdint.h>
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 <int> dbitlist;
std::vector <int> 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<uint16_t> *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(detectorData*, long unsigned int, unsigned int, void*);
int StopFlag;
int plotData(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

View File

@ -1,614 +0,0 @@
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <TGFileDialog.h>
#include <TGComboBox.h>
#include <TH2F.h>
#include <TColor.h>
#include <TH1F.h>
#include <TGraphErrors.h>
#include <TGColorSelect.h>
#include <THStack.h>
#include <TGTab.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "ctbAdcs.h"
#include "ctbDefs.h"
#include "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<<id;
// ToggledAdcPlot(mask);
cout << "Colsel " << id << " enable " << b << endl;
if (b)
fColorSel->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; idac<NADCS; idac++) {
if (idac%16==0) {
vframe=new TGVerticalFrame(hhframe, 400,800);
hhframe->AddFrame(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; is<NADCS; is++) {
sAdc[is]->setAdcAlias(NULL,-1,-1);
if (invreg & (1<<is) )
sAdc[is]->setInverted(kTRUE);
else
sAdc[is]->setInverted(kFALSE);
if (disreg & (1<<is) )
sAdc[is]->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; is<NADCS; is++){
sAdc[is]->setPlot(kTRUE);
}
}
void ctbAdcs::RemoveAll() {
for (int is=0; is<NADCS; is++) {
sAdc[is]->setPlot(kFALSE);
}
}
void ctbAdcs::CheckHalf0() {
for (int is=0; is<NADCS/2; is++) {
sAdc[is]->setPlot(kTRUE);
}
}
void ctbAdcs::RemoveHalf0() {
for (int is=0; is<NADCS/2; is++){
sAdc[is]->setPlot(kFALSE);
}
}
void ctbAdcs::CheckHalf1() {
for (int is=NADCS/2; is<NADCS; is++){
sAdc[is]->setPlot(kTRUE);
}
}
void ctbAdcs::RemoveHalf1() {
for (int is=NADCS/2; is<NADCS; is++){
sAdc[is]->setPlot(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 && is<NADCS) {
sAdc[is]->setAdcAlias(tit,plot,color);
}
return is;
}
string ctbAdcs::getAdcAlias() {
ostringstream line;
for (int is=0; is<NADCS; is++)
line << sAdc[is]->getAdcAlias();
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<<b;
if (sAdc[b]->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<<b;
if (sAdc[b]->getInverted())
oreg|=m;
else
oreg&=~m;
setInvert(oreg);
}
Pixel_t ctbAdcs::getColor(int i){
if (i>=0 && i<NADCS)
return sAdc[i]->getColor();
return static_cast<Pixel_t>(-1);
}
Bool_t ctbAdcs::getEnabled(int i){
if (i>=0 && i<NADCS)
return sAdc[i]->getEnabled();
return static_cast<Bool_t>(-1);
}
Bool_t ctbAdcs::getEnable(int i){
if (i>=0 && i<NADCS)
return sAdc[i]->getEnable();
return static_cast<Bool_t>(-1);
}
Bool_t ctbAdcs::getPlot(int i){
if (i>=0 && i<NADCS)
return sAdc[i]->getPlot();
return static_cast<Bool_t>(-1);
}

View File

@ -1,155 +0,0 @@
#ifndef CTBADCS_H
#define CTBADCS_H
#include <TGFrame.h>
#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 <string>
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

View File

@ -1,233 +0,0 @@
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <TGTextEntry.h>
#include <TGLabel.h>
#include <TGNumberEntry.h>
#include <TGButton.h>
#include "ctbDacs.h"
#include "ctbDefs.h"
#include "Detector.h"
#include "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<int>(moenchDacIndices[id]);
}
void ctbDac::setValue(Long_t a) {setValue();}
void ctbDac::setValue() {
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
try {
int sid = id;
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
sid = getMoenchDacId();
}
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(sid), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
} 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<slsDetectorDefs::dacIndex>(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<slsDetectorDefs::dacIndex>(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; idac<NDACS; idac++) {
dacs[idac]=new ctbDac(this, idac, myDet);
}
dacs[NDACS]=new ctbDac(this, slsDetectorDefs::ADC_VPP, myDet);
dacs[NDACS+1]=new ctbDac(this, slsDetectorDefs::HIGH_VOLTAGE, myDet);
dacs[NDACS]->setLabel((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 && is<NDACS)
dacs[is]->setLabel(tit,mv);
return is;
}
string ctbDacs::getDacAlias() {
ostringstream line;
for (int i=0; i<NDACS; i++)
line << dacs[i]->getLabel() << endl;
return line.str();
}
string ctbDacs::getDacParameters() {
ostringstream line;
for (int i=0; i<NDACS; i++) {
//line << "dacs:" << i << " " << dacs[i]->getValue << endl;
line << "dac:" << i << " " << dacs[i]->getValue() << endl;
}
return line.str();
}
void ctbDacs::update() {
for (int idac=0; idac<NDACS+1; idac++) {
dacs[idac]->getValue();
}
}

View File

@ -1,75 +0,0 @@
#ifndef CTBDACS_H
#define CTBDACS_H
#include <TGFrame.h>
#define NDACS 18
//#define NDACS 16
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TGCheckButton;
namespace sls
{
class Detector;
};
#include <string>
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

View File

@ -1,84 +0,0 @@
#pragma once
#include <string>
#include <stdexcept>
#include <chrono>
//#include "sls_detector_exceptions.h"
//#include "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<nanoseconds>(duration<double>(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<duration<double>>(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 <class CT> struct NonDeduced { using type = CT; };
template <class S, typename RT, typename... CT>
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
RT (S::*somefunc)(CT...),
typename NonDeduced<CT>::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);
};
};

View File

@ -1,157 +0,0 @@
#include <TApplication.h>
#include <TColor.h>
#include <TStyle.h>
#include <TROOT.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include "Detector.h"
#include "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; ia<argc; ia++) {
if (strcmp(argv[ia],"-alias")==0) {
if (ia+1<argc) {
afname=argv[ia+1];
ia++;
af=1;
}
} else if (strcmp(argv[ia],"-config")==0) {
if (ia+1<argc) {
cfname=argv[ia+1];
ia++;
cf=1;
}
} else if (strcmp(argv[ia],"-par")==0) {
if (ia+1<argc) {
pfname=argv[ia+1];
ia++;
pf=1;
}
} else if (strcmp(argv[ia],"-id")==0) {
if (ia+1<argc) {
id=atoi(argv[ia+1]);
ia++;
}
}
}
cout << " *** " << endl;
sls::Detector *myDet = nullptr;
try {
/****** Create detector ****************/
myDet=new sls::Detector(id);
cout << "Created multi detector id " << id << endl;
if (cf) {
myDet->loadConfig(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; ia<argc; ia++)
cout << argv[ia] << endl;
cout << " *** " << endl;
if (af)
mf->loadAlias(afname);
else
cout << "no alias specified" << endl;
theApp.Run();
return 0;
}

View File

@ -1,15 +0,0 @@
#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;

View File

@ -1,586 +0,0 @@
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <TGFileDialog.h>
#include <TGComboBox.h>
#include <TH2F.h>
#include <TColor.h>
#include <TH1F.h>
#include <TGraphErrors.h>
#include <THStack.h>
#include <TGTab.h>
#include <TApplication.h>
#include <TGCanvas.h>
#include <stdlib.h>
#include <TGMenu.h>
#include <TGDockableFrame.h>
//#include <TGMenuBar.h>
//#include <TGPopupMenu.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include "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);
}

View File

@ -1,128 +0,0 @@
#ifndef CTBMAIN_H
#define CTBMAIN_H
#include <TGFrame.h>
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 <string>
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

File diff suppressed because it is too large Load Diff

View File

@ -1,179 +0,0 @@
#ifndef CTBPATTERN_H
#define CTBPATTERN_H
#include <TGFrame.h>
#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 <string>
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

View File

@ -1,223 +0,0 @@
#include <TGFrame.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "ctbDefs.h"
#include "ctbDacs.h"
#include "ctbPowers.h"
#include "Detector.h"
#include "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<slsDetectorDefs::dacIndex>(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<slsDetectorDefs::dacIndex>(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<int>(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; idac<NPOWERS; idac++) {
dacs[idac]=new ctbPower(this, slsDetectorDefs::V_POWER_A+idac, myDet);
}
}
int ctbPowers::setPwrAlias(string line) {
int is=-1;
char tit[100];
if (sscanf(line.c_str(),"VA %s",tit)) {
dacs[0]->setLabel(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; i<NPOWERS; i++)
line << dacs[i]->getLabel() << 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; i<POWERS; i++) {
// //line << "dacs:" << i << " " << dacs[i]->getValue << endl;
// line << "dac:" << i << " " << dacs[i]->getValue() << endl;
// }
return line.str();
}
void ctbPowers::update() {
for (int idac=0; idac<NPOWERS; idac++) {
dacs[idac]->getValue();
}
}

View File

@ -1,67 +0,0 @@
#ifndef CTBPOWERS_H
#define CTBPOWERS_H
#include <TGFrame.h>
#define NPOWERS 6
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TGCheckButton;
namespace sls
{
class Detector;
};
#include <string>
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

View File

@ -1,531 +0,0 @@
#include <TApplication.h>
#include <TGClient.h>
#include <TCanvas.h>
#include <TF1.h>
#include <TRandom.h>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <TList.h>
#include <TGFileDialog.h>
#include <TGComboBox.h>
#include <TH2F.h>
#include <TColor.h>
#include <TH1F.h>
#include <TGraphErrors.h>
#include <THStack.h>
#include <TGTab.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <TGButton.h>
#include <TRootEmbeddedCanvas.h>
#include <TGButtonGroup.h>
#include <TGNumberEntry.h>
#include <TGLabel.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <TColor.h>
#include <TGColorSelect.h>
#include "ctbSignals.h"
#include "ctbDefs.h"
#include "Detector.h"
using namespace std;
//#define DEFAULTFN "run_0.encal"
ctbSignal::ctbSignal(TGFrame *page, int i, sls::Detector *det)
: TGHorizontalFrame(page, 800,50), myDet(det), id(i), hsig(NULL) {
TGHorizontalFrame *hframe=this;
char tit[100];
sprintf(tit, "BIT%d ",id);
sLabel= new TGLabel(hframe, tit);
hframe->AddFrame( sLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sLabel->MapWindow();
sLabel->SetTextJustify(kTextLeft);
sOutput= new TGCheckButton(hframe, "Out");
hframe->AddFrame( sOutput,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sOutput->MapWindow();
sOutput->Connect("Toggled(Bool_t)","ctbSignal",this,"ToggledOutput(Bool_t)");
sDbitList= new TGCheckButton(hframe, "DB List");
hframe->AddFrame( sDbitList,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sDbitList->MapWindow();
sDbitList->Connect("Toggled(Bool_t)","ctbSignal",this,"ToggledDbitList(Bool_t)");
sPlot= new TGCheckButton(hframe, "Plot");
hframe->AddFrame( sPlot,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
sPlot->MapWindow();
sPlot->Connect("Toggled(Bool_t)","ctbSignal",this,"ToggledPlot(Bool_t)");
fColorSel = new TGColorSelect(hframe, id+1, 0);
fColorSel->Connect("ColorSelected(Pixel_t)","ctbSignal",this,"ColorChanged(Pixel_t)");
hframe->AddFrame(fColorSel, new TGLayoutHints(kLHintsTop |
kLHintsLeft, 2, 0, 2, 2));
fColorSel->SetColor(TColor::Number2Pixel(id+1));
ToggledOutput(kFALSE);
ToggledPlot(kFALSE);
// if (id==63) {
// sOutput->SetOn(kTRUE);
// sOutput->SetEnabled(kFALSE);
// }
// #ifdef CTB
// if (id==62) {
// sOutput->SetOn(kTRUE);
// sOutput->SetEnabled(kFALSE);
// }
// // if (id>=32 && id<48)
// // fixOutput(1);
// // else if (id>=48 && id<64)
// // fixOutput(0);
// #endif
}
int ctbSignal::setSignalAlias(char *tit, int plot, int col) {
if (tit)
sLabel->SetText(tit);
if (plot>0) {
sPlot->SetOn(kTRUE,kTRUE);
} else if (plot==0)
sPlot->SetOn(kFALSE,kTRUE);
if (col>=0)
fColorSel->SetColor(col);//TColor::Number2Pixel(col+1));
fColorSel->SetEnabled(sPlot->IsOn());
return 0;
}
string ctbSignal::getSignalAlias() {
ostringstream oss;
oss << "BIT" << dec << id << " " << sLabel->GetText()->Data() << " " << sPlot->IsOn() << hex << " " << fColorSel->GetColor() << endl;
return oss.str();
}
int ctbSignal::setOutput(Long64_t r) {
// cout << hex << r << dec <<endl;
Long64_t mask=((Long64_t)1<<id);
if (r&mask)
sOutput->SetOn(kTRUE,kTRUE);
else
sOutput->SetOn(kFALSE,kTRUE);
return sOutput->IsOn();
}
int ctbSignal::fixOutput(int i) {
if (i) {
sPlot->SetOn(kFALSE);
//sClock->SetOn(kFALSE,kTRUE);
sOutput->SetOn(kTRUE);
// sPlot->SetEnabled(kFALSE);
// sClock->SetEnabled(kTRUE);
} else {
sOutput->SetOn(kFALSE,kTRUE);
// sClock->SetOn(kFALSE);
// sClock->SetEnabled(kFALSE);
sPlot->SetEnabled(kTRUE);
}
sOutput->SetEnabled(kFALSE);
return 0;
}
int ctbSignal::setDbitList(Long64_t r) {
if (r)
sDbitList->SetOn(kTRUE,kFALSE);
else
sDbitList->SetOn(kFALSE,kFALSE);
return sDbitList->IsOn();
}
int ctbSignal::isDbitList() { return sDbitList->IsOn();}
int ctbSignal::isOutput() { return sOutput->IsOn();}
int ctbSignal::isPlot() { return sPlot->IsOn();}
Pixel_t ctbSignal::getColor(){return fColorSel->GetColor();}
void ctbSignal::ToggledOutput(Bool_t b) {
ToggledSignalOutput(id);
if (b) {
// sClock->SetEnabled(kTRUE);
sPlot->SetOn(kFALSE);
// sPlot->SetEnabled(kFALSE);
fColorSel->SetEnabled(kFALSE);
} else {
// sClock->SetEnabled(kFALSE);
// sClock->SetOn(kFALSE);
sPlot->SetEnabled(kTRUE);
if ( sPlot->IsOn())
fColorSel->SetEnabled(kFALSE);
else
fColorSel->SetEnabled(kTRUE);
}
}
void ctbSignal::ToggledDbitList(Bool_t b){
Long_t mask=id;
ToggledSignalDbitList(mask);
}
void ctbSignal::ToggledPlot(Bool_t b){
Long_t mask=b<<id;
ToggledSignalPlot(mask);
fColorSel->SetEnabled(b);
}
void ctbSignal::ColorChanged(Pixel_t p){
ToggledSignalPlot(id);
}
void ctbSignal::ToggledSignalOutput(Int_t b) {
cout << "Toggle signal " << id << " " << b << " " << sOutput->IsOn() <<endl;;
Emit("ToggledSignalOutput(Int_t)", id);
}
void ctbSignal::ToggledSignalDbitList(Int_t b){
cout << "Toggle dbitlist " << id << " " << b << endl;;
Emit("ToggledSignalDbitList(Int_t)", id);
}
void ctbSignal::ToggledSignalPlot(Int_t b){
Emit("ToggledSignalPlot(Int_t)", id);
}
ctbSignals::ctbSignals(TGVerticalFrame *page, sls::Detector *det)
: TGGroupFrame(page,"IO Signals",kVerticalFrame), myDet(det) {
SetTitlePos(TGGroupFrame::kLeft);
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
MapWindow();
TGHorizontalFrame *hframe;
TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
AddFrame(hhframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hhframe->MapWindow();
TGVerticalFrame *vframe;
int idac=0;
for (idac=0; idac<NSIGNALS; idac++) {
if (idac%((NSIGNALS+2)/2)==0) {
vframe=new TGVerticalFrame(hhframe, 400,800);
hhframe->AddFrame(vframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
vframe->MapWindow();
}
signals[idac]=new ctbSignal(vframe,idac,myDet);
signals[idac]->Connect("ToggledSignalOutput(Int_t)","ctbSignals",this,"ToggledOutReg(Int_t)");
signals[idac]->Connect("ToggledSignalDbitList(Int_t)","ctbSignals",this,"ToggledDbitList(Int_t)");
signals[idac]->Connect("ToggledSignalPlot(Int_t)","ctbSignals",this,"ToggledPlot(Int_t)");
vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
signals[idac]->MapWindow();
}
hframe=new TGHorizontalFrame(vframe, 800,50);
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
TGLabel *label= new TGLabel(hframe, "IO Control Register: ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eIOCntrlRegister = new TGNumberEntry(hframe, 0, 16,999, TGNumberFormat::kNESHex,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame(eIOCntrlRegister,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eIOCntrlRegister->MapWindow();
eIOCntrlRegister->Resize(150,30);
hframe=new TGHorizontalFrame(vframe, 800,50);
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
hframe->MapWindow();
label= new TGLabel(hframe, "DBit Offset: ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
label->MapWindow();
label->SetTextJustify(kTextLeft);
eDbitOffset = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELNoLimits);
hframe->AddFrame(eDbitOffset,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eDbitOffset->MapWindow();
eDbitOffset->Resize(150,30);
TGTextEntry *e= eDbitOffset->TGNumberEntry::GetNumberEntry();
e->Connect("ReturnPressed()","ctbSignals",this,"setDbitOffset()");
e->Connect("ValueSet(Long_t)","ctbSignals",this,"setDbitOffset(Long_t)");
}
int ctbSignals::setSignalAlias(string line) {
int is=-1, plot=0, col=-1;
char tit[100];
int narg=sscanf(line.c_str(),"BIT%d %s %d %d",&is,tit,&plot,&col);
if (narg<2)
return -1;
if (is>=0 && is<NIOSIGNALS) {
signals[is]->setSignalAlias(tit,plot,col);
}
return is;
}
string ctbSignals::getSignalAlias() {
ostringstream oss;
for (int is=0; is<NIOSIGNALS; is++)
oss << signals[is]->getSignalAlias() << endl;
return oss.str();
}
void ctbSignals::update() {
try {
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
cout << hex << oreg << dec << endl;
for (int idac=0; idac<NIOSIGNALS; idac++) {
signals[idac]->setOutput(oreg);
}
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::update")
try {
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
// enable all
if (dbitlist.empty()) {
for (int is=0; is<64; is++) {
signals[is]->setDbitList(1);
}
}
else {
// disable all
for (int is=0; is<64; is++) {
signals[is]->setDbitList(0);
}
// enable selected
for (const auto &value : dbitlist) {
signals[value]->setDbitList(1);
}
}
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbSignals::update")
try {
auto val = myDet->getRxDbitOffset().tsquash("Different values");
eDbitOffset->SetNumber(val);
} CATCH_DISPLAY ("Could not get receiver dbit offset.", "ctbSignals::update")
}
string ctbSignals::getSignalParameters() {
try {
auto val = myDet->getPatternIOControl().tsquash("Different values");
ostringstream line;
line << "patioctrl " << hex << val << dec << endl;
return line.str();
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::getSignalParameters")
return ("");
}
void ctbSignals::ToggledOutReg(Int_t mask) {
try {
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
Long64_t m=((Long64_t)1)<<mask;
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg;
if (signals[mask]->isOutput()) {
cout << " or " << m ;
oreg|=m;
} else {
cout << " not " << ~m ;
oreg&=~m;
}
cout << " after " << oreg << endl;
myDet->setPatternIOControl(static_cast<uint64_t>(oreg));
oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
eIOCntrlRegister->SetText(to_string(oreg).c_str());
} CATCH_DISPLAY ("Could not get/set patternIOcontrol.", "ctbSignals::ToggledOutReg")
}
void ctbSignals::ToggledDbitList(Int_t mask){
try {
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
// anyway all enabled
if ((dbitlist.empty()) && (signals[mask]->isDbitList())) {
;
}
// set the dbitlist
else {
std::vector <int> new_dbitlist;
for (int is=0; is<64; is++) {
if (signals[is]->isDbitList()){
new_dbitlist.push_back(is);
cout << is << " " << new_dbitlist.size() - 1 << endl;
}
}
if (new_dbitlist.size() > 64)
new_dbitlist.clear();
myDet->setRxDbitList(new_dbitlist);
// get list again
dbitlist = myDet->getRxDbitList().tsquash("Different values");
}
// enable all
if (dbitlist.empty()) {
for (int is=0; is<64; is++) {
signals[is]->setDbitList(1);
}
}
else {
// disable all
for (int is=0; is<64; is++) {
signals[is]->setDbitList(0);
}
// enable selected
for (const auto &value : dbitlist) {
signals[value]->setDbitList(1);
}
}
} CATCH_DISPLAY ("Could not get/set receiver dbit list.", "ctbSignals::ToggledDbitList")
}
void ctbSignals::ToggledPlot(Int_t b) {
Emit("ToggledSignalPlot(Int_t)", b);
}
void ctbSignals::ToggledSignalPlot(Int_t b) {
Emit("ToggledSignalPlot(Int_t)", b);
}
Pixel_t ctbSignals::getColor(int i){
if (i>=0 && i<NSIGNALS)
return signals[i]->getColor();
return static_cast<Pixel_t>(-1);
}
int ctbSignals::getPlot(int i){
if (i>=0 && i<NSIGNALS)
return signals[i]->isPlot();
return -1;
};
void ctbSignals::setDbitOffset(Long_t) {
setDbitOffset();
}
void ctbSignals::setDbitOffset(){
try {
myDet->setRxDbitOffset(eDbitOffset->GetNumber());
} CATCH_DISPLAY ("Could not set receiver dbit offset.", "ctbSignals::setDbitOffset")
}

View File

@ -1,121 +0,0 @@
#ifndef CTBSIGNALS_H
#define CTBSIGNALS_H
#include <TGFrame.h>
#define NSIGNALS 64
#define NIOSIGNALS 64 //for moench board was 52
#define ADCLATCH 63
#define DIGSIGLATCH 62
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TGCheckButton;
class TH1I;
class TGTextButton;
class TGColorSelect;
class TGNumberEntry;
namespace sls
{
class Detector;
};
class ctbSignal;
#include <string>
using namespace std;
class ctbSignal : public TGHorizontalFrame {
// RQ_OBJECT("ctbSignal")
private:
TGLabel *sLabel;
TGCheckButton *sOutput;
TGCheckButton *sDbitList;
TGCheckButton *sPlot;
TGLabel *sValue;
TGNumberEntry *sEntry;
TGColorSelect *fColorSel;
sls::Detector *myDet;
Int_t id;
TH1I *hsig;
public:
ctbSignal(TGFrame *page, int i, sls::Detector *det);
int setSignalAlias(char *tit, int plot, int col);
string getSignalAlias();
TH1I *getPlot() {return hsig;};
int setOutput(Long64_t);
int fixOutput(int);
int setDbitList(Long64_t);
void ToggledOutput(Bool_t);
void ToggledDbitList(Bool_t);
void ToggledPlot(Bool_t);
void ColorChanged(Pixel_t);
int isDbitList();
int isOutput();
int isPlot();
Pixel_t getColor();
void ToggledSignalOutput(Int_t); //*SIGNAL*
void ToggledSignalDbitList(Int_t); //*SIGNAL*
void ToggledSignalPlot(Int_t); //*SIGNAL*
ClassDef(ctbSignal,0)
};
class ctbSignals : public TGGroupFrame {
private:
ctbSignal *signals[NSIGNALS];
TGNumberEntry *eIOCntrlRegister;
TGNumberEntry *eDbitOffset;
sls::Detector *myDet;
public:
ctbSignals(TGVerticalFrame *page, sls::Detector *det);
int setSignalAlias(string line);
string getSignalAlias();
int getPlot(int);
Pixel_t getColor(int);
void update();
// void saveParameters();
string getSignalParameters();
//void setDbitList(Int_t);
void setDbitOffset(Long_t);
void setDbitOffset();
void ToggledOutReg(Int_t);
void ToggledDbitList(Int_t);
void ToggledPlot(Int_t);
void ToggledSignalPlot(Int_t); //*SIGNAL*
ClassDef(ctbSignals,0)
};
#endif

View File

@ -1,182 +0,0 @@
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <TGTextEntry.h>
#include <TGLabel.h>
#include <TGNumberEntry.h>
#include <TGButton.h>
#include "ctbSlowAdcs.h"
#include "ctbDefs.h"
#include "Detector.h"
#include "sls_detector_defs.h"
using namespace std;
ctbSlowAdc::ctbSlowAdc(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, "SENSE %d:",idac-1000);
dacsLabel= new TGLabel(hframe, tit);// new TGLabel(hframe, tit);
hframe->AddFrame(dacsLabel,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
dacsLabel->MapWindow();
dacsLabel->SetTextJustify(kTextLeft);
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);
TGTextButton *b= new TGTextButton(hframe, "Update");
hframe->AddFrame( b,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
b->MapWindow();
b->SetTextJustify(kTextLeft);
b->Connect("Clicked()","ctbSlowAdc",this,"getValue()");
}
int ctbSlowAdc::setLabel(char *tit) {
if(tit)
dacsLabel->SetText(tit);
return id;
}
string ctbSlowAdc::getLabel() {
ostringstream line;
line << dacsLabel->GetText() << endl;
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
return line.str();
}
int ctbSlowAdc::getValue() {
try {
std::string s;
// temp
if (id == static_cast<int>(slsDetectorDefs::SLOW_ADC_TEMP)) {
int val = myDet->getTemperature(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
cout << "slow adc temp" << " " << val << endl;
s = to_string(val) + " " + to_string(0x00b0) + "C";//<2F>C
dacsValue->SetText(s.c_str());
return val;
}
// mv
else {
int val = myDet->getSlowADC(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
cout << "slow adc " << id << " " << val << endl;
s = to_string(val) + " mV";
dacsValue->SetText(s.c_str());
return val;
}
} CATCH_DISPLAY ("Could not get slow dac " + to_string(id) + ".", "ctbSlowAdc::getValue")
return -1;
}
ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Sense",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; idac<NSLOWADCS + 1; idac++) {
adcs[idac]=new ctbSlowAdc(this, idac+1000, myDet);
}
adcs[NSLOWADCS]->setLabel((char*)"Temperature");
}
int ctbSlowAdcs::setSlowAdcAlias(string line) {
int is=-1, mv=0;
char tit[100];
int narg=sscanf(line.c_str(),"SENSE%d %s %d",&is,tit,&mv);
if (narg<2)
return -1;
if (is>=0 && is<NSLOWADCS)
adcs[is]->setLabel(tit);
return is;
}
string ctbSlowAdcs::getSlowAdcAlias() {
ostringstream line;
for (int i=0; i<NSLOWADCS; i++)
line << adcs[i]->getLabel() << endl;
return line.str();
}
string ctbSlowAdcs::getAdcParameters() {
ostringstream line;
for (int i=0; i<NSLOWADCS; i++) {
//line << "dacs:" << i << " " << dacs[i]->getValue << endl;
line << "adc:" << i << " " << adcs[i]->getValue() << endl;
}
line << "adc:-1" << adcs[NSLOWADCS]->getValue() << endl;
return line.str();
}
void ctbSlowAdcs::update() {
for (int idac=0; idac<NSLOWADCS+1; idac++) {
adcs[idac]->getValue();
}
}

View File

@ -1,78 +0,0 @@
#ifndef CTBSLOWADCS_H
#define CTBSLOWADCS_H
#include <TGFrame.h>
//#define NDACS 16
#define NSLOWADCS 8
class TGTextEntry;
class TGLabel;
class TGNumberEntry;
class TGCheckButton;
class TGTextButton;
namespace sls
{
class Detector;
};
#include <string>
using namespace std;
class ctbSlowAdc : public TGHorizontalFrame {
protected:
// TGLabel *dacsLabel;
// TGNumberEntry *dacsEntry;
// TGCheckButton *dacsUnit;
TGLabel *dacsLabel;
TGLabel *dacsValue;
int id;
sls::Detector* myDet;
public:
ctbSlowAdc(TGGroupFrame*, int , sls::Detector*);
int getValue();
int setLabel(char *tit);
string getLabel();
ClassDef(ctbSlowAdc,0)
};
class ctbSlowAdcs : public TGGroupFrame {
private:
ctbSlowAdc *adcs[NSLOWADCS+1];
sls::Detector* myDet;
public:
ctbSlowAdcs(TGVerticalFrame *page, sls::Detector*);
int setSlowAdcAlias(string line);
// int setDacAlias(string line);
string getSlowAdcAlias();
string getAdcParameters();
void update();
ClassDef(ctbSlowAdcs,0)
};
#endif

View File

@ -1,110 +0,0 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/utsname.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <math.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
int iarg;
char fname[10000];
uint64_t word;
int val[64];
int bit[64];
FILE *fdin;
int nb=2;
int off=0;
int ioff=0;
int dr=24;
int idr=0;
int ib=0;
int iw=0;
bit[0]=19;
bit[1]=8;
// for (iarg=0; iarg<argc; iarg++) printf("%d %s\n",iarg, argv[iarg]);
if (argc<2) printf("Error: usage is %s fname [dr off b0 b1 bn]\n");
if (argc>2) dr=atoi(argv[2]);
if (argc>3) off=atoi(argv[3]);
if (argc>4) {
for (ib=0; ib<64; ib++) {
if (argc>4+ib) {
bit[ib]=atoi(argv[4+ib]);
nb++;
}
}
}
idr=0;
for (ib=0; ib<nb; ib++) {
val[ib]=0;
}
fdin=fopen(argv[1],"rb");
if (fdin==NULL) {
printf("Cannot open input file %s for reading\n",argv[1]);
return 200;
}
while (fread((void*)&word, 8, 1, fdin)) {
// printf("%llx\n",word);
if (ioff<off) ioff++;
else {
for (ib=0; ib<nb; ib++) {
if (word&(1<<bit[ib])) val[ib]|=(1<<idr);
}
idr++;
if (idr==dr) {
idr=0;
fprintf(stdout,"%d\t",iw++);
for (ib=0; ib<nb; ib++) {
#ifdef HEX
fprintf(stdout,"%08llx\t",val[ib]);
#else
fprintf(stdout,"%lld\t",val[ib]);
#endif
val[ib]=0;
}
fprintf(stdout,"\n");
}
}
}
if (idr!=0) {
fprintf(stdout,"%d\t",iw++);
for (ib=0; ib<nb; ib++) {
#ifdef HEX
fprintf(stdout,"%08llx\t",val[ib]);
#else
fprintf(stdout,"%lld\t",val[ib]);
#endif
val[ib]=0;
}
fprintf(stdout,"\n");
}
fclose(fdin);
return 0;
}

View File

@ -1,69 +0,0 @@
find_package(Doxygen)
find_package(Sphinx)
if (DOXYGEN_FOUND AND SPHINX_FOUND)
message(${CMAKE_PROJECT_SORURCE_DIR}/slsDetectorSoftware/src)
# Utility to generate command line documentation
add_executable(gendoc src/gendoc.cpp)
# This is a bit hacky, but better than exposing stuff?
target_include_directories(gendoc PRIVATE ${PROJECT_SOURCE_DIR}/slsDetectorSoftware/src)
target_link_libraries(gendoc PRIVATE
slsDetectorShared
)
set_target_properties(gendoc PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
#Doxygen
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
#Sphinx
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR})
set(SPHINX_SOURCE_FILES
src/commandline.rst
src/container_utils.rst
src/dependencies.rst
src/detector.rst
src/index.rst
src/installation.rst
src/pydetector.rst
src/pyenums.rst
src/pyexamples.rst
src/receiver.rst
src/result.rst
src/type_traits.rst
src/ToString.rst
)
foreach(filename ${SPHINX_SOURCE_FILES})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${filename}
"${SPHINX_BUILD}/${filename}")
endforeach(filename ${SPHINX_SOURCE_FILES})
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
"${SPHINX_BUILD}/conf.py"
@ONLY)
add_custom_target(docs
gendoc
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
COMMAND ${SPHINX_EXECUTABLE} -a -b html
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
-c "${SPHINX_BUILD}"
${SPHINX_BUILD}/src
${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx")
else (DOXYGEN_FOUND AND SPHINX_FOUND)
message("Doxygen and Sphinx are needed to build documentation")
endif (DOXYGEN_FOUND AND SPHINX_FOUND)

File diff suppressed because it is too large Load Diff

View File

@ -1,62 +0,0 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
# sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../bin/'))
#sys.path.insert(0, '/home/l_frojdh/sls/build/bin')
#sys.path.insert(0, @CMAKE_CURRENT_BINARY_DIR@)
print(sys.path)
# -- Project information -----------------------------------------------------
project = 'slsDetectorPackage'
copyright = '2019, PSD Detector Group'
author = 'PSD Detector Group'
version = '@PROJECT_VERSION@'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['breathe',
'sphinx_rtd_theme',
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
]
breathe_default_project = "slsDetectorPackage"
napoleon_use_ivar = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']

View File

@ -1,6 +0,0 @@
ToString
==============
String conversion
.. doxygenfile:: ToString.h

View File

@ -1,16 +0,0 @@
Command line interface
==============================================
Usage
-------------
Commands can be uses either with sls_detector_get or sls_detector_put
.. code-block::
sls_detector_get vrf
Commands
-----------
.. include:: ../commands.rst

View File

@ -1,14 +0,0 @@
ContainerUtils
==================
Helper functions to handle standard container compliant
containers. Supports array, vector, sls::Result etc.
While not a part of the public API we aim not to change this
interface too much. However, we don't give the same strong
guarantees as for Detector etc.
Any reoccurring container operation should probably be added to
this file.
.. doxygenfile:: container_utils.h

View File

@ -1,53 +0,0 @@
Dependencies
=========================
While we value few dependencies some libraries are required in
order to not have to reinvent the wheel. Due to the state of package
management in C++ we decided to bundle some of them with our source
code. These are found in the libs/ directory.
-----------------------
Core
-----------------------
To use the basic building blocks, meaning sls_detector_get/put and
the shared libraries these are needed:
* Linux, preferably recent kernel (currently no cross platform support)
* CMake > 3.9
* C++11 compatible compiler. (We test with gcc and clang)
* ZeroMQ version 4
-----------------------
GUI
-----------------------
The GUI is currently using Qt4 but watch out for an upgrade to 5.
* Qt 4.8
* Qwt 6
-----------------------
Python bindings
-----------------------
* Python > 3.6
* pybind11 (packaged in libs/)
-----------------------
Documentation
-----------------------
The documentation that you are reading now is built with
* Doxygen (to extract C++ classes etc.)
* Breathe (Sphinx plugin to handle doxygen xml)
* Sphinx
-----------------------
Packaged in libs/
-----------------------
* catch2 (unit testing)
* rapidjson (streaming from receiver)
* pybind11 (python bindings)

View File

@ -1,16 +0,0 @@
Detector
==============================================
The sls::Detector is the new public API to control
detectors from C++. This API is also used internally
for the Python bindings and the command line interface.
If a receiver has been configured this is also controlled
through this class.
Most, if not all, functions are called in parallel
and the return value is a thin std::vector wrapper
containing results from all modules. (Result<T>)
.. doxygenclass:: sls::Detector
:members:
:undoc-members:

View File

@ -1,56 +0,0 @@
/**
* Utility program to generate input files for the command line
* documentation. Uses the string returned from sls_detector_help cmd
*
*/
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include "CmdProxy.h"
#include "Detector.h"
#include "sls_detector_defs.h"
std::string replace_all(const std::string &src, const std::string &from,
const std::string &to) {
std::string results;
std::string::const_iterator end = src.end();
std::string::const_iterator current = src.begin();
std::string::const_iterator next =
std::search(current, end, from.begin(), from.end());
while (next != end) {
results.append(current, next);
results.append(to);
current = next + from.size();
next = std::search(current, end, from.begin(), from.end());
}
results.append(current, next);
return results;
}
int main() {
std::cout << "Generating command line documentation!\n";
sls::CmdProxy proxy(nullptr);
auto commands = proxy.GetProxyCommands();
std::ofstream fs("commands.rst");
fs << ".. glossary::\n";
for (const auto &cmd : commands) {
std::ostringstream os;
proxy.Call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os);
auto tmp = os.str().erase(0, cmd.size());
auto usage = tmp.substr(0, tmp.find_first_of('\n'));
tmp.erase(0, usage.size());
auto help = replace_all(tmp, "\n\t", "\n\t\t");
fs << '\t' << cmd << usage << help << "\n";
}
}

View File

@ -1,50 +0,0 @@
.. slsDetectorPackage documentation master file, created by
sphinx-quickstart on Mon Jul 29 17:38:15 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to slsDetectorPackage's documentation!
==============================================
.. toctree::
:maxdepth: 1
:caption: Installation:
installation
dependencies
.. toctree::
:caption: C++ API
:maxdepth: 2
detector
result
receiver
.. toctree::
:caption: Python API
:maxdepth: 2
pydetector
pyenums
pyexamples
.. toctree::
:caption: Command line
:maxdepth: 2
commandline
.. toctree::
:caption: Developer
container_utils
type_traits
ToString
.. Indices and tables
.. ==================
.. * :ref:`genindex`
.. * :ref:`modindex`
.. * :ref:`search`

View File

@ -1,5 +0,0 @@
Installation
==============================================
get the source etc.

View File

@ -1,9 +0,0 @@
Detector
=====================================================
.. py:currentmodule:: sls_detector
.. autoclass:: ExperimentalDetector
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,12 +0,0 @@
Enums
===========
These enums are defined in slsDetectorDefs in the C++ package and
exposed to Python through pybind11.
.. py:currentmodule:: sls_detector
.. autoclass:: runStatus
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,143 +0,0 @@
Examples
================
Some short hints on how to use the detector
------------------------
Simple threshold scan
------------------------
Assuming you have set up your detector with exposure time, period, enabled
file writing etc.
.. code-block:: python
from slsdet import Eiger
d = Eiger()
threshold = range(0, 2000, 200)
for th in threshold:
d.vthreshold = th
d.acquire()
If we want to control the shutter of for example, the big X-ray box we can add
this line in our code. It then opens the shutter just before the measurement
and closes is afterwards.
::
with xrf_shutter_open(box, 'Fe'):
for th in threshold:
d.vthreshold = th
d.acquire()
-----------------------
Reading temperatures
-----------------------
::
d.temp
>>
temp_fpga : 43.19°C, 51.83°C
temp_fpgaext : 38.50°C, 38.50°C
temp_10ge : 39.50°C, 39.50°C
temp_dcdc : 42.50°C, 42.50°C
temp_sodl : 39.50°C, 40.50°C
temp_sodr : 39.50°C, 40.50°C
temp_fpgafl : 40.87°C, 37.61°C
temp_fpgafr : 34.51°C, 35.63°C
d.temp.fpga
>> temp_fpga : 40.84°C, 39.31°C
t = d.temp.fpga[0]
t
>> 40.551
t = d.temp.fpga[:]
t
>> [40.566, 39.128]
-----------------------
Non blocking acquire
-----------------------
There are mainly two ways to achieve a non blocking acquire when calling from the Python API. One is to manually start
the detector and the second one is to launch the normal acquire from a different process. Depending on your measurement
it might also be better to run the other task in a seperate process and use acq in the main thread.
But lets start looking at the at the manual way:
::
import time
from sls_detector import Eiger
d = Eiger()
n = 10
t = 1
d.exposure_time = t
d.n_frames = n
d.reset_frames_caught()
#Start the measurement
t0 = time.time()
d.start_receiver()
d.start_detector()
#Wait for the detector to be ready or do other important stuff
time.sleep(t*n)
#check if the detector is ready otherwise wait a bit longer
while d.status != 'idle':
time.sleep(0.1)
#Stop the receiver after we got the frames
#Detector is already idle so we don't need to stop it
d.stop_receiver()
lost = d.frames_caught - n
print(f'{n} frames of {t}s took {time.time()-t0:{.3}}s with {lost} frames lost ')
#Reset to not interfere with a potential next measurement
d.reset_frames_caught()
Instead launching d.acq() from a different process is a bit easier since the control of receiver and detector
is handled in the acq call. However, you need to join the process used otherwise a lot of zombie processes would
hang around until the main process exits.
::
import time
from multiprocessing import Process
from sls_detector import Eiger
def acquire():
"""
Create a new Eiger object that still referes to the same actual detector
and same shared memory. Then launch acq.
"""
detector = Eiger()
detector.acq()
#This is the detector we use throughout the session
d = Eiger()
#Process to run acquire
p = Process(target=acquire)
#Start the thread and short sleep to allow the acq to start
p.start()
time.sleep(0.01)
#Do some other work
while d.busy is True:
print(d.busy)
time.sleep(0.1)
#Join the process
p.join()

View File

@ -1,6 +0,0 @@
Receiver
==============================================
.. doxygenclass:: slsReceiver
:members:
.. :undoc-members:

View File

@ -1,4 +0,0 @@
Result
==============================================
.. doxygenfile:: Result.h

View File

@ -1,7 +0,0 @@
TypeTraits
==============
Template meta functions in the same spirit as type_traits
from the standard library.
.. doxygenfile:: TypeTraits.h

View File

@ -1,22 +0,0 @@
GITREPO1='git remote -v'
GITREPO2=" | grep \"fetch\" | cut -d' ' -f1"
BRANCH1='git branch -v'
BRANCH2=" | grep '*' | cut -d' ' -f2"
REPUID1='git log --pretty=format:"%H" -1'
AUTH1_1='git log --pretty=format:"%cn" -1'
AUTH1_2=" | cut -d' ' -f1"
AUTH2_1='git log --pretty=format:"%cn" -1'
AUTH2_2=" | cut -d' ' -f2"
FOLDERREV1='git log --oneline . ' #used for all the individual server folders
FOLDERREV2=" | wc -l" #used for all the individual server folders
REV1='git log --oneline '
REV2=" | wc -l"
GITREPO=`eval $GITREPO1 $GITREPO2`
BRANCH=`eval $BRANCH1 $BRANCH2`
REPUID=`eval $REPUID1`
AUTH1=`eval $AUTH1_1 $AUTH1_2`
AUTH2=`eval $AUTH2_1 $AUTH2_2`
REV=`eval $REV1 $REV2`
FOLDERREV=`eval $FOLDERREV1 $FOLDERREV2`

24
examples/ang.off Executable file
View File

@ -0,0 +1,24 @@
module 0 center 6.395E+02 +- 0.00E+00 conversion 6.5660E-05 +- 7.10E-09 offset 0.00000 +- 0.00015
module 1 center 6.395E+02 +- 0.00E+00 conversion 6.5650E-05 +- 7.09E-09 offset 5.00211 +- 0.00015
module 2 center 6.395E+02 +- 0.00E+00 conversion 6.5625E-05 +- 7.09E-09 offset 10.00733 +- 0.00015
module 3 center 6.395E+02 +- 0.00E+00 conversion 6.5618E-05 +- 7.09E-09 offset 15.00742 +- 0.00015
module 4 center 6.395E+02 +- 0.00E+00 conversion 6.5642E-05 +- 7.15E-09 offset 20.00620 +- 0.00015
module 5 center 6.395E+02 +- 0.00E+00 conversion 6.5612E-05 +- 7.09E-09 offset 25.00281 +- 0.00015
module 6 center 6.395E+02 +- 0.00E+00 conversion 6.5623E-05 +- 6.93E-09 offset 30.00704 +- 0.00015
module 7 center 6.395E+02 +- 0.00E+00 conversion 6.5605E-05 +- 7.10E-09 offset 34.99715 +- 0.00015
module 8 center 6.395E+02 +- 0.00E+00 conversion 6.5643E-05 +- 7.21E-09 offset 39.99533 +- 0.00015
module 9 center 6.395E+02 +- 0.00E+00 conversion 6.5638E-05 +- 7.09E-09 offset 44.99969 +- 0.00015
module 10 center 6.395E+02 +- 0.00E+00 conversion 6.5638E-05 +- 6.94E-09 offset 49.99859 +- 0.00015
module 11 center 6.395E+02 +- 0.00E+00 conversion 6.5644E-05 +- 7.10E-09 offset 54.99499 +- 0.00015
module 12 center 6.395E+02 +- 0.00E+00 conversion 6.5618E-05 +- 7.09E-09 offset 59.99120 +- 0.00015
module 13 center 6.395E+02 +- 0.00E+00 conversion 6.5607E-05 +- 7.11E-09 offset 64.98880 +- 0.00015
module 14 center 6.395E+02 +- 0.00E+00 conversion 6.5609E-05 +- 7.09E-09 offset 69.98205 +- 0.00015
module 15 center 6.395E+02 +- 0.00E+00 conversion 6.5611E-05 +- 7.09E-09 offset 74.98379 +- 0.00015
module 16 center 6.395E+02 +- 0.00E+00 conversion 6.5619E-05 +- 4.72E-09 offset 79.98559 +- 0.00015
module 17 center 6.395E+02 +- 0.00E+00 conversion 6.5604E-05 +- 7.09E-09 offset 84.98376 +- 0.00015
module 18 center 6.395E+02 +- 0.00E+00 conversion 6.5605E-05 +- 7.09E-09 offset 89.98307 +- 0.00015
module 19 center 6.395E+02 +- 0.00E+00 conversion 6.5616E-05 +- 7.09E-09 offset 94.98907 +- 0.00015
module 20 center 6.395E+02 +- 0.00E+00 conversion 6.5634E-05 +- 7.08E-09 offset 99.97965 +- 0.00015
module 21 center 6.395E+02 +- 0.00E+00 conversion 6.5608E-05 +- 4.16E-09 offset 104.99732 +- 0.00016
module 22 center 6.395E+02 +- 0.00E+00 conversion 6.5608E-05 +- 7.09E-09 offset 109.98646 +- 0.00015
module 23 center 6.395E+02 +- 0.00E+00 conversion 6.5649E-05 +- 7.09E-09 offset 114.98765 +- 0.00015

5
examples/bad.chans Normal file
View File

@ -0,0 +1,5 @@
15
1528
5000
6513

0
examples/config_gen_script/beb_31_25.config_gen Executable file → Normal file
View File

0
examples/config_gen_script/eiger_2m_1gb.config_gen Executable file → Normal file
View File

View File

@ -1,39 +0,0 @@
hostname hostname1+hostname2+hostname3+hostname55+
header_var1 wow
header_var2 great
header_var3 very nice
0:counter1 100
0:counter2 1024
0:counter3 1500
0:forallmodules val_mod1
0:constant1 const1
0:constant2 const2
0:constant3 const3 /path/to/something
1:counter1 101
1:counter2 1036
1:counter3 1503
1:forallmodules val_mod2
1:constant1 const1
1:constant2 const2
1:constant3 const3 /path/to/something
2:counter1 102
2:counter2 1048
2:counter3 1506
2:forallmodules val_mod3
2:constant1 const1
2:constant2 const2
2:constant3 const3 /path/to/something
3:counter1 103
3:counter2 1060
3:counter3 1509
3:forallmodules val_mod4
3:constant1 const1
3:constant2 const2
3:constant3 const3 /path/to/something
footer1 foot1
footer2 somethingelseathebottom

View File

@ -1,47 +0,0 @@
#!/bin/bash
# local variables
a_variable=/path/to/something
# HOSTNAMES is special
# Beside of the hostname line it also defines the amount of modules
# for the body part
# take care for the last space
HOSTNAMES="hostname1 hostname2 hostname3 hostname55 "
## header contains constant values at the beginning of the file
header=(
header_var1="wow"
header_var2="great"
header_var3="very nice"
)
## the body part is for each half module
# counters will count automatically
# the number behind ':' indicates the incrementation value
counters=(
counter1="100:1"
counter2="1024:12"
counter3="1500:3"
)
# constant values
constants=(
constant1="const1"
constant2="const2"
constant3="const3 ${a_variable}"
)
# lists contains space separated lists each value for each half module
lists=(
forallmodules="val_mod1 val_mod2 val_mod3 val_mod4"
)
## footer contains constant values for the end of the file
footer=(
footer1=foot1
footer2=somethingelseathebottom
)

View File

@ -1,33 +0,0 @@
detsizechan 1024 512
#detetctor geometry, long side of the module first
hostname beb059+beb058+
#1Gb detector hostname for controls
0:rx_tcpport 1991
#tcpport for the first halfmodule
0:rx_udpport 50011
#udp port first quadrant, first halfmodule
0:rx_udpport2 50012
#udp port second quadrant, first halfmodule
0:rx_udpip 10.0.30.210
#udp IP of the receiver over 10Gb
0:detectorip 10.0.30.100
#first half module 10 Gb IP
1:rx_tcpport 1992
#tcpport for the second halfmodule
1:rx_udpport 50013
#udp port first quadrant, second halfmodule
1:rx_udpport2 50014
#udp port second quadrant, second halfmodule
1:rx_udpip 10.0.40.210
#udp IP of the receiver over 10Gb,
#can be the same or different from 0:rx_udpip
1:detectorip 10.0.40.101
#second half module 10 Gb IP
rx_hostname x12sa-vcons
#1Gb receiver pc hostname
outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M
threaded 1

View File

@ -1,24 +0,0 @@
detsizechan 1024 512
#detetctor geometry, long side of the module first
hostname beb059+beb058+
#1Gb detector hostname for controls
0:rx_tcpport 1991
#tcpport for the first halfmodule
0:rx_udpport 50011
#udp port first quadrant, first halfmodule
0:rx_udpport2 50012
#udp port second quadrant, first halfmodule
1:rx_tcpport 1992
#tcpport for the second halfmodule
1:rx_udpport 50013
#udp port first quadrant, second halfmodule
1:rx_udpport2 50014
#udp port second quadrant, second halfmodule
rx_hostname x12sa-vcons
#1Gb receiver pc hostname
outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M
threaded 1

14
examples/gotthard.config Executable file → Normal file
View File

@ -1,11 +1,18 @@
hostname bchip007
type Gotthard+
0:hostname bchip007
#0:port 1952
#0:stopport 1953
#0:rx_tcpport 1956 must also have this in receiver config file
0:settingsdir /home/l_maliakal_d/mySoft/newMythenSoftware/settingsdir/gotthard
0:angdir 1.000000
0:moveflag 0.000000
0:lock 0
0:caldir /home/l_maliakal_d/mySoft/newMythenSoftware/settingsdir/gotthard
0:ffdir /home/l_maliakal_d
0:extsig:0 off
0:extsig:1 off
0:extsig:2 off
0:extsig:3 off
#0:detectorip 129.129.202.9
0:detectormac 00:aa:bb:cc:dd:ee
0:rx_udpport 50004
@ -16,6 +23,7 @@ hostname bchip007
master -1
sync none
outdir /bigRAID/datadir_gotthard/rec_test_data
ffdir /home/l_maliakal_d
headerbefore none
headerafter none
headerbeforepar none
@ -24,4 +32,4 @@ badchannels none
angconv none
globaloff 0.000000
binsize 0.001000
threaded 1

View File

@ -1,132 +0,0 @@
#G1 Energy #G2 Energy
300 7000
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain (for every channel) ADU
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1

2
examples/gotthard_setup.det Executable file → Normal file
View File

@ -8,7 +8,7 @@ period 0.000024984
delay 0.999999968
gates 1
frames 300000.000000000
triggers 1.000000000
cycles 1.000000000
timing auto
fineoff 0.000000
startscript none

View File

@ -1,57 +0,0 @@
detsizechan 2560 1
hostname bchip074+bchip075+
0:extsig:0 trigger_in_rising_edge
0:rx_tcpport 1954
0:rx_udpport 50001
0:vhighvoltage 0
1:extsig:0 trigger_in_rising_edge
1:rx_tcpport 1955
1:rx_udpport 50002
1:vhighvoltage 0
##############################################################################
#########
######### Uncomment this part to use the gotthard25umZmq process
#########
##############################################################################
# #replace my_receiver_hostname with the hostname of IP of the machine where the receiver runs
#0:rx_zmqip my_receiver_hostname
#0:rx_zmqport 30003
# #replace my_client_hostname with the hostname of IP of the machine where the client/GUI or softIOC runs
#0:zmqip my_client_hostname
#0:zmqport 40003
# #replace my_receiver_hostname with the hostname of IP of the machine where the receiver runs
#1:rx_zmqip my_receiver_hostname
#1:rx_zmqport 30004
# #replace my_client_hostname with the hostname of IP of the machine where the client/GUI or softIOC runs
#1:zmqip my_client_hostname
#1:zmqport 40004
##############################################################################
#########
######### until here
#########
##############################################################################
r_readfreq 1
rx_datastream 1
#replace my_receiver_hostname with the hostname of 1Gb IP of the machine where the receiver runs
rx_hostname my_receiver_hostname
rx_datastream 1
outdir /tmp/
settings veryhighgain
exptime 0.000005
period 0.0001
vhighvoltage 90

View File

@ -1,13 +0,0 @@
Turn on the two receivers:
slsReceiver -t1954 &
slsReceiver -t1955 &
Switch on the photon conversion on the receiver machine (replace my_receiver_hostname):
gotthard25umZmq my_receiver_hostname 30003 my_receiver_hostname 40003 &
Run the configuration file:
sls_detector_put config bchip2modules.config
Start your measurements using the command line, the slsDetectorGui or the EPICS driver

View File

@ -1,501 +0,0 @@
initialchecks 0
#############################################
### edit with hostname or IP address of your detector
############################################
hostname bchip181+
runclk 40
adcclk 20
dbitclk 40
patword 0000 0000000000000000
patword 0001 0000000000000000
patword 0002 0008000900080000
patword 0003 0008000900080000
patword 0004 0008000900080000
patword 0005 0008000900080000
patword 0006 0008000900080000
patword 0007 0008000900080000
patword 0008 0008000900080000
patword 0009 0008000900080000
patword 000a 0008000900080000
patword 000b 0008000900080000
patword 000c 0008000900080000
patword 000d 0008000900080000
patword 000e 0008000900080000
patword 000f 0008000900080000
patword 0010 0008000900080000
patword 0011 0008000900080000
patword 0012 0008000900080000
patword 0013 0008000900080000
patword 0014 0008000900080000
patword 0015 0008000900080000
patword 0016 0008400900080020
patword 0017 0008400900080020
patword 0018 0008599f0418503a
patword 0019 0008599f0418503a
patword 001a 0108599f0418503a
patword 001b 0108599f0418503a
patword 001c 0108599f0418503a
patword 001d 0108599f0418503a
patword 001e 0108599f0418503a
patword 001f 0108599f0418503a
patword 0020 0108599f0418503a
patword 0021 0108599f0418503a
patword 0022 0108599f0418503a
patword 0023 0108599f0418503a
patword 0024 0108599f0418503a
patword 0025 0108599f0418503a
patword 0026 0108599f0418503a
patword 0027 0108599f0418503a
patword 0028 0108599f0418503a
patword 0029 0108599f0418503a
patword 002a 0108599f0418503a
patword 002b 0108599f0418503a
patword 002c 0108599f0418503a
patword 002d 0108599f0418503a
patword 002e 0108599f0418503a
patword 002f 0108599f0418503a
patword 0030 0108599f0418503a
patword 0031 0108599f0418503a
patword 0032 0108599f0418503a
patword 0033 0108599f0418503a
patword 0034 0108599f0418503a
patword 0035 0108599f0418503a
patword 0036 0108599f0418503a
patword 0037 0108599f0418503a
patword 0038 0108599f0418503a
patword 0039 0108599f0418503a
patword 003a 0108599f0418503a
patword 003b 0108599f0418503a
patword 003c 0108599f0418503a
patword 003d 0108599f0418503a
patword 003e 0108599f0418503a
patword 003f 0108599f0418503a
patword 0040 0108599f0418503a
patword 0041 0108599f0418503a
patword 0042 0108599f0418503a
patword 0043 0108599f0418503a
patword 0044 0108599f0418503a
patword 0045 0108599f0418503a
patword 0046 0108599f0418503a
patword 0047 0108599f0418503a
patword 0048 0108599f0418503a
patword 0049 0108599f0418503a
patword 004a 0108599f0418503a
patword 004b 0108599f0418503a
patword 004c 0108599f0418503a
patword 004d 0108599f0418503a
patword 004e 0108599f0418503a
patword 004f 0108599f0418503a
patword 0050 0108599f0418503a
patword 0051 0108599f0418503a
patword 0052 0108599f0418503a
patword 0053 0108599f0418503a
patword 0054 0108599f0418503a
patword 0055 0108599f0418503a
patword 0056 0108599f0418503a
patword 0057 0108599f0418503a
patword 0058 0108599f0418503a
patword 0059 0108599f0418503a
patword 005a 0108599f0418503a
patword 005b 0108599f0418503a
patword 005c 0108599f0418503a
patword 005d 0108599f0418503a
patword 005e 0108599f0418503a
patword 005f 0108599f0418503a
patword 0060 0108599f0418503a
patword 0061 0108599f0418503a
patword 0062 0108599f0418503a
patword 0063 0108599f0418503a
patword 0064 0108599f0418503a
patword 0065 0108599f0418503a
patword 0066 0108599f0418503a
patword 0067 0108599f0418503a
patword 0068 0108599f0418503a
patword 0069 0108599f0418503a
patword 006a 0108599f0418503a
patword 006b 0108599f0418503a
patword 006c 0108599f0418503a
patword 006d 0108599f0418503a
patword 006e 0108599f0418503a
patword 006f 0108599f0418503a
patword 0070 0108599f0418503a
patword 0071 0108599f0418503a
patword 0072 0108599f0418503a
patword 0073 0108599f0418503a
patword 0074 0108599f0418503a
patword 0075 0108599f0418503a
patword 0076 0108599f0418503a
patword 0077 0108599f0418503a
patword 0078 0108599f0418503a
patword 0079 0108599f0418503a
patword 007a 0108599f0418503a
patword 007b 0108599f0418503a
patword 007c 0108599f0418503a
patword 007d 0108599f0418503a
patword 007e 010859960418503a
patword 007f 010859960418503a
patword 0080 010859960418503a
patword 0081 010859960418503a
patword 0082 010859960418503a
patword 0083 010859960418503a
patword 0084 010859960418503a
patword 0085 010859960418503a
patword 0086 010859960418503a
patword 0087 010859960418503a
patword 0088 010859960418503a
patword 0089 010859960418503a
patword 008a 010859960418503a
patword 008b 010859960418503a
patword 008c 010859960418503a
patword 008d 010859960418503a
patword 008e 010859960418503a
patword 008f 010859960418503a
patword 0090 010859960418503a
patword 0091 010859960418503a
patword 0092 010819960418501a
patword 0093 010819960418501a
patword 0094 010819960418501a
patword 0095 010819960418501a
patword 0096 030819960418501a
patword 0097 030819960418501a
patword 0098 030819960418501a
patword 0099 030819960418501a
patword 009a 030819960418501a
patword 009b 030819960418501a
patword 009c 030819960418501a
patword 009d 030819960418501a
patword 009e 030819960418501a
patword 009f 030819960418501a
patword 00a0 030819960418501a
patword 00a1 030819960418501a
patword 00a2 030819960418501a
patword 00a3 030819960418501a
patword 00a4 030819960418501a
patword 00a5 030819960418501a
patword 00a6 030819960418501a
patword 00a7 030819960418501a
patword 00a8 030819960418501a
patword 00a9 030819960418501a
patword 00aa 030819960418501a
patword 00ab 030819960418501a
patword 00ac 030819960008501a
patword 00ad 030819960008501a
patword 00ae 030819960008501a
patword 00af 030819960008501a
patword 00b0 030819960008501a
patword 00b1 030819960008501a
patword 00b2 030819960008501a
patword 00b3 030819960008501a
patword 00b4 030819960008501a
patword 00b5 030819960008501a
patword 00b6 030819960008501a
patword 00b7 030819960008501a
patword 00b8 030819960008501a
patword 00b9 030819960008501a
patword 00ba 030819960008501a
patword 00bb 030819960008501a
patword 00bc 030819960008501a
patword 00bd 030819960008501a
patword 00be 030819960008501a
patword 00bf 030819960008501a
patword 00c0 0308199f0008501a
patword 00c1 0308199f0008501a
patword 00c2 0308199f0008501a
patword 00c3 0308199f0008501a
patword 00c4 0308199f0008501a
patword 00c5 0308199f0008501a
patword 00c6 0308199f0008501a
patword 00c7 0308199f0008501a
patword 00c8 0308199f0008501a
patword 00c9 0308199f0008501a
patword 00ca 0308199f0008501a
patword 00cb 0308199f0008501a
patword 00cc 0308199f0008501a
patword 00cd 0308199f0008501a
patword 00ce 0308199f0008501a
patword 00cf 0308199f0008501a
patword 00d0 0308199f0008501a
patword 00d1 0308199f0008501a
patword 00d2 0308199f0008501a
patword 00d3 0308199f0008501a
patword 00d4 0308599f0008503a
patword 00d5 0308599f0008503a
patword 00d6 030c599f000850ba
patword 00d7 030c599f000850ba
patword 00d8 030c599f000850ba
patword 00d9 030c599f000850ba
patword 00da 030c599f000850ba
patword 00db 030c599f000850ba
patword 00dc 030c599f000850ba
patword 00dd 030c599f000850ba
patword 00de 030c599f000850ba
patword 00df 030c599f000850ba
patword 00e0 030c599f000850ba
patword 00e1 030c599f000850ba
patword 00e2 030c599f000850ba
patword 00e3 030c599f000850ba
patword 00e4 030c599f000850ba
patword 00e5 030c599f000850ba
patword 00e6 030c599f000850ba
patword 00e7 030c599f000850ba
patword 00e8 030c599f000850ba
patword 00e9 030c599f000850ba
patword 00ea 030c799f010858ba
patword 00eb 030c799f010858ba
patword 00ec 030c599f000850ba
patword 00ed 030c599f000850ba
patword 00ee 030c599f000850ba
patword 00ef 030c599f000850ba
patword 00f0 030c599f000850ba
patword 00f1 030c599f000850ba
patword 00f2 030c599f000850ba
patword 00f3 030c599f000850ba
patword 00f4 030c599f000850ba
patword 00f5 030c599f000850ba
patword 00f6 030c599f000850ba
patword 00f7 030c599f000850ba
patword 00f8 030c599f000850ba
patword 00f9 030c599f000850ba
patword 00fa 030c599f000850ba
patword 00fb 030c599f000850ba
patword 00fc 030c599f000850ba
patword 00fd 030c599f000850ba
patword 00fe 030c599f000850ba
patword 00ff 030c599f000850ba
patword 0100 030c599f000850ba
patword 0101 030c599f000850ba
patword 0102 030c599f400850ba
patword 0103 030c599f400850ba
patword 0104 030c599f600850ba
patword 0105 030c599f400850ba
patword 0106 030c599f400850ba
patword 0107 030c599f400850ba
patword 0108 870c599f682e50ba
patword 0109 870c599f482850ba
patword 010a 870c599f000e50ba
patword 010b 870c599f000850ba
patword 010c 870c599f000e50ba
patword 010d 870c599f000850ba
patword 010e 870c599f000e50ba
patword 010f 870c599f000850ba
patword 0110 870c599f000e50ba
patword 0111 870c599f000850ba
patword 0112 870c599f000e50ba
patword 0113 870c599f000850ba
patword 0114 870c599f000e50ba
patword 0115 870c599f000850ba
patword 0116 870c599f000e50ba
patword 0117 870c599f000850ba
patword 0118 870c599f000e50ba
patword 0119 870c599f000850ba
patword 011a 870c599f000e50ba
patword 011b 870c599f000850ba
patword 011c 870c599f000e50ba
patword 011d 870c599f000850ba
patword 011e 870c599f000e50ba
patword 011f 870c599f000850ba
patword 0120 870c599f000e50ba
patword 0121 870c599f000850ba
patword 0122 870c599f200e50ba
patword 0123 870c599f000850ba
patword 0124 870c599f000e50ba
patword 0125 870c599f000850ba
patword 0126 870c599f000e50ba
patword 0127 870c599f000850ba
patword 0128 870c599f000e50ba
patword 0129 870c599f000850ba
patword 012a 870c599f000e50ba
patword 012b 870c599f000850ba
patword 012c 870c599f000e50ba
patword 012d 870c599f000850ba
patword 012e 870c599f000e50ba
patword 012f 870c599f000850ba
patword 0130 870c599f000e50ba
patword 0131 870c599f000850ba
patword 0132 870c599f000e50ba
patword 0133 870c599f000850ba
patword 0134 870c599f000e50ba
patword 0135 870c599f000850ba
patword 0136 870c599f000e50ba
patword 0137 870c599f000850ba
patword 0138 870c599f000e50ba
patword 0139 870c599f000850ba
patword 013a 870c599f282e50ba
patword 013b 870c599f082850ba
patword 013c 870c599f000e50ba
patword 013d 870c599f000850ba
patword 013e 870c599f000e50ba
patword 013f 870c599f000850ba
patword 0140 870c599f000e50ba
patword 0141 870c599f000850ba
patword 0142 870c599f000e50ba
patword 0143 870c599f000850ba
patword 0144 870c599f000e50ba
patword 0145 870c599f000850ba
patword 0146 870c599f000e50ba
patword 0147 870c599f000850ba
patword 0148 870c599f000e50ba
patword 0149 870c599f000850ba
patword 014a 870c599f000e50ba
patword 014b 870c599f000850ba
patword 014c 870c599f000e50ba
patword 014d 870c599f000850ba
patword 014e 870c599f000e50ba
patword 014f 870c599f000850ba
patword 0150 870c599f000e50ba
patword 0151 870c599f000850ba
patword 0152 870c599f000e50ba
patword 0153 870c599f000850ba
patword 0154 870c599f200e50ba
patword 0155 870c599f000850ba
patword 0156 870c599f000e50ba
patword 0157 870c599f000850ba
patword 0158 870c599f000e50ba
patword 0159 870c599f000850ba
patword 015a 870c599f000e50ba
patword 015b 870c599f000850ba
patword 015c 870c599f000e50ba
patword 015d 870c599f000850ba
patword 015e 870c599f000e50ba
patword 015f 870c599f000850ba
patword 0160 870c599f000e50ba
patword 0161 870c599f000850ba
patword 0162 870c599f000e50ba
patword 0163 870c599f000850ba
patword 0164 870c599f000e50ba
patword 0165 870c599f000850ba
patword 0166 870c599f000e50ba
patword 0167 870c599f000850ba
patword 0168 870c599f000e50ba
patword 0169 870c599f000850ba
patword 016a 870c599f000e50ba
patword 016b 870c599f000850ba
patword 016c 070c599f000850ba
patword 016d 070c599f000850ba
patword 016e 000c599f000850ba
patword 016f 000c599f000850ba
patword 0170 0008599f200e503a
patword 0171 0008599f0008503a
patword 0172 0008599f200e503a
patword 0173 0008599f0008503a
patword 0174 0008599f0008503a
patword 0175 0008599f0008503a
patword 0176 0008599f0008503a
patword 0177 0008599f0008503a
patword 0178 0008599f0008503a
patword 0179 0008599f0008503a
patword 017a 0008599f0008503a
patword 017b 0008599f0008503a
patword 017c 0008599f0008503a
patword 017d 0008599f0008503a
patword 017e 0008599f0008503a
patword 017f 0008599f0008503a
patword 0180 0008599f0008503a
patword 0181 0008599f0008503a
patword 0182 0008599f0008503a
patword 0183 0008599f0008503a
patword 0184 0008599f0008503a
patword 0185 0008599f0008503a
patword 0186 0008599f0008503a
patword 0187 0008599f0008503a
patword 0188 0008599f0008503a
patword 0189 0008599f0008503a
patword 018a 0008599f0008503a
patword 018b 0008599f0008503a
patword 018c 0008599f0008503a
patword 018d 0008599f0008503a
patioctrl 8f0effff6dbffdbf
patclkctrl 0000000000000000
patlimits 0000 018c
patloop0 013a 016b
patnloop0 199
patloop1 0400 0400
patnloop1 0
patloop2 0400 0400
patnloop2 0
patwait0 00aa
patwaittime0 10000
patwait1 0400
patwaittime1 0
patwait2 0400
patwaittime2 0
#0:rx_tcpport 1977
#############################################
### edit with 10 Gbs IP of your server
############################################
#0:udp_dstip 10.1.1.102
0:udp_dstip 129.129.202.136
#############################################
### edit with any number in the subnet of your server (first 3 numbers as above)
############################################
#0:udp_srcip 10.1.1.19
0:udp_srcip 129.129.202.13
0:udp_dstport 33410
#############################################
### edit with 10 Gbs IP of your server
############################################
#zmqip 129.129.202.110
#rx_zmqip 10.1.1.102
#rx_zmqport 30001
#############################################
### edit with 1 Gbs IP of PC where you will run the GUI
############################################
#zmqip 129.129.202.110
#zmqport 50001
#############################################
### edit with hostname or 1Gbs IP address of your server
############################################
rx_hostname mpc2011
tengiga 0
rx_datastream 1
rx_readfreq 1
dac 6 800
dac 0 1300
dac 4 1428
dac 1 1000
dac 7 900
dac 3 680
dac 2 1400
dac 5 1200
adcinvert 4a342593
#0xb5cbda6c
asamples 5000
dsamples 0
adcphase 30 deg
adcpipeline 14
adcreg 14 40
frames 1000
period 0.001
#############################################
### edit with directory you want to write to
############################################
fpath /tmp/
fwrite 0
romode analog
#rx_jsonaddheader frameMode
rx_jsonpara frameMode newpedestal
#rx_jsonaddheader detectorMode
rx_jsonpara detectorMode analog
#flags newpedestal
#flags analog
reg 0x5e 0x00010000
#powerchip 1
vhighvoltage 90

View File

@ -1,16 +0,0 @@
hostname localhost
0:rx_udpport 50004
0:rx_udpip 172.24.8.84
0:detectorip 172.24.8.254
rx_hostname localhost
#powerchip 1
#vhighvoltage 200
#extsig:0 trigger_in_rising_edge
#timing trigger
outdir /tmp/slsdetector

View File

@ -1,26 +0,0 @@
detsizechan 1024 1024
hostname bchip048+bchip052+
0:rx_udpport 50004
0:rx_udpip 10.1.1.100
0:rx_udpmac F4:52:14:2F:32:00
0:detectorip 10.1.1.10
0:detectormac 00:aa:bb:cc:dd:33
1:rx_tcpport 1955
1:rx_udpport 50005
1:rx_udpip 10.1.1.100
1:rx_udpmac F4:52:14:2F:32:00
1:detectorip 10.1.1.11
1:detectormac 00:aa:bb:cc:dd:33
rx_hostname pcmoench01
powerchip 1
vhighvoltage 200
#extsig:0 trigger_in_rising_edge
#timing trigger
outdir /external_pool/jungfrau_data/softwaretest

View File

@ -1,61 +0,0 @@
#initialchecks 0
#############################################
### edit with hostname or IP address of your detector
############################################
hostname bchip181+
#############################################
### edit with 10 Gbs IP of your server
############################################
udp_dstip 10.1.1.102
#############################################
### edit with any number in the subnet of your server (first 3 numbers as above)
############################################
udp_srcip 10.1.1.19
udp_dstport 33410
#############################################
### edit with 10 Gbs IP of your server
############################################
#rx_zmqip 10.1.1.102
#rx_zmqport 30001
#############################################
### edit with 1 Gbs IP of PC where you will run the GUI
############################################
#zmqip 129.129.202.136
#zmqport 40001
#############################################
### edit with hostname or 1Gbs IP address of your server
############################################
rx_hostname mpc2011
tengiga 1
rx_datastream 1
frames 1
period 0.001
#############################################
### edit with directory you want to write to
############################################
fpath /mnt/moench_data/scratch/
fwrite 0
rx_datastream 1
rx_jsonpara frameMode newpedestal
rx_jsonpara detectorMode analog
rx_discardpolicy discardpartial
adcpipeline 15
powerchip 1
vhighvoltage 90
adcreg 14 40

32
examples/mythen.config Normal file
View File

@ -0,0 +1,32 @@
type Mythen+
0:hostname mcs1x21
0:port 1952
0:stopport 1953
0:settingsdir /afs/psi.ch/user/b/bergamaschi
0:outdir /afs/psi.ch/user/b/bergamaschi
0:angdir 1.000000
0:moveflag 1.000000
0:lock 0
0:caldir /afs/psi.ch/user/b/bergamaschi
0:ffdir /afs/psi.ch/user/b/bergamaschi
0:nmod 1
0:waitstates 13
0:setlength 3
0:clkdivider 6
0:extsig:0 gate_in_active_high
0:extsig:1 trigger_in_rising_edge
0:extsig:2 off
0:extsig:3 off
master -1
sync none
outdir /afs/psi.ch/user/b/bergamaschi
ffdir /afs/psi.ch/user/b/bergamaschi
headerbefore none
headerafter none
headerbeforepar none
headerafterpar none
badchannels none
angconv none
globaloff 0.000000
binsize 0.001000
threaded 1

1
examples/receiver.config Normal file
View File

@ -0,0 +1 @@
dataport 1955

0
examples/scripts/.parab Executable file → Normal file
View File

View File

@ -0,0 +1,142 @@
#! /bin/awk -f
# this is an awk script to start a run
# you first need to run inimodule.awk to initialize
# the pattern, set Vc and set the trimbits
#
#####################################################################
# revision history #
#####################################################################
# 31.10.2001 first version #
#####################################################################
# #
# Bernd Schmitt #
# #
# bernd.schmitt@psi.ch #
# #
#####################################################################
# #
# modifications: #
# #
# 1.3.2002 BS adapted for use with DCB #
# #
# 25.5.2002 BS adapted to new convert program #
# #
# 29.5.2002 sleep -> usleep for meas. time , TS #
# #
#####################################################################
BEGIN {
# initialize variables
NPAR=3
PAR[1]="nrun"
PAR[2]="fn"
PAR[3]="par"
# initialize default values
PARVAL[1] = 100
PARVAL[2] = "microstrip_july2007"
PARVAL[3]=0
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
# read command line defined variables
if (ARGC>1) {
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
for (i=1; i<=ARGC; i++) {
printf("%s \n", ARGV[i]);
nsplit=split(ARGV[i],array,"=")
VAR = array[1];
VAL = array[2];
for (j=1; j<=NPAR; j++) {
if ( VAR==PAR[j] ) {
PARVAL[j] = VAL
}
}
}
}
run=PARVAL[1]
fn=PARVAL[2]
par=PARVAL[3]
# print command line arguments
for (i=1; i<=NPAR; i++){
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
}
printf("\n\n");
# generate parameter file
fnamep=fn".parab"
printf("header before\n")>> fnamep
system("date >>"fnamep)
printf("run=%i \n", run ) >> fnamep
#print detector parameters to file
if (par==1) {
command="sls_detector_get exptime| awk -F \" \" '{print $2}'"
command | getline var
printf("acquisition time = %11.6f second(s)\n", var) >> fnamep
command="sls_detector_get settings| awk -F \" \" '{print $2}'"
command | getline var
printf("settings = %s\n", var) >> fnamep;
command="sls_detector_get threshold| awk -F \" \" '{print $2}'"
command | getline var
printf("threshold energy = %d eV\n", var) >> fnamep;
command="sls_detector_get badchannels| awk -F \" \" '{print $2}'"
command | getline var
printf("bad channel list = %s\n",var) >> fnamep;
command="sls_detector_get angconv| awk -F \" \" '{print $2}'"
command | getline var
printf("angle calibration conversion = %s\n",var) >> fnamep;
command="sls_detector_get globaloff| awk -F \" \" '{print $2}'"
command | getline var
printf("beamline offset = %f deg\n", var) >> fnamep;
command="sls_detector_get fineoff| awk -F \" \" '{print $2}'"
command | getline var
printf("fine offset = %f deg\n", var) >> fnamep;
command="sls_detector_get flatfield| awk -F \" \" '{print $2}'"
command | getline var
printf("Flat field corrections = %s\n",var) >> fnamep;
command="sls_detector_get ratecorr| awk -F \" \" '{print $2}'"
command | getline var
printf("Dead time corrections tau = %d ns\n",var) >> fnamep;
}
#print beamline parameters to file
#read detector position
system("caget X04SA-ES2-TH2:RO.RBV >>"fnamep)
#read I0
system("caget X04SA-ES2-SC:CH6>>"fnamep)
}

87
examples/scripts/ScanScript.awk Executable file
View File

@ -0,0 +1,87 @@
#! /bin/awk -f
# this is an awk script to start a run
# you first need to run inimodule.awk to initialize
# the pattern, set Vc and set the trimbits
#
#####################################################################
# revision history #
#####################################################################
# 31.10.2001 first version #
#####################################################################
# #
# Bernd Schmitt #
# #
# bernd.schmitt@psi.ch #
# #
#####################################################################
# #
# modifications: #
# #
# 1.3.2002 BS adapted for use with DCB #
# #
# 25.5.2002 BS adapted to new convert program #
# #
# 29.5.2002 sleep -> usleep for meas. time , TS #
# #
#####################################################################
BEGIN {
# initialize variables
NPAR=4
PAR[1]="nrun"
PAR[2]="fn"
PAR[3]="var"
PAR[4]="par"
# initialize default values
PARVAL[1] = 100
PARVAL[2] = "myfname"
PARVAL[3] = 0
PARVAL[2] = "none"
# read command line defined variables
if (ARGC>1) {
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
for (i=1; i<=ARGC; i++) {
nsplit=split(ARGV[i],array,"=")
VAR = array[1];
VAL = array[2];
for (j=1; j<=NPAR; j++) {
if ( VAR==PAR[j] ) {
PARVAL[j] = VAL
}
}
}
}
run=PARVAL[1]
fn=PARVAL[2]
var=PARVAL[3]
par=PARVAL[4]
# print command line arguments
for (i=1; i<=NPAR; i++){
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
}
#execute you command hereafter e.g. change temperature etc.
}

View File

@ -0,0 +1,100 @@
#! /bin/awk -f
# this is an awk script to start a run
# you first need to run inimodule.awk to initialize
# the pattern, set Vc and set the trimbits
#
#####################################################################
# revision history #
#####################################################################
# 31.10.2001 first version #
#####################################################################
# #
# Bernd Schmitt #
# #
# bernd.schmitt@psi.ch #
# #
#####################################################################
# #
# modifications: #
# #
# 1.3.2002 BS adapted for use with DCB #
# #
# 25.5.2002 BS adapted to new convert program #
# #
# 29.5.2002 sleep -> usleep for meas. time , TS #
# #
#####################################################################
BEGIN {
# initialize variables
NPAR=7
PAR[1]="nrun"
PAR[2]="fn"
PAR[3]="par"
PAR[4]="sv0"
PAR[5]="sv1"
PAR[6]="p0"
PAR[7]="p1"
# initialize default values
PARVAL[1] = 100
PARVAL[2] = "myfname"
PARVAL[3] = 1
PARVAL[4] = 0
PARVAL[5] = 0
PARVAL[6] = "none"
PARVAL[7] = "none"
# read command line defined variables
if (ARGC>1) {
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
for (i=1; i<=ARGC; i++) {
nsplit=split(ARGV[i],array,"=")
VAR = array[1];
VAL = array[2];
for (j=1; j<=NPAR; j++) {
if ( VAR==PAR[j] ) {
PARVAL[j] = VAL
}
}
}
}
run=PARVAL[1]
fn=PARVAL[2]
"par"PAR[3]=
sv0=PAR[4]
sv1=PAR[5]
p0=PAR[6]
p1=PAR[7]
# print command line arguments
for (i=1; i<=NPAR; i++){
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
}
# printf("\n\n");
# system("close_shutter_g95")
# execute your actions hereafter
if (par==1) {
#open shutter
} else {
#close shutter
}
}

Some files were not shown because too many files have changed in this diff Show More