mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
Compare commits
38 Commits
2020.03.02
...
udp
Author | SHA1 | Date | |
---|---|---|---|
f08006db46 | |||
d5df63ce49 | |||
64d59b1dff | |||
a0bc843018 | |||
6126a401d0 | |||
7665d7b33a | |||
d3d8d7ba8e | |||
938d90bfb8 | |||
990f32397b | |||
53b1456f1a | |||
fbb901c8cc | |||
7b7641fb53 | |||
4de49906d4 | |||
c9b5db4d7f | |||
2e6378f241 | |||
692584ced8 | |||
4ae93dbc73 | |||
f37ceaf517 | |||
75a9002f2c | |||
cfec18e441 | |||
3ff7654c29 | |||
9781dbe49e | |||
e777c0fa79 | |||
9981632b2d | |||
d8436da540 | |||
4dc4c1ec0a | |||
6537aa1ceb | |||
467be41ccb | |||
73a39fcafe | |||
041c9fefa0 | |||
4f4f3baefc | |||
3523de8ba9 | |||
e77a93021d | |||
4dc14bf9d6 | |||
a5cdd687e6 | |||
89175586b4 | |||
c3bbe45b68 | |||
8f64449117 |
@ -4,6 +4,12 @@ language: cpp
|
||||
|
||||
os: linux
|
||||
|
||||
# env:
|
||||
# matrix:
|
||||
# - CONDA_PY="3.7"
|
||||
|
||||
|
||||
|
||||
dist: bionic
|
||||
|
||||
install:
|
||||
@ -33,6 +39,5 @@ deploy:
|
||||
provider: script
|
||||
script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||
on:
|
||||
branch: developer
|
||||
tags: true
|
||||
branch: udp
|
||||
|
||||
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
|
||||
project(slsDetectorPackage)
|
||||
set(PROJECT_VERSION 5.0.0)
|
||||
include(CheckIPOSupported)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
|
||||
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
include(cmake/project_version.cmake)
|
||||
@ -44,9 +44,6 @@ option(SLS_USE_PYTHON "Python bindings" OFF)
|
||||
option(SLS_USE_CTBGUI "ctb GUI" OFF)
|
||||
option(SLS_BUILD_DOCS "docs" OFF)
|
||||
option(SLS_BUILD_EXAMPLES "examples" OFF)
|
||||
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
|
||||
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
@ -114,11 +111,6 @@ if(SLS_USE_SANITIZER)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
endif()
|
||||
|
||||
if(SLS_TUNE_LOCAL)
|
||||
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
|
||||
endif()
|
||||
|
||||
|
||||
#rapidjson
|
||||
add_library(rapidjson INTERFACE)
|
||||
target_include_directories(rapidjson INTERFACE
|
||||
|
@ -1,13 +1,13 @@
|
||||
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
||||
version: "udp"
|
||||
|
||||
source:
|
||||
- path: ..
|
||||
|
||||
build:
|
||||
number: 2
|
||||
number: 1
|
||||
binary_relocation: True
|
||||
rpaths:
|
||||
- lib/
|
||||
|
@ -29,10 +29,9 @@
|
||||
#include "sls_detector_defs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "moench03CtbData.h"
|
||||
//#include "moench03TCtbData.h"
|
||||
//#include "moench03T1CtbData.h"
|
||||
#include "moench03TCtbData.h"
|
||||
#include "moench03T1CtbData.h"
|
||||
#include "moench03CommonMode.h"
|
||||
#include "moench03T1ZmqDataNew.h"
|
||||
#include "moench02CtbData.h"
|
||||
//#include "jungfrau10ModuleData.h"
|
||||
#include "moenchCommonMode.h"
|
||||
@ -44,9 +43,6 @@
|
||||
#include "moench04CtbZmq10GbData.h"
|
||||
#include "deserializer.h"
|
||||
#include "detectorData.h"
|
||||
#include "imageZmq16bit.h"
|
||||
#include "imageZmq32bit.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -236,10 +232,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
cbDetType->AddEntry("MOENCH02", MOENCH02);
|
||||
cbDetType->AddEntry("MOENCH04", MOENCH04);
|
||||
// cbDetType->AddEntry("JUNGFRAU1.0", 2);
|
||||
cbDetType->AddEntry("MOENCH03",MOENCH03);
|
||||
cbDetType->AddEntry("IMAGE32BIT",IMAGE32B);
|
||||
cbDetType->AddEntry("IMAGE16BIT",IMAGE16B);
|
||||
|
||||
//cbDetType->AddEntry("MOENCH03 T", iiii++);
|
||||
//cbDetType->AddEntry("MOENCH03", iiii++);
|
||||
// cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301);
|
||||
// cbDetType->AddEntry("ADCSAR2", ADCSAR2);
|
||||
@ -278,7 +271,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
|
||||
|
||||
// cout << "off "<< endl;
|
||||
cout << "off "<< endl;
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
@ -297,8 +290,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eSerOff->MapWindow();
|
||||
eSerOff->SetNumber(0);
|
||||
eSerOff->MapWindow();;
|
||||
eSerOff->SetNumber(5);
|
||||
e= eSerOff->TGNumberEntry::GetNumberEntry();
|
||||
eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeSerialOffset()");
|
||||
@ -344,53 +337,6 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
hframe->MapWindow();
|
||||
|
||||
|
||||
|
||||
label=new TGLabel(hframe,"Image Pixels");
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
|
||||
label->MapWindow();
|
||||
label->SetTextJustify(kTextLeft);
|
||||
|
||||
|
||||
label=new TGLabel(hframe,"X: ");
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
|
||||
label->MapWindow();
|
||||
label->SetTextJustify(kTextRight);
|
||||
|
||||
|
||||
ePixX=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(ePixX,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
ePixX->MapWindow();
|
||||
ePixX->SetNumber(400);
|
||||
e= ePixX->TGNumberEntry::GetNumberEntry();
|
||||
ePixX->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()");
|
||||
|
||||
|
||||
|
||||
label=new TGLabel(hframe,"Y: ");
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
|
||||
label->MapWindow();
|
||||
label->SetTextJustify(kTextRight);
|
||||
|
||||
|
||||
ePixY=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(ePixY,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
ePixY->MapWindow();
|
||||
ePixY->SetNumber(400);
|
||||
e= ePixY->TGNumberEntry::GetNumberEntry();
|
||||
ePixY->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()");
|
||||
|
||||
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
@ -913,11 +859,6 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
nx=eNumCount->GetIntNumber();
|
||||
dr=eDynRange->GetIntNumber();
|
||||
soff=eSerOff->GetIntNumber();
|
||||
// cout <<"deserializer: " << endl;
|
||||
// cout << "Number of chans:\t" << nx << endl;
|
||||
// cout << "Serial Offset:\t" << soff << endl;
|
||||
// cout << "Dynamic range:\t" << dr << endl;
|
||||
|
||||
}
|
||||
|
||||
i=0;
|
||||
@ -982,7 +923,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
for (int y=0; y<ny; y++) {
|
||||
ped=0;
|
||||
aval=dataStructure->getValue(data->data,x,y);
|
||||
// cout << x << " " <<y << " "<< aval << endl;
|
||||
|
||||
if (cbGetPedestal->IsOn()) {
|
||||
if (photonFinder) {
|
||||
photonFinder->addToPedestal(aval,x,y);
|
||||
@ -1259,9 +1200,6 @@ void ctbAcquisition::changeDetector(){
|
||||
eNumCount->SetState(kFALSE);
|
||||
eDynRange->SetState(kFALSE);
|
||||
eSerOff->SetState(kFALSE);
|
||||
ePixX->SetState(kFALSE);
|
||||
ePixY->SetState(kFALSE);
|
||||
|
||||
deserializer=0;
|
||||
if (rb2D->IsOn() ) {//|| rbScan->IsOn()
|
||||
switch (cbDetType->GetSelected()) {
|
||||
@ -1272,6 +1210,7 @@ void ctbAcquisition::changeDetector(){
|
||||
// commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH04:
|
||||
|
||||
try {
|
||||
auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
if (retval) {
|
||||
@ -1284,54 +1223,6 @@ void ctbAcquisition::changeDetector(){
|
||||
cout << "MOENCH 0.4!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH03:
|
||||
//try {
|
||||
// auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
// if (retval) {
|
||||
dataStructure=new moench03T1ZmqDataNew(nAnalogSamples);
|
||||
// } else {
|
||||
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
// }
|
||||
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "MOENCH 0.3! USE JUNGFRAU MODULE!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case IMAGE32B:
|
||||
//try {
|
||||
// auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
// if (retval) {
|
||||
// if (deserializer) {
|
||||
ePixX->SetState(kTRUE);
|
||||
ePixY->SetState(kTRUE);
|
||||
// }
|
||||
dataStructure=new imageZmq32bit(ePixX->GetIntNumber(),ePixY->GetIntNumber());
|
||||
// } else {
|
||||
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
// }
|
||||
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "Image 32bit, no channel shuffling" << endl;
|
||||
commonMode=NULL;
|
||||
break;
|
||||
|
||||
case IMAGE16B:
|
||||
//try {
|
||||
// auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
// if (retval) {
|
||||
// if (deserializer) {
|
||||
ePixX->SetState(kTRUE);
|
||||
ePixY->SetState(kTRUE);
|
||||
// }
|
||||
dataStructure=new imageZmq16bit(ePixX->GetIntNumber(),ePixY->GetIntNumber());
|
||||
// } else {
|
||||
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
// }
|
||||
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "Image 16bit, no channel shuffling" << endl;
|
||||
commonMode=NULL;
|
||||
break;
|
||||
|
||||
// case 1:
|
||||
// cout << "************** T!!!!!!!!!!" << endl;
|
||||
@ -1395,7 +1286,6 @@ void ctbAcquisition::changeDetector(){
|
||||
photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode
|
||||
//photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode
|
||||
dataStructure->getDetectorSize(nx,ny);
|
||||
|
||||
}
|
||||
if (deserializer) {
|
||||
ny=1;
|
||||
@ -1621,13 +1511,13 @@ void ctbAcquisition::update() {
|
||||
|
||||
if (dataStructure) {
|
||||
cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
// cout << "settings deserialiation parameters for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// eSerOff->SetNumber( ms->setSerialOffset(-1));
|
||||
// eDynRange->SetNumber( ms->setDynamicRange(-1));
|
||||
// eNumCount->SetNumber( ms->setNumberOfCounters(-1));
|
||||
// }
|
||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
cout << "settings deserialiation parameters for MYTHEN" << endl;
|
||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
eSerOff->SetNumber( ms->setSerialOffset(-1));
|
||||
eDynRange->SetNumber( ms->setDynamicRange(-1));
|
||||
eNumCount->SetNumber( ms->setNumberOfCounters(-1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2087,22 +1977,20 @@ void ctbAcquisition::ChangeNumberOfChannels(Long_t a){
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeSerialOffset(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
// cout << "settings offsets for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
// // cout << cbDetType->GetSelected()<< endl;
|
||||
// // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
// // cout << "settings offsets for MYTHEN" << endl;
|
||||
// // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// // ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
|
||||
// }
|
||||
// // }
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeDynamicRange(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
@ -2116,7 +2004,6 @@ void ctbAcquisition::ChangeDynamicRange(){
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeNumberOfChannels(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
@ -2130,24 +2017,6 @@ void ctbAcquisition::ChangeNumberOfChannels(){
|
||||
changePlot();
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeImagePixels(Long_t a){
|
||||
ChangeImagePixels();
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeImagePixels(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
// cout << "settings number of channels for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// ms->setNumberOfCounters(eNumCount->GetIntNumber());
|
||||
|
||||
// }
|
||||
// }
|
||||
// if (deserializer)
|
||||
// changePlot();
|
||||
};
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeHistoLimitsPedSub(Long_t a){
|
||||
|
@ -42,7 +42,7 @@ using namespace std;
|
||||
class ctbAcquisition : public TGGroupFrame {
|
||||
|
||||
|
||||
enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE32B, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
|
||||
|
||||
private:
|
||||
@ -57,9 +57,6 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
TGNumberEntry *eNumCount;
|
||||
|
||||
|
||||
TGNumberEntry *ePixX;
|
||||
TGNumberEntry *ePixY;
|
||||
|
||||
TGNumberEntry *eFitADC;
|
||||
TGNumberEntry *eBitPlot;
|
||||
TGNumberEntry *eMinRaw;
|
||||
@ -234,8 +231,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
void ChangeNumberOfChannels(Long_t);
|
||||
void ChangeDynamicRange();
|
||||
void ChangeDynamicRange(Long_t);
|
||||
void ChangeImagePixels();
|
||||
void ChangeImagePixels(Long_t);
|
||||
|
||||
|
||||
void canvasClicked();
|
||||
void FitADC();
|
||||
|
133
examples/moench03_T1.config → examples/moench01_T1_lab.config
Normal file → Executable file
133
examples/moench03_T1.config → examples/moench01_T1_lab.config
Normal file → Executable file
@ -1,13 +1,4 @@
|
||||
#############################################
|
||||
### edit with hostname or IP address of your detector
|
||||
############################################
|
||||
hostname bchip181+
|
||||
runclk 40
|
||||
adcclk 20
|
||||
dbitclk 40
|
||||
|
||||
|
||||
|
||||
hostname bchip085+
|
||||
|
||||
patword 0000 0000000000000000
|
||||
patword 0001 0000000000000000
|
||||
@ -417,80 +408,84 @@ patnloop1 0
|
||||
patloop2 0400 0400
|
||||
patnloop2 0
|
||||
patwait0 00aa
|
||||
patwaittime0 10000
|
||||
patwaittime0 40000
|
||||
patwait1 0400
|
||||
patwaittime1 0
|
||||
patwait2 0400
|
||||
patwaittime2 0
|
||||
|
||||
|
||||
#0:rx_tcpport 1977
|
||||
####mcp2011
|
||||
#0:rx_udpip 10.1.1.102
|
||||
#0:detectorip 10.1.1.19
|
||||
#0:rx_udpport 32410
|
||||
####gui listening to
|
||||
#zmqip 129.129.202.131
|
||||
#zmqport 30001
|
||||
####data streaming out of
|
||||
#rx_zmqip 10.1.2.103
|
||||
#rx_zmqport 30003
|
||||
#0:rx_hostname mpc2011
|
||||
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
0:udp_dstip 10.1.2.102
|
||||
#############################################
|
||||
### edit with any number in the subnet of your server (first 3 numbers as above)
|
||||
############################################
|
||||
0:udp_srcip 10.1.2.19
|
||||
|
||||
0:udp_dstport 32410
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
#zmqip 129.129.202.110
|
||||
rx_zmqip 10.1.1.102
|
||||
rx_zmqport 30001
|
||||
#############################################
|
||||
### edit with 1 Gbs IP of PC where you will run the GUI
|
||||
############################################
|
||||
#zmqip 129.129.202.110
|
||||
#zmqport 50001
|
||||
####mx-test-1
|
||||
0:rx_udpip 10.1.1.100
|
||||
0:detectorip 10.1.1.19
|
||||
0:rx_udpport 32410
|
||||
####gui listening to (on receiver pc)
|
||||
zmqip 129.129.202.92
|
||||
zmqport 30001
|
||||
####data streaming out of
|
||||
rx_zmqip 10.1.1.100
|
||||
rx_zmqport 30003
|
||||
0:rx_hostname pcmoench01
|
||||
|
||||
|
||||
#############################################
|
||||
### edit with hostname or 1Gbs IP address of your server
|
||||
############################################
|
||||
0:rx_hostname mpc2011
|
||||
|
||||
tengiga 1
|
||||
|
||||
#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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#turn on datastream from commandline
|
||||
rx_datastream 1
|
||||
|
||||
r_readfreq 1
|
||||
|
||||
#0:configuremac -1
|
||||
rx_datastream 1
|
||||
|
||||
r_readfreq 1
|
||||
|
||||
|
||||
dac:6 800
|
||||
dac:0 1300
|
||||
dac:4 1428
|
||||
dac:1 1000
|
||||
dac:7 900
|
||||
dac:3 680
|
||||
dac:2 1400
|
||||
dac:5 1200
|
||||
adcinvert 4a342593
|
||||
samples 5000
|
||||
adcphase 30 deg
|
||||
adcpipeline 14
|
||||
adcphase 90
|
||||
adcpipeline 15
|
||||
adcreg 14 40
|
||||
powerchip 1
|
||||
vhighvoltage 90
|
||||
period 0.005
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
frames 100
|
||||
period 0.1
|
||||
outdir /scratch/
|
||||
enablefwrite 0
|
||||
|
||||
|
||||
|
@ -176,7 +176,6 @@ One can configure all the detector settings in a parameter file {\tt{setup.det}}
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-parameters setup.det
|
||||
\end{verbatim}
|
||||
Note that the parameter file for any realease before 4.1.1 has not the possibility to understand parameters to be set differently for different half modules, i.e. {\tt{0:txndelay\_left xxxxx},\tt{1:txndelay\_left yyyyy}}.
|
||||
|
||||
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{vhighvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
|
||||
Other important settings that are configured in the {\tt{setup.det}} file are:
|
||||
@ -610,19 +609,18 @@ The detector can be setup such to receive external triggers. Connect a LEMO sign
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_acquire 0-
|
||||
\end{verbatim}
|
||||
No timeout is expected between the start of the acquisition and the arrival of the first trigger.
|
||||
|
||||
Here are the implemented options so far:
|
||||
\begin{itemize}
|
||||
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of cycles (i.e. triggers) to 1 using {\tt{cycles}}. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{cycles}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of triggers (i.e. triggers) to 1 using {\tt{triggers}}. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{triggers}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{triggers}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{triggers}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
|
||||
ATTENTION: From release 4.1.1 with the {\tt{trigger}} option it is possible to have software triggers as a debugging tool (instead of the hardware trigger signal. One should start the acquisition (with the blocking {\tt{sls\_detector\_acquire}} if wanted and with another client one can send the softare trigger {\tt{sls\_detector\_put status trigger}}. This option allows for example to perform a motor scan (moving a motor in between single images) and still writing all images to the same file.
|
||||
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
|
||||
However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}.
|
||||
|
||||
@ -630,13 +628,13 @@ However, from 4.1.0, in gating mode, an option to immediately terminate the subf
|
||||
|
||||
Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be output in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal.
|
||||
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{triggers}} configurable at the same time.
|
||||
|
||||
There is the possibility to use {\tt{timing trigger/burst\_trigger}} and send software single commands to fake the trigger. This is done with:
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [trigger/burst_trigger]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_status trigger
|
||||
\end{verbatim}
|
||||
Note that this functionality is very (!) useful if you need to do something between and acquisition and the next. This can be used to do a fast threshold scan for example. See section~\ref{sec:fastthresholdscan}.
|
||||
@ -717,7 +715,7 @@ If \textbf{dr} is 32 and \textbf{clkdivider} is not 2, whatever the detector get
|
||||
Here is a list of parameters that should be reset:
|
||||
\begin{enumerate}
|
||||
\item \textbf{resetframescaught} should be reset to zero after every acquisition taken with {\tt{receiver start}},{\tt{status start}},{\tt{receiver stop}}. If the acquisition is taken with {\tt{sls\_detector\_acquire}}, there is no need to reset this.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{cycles}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{cycles} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{triggers}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{triggers} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
@ -990,14 +988,13 @@ Packets Caught Mask : 64 bytes
|
||||
Note that if one wants to reconstruct the real time the detector was acquiring in 32 bit (autosumming mode), one would have to multiply the SubExptime (ns) for the SubFrame Number.
|
||||
|
||||
\subsection{Offline image reconstruction}
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. However, it can be retrieved from \\
|
||||
{\tt{git clone https://github.com/slsdetectorgroup/slsImageReconstruction.git slsImageReconstruction}}.\\
|
||||
Checkout the {\tt{v3.1}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code. There is a {\tt{developer}} branch that has newer updates but needs to be tested.
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\
|
||||
{\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}.
|
||||
Checkout the {\tt{developer}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code.
|
||||
|
||||
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5}. \textbf{tiff} and \textbf{root} format. The detector writes 2 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
|
||||
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5} and \textbf{root} format. The detector writes 4 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
|
||||
|
||||
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in \\
|
||||
{\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
|
||||
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
|
||||
\begin{verbatim}
|
||||
#define EIGER_MAX_FRAMES_PER_FILE 2000
|
||||
\end{verbatim}
|
||||
@ -1046,12 +1043,11 @@ cbfMaker9M [file_name_with_dir]
|
||||
contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side), the 1.5M OMNY geometry (3 modules next to each other on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\
|
||||
Missing packets in a frame and border pixels ($\times 2$ and $\times 4$ are given with value $-1$ at the present time.
|
||||
|
||||
From the new {{v4.1.1}} all the define that you see below need only to be modified in the Makefile.
|
||||
|
||||
Make sure the following options are uncommented in the {\tt{slsImageReconstruction/src/main\_csaxs.cpp}} file.
|
||||
\begin{verbatim}
|
||||
#define MYCBF
|
||||
##following line only if you need to process with BUBBLE
|
||||
##following line only if you need to process with
|
||||
##BUBBLE (Material Science / uXAS beamlines).
|
||||
#define MSHeader
|
||||
\end{verbatim}
|
||||
Compile it with:
|
||||
@ -1100,10 +1096,6 @@ To use it any geometry:\\
|
||||
eg.
|
||||
{\tt image /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
|
||||
|
||||
With new new software, the new options to run the cbfMaker/hdf5Maker executablesare:
|
||||
|
||||
./hdf5Maker -f [filename] -d [outdirname] -x [npix\_x] -y [npix\_y] -v (v flags that longedge is vertical, no argument) -n [name\_of\_hdf5\_dataset] -m (mask\_hot\_pixels, need to be in file maskpix.txt in the samedir as executable, no argument) -g [0,no filling/1,division/2,interpolation/3,interpolate,alternative]
|
||||
|
||||
\subsection{Read temperatures/HV from boards}
|
||||
|
||||
With an updated kernel on the linux boards (ask to the SLS detector group for specifications), it is possible to monitor the temperature on the boards:
|
||||
@ -1265,7 +1257,7 @@ We have also been requested if we could speed up the threshold scan. At the mome
|
||||
./sls_detector_put enablefwrite 0
|
||||
./sls_detector_put resetframescaught 0
|
||||
./sls_detector_put index 0
|
||||
./sls_detector_put cycles 21
|
||||
./sls_detector_put triggers 21
|
||||
./sls_detector_put receiver start
|
||||
./sls_detector_put status start
|
||||
for i in $(seq 0 20);
|
||||
@ -1523,8 +1515,8 @@ frames number
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
\item \begin{verbatim}
|
||||
sls_detector_get cycles
|
||||
cycles number
|
||||
sls_detector_get triggers
|
||||
triggers number
|
||||
\end{verbatim}
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
|
@ -3,9 +3,9 @@ import sys
|
||||
import numpy as np
|
||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||
|
||||
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||
from slsdet import dacIndex, readoutMode
|
||||
from slsdet.lookup import view, find
|
||||
from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||
from sls_detector import dacIndex, readoutMode
|
||||
from sls_detector.lookup import view, find
|
||||
|
||||
d = Detector()
|
||||
# e = Eiger()
|
||||
|
@ -8,7 +8,7 @@ import sys
|
||||
import setuptools
|
||||
import os
|
||||
|
||||
__version__ = os.environ.get('GIT_DESCRIBE_TAG', 'developer')
|
||||
__version__ = 'udp'
|
||||
|
||||
|
||||
def get_conda_path():
|
||||
|
@ -1,9 +1,9 @@
|
||||
from .detector import Detector
|
||||
|
||||
def view(name, det = Detector):
|
||||
names = find(name, det)
|
||||
def view(name):
|
||||
names = find(name)
|
||||
for n in names:
|
||||
print(n)
|
||||
|
||||
def find(name, det = Detector):
|
||||
return [n for n in dir(det) if name.lower() in n.lower()]
|
||||
def find(name):
|
||||
return [n for n in dir(Detector) if name in n]
|
@ -428,13 +428,6 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setImageTestMode", &Detector::setImageTestMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getNumberOfBursts", &Detector::getNumberOfBursts,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfBursts", &Detector::setNumberOfBursts, py::arg())
|
||||
.def("getBurstPeriod", &Detector::getBurstPeriod,
|
||||
py::arg() = Positions{})
|
||||
.def("setBurstPeriod", &Detector::setBurstPeriod, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getInjectChannel", &Detector::getInjectChannel,
|
||||
py::arg() = Positions{})
|
||||
.def("setInjectChannel", &Detector::setInjectChannel, py::arg(),
|
||||
@ -448,14 +441,6 @@ void init_det(py::module &m) {
|
||||
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
||||
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getCurrentSource", &Detector::getCurrentSource,
|
||||
py::arg() = Positions{})
|
||||
.def("setCurrentSource", &Detector::setCurrentSource, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getTimingSource", &Detector::getTimingSource,
|
||||
py::arg() = Positions{})
|
||||
.def("setTimingSource", &Detector::setTimingSource, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getCounterMask", &Detector::getCounterMask,
|
||||
py::arg() = Positions{})
|
||||
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
||||
|
@ -284,11 +284,4 @@ void init_enums(py::module &m) {
|
||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
|
||||
.value("TIMING_INTERNAL",
|
||||
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
|
||||
.value("TIMING_EXTERNAL",
|
||||
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
|
||||
.export_values();
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ template <class dataType> class analogDetector {
|
||||
if (g==0) g=-1.;
|
||||
}
|
||||
|
||||
return stat[iy][ix].getPedestalRMS();//divide by gain?
|
||||
return stat[iy][ix].getPedestalRMS()/g;//divide by gain?
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef DESERIALIZER_H
|
||||
#define DESERIALIZER_H
|
||||
#include <vector>
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
class deserializer : public slsDetectorData<int> {
|
||||
|
||||
@ -53,13 +52,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||
// off=0;
|
||||
//int iarg;
|
||||
|
||||
|
||||
cout <<"** deserializer: " << endl;
|
||||
cout << "** Number of chans:\t" << nch << endl;
|
||||
cout << "** Serial Offset:\t" << off << endl;
|
||||
cout << "** Dynamic range:\t" << dr << endl;
|
||||
int64_t word, *wp, ww,one=1, bit ;
|
||||
int64_t word, *wp;
|
||||
int* val=new int[nch];
|
||||
int ioff=0;
|
||||
int idr=0;
|
||||
@ -73,62 +66,39 @@ class deserializer : public slsDetectorData<int> {
|
||||
val[ib]=0;
|
||||
}
|
||||
wp=(int64_t*)ptr;
|
||||
|
||||
int nw=nch/nb;
|
||||
|
||||
cout << "** Number of bits:\t" << nb << endl;
|
||||
cout << "** Samples:\t" << nw << endl;
|
||||
|
||||
for (ib=0; ib<nb; ib++) {
|
||||
cout << dbl[ib] << " " ;
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
for (ib=0; ib<nch; ib++) {
|
||||
val[ib]=0;
|
||||
}
|
||||
|
||||
for (iw=0; iw<nw; iw) {
|
||||
for (iw=0; iw<nch/nb; iw) {
|
||||
word=*wp;;
|
||||
if (ioff<off) {
|
||||
ioff++;
|
||||
// cout <<"*";
|
||||
} else {
|
||||
//if (idr<16) {
|
||||
//ib=0;
|
||||
// cout << hex << "*************" << word << endl;
|
||||
for (ib=0; ib<nb; ib++) {
|
||||
// for (const auto &bit : dbl) {
|
||||
ich=iw+nch*ib/nb;
|
||||
/* if (ich>1060) */
|
||||
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
|
||||
bit=dbl[ib];
|
||||
ww=one<<bit;
|
||||
if (word&(ww) && ich<nch) {
|
||||
ib=0;
|
||||
for (const auto &bit : dbl) {
|
||||
ich=iw+nch/nb*(ib);
|
||||
if (word&(1<<bit) && ich<nch) {
|
||||
//cout << "+" ;
|
||||
val[ich]|=(1<<idr);
|
||||
}
|
||||
/* if (ich>1060) */
|
||||
/* cout << val[ich] << " " << hex << word << " " << ww << " " << (word&(ww)) << dec <<endl; */
|
||||
/* //else { */
|
||||
} //else {
|
||||
//cout << "-" ;
|
||||
//}
|
||||
//ib++;
|
||||
ib++;
|
||||
}
|
||||
|
||||
idr++;
|
||||
}
|
||||
|
||||
idr++;
|
||||
if (idr==dr) {
|
||||
idr=0;
|
||||
// cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl;
|
||||
// cout <<dec << iw<<endl;
|
||||
cout <<dec << iw<<endl;
|
||||
iw++;
|
||||
}//end if()
|
||||
|
||||
//end else()
|
||||
wp+=1;
|
||||
// ii++;
|
||||
ii++;
|
||||
}//end for
|
||||
|
||||
|
||||
@ -147,7 +117,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
int ii=0;
|
||||
int ich;
|
||||
int nb=dbl.size();
|
||||
int bit;
|
||||
|
||||
char *dval;
|
||||
|
||||
idr=0;
|
||||
@ -157,13 +127,8 @@ class deserializer : public slsDetectorData<int> {
|
||||
dval=ptr;
|
||||
|
||||
ib=0;
|
||||
ich=0;
|
||||
for (ib=0; ib<nb; ib++) {
|
||||
// for (const auto &bit : dbl) {
|
||||
|
||||
/* if (ich>1060) */
|
||||
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
|
||||
bit=dbl[ib];
|
||||
ich=0;
|
||||
for (const auto &bit : dbl) {
|
||||
//ioff=off;
|
||||
idr=0;
|
||||
for (iw=0; iw<(nch*dr/nb)/8; iw++) {
|
||||
@ -176,7 +141,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
}
|
||||
}
|
||||
ii++;
|
||||
// ib++;
|
||||
ib++;
|
||||
}//end for
|
||||
|
||||
|
||||
|
@ -1,125 +0,0 @@
|
||||
#ifndef IMAGEZMQ16BIT_H
|
||||
#define IMAGEZMQ16BIT_H
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
|
||||
class imageZmq16bit : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
|
||||
// int iframe;
|
||||
public:
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||
(160x160 pixels, 40 packets 1286 large etc.)
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||
imageZmq16bit(int nnx=400, int nny=400): slsDetectorData<uint16_t>(nnx, nny, 2*nnx*nny) {
|
||||
cout << "* " << nx << " " << ny << endl;
|
||||
int is=0;
|
||||
for (int row=0; row<ny; row++){
|
||||
for(int col=0;col<nx;col++){
|
||||
dataMap[row][col]=is*2;
|
||||
is++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
virtual double getValue(char *data, int ix, int iy=0) {
|
||||
|
||||
cout << ix << " " << ix << dataMap[iy][ix] << 2*nx*ny << " "<< endl;
|
||||
uint16_t val=getChannel(data, ix, iy)&0x3fff;
|
||||
return val;
|
||||
};
|
||||
|
||||
|
||||
int getFrameNumber(char *buff){return *((int*)buff);};//*((int*)(buff+5))&0xffffff;};
|
||||
|
||||
|
||||
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin) {
|
||||
int ff=-1, np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int &ff) {
|
||||
int np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||
char *data=new char[2*nx*ny];
|
||||
char *d=readNextFrame(filebin, ff, np, data);
|
||||
if (d==NULL) {delete [] data; data=NULL;}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||
//char *retval=0;
|
||||
// int nd;
|
||||
//int fnum = -1;
|
||||
np=0;
|
||||
// int pn;
|
||||
|
||||
|
||||
// if (ff>=0)
|
||||
// fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, 2*nx*ny) ){
|
||||
// iframe++;
|
||||
//ff=iframe;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||
if (dsize<2*nx*ny) ndata=dsize;
|
||||
else ndata=2*nx*ny;
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// virtual int setFrameNumber(int ff){iframe=ff};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int getPacketNumber(int x, int y) {return 0;};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,125 +0,0 @@
|
||||
#ifndef IMAGEZMQ32BIT_H
|
||||
#define IMAGEZMQ32BIT_H
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
|
||||
class imageZmq32bit : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
|
||||
// int iframe;
|
||||
public:
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||
(160x160 pixels, 40 packets 1286 large etc.)
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||
imageZmq32bit(int nnx=400, int nny=400): slsDetectorData<uint16_t>(nnx, nny, sizeof(uint32_t)*nnx*nny) {
|
||||
cout << "* " << nx << " " << ny << endl;
|
||||
int is=0;
|
||||
for (int row=0; row<ny; row++){
|
||||
for(int col=0;col<nx;col++){
|
||||
dataMap[row][col]=is*sizeof(uint32_t);
|
||||
is++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
/* virtual double getValue(char *data, int ix, int iy=0) { */
|
||||
|
||||
/* //cout << ix << " " << ix << dataMap[iy][ix] << 2*nx*ny << " "<< endl; */
|
||||
/* uint16_t val=getChannel(data, ix, iy); */
|
||||
/* return val; */
|
||||
/* }; */
|
||||
|
||||
|
||||
int getFrameNumber(char *buff){return *((int*)buff);};//*((int*)(buff+5))&0xffffff;};
|
||||
|
||||
|
||||
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin) {
|
||||
int ff=-1, np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int &ff) {
|
||||
int np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
};
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||
char *data=new char[2*nx*ny];
|
||||
char *d=readNextFrame(filebin, ff, np, data);
|
||||
if (d==NULL) {delete [] data; data=NULL;}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||
//char *retval=0;
|
||||
// int nd;
|
||||
//int fnum = -1;
|
||||
np=0;
|
||||
// int pn;
|
||||
|
||||
|
||||
// if (ff>=0)
|
||||
// fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, 2*nx*ny) ){
|
||||
// iframe++;
|
||||
//ff=iframe;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||
if (dsize<2*nx*ny) ndata=dsize;
|
||||
else ndata=2*nx*ny;
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// virtual int setFrameNumber(int ff){iframe=ff};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int getPacketNumber(int x, int y) {return 0;};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -28,8 +28,7 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||
moench03T1ZmqDataNew(int ns=5000, int oo=0): slsDetectorData<uint16_t>(400, 400, ns*32*2+oo), nSamples(ns), offset(oo), xtalk(0.00021) {
|
||||
moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||
|
||||
int nadc=32;
|
||||
int sc_width=25;
|
||||
@ -138,7 +137,6 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
/* vout+=0.0008*val-6224; */
|
||||
/* return vout; //(double)getChannel(data, ix, iy);
|
||||
*/
|
||||
// cout << ix << " "<< iy << " " << dataMap[iy][ix] << endl;
|
||||
return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy);
|
||||
};
|
||||
|
||||
|
@ -1,19 +1,15 @@
|
||||
|
||||
INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ -I../../libs/rapidjson/
|
||||
INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/
|
||||
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -g -std=c++11 -Wall
|
||||
#-L../../bin -lhdf5 -L.
|
||||
|
||||
#DESTDIR?=../bin
|
||||
|
||||
all: moenchZmqProcess moenchZmqProcessCtbGui
|
||||
|
||||
all: moenchZmqProcess
|
||||
|
||||
moenchZmqProcess: moenchZmqProcess.cpp clean
|
||||
g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP
|
||||
|
||||
moenchZmqProcessCtbGui: moenchZmqProcess.cpp clean
|
||||
g++ -o moenchZmqProcessCtbGui moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DCTBGUI
|
||||
|
||||
clean:
|
||||
rm -f moenchZmqProcess
|
||||
|
||||
|
@ -74,14 +74,6 @@ int main(int argc, char *argv[]) {
|
||||
// high_resolution_clock::time_point t1;
|
||||
// high_resolution_clock::time_point t2 ;
|
||||
time_t begin,end,finished;
|
||||
int rms=0;
|
||||
|
||||
int nped=1000, nped0=100;
|
||||
|
||||
#ifdef PTC
|
||||
nped=10000;
|
||||
nped0=10000;
|
||||
#endif
|
||||
|
||||
|
||||
if (argc > 4) {
|
||||
@ -119,7 +111,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
//slsDetectorData *det=new moench03T1ZmqDataNew();
|
||||
moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew(5000,sizeof(int));
|
||||
moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew();
|
||||
cout << endl << " det" <<endl;
|
||||
int npx, npy;
|
||||
det->getDetectorSize(npx, npy);
|
||||
@ -137,15 +129,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int ncol_cm=CM_ROWS;
|
||||
double xt_ghost=C_GHOST;
|
||||
|
||||
|
||||
moench03CommonMode *cm=NULL;
|
||||
moench03GhostSummation *gs=NULL;
|
||||
#ifdef CORR
|
||||
cm=new moench03CommonMode(ncol_cm);
|
||||
gs=new moench03GhostSummation(det, xt_ghost);
|
||||
#endif
|
||||
|
||||
moench03CommonMode *cm=new moench03CommonMode(ncol_cm);
|
||||
moench03GhostSummation *gs=new moench03GhostSummation(det, xt_ghost);
|
||||
double *gainmap=NULL;
|
||||
float *gm;
|
||||
double *gmap=NULL;
|
||||
@ -173,7 +158,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
//analogDetector<uint16_t> *filter=new analogDetector<uint16_t>(det,1,NULL,1000);
|
||||
#ifndef INTERP
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, nSigma, 1, cm, nped, nped0, -1, -1, gainmap, gs);
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
|
||||
multiThreadedCountingDetector *mt=new multiThreadedCountingDetector(filter,nthreads,fifosize);
|
||||
|
||||
@ -184,7 +169,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (etafname) interp->readFlatField(etafname);
|
||||
|
||||
interpolatingDetector *filter=new interpolatingDetector(det,interp, nSigma, 1, cm, nped, nped0, -1, -1, gainmap, gs);
|
||||
interpolatingDetector *filter=new interpolatingDetector(det,interp, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
multiThreadedInterpolatingDetector *mt=new multiThreadedInterpolatingDetector(filter,nthreads,fifosize);
|
||||
#endif
|
||||
|
||||
@ -308,8 +293,7 @@ int main(int argc, char *argv[]) {
|
||||
uint8_t detType = 0;
|
||||
uint8_t version = 0;
|
||||
// int* flippedData = 0;
|
||||
string* additionalJsonHeader = 0;
|
||||
//char* additionalJsonHeader = 0;
|
||||
char* additionalJsonHeader = 0;
|
||||
|
||||
int32_t threshold=0;
|
||||
|
||||
@ -372,11 +356,6 @@ int main(int argc, char *argv[]) {
|
||||
sprintf(ofname,"%s_%ld_ped.tiff",fname,fileindex);
|
||||
mt->writePedestal(ofname);
|
||||
cout << "Writing pedestal to " << ofname << endl;
|
||||
if (rms) {
|
||||
sprintf(ofname,"%s_%ld_var.tiff",fname,fileindex);
|
||||
mt->writePedestalRMS(ofname);
|
||||
cout << "Writing pedestal variance to " << ofname << endl;
|
||||
}
|
||||
}
|
||||
#ifdef INTERP
|
||||
else if (fMode==eFlat) {
|
||||
@ -409,7 +388,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
dout[ix]=ped[ix];
|
||||
// if (ix<100*400)
|
||||
// cout << ix << " " << ped[ix] << " "<< dout[ix] << endl;
|
||||
// cout << ix << " " << ped[ix] << endl;
|
||||
}
|
||||
|
||||
}
|
||||
@ -447,9 +426,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// }
|
||||
// }
|
||||
dout[ix]=detimage[ix];
|
||||
if (dout[ix]<0) dout[ix]=0;
|
||||
//cout << ix << " " << dout[ix] << endl;
|
||||
dout[ix]=detimage[ix];
|
||||
if (dout[ix]<0) dout[ix]=0;
|
||||
// cout << ix << " " << dout[ix] << endl;
|
||||
// }
|
||||
}
|
||||
}
|
||||
@ -469,48 +448,42 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// cout << "Sending image size " << nnx << " " << nny << endl;
|
||||
|
||||
// #ifndef DEVELOPER
|
||||
// #ifndef MOENCH_BRANCH
|
||||
// zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 0,0, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader);
|
||||
// #endif
|
||||
// #endif
|
||||
|
||||
|
||||
// #ifdef DEVELOPER
|
||||
#ifdef CTBGUI
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
#ifndef DEVELOPER
|
||||
#ifndef MOENCH_BRANCH
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 0,0, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader);
|
||||
#endif
|
||||
#ifndef CTBGUI
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,1,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
#endif
|
||||
// #endif
|
||||
// #ifdef MOENCH_BRANCH
|
||||
// /*
|
||||
// int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0,
|
||||
// uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0,
|
||||
// uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL,
|
||||
// uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0,
|
||||
// uint64_t bunchId = 0, uint64_t timestamp = 0,
|
||||
// uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0,
|
||||
// uint32_t debug = 0, uint16_t roundRNumber = 0,
|
||||
// uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0,
|
||||
// char* additionalJsonHeader = 0) {
|
||||
// int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEADER_VERSION , uint32_t dr, uint64_t fileindex, uint32_t 0, uint32_t 0, uint32_t, uint64_t, uint64_t, char*, uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t, int*, char*)
|
||||
|
||||
// */
|
||||
// //zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version);//, 0,additionalJsonHeader);
|
||||
// zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
#ifdef DEVELOPER
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
#endif
|
||||
#ifdef MOENCH_BRANCH
|
||||
/*
|
||||
int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0,
|
||||
uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0,
|
||||
uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL,
|
||||
uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0,
|
||||
uint64_t bunchId = 0, uint64_t timestamp = 0,
|
||||
uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0,
|
||||
uint32_t debug = 0, uint16_t roundRNumber = 0,
|
||||
uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0,
|
||||
char* additionalJsonHeader = 0) {
|
||||
int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEADER_VERSION , uint32_t dr, uint64_t fileindex, uint32_t 0, uint32_t 0, uint32_t, uint64_t, uint64_t, char*, uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t, int*, char*)
|
||||
|
||||
// /* old
|
||||
// zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
// */
|
||||
// /*
|
||||
*/
|
||||
//zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version);//, 0,additionalJsonHeader);
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
|
||||
/* old
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
*/
|
||||
/*
|
||||
|
||||
|
||||
// new
|
||||
// zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,additionalJsonHeader);
|
||||
// */
|
||||
// #endif
|
||||
new
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,additionalJsonHeader);
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -604,7 +577,6 @@ int main(int argc, char *argv[]) {
|
||||
/* Analog detector commands */
|
||||
//isPedestal=0;
|
||||
//isFlat=0;
|
||||
rms=0;
|
||||
fMode=eFrame;
|
||||
frameMode_s="frame";
|
||||
cprintf(MAGENTA, "Frame mode: ");
|
||||
@ -614,17 +586,11 @@ int main(int argc, char *argv[]) {
|
||||
if (frameMode_s == "pedestal"){
|
||||
fMode=ePedestal;
|
||||
//isPedestal=1;
|
||||
} else if (frameMode_s == "newpedestal"){
|
||||
} else if (frameMode_s == "newPedestal"){
|
||||
mt->newDataSet(); //resets pedestal
|
||||
// cprintf(MAGENTA, "Resetting pedestal\n");
|
||||
fMode=ePedestal;
|
||||
//isPedestal=1;
|
||||
} else if (frameMode_s == "variance"){
|
||||
mt->newDataSet(); //resets pedestal
|
||||
// cprintf(MAGENTA, "Resetting pedestal\n");
|
||||
fMode=ePedestal;
|
||||
rms=1;
|
||||
//isPedestal=1;
|
||||
}
|
||||
#ifdef INTERP
|
||||
else if (frameMode_s == "flatfield") {
|
||||
@ -645,13 +611,11 @@ int main(int argc, char *argv[]) {
|
||||
frameMode_s="frame";
|
||||
}
|
||||
}
|
||||
cprintf(MAGENTA, "%s\n" , frameMode_s.c_str());
|
||||
} else
|
||||
cprintf(RED, "%s\n" , frameMode_s.c_str());
|
||||
|
||||
}
|
||||
cprintf(MAGENTA, "%s\n" , frameMode_s.c_str());
|
||||
mt->setFrameMode(fMode);
|
||||
|
||||
threshold=0;
|
||||
// threshold=0;
|
||||
cprintf(MAGENTA, "Threshold: ");
|
||||
if (doc.HasMember("threshold")) {
|
||||
if (doc["threshold"].IsInt()) {
|
||||
@ -719,11 +683,10 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str());
|
||||
} else
|
||||
cprintf(RED, "%s\n" , frameMode_s.c_str());
|
||||
}
|
||||
|
||||
mt->setDetectorMode(dMode);
|
||||
cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str());
|
||||
|
||||
// cout << "done " << endl;
|
||||
|
||||
@ -774,7 +737,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// cout << "file" << endl;
|
||||
// cout << "data " << endl;
|
||||
if (of==NULL && dMode!=eAnalog && fMode!=ePedestal && threshold<=0) {
|
||||
if (of==NULL) {
|
||||
#ifdef WRITE_QUAD
|
||||
sprintf(ofname,"%s_%ld.clust2",filename.c_str(),fileindex);
|
||||
#endif
|
||||
@ -815,6 +778,9 @@ int main(int argc, char *argv[]) {
|
||||
zmqsocket->ReceiveData(0, dummybuff, size);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
iframe++;
|
||||
|
||||
} // exiting infinite loop
|
||||
|
@ -461,50 +461,6 @@ public:
|
||||
return ped;
|
||||
};
|
||||
|
||||
|
||||
virtual double *getPedestalRMS(){
|
||||
int nx, ny;
|
||||
dets[0]->getDetectorSize(nx,ny);
|
||||
// if (ped) delete [] ped;
|
||||
double *rms=new double[nx*ny];
|
||||
double *p0=new double[nx*ny];
|
||||
|
||||
for (int i=0; i<nThreads; i++) {
|
||||
//inte=(slsInterpolation*)dets[i]->getInterpolation(nb,emi,ema);
|
||||
// cout << i << endl;
|
||||
p0=dets[i]->getPedestalRMS(p0);
|
||||
if (p0) {
|
||||
if (i==0) {
|
||||
|
||||
for (int ib=0; ib<nx*ny; ib++) {
|
||||
rms[ib]=p0[ib]*p0[ib]/((double)nThreads);
|
||||
// cout << p0[ib] << " ";
|
||||
}
|
||||
} else {
|
||||
for (int ib=0; ib<nx*ny; ib++) {
|
||||
rms[ib]+=p0[ib]*p0[ib]/((double)nThreads);
|
||||
// cout << p0[ib] << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
delete [] p0;
|
||||
|
||||
/* for (int ib=0; ib<nx*ny; ib++) { */
|
||||
/* if (rms[ib]>0) */
|
||||
/* rms[ib]=sqrt(ped[ib]); */
|
||||
/* else */
|
||||
/* rms[ib]=0; */
|
||||
/* } */
|
||||
|
||||
|
||||
return rms;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual double *setPedestal(double *h=NULL){
|
||||
//int nb=0;
|
||||
@ -542,27 +498,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
virtual void *writePedestalRMS(const char * imgname){
|
||||
|
||||
int nx, ny;
|
||||
dets[0]->getDetectorSize(nx,ny);
|
||||
|
||||
double *rms=getPedestalRMS();
|
||||
float *gm=new float[nx*ny];
|
||||
if (gm) {
|
||||
for (int ix=0; ix<nx*ny; ix++) {
|
||||
gm[ix]=rms[ix];
|
||||
}
|
||||
WriteToTiff(gm,imgname ,nx, ny);
|
||||
delete [] gm;
|
||||
delete [] rms;
|
||||
} else cout << "Could not allocate float image " << endl;
|
||||
|
||||
return NULL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
virtual void *readPedestal(const char * imgname, int nb=-1, double emin=1, double emax=0){
|
||||
|
||||
int nx, ny;
|
||||
|
@ -145,10 +145,6 @@
|
||||
<property name="windowTitle">
|
||||
<string>SLS Detector GUI</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/mountain.png</normaloff>:/icons/images/mountain.png</iconset>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhNone</set>
|
||||
</property>
|
||||
@ -375,6 +371,101 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionOpenSetup">
|
||||
<property name="text">
|
||||
<string>&Load &Setup</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveSetup">
|
||||
<property name="text">
|
||||
<string>&Save &Setup</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMeasurementWizard">
|
||||
<property name="text">
|
||||
<string>&Measurement Wizard</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenConfiguration">
|
||||
<property name="text">
|
||||
<string>&Load &Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveConfiguration">
|
||||
<property name="text">
|
||||
<string>&Save &Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnergyCalibration">
|
||||
<property name="text">
|
||||
<string>&Energy Calibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAngularCalibration">
|
||||
<property name="text">
|
||||
<string>&Angular Calibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Debug</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionBeamline">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Beamline</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExpert">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Expert</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionConfiguration">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionVersion">
|
||||
<property name="text">
|
||||
<string>&Version</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadConfiguration">
|
||||
<property name="text">
|
||||
<string>Load Configuration</string>
|
||||
@ -385,11 +476,6 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Load Trimbits</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadParameters">
|
||||
<property name="text">
|
||||
<string>Load Parameters</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@ -414,14 +500,12 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Dockable Windows</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<action name="actionLoadParameters">
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
<string>Load Parameters</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -432,6 +432,19 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Triggers:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QComboBox" name="comboPeriodUnit">
|
||||
<property name="enabled">
|
||||
@ -653,6 +666,108 @@ Frame period between exposures.
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delay After Trigger:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinExpTime">
|
||||
<property name="enabled">
|
||||
@ -788,6 +903,65 @@ Exposure Time of a frame.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QComboBox" name="comboDelayUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="comboExpUnit">
|
||||
<property name="enabled">
|
||||
@ -910,577 +1084,6 @@ Frame period between exposures.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageLblTrigger">
|
||||
<layout class="QGridLayout" name="gridLblTrigger">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Triggers:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLblBurst">
|
||||
<layout class="QGridLayout" name="gridLblBurst">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumBursts">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Bursts:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QStackedWidget" name="stackedSpinTriggerBurst">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSpinTrigger">
|
||||
<layout class="QGridLayout" name="gridSpinTrigger">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSpinBox" name="spinNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageSpinBurst">
|
||||
<layout class="QGridLayout" name="gridSpinBurst">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSpinBox" name="spinNumBursts">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QStackedWidget" name="stackedLblDelayBurstPeriod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageLblDelay">
|
||||
<layout class="QGridLayout" name="gridLblDelay">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delay After Trigger:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLblBurstPeriod">
|
||||
<layout class="QGridLayout" name="gridLblBurstPeriod">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblBurstPeriod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Burst Period:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QStackedWidget" name="stackedSpinDelayBurstPeriod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>152</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>152</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSpinDelay">
|
||||
<layout class="QGridLayout" name="gridSpinDelay">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QDoubleSpinBox" name="spinDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageSpinBurstPeriod">
|
||||
<layout class="QGridLayout" name="gridSpinBurstPeriod">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QDoubleSpinBox" name="spinBurstPeriod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QStackedWidget" name="stackedComboDelayBurstPeriod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageComboDelay">
|
||||
<layout class="QGridLayout" name="gridComboDelay">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboDelayUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageComboBurstPeriod">
|
||||
<layout class="QGridLayout" name="gridComboBurstPeriod">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBurstPeriodUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1513,6 +1116,9 @@ Frame period between exposures.
|
||||
<tabstop>comboExpUnit</tabstop>
|
||||
<tabstop>spinPeriod</tabstop>
|
||||
<tabstop>comboPeriodUnit</tabstop>
|
||||
<tabstop>spinNumTriggers</tabstop>
|
||||
<tabstop>spinDelay</tabstop>
|
||||
<tabstop>comboDelayUnit</tabstop>
|
||||
<tabstop>spinNumSamples</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
@ -822,7 +822,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="stackedWidget1D">
|
||||
<property name="currentIndex">
|
||||
<number>5</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSuperImpose">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@ -1360,27 +1360,6 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkGainPlot1D">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Displays minimum, maximum and sum of values for each plot.
|
||||
<nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gain Plot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -2368,6 +2347,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<zorder>box1D</zorder>
|
||||
<zorder>boxFrequency</zorder>
|
||||
<zorder>box2D</zorder>
|
||||
<zorder>horizontalSpacer_6</zorder>
|
||||
<zorder>boxPlotAxis</zorder>
|
||||
<zorder>boxSave</zorder>
|
||||
</widget>
|
||||
|
@ -30,7 +30,8 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qDetectorMain(int multiId, std::string fname, bool isDevel);
|
||||
qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
QWidget *parent = 0);
|
||||
~qDetectorMain();
|
||||
|
||||
private slots:
|
||||
|
@ -98,8 +98,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
|
||||
SlsQt1DPlot *plot1d{nullptr};
|
||||
QVector<SlsQtH1D *> hists1d;
|
||||
SlsQt1DPlot *gainplot1d{nullptr};
|
||||
SlsQtH1D * gainhist1d{nullptr};
|
||||
SlsQt2DPlot *plot2d{nullptr};
|
||||
SlsQt2DPlot *gainplot2d{nullptr};
|
||||
QFutureWatcher<std::string> *acqResultWatcher;
|
||||
@ -126,7 +124,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
int nHists{1};
|
||||
double *datax1d{nullptr};
|
||||
std::vector<double *> datay1d;
|
||||
double *gainDatay1d{nullptr};
|
||||
double *data2d{nullptr};
|
||||
double *gainData{nullptr};
|
||||
|
||||
@ -164,6 +161,4 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
const static int npixelsx_jctb = 400;
|
||||
int npixelsy_jctb{0};
|
||||
uint32_t pixelMask{0};
|
||||
uint32_t gainMask{0};
|
||||
int gainOffset{0};
|
||||
};
|
||||
|
@ -26,12 +26,10 @@ private slots:
|
||||
void SetNumMeasurements(int val);
|
||||
void SetNumFrames(int val);
|
||||
void SetNumTriggers(int val);
|
||||
void SetNumBursts(int val);
|
||||
void SetNumSamples(int val);
|
||||
void SetExposureTime();
|
||||
void SetAcquisitionPeriod();
|
||||
void SetDelay();
|
||||
void SetBurstPeriod();
|
||||
void SetFileWrite(bool val);
|
||||
void SetFileName();
|
||||
void SetRunIndex(int val);
|
||||
@ -43,24 +41,17 @@ private slots:
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
/** default, show trigger and delay,
|
||||
* otherwise for gotthard2 in auto timing mode and burst mode,
|
||||
* show bursts and burst period
|
||||
*/
|
||||
void ShowTriggerDelay();
|
||||
void SetupTimingMode();
|
||||
void EnableWidgetsforTimingMode();
|
||||
|
||||
void GetTimingMode();
|
||||
void GetNumFrames();
|
||||
void GetNumTriggers();
|
||||
void GetNumBursts();
|
||||
void GetNumSamples();
|
||||
void GetExposureTime();
|
||||
void GetAcquisitionPeriod();
|
||||
void CheckAcqPeriodGreaterThanExp();
|
||||
void GetDelay();
|
||||
void GetBurstPeriod();
|
||||
void GetFileWrite();
|
||||
void GetFileName();
|
||||
void GetRunIndex();
|
||||
|
@ -77,14 +77,14 @@ class SlsQtH1D:public QwtPlotCurve{
|
||||
int ndata;
|
||||
int n_array;
|
||||
double dx;
|
||||
double *x{nullptr},*y{nullptr};
|
||||
double *x,*y;
|
||||
double ymin,ymax;
|
||||
double firstXgt0,firstYgt0;
|
||||
void Initailize();
|
||||
int SetUpArrays(int n);
|
||||
int CheckIndex(int bx);
|
||||
|
||||
QPen* pen_ptr{nullptr};
|
||||
QPen* pen_ptr;
|
||||
};
|
||||
|
||||
|
||||
@ -132,7 +132,6 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
void DisableZoom(bool disable);
|
||||
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);Update();};
|
||||
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);Update();};
|
||||
void SetYStep (int step) {ystep = step;};
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
double GetXMinimum(){return hist_list->Hist()->GetXMin();};
|
||||
@ -151,14 +150,13 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
void SetLogY(bool yes=1);
|
||||
private:
|
||||
|
||||
SlsQtH1DList* hist_list{nullptr};
|
||||
SlsQt1DZoomer* zoomer{nullptr};
|
||||
QwtPlotPanner* panner{nullptr};
|
||||
SlsQtH1DList* hist_list;
|
||||
SlsQt1DZoomer* zoomer;
|
||||
QwtPlotPanner* panner;
|
||||
|
||||
QwtPlotMarker *hline{nullptr};
|
||||
QwtPlotMarker *vline{nullptr};
|
||||
QwtPlotMarker *hline;
|
||||
QwtPlotMarker *vline;
|
||||
bool disableZoom{false};
|
||||
int ystep{0};
|
||||
|
||||
void SetupZoom();
|
||||
void UnknownStuff();
|
||||
|
@ -20,7 +20,7 @@ class SlsQt2DPlot: public QwtPlot{
|
||||
|
||||
public:
|
||||
SlsQt2DPlot(QWidget * = NULL);
|
||||
~SlsQt2DPlot();
|
||||
|
||||
void SetTitle(QString title);
|
||||
void SetXTitle(QString title);
|
||||
void SetYTitle(QString title);
|
||||
@ -77,17 +77,17 @@ private:
|
||||
QwtLinearColorMap* myColourMap(QVector<double> colourStops);
|
||||
QwtLinearColorMap* myColourMap(int log=0);
|
||||
|
||||
QwtPlotSpectrogram *d_spectrogram{nullptr};
|
||||
SlsQt2DHist* hist{nullptr};
|
||||
SlsQt2DZoomer* zoomer{nullptr};
|
||||
QwtPlotPanner* panner{nullptr};
|
||||
QwtScaleWidget *rightAxis{nullptr};
|
||||
QwtPlotSpectrogram *d_spectrogram;
|
||||
SlsQt2DHist* hist;
|
||||
SlsQt2DZoomer* zoomer;
|
||||
QwtPlotPanner* panner;
|
||||
QwtScaleWidget *rightAxis;
|
||||
|
||||
QwtLinearColorMap* colorMapLinearScale{nullptr};
|
||||
QwtLinearColorMap* colorMapLogScale{nullptr};
|
||||
QwtLinearColorMap* colorMapLinearScale;
|
||||
QwtLinearColorMap* colorMapLogScale;
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtValueList* contourLevelsLinear{nullptr};
|
||||
QwtValueList* contourLevelsLog{nullptr};
|
||||
QwtValueList* contourLevelsLinear;
|
||||
QwtValueList* contourLevelsLog;
|
||||
#else
|
||||
QList<double> contourLevelsLinear;
|
||||
QList<double> contourLevelsLog;
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||
#endif
|
||||
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title), x(nullptr), y(nullptr), pen_ptr(nullptr) {
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title) {
|
||||
Initailize();
|
||||
SetData(n, min, max, data);
|
||||
}
|
||||
@ -33,18 +33,15 @@ SlsQtH1D::SlsQtH1D(QString title, int n, double *data_x, double *data_y) : QwtPl
|
||||
|
||||
void SlsQtH1D::Initailize() {
|
||||
ndata = n_array = 0;
|
||||
x = y = nullptr;
|
||||
x = y = 0;
|
||||
pen_ptr = new QPen();
|
||||
SetLineColor();
|
||||
}
|
||||
|
||||
SlsQtH1D::~SlsQtH1D() {
|
||||
if (x)
|
||||
delete [] x;
|
||||
if (y)
|
||||
delete [] y;
|
||||
if (pen_ptr)
|
||||
delete pen_ptr;
|
||||
delete x;
|
||||
delete y;
|
||||
delete pen_ptr;
|
||||
}
|
||||
|
||||
void SlsQtH1D::Attach(SlsQt1DPlot *p) {
|
||||
@ -361,16 +358,12 @@ SlsQt1DPlot::SlsQt1DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
}
|
||||
|
||||
SlsQt1DPlot::~SlsQt1DPlot() {
|
||||
if (hist_list)
|
||||
delete hist_list;
|
||||
delete hist_list;
|
||||
|
||||
if (hline)
|
||||
delete hline;
|
||||
if (vline)
|
||||
delete vline;
|
||||
if (zoomer)
|
||||
delete zoomer;
|
||||
if (panner)
|
||||
delete panner;
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::CalculateNResetZoomBase() {
|
||||
|
@ -52,30 +52,6 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
}
|
||||
|
||||
|
||||
SlsQt2DPlot::~SlsQt2DPlot() {
|
||||
if (d_spectrogram) {
|
||||
d_spectrogram->detach();
|
||||
}
|
||||
if (hist)
|
||||
delete hist;
|
||||
if (colorMapLinearScale)
|
||||
delete colorMapLinearScale;
|
||||
if (colorMapLogScale)
|
||||
delete colorMapLogScale;
|
||||
|
||||
|
||||
if (zoomer)
|
||||
delete zoomer;
|
||||
if (panner)
|
||||
delete panner;
|
||||
#if QWT_VERSION<0x060000
|
||||
if (contourLevelsLinear)
|
||||
delete contourLevelsLinear;
|
||||
if (contourLevelsLog)
|
||||
delete contourLevelsLog;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetTitle(QString title) {
|
||||
setTitle(title);
|
||||
}
|
||||
@ -118,7 +94,7 @@ void SlsQt2DPlot::SetZFont(const QFont& f) {
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetupColorMap() {
|
||||
|
||||
|
||||
colorMapLinearScale = myColourMap(0);
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
|
@ -26,10 +26,27 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
QApplication *theApp = new QApplication(argc, argv);
|
||||
theApp->setStyle(new QPlastiqueStyle);
|
||||
theApp->setWindowIcon(QIcon(":/icons/images/mountain.png"));
|
||||
try {
|
||||
qDetectorMain *det = new qDetectorMain(argc, argv, theApp, 0);
|
||||
det->show();
|
||||
theApp->exec();
|
||||
} catch (const std::exception &e) {
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
std::string(e.what()) + "\nExiting Gui :'( ", "main");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
QWidget *parent)
|
||||
: QMainWindow(parent), detType(slsDetectorDefs::GENERIC), isDeveloper(0),
|
||||
heightPlotWindow(0), heightCentralWidget(0) {
|
||||
|
||||
// options
|
||||
std::string fname = "";
|
||||
bool isDeveloper = false;
|
||||
int64_t tempval = 0;
|
||||
int multiId = 0;
|
||||
|
||||
@ -64,7 +81,7 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
isDeveloper = true;
|
||||
isDeveloper = 1;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
@ -75,7 +92,7 @@ int main(int argc, char **argv) {
|
||||
tempval = APIGUI;
|
||||
FILE_LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
|
||||
<< std::hex << tempval << ")";
|
||||
return 0;
|
||||
return;
|
||||
|
||||
case 'h':
|
||||
default:
|
||||
@ -90,29 +107,10 @@ int main(int argc, char **argv) {
|
||||
"\t only when more than one multi "
|
||||
"detector object is needed.\n\n";
|
||||
FILE_LOG(logERROR) << help_message;
|
||||
return -1;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QApplication app(argc, argv);
|
||||
app.setStyle(new QPlastiqueStyle);
|
||||
//app.setWindowIcon(QIcon(":/icons/images/mountain.png"));
|
||||
try {
|
||||
qDetectorMain det(multiId, fname, isDeveloper);
|
||||
det.show();
|
||||
app.exec();
|
||||
} catch (const std::exception &e) {
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
std::string(e.what()) + "\nExiting Gui :'( ", "main");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
qDetectorMain::qDetectorMain(int multiId, std::string fname, bool isDevel)
|
||||
: QMainWindow(0), detType(slsDetectorDefs::GENERIC), isDeveloper(isDevel),
|
||||
heightPlotWindow(0), heightCentralWidget(0) {
|
||||
|
||||
setupUi(this);
|
||||
SetUpDetector(fname, multiId);
|
||||
SetUpWidgetWindow();
|
||||
|
@ -32,8 +32,6 @@ qDrawPlot::~qDrawPlot() {
|
||||
delete [] datax1d;
|
||||
for (auto &it : datay1d)
|
||||
delete [] it;
|
||||
if (gainDatay1d)
|
||||
delete [] gainDatay1d;
|
||||
if (data2d)
|
||||
delete [] data2d;
|
||||
if (gainData)
|
||||
@ -41,10 +39,6 @@ qDrawPlot::~qDrawPlot() {
|
||||
|
||||
if (plot1d)
|
||||
delete plot1d;
|
||||
if (gainhist1d)
|
||||
delete gainhist1d;
|
||||
if (gainplot1d)
|
||||
delete gainplot1d;
|
||||
if (plot2d)
|
||||
delete plot2d;
|
||||
if (gainplot2d)
|
||||
@ -61,18 +55,12 @@ void qDrawPlot::SetupWidgetWindow() {
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
pixelMask = ((1 << 14) - 1);
|
||||
gainMask = (3 << 14);
|
||||
gainOffset = 14;
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
|
||||
<< ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset;
|
||||
pixelMask = ((1 << 15) - 1);
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << std::dec;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
pixelMask = ((1 << 12) - 1);
|
||||
gainMask = (3 << 12);
|
||||
gainOffset = 12;
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
|
||||
<< ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset;
|
||||
pixelMask = ((1 << 13) - 1);
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << std::dec;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -166,40 +154,12 @@ void qDrawPlot::SetupPlots() {
|
||||
plot1d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetTitle("");
|
||||
plot1d->SetTitle("--");
|
||||
plot1d->SetXTitle(xTitle1d);
|
||||
plot1d->SetYTitle(yTitle1d);
|
||||
h->Attach(plot1d);
|
||||
plot1d->hide();
|
||||
|
||||
if (gainDatay1d)
|
||||
delete[] gainDatay1d;
|
||||
gainDatay1d = new double[nPixelsX];
|
||||
// default display data
|
||||
for (unsigned int px = 0; px < nPixelsX; ++px) {
|
||||
gainDatay1d[px] = 0;
|
||||
}
|
||||
// set gain hist
|
||||
gainhist1d = new SlsQtH1D("", nPixelsX, datax1d, gainDatay1d);
|
||||
gainhist1d->SetLineColor(0);
|
||||
gainhist1d->setStyleLinesorDots(isLines);
|
||||
gainhist1d->setSymbolMarkers(isMarkers);
|
||||
// setup 1d gain plot
|
||||
gainplot1d = new SlsQt1DPlot(boxPlot);
|
||||
gainplot1d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetTitle("");
|
||||
gainplot1d->SetYTitle("Gain");
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div( 0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
gainplot1d->setAxisScaleDiv( QwtPlot::yLeft, div );
|
||||
//gainplot1d->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtScaleDraw::Ticks, false);
|
||||
//gainplot1d->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtScaleDraw::Labels, false);
|
||||
gainhist1d->setItemAttribute(QwtPlotItem::Legend, false);
|
||||
gainhist1d->Attach(gainplot1d);
|
||||
gainplot1d->hide();
|
||||
|
||||
// setup 2d data
|
||||
if (data2d)
|
||||
delete [] data2d;
|
||||
@ -237,21 +197,17 @@ void qDrawPlot::SetupPlots() {
|
||||
|
||||
gainplot2d = new SlsQt2DPlot(boxPlot);
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
gainplot2d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot2d->setTitle("Gain");
|
||||
gainplot2d->SetZTitle("");
|
||||
gainplot2d->enableAxis(QwtPlot::yLeft, false);
|
||||
//gainplot2d->enableAxis(1, false);
|
||||
gainplot2d->enableAxis(QwtPlot::xBottom, false);
|
||||
// set ticks to just 3
|
||||
gainplot2d->setAxisScaleDiv( QwtPlot::yRight, div );
|
||||
gainplot2d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot2d->setTitle("");
|
||||
gainplot2d->enableAxis(0, false);
|
||||
gainplot2d->enableAxis(1, false);
|
||||
gainplot2d->enableAxis(2, false);
|
||||
gainplot2d->hide();
|
||||
|
||||
// layout of plots
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
|
||||
@ -260,10 +216,6 @@ void qDrawPlot::resizeEvent(QResizeEvent *event) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
if (gainplot1d->isVisible()) {
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
@ -595,9 +547,6 @@ void qDrawPlot::DetachHists() {
|
||||
for (QVector<SlsQtH1D *>::iterator h = hists1d.begin(); h != hists1d.end(); ++h) {
|
||||
(*h)->Detach(plot1d);
|
||||
}
|
||||
if (gainhist1d) {
|
||||
gainhist1d->Detach(gainplot1d);
|
||||
}
|
||||
}
|
||||
|
||||
void qDrawPlot::StartAcquisition() {
|
||||
@ -717,8 +666,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
|
||||
unsigned int nPixels = nPixelsX * (is1d ? 1 : nPixelsY);
|
||||
double* rawData = new double[nPixels];
|
||||
if (hasGainData) {
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange,
|
||||
is1d ? gainDatay1d : gainData);
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange, gainData);
|
||||
isGainDataExtracted = true;
|
||||
} else {
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange);
|
||||
@ -871,20 +819,6 @@ void qDrawPlot::Update1dPlot() {
|
||||
h->Attach(plot1d);
|
||||
}
|
||||
}
|
||||
if (isGainDataExtracted) {
|
||||
gainhist1d->SetData(nPixelsX, datax1d, gainDatay1d);
|
||||
gainhist1d->SetLineColor(0);
|
||||
gainhist1d->setStyleLinesorDots(isLines);
|
||||
gainhist1d->setSymbolMarkers(isMarkers);
|
||||
gainhist1d->Attach(gainplot1d);
|
||||
if (!gainplot1d->isVisible()) {
|
||||
gainplot1d->setFixedWidth(plot1d->width() );
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot1d->show();
|
||||
}
|
||||
} else if (gainplot1d->isVisible()) {
|
||||
gainplot1d->hide();
|
||||
}
|
||||
if (xyRangeChanged) {
|
||||
Update1dXYRange();
|
||||
xyRangeChanged = false;
|
||||
@ -898,7 +832,7 @@ void qDrawPlot::Update2dPlot() {
|
||||
plot2d->SetYTitle(yTitle2d);
|
||||
plot2d->SetZTitle(zTitle2d);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, data2d);
|
||||
if (isGainDataExtracted) {
|
||||
if (isGainDataExtracted) {
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
if (!gainplot2d->isVisible()) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
@ -991,7 +925,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
||||
if (gaindest != NULL) {
|
||||
for (ichan = 0; ichan < size; ++ichan) {
|
||||
uint16_t temp = (*((u_int16_t *)source));
|
||||
gaindest[ichan] = ((temp & gainMask) >> gainOffset);
|
||||
gaindest[ichan] = ((temp & 0xC000) >> 14);
|
||||
dest[ichan] = (temp & pixelMask);
|
||||
source += 2;
|
||||
}
|
||||
|
@ -42,10 +42,6 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
lblDelay->setEnabled(true);
|
||||
spinDelay->setEnabled(true);
|
||||
comboDelayUnit->setEnabled(true);
|
||||
|
||||
// default is triggers and delay (not #bursts and burst period for gotthard2 in auto mode)
|
||||
ShowTriggerDelay();
|
||||
|
||||
// enabling according to det type
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
@ -64,13 +60,6 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
spinStartingFrameNumber->setEnabled(true);
|
||||
startingFnumImplemented = true;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
lblNumBursts->setEnabled(true);
|
||||
spinNumBursts->setEnabled(true);
|
||||
lblBurstPeriod->setEnabled(true);
|
||||
spinBurstPeriod->setEnabled(true);
|
||||
comboBurstPeriodUnit->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -89,9 +78,6 @@ void qTabMeasurement::Initialization() {
|
||||
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
||||
if (spinNumBursts->isEnabled()) {
|
||||
connect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int)));
|
||||
}
|
||||
if (spinNumSamples->isEnabled()) {
|
||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
}
|
||||
@ -103,10 +89,6 @@ void qTabMeasurement::Initialization() {
|
||||
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
||||
}
|
||||
if (spinBurstPeriod->isEnabled()) {
|
||||
connect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod()));
|
||||
connect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetBurstPeriod()));
|
||||
}
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||
@ -119,35 +101,6 @@ void qTabMeasurement::Initialization() {
|
||||
|
||||
}
|
||||
|
||||
void qTabMeasurement::ShowTriggerDelay() {
|
||||
bool showTrigger = true;
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||
try {
|
||||
FILE_LOG(logDEBUG) << "Getting burst mode";
|
||||
auto retval = det->getBurstMode().tsquash("Inconsistent burst mode for all detectors.");
|
||||
// burst mode and auto timing mode
|
||||
if (retval != slsDetectorDefs::BURST_OFF && comboTimingMode->currentIndex() == AUTO) {
|
||||
showTrigger = false;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get burst mode.", "qTabMeasurement::ShowTriggerDelay")
|
||||
}
|
||||
|
||||
if (showTrigger) {
|
||||
stackedLblTriggerBurst->setCurrentWidget(pageLblTrigger);
|
||||
stackedSpinTriggerBurst->setCurrentWidget(pageSpinTrigger);
|
||||
stackedLblDelayBurstPeriod->setCurrentWidget(pageLblDelay);
|
||||
stackedSpinDelayBurstPeriod->setCurrentWidget(pageSpinDelay);
|
||||
stackedComboDelayBurstPeriod->setCurrentWidget(pageComboDelay);
|
||||
} else {
|
||||
stackedLblTriggerBurst->setCurrentWidget(pageLblBurst);
|
||||
stackedSpinTriggerBurst->setCurrentWidget(pageSpinBurst);
|
||||
stackedLblDelayBurstPeriod->setCurrentWidget(pageLblBurstPeriod);
|
||||
stackedSpinDelayBurstPeriod->setCurrentWidget(pageSpinBurstPeriod);
|
||||
stackedComboDelayBurstPeriod->setCurrentWidget(pageComboBurstPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::SetupTimingMode() {
|
||||
QStandardItemModel* model = qobject_cast<QStandardItemModel *>(comboTimingMode->model());
|
||||
QModelIndex index[NUMTIMINGMODES];
|
||||
@ -186,9 +139,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
switch(comboTimingMode->currentIndex()) {
|
||||
case AUTO:
|
||||
// #frames, exptime, period
|
||||
if (det->getDetectorType().squash() != slsDetectorDefs::GOTTHARD2) {
|
||||
spinNumTriggers->setValue(1);
|
||||
}
|
||||
spinNumTriggers->setValue(1);
|
||||
lblNumFrames->setEnabled(true);
|
||||
spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true);
|
||||
@ -197,9 +148,6 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
lblPeriod->setEnabled(true);
|
||||
spinPeriod->setEnabled(true);
|
||||
comboPeriodUnit->setEnabled(true);
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||
ShowTriggerDelay();
|
||||
}
|
||||
break;
|
||||
case TRIGGER:
|
||||
// #triggers, exptime
|
||||
@ -220,9 +168,6 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
lblDelay->setEnabled(true);
|
||||
spinDelay->setEnabled(true);
|
||||
comboDelayUnit->setEnabled(true);
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||
ShowTriggerDelay();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GATED:
|
||||
@ -252,7 +197,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
|
||||
void qTabMeasurement::GetTimingMode() {
|
||||
FILE_LOG(logDEBUG) << "Getting timing mode";
|
||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
try {
|
||||
auto oldMode = comboTimingMode->currentIndex();
|
||||
auto retval = det->getTimingMode().tsquash("Inconsistent timing mode for all detectors.");
|
||||
@ -271,7 +216,7 @@ void qTabMeasurement::GetTimingMode() {
|
||||
throw sls::RuntimeError(std::string("Unknown timing mode: ")+ std::to_string(retval));
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get timing mode.", "qTabMeasurement::GetTimingMode")
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetTimingMode(int val) {
|
||||
@ -321,23 +266,6 @@ void qTabMeasurement::SetNumTriggers(int val) {
|
||||
} CATCH_HANDLE("Could not set number of triggers.", "qTabMeasurement::SetNumTriggers", this, &qTabMeasurement::GetNumTriggers)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumBursts() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of bursts";
|
||||
disconnect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int)));
|
||||
try {
|
||||
auto retval = det->getNumberOfBursts().tsquash("Inconsistent number of bursts for all detectors.");
|
||||
spinNumBursts->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumBursts")
|
||||
connect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumBursts(int val) {
|
||||
FILE_LOG(logINFO) << "Setting number of bursts to " << val;
|
||||
try {
|
||||
det->setNumberOfBursts(val);
|
||||
} CATCH_HANDLE("Could not set number of bursts.", "qTabMeasurement::SetNumBursts", this, &qTabMeasurement::GetNumBursts)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumSamples() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of samples";
|
||||
disconnect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
@ -457,32 +385,6 @@ void qTabMeasurement::SetDelay() {
|
||||
} CATCH_HANDLE("Could not set delay.", "qTabMeasurement::SetDelay", this, &qTabMeasurement::GetDelay)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetBurstPeriod() {
|
||||
FILE_LOG(logDEBUG) << "Getting Burst Period";
|
||||
disconnect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod()));
|
||||
disconnect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetBurstPeriod()));
|
||||
try {
|
||||
spinBurstPeriod->setValue(-1);
|
||||
auto retval = det->getBurstPeriod().tsquash("Inconsistent burst period for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinBurstPeriod->setValue(time.first);
|
||||
comboBurstPeriodUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get burst period.", "qTabMeasurement::GetBurstPeriod")
|
||||
connect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod()));
|
||||
connect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetBurstPeriod()));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetBurstPeriod() {
|
||||
auto val = spinBurstPeriod->value();
|
||||
auto unit = static_cast<qDefs::timeUnit>(comboBurstPeriodUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting burst period to " << val << " " << qDefs::getUnitString(unit);
|
||||
try {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
|
||||
det->setBurstPeriod(timeNS);
|
||||
} CATCH_HANDLE("Could not set burst period.", "qTabMeasurement::SetBurstPeriod", this, &qTabMeasurement::GetBurstPeriod)
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::GetFileWrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Write Enable";
|
||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
@ -675,15 +577,9 @@ void qTabMeasurement::Refresh() {
|
||||
GetExposureTime();
|
||||
GetAcquisitionPeriod();
|
||||
GetNumTriggers();
|
||||
if (spinNumBursts->isEnabled()) {
|
||||
GetNumBursts();
|
||||
}
|
||||
if (delayImplemented) {
|
||||
GetDelay();
|
||||
}
|
||||
if (spinBurstPeriod->isEnabled()) {
|
||||
GetBurstPeriod();
|
||||
}
|
||||
if (sampleImplemented) {
|
||||
GetNumSamples();
|
||||
}
|
||||
|
@ -60,13 +60,8 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
is1d = true;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
is1d = true;
|
||||
chkGainPlot1D->setEnabled(true);
|
||||
chkGainPlot1D->setChecked(true);
|
||||
plot->EnableGainPlot(true);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkGapPixels->setEnabled(true);
|
||||
@ -74,8 +69,6 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
chkGainPlot->setEnabled(true);
|
||||
chkGainPlot->setChecked(true);
|
||||
plot->EnableGainPlot(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -135,8 +128,6 @@ void qTabPlot::Initialization() {
|
||||
//gainplot
|
||||
if (chkGainPlot->isEnabled())
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
if (chkGainPlot1D->isEnabled())
|
||||
connect(chkGainPlot1D, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
// gap pixels
|
||||
if (chkGapPixels->isEnabled())
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
@ -588,9 +579,6 @@ void qTabPlot::Refresh() {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
chkGainPlot->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
chkGainPlot1D->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -598,7 +586,6 @@ void qTabPlot::Refresh() {
|
||||
boxPlotType->setEnabled(false);
|
||||
boxFrequency->setEnabled(false);
|
||||
chkGainPlot->setEnabled(false);
|
||||
chkGainPlot1D->setEnabled(false);
|
||||
chkGapPixels->setEnabled(false);
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -104,8 +104,6 @@
|
||||
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
||||
#define CONTROL_TIMING_SOURCE_EXT_OFST (17)
|
||||
#define CONTROL_TIMING_SOURCE_EXT_MSK (0x00000001 << CONTROL_TIMING_SOURCE_EXT_OFST)
|
||||
#define CONTROL_PWR_CHIP_OFST (31)
|
||||
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
|
||||
|
||||
@ -130,8 +128,6 @@
|
||||
#define ASIC_CONFIG_FIX_GAIN_1_VAL ((0x1 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_FIX_GAIN_2_VAL ((0x2 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_RESERVED_VAL ((0x3 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_CURRENT_SRC_EN_OFST (7)
|
||||
#define ASIC_CONFIG_CURRENT_SRC_EN_MSK (0x00000001 << ASIC_CONFIG_CURRENT_SRC_EN_OFST)
|
||||
#define ASIC_CONFIG_RST_DAC_OFST (15)
|
||||
#define ASIC_CONFIG_RST_DAC_MSK (0x00000001 << ASIC_CONFIG_RST_DAC_OFST)
|
||||
#define ASIC_CONFIG_DONE_OFST (31)
|
||||
|
Binary file not shown.
@ -47,10 +47,9 @@ int injectedChannelsIncrement = 0;
|
||||
int vetoReference[NCHIP][NCHAN];
|
||||
uint8_t adcConfiguration[NCHIP][NADC];
|
||||
int burstMode = BURST_INTERNAL;
|
||||
int64_t numTriggers = 1;
|
||||
int64_t numBursts = 1;
|
||||
int64_t delayAfterTriggerNs = 0;
|
||||
int64_t burstPeriodNs = 0;
|
||||
int64_t exptime_ns = 0;
|
||||
int64_t period_ns = 0;
|
||||
int64_t nframes = 0;
|
||||
int detPos[2] = {};
|
||||
|
||||
int isInitCheckDone() {
|
||||
@ -354,10 +353,9 @@ void setupDetector() {
|
||||
injectedChannelsOffset = 0;
|
||||
injectedChannelsIncrement = 0;
|
||||
burstMode = BURST_INTERNAL;
|
||||
numTriggers = 1;
|
||||
numBursts = 1;
|
||||
delayAfterTriggerNs = 0;
|
||||
burstPeriodNs = 0;
|
||||
exptime_ns = 0;
|
||||
period_ns = 0;
|
||||
nframes = 0;
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||
@ -441,14 +439,10 @@ void setupDetector() {
|
||||
// Initialization of acquistion parameters
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setNumBursts(DEFAULT_NUM_BURSTS);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setDelayAfterTrigger(DEFAULT_DELAY_AFTER_TRIGGER);
|
||||
setBurstPeriod(DEFAULT_BURST_PERIOD);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
setCurrentSource(DEFAULT_CURRENT_SOURCE);
|
||||
setTimingSource(DEFAULT_TIMING_SOURCE);
|
||||
}
|
||||
|
||||
int readConfigFile() {
|
||||
@ -458,13 +452,13 @@ int readConfigFile() {
|
||||
}
|
||||
|
||||
// require a sleep before and after the rst dac signal
|
||||
usleep (INITIAL_STARTUP_WAIT);
|
||||
usleep (1 * 1000);
|
||||
|
||||
// inform FPGA that onchip dacs will be configured soon
|
||||
FILE_LOG(logINFO, ("Setting configuration starting bit\n"));
|
||||
bus_w(ASIC_CONFIG_REG, bus_r(ASIC_CONFIG_REG) | ASIC_CONFIG_RST_DAC_MSK);
|
||||
|
||||
usleep (INITIAL_STARTUP_WAIT);
|
||||
usleep (1 * 1000);
|
||||
|
||||
FILE* fd = fopen(CONFIG_FILE, "r");
|
||||
if(fd == NULL) {
|
||||
@ -737,104 +731,52 @@ int setDynamicRange(int dr){
|
||||
/* parameters - timer */
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld [local]\n", val));
|
||||
// continuous mode
|
||||
if (burstMode == BURST_OFF) {
|
||||
setNumFramesCont(val);
|
||||
setNumFramesBurst(1);
|
||||
} else {
|
||||
setNumFramesBurst(val);
|
||||
setNumFramesCont(1);
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld [local]\n", (long long int)val));
|
||||
nframes = val;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumFrames() {
|
||||
if (burstMode == BURST_OFF) {
|
||||
return getNumFramesCont();
|
||||
} else {
|
||||
return getNumFramesBurst();
|
||||
}
|
||||
return nframes;
|
||||
}
|
||||
|
||||
void setNumTriggers(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", val));
|
||||
numTriggers = val;
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
FILE_LOG(logINFO, ("\tBurst and Auto mode: not writing #triggers to register\n"));
|
||||
} else {
|
||||
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumTriggers() {
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
return numTriggers;
|
||||
}
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
void setNumBursts(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of bursts %lld\n", val));
|
||||
numBursts = val;
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("\tNot (Burst and Auto mode): not writing #bursts to register\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumBursts() {
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
return numBursts;
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", val));
|
||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [local]\n", val));
|
||||
// continuous mode
|
||||
if (burstMode == BURST_OFF) {
|
||||
return setExptimeCont(val);
|
||||
} else {
|
||||
return setExptimeBurst(val);
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [local]\n", (long long int)val));
|
||||
exptime_ns = val;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
return getExptimeBoth();
|
||||
return exptime_ns;
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", val));
|
||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [local]\n", val));
|
||||
// continuous mode
|
||||
if (burstMode == BURST_OFF) {
|
||||
setPeriodBurst(0);
|
||||
return setPeriodCont(val);
|
||||
} else {
|
||||
setPeriodCont(0);
|
||||
return setPeriodBurst(val);
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [local]\n", (long long int)val));
|
||||
period_ns = val;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getPeriod() {
|
||||
if (burstMode == BURST_OFF) {
|
||||
return getPeriodCont();
|
||||
} else {
|
||||
return getPeriodBurst();
|
||||
}
|
||||
return period_ns;
|
||||
}
|
||||
|
||||
void setNumFramesBurst(int64_t val) {
|
||||
@ -848,7 +790,7 @@ int64_t getNumFramesBurst() {
|
||||
}
|
||||
|
||||
void setNumFramesCont(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld [Continuous mode]\n", val));
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld [Continuous mode]\n", (long long int)val));
|
||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
@ -857,12 +799,12 @@ int64_t getNumFramesCont() {
|
||||
}
|
||||
|
||||
int setExptimeBurst(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [Burst mode]\n", val));
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [Burst mode]\n", (long long int)val));
|
||||
return setExptimeBoth(val);
|
||||
}
|
||||
|
||||
int setExptimeCont(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [Continuous mode]\n", val));
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [Continuous mode]\n", (long long int)val));
|
||||
return setExptimeBoth(val);
|
||||
}
|
||||
|
||||
@ -885,7 +827,7 @@ int64_t getExptimeBoth() {
|
||||
|
||||
|
||||
int setPeriodBurst(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val));
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", (long long int)val));
|
||||
val *= (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||
set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG);
|
||||
|
||||
@ -899,12 +841,11 @@ int setPeriodBurst(int64_t val) {
|
||||
}
|
||||
|
||||
int64_t getPeriodBurst() {
|
||||
FILE_LOG(logDEBUG, ("Getting period [Burst mode]\n"));
|
||||
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG)/ (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||
}
|
||||
|
||||
int setPeriodCont(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val));
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", (long long int)val));
|
||||
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||
|
||||
@ -918,23 +859,17 @@ int setPeriodCont(int64_t val) {
|
||||
}
|
||||
|
||||
int64_t getPeriodCont() {
|
||||
FILE_LOG(logDEBUG, ("Getting period [Continuous mode]\n"));
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
}
|
||||
|
||||
int setDelayAfterTrigger(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", val));
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", val));
|
||||
delayAfterTriggerNs = val;
|
||||
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
FILE_LOG(logINFO, ("\tBurst and Auto mode: not writing delay to register\n"));
|
||||
} else {
|
||||
set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getDelayAfterTrigger();
|
||||
@ -946,42 +881,9 @@ int setDelayAfterTrigger(int64_t val) {
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTrigger() {
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
return delayAfterTriggerNs;
|
||||
}
|
||||
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
}
|
||||
|
||||
int setBurstPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid burst period: %lld ns\n", val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting burst period %lld ns\n", val));
|
||||
burstPeriodNs = val;
|
||||
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("\tNot (Burst and Auto mode): not writing burst period to register\n"));
|
||||
}
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getBurstPeriod();
|
||||
val /= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getBurstPeriod() {
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
}
|
||||
return burstPeriodNs;
|
||||
}
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
}
|
||||
@ -1206,12 +1108,6 @@ void setTiming( enum timingMode arg){
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("\tUpdating trigger/burst and delay/burst period registers\n"))
|
||||
setNumTriggers(numTriggers);
|
||||
setNumBursts(numBursts);
|
||||
setDelayAfterTrigger(delayAfterTriggerNs);
|
||||
setBurstPeriod(burstPeriodNs);
|
||||
}
|
||||
|
||||
enum timingMode getTiming() {
|
||||
@ -1882,25 +1778,10 @@ int setBurstModeinFPGA(enum burstMode value) {
|
||||
int setBurstMode(enum burstMode burst) {
|
||||
FILE_LOG(logINFO, ("Setting burst mode to %s\n", burst == BURST_OFF ? "off" : (burst == BURST_INTERNAL ? "internal" : "external")));
|
||||
|
||||
// remember the number of frames and period (before changing burst mode)
|
||||
int64_t frames = getNumFrames();
|
||||
int64_t period = getPeriod();
|
||||
|
||||
if (setBurstModeinFPGA(burst) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("\tUpdating trigger/burst and delay/burst period registers\n"))
|
||||
setNumTriggers(numTriggers);
|
||||
setNumBursts(numBursts);
|
||||
setDelayAfterTrigger(delayAfterTriggerNs);
|
||||
setBurstPeriod(burstPeriodNs);
|
||||
|
||||
// set number of frames and period again (set registers according to timing mode)
|
||||
FILE_LOG(logINFO, ("\tUpdating #frames and period registers\n"));
|
||||
setNumFrames(frames);
|
||||
setPeriod(period);
|
||||
|
||||
FILE_LOG(logINFO, ("\tSetting %s Mode in Chip\n", burstMode == BURST_OFF ? "Continuous" : "Burst"));
|
||||
int value = burstMode ? ASIC_GLOBAL_BURST_VALUE : ASIC_GLOBAL_CONT_VALUE;
|
||||
|
||||
@ -1948,62 +1829,84 @@ enum burstMode getBurstMode() {
|
||||
int runmode = bus_r (addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
||||
switch (runmode) {
|
||||
case ASIC_CONFIG_RUN_MODE_CONT_VAL:
|
||||
burstMode = BURST_OFF;
|
||||
break;
|
||||
return BURST_OFF;
|
||||
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
||||
burstMode = BURST_INTERNAL;
|
||||
break;
|
||||
return BURST_INTERNAL;
|
||||
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
||||
burstMode = BURST_EXTERNAL;
|
||||
break;
|
||||
return BURST_EXTERNAL;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode));
|
||||
return -1;
|
||||
}
|
||||
return burstMode;
|
||||
}
|
||||
|
||||
void setCurrentSource(int value) {
|
||||
uint32_t addr = ASIC_CONFIG_REG;
|
||||
if (value > 0) {
|
||||
bus_w(addr, (bus_r(addr) | ASIC_CONFIG_CURRENT_SRC_EN_MSK));
|
||||
} else if (value == 0) {
|
||||
bus_w(addr, (bus_r(addr) &~ ASIC_CONFIG_CURRENT_SRC_EN_MSK));
|
||||
}
|
||||
}
|
||||
|
||||
int getCurrentSource() {
|
||||
return ((bus_r(ASIC_CONFIG_REG) & ASIC_CONFIG_CURRENT_SRC_EN_MSK) >> ASIC_CONFIG_CURRENT_SRC_EN_OFST);
|
||||
}
|
||||
|
||||
void setTimingSource(enum timingSourceType value) {
|
||||
uint32_t addr = CONTROL_REG;
|
||||
switch (value) {
|
||||
case TIMING_INTERNAL:
|
||||
FILE_LOG(logINFO, ("Setting timing source to internal\n"));
|
||||
bus_w(addr, (bus_r(addr) &~ CONTROL_TIMING_SOURCE_EXT_MSK));
|
||||
break;
|
||||
case TIMING_EXTERNAL:
|
||||
FILE_LOG(logINFO, ("Setting timing source to exernal\n"));
|
||||
bus_w(addr, (bus_r(addr) | CONTROL_TIMING_SOURCE_EXT_MSK));
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown timing source %d\n", value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
enum timingSourceType getTimingSource() {
|
||||
if (bus_r(CONTROL_REG) & CONTROL_TIMING_SOURCE_EXT_MSK) {
|
||||
return TIMING_EXTERNAL;
|
||||
}
|
||||
return TIMING_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* aquisition */
|
||||
|
||||
int updateAcquisitionRegisters(char* mess) {
|
||||
// burst mode
|
||||
if (burstMode != BURST_OFF) {
|
||||
// validate #frames in burst mode
|
||||
if (nframes > MAX_FRAMES_IN_BURST_MODE) {
|
||||
sprintf(mess, "Could not start acquisition because number of frames %lld must be <= %d in burst mode.\n", (long long unsigned int)nframes, MAX_FRAMES_IN_BURST_MODE);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
setNumFramesBurst(nframes);
|
||||
// exptime
|
||||
if (setExptimeBurst(exptime_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because exptime could not be set in burst mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)exptime_ns, getExptimeBoth());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
// period
|
||||
if (setPeriodBurst(period_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)period_ns, getPeriodBurst());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// set continuous values to default (exptime same register)
|
||||
FILE_LOG(logINFO, ("Setting continuous mode registers to defaults\n"));
|
||||
// frames
|
||||
setNumFramesCont(1);
|
||||
// period
|
||||
if (setPeriodCont(0) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in continuous mode. Set 0 ns, got %lld ns.\n", getPeriodCont());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
// continuous
|
||||
else {
|
||||
// frames
|
||||
setNumFramesCont(nframes);
|
||||
// exptime
|
||||
if (setExptimeCont(exptime_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because exptime could not be set in continuous mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)exptime_ns, getExptimeBoth());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
// period
|
||||
if (setPeriodCont(period_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in continuous mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)period_ns, getPeriodCont());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// set burst values to default (exptime same register)
|
||||
FILE_LOG(logINFO, ("Setting burst mode registers to defaults\n"));
|
||||
setNumFramesBurst(1);
|
||||
// period
|
||||
if (setPeriodBurst(0) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set 0 ns, got %lld ns.\n", getPeriodBurst());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int startStateMachine(){
|
||||
#ifdef VIRTUAL
|
||||
// create udp socket
|
||||
|
@ -27,23 +27,17 @@
|
||||
#define TYPE_GOTTHARD2_MODULE_VAL (512)
|
||||
#define TYPE_TOLERANCE (10)
|
||||
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||
#define INITIAL_STARTUP_WAIT (1 * 1000 * 1000)
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_NUM_BURSTS (1)
|
||||
#define DEFAULT_EXPTIME (0) // 0 ms (220ns in firmware)
|
||||
#define DEFAULT_PERIOD (0) // 0 ms
|
||||
#define DEFAULT_PERIOD (1 * 1000) // 1 ms
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_BURST_PERIOD (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
||||
#define DEFAULT_CURRENT_SOURCE (0)
|
||||
#define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL)
|
||||
|
||||
#define DEFAULT_READOUT_C0 (144444448) // rdo_clk, 144 MHz
|
||||
#define DEFAULT_READOUT_C1 (144444448) // rdo_x2_clk, 144 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (144444448) // run_clk, 144 MHz
|
||||
@ -53,9 +47,9 @@
|
||||
|
||||
/* Firmware Definitions */
|
||||
#define IP_HEADER_SIZE (20)
|
||||
#define FIXED_PLL_FREQUENCY (20000000) // 20MHz
|
||||
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // 866 MHz
|
||||
#define SYSTEM_PLL_VCO_FREQ_HZ (722222224) // 722 MHz
|
||||
#define FIXED_PLL_FREQUENCY (020000000) // 20MHz
|
||||
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // Hz
|
||||
#define SYSTEM_PLL_VCO_FREQ_HZ (722222240) // Hz
|
||||
|
||||
/** Other Definitions */
|
||||
#define BIT16_MASK (0xFFFF)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -33,7 +33,7 @@
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_READOUT_C0 (125000000) // rdo_clk, 125 MHz
|
||||
#define DEFAULT_READOUT_C1 (125000000) // rdo_x2_clk, 125 MHz
|
||||
#define DEFAULT_READOUT_C1 (250000000) // rdo_x2_clk, 250 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (250000000) // run_clk, 250 MHz
|
||||
#define DEFAULT_SYSTEM_C1 (125000000) // chip_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C2 (125000000) // sync_clk, 125 MHz
|
||||
|
@ -178,11 +178,6 @@ int64_t getExpTime();
|
||||
int setPeriod(int64_t val);
|
||||
int64_t getPeriod();
|
||||
#ifdef GOTTHARD2D
|
||||
void setNumBursts(int64_t val);
|
||||
int64_t getNumBursts();
|
||||
int setBurstPeriod(int64_t val);
|
||||
int64_t getBurstPeriod();
|
||||
|
||||
void setNumFramesBurst(int64_t val);
|
||||
int64_t getNumFramesBurst();
|
||||
void setNumFramesCont(int64_t val);
|
||||
@ -482,10 +477,6 @@ int configureADC();
|
||||
int setBurstModeinFPGA(enum burstMode value);
|
||||
int setBurstMode(enum burstMode burst);
|
||||
enum burstMode getBurstMode();
|
||||
void setCurrentSource(int value);
|
||||
int getCurrentSource();
|
||||
void setTimingSource(enum timingSourceType value);
|
||||
enum timingSourceType getTimingSource();
|
||||
#endif
|
||||
|
||||
|
||||
@ -517,6 +508,9 @@ int setTransmissionDelayRight(int value);
|
||||
|
||||
|
||||
// aquisition
|
||||
#ifdef GOTTHARD2D
|
||||
int updateAcquisitionRegisters(char* mess);
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
int prepareAcquisition();
|
||||
#endif
|
||||
|
@ -208,11 +208,3 @@ int set_adc_enable_mask_10g(int);
|
||||
int get_adc_enable_mask_10g(int);
|
||||
int set_counter_mask(int);
|
||||
int get_counter_mask(int);
|
||||
int get_num_bursts(int);
|
||||
int set_num_bursts(int);
|
||||
int get_burst_period(int);
|
||||
int set_burst_period(int);
|
||||
int get_current_source(int);
|
||||
int set_current_source(int);
|
||||
int get_timing_source(int);
|
||||
int set_timing_source(int);
|
||||
|
@ -68,8 +68,6 @@
|
||||
|
||||
#define AD7689_INT_REF_MAX_MV (2500) // chosen using reference buffer selection in config reg
|
||||
#define AD7689_INT_REF_MIN_MV (0)
|
||||
#define AD7689_INT_REF_MAX_UV (2500 * 1000)
|
||||
#define AD7689_INT_REF_MIN_UV (0)
|
||||
#define AD7689_INT_MAX_STEPS (0xFFFF + 1)
|
||||
#define AD7689_TMP_C_FOR_1_MV (25.00 / 283.00)
|
||||
|
||||
@ -128,6 +126,7 @@ int AD7689_GetTemperature() {
|
||||
// overwrite configuration
|
||||
AD7689_CFG_CFG_OVRWRTE_VAL);
|
||||
|
||||
// FIXME: do we have to read it 8 times?? (sequencer is disabled anyway) or are we sequencing, then we read only last channel
|
||||
int regval = AD7689_Get();
|
||||
|
||||
// value in mV FIXME: page 17? reference voltage temperature coefficient or t do with -40 to 85 °C
|
||||
@ -139,21 +138,22 @@ int AD7689_GetTemperature() {
|
||||
|
||||
// value in °C
|
||||
double tempValue = AD7689_TMP_C_FOR_1_MV * (double)retval;
|
||||
FILE_LOG(logINFO, ("\ttemp read : %f °C (%d unit)\n", tempValue, regval));
|
||||
|
||||
FILE_LOG(logINFO, ("\ttemp read : %f °C\n", tempValue));
|
||||
|
||||
return tempValue;
|
||||
|
||||
}
|
||||
|
||||
int AD7689_GetChannel(int ichan) {
|
||||
// filter channels val
|
||||
if (ichan < 0 || ichan >= AD7689_NUM_CHANNELS) {
|
||||
// filter channels val
|
||||
if (ichan < 0 || ichan >= AD7689_NUM_CHANNELS) {
|
||||
FILE_LOG(logERROR, ("Cannot get slow adc channel. "
|
||||
"%d out of bounds (0 to %d)\n", ichan, AD7689_NUM_CHANNELS - 1));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
AD7689_Set(
|
||||
AD7689_Set(
|
||||
// read back
|
||||
AD7689_CFG_RB_MSK |
|
||||
// disable sequencer (different from config)
|
||||
@ -169,17 +169,16 @@ int AD7689_GetChannel(int ichan) {
|
||||
// overwrite configuration
|
||||
AD7689_CFG_CFG_OVRWRTE_VAL);
|
||||
|
||||
int regval = AD7689_Get();
|
||||
// FIXME: do we have to read it 8 times?? (sequencer is disabled anyway) or are we sequencing, then we read only last channel
|
||||
int regval = AD7689_Get();
|
||||
|
||||
// value in uV
|
||||
int retval = ((double)(regval - 0) * (double)(AD7689_INT_REF_MAX_UV - AD7689_INT_REF_MIN_UV))
|
||||
/ (double)(AD7689_INT_MAX_STEPS - 0) + AD7689_INT_REF_MIN_UV;
|
||||
|
||||
/*ConvertToDifferentRange(0, AD7689_INT_MAX_STEPS,
|
||||
// value in mV
|
||||
int retval = 0;
|
||||
ConvertToDifferentRange(0, AD7689_INT_MAX_STEPS,
|
||||
AD7689_INT_REF_MIN_MV, AD7689_INT_REF_MAX_MV,
|
||||
regval, &retval);*/
|
||||
regval, &retval);
|
||||
FILE_LOG(logINFO, ("\tvoltage read for chan %d: %d mV\n", ichan, retval));
|
||||
|
||||
FILE_LOG(logINFO, ("\tvoltage read for chan %d: %d uV (regVal: %d)\n", ichan, retval, regval));
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -8,15 +8,12 @@ void SPIChipSelect (uint32_t* valw, uint32_t addr, uint32_t csmask, uint32_t cl
|
||||
FILE_LOG(logDEBUG2, ("SPI chip select. valw:0x%08x addr:0x%x csmask:0x%x, clkmask:0x%x digmask:0x%x convbit:%d\n",
|
||||
*valw, addr, csmask, clkmask, digoutmask, convBit));
|
||||
|
||||
// needed for the slow adcs for apprx 20 ns before and after rising of convbit (usleep val is vague assumption)
|
||||
if (convBit)
|
||||
usleep(20);
|
||||
|
||||
// start point
|
||||
if (convBit) {
|
||||
// needed for the slow adcs for apprx 20 ns before and after rising of convbit (usleep val is vague assumption)
|
||||
usleep(20);
|
||||
// clkmask has to be down for conversion to have correct value (for conv bit = 1)
|
||||
(*valw) = (((bus_r(addr) | csmask) &(~clkmask)) &(~digoutmask));
|
||||
} else {
|
||||
(*valw) = ((bus_r(addr) | csmask | clkmask) &(~digoutmask));
|
||||
}
|
||||
(*valw) = ((bus_r(addr) | csmask | clkmask) &(~digoutmask));
|
||||
bus_w (addr, (*valw));
|
||||
FILE_LOG(logDEBUG2, ("startpoint. valw:0x%08x\n", *valw));
|
||||
|
||||
@ -96,7 +93,6 @@ uint32_t receiveDataFromSPI (uint32_t* valw, uint32_t addr, int numbitstoreceive
|
||||
|
||||
uint32_t retval = 0;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < numbitstoreceive; ++i) {
|
||||
|
||||
// clk down
|
||||
@ -108,16 +104,11 @@ uint32_t receiveDataFromSPI (uint32_t* valw, uint32_t addr, int numbitstoreceive
|
||||
retval |= ((bus_r(readaddr) & 0x1) << (numbitstoreceive - 1 - i));
|
||||
FILE_LOG(logDEBUG2, ("read data %d. retval:0x%08x\n", i, retval));
|
||||
|
||||
usleep(20);
|
||||
|
||||
// clk up
|
||||
(*valw) |= clkmask ;
|
||||
bus_w (addr, (*valw));
|
||||
FILE_LOG(logDEBUG2, ("clk up. valw:0x%08x\n", *valw));
|
||||
|
||||
usleep(20);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -144,8 +135,7 @@ uint32_t serializeFromSPI(uint32_t addr, uint32_t csmask, int numbitstoreceive,
|
||||
|
||||
uint32_t retval = receiveDataFromSPI(&valw, addr, numbitstoreceive, clkmask, readaddr);
|
||||
|
||||
// not needed for conv bit (not a chip select)
|
||||
//SPIChipDeselect(&valw, addr, csmask, clkmask, digoutmask, convBit); // moving this before bringin up earlier changes temp of slow adc
|
||||
SPIChipDeselect(&valw, addr, csmask, clkmask, digoutmask, convBit); // moving this before bringin up earlier changes temp of slow adc
|
||||
|
||||
if (numbitstoreceive == 16) {
|
||||
FILE_LOG(logDEBUG2, ("Read From SPI Register: 0x%04x\n", retval));
|
||||
|
@ -315,14 +315,6 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
||||
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
||||
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
||||
case F_GET_NUM_BURSTS: return "F_GET_NUM_BURSTS";
|
||||
case F_SET_NUM_BURSTS: return "F_SET_NUM_BURSTS";
|
||||
case F_GET_BURST_PERIOD: return "F_GET_BURST_PERIOD";
|
||||
case F_SET_BURST_PERIOD: return "F_SET_BURST_PERIOD";
|
||||
case F_GET_CURRENT_SOURCE: return "F_GET_CURRENT_SOURCE";
|
||||
case F_SET_CURRENT_SOURCE: return "F_SET_CURRENT_SOURCE";
|
||||
case F_GET_TIMING_SOURCE: return "F_GET_TIMING_SOURCE";
|
||||
case F_SET_TIMING_SOURCE: return "F_SET_TIMING_SOURCE";
|
||||
|
||||
default: return "Unknown Function";
|
||||
}
|
||||
@ -507,14 +499,6 @@ void function_table() {
|
||||
flist[F_GET_ADC_ENABLE_MASK_10G] = &get_adc_enable_mask_10g;
|
||||
flist[F_SET_COUNTER_MASK] = &set_counter_mask;
|
||||
flist[F_GET_COUNTER_MASK] = &get_counter_mask;
|
||||
flist[F_GET_NUM_BURSTS] = &get_num_bursts;
|
||||
flist[F_SET_NUM_BURSTS] = &set_num_bursts;
|
||||
flist[F_GET_BURST_PERIOD] = &get_burst_period;
|
||||
flist[F_SET_BURST_PERIOD] = &set_burst_period;
|
||||
flist[F_GET_CURRENT_SOURCE] = &get_current_source;
|
||||
flist[F_SET_CURRENT_SOURCE] = &set_current_source;
|
||||
flist[F_GET_TIMING_SOURCE] = &get_timing_source;
|
||||
flist[F_SET_TIMING_SOURCE] = &set_timing_source;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||
@ -1785,6 +1769,12 @@ int start_acquisition(int file_des) {
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef GOTTHARD2D
|
||||
if (updateAcquisitionRegisters(mess) == FAIL) {
|
||||
ret = FAIL;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
@ -1915,6 +1905,12 @@ int start_and_read_all(int file_des) {
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef GOTTHARD2D
|
||||
if (updateAcquisitionRegisters(mess) == FAIL) {
|
||||
ret = FAIL;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
@ -1981,20 +1977,10 @@ int set_num_frames(int file_des) {
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
#ifdef GOTTHARD2D
|
||||
// validate #frames in burst mode
|
||||
if (getBurstMode() != BURST_OFF && arg > MAX_FRAMES_IN_BURST_MODE) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set number of frames %lld. Must be <= %d in burst mode.\n", (long long unsigned int)arg, MAX_FRAMES_IN_BURST_MODE);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
#endif
|
||||
if (ret == OK) {
|
||||
setNumFrames(arg);
|
||||
int64_t retval = getNumFrames();
|
||||
FILE_LOG(logDEBUG1, ("retval num frames %lld\n", (long long int)retval));
|
||||
validate64(arg, retval, "set number of frames", DEC);
|
||||
}
|
||||
setNumFrames(arg);
|
||||
int64_t retval = getNumFrames();
|
||||
FILE_LOG(logDEBUG1, ("retval num frames %lld\n", (long long int)retval));
|
||||
validate64(arg, retval, "set number of frames", DEC);
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
@ -2815,26 +2801,7 @@ int send_update(int file_des) {
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// #bursts
|
||||
#ifdef GOTTHARD2D
|
||||
i64 = getNumBursts();
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// timing mode
|
||||
i32 = (int)getTiming();
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// burst mode
|
||||
#ifdef GOTTHARD2D
|
||||
i32 = (int)getBurstMode();
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// readout mode
|
||||
// readout flags
|
||||
#ifdef CHIPTESTBOARDD
|
||||
i32 = getReadoutMode();
|
||||
n = sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
@ -6664,181 +6631,3 @@ int get_counter_mask(int file_des) {
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
int get_num_bursts(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getNumBursts();
|
||||
FILE_LOG(logDEBUG1, ("retval num bursts %lld\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_num_bursts(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting number of bursts %lld\n", (long long int)arg));
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
setNumBursts(arg);
|
||||
int64_t retval = getNumBursts();
|
||||
FILE_LOG(logDEBUG1, ("retval num bursts %lld\n", (long long int)retval));
|
||||
validate64(arg, retval, "set number of bursts", DEC);
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
int get_burst_period(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getBurstPeriod();
|
||||
FILE_LOG(logDEBUG1, ("retval burst period %lld ns\n", (long long int)retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_burst_period(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting burst period %lld ns\n", (long long int)arg));
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = setBurstPeriod(arg);
|
||||
int64_t retval = getBurstPeriod();
|
||||
FILE_LOG(logDEBUG1, ("retval burst period %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set burst period. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
int set_current_source(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = 0;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logINFO, ("Setting current source enable: %u\n", arg));
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
setCurrentSource(arg);
|
||||
int retval = getCurrentSource();
|
||||
FILE_LOG(logDEBUG1, ("current source enable retval: %u\n", retval));
|
||||
validate(arg, retval, "current source enable", DEC);
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
int get_current_source(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
|
||||
FILE_LOG(logDEBUG1, ("Getting current source enable\n"));
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getCurrentSource();
|
||||
FILE_LOG(logDEBUG1, ("current source enable retval: %u\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
int set_timing_source(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum timingSourceType arg = TIMING_INTERNAL;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Setting timing source: %d\n", arg));
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
switch (arg) {
|
||||
case TIMING_INTERNAL:
|
||||
case TIMING_EXTERNAL:
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("timing source", (int)arg);
|
||||
break;
|
||||
}
|
||||
if (ret == OK) {
|
||||
setTimingSource(arg);
|
||||
enum timingSourceType retval = getTimingSource();
|
||||
FILE_LOG(logDEBUG, ("timing source retval: %d\n", retval));
|
||||
if (retval != arg) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set timing source. Set %d, got %d\n", arg, retval);
|
||||
FILE_LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
int get_timing_source(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum timingSourceType retval = TIMING_INTERNAL;
|
||||
|
||||
FILE_LOG(logDEBUG1, ("Getting timing source\n"));
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getTimingSource();
|
||||
FILE_LOG(logDEBUG1, ("Get timing source retval:%d\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
@ -155,10 +155,12 @@ class Detector {
|
||||
|
||||
void setPeriod(ns t, Positions pos = {});
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||
* [Gotthard2] only in continuous mode */
|
||||
Result<ns> getDelayAfterTrigger(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||
* [Gotthard2] only in continuous mode */
|
||||
void setDelayAfterTrigger(ns value, Positions pos = {});
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||
@ -896,18 +898,6 @@ class Detector {
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/** [Gotthard2] only in burst mode and auto timing mode */
|
||||
Result<int64_t> getNumberOfBursts(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] only in burst mode and auto timing mode */
|
||||
void setNumberOfBursts(int64_t value);
|
||||
|
||||
/** [Gotthard2] only in burst mode and auto timing mode */
|
||||
Result<ns> getBurstPeriod(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] only in burst mode and auto timing mode */
|
||||
void setBurstPeriod(ns value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] offset channel, increment channel */
|
||||
Result<std::array<int, 2>> getInjectChannel(Positions pos = {});
|
||||
|
||||
@ -931,18 +921,6 @@ class Detector {
|
||||
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
|
||||
void setBurstMode(defs::burstMode value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<bool> getCurrentSource(Positions pos = {}) const;
|
||||
|
||||
/** default disabled */
|
||||
void setCurrentSource(bool value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<defs::timingSourceType> getTimingSource(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] Options: TIMING_INTERNAL, TIMING_EXTERNAL */
|
||||
void setTimingSource(defs::timingSourceType value, Positions pos = {});
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Mythen3 Specific *
|
||||
@ -1048,7 +1026,7 @@ class Detector {
|
||||
Result<int> getMeasuredCurrent(defs::dacIndex index,
|
||||
Positions pos = {}) const;
|
||||
|
||||
/** [CTB] Options: SLOW_ADC0 - SLOW_ADC7 in uV */
|
||||
/** [CTB] Options: SLOW_ADC0 - SLOW_ADC7 */
|
||||
Result<int> getSlowADC(defs::dacIndex index, Positions pos = {}) const;
|
||||
|
||||
/** [CTB]*/
|
||||
|
@ -1400,7 +1400,7 @@ std::string CmdProxy::SlowAdc(int action) {
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_channel (0-7 for channel|8 for temperature)]\n\t[Ctb] Slow "
|
||||
"ADC channel in mV or °C."
|
||||
"ADC channel."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
@ -1416,11 +1416,7 @@ std::string CmdProxy::SlowAdc(int action) {
|
||||
} else {
|
||||
auto t = det->getSlowADC(
|
||||
static_cast<defs::dacIndex>(nchan + defs::SLOW_ADC0), {det_id});
|
||||
Result<double> result(t.size());
|
||||
for (unsigned int i = 0; i < t.size(); ++i) {
|
||||
result[i] = t[i] / 1000.00;
|
||||
}
|
||||
os << OutString(result) << " mV\n";
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("cannot put");
|
||||
|
@ -572,11 +572,9 @@ class CmdProxy {
|
||||
{"acquire", &CmdProxy::acquire},
|
||||
{"frames", &CmdProxy::frames},
|
||||
{"triggers", &CmdProxy::triggers},
|
||||
{"bursts", &CmdProxy::bursts},
|
||||
{"exptime", &CmdProxy::exptime},
|
||||
{"period", &CmdProxy::period},
|
||||
{"delay", &CmdProxy::delay},
|
||||
{"burstperiod", &CmdProxy::burstperiod},
|
||||
{"framesl", &CmdProxy::framesl},
|
||||
{"triggersl", &CmdProxy::triggersl},
|
||||
{"delayl", &CmdProxy::delayl},
|
||||
@ -790,8 +788,6 @@ class CmdProxy {
|
||||
{"vetophoton", &CmdProxy::VetoPhoton},
|
||||
{"vetoref", &CmdProxy::VetoReference},
|
||||
{"burstmode", &CmdProxy::BurstMode},
|
||||
{"currentsource", &CmdProxy::currentsource},
|
||||
{"timingsource", &CmdProxy::timingsource},
|
||||
|
||||
/* Mythen3 Specific */
|
||||
{"counters", &CmdProxy::Counters},
|
||||
@ -1015,16 +1011,12 @@ class CmdProxy {
|
||||
INTEGER_COMMAND_NOID(frames, getNumberOfFrames, setNumberOfFrames,
|
||||
std::stol,
|
||||
"[n_frames]\n\tNumber of frames per aquire. In trigger mode, number of frames per trigger."
|
||||
"\n\t[Gotthard2] Burst mode has a maximum of 2720 frames.");
|
||||
"\n\t[Gotthard2] Burst mode has a maximum of 2720 frames. Frames number for both modes are uploaded to detector just before acquisition starts");
|
||||
|
||||
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
|
||||
std::stol,
|
||||
"[n_triggers]\n\tNumber of triggers per aquire. Use timing command to set timing mode.");
|
||||
|
||||
INTEGER_COMMAND_NOID(bursts, getNumberOfBursts, setNumberOfBursts,
|
||||
std::stol,
|
||||
"[n_bursts]\n\t[Gotthard2] Number of bursts per aquire. Only in auto timing mode and burst mode. Use timing command to set timing mode and burstmode command to set burst mode.");
|
||||
|
||||
TIME_COMMAND(exptime, getExptime, setExptime,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\tExposure time"
|
||||
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
|
||||
@ -1034,10 +1026,8 @@ class CmdProxy {
|
||||
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
|
||||
|
||||
TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Delay after trigger");
|
||||
|
||||
TIME_COMMAND(burstperiod, getBurstPeriod, setBurstPeriod,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst period. Only in burst mode and auto timing mode.");
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Delay after trigger"
|
||||
"\n\t[Gotthard2] only in continuous mode.");
|
||||
|
||||
GET_COMMAND(framesl, getNumberOfFramesLeft,
|
||||
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Number of frames left in acquisition."
|
||||
@ -1566,12 +1556,6 @@ class CmdProxy {
|
||||
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated values when taking an acquisition. Default is 0.");
|
||||
|
||||
/* Gotthard2 Specific */
|
||||
INTEGER_COMMAND(currentsource, getCurrentSource, setCurrentSource, std::stoi,
|
||||
"[0, 1]\n\t[Gotthard2] Enable or disable current source. Default is disabled.");
|
||||
|
||||
INTEGER_COMMAND(timingsource, getTimingSource, setTimingSource, sls::StringTo<slsDetectorDefs::timingSourceType>,
|
||||
"[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal and external is system timing. Default is internal.");
|
||||
|
||||
/* Mythen3 Specific */
|
||||
|
||||
/* CTB Specific */
|
||||
|
@ -1160,22 +1160,6 @@ void Detector::setImageTestMode(int value, Positions pos) {
|
||||
|
||||
// Gotthard2 Specific
|
||||
|
||||
Result<int64_t> Detector::getNumberOfBursts(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getNumberOfBursts, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfBursts(int64_t value) {
|
||||
pimpl->Parallel(&slsDetector::setNumberOfBursts, {}, value);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getBurstPeriod(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getBurstPeriod, pos);
|
||||
}
|
||||
|
||||
void Detector::setBurstPeriod(ns value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setBurstPeriod, pos, value.count());
|
||||
}
|
||||
|
||||
Result<std::array<int, 2>> Detector::getInjectChannel(Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getInjectChannel, pos);
|
||||
}
|
||||
@ -1204,22 +1188,6 @@ void Detector::setBurstMode(defs::burstMode value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setBurstMode, pos, value);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getCurrentSource(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getCurrentSource, pos);
|
||||
}
|
||||
|
||||
void Detector::setCurrentSource(bool value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setCurrentSource, pos, value);
|
||||
}
|
||||
|
||||
Result<defs::timingSourceType> Detector::getTimingSource(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimingSource, pos);
|
||||
}
|
||||
|
||||
void Detector::setTimingSource(defs::timingSourceType value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimingSource, pos, value);
|
||||
}
|
||||
|
||||
// Mythen3 Specific
|
||||
|
||||
Result<uint32_t> Detector::getCounterMask(Positions pos) const {
|
||||
|
@ -491,7 +491,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
multiframe = new char[multisize];
|
||||
memset(multiframe, 0xFF, multisize);
|
||||
// dynamic range
|
||||
dynamicRange = doc["bitmode"].GetUint();
|
||||
dynamicRange = doc["bitmode"].GetUint();
|
||||
bytesPerPixel = (float)dynamicRange / 8;
|
||||
// shape
|
||||
nPixelsX = doc["shape"][0].GetUint();
|
||||
@ -514,7 +514,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
(doc["quad"].GetUint() == 0) ? false : true;
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "One Time Header Info:"
|
||||
"\n\tsize: "
|
||||
"\n\tsize: "
|
||||
<< size << "\n\tmultisize: " << multisize
|
||||
<< "\n\tdynamicRange: " << dynamicRange
|
||||
<< "\n\tbytesPerPixel: " << bytesPerPixel
|
||||
@ -536,9 +536,9 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
coordY = (nY - 1) - coordY;
|
||||
}
|
||||
flippedDataX = doc["flippedDataX"].GetUint();
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Header Info:"
|
||||
"\n\tcurrentFileName: "
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Header Info:"
|
||||
"\n\tcurrentFileName: "
|
||||
<< currentFileName << "\n\tcurrentAcquisitionIndex: "
|
||||
<< currentAcquisitionIndex
|
||||
<< "\n\tcurrentFrameIndex: " << currentFrameIndex
|
||||
@ -551,20 +551,19 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
// DATA
|
||||
data = true;
|
||||
zmqSocket[isocket]->ReceiveData(isocket, image, size);
|
||||
|
||||
// creating multi image
|
||||
{
|
||||
uint32_t xoffset = coordX * nPixelsX * bytesPerPixel;
|
||||
uint32_t yoffset = coordY * nPixelsY;
|
||||
uint32_t singledetrowoffset = nPixelsX * bytesPerPixel;
|
||||
uint32_t rowoffset = nX * singledetrowoffset;
|
||||
if (multi_shm()->multiDetectorType == CHIPTESTBOARD) {
|
||||
if (multi_shm()->multiDetectorType == CHIPTESTBOARD) {
|
||||
singledetrowoffset = size;
|
||||
nPixelsY = 1; // TODO: nDetPixelsY is not updated.
|
||||
}
|
||||
|
||||
}
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Multi Image Info:"
|
||||
"\n\txoffset: "
|
||||
<< "Multi Image Info:"
|
||||
"\n\txoffset: "
|
||||
<< xoffset << "\n\tyoffset: " << yoffset
|
||||
<< "\n\tsingledetrowoffset: " << singledetrowoffset
|
||||
<< "\n\trowoffset: " << rowoffset;
|
||||
@ -589,11 +588,11 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
}
|
||||
}
|
||||
}
|
||||
FILE_LOG(logDEBUG)<< "Call Back Info:"
|
||||
<< "\n\t nDetPixelsX: " << nDetPixelsX
|
||||
<< "\n\t nDetPixelsY: " << nDetPixelsY
|
||||
<< "\n\t databytes: " << multisize
|
||||
<< "\n\t dynamicRange: " << dynamicRange ;
|
||||
FILE_LOG(logDEBUG) << "Call Back Info:"
|
||||
<< "\n\t nDetPixelsX: " << nDetPixelsX
|
||||
<< "\n\t nDetPixelsY: " << nDetPixelsY
|
||||
<< "\n\t databytes: " << multisize
|
||||
<< "\n\t dynamicRange: " << dynamicRange;
|
||||
|
||||
// send data to callback
|
||||
if (data) {
|
||||
@ -609,11 +608,10 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
}
|
||||
int n = processImageWithGapPixels(multiframe, multigappixels,
|
||||
quadEnable);
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "Call Back Info Recalculated:"
|
||||
<< "\n\t nDetPixelsX: " << nDetPixelsX
|
||||
<< "\n\t nDetPixelsY: " << nDetPixelsY
|
||||
<< "\n\t databytes: " << n;
|
||||
FILE_LOG(logDEBUG) << "Call Back Info Recalculated:"
|
||||
<< "\n\t nDetPixelsX: " << nDetPixelsX
|
||||
<< "\n\t nDetPixelsY: " << nDetPixelsY
|
||||
<< "\n\t databytes: " << n;
|
||||
thisData =
|
||||
new detectorData(getCurrentProgress(), currentFileName,
|
||||
nDetPixelsX, nDetPixelsY, multigappixels,
|
||||
@ -632,7 +630,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
pCallbackArg);
|
||||
delete thisData;
|
||||
}
|
||||
|
||||
|
||||
// all done
|
||||
if (numRunning == 0) {
|
||||
// let main thread know that all dummy packets have been received
|
||||
@ -877,12 +875,24 @@ void DetectorImpl::registerDataCallback(void (*userCallback)(detectorData *,
|
||||
}
|
||||
|
||||
double DetectorImpl::setTotalProgress() {
|
||||
int64_t tot = Parallel(&slsDetector::getTotalNumFramesToReceive, {})
|
||||
.tsquash("Inconsistent number of total frames (#frames x #triggers(or bursts) x #storage cells)");
|
||||
if (tot == 0) {
|
||||
throw RuntimeError("Invalid Total Number of frames (0)");
|
||||
int64_t nf = Parallel(&slsDetector::getNumberOfFramesFromShm, {})
|
||||
.tsquash("Inconsistent number of frames");
|
||||
int64_t nc = Parallel(&slsDetector::getNumberOfTriggersFromShm, {})
|
||||
.tsquash("Inconsistent number of triggers");
|
||||
if (nf == 0 || nc == 0) {
|
||||
throw RuntimeError("Number of frames or triggers is 0");
|
||||
}
|
||||
totalProgress = tot;
|
||||
|
||||
int ns = 1;
|
||||
if (multi_shm()->multiDetectorType == JUNGFRAU) {
|
||||
ns =
|
||||
Parallel(&slsDetector::getNumberOfAdditionalStorageCellsFromShm, {})
|
||||
.tsquash("Inconsistent number of additional storage cells");
|
||||
++ns;
|
||||
}
|
||||
|
||||
totalProgress = nf * nc * ns;
|
||||
FILE_LOG(logDEBUG1) << "nf " << nf << " nc " << nc << " ns " << ns;
|
||||
FILE_LOG(logDEBUG1) << "Set total progress " << totalProgress << std::endl;
|
||||
return totalProgress;
|
||||
}
|
||||
|
@ -338,10 +338,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
shm()->currentThresholdEV = -1;
|
||||
shm()->nFrames = 1;
|
||||
shm()->nTriggers = 1;
|
||||
shm()->nBursts = 1;
|
||||
shm()->nAddStorageCells = 0;
|
||||
shm()->timingMode = AUTO_TIMING;
|
||||
shm()->burstMode = BURST_INTERNAL;
|
||||
shm()->deadTime = 0;
|
||||
sls::strcpy_safe(shm()->rxHostname, "none");
|
||||
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
|
||||
@ -759,8 +756,8 @@ void slsDetector::updateCachedDetectorVariables() {
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->nFrames = i64;
|
||||
|
||||
// storage cell
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
// storage cell
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->nAddStorageCells = i64;
|
||||
}
|
||||
@ -769,22 +766,6 @@ void slsDetector::updateCachedDetectorVariables() {
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->nTriggers = i64;
|
||||
|
||||
// bursts
|
||||
if (shm()->myDetectorType == GOTTHARD2) {
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->nBursts = i64;
|
||||
}
|
||||
|
||||
// timing mode
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->timingMode = static_cast<timingMode>(i32);
|
||||
|
||||
// burst mode
|
||||
if (shm()->myDetectorType == GOTTHARD2) {
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->burstMode = static_cast<burstMode>(i32);
|
||||
}
|
||||
|
||||
// readout mode
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD) {
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
@ -1219,31 +1200,25 @@ uint64_t slsDetector::getStartingFrameNumber() {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getTotalNumFramesToReceive() {
|
||||
int64_t repeats = shm()->nTriggers;
|
||||
// gotthard2 & auto & burst mode, use nBursts instead of nTriggers
|
||||
if (shm()->myDetectorType == GOTTHARD2) {
|
||||
if (shm()->burstMode != BURST_OFF && shm()->timingMode == AUTO_TIMING) {
|
||||
repeats = shm()->nBursts;
|
||||
}
|
||||
}
|
||||
return (shm()->nFrames * repeats * (int64_t)(shm()->nAddStorageCells + 1));
|
||||
}
|
||||
|
||||
void slsDetector::sendTotalNumFramestoReceiver() {
|
||||
if (shm()->useReceiverFlag) {
|
||||
int64_t arg = getTotalNumFramesToReceive();
|
||||
int64_t arg = shm()->nFrames * shm()->nTriggers * (shm()->nAddStorageCells + 1);
|
||||
FILE_LOG(logDEBUG1) << "Sending total number of frames (#f x #t x #s) to Receiver: " << arg;
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_FRAMES, arg, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfFramesFromShm() {
|
||||
return shm()->nFrames;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfFrames() {
|
||||
int64_t prevVal = shm()->nFrames;
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_NUM_FRAMES, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of frames :" << retval;
|
||||
if (shm()->nFrames != retval) {
|
||||
shm()->nFrames = retval;
|
||||
shm()->nFrames = retval;
|
||||
if (prevVal != retval) {
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nFrames;
|
||||
@ -1256,12 +1231,17 @@ void slsDetector::setNumberOfFrames(int64_t value) {
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfTriggersFromShm() {
|
||||
return shm()->nTriggers;
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfTriggers() {
|
||||
int64_t prevVal = shm()->nTriggers;
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_NUM_TRIGGERS, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of triggers :" << retval;
|
||||
if (shm()->nTriggers != retval) {
|
||||
shm()->nTriggers = retval;
|
||||
shm()->nTriggers = retval;
|
||||
if (prevVal != retval) {
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nTriggers;
|
||||
@ -1273,25 +1253,11 @@ void slsDetector::setNumberOfTriggers(int64_t value) {
|
||||
shm()->nTriggers = value;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
|
||||
int64_t slsDetector::getNumberOfBursts() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_NUM_BURSTS, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "number of bursts :" << retval;
|
||||
if (shm()->nBursts != retval) {
|
||||
shm()->nBursts = retval;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
return shm()->nBursts;
|
||||
}
|
||||
|
||||
void slsDetector::setNumberOfBursts(int64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting number of bursts to " << value;
|
||||
sendToDetector(F_SET_NUM_BURSTS, value, nullptr);
|
||||
shm()->nBursts = value;
|
||||
sendTotalNumFramestoReceiver();
|
||||
}
|
||||
|
||||
int slsDetector::getNumberOfAdditionalStorageCellsFromShm() {
|
||||
return shm()->nAddStorageCells;
|
||||
}
|
||||
|
||||
int slsDetector::getNumberOfAdditionalStorageCells() {
|
||||
int prevVal = shm()->nAddStorageCells;
|
||||
int retval = -1;
|
||||
@ -1401,18 +1367,6 @@ void slsDetector::setDelayAfterTrigger(int64_t value) {
|
||||
sendToDetector(F_SET_DELAY_AFTER_TRIGGER, value, nullptr);
|
||||
}
|
||||
|
||||
int64_t slsDetector::getBurstPeriod() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_BURST_PERIOD, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "burst period :" << retval << "ns";
|
||||
return retval;
|
||||
}
|
||||
|
||||
void slsDetector::setBurstPeriod(int64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting burst period to " << value << "ns";
|
||||
sendToDetector(F_SET_BURST_PERIOD, value, nullptr);
|
||||
}
|
||||
|
||||
int64_t slsDetector::getSubExptime() {
|
||||
int64_t retval = -1;
|
||||
sendToDetector(F_GET_SUB_EXPTIME, nullptr, retval);
|
||||
@ -1544,7 +1498,6 @@ slsDetectorDefs::timingMode slsDetector::setTimingMode(timingMode value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting communication to mode " << value;
|
||||
sendToDetector(fnum, static_cast<int>(value), retval);
|
||||
FILE_LOG(logDEBUG1) << "Timing Mode: " << retval;
|
||||
shm()->timingMode = retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -2535,41 +2488,13 @@ slsDetectorDefs::burstMode slsDetector::getBurstMode() {
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_BURST_MODE, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Burst mode:" << retval;
|
||||
shm()->burstMode = static_cast<slsDetectorDefs::burstMode>(retval);
|
||||
return shm()->burstMode;
|
||||
return static_cast<slsDetectorDefs::burstMode>(retval);
|
||||
}
|
||||
|
||||
void slsDetector::setBurstMode(slsDetectorDefs::burstMode value) {
|
||||
int arg = static_cast<int>(value);
|
||||
FILE_LOG(logDEBUG1) << "Setting burst mode to " << arg;
|
||||
sendToDetector(F_SET_BURST_MODE, arg, nullptr);
|
||||
shm()->burstMode = value;
|
||||
}
|
||||
|
||||
bool slsDetector::getCurrentSource() {
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_CURRENT_SOURCE, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Current source enable:" << retval;
|
||||
return static_cast<bool>(retval);
|
||||
}
|
||||
|
||||
void slsDetector::setCurrentSource(bool value) {
|
||||
int arg = static_cast<int>(value);
|
||||
FILE_LOG(logDEBUG1) << "Setting current source enable to " << arg;
|
||||
sendToDetector(F_SET_CURRENT_SOURCE, arg, nullptr);
|
||||
}
|
||||
|
||||
slsDetectorDefs::timingSourceType slsDetector::getTimingSource() {
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_TIMING_SOURCE, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Timing source:" << retval;
|
||||
return static_cast<slsDetectorDefs::timingSourceType>(retval);
|
||||
}
|
||||
|
||||
void slsDetector::setTimingSource(slsDetectorDefs::timingSourceType value) {
|
||||
int arg = static_cast<int>(value);
|
||||
FILE_LOG(logDEBUG1) << "Setting timing source to " << arg;
|
||||
sendToDetector(F_SET_TIMING_SOURCE, arg, nullptr);
|
||||
}
|
||||
|
||||
int slsDetector::setCounterBit(int cb) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
class ServerInterface;
|
||||
|
||||
#define SLS_SHMAPIVERSION 0x190726
|
||||
#define SLS_SHMVERSION 0x200225
|
||||
#define SLS_SHMVERSION 0x191127
|
||||
|
||||
/**
|
||||
* @short structure allocated in shared memory to store detector settings for
|
||||
@ -86,17 +86,8 @@ struct sharedSlsDetector {
|
||||
/** number of triggers */
|
||||
int64_t nTriggers;
|
||||
|
||||
/** number of bursts */
|
||||
int64_t nBursts;
|
||||
|
||||
/** number of additional storage cells */
|
||||
int nAddStorageCells;
|
||||
|
||||
/** timing mode */
|
||||
slsDetectorDefs::timingMode timingMode;
|
||||
|
||||
/** burst mode */
|
||||
slsDetectorDefs::burstMode burstMode;
|
||||
|
||||
/** rate correction in ns */
|
||||
int64_t deadTime;
|
||||
@ -530,24 +521,23 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint64_t getStartingFrameNumber();
|
||||
|
||||
int64_t getTotalNumFramesToReceive();
|
||||
|
||||
void sendTotalNumFramestoReceiver();
|
||||
|
||||
int64_t getNumberOfFramesFromShm();
|
||||
|
||||
int64_t getNumberOfFrames();
|
||||
|
||||
void setNumberOfFrames(int64_t value);
|
||||
|
||||
int64_t getNumberOfTriggersFromShm();
|
||||
|
||||
int64_t getNumberOfTriggers();
|
||||
|
||||
void setNumberOfTriggers(int64_t value);
|
||||
|
||||
/** [Gotthard2] only in burst mode and in auto timing mode */
|
||||
int64_t getNumberOfBursts();
|
||||
|
||||
/** [Gotthard2] only in burst mode and in auto timing mode */
|
||||
void setNumberOfBursts(int64_t value);
|
||||
|
||||
/** [Jungfrau] Advanced */
|
||||
int getNumberOfAdditionalStorageCellsFromShm();
|
||||
|
||||
/** [Jungfrau] Advanced */
|
||||
int getNumberOfAdditionalStorageCells();
|
||||
|
||||
@ -574,18 +564,14 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
|
||||
void setPeriod(int64_t value);
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||
* [Gotthard2] only in continuous mode */
|
||||
int64_t getDelayAfterTrigger();
|
||||
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
||||
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||
* [Gotthard2] only in continuous mode */
|
||||
void setDelayAfterTrigger(int64_t value);
|
||||
|
||||
/** [Gotthard2] only in burst mode and in auto timing mode */
|
||||
int64_t getBurstPeriod();
|
||||
|
||||
/** [Gotthard2] only in burst mode and in auto timing mode */
|
||||
void setBurstPeriod(int64_t value);
|
||||
|
||||
/** [Eiger] in 32 bit mode */
|
||||
int64_t getSubExptime();
|
||||
|
||||
@ -1152,18 +1138,6 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
|
||||
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
|
||||
void setBurstMode(burstMode value);
|
||||
|
||||
/** [Gotthard2] */
|
||||
bool getCurrentSource();
|
||||
|
||||
/** default disabled */
|
||||
void setCurrentSource(bool value);
|
||||
|
||||
/** [Gotthard2] */
|
||||
slsDetectorDefs::timingSourceType getTimingSource();
|
||||
|
||||
/** [Gotthard2] Options: TIMING_INTERNAL, TIMING_EXTERNAL */
|
||||
void setTimingSource(slsDetectorDefs::timingSourceType value);
|
||||
|
||||
/**
|
||||
* Set/get counter bit in detector (Gotthard)
|
||||
|
@ -7,8 +7,6 @@ target_sources(tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-jungfrau.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-mythen3.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-gotthard2.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-gotthard.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-chiptestboard.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-global.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-Result.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdParser.cpp
|
||||
|
@ -1,97 +0,0 @@
|
||||
#include "CmdProxy.h"
|
||||
#include "Detector.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls_detector_defs.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "Result.h"
|
||||
#include "ToString.h"
|
||||
#include "test-CmdProxy-global.h"
|
||||
#include "tests/globals.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
using sls::CmdProxy;
|
||||
using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
TEST_CASE("Setting and reading back Chip test board dacs", "[.cmd][.dacs]") {
|
||||
// dac 0 to dac 17
|
||||
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
for (int i = 0; i < 18; ++i) {
|
||||
SECTION("dac " + std::to_string(i)) { test_dac(static_cast<defs::dacIndex>(i), "dac " + std::to_string(i), 0); }
|
||||
}
|
||||
// eiger
|
||||
REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vsvp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vsvn", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vrf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vrs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtgstv", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_ll", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_lr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcal", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_rl", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_rr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("rxb_rb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("rxb_lb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcn", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vis", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("iodelay", {}, -1, GET));
|
||||
// jungfrau
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_prech", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_ds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
// gotthard
|
||||
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
|
||||
// mythen3
|
||||
REQUIRE_THROWS(proxy.Call("vpreamp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vshaper", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vshaperneg", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("viinsh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth2", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth3", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vpl", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vph", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcassh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcas", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vicin", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vipre_out", {}, -1, GET));
|
||||
// gotthard2
|
||||
REQUIRE_THROWS(proxy.Call("vref_h_adc", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_l_adc", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
}
|
||||
}
|
@ -280,7 +280,7 @@ TEST_CASE("quad", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs]") {
|
||||
TEST_CASE("Setting and reading back EIGER dacs", "[.cmd]") {
|
||||
// vsvp, vtr, vrf, vrs, vsvn, vtgstv, vcmp_ll, vcmp_lr, vcal, vcmp_rl,
|
||||
// rxb_rb, rxb_lb, vcmp_rr, vcp, vcn, vis, vthreshold
|
||||
Detector det;
|
||||
@ -374,14 +374,11 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs]") {
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
// jungfrau
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_prech", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_ds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,93 +0,0 @@
|
||||
#include "CmdProxy.h"
|
||||
#include "Detector.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls_detector_defs.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "Result.h"
|
||||
#include "ToString.h"
|
||||
#include "test-CmdProxy-global.h"
|
||||
#include "tests/globals.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
using sls::CmdProxy;
|
||||
using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
TEST_CASE("Setting and reading back GOTTHARD dacs", "[.cmd][.dacs]") {
|
||||
// vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp, ib_test_c
|
||||
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD) {
|
||||
SECTION("vref_ds") { test_dac(defs::VREF_DS, "vref_ds", 660); }
|
||||
SECTION("vcascn_pb") { test_dac(defs::VCASCN_PB, "vcascn_pb", 650); }
|
||||
SECTION("vcascp_pb") { test_dac(defs::VCASCP_PB, "vcascp_pb", 1480); }
|
||||
SECTION("vout_cm") { test_dac(defs::VOUT_CM, "vout_cm", 1520); }
|
||||
SECTION("vcasc_out") { test_dac(defs::VCASC_OUT, "vcasc_out", 1320); }
|
||||
SECTION("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1350); }
|
||||
SECTION("vref_comp") { test_dac(defs::VREF_COMP, "vref_comp", 350); }
|
||||
SECTION("ib_test_c") { test_dac(defs::IB_TESTC, "ib_test_c", 2001); }
|
||||
// eiger
|
||||
REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vsvp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vsvn", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vrf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vrs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtgstv", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_ll", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_lr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcal", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_rl", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_rr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("rxb_rb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("rxb_lb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcn", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vis", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("iodelay", {}, -1, GET));
|
||||
// jungfrau
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_prech", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_ds", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
// mythen3
|
||||
REQUIRE_THROWS(proxy.Call("vpreamp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vshaper", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vshaperneg", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("viinsh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth2", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth3", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vpl", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vph", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcassh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcas", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vicin", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vipre_out", {}, -1, GET));
|
||||
// gotthard2
|
||||
REQUIRE_THROWS(proxy.Call("vref_h_adc", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_l_adc", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
}
|
||||
}
|
@ -68,14 +68,11 @@ TEST_CASE("Setting and reading back GOTTHARD2 dacs", "[.cmd][.dacs]") {
|
||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
|
||||
// jungfrau
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vref_prech", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_ds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
|
||||
// mythen3
|
||||
REQUIRE_THROWS(proxy.Call("vpreamp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vshaper", {}, -1, GET));
|
||||
@ -227,117 +224,3 @@ TEST_CASE("inj_ch", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("inj_ch", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("bursts", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto previous = det.getNumberOfBursts().squash(1);
|
||||
auto previousTrigger = det.getNumberOfTriggers().squash(1);
|
||||
|
||||
std::ostringstream oss_set, oss_get;
|
||||
proxy.Call("bursts", {"3"}, -1, PUT, oss_set);
|
||||
REQUIRE(oss_set.str() == "bursts 3\n");
|
||||
|
||||
// change to trigger and back (bursts should still be same)
|
||||
proxy.Call("timing", {"trigger"}, -1, PUT);
|
||||
proxy.Call("triggers", {"2"}, -1, PUT);
|
||||
proxy.Call("timing", {"auto"}, -1, PUT);
|
||||
|
||||
|
||||
proxy.Call("bursts", {}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() == "bursts 3\n");
|
||||
|
||||
|
||||
det.setNumberOfBursts(previous);
|
||||
det.setNumberOfTriggers(previousTrigger);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("bursts", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("burstperiod", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto previous = det.getBurstPeriod();
|
||||
|
||||
std::ostringstream oss_set, oss_get;
|
||||
proxy.Call("burstperiod", {"30ms"}, -1, PUT, oss_set);
|
||||
REQUIRE(oss_set.str() == "burstperiod 30ms\n");
|
||||
proxy.Call("burstperiod", {}, -1, GET, oss_get);
|
||||
REQUIRE(oss_get.str() == "burstperiod 30ms\n");
|
||||
// Reset all dacs to previous value
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setBurstPeriod(previous[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("burstperiod", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("currentsource", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto prev_val = det.getCurrentSource();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("currentsource", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "currentsource 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("currentsource", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "currentsource 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("currentsource", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "currentsource 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setCurrentSource(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("currentsource", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("timingsource", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto prev_val = det.getTimingSource();
|
||||
/* { until its activated in fpga
|
||||
std::ostringstream oss;
|
||||
proxy.Call("timingsource", {"external"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "timingsource external\n");
|
||||
}*/
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("timingsource", {"internal"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "timingsource internal\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("timingsource", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "timingsource internal\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTimingSource(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("timingsource", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "sls_detector_defs.h"
|
||||
#include <sstream>
|
||||
|
||||
#include "test-CmdProxy-global.h"
|
||||
#include "tests/globals.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
@ -158,78 +157,76 @@ TEST_CASE("resetfpga", "[.cmd]") {
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd]") {
|
||||
// vb_comp, vdd_prot, vin_com, vref_prech, vb_pixbuf, vb_ds, vref_ds, vref_comp
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
SECTION("vb_comp") { test_dac(defs::VB_COMP, "vb_comp", 1220); }
|
||||
SECTION("vdd_prot") { test_dac(defs::VDD_PROT, "vdd_prot", 3000); }
|
||||
SECTION("vin_com") { test_dac(defs::VIN_COM, "vin_com", 1053); }
|
||||
SECTION("vref_prech") { test_dac(defs::VREF_PRECH, "vref_prech", 1450); }
|
||||
SECTION("vb_pixbuf") { test_dac(defs::VB_PIXBUF, "vb_pixbuf", 750); }
|
||||
SECTION("vb_ds") { test_dac(defs::VB_DS, "vb_ds", 1000); }
|
||||
SECTION("vref_ds") { test_dac(defs::VREF_DS, "vref_ds", 480); }
|
||||
SECTION("vref_comp") { test_dac(defs::VREF_COMP, "vref_comp", 420); }
|
||||
// eiger
|
||||
REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vsvp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vsvn", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vrf", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vrs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtgstv", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_ll", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_lr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcal", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_rl", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcmp_rr", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("rxb_rb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("rxb_lb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcn", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vis", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("iodelay", {}, -1, GET));
|
||||
// gotthard
|
||||
// REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
|
||||
// REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
|
||||
// mythen3
|
||||
REQUIRE_THROWS(proxy.Call("vpreamp", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vshaper", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vshaperneg", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("viinsh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth2", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vth3", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vpl", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vph", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcassh", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcas", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vicin", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vipre_out", {}, -1, GET));
|
||||
// gotthard2
|
||||
REQUIRE_THROWS(proxy.Call("vref_h_adc", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_l_adc", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
// void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue)
|
||||
// {
|
||||
// Detector det;
|
||||
// CmdProxy proxy(&det);
|
||||
// std::ostringstream oss_set, oss_get;
|
||||
// auto dacstr = std::to_string(dacvalue);
|
||||
// auto previous = det.getDAC(index, false);
|
||||
// proxy.Call(dacname, {dacstr}, -1, PUT, oss_set);
|
||||
// REQUIRE(oss_set.str() == dacname + " " + dacstr + "\n");
|
||||
// proxy.Call(dacname, {}, -1, GET, oss_get);
|
||||
// REQUIRE(oss_set.str() == dacname + " " + dacstr + "\n");
|
||||
// // Reset all dacs to previous value
|
||||
// for (int i = 0; i != det.size(); ++i) {
|
||||
// det.setDAC(index, previous[i], false, {i});
|
||||
// }
|
||||
// }
|
||||
|
||||
// TEST_CASE("Setting and reading back EIGER dacs", "[.cmd]") {
|
||||
// // vsvp, vtr, vrf, vrs, vsvn, vtgstv, vcmp_ll, vcmp_lr, vcal, vcmp_rl,
|
||||
// // rxb_rb, rxb_lb, vcmp_rr, vcp, vcn, vis, vthreshold
|
||||
// Detector det;
|
||||
// CmdProxy proxy(&det);
|
||||
// auto det_type = det.getDetectorType().squash();
|
||||
// if (det_type == defs::EIGER) {
|
||||
// SECTION("vsvp") { test_dac(defs::SVP, "vsvp", 5); }
|
||||
// SECTION("vtr") { test_dac(defs::VRF, "vtr", 1200); }
|
||||
// SECTION("vrf") { test_dac(defs::VRF, "vrf", 1500); }
|
||||
// SECTION("vrs") { test_dac(defs::VRF, "vrs", 1510); }
|
||||
// SECTION("vsvn") { test_dac(defs::SVN, "vsvn", 3800); }
|
||||
// SECTION("vtgstv") { test_dac(defs::VTGSTV, "vtgstv", 2550); }
|
||||
// SECTION("vcmp_ll") { test_dac(defs::VCMP_LL, "vcmp_ll", 1400); }
|
||||
// SECTION("vcmp_lr") { test_dac(defs::VCMP_LR, "vcmp_lr", 1400); }
|
||||
// SECTION("vcal") { test_dac(defs::CAL, "vcal", 1400); }
|
||||
// SECTION("vcmp_rl") { test_dac(defs::VCMP_RL, "vcmp_rl", 1400); }
|
||||
// SECTION("rxb_rb") { test_dac(defs::RXB_RB, "rxb_rb", 1400); }
|
||||
// SECTION("rxb_lb") { test_dac(defs::RXB_LB, "rxb_lb", 1400); }
|
||||
// SECTION("vcmp_rr") { test_dac(defs::VCMP_RR, "vcmp_rr", 1400); }
|
||||
// SECTION("vcp") { test_dac(defs::VCP, "vcp", 1400); }
|
||||
// SECTION("vcn") { test_dac(defs::VCN, "vcn", 1400); }
|
||||
// SECTION("vis") { test_dac(defs::VIS, "vis", 1400); }
|
||||
// SECTION("iodelay") { test_dac(defs::IO_DELAY, "iodelay", 1400); }
|
||||
// SECTION("vthreshold") {
|
||||
// // Read out individual vcmp to be able to reset after
|
||||
// // the test is done
|
||||
// auto vcmp_ll = det.getDAC(defs::VCMP_LL, false);
|
||||
// auto vcmp_lr = det.getDAC(defs::VCMP_LR, false);
|
||||
// auto vcmp_rl = det.getDAC(defs::VCMP_RL, false);
|
||||
// auto vcmp_rr = det.getDAC(defs::VCMP_RR, false);
|
||||
// auto vcp = det.getDAC(defs::VCP, false);
|
||||
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// proxy.Call("vthreshold", {"1234"}, -1, PUT, oss);
|
||||
// REQUIRE(oss.str() == "vthreshold 1234\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// proxy.Call("vthreshold", {}, -1, GET, oss);
|
||||
// REQUIRE(oss.str() == "vthreshold 1234\n");
|
||||
// }
|
||||
|
||||
// // Reset dacs after test
|
||||
// for (int i = 0; i != det.size(); ++i) {
|
||||
// det.setDAC(defs::VCMP_LL, vcmp_ll[i], false, {i});
|
||||
// det.setDAC(defs::VCMP_LR, vcmp_ll[i], false, {i});
|
||||
// det.setDAC(defs::VCMP_RL, vcmp_ll[i], false, {i});
|
||||
// det.setDAC(defs::VCMP_RR, vcmp_ll[i], false, {i});
|
||||
// det.setDAC(defs::VCP, vcp[i], false, {i});
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
@ -64,6 +64,432 @@ TEST_CASE("initialchecks", "[.cmd]") {
|
||||
det.setInitialChecks(check);
|
||||
}
|
||||
|
||||
// TEST_CASE("dacs", "[.cmd]") {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("daclist", GET));
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("dacvalues", GET));
|
||||
// int prev_val = 0;
|
||||
// if (test::type == slsDetectorDefs::JUNGFRAU) {
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_ds", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vb_ds "));
|
||||
// prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_ds 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_ds", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vb_ds 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_ds " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_comp", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vb_comp "));
|
||||
// prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_comp 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_comp", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vb_comp 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_comp " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_pixbuf", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vb_pixbuf
|
||||
// ")); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_pixbuf 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_pixbuf", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vb_pixbuf 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vb_pixbuf " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_ds", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vref_ds "));
|
||||
// prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_ds 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_ds", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vref_ds 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_ds " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_comp", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vref_comp
|
||||
// ")); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_comp 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_comp", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vref_comp 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_comp " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_prech", GET,
|
||||
// nullptr, oss)); std::string s = (oss.str()).erase (0,
|
||||
// strlen("vref_prech ")); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_prech 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_prech", GET,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "vref_prech 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_prech " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vin_com", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vin_com "));
|
||||
// prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vin_com 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vin_com", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vin_com 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vin_com " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vdd_prot", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vdd_prot
|
||||
// ")); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vdd_prot 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vdd_prot", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vdd_prot 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vdd_prot " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vthreshold", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vsvp", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vsvn", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vtr", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vrf", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vrs", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vtgstv", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_ll", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_lr", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcal", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_rl", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_rr", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("rxb_rb", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("rxb_lb", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcp", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcn", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vis", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("iodelay", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcascn_pb", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcascp_pb", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vout_cm", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcasc_out", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vin_cm", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("ib_test_c", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vpreamp", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vshaper", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vshaperneg", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vipre", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("viinsh", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vdcsh", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vth1", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vth2", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vth3", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vpl", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vph", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vtrim", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcassh", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcas", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vicin", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vipre_out", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_h_adc", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_fe", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_adc", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_cds", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_rstore", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_1st", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_comp_fe", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc1", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_l_adc", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_cds", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_cs", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_fd", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc2", GET));
|
||||
// }
|
||||
|
||||
// else if (test::type == slsDetectorDefs::GOTTHARD) {
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_ds", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vref_ds "));
|
||||
// prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_ds 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_ds", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vref_ds 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_ds " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcascn_pb", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vcascn_pb
|
||||
// ")); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcascn_pb 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcascn_pb", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vcascn_pb 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcascn_pb " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcascp_pb", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vcascp_pb
|
||||
// ")); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcascp_pb 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcascp_pb", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vcascp_pb 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcascp_pb " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vout_cm", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vout_cm "));
|
||||
// prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vout_cm 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vout_cm", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vout_cm 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vout_cm " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcasc_out", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vcasc_out
|
||||
// ")); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcasc_out 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcasc_out", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vcasc_out 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vcasc_out " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vin_cm", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vin_cm "));
|
||||
// prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vin_cm 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vin_cm", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vin_cm 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vin_cm " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_comp", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("vref_comp
|
||||
// ")); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_comp 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_comp", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "vref_comp 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("vref_comp " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("ib_test_c", GET, nullptr,
|
||||
// oss)); std::string s = (oss.str()).erase (0, strlen("ib_test_c
|
||||
// ")); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("ib_test_c 1000", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("ib_test_c", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "ib_test_c 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("ib_test_c " +
|
||||
// std::to_string(prev_val), PUT));
|
||||
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vthreshold", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vsvp", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vsvn", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vtr", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vrf", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vrs", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vtgstv", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_ll", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_lr", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcal", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_rl", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_rr", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("rxb_rb", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("rxb_lb", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcp", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcn", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vis", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("iodelay", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vpreamp", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vshaper", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vshaperneg", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vipre", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("viinsh", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vdcsh", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vth1", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vth2", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vth3", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vpl", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vph", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vtrim", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcassh", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcas", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vicin", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vipre_out", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_h_adc", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_fe", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_adc", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_cds", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_rstore", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_1st", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_comp_fe", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc1", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_prech", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_l_adc", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_cds", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_cs", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_fd", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc2", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_ds", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_pixbuf", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vin_com", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vdd_prot", GET));
|
||||
// }
|
||||
|
||||
// else if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
// for (int i = 0; i < 18; ++i) {
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("dac " +
|
||||
// std::to_string(i), GET, nullptr, oss)); std::string s =
|
||||
// (oss.str()).erase (0, ("dac " + std::to_string(i)).length() +
|
||||
// 1); prev_val = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("dac " +
|
||||
// std::to_string(i) + " 1000", PUT)); std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("dac " +
|
||||
// std::to_string(i), GET, nullptr, oss)); REQUIRE(oss.str() ==
|
||||
// "dac " + std::to_string(i) + " 1000\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("dac " + std::to_string(i)
|
||||
// + " " + std::to_string(prev_val), PUT));
|
||||
// }
|
||||
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vthreshold", GET)); dac 0
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vsvp", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vsvn", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vtr", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vrf", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vrs", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vtgstv", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_ll", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_lr", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcal", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_rl", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcmp_rr", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("rxb_rb", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("rxb_lb", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcp", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcn", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vis", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("iodelay", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vref_ds", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vcascn_pb", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vcascp_pb", GET));
|
||||
// // REQUIRE_THROWS(multiSlsDetectorClient("vout_cm", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vcasc_out", GET));
|
||||
// // REQUIRE_THROWS(multiSlsDetectorClient("vin_cm", GET));
|
||||
// // REQUIRE_THROWS(multiSlsDetectorClient("vref_comp", GET));
|
||||
// // REQUIRE_THROWS(multiSlsDetectorClient("ib_test_c", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vpreamp", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vshaper", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vshaperneg", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vipre", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("viinsh", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vdcsh", GET));
|
||||
// // REQUIRE_THROWS(multiSlsDetectorClient("vth1", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vth2", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vth3", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vpl", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vph", GET));
|
||||
// //REQUIRE_THROWS(multiSlsDetectorClient("vtrim", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcassh", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcas", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vicin", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vipre_out", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_h_adc", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_fe", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp_adc", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_cds", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_rstore", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_1st", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_comp_fe", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc1", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_prech", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_l_adc", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vref_cds", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_cs", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_opa_fd", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vcom_adc2", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_ds", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_comp", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vb_pixbuf", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vin_com", GET));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("vdd_prot", GET));
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
TEST_CASE("user", "[.cmd]") {
|
||||
Detector det;
|
||||
|
@ -84,9 +84,6 @@ uint64_t Listener::GetNumMissingPacket(bool stoppedFlag, uint64_t numPackets) {
|
||||
if (!stoppedFlag) {
|
||||
return (numPackets - numPacketsCaught);
|
||||
}
|
||||
if (numPacketsCaught == 0) {
|
||||
return numPacketsCaught;
|
||||
}
|
||||
return (lastCaughtFrameIndex - firstIndex + 1) * generalData->packetsPerFrame - numPacketsCaught;
|
||||
}
|
||||
|
||||
|
@ -217,18 +217,6 @@ inline std::string ToString(const defs::burstMode s) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline std::string ToString(const defs::timingSourceType s) {
|
||||
switch (s) {
|
||||
case defs::TIMING_INTERNAL:
|
||||
return std::string("internal");
|
||||
case defs::TIMING_EXTERNAL:
|
||||
return std::string("external");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
// in case we already have a string
|
||||
// causes a copy but might be needed in generic code
|
||||
inline std::string ToString(const std::string& s) {
|
||||
@ -586,15 +574,6 @@ inline defs::burstMode StringTo(const std::string& s) {
|
||||
throw sls::RuntimeError("Unknown burst mode " + s);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline defs::timingSourceType StringTo(const std::string& s) {
|
||||
if (s == "internal")
|
||||
return defs::TIMING_INTERNAL;
|
||||
if (s == "external")
|
||||
return defs::TIMING_EXTERNAL;
|
||||
throw sls::RuntimeError("Unknown timing source type " + s);
|
||||
}
|
||||
|
||||
|
||||
/** For types with a .str() method use this for conversion */
|
||||
template <typename T>
|
||||
|
@ -90,13 +90,17 @@ class UdpRxSocket {
|
||||
}
|
||||
|
||||
const char *LastPacket() const noexcept { return buff; }
|
||||
ssize_t getPacketSize() const noexcept { return packet_size; }
|
||||
|
||||
bool ReceivePacket() noexcept { return ReceivePacket(buff); }
|
||||
constexpr ssize_t getPacketSize() const noexcept { return packet_size; }
|
||||
|
||||
bool ReceivePacket() noexcept {
|
||||
auto bytes_received =
|
||||
recvfrom(fd, buff, packet_size, 0, nullptr, nullptr);
|
||||
return bytes_received == packet_size;
|
||||
}
|
||||
|
||||
bool ReceivePacket(char *dst) noexcept {
|
||||
auto bytes_received =
|
||||
recvfrom(fd, dst, packet_size, 0, nullptr, nullptr);
|
||||
recvfrom(fd, buff, packet_size, 0, nullptr, nullptr);
|
||||
return bytes_received == packet_size;
|
||||
}
|
||||
|
||||
@ -144,4 +148,4 @@ class UdpRxSocket {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace sls
|
||||
} // namespace sls
|
@ -444,17 +444,9 @@ class slsDetectorDefs {
|
||||
enum burstMode {
|
||||
BURST_OFF,
|
||||
BURST_INTERNAL,
|
||||
BURST_EXTERNAL
|
||||
BURST_EXTERNAL,
|
||||
};
|
||||
|
||||
/**
|
||||
* timing source for gotthard2
|
||||
*/
|
||||
enum timingSourceType {
|
||||
TIMING_INTERNAL,
|
||||
TIMING_EXTERNAL
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
protected:
|
||||
|
@ -188,18 +188,9 @@ enum detFuncs{
|
||||
F_GET_ADC_ENABLE_MASK_10G,
|
||||
F_SET_COUNTER_MASK,
|
||||
F_GET_COUNTER_MASK,
|
||||
F_GET_NUM_BURSTS,
|
||||
F_SET_NUM_BURSTS,
|
||||
F_GET_BURST_PERIOD,
|
||||
F_SET_BURST_PERIOD,
|
||||
F_GET_CURRENT_SOURCE,
|
||||
F_SET_CURRENT_SOURCE,
|
||||
F_GET_TIMING_SOURCE,
|
||||
F_SET_TIMING_SOURCE,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||
F_EXEC_RECEIVER_COMMAND,
|
||||
F_EXIT_RECEIVER,
|
||||
F_LOCK_RECEIVER,
|
||||
@ -452,14 +443,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
||||
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
||||
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
||||
case F_GET_NUM_BURSTS: return "F_GET_NUM_BURSTS";
|
||||
case F_SET_NUM_BURSTS: return "F_SET_NUM_BURSTS";
|
||||
case F_GET_BURST_PERIOD: return "F_GET_BURST_PERIOD";
|
||||
case F_SET_BURST_PERIOD: return "F_SET_BURST_PERIOD";
|
||||
case F_GET_CURRENT_SOURCE: return "F_GET_CURRENT_SOURCE";
|
||||
case F_SET_CURRENT_SOURCE: return "F_SET_CURRENT_SOURCE";
|
||||
case F_GET_TIMING_SOURCE: return "F_GET_TIMING_SOURCE";
|
||||
case F_SET_TIMING_SOURCE: return "F_SET_TIMING_SOURCE";
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
|
@ -1,12 +1,12 @@
|
||||
/** API versions */
|
||||
#define GITBRANCH "developer"
|
||||
#define APILIB 0x190723
|
||||
#define APIRECEIVER 0x190722
|
||||
#define APIGUI 0x190723
|
||||
#define APIEIGER 0x200122
|
||||
#define APIGOTTHARD 0x200130
|
||||
#define APICTB 0x200131
|
||||
#define APIJUNGFRAU 0x200131
|
||||
#define APIMOENCH 0x200131
|
||||
#define APIMYTHEN3 0x200226
|
||||
#define APIJUNGFRAU 0x200226
|
||||
#define APIEIGER 0x200226
|
||||
#define APIGOTTHARD 0x200226
|
||||
#define APILIB 0x200227
|
||||
#define APIRECEIVER 0x200227
|
||||
#define APIGUI 0x200227
|
||||
#define APICTB 0x200227
|
||||
#define APIGOTTHARD2 0x200228
|
||||
#define APIMYTHEN3 0x200130
|
||||
#define APIGOTTHARD2 0x200204
|
||||
|
@ -5,8 +5,6 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
constexpr int default_port = 50001;
|
||||
|
||||
int open_socket(int port) {
|
||||
const char *host = nullptr; // localhost
|
||||
|
||||
@ -36,8 +34,9 @@ int open_socket(int port) {
|
||||
return fd;
|
||||
}
|
||||
|
||||
TEST_CASE("Receive data on localhost") {
|
||||
TEST_CASE("Receive a packet on localhost") {
|
||||
constexpr int port = 50001;
|
||||
|
||||
std::vector<int> data_to_send{4, 5, 3, 2, 5, 7, 2, 3};
|
||||
ssize_t packet_size =
|
||||
sizeof(decltype(data_to_send)::value_type) * data_to_send.size();
|
||||
@ -45,6 +44,9 @@ TEST_CASE("Receive data on localhost") {
|
||||
|
||||
|
||||
int fd = open_socket(port);
|
||||
// int n = sendto(fd, data_to_send.data(), packet_size, 0, res->ai_addr,
|
||||
// res->ai_addrlen);
|
||||
|
||||
auto n = write(fd, data_to_send.data(), packet_size);
|
||||
CHECK(n == packet_size);
|
||||
CHECK(udpsock.ReceivePacket());
|
||||
@ -58,7 +60,7 @@ TEST_CASE("Receive data on localhost") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Shutdown socket without hanging when waiting for data") {
|
||||
TEST_CASE("Shutdown socket without hanging") {
|
||||
constexpr int port = 50001;
|
||||
constexpr ssize_t packet_size = 8000;
|
||||
sls::UdpRxSocket s{port, packet_size};
|
||||
@ -84,26 +86,4 @@ TEST_CASE("Too small packet"){
|
||||
write(fd, &val, sizeof(val));
|
||||
CHECK(s.ReceivePacket() == false);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Receive an int to internal buffer"){
|
||||
int to_send = 5;
|
||||
int received = -1;
|
||||
auto fd = open_socket(default_port);
|
||||
sls::UdpRxSocket s(default_port, sizeof(int));
|
||||
write(fd, &to_send, sizeof(to_send));
|
||||
CHECK(s.ReceivePacket());
|
||||
memcpy(&received, s.LastPacket(), sizeof(int));
|
||||
CHECK(received == to_send);
|
||||
}
|
||||
|
||||
TEST_CASE("Receive an int to an external buffer"){
|
||||
int to_send = 5;
|
||||
int received = -1;
|
||||
auto fd = open_socket(default_port);
|
||||
sls::UdpRxSocket s(default_port, sizeof(int));
|
||||
write(fd, &to_send, sizeof(to_send));
|
||||
CHECK(s.ReceivePacket(reinterpret_cast<char*>(&received)));
|
||||
CHECK(received == to_send);
|
||||
}
|
Reference in New Issue
Block a user