mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 13:57:13 +02:00
Compare commits
211 Commits
gotthardDo
...
sophieesrf
Author | SHA1 | Date | |
---|---|---|---|
53423a42ac | |||
c2b1eef75c | |||
f5a86bbfe1 | |||
9af0ec74b6 | |||
45de361b22 | |||
260f237990 | |||
37dd5fb902 | |||
ecd0c810ca | |||
7c29327b47 | |||
c366e94a96 | |||
ca8cb33569 | |||
7db6b7bca8 | |||
7e16f3ebeb | |||
233c145791 | |||
d7cc9fc023 | |||
ed1135566a | |||
3595c586d4 | |||
11de3dfde2 | |||
14d227f8db | |||
144bd7124b | |||
f6660c0dac | |||
73ac8bab38 | |||
d76568d6d9 | |||
72f47b2375 | |||
3114512c3f | |||
95254619c6 | |||
a0016cb005 | |||
0b140111b3 | |||
d7831f6c64 | |||
a97b725f43 | |||
69c71e48f6 | |||
54fc63dd55 | |||
5e9871720b | |||
55517e6d4c | |||
2853f97fe7 | |||
fc0f8ef9da | |||
99bf6446fe | |||
283dfa2b05 | |||
5316fed5d4 | |||
dda013a85b | |||
2eecf43fbb | |||
eba0fa277d | |||
e6e3561dcb | |||
b294b3e8b1 | |||
025e7b8f44 | |||
aa25d86310 | |||
a7551cca4e | |||
8e79f9094a | |||
2dece5c635 | |||
24db58e615 | |||
bab7d8e3fb | |||
2339fb2a0e | |||
378392c0f5 | |||
fcde40b854 | |||
ceed0eaa9b | |||
e3088d822f | |||
27ebd9c713 | |||
f33b3cdc79 | |||
b0ea458d3a | |||
7e2f2cd31b | |||
6cf7bf2e06 | |||
fc7ae98eee | |||
542dda8ece | |||
0f6cb4dc41 | |||
ecc970bc73 | |||
15aaa93130 | |||
34b659fa15 | |||
cf8b0de433 | |||
32c1a45e11 | |||
da1b6ad62d | |||
49d6dcb6e2 | |||
22ef1cee8b | |||
9d3fdaaadc | |||
06f84585af | |||
a970bacbe5 | |||
5be2979fff | |||
4765849613 | |||
05ed8dca4e | |||
4f600f3129 | |||
4b72d685f3 | |||
bbd7e7906a | |||
f735baf9d7 | |||
ad14381ab4 | |||
7702865409 | |||
2f8c1b453e | |||
883317dd28 | |||
8ed67119b9 | |||
f45e2b4ab9 | |||
abdf4b1ada | |||
228d624d8f | |||
e0c9805ee8 | |||
4eef81fbe9 | |||
301600e720 | |||
4d4e4a4ce7 | |||
ad3ac2cdee | |||
b10abd07ee | |||
e65b416215 | |||
24df69d57f | |||
183c306166 | |||
1dfdcfcb7e | |||
212218396a | |||
b78b8425fd | |||
12832a3a96 | |||
621b7cfb2a | |||
a67d9e60da | |||
d71008bd10 | |||
a154d0a088 | |||
c5262458d5 | |||
cb635d800a | |||
0ed82d4ef7 | |||
bdf9373e0d | |||
3f61206289 | |||
e19a27bf62 | |||
a1831c38ed | |||
c4b8c6385f | |||
f393751771 | |||
94ce042401 | |||
49b8024c43 | |||
8b39443197 | |||
dcce66ee9f | |||
563b1bb8b7 | |||
b4d9a6a09d | |||
51fd9ed423 | |||
23d73ae5ae | |||
8986b008dd | |||
30f1e6ad3f | |||
02cc284422 | |||
e6c0304af1 | |||
16fe4d305e | |||
68e9648854 | |||
0417a7e97d | |||
6653cc9cb1 | |||
a37bbc50fe | |||
5b01b4cbd8 | |||
d3a0319863 | |||
fdd19bc316 | |||
1152555663 | |||
516336963e | |||
99281e2690 | |||
501d2478a5 | |||
08b6eb78c5 | |||
d096a5efeb | |||
9f24bb0a98 | |||
173d8f740e | |||
16428f3828 | |||
1247f760f2 | |||
11475316fd | |||
a09c2e38a3 | |||
1c49fbb090 | |||
b5909044f6 | |||
62a88dadba | |||
e0bb7d74f4 | |||
d09a1a0a95 | |||
d38108e527 | |||
c9675d111a | |||
8f9c657fa0 | |||
c35203ebfb | |||
1069bf5979 | |||
cac913831c | |||
03e781a0ac | |||
a5a3d4bc78 | |||
bc70cc3a26 | |||
e024774323 | |||
bdcccb7732 | |||
5ff2e86060 | |||
70e193b0fd | |||
c3a9d3c342 | |||
d3c807975f | |||
1c5250ea7f | |||
7cb3b3f8de | |||
7cd35f24b8 | |||
28af3c2642 | |||
2bd8e6c166 | |||
ccdc7d22e9 | |||
3831896a78 | |||
9847729f3c | |||
0eff9e1401 | |||
4323a837ef | |||
649cb0aed9 | |||
8cf6e0cbd6 | |||
753290b228 | |||
d28f293485 | |||
da010a03d7 | |||
72b71f3fcd | |||
e4868671ae | |||
61897cbd41 | |||
9e8d3e598f | |||
252e924f92 | |||
fe2ba8621b | |||
b8bdbf4da6 | |||
5340b8ef24 | |||
807189a492 | |||
593f5b6c65 | |||
b029f1fa26 | |||
14546247e4 | |||
a74e8f68f7 | |||
a1936cb884 | |||
a36b715eab | |||
17c20748bc | |||
d5f8a1b4e7 | |||
70ce8c1653 | |||
5203a0d621 | |||
59ad15b54e | |||
afac5be3c3 | |||
688dd15fe9 | |||
98752e1cdb | |||
d59f419370 | |||
9ba3fb9279 | |||
50111bcea7 | |||
ab06c33107 | |||
10209b75df |
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
set (CALIBRATE OFF)
|
||||
|
||||
option (USE_HDF5 "HDF5 File format" OFF)
|
||||
@ -7,7 +7,12 @@ option (USE_TEXTCLIENT "Text Client" OFF)
|
||||
option (USE_RECEIVER "Receiver" OFF)
|
||||
option (USE_GUI "GUI" OFF)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-misleading-indentation")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++98 -Wno-misleading-indentation")
|
||||
else ()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
|
||||
endif ()
|
||||
|
||||
find_package(Qt4)
|
||||
find_package(Qwt 6)
|
||||
@ -31,8 +36,10 @@ endif (USE_TEXTCLIENT)
|
||||
|
||||
if (USE_RECEIVER)
|
||||
add_subdirectory(slsReceiverSoftware)
|
||||
add_subdirectory(manual/manual-api)
|
||||
endif (USE_RECEIVER)
|
||||
|
||||
|
||||
if (USE_GUI)
|
||||
if (QT4_FOUND AND QWT_FOUND)
|
||||
add_subdirectory(slsDetectorGui)
|
||||
|
2
Makefile
2
Makefile
@ -23,7 +23,7 @@ CALIBDIR = $(WD)/slsDetectorCalibration
|
||||
TABSPACE := "\t"
|
||||
|
||||
|
||||
INCLUDES=-I. -I$(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/slsDetectorUtils -I$(LIBRARYDIR)/slsDetectorCommand -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYRXRDIR)/include -I$(LIBRARYDIR)/threadFiles -I$(ASM)
|
||||
INCLUDES=-I. -I$(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/slsDetectorUtils -I$(LIBRARYDIR)/slsDetectorCommand -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYRXRDIR)/include -I$(LIBRARYDIR)/threadFiles -I$(LIBRARYDIR)/sharedMemory -I$(ASM)
|
||||
|
||||
INCLUDESRXR += -I. -I$(LIBRARYRXRDIR)/include -I$(CALIBDIR) -I$(ASM)
|
||||
#LIBFLAGRXR +=
|
||||
|
112
RELEASE.txt
112
RELEASE.txt
@ -1,113 +1 @@
|
||||
SLS Detector Package 3.1.1 released on 2018-03-12
|
||||
=================================================
|
||||
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
This document describes the differences between 3.1.0 and 3.1.0 releases.
|
||||
|
||||
The conda package of the binaries can be downloaded from
|
||||
|
||||
https://github.com/slsdetectorgroup/sls_detector_software.git
|
||||
|
||||
The Python interface to the software package (including the package) is at
|
||||
|
||||
https://github.com/slsdetectorgroup/sls_detector.git
|
||||
|
||||
Manual (both HTML and pdf versions) are provided in
|
||||
manual/docs/
|
||||
|
||||
Documentation from Source Code can be found for the Command Line and for the API in
|
||||
html:
|
||||
manual/docs/html/slsDetectorClientDocs/index.html
|
||||
manual/docs/html/slsDetectorUsersDocs/index.html
|
||||
pdf:
|
||||
manual/docs/pdf/slsDetectorClientDocs.pdf
|
||||
manual/docs/pdf/slsDetectorUsersDocs.pdf
|
||||
|
||||
Example including binaries for detector and receiver user classes can be found in
|
||||
|
||||
manual/manual-api
|
||||
|
||||
User documentation can also be accessed directly at this location:
|
||||
|
||||
https://www.psi.ch/detectors/users-support
|
||||
|
||||
If you have any software related questions or comments, please send them to:
|
||||
|
||||
dhanya.thattil@psi.ch
|
||||
anna.bergamaschi@psi.ch
|
||||
|
||||
If you have any python related questions or comments, please send them to:
|
||||
|
||||
erik.frojdh@psi.ch
|
||||
|
||||
|
||||
CONTENTS
|
||||
|
||||
- Firmware Requirements
|
||||
- Changes in User Interface
|
||||
- New Features
|
||||
- Resolved Issues
|
||||
- Known Issues
|
||||
|
||||
|
||||
|
||||
Firmware Requirements
|
||||
=====================
|
||||
|
||||
Please refer to the link below for more details on the firmware versions.
|
||||
https://www.psi.ch/detectors/firmware.
|
||||
|
||||
Gotthard
|
||||
========
|
||||
Minimum compatible version : 11.01.2013
|
||||
Latest version : 08.02.2018 (50um and 25um Master)
|
||||
09.02.2018 (25 um Slave)
|
||||
|
||||
-Can not be upgraded remotely.
|
||||
|
||||
|
||||
Eiger
|
||||
=====
|
||||
Minimum compatible version : 16
|
||||
Latest version : 20
|
||||
|
||||
-Can be upgraded remotely via bit files.
|
||||
|
||||
|
||||
Jungfrau
|
||||
========
|
||||
Minimum compatible version : 13.11.2017
|
||||
Latest version : 13.11.2017
|
||||
|
||||
-Can be upgraded remotely via sls_detector_put programfpga <pof>.
|
||||
|
||||
|
||||
|
||||
Changes in User Interface
|
||||
=========================
|
||||
|
||||
|
||||
|
||||
|
||||
New Features
|
||||
============
|
||||
|
||||
|
||||
|
||||
Resolved Issues
|
||||
===============
|
||||
|
||||
|
||||
Known Issues
|
||||
============
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
for i in seq `ipcs -m | cut -d ' ' -f1`; do ipcrm -M $i; done;
|
||||
rm /dev/shm/slsDetectorPackage*;
|
||||
|
@ -3,12 +3,8 @@ hostname bchip007
|
||||
#0:port 1952
|
||||
#0:stopport 1953
|
||||
#0:rx_tcpport 1956 must also have this in receiver config file
|
||||
0:settingsdir /home/l_maliakal_d/mySoft/newMythenSoftware/settingsdir/gotthard
|
||||
0:angdir 1.000000
|
||||
0:moveflag 0.000000
|
||||
0:lock 0
|
||||
0:caldir /home/l_maliakal_d/mySoft/newMythenSoftware/settingsdir/gotthard
|
||||
0:ffdir /home/l_maliakal_d
|
||||
0:extsig:0 off
|
||||
#0:detectorip 129.129.202.9
|
||||
0:detectormac 00:aa:bb:cc:dd:ee
|
||||
@ -20,7 +16,6 @@ hostname bchip007
|
||||
master -1
|
||||
sync none
|
||||
outdir /bigRAID/datadir_gotthard/rec_test_data
|
||||
ffdir /home/l_maliakal_d
|
||||
headerbefore none
|
||||
headerafter none
|
||||
headerbeforepar none
|
||||
@ -29,4 +24,4 @@ badchannels none
|
||||
angconv none
|
||||
globaloff 0.000000
|
||||
binsize 0.001000
|
||||
threaded 1
|
||||
|
||||
|
@ -1,18 +1,15 @@
|
||||
hostname bchip038+
|
||||
|
||||
settingsdir /home/mySoft/slsDetectorsPackage/settingsdir/jungfrau
|
||||
caldir /home/mySoft/slsDetectorsPackage/settingsdir/jungfrau
|
||||
lock 0
|
||||
|
||||
0:rx_udpport 50004
|
||||
0:rx_udpip 10.1.1.100
|
||||
0:detectorip 10.1.1.10
|
||||
|
||||
rx_hostname pcmoench01
|
||||
|
||||
powerchip 1
|
||||
timing auto
|
||||
|
||||
#extsig:0 trigger_in_rising_edge
|
||||
#timing trigger
|
||||
|
||||
outdir /external_pool/jungfrau_data/softwaretest
|
||||
threaded 1
|
||||
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
detsizechan 1024 1024
|
||||
hostname bchip048+bchip052+
|
||||
|
||||
settingsdir /home/mySoft/slsDetectorsPackage/settingsdir/jungfrau
|
||||
caldir /home/mySoft/slsDetectorsPackage/settingsdir/jungfrau
|
||||
lock 0
|
||||
|
||||
|
||||
0:rx_udpport 50004
|
||||
0:rx_udpip 10.1.1.100
|
||||
0:rx_udpmac F4:52:14:2F:32:00
|
||||
@ -22,9 +17,9 @@ lock 0
|
||||
rx_hostname pcmoench01
|
||||
|
||||
powerchip 1
|
||||
extsig:0 trigger_in_rising_edge
|
||||
timing auto
|
||||
#extsig:0 trigger_in_rising_edge
|
||||
#timing trigger
|
||||
|
||||
outdir /external_pool/jungfrau_data/softwaretest
|
||||
threaded 1
|
||||
|
||||
|
||||
|
@ -8,13 +8,11 @@ hostname bchip007+bchip009+
|
||||
#0:port 1952
|
||||
#0:stopport 1953
|
||||
#0:rx_tcpport 1956
|
||||
0:settingsdir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
||||
0:angdir 1.000000
|
||||
0:moveflag 0.000000
|
||||
0:lock 0
|
||||
0:caldir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
||||
0:ffdir /home/l_msdetect
|
||||
0:extsig:0 off
|
||||
|
||||
0:detectorip 10.1.1.2
|
||||
#0:detectormac 00:aa:bb:cc:dd:ee
|
||||
#0:rx_udpport 50001
|
||||
@ -28,13 +26,11 @@ hostname bchip007+bchip009+
|
||||
#1:port 1952
|
||||
#1:stopport 1953
|
||||
1:rx_tcpport 1957
|
||||
1:settingsdir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
||||
1:angdir 1.000000
|
||||
1:moveflag 0.000000
|
||||
1:lock 0
|
||||
1:caldir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
||||
1:ffdir /home/l_msdetect
|
||||
1:extsig:0 off
|
||||
|
||||
1:detectorip 10.1.2.2
|
||||
#1:detectormac 00:aa:bb:cc:dd:ee
|
||||
1:rx_udpport 50004
|
||||
@ -56,4 +52,4 @@ badchannels none
|
||||
angconv none
|
||||
globaloff 0.000000
|
||||
binsize 0.001000
|
||||
threaded 1
|
||||
|
||||
|
17
manual/manual-api/CMakeLists.txt
Normal file
17
manual/manual-api/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
add_executable(slsMultiReceiver
|
||||
mainReceiver.cpp
|
||||
)
|
||||
set_target_properties(slsMultiReceiver PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
target_link_libraries(slsMultiReceiver
|
||||
slsReceiverShared
|
||||
pthread
|
||||
zmq
|
||||
rt
|
||||
)
|
||||
|
||||
install(TARGETS slsMultiReceiver
|
||||
RUNTIME DESTINATION bin)
|
||||
|
@ -54,7 +54,7 @@ void sigInterruptHandler(int p){
|
||||
*/
|
||||
void printHelp() {
|
||||
cprintf(RESET, "Usage:\n"
|
||||
"./detReceiver [start_tcp_port] [num_receivers] [1 for call back, 0 for none]\n\n");
|
||||
"./slsMultiReceiver(detReceiver) [start_tcp_port] [num_receivers] [1 for call back, 0 for none]\n\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@ -86,42 +86,77 @@ void AcquisitionFinished(uint64_t frames, void*p){
|
||||
cprintf(BLUE, "#### AcquisitionFinished: frames:%llu ####\n",frames);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Receiver Data Call back
|
||||
* Prints in different colors(for each receiver process) the different headers for each image call back.
|
||||
* @param frameNumber frame number
|
||||
* @param expLength real time exposure length (in 100ns) or sub frame number (Eiger 32 bit mode only)
|
||||
* @param packetNumber number of packets caught for this frame
|
||||
* @param bunchId bunch id from beamline
|
||||
* @param timestamp time stamp in 10MHz clock (not implemented for most)
|
||||
* @param modId module id (not implemented for most)
|
||||
* @param xCoord x coordinates (detector id in 1D)
|
||||
* @param yCoord y coordinates (not implemented)
|
||||
* @param zCoord z coordinates (not implemented)
|
||||
* @param debug debug values if any
|
||||
* @param roundRNumber (not implemented)
|
||||
* @param detType detector type see :: detectorType
|
||||
* @param version version of standard header (structure format)
|
||||
* @param metadata sls_receiver_header metadata
|
||||
* @param datapointer pointer to data
|
||||
* @param datasize data size in bytes
|
||||
* @param datasize data size in bytes.
|
||||
* @param p pointer to object
|
||||
*/
|
||||
void GetData(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp,
|
||||
uint16_t modId, uint16_t xCoord, uint16_t yCoord, uint16_t zCoord, uint32_t debug, uint16_t roundRNumber, uint8_t detType, uint8_t version,
|
||||
char* datapointer, uint32_t datasize, void* p){
|
||||
void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
|
||||
slsReceiverDefs::sls_receiver_header* header = (slsReceiverDefs::sls_receiver_header*)metadata;
|
||||
slsReceiverDefs::sls_detector_header detectorHeader = header->detHeader;
|
||||
|
||||
PRINT_IN_COLOR (modId?modId:xCoord,
|
||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.xCoord,
|
||||
"#### %d GetData: ####\n"
|
||||
"frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu\t\ttimestamp: %llu\t\tmodId: %u\t\t"
|
||||
"xCoord: %u\t\tyCoord: %u\t\tzCoord: %u\t\tdebug: %u\t\troundRNumber: %u\t\tdetType: %u\t\t"
|
||||
"version: %u\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||
xCoord, frameNumber, expLength, packetNumber, bunchId, timestamp, modId,
|
||||
xCoord, yCoord, zCoord, debug, roundRNumber, detType, version,
|
||||
((uint8_t)(*((uint8_t*)(datapointer)))), datasize);
|
||||
"frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu"
|
||||
"\t\ttimestamp: %llu\t\tmodId: %u\t\t"
|
||||
"xCoord: %u\t\tyCoord: %u\t\tzCoord: %u\t\tdebug: %u"
|
||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
||||
//"\t\tpacketsMask:%s"
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||
detectorHeader.xCoord, detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber, detectorHeader.bunchId,
|
||||
detectorHeader.timestamp, detectorHeader.modId,
|
||||
detectorHeader.xCoord, detectorHeader.yCoord, detectorHeader.zCoord,
|
||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||
detectorHeader.detType, detectorHeader.version,
|
||||
//header->packetsMask.to_string().c_str(),
|
||||
((uint8_t)(*((uint8_t*)(datapointer)))), datasize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get Receiver Data Call back (modified)
|
||||
* Prints in different colors(for each receiver process) the different headers for each image call back.
|
||||
* @param metadata sls_receiver_header metadata
|
||||
* @param datapointer pointer to data
|
||||
* @param datasize data size in bytes.
|
||||
* @param revDatasize new data size in bytes after the callback.
|
||||
* This will be the size written/streamed. (only smaller value is allowed).
|
||||
* @param p pointer to object
|
||||
*/
|
||||
void GetData(char* metadata, char* datapointer, uint32_t &revDatasize, void* p){
|
||||
slsReceiverDefs::sls_receiver_header* header = (slsReceiverDefs::sls_receiver_header*)metadata;
|
||||
slsReceiverDefs::sls_detector_header detectorHeader = header->detHeader;
|
||||
|
||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.xCoord,
|
||||
"#### %d GetData: ####\n"
|
||||
"frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu"
|
||||
"\t\ttimestamp: %llu\t\tmodId: %u\t\t"
|
||||
"xCoord: %u\t\tyCoord: %u\t\tzCoord: %u\t\tdebug: %u"
|
||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
||||
//"\t\tpacketsMask:%s"
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||
detectorHeader.xCoord, detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber, detectorHeader.bunchId,
|
||||
detectorHeader.timestamp, detectorHeader.modId,
|
||||
detectorHeader.xCoord, detectorHeader.yCoord, detectorHeader.zCoord,
|
||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||
detectorHeader.detType, detectorHeader.version,
|
||||
//header->packetsMask.to_string().c_str(),
|
||||
((uint8_t)(*((uint8_t*)(datapointer)))), revDatasize);
|
||||
|
||||
// if data is modified, eg ROI and size is reduced
|
||||
revDatasize = 26000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Example of main program using the slsReceiverUsers class
|
||||
*
|
||||
@ -209,7 +244,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
/* - Call back for raw data */
|
||||
cprintf(BLUE, "Registering GetData() \n");
|
||||
receiver->registerCallBackRawDataReady(GetData,NULL);
|
||||
if (withCallback == 1) receiver->registerCallBackRawDataReady(GetData,NULL);
|
||||
else if (withCallback == 2) receiver->registerCallBackRawDataModifyReady(GetData,NULL);
|
||||
}
|
||||
|
||||
|
||||
|
BIN
manual/manual-client/Boards.png
Normal file
BIN
manual/manual-client/Boards.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 432 KiB |
BIN
manual/manual-client/Eiger_short.pdf
Normal file
BIN
manual/manual-client/Eiger_short.pdf
Normal file
Binary file not shown.
@ -18,17 +18,28 @@
|
||||
\tableofcontents
|
||||
|
||||
\section{Usage}
|
||||
\subsection{Short description}
|
||||
Figure ~\ref{boards} show the readout board basic components on an Eiger half module. An half module can read up to 4 readout chips.
|
||||
\begin{figure}[t]
|
||||
\begin{center}
|
||||
\includegraphics[width=1\textwidth]{Boards}
|
||||
\end{center}
|
||||
\caption{Picture with most relevant components of the EIGER readout system. The readout system starts with the Front End Boards (FEB) which performs data descrambling (also converts the packets from 12 $\to$ 16 bits) and rate correction. The BackEndBoard (BEB) has 2x2GB DDR2 memories and can perform data buffering (storing images on board) and data summation (16 bit $\to$ 32 bits). The controls to the detector are passed through the 1Gb, while in most installations, the data are sent out through the 10GB ethernet connection.}
|
||||
\label{boards}
|
||||
\end{figure}
|
||||
|
||||
|
||||
|
||||
\subsection{Mandatory setup - Hardware}
|
||||
An EIGER single module (500~kpixels) needs:
|
||||
\begin{itemize}
|
||||
\item A chilled (water+alcohol) at approximately 21~$^{\circ}$C, which needs to dissipate 85~W. For the 9M, a special cooling liquid is required: 2/3 deionized water and 1/3 ESA Type 48.
|
||||
\item A chilled (water+alcohol) at 21~$^{\circ}$C for a single module (500k pixels), which needs to dissipate 85~W (every module, i.e. for two half boards). For the 9M, 1.5M, a special cooling liquid is required: 2/3 deionized water and 1/3 ESA Type 48. This is important as the high temperature generated by the boards accelerate the corrosion due to Cu/Al reaction and the blockage of the small channels where the liquid flows, in particular near the face of the detector and if it is a parallel flow and not a single loop. The 9M and 1.5M run at 19~$^{\circ}$C.
|
||||
\item A power supply (12~V, 8~A). For the 9~M, a special cpu is give to remotely switch on and off the detector: see section~\ref{bchip100}.
|
||||
\item 2$\times$1~Gb/s Ethernet connectors to control the detector and, optionally, receive data at low rate. A DHCP server that gives IPs to the 1~Gb/s connectors of the detector is needed. Note that flow control has to be enabled on the switch you are using.
|
||||
\item 2$\times$10~Gb/s transceivers to optionally, receive data at high rate.
|
||||
\item 2$\times$1~Gb/s Ethernet connectors to control the detector and, optionally, receive data at low rate. A DHCP server that gives IPs to the 1~Gb/s connectors of the detector is needed. Note that flow control has to be enabled on the switch you are using, if you plan to read the data out from there. If not, you need to implement delays in the sending out of the data.
|
||||
\item 2$\times$10~Gb/s transceivers to optionally, receive data at high rate. The 10Gb/s transceiver need to match the wavelength (long/short range) of the fibers chosen by the beamline infrastructure.
|
||||
\end{itemize}
|
||||
The equipment scales linearly with the number of modules.
|
||||
Figure~\ref{fig:1} shows the relationship between the \textbf{Client} (which sits on a beamline control PC), the \textbf{Receiver} (which can run in multiple instances on one or more PCs which receive data from the detector. The receiver(s) does not necessary have to be running on the same PC as the client.) It is important that the receiver is closely connected to the detector (they have to be on the same network). Note that if you implement the 1Gb/s readout only: client, receiver and detector have to be all three in the same network. If you implement the 10Gb/s readout, then client, the 1~GbE of the detector and the receiver have to stay on the 1GbE. But the receiver data receiving device and the 10GbE detector can be on their private network, minimizing the missing packets.
|
||||
Figure~\ref{fig:1} shows the relationship between the \textbf{Client} (which sits on a beamline control PC), the \textbf{Receiver} (which can run in multiple instances on one or more PCs which receive data from the detector. The receiver(s) does not necessary have to be running on the same PC as the client.) The username under which the receiver runs is the owner of the data files, if using our implementation. It is important that the receiver is closely connected to the detector (they have to be on the same network). Note that if you implement the 1Gb/s readout only: client, receiver and detector have to be all three in the same network. If you implement the 10Gb/s readout, then client, the 1~GbE of the detector and the receiver have to stay on the 1GbE. But the receiver data receiving device and the 10GbE detector can be on their private network, minimizing the missing packets.
|
||||
|
||||
\begin{figure}[t]
|
||||
\begin{center}
|
||||
@ -41,7 +52,7 @@ Figure~\ref{fig:1} shows the relationship between the \textbf{Client} (which sit
|
||||
The Client talks to control over 1~Gb Ethernet connection using TCP/IP to the detector and to the receiver. The detector sends data in UDP packets to the receiver. This data sending can be done over 1~Gb/s or 10~Gb/s.
|
||||
|
||||
\begin{itemize}
|
||||
\item \textbf{Switch on the detector only after having started the chiller: the 500k single module and the 1.5M at cSAXS have a hardware temperature sensor, which will power off the boards if the temperature is too high. Note that the detector will be power on again as soon as the temperature has been lowered. The 9M will not boot up without the correct waterflow and temperature has it has an integrated flowmeter.}
|
||||
\item \textbf{Switch on the detector only after having started the chiller: the 500k single module and the 1.5M at cSAXS/OMNY have a hardware temperature sensor, which will power off the boards if the temperature is too high. Note that the detector will be power on again as soon as the temperature has been lowered. The 9M will not boot up without the correct waterflow and temperature has it has an integrated flowmeter.}
|
||||
\item \textbf{Switch on the detector only after having connected all the cables and network. EIGER is unable to get IP address after it has been switched on without a proper network set up. In that case switch off and on the detector again.}
|
||||
\end{itemize}
|
||||
|
||||
@ -73,28 +84,22 @@ You can also Check temperatures and water flow in a browser (from the same subne
|
||||
|
||||
\subsection{Mandatory setup - Receiver}
|
||||
|
||||
The receiver is a process run on a PC closely connected to the detector. Open one receiver for every half module board (remember, a module has two receivers!!!) . Go to {\tt{slsDetectorsPackage/bin/}}, \textbf{slsReceiver} should be started on the machine expected to receive the data from the detector.
|
||||
The receiver is a process run on a PC closely connected to the detector. Open one receiver for every half module board (remember, a module has two receivers!!!) . Go to {\tt{slsDetectorsPackage/build/bin/}}, \textbf{slsReceiver} should be started on the machine expected to receive the data from the detector.
|
||||
|
||||
\begin{itemize}
|
||||
\item {\tt{./slsReceiver --rx\_tcpport xxxx}}
|
||||
\item {\tt{./slsReceiver --rx\_tcpport yyyy}}
|
||||
\end{itemize}
|
||||
where xxxx, yyyy are the tcp port numbers. Use 1955 and 1956 for example. Note that in older version of the software {\tt{--mode 1}} was used only for the ``bottom'' half module. Now, the receiver for the bottom is open without arguments anymore, but still in the configuration file one needs to write {\tt{n:flippeddatax 1}}, where {\tt{n}} indicated the half module number, 1 if it is a module.
|
||||
where xxxx, yyyy are the tcp port numbers. Use 1955 and 1956 for example. The receiver for the bottom is open without arguments but still in the configuration file one needs to write {\tt{n:flippeddatax 1}}, where {\tt{2n+1}} indicated the half module number, 1 if it is a module.
|
||||
\\ Open as many receiver as half module boards. A single module has two half module boards.
|
||||
|
||||
From the software version 3.0.1, one can decide weather start a zmq callback from the receiver to the client (for example to visualize data in the slsDetectorGui or another gui). If the zmq steam is not required (cased of the command line for example, one can switch off the streaming with {\tt{./sls\_detector\_put rx\_datastream 0}}, enable it with {\tt{./sls\_detector\_put rx\_datastream 1}}. In the case of inizialising the stream to use the slsDetectorGui, nothing needs to be taken care of by the user. If instead you want to stream the streaming on different channels, the zmq port of the client can be set stealing from the slsDetectorGui stream having {\tt{./sls\_detector\_put n:zmqport 300y}}, where n is each half module independently, matching the receiver stream {\tt{./sls\_detector\_put n:rx\_zmqport 300y}}.
|
||||
|
||||
From the software version 3.0.1, one can decide weather start a zmq callback from the receiver to the client (for example to visualize data in the slsDetectorGui or another gui). If the zmq steam is not required (cased of the command line for example, one can switch off the streaming with {\tt{./sls\_detector\_put rx\_datastream 0}}, enable it with {\tt{./sls\_detector\_put rx\_datastream 1}}. In the case of inizialising the stream to use the slsDetectorGui, nothing needs to be taken care of by the user. If instead you want to stream the streaming on different channels, the zmq port of the client can be set stealing from the slsDetectorGui stream having {\tt{./sls\_detector\_put zmqport 300y}}. Note that if this is done globally (not for every half module n independently, then the client automatically takes into account that for every half module, there are 2 zmq stream. The receiver stream {\tt{./sls\_detector\_put rx\_zmqport 300y}} has to match such that the GUI can work.
|
||||
If one desires to set the zmqport manually, he offset has to be taken into account: {\tt{./sls\_detector\_put 0:rx\_zmqport 300y}}, {\tt{./sls\_detector\_put 1:rx\_zmqport 300y+2}} and so on..
|
||||
|
||||
There is an example code that can be compiled in {\tt{manual/manual-api/mainReceiver.cpp}} and gives the executable {\tt{./detReceiver}}, use it with two or more receivers to open all receivers in one single terminal: {\tt{./detReceiver startTCPPort numReceivers withCallback}}, where startTCPPort assumes the other ports are consecutively increased.
|
||||
|
||||
|
||||
|
||||
|
||||
\subsection{Mandatory setup - Client}
|
||||
|
||||
\underline{In the case of cSAXS, the detector software is installed on:}\\
|
||||
\underline{/sls/X12SA/data/x12saop/EigerPackage/slsDetectorsPackage}
|
||||
|
||||
The command line interface consists in these main functions:
|
||||
\begin{description}
|
||||
\item[sls\_detector\_acquire] to acquire data from the detector
|
||||
@ -166,15 +171,15 @@ Other important settings that are configured in the {\tt{setup.det}} file are:
|
||||
\begin{itemize}
|
||||
\item {\tt{tengiga 0/1}}, which sets whether the detector is enabled to send data through the 1~or the 10~Gb Ethernet.
|
||||
\item {\tt{flags parallel/nonparallel}}, which sets whether the detector is set in parallel acquisition and readout or in sequential mode. This changes the readout time of the chip and affects the frame rate capability (faster is {\tt{parallel}}, with higher noise but needed when the frame rate is $>2$~kHz.
|
||||
\item {\tt{dr 32/16}} sets the detector in autosumming mode (32 bit counter or not autosumming, 12 bit out of the chip). This is strictly connected to what is required for the readout clock of chip. See next point.
|
||||
\item {\tt{dr 32/16/8/4}} sets the detector in autosumming mode (32 bit counter or not autosumming, 12 bit out of the chip). This is strictly connected to what is required for the readout clock of chip. See next point.
|
||||
\item {\tt{clkdivider 0/1/2}}. Changes the readout clock: 200, 100, 50~MHz (also referred to as full, half, quarter speed). Note that autosumming mode ({\tt{dr 32}} only works at {clkdivider 2}=quarter speed). By selecting Refer to readout timing specifications in~section\ref{timing} for how to set the detector.
|
||||
\item {\tt{flags continuous/storeinram}}. Allows to take frame continuously or storing them on memory. Normally {\tt{continuous}} should be used. Enabling the {\tt{stroreinram}} mode allows you to obtain the maximum frame rate, but at the expenses to have to receive the data all at the end of the acquisition. Refer to readout timing specifications in section~\ref{timing} for how to set the detector.
|
||||
\item {\tt{flags continuous/storeinram}}. Allows to take frame continuously or storing them on memory. Users should use the {\tt{continuous}} flags. Enabling the {\tt{stroreinram}} flag makes the data to be sent out all at the end of the acquisition. Refer to readout timing specifications in section~\ref{timing} for how to set the detector. Examples will be given in section~\ref{}.
|
||||
\end{itemize}
|
||||
|
||||
One should notice that, by default, by choosing the option {\tt{dr 32}}, then the software automatically sets the detector to {\tt{clkdivider 2}}. By choosing the option {\tt{dr 16}}, the software automatically sets the detector to {\tt{clkdivider 1}}. One needs to choose {\tt{clkdivider 0}} after setting the {\tt{dr 16}} option to have the fastest frame rate.
|
||||
We would recommend expert users (beamline people) to write their parameters file for the users.
|
||||
|
||||
\section{API versioning}
|
||||
\section{API versioning} \label{api}
|
||||
The eigerDetectorServer running on the boards has a versioning API scheme that will make it crash if used with a wrong firmware.
|
||||
You can also check your versioning by hand with the code:
|
||||
\begin{verbatim}
|
||||
@ -194,12 +199,18 @@ Killing and starting the server on the boards allows you to check the firmware v
|
||||
\section{Setting up the threshold}
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-trimen N xxxx yyyy zzzz
|
||||
sls_detector_put 0-settings standard #[veryhighgain/highgain/lowgain/verylowgain] also possible
|
||||
sls_detector_put 0-threshold energy_in_eV
|
||||
sls_detector_put 0-settings standard
|
||||
sls_detector_put 0-threshold energy_in_eV standard
|
||||
\end{verbatim}
|
||||
The first line requires to specify how many ({\tt{N}}) and at which energies in eV {\{tt{xxxx}}, {\tt{yyyy}}, {\tt{zzzz}} and so on) trimmed files were generated (to allow for an interpolation). This line should normally be included into the {\tt{mydetector.config}} file and should be set for you by one of the detector group.
|
||||
NORMALLY, in this new calibration scheme, only {\tt{settings standard}} will be provided to you, unless specific cases to be discussed.
|
||||
The threshold at 6000 eV , for example would be set as:{\tt{sls\_detector\_put 0-threshold 6000}}.
|
||||
The threshold at 6000 eV , for example would be set as:{\tt{sls\_detector\_put 0-threshold 6000 standard}}.
|
||||
|
||||
For \E, at the moment normally only {\tt{standard}} settings are possible.
|
||||
{\tt{lowgain}}, {\tt{verylowgain}}, {\tt{veryhighgain}} and {\tt{highgain}} are theoretically possible, but we never calibrate like this. They could be implemented later if needed.
|
||||
|
||||
Notice that setting the threshold actually loads the trimbit files (and interpolate them between the closest calibration energies) so it is time consuming.
|
||||
The threshold is expressed in (eV) as the proper threshold setting, i.e. normally is set to 50\% of the beam energy.
|
||||
|
||||
We have added a special command, {\tt{thresholdnotb}}, which allows to scan the threshold energy without reloading the trimbits at every stage. One can either keep the trimbits at a specific value (es.32 if the range of energies to scan is large) or use the trimbits from a specific energy (like a central energy).
|
||||
\begin{verbatim}
|
||||
@ -216,12 +227,7 @@ sls_detector_put 0-period 0[time_is_s]
|
||||
\end{verbatim}
|
||||
In this acquisition 10 consecutive 1~s frames will be acquired. Note that {\tt{period}} defines the sum of the acquisition time and the desired dead time before the next frame. If {\tt{period}} is set to 0, then the next frame will start as soon as the detector is ready to take another acquisition. \\
|
||||
|
||||
For \E, at the moment 5 settings are possible: {\tt{standard}}, {\tt{lowgain}}, {\tt{verylowgain}}, {\tt{veryhighgain}} and {\tt{highgain}}. According to the setting chosen, one can reach different requirements (low noise or high rate). Refer to the settings requirements for your detector.\\
|
||||
Notice that the option {\tt{settings standard/highgain/lowgain/veryhighgain/verylowgain}} actually loads the trimbit files so it is time consuming. Only setting the {\tt{threshold}} does not load trimbit files.
|
||||
|
||||
The threshold is expressed in (eV) as the proper threshold setting, i.e. normally is set to 50\% of the beam energy.
|
||||
|
||||
\underline{At cSAXS, the {\tt{settingsdir}} and {\tt{caldir}} are in}\\\underline{/sls/X12SA/data/x12saop/EigerPackage/calibrations/}\\
|
||||
%\underline{At cSAXS, the {\tt{settingsdir}} and {\tt{caldir}} are in}\\\underline{/sls/X12SA/data/x12saop/EigerPackage/calibrations/}\\
|
||||
|
||||
You need to setup where the files will be written to
|
||||
\begin{verbatim}
|
||||
@ -247,23 +253,28 @@ sls_detector_get receiver
|
||||
\end{verbatim}
|
||||
|
||||
There is a more complex way of performing an acquisition, that is useful for debugging and in case one wants a non blocking behavior:
|
||||
\begin{itemize}
|
||||
|
||||
You can then reset to zero the number of frames caught, then start the receiver and the detector:
|
||||
\begin{enumerate}
|
||||
\item {\tt{sls\_detector\_put 0-resetframescaught 0}}
|
||||
\item {\tt{sls\_detector\_put 0-receiver start}}
|
||||
\item {\tt{sls\_detector\_put 0-status start}}
|
||||
\end{itemize}
|
||||
\end{enumerate}
|
||||
|
||||
You can poll the detector status using:
|
||||
\begin{verbatim}
|
||||
sls_detector_get 0-status
|
||||
\end{verbatim}
|
||||
When the detector is {\tt{idle}}, then you need to stop the receiver doing:
|
||||
\begin{itemize}
|
||||
When the detector is {\tt{idle}}, then the acquisition is done but the receiver could still be receiving data. If you want, you can check if the receiver is finished receiving as many frames as you were expecting (this is optional but required for many many frames acquisition or when using some delays to send data at very high frame rate.
|
||||
\begin{enumerate}
|
||||
\setcounter{enumi}{3}
|
||||
\item {\tt{sls\_detector\_get framescaught}}
|
||||
\end{enumerate}
|
||||
Then you can stop the receiver as well now:
|
||||
\begin{enumerate}
|
||||
\setcounter{enumi}{4}
|
||||
\item {\tt{sls\_detector\_put 0-receiver stop}}
|
||||
\end{itemize}
|
||||
You can then reset to zero the number of frames caught, if you desire:
|
||||
\begin{itemize}
|
||||
\item {\tt{sls\_detector\_put 0-resetframescaught 0}}
|
||||
\end{itemize}
|
||||
\end{enumerate}
|
||||
|
||||
The detector will not accept other commands while acquiring. If an acquisition wishes to be properly aborted, then:
|
||||
\begin{itemize}
|
||||
@ -275,7 +286,7 @@ this same command can be used after a non proper abortion of the acquisition to
|
||||
IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the speed at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} and the dead time between frames through {\tt{flags parallel}}, i.e. acquire and read at the same time or acquire and then read out.
|
||||
The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT.
|
||||
|
||||
In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from the boards (independent on how the chip is set), the continuous frame rates are listed in table~\ref{tcont}:
|
||||
In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from the boards (independent on how the chip is set), the continuous frame rates are listed in table~\ref{tcont}.
|
||||
\begin{table}
|
||||
\begin{tabular}{|c|c|c|c|}
|
||||
\hline
|
||||
@ -294,10 +305,9 @@ GbE & dynamic range & continuos maximum frame rate(Hz) & minimum period ($\mu$s)
|
||||
10 & 4 & \textbf{10240} & 98\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\caption{Frame rate limits for the CONTINUOS streaming out of images.}
|
||||
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s.}
|
||||
\label{tcont}\end{table}
|
||||
Note that in the {\tt{continuous}} flag mode, some buffering is still done on the memories, so a higher frame rate than the proper real continuous one can be achieved. Still, this extra buffering is possible till the memories are not saturated.
|
||||
The number of images that can be stored on memories are listed in table~\ref{timgs}:
|
||||
Note that in the {\tt{continuous}} flag mode, some buffering is still done on the memories, so a higher frame rate than the proper real continuous one can be achieved. Still, this extra buffering is possible till the memories are not saturated. The number of images that can be stored on the DDR2 on board memories are listed in table~\ref{timgs}.
|
||||
\begin{table}
|
||||
\begin{tabular}{|c|c|}
|
||||
\hline
|
||||
@ -314,72 +324,184 @@ dynamic range & images\\
|
||||
\label{timgs}
|
||||
\end{table}
|
||||
|
||||
The maximum frame rate achievable with 10~GbE, {\tt{dr 16}}, {\tt{flags continuous}}, {\tt{flags parallel}},{\tt{clkdivider 0}}, \textbf{6.1~kHz}. This is currently limited by the connection between the Front End Board and the Backend board. We expect the 32 bit mode limit to be \textbf{2~kHz} ({\tt{clkdivider 2}}).
|
||||
The maximum frame rate achievable with 10~GbE, {\tt{dr 16}}, {\tt{flags continuous}}, {\tt{flags parallel}},{\tt{clkdivider 0}}, \textbf{6.1~kHz}. This is currently limited by the connection between the Front End Board and the Backend board. We expect the 32 bit mode limit, internally, to be \textbf{2~kHz} ({\tt{clkdivider 2}}).
|
||||
In dynamic range {\tt{dr 8}} the frame rate is \textbf{11~kHz} and for{\tt{dr 4}} is \textbf{22~kHz}. For 4 and 8 bit mode the frame rate are directly limited by the speed of the detector chip and not by the readout boards.
|
||||
|
||||
In table~\ref{tframes} is a list of all the readout times in the different configurations:
|
||||
\subsection{Minimum time between frames and Maximum frame rate}
|
||||
|
||||
We need to leave enough time between an exposure and the following. This time is a combination of the time required by the chip, by the readout boards and eventually extra time to reduce some appearance of cross talk noise between the digital and analog parts of the chip.
|
||||
\textbf{It is essential to set the {\tt{period}} of the detector, defined as the {\tt{exptime}} plus an extra time, that needs to be at least the chip/board readout time. If this is set wrong (it is $<$ {\tt{exptime}} plus chip/board readout time), then the detector takes the minimum time it can, but you are in a not controlled frame rate situation.}
|
||||
|
||||
The expected time difference between frames given by the pure chip readout time is in Table~\ref{tchipro}.
|
||||
\begin{tiny}
|
||||
\begin{table}
|
||||
\begin{flushleft}
|
||||
\begin{tabular}{|c|c|c|c|c|c|c|c|}
|
||||
\begin{tabular}{|c|c|c|c|}
|
||||
\hline
|
||||
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{readout t($\mu$s)} & \tiny{max frame rate (kHz)} & \tiny{max exptime ($\mu$s)} & \tiny{min period ($\mu$s)} & \tiny{max imgs (nominal/our network)}\\
|
||||
\tiny{dr} & \tiny{clkdivider} & \tiny{expected chip readout t($\mu$s)} & \tiny{measured chip readout t($\mu$s)}\\
|
||||
\hline
|
||||
4 & 0 & parallel & 3.4 & 22 & 40 & 44 & 30k/50k\\
|
||||
\hline
|
||||
4 & 0 & nonparallel & 44 & 21 & 3 & 49 & 30k/50k\\
|
||||
\hline
|
||||
4 & 1 & parallel & 6 & 10.5 & 85 & 92 & 30k/100k\\
|
||||
\hline
|
||||
4 & 1 & nonparallel & 88.7 & 10.5 & 3 & 93 & 30k/100k\\
|
||||
\hline
|
||||
4 & 2 & parallel & 11.2 & 5.4 & 185 & 197 & infinite\\
|
||||
\hline
|
||||
4 & 2 & nonparallel & 176.5 & 5.4 & 3 & 180 & infinite\\
|
||||
4 & 0 & 41 & 40\\
|
||||
4 & 1 & 82 & 84\\
|
||||
4 & 2 & 123 & 172\\
|
||||
\hline
|
||||
\hline
|
||||
8 & 0 & parallel & 3.4 & 11.1 & 85 & 89 & 15k/24k\\
|
||||
\hline
|
||||
8 & 0 & nonparallel & 85.7 & 11.1 & 3 & 91 & 15k/24k\\
|
||||
\hline
|
||||
8 & 1 & parallel & 6.1 & 5.7 & 174 & 181 & 15k/52k\\
|
||||
\hline
|
||||
8 & 1 & nonparallel & 170.5 & 5.7 & 3 & 175 & 15k/52k\\
|
||||
\hline
|
||||
8 & 2 & parallel & 11.2 & 2.9 & 330 & 342 & infinite\\
|
||||
\hline
|
||||
8 & 2 & nonparallel & 340.3 & 2.9 & 3 & 344 & infinite\\
|
||||
8 & 0 & 82 & 82\\
|
||||
8 & 1 & 164 & 167\\
|
||||
8 & 2 & 328 & 336\\
|
||||
\hline
|
||||
\hline
|
||||
16 & 0 & parallel & 3.4 & 6 & 164 & 168 & 8k/12k\\
|
||||
\hline
|
||||
16 & 0 & nonparallel & 126 & 3.4& 164 & 295 & 8k/23k\\
|
||||
\hline
|
||||
16 & 1 & parallel & 6.1 & 2.9& 339 & 346 & 8k/28k\\
|
||||
\hline
|
||||
16 & 1 & nonparallel & 255 & 1.7& 339 & 592 & infinite\\
|
||||
\hline
|
||||
16 & 2 & parallel & 11 & 1.5& 66 & 78 & infinite \\
|
||||
\hline
|
||||
16 & 2 & nonparallel & 504 & 0.85 & 7 & 512 & infinite\\
|
||||
\hline
|
||||
\hline
|
||||
32 & 2 & parallel & 11 & 2& & &\\
|
||||
\hline
|
||||
32 & 2 & nonparallel & 504 & $<2$& & &\\
|
||||
12 & 0 & 123 &122\\
|
||||
12 & 1 & 246 & 251\\
|
||||
12 & 2 & 491 & 500\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\caption{Readout settings. The {\tiny{min exptime}} possible is 5$-$10~$\mu$s. This is due to the time to pass the pixel enable signal in the whole chip.}
|
||||
\caption{Readout time required from the chip to readout the pixels. The numbers are obtained using equation~\ref{dtnonparallel}.}
|
||||
\label{tchipro}
|
||||
\end{flushleft}
|
||||
\end{table}
|
||||
\end{tiny}
|
||||
|
||||
The {\tt{period}} is s is defined as:
|
||||
\begin{equation} \label{period}
|
||||
\textrm{period} = \textrm{exptime} + \textrm{minimum time between frames}
|
||||
\end{equation}
|
||||
where the 'minimum time between frames' and the minimum period will be discussed in Table~\ref{tframes}.
|
||||
\begin{tiny}
|
||||
\begin{table}
|
||||
\begin{flushleft}
|
||||
\begin{tabular}{|c|c|c|c|c|c|c|}
|
||||
\hline
|
||||
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{t between frames($\mu$s) } & \tiny{max frame rate (kHz)} & \tiny{min period ($\mu$s)} & \tiny{max imgs (nominal/our network)}\\
|
||||
\hline
|
||||
4 & 0 & parallel & 3.4 & 22 & 44 & 30k/50k\\
|
||||
\hline
|
||||
4 & 1 & parallel & 6 & 10.5 & 92 & 30k/100k\\
|
||||
\hline
|
||||
4 & 2 & parallel & 11.2 & 5.4 & 197 & infinite\\
|
||||
\hline
|
||||
\hline
|
||||
8 & 0 & parallel & 3.4 & 11.1 & 89 & 15k/24k\\
|
||||
\hline
|
||||
8 & 1 & parallel & 6.1 & 5.7 & 181 & 15k/52k\\
|
||||
\hline
|
||||
8 & 2 & parallel & 11.2 & 2.9 & 342 & infinite\\
|
||||
\hline
|
||||
\hline
|
||||
16 & 0 & parallel & 3.4 & 6.1 & (126+38)* =164 & 8k/12k\\
|
||||
\hline
|
||||
16 & 0 & nonparallel & 126 & 5.6 & (126+52)*= 179 & 8k/23k\\
|
||||
\hline
|
||||
16 & 1 & parallel & 6.1 & 3.9 & 257 & 8k/28k\\
|
||||
\hline
|
||||
16 & 1 & nonparallel & 255 & 3.3 & 303 & infinite\\
|
||||
\hline
|
||||
16 & 2 & parallel & 11 & 1.9 & 526 & infinite \\
|
||||
\hline
|
||||
16 & 2 & nonparallel & 504 & 1.8 & 555 & infinite\\
|
||||
\hline
|
||||
%32 & 2 & parallel & 11 & 2& & &\\
|
||||
%\hline
|
||||
%32 & 2 & nonparallel & 504 & $<2$& & &\\
|
||||
%\hline
|
||||
\end{tabular}
|
||||
\caption{Readout settings. The {\tiny{min exptime}} possible is 5$-$10~$\mu$s. This is due to the time to pass the pixel enable signal in the whole chip. The time between frames has been measured with the oscilloscope and the maximum frames rate has been tested with an external gating from a pulse generator at known frequence. The minimum period is obtained as 1/$\textrm{max frame rate}$.}
|
||||
\label{tframes}
|
||||
\end{flushleft}
|
||||
\end{table}
|
||||
\end{tiny}
|
||||
\textbf{As if you run too fast, the detector could become noisier, it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that {\tt{highgain}} settings could not be used at 6~kHz.
|
||||
\textbf{We recommend to use the detector in 32 bit mode with {\tt{clkdivider 2}}, {\tt{flags parallel}}. We recommend to use the detector in 16 bit mode with {\tt{clkdivider 1}}, {\tt{flags parallel}}}. In general, choose first the desired dead time: this will tell you if you want to run in parallel or non parallel mode. Then, choose the maximum frame rate you want to aim, not exceeding what you aim for not to increase the noise.
|
||||
|
||||
\textbf{As if you run too fast, the detector could become noisier, it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that with low energy settings could not reach 6~kHz and no noise.
|
||||
|
||||
In 16 bit mode, it could make sense, in case of noise and low threshold to either reduce the frame rate:
|
||||
\begin{equation}
|
||||
\textrm{new period} = \textrm{exptime} + \textrm{minimum time between frames} + (\textrm{10$-$20 }\mu \textrm{s})
|
||||
\end{equation}
|
||||
to let the signal settle or, if the frame rate is important, leave the {\tt{period}} at the same value but reduce the {\tt{exptime}}:
|
||||
\begin{equation}
|
||||
\textrm{new exptime} = \textrm{old exptime} - (\textrm{10$-$20 }\mu \textrm{s})
|
||||
\end{equation}
|
||||
|
||||
In general, choose first the desired dead time: this will tell you if you want to run in parallel or non parallel mode, although most likely it is parallel mode. Then, choose the maximum frame rate you want to aim, not exceeding what you aim for not to increase the noise. In 4 and 8 bit modes it makes no sense to run nonparallel as the exposure time is too small compared to the readout time.
|
||||
|
||||
\subsubsection{4 and 8 bit mode}
|
||||
In {\tt{parallel}} mode, the minimum time between frames is due to the time required to latch the values of the counter with capacitors. These values are determined in firmware and they can be estimated as:
|
||||
|
||||
\begin{equation} \label{dtparallel}
|
||||
\textrm{time between frames, parallel} = 4 \mu s \cdot (clkdivider+1)
|
||||
\end{equation}
|
||||
|
||||
This time is independent on the {\tt{dr}}.
|
||||
|
||||
In {\tt{nonparallel}} mode, it is easily possible to calculate the required asic readout time.
|
||||
Indeed a block of (8*256) pixels are readout, the bits pixel are the {\tt{dr}} and the speed of readout is 5ns/bit *({\tt{clkdivider}}+1) :
|
||||
|
||||
\begin{equation}\label{dtnonparallel}
|
||||
\textrm{asics readout time} = 5ns/bit \cdot 2^{(clkdivider+1)} \cdot dr \cdot (8*256) + 4 \mu s \cdot (clkdivider+1)
|
||||
\end{equation}
|
||||
|
||||
While we expose the next frame, we still need to readout the previous frame, so we need to guarantee that the period is large enough at least to readout the frame. So the maximum frame rate has to be $1/(\textrm{asic readout time})$. The minimum period has to be equal to the asic readout time.
|
||||
|
||||
\subsubsection{16 bit mode}
|
||||
|
||||
A similar situation happens in 16 bit mode, where this is more complicated because of three things:
|
||||
\begin{enumerate}
|
||||
\item The chip actual {\tt{dr}} is 12 bit
|
||||
\item The chip is readout as 12-bit/pixel, but the FEB inflates the pixel values to 16-bits when it passes to the BEB. This means that effectively the FEB to BEB connection limits the data throughput in the same way as if the {\tt{dr}} of the chip would really be 16 bits.
|
||||
\item While in 4 and 8 bit mode it makes no sense to run in {\tt{nonparallel}} mode as the exptime/dead time ratio would be not advantageous, in 16 bit mode, one can choose how to run more freely.
|
||||
\end{enumerate}
|
||||
|
||||
If we are in parallel mode, the dead time between frames, is also here described by equation~\ref{dtparallel}. If we are in {\tt{nonparallel}} mode, the dead time between frames is defined by \ref{dtnonparallel} ONLY for {\tt{clkdivider}} 1 and 2. So the maximum frame rate has to be $1/(\textrm{chip readout time})$ in this case. Only for {\tt{clkdivider}} 0 we hit some limitation in the bandwidth of The FEB $\to$ BEB connection. In this case, the maximum frame rate is lowered compared to what expected.
|
||||
|
||||
\subsubsection{32 bit mode}
|
||||
The autosumming mode of Eiger is the intended for long exposure times (frame rate of order of 100Hz, PILATUS like). A single acquisition is broken down into many smaller 12-bit acquisitions, each of a {\tt{subexptime}} of 2.621440~ms by default. Normally, this is a good default value to sustain an intensity of $10^6$ photons/pixel/s with no saturation. To change the value of {\tt{subexptime}} see section~\ref{advanced}.
|
||||
|
||||
The time between 12-bit subframes are listed in table~\ref{t32bitframe}.
|
||||
\begin{tiny}
|
||||
\begin{table}
|
||||
\begin{flushleft}
|
||||
\begin{tabular}{|c|c|c|c|c|c|}
|
||||
\hline
|
||||
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{t difference between subframes($\mu$s)} & \tiny{max internal subframe rate (kHz)} & \tiny{maximum frame rate (Hz)}\\
|
||||
\hline
|
||||
32 & 2 & parallel & 12 & 2 & 170\\
|
||||
\hline
|
||||
32 & 2 & nonparallel & 504 & $<2$ & 160\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\caption{Timing for the 32bit case. The maximum frame rate has been computed assuming 2 subframes of default {\tt{subexptime}} of 2.62144 ms.}
|
||||
\label{t32bitframe}
|
||||
\end{flushleft}
|
||||
\end{table}
|
||||
\end{tiny}
|
||||
|
||||
\textbf{The exposure time brokend up rounding up to the full next complete subframe that can be started.}
|
||||
The number of subframes composing a single 32bit acquisition can be calculated as:
|
||||
\begin{equation}
|
||||
\textrm{\# subframes}= (int) (\frac{\textrm{exptime (s)}}{\textrm{subexptime (s) + difference between frames (s)}}+0.5)
|
||||
%\label{esubframes}
|
||||
\end{equation}
|
||||
This also means that {\tt{exptime}}$<${\tt{subexptime}} will be rounded to{\tt{subexptime}}. If you want shorter acquisitions, either reduce the {\tt{subexptime}} or switch two 16-bit mode (you can always sum offline if needed).
|
||||
|
||||
The UDP header will contain, after you receive the data, the effective number of subframe per image (see section~\ref{UDP}) as "SubFrame Num or Exp Time", i.e. the number of subframes recorded (32 bit eiger).
|
||||
The effective time the detector has recorded data can be computed as:
|
||||
\begin{equation}
|
||||
\textrm{effective exptime}=(\textrm{subexptime})\cdot (\textrm{\# subframes})
|
||||
%\label{esubframes}
|
||||
\end{equation}
|
||||
|
||||
In the future release, a configurable extra time difference between subframes will be introduced for the parallel mode, so that some noise appearing in detectors at low threshold can be removed. This will enlarge the time difference between frames form the default 12~$\mu$s to something configurable, expected to be 15-40~$\mu$s (for the 9M it is currently 200~$\mu$s due to a noisier module).
|
||||
|
||||
\section{External triggering options}\label{triggering}
|
||||
The detector can be setup such to receive external triggers. Connect a LEMO signal to the TRIGGER IN connector in the Power Distribution Board (see Fig.). The logic 0 for the board is passed by low level 0$-$0.7~V, the logic 1 is passed to the board with a signal between 1.2$-$5~V. Eiger is 50~$\Omega$ terminated. By default the positive polarity is used (negative should not be passed to the board).
|
||||
|
||||
\begin{figure}[t]
|
||||
\begin{center}
|
||||
\includegraphics[width=.4\textwidth]{tiggerIN}
|
||||
\end{center}
|
||||
\caption{\textbf{Trigger INPUT} (looking at a single module from the back, top) is the \textbf{rightmost, down}.}
|
||||
\label{triggerIN}
|
||||
\end{figure}
|
||||
|
||||
\section{External triggering options}
|
||||
The detector can be setup such to receive external triggers. Connect a LEMO signal to the TRIGGER IN connector in the Power Distribution Board. The logic 0 for the board is passed by low level 0$-$0.7~V, the logic 1 is passed to the board with a signal between 1.2$-$5~V. Eiger is 50~$\Omega$ terminated. By default the positive polarity is used (negative should not be passed to the board).
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
|
||||
sls_detector_put 0-frames x
|
||||
@ -390,17 +512,17 @@ No timeout is expected between the start of the acquisition and the arrival of t
|
||||
|
||||
Here are the implemented options so far:
|
||||
\begin{itemize}
|
||||
\item {\tt{auto}} is the software controlled acquisition, where {\tt{exptime}} and {\tt{period}} have to be set.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. You {\tt{frames}} needs to be 1 always, {\tt{cycles}} can be changed and defines how many triggers are considered. 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. 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.
|
||||
\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}}.
|
||||
\end{itemize}
|
||||
|
||||
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 modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
|
||||
|
||||
\section{Autosumming and rate corrections}
|
||||
\section{Autosumming and rate corrections} \label{advanced}
|
||||
|
||||
In the case of autosumming mode, i.e, {\tt{dr 32}}, the acquisition time ({\tt{exptime}} is broken in as many subframes as they fit into the acquisition time minus all the subframes readout times. By default the {\tt{subexptime}} is set to 2.621440~ms. This implies that 12 bit counter of \E will saturate when the rate is above or equal to 1.57~MHz/pixel. The minimum value is of order of 10~ns (although as explained values smaller than 500~$\mu$s do not make sense). The maximum value is 5.2~s.
|
||||
|
||||
@ -417,7 +539,7 @@ In the EIGER on board server, this look-up table is generated assuming that the
|
||||
n_d= n_i \cdot exp(-n_i \cdot \tau),
|
||||
\label{rate}
|
||||
\end{equation}
|
||||
where $\tau$ represents an effective parameter for the dead time and the loss in efficiency. The look-up table is necessary as we are interested to obtain $c_i(c_d)$ and equation~\ref{rate} is not invertible. One needs to notice that the paralizable counter model to create a look-up tables applies only if photons arrive with a continuous pattern (like at the SLS). If photons are structured in fewer but intenser bunches, deviations may arise. This is the case for some operation modes at the ESRF. For those cases we are studying how to correct, probably from a simulated correction tables if an analytical curve cannot be found.
|
||||
where $\tau$ represents an effective parameter for the dead time and the loss in efficiency. The look-up table is necessary as we are interested to obtain $c_i(c_d)$ and equation~\ref{rate} is not invertible. One needs to notice that the paralyzable counter model to create a look-up tables applies only if photons arrive with a continuous pattern (like at the SLS). If photons are structured in fewer but intenser bunches, deviations may arise. This is the case for some operation modes at the ESRF. For those cases we are studying how to correct, probably from a simulated correction tables if an analytical curve cannot be found.
|
||||
\textbf{In the new calibration scheme, $\tau$ is given as a function of the energy. It is loaded from the trimbit files and interpolation between two trimbit files are performed.} One needs to make sure the appropriate $\tau$ value is written in the trimbit files, then need to load the appropriate {\tt{settings}} and {\tt{vthreshold}} before.
|
||||
|
||||
Online rate corrections can be activated for {\tt{dr=32}}. They are particularly useful in the autosumming mode as every single subframe is corrected before summing it. To correct for rate, the subframe duration has to be known to the correction algorithm. Rate corrections for {\tt{dr=16}} will be activated as well in the next firmware release.
|
||||
@ -454,20 +576,37 @@ Here is a list of limits that should be checked:
|
||||
If \textbf{dr} is 32 and \textbf{clkdivider} is not 2, whatever the detector gets out is wrong (the boards cannot properly keep up)
|
||||
\item If the variable \textbf{frames} is greater than what the memory can store (table~\ref{timgs}) and the frame rate exceed the continuos streaming (table~\ref{tcont}), limits on the maximum number of images need to be implemented if the period is lower than the one listed in table~\ref{tcont}. Check table~\ref{tframes} to see the different cases.
|
||||
\item Running at a speed that does not support the frame rate you are asking: see table~\ref{tframes} to check if the frame rate (\textbf{period}) you are asking is compatible with the \textbf{clkdivider} you are asking.
|
||||
\item Running at a redout time that does not support the frame rate you are asking. Check table~\ref{tframes} to check if the frame rate (\textbf{period}) you are asking is compatible with the \textbf{flags} you are asking.
|
||||
\item Running at a readout time that does not support the frame rate you are asking. Check table~\ref{tframes} to check if the frame rate (\textbf{period}) you are asking is compatible with the \textbf{flags} you are asking.
|
||||
\item The minimum allowed value for \textbf{exptime} should be 10~$\mu$s.
|
||||
\item By default the {\textbf{subexptime}} is set to 2.621440~ms. Values smaller than 500~$\mu$s do not make sense. The maximum value is 5.2~s. This limits should be checked.
|
||||
\end{enumerate}
|
||||
|
||||
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.
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
\section{1Gb/s, 10Gb/s links}
|
||||
\subsection{Checking the 1Gb/s, 10Gb/s physical links}\label{led}
|
||||
LEDs on the backpanel board at the back of each half module signal:
|
||||
\begin{itemize}
|
||||
\item the 1Gb/s physical link is signaled by the most external LED (should be green)
|
||||
\item the 10Gb/s physical link is signaled by the second most external LED next to the 1Gb/s one (should be green)
|
||||
\item the 1Gb/s physical link is signaled by the most external LED (should be green). For top half modules is at the extreme left. For bottom half modules is at the extreme right.
|
||||
\item the 10Gb/s physical link is signaled by the second most external LED next to the 1Gb/s one (should be green).
|
||||
\end{itemize}
|
||||
|
||||
\begin{figure}[t]
|
||||
\begin{center}
|
||||
\includegraphics[width=.7\textwidth]{LEDSim}
|
||||
\end{center}
|
||||
\caption{1 and 10GB LEDs position.}
|
||||
\label{fLEDs}
|
||||
\end{figure}
|
||||
|
||||
|
||||
|
||||
|
||||
\subsection{Delays in sending for 1Gb/s, 10Gb/s, 10Gb flow control, receiver fifo}
|
||||
|
||||
Extremely advanced options allow to:
|
||||
@ -486,10 +625,10 @@ Extremely advanced options allow to:
|
||||
\end{verbatim}
|
||||
As example:
|
||||
\begin{verbatim}
|
||||
for X in \$(seq 0 4); do ./sls_detector_put \$X:txndelay_left \$((X*100000)); done
|
||||
for X in $(seq 0 4); do ./sls_detector_put $X:txndelay_left $((X*100000)); done
|
||||
\end{verbatim}
|
||||
\begin{verbatim}
|
||||
./sls_detector_put \$X:txndelay_right \$((X*100000)); X=\$((X+1)); done
|
||||
./sls_detector_put $X:txndelay_right $((X*100000)); X=$((X+1)); done
|
||||
\end{verbatim}
|
||||
|
||||
\item Set transmission delay of the entire frame. This is required as you want to finish sending the first frame to all receivers before starting sending the second frame to the receivers with shorter delay time. This value has to be greater than the maximum of the transmission delays of each port.
|
||||
@ -539,9 +678,15 @@ Very important is to activate the flow control in 10Gb (in 1Gb it is on by defau
|
||||
\end{verbatim}
|
||||
Set the transmission delays as explained in the manual.
|
||||
|
||||
It can help to increase the fifo size of the receiver to {\tt{rx\_fifodepth}} to 1000 images
|
||||
\begin{verbatim}
|
||||
./sls_detector_put rx_fifodepth 1000
|
||||
\end{verbatim}
|
||||
One needs to keep into account that in 16 bit mode for 1 image we expect each slsReceiver to allocate 0.5MB. So for 1000 images, we expect 500MB memory for each receiver. This can be monitored in Linux with "top" or "free -m".
|
||||
|
||||
\section{Offline processing and monitoring}
|
||||
|
||||
\subsection{Data out of the detector: UDP packets}
|
||||
\subsection{Data out of the detector: UDP packets}\label{UDP}
|
||||
|
||||
The current UDP header format is described in figure~\ref{UDPheader}.
|
||||
\begin{figure}[t]
|
||||
@ -608,9 +753,9 @@ Header Version : 1 byte
|
||||
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 is in {\tt{slsDetectorsPackage/slsImageReconstruction}}.
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore.
|
||||
|
||||
The detector writes a raw file per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce cbf files. The executable uses the CBFlib-0.9.5 library (downloaded from the web as it download some architecture dependent packages at installation).\\
|
||||
The detector writes 2 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce cbf files. The executable uses the CBFlib-0.9.5 library (downloaded from the web as it download some architecture dependent packages at installation).\\
|
||||
\underline{At cSAXS, the CBFlib-0.9.5 has been compiled -such that the required packages are}\\\underline{ downloaded in /sls/X12SA/data/x12saop/EigerPackage/CBFlib-0.9.5.}\\
|
||||
|
||||
To use it for a single module:
|
||||
@ -626,7 +771,7 @@ cbfMaker [filename] [pixels x] [pixels y] ([singlemodulelongside_x] [start det])
|
||||
\end{verbatim}
|
||||
eg.
|
||||
{\tt cbfMaker /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 0}.\\
|
||||
The {\tt{[singlemodulelongside\_x]}} and {\tt{[start det]}} param are optional. Defaults are ``1'', the detector long side is on the x coordinate and start to reconstruct from module 0.
|
||||
The {\tt{[singlemodulelongside\_x]}} {\tt{[option to interpolate gap pixels]}} param are optional. Defaults are ``1'', the detector long side is on the x coordinate and start to reconstruct from module 0.
|
||||
The executables:
|
||||
\begin{verbatim}
|
||||
bcfMaker1.5M [file_name_with_dir]
|
||||
@ -694,7 +839,15 @@ Start the server again:
|
||||
\begin{verbatim}
|
||||
./eigerDetectorServer &
|
||||
\end{verbatim}
|
||||
\textbf{Note that the server appropriate for the software version used is located inside the package: {\tt{slsDetectorsPackage/serverBin/eigerDetectorServerxx.yy.}}}.
|
||||
|
||||
To copy the detector server on many boards, a script can be implemented on the lines of:
|
||||
\begin{verbatim}
|
||||
for i in beb111 beb070;
|
||||
do ssh root@$i killall eigerDetectorServer;
|
||||
scp eigerDetectorServer root@$i:~/executables/eigerDetectorServer ;
|
||||
ssh root@$i sync; done
|
||||
\end{verbatim}
|
||||
|
||||
\section{Loading firmware bitfiles}
|
||||
|
||||
@ -708,7 +861,7 @@ cd executables
|
||||
./boot_recovery
|
||||
\end{verbatim}
|
||||
\end{enumerate}
|
||||
In both case, after booting, only the central one should be on green and red alternating.
|
||||
In both case, after booting, only the central LED should be on green and red alternating.
|
||||
|
||||
From a terminal, do:
|
||||
\begin{verbatim}
|
||||
@ -769,17 +922,9 @@ To load the special noise file look at {\tt{settingsdir/eiger/standard/eigernois
|
||||
sls_detector_put trimbits ../settingsdir/eiger/standard/eigernoise
|
||||
\end{verbatim}
|
||||
|
||||
\section{Running the (9M at cSAXS. For now)}
|
||||
\begin{itemize}
|
||||
\item login as {\tt{x12saop@xbl-daq-27}}
|
||||
\item {\tt{setup\_eiger}} \#loads environmental variables and brings you to the right directory to execute commands
|
||||
\item slsReceiverScript3 1991 36 \# from one shell.. opens 36 receivers
|
||||
\item p config ../../eiger\_9m\_10gb\_xbl-daq-27\_withbottom.config
|
||||
\end{itemize}
|
||||
|
||||
\section{Troubleshooting}
|
||||
\subsection{Cannot successfully finish an acquisition}
|
||||
\subsubsection{only master module return from acquisition}
|
||||
\subsubsection{Only master module return from acquisition}
|
||||
When no packets are received AND detector states in 'running status'. Widest list of causes.
|
||||
Query the status of each half module till the maximum number {\tt{N}}, {\tt{for i in \$(seq\ 0\ N); do sls\_detector\_get \$i:status; done}}, to check if there are half modules that are still running.
|
||||
|
||||
@ -790,7 +935,7 @@ If only the master modules return but ALL the other half modules do not:
|
||||
\item It can be that the synchronization cable is not connected or the termination board at the synchronization does not work. Check.
|
||||
\end{itemize}
|
||||
|
||||
\subsubsection{a few modules do not return from acquisition}
|
||||
\subsubsection{A few modules do not return from acquisition}
|
||||
If only a few modules are still running but the others return, it is a real problem with a backend board or a synchronization bug.
|
||||
If you can, ssh into the board, kill and start the eigerDetectorServer again (see Section~\ref{server} for how to do this). Keep the terminal with the output from the eigerDetectorServer and repeat the acquisition.
|
||||
\begin{itemize}
|
||||
@ -800,11 +945,33 @@ If you can, ssh into the board, kill and start the eigerDetectorServer again (se
|
||||
|
||||
\subsection{No packets (or very little) are received}
|
||||
In both cases running \textbf{wireshark} set to receive UDP packets on the ethernet interface of the receiver (filter the UDPport$>=$xxxx, where xxxx is written in the configuration file) can help you understanding if NO packets are seen or some packets are seen. You have to set the buffer size of the receiving device in wireshark to 100Mbyte minimum. If no packets are received, check that your receiving interface and detector UDPIPs are correct (if in 10Gb). Most of the time in this case it is a basic configuration problem.
|
||||
If some packets are received, but not all, then it is an optimization problem:
|
||||
It can help looking at the receiver output, shown in an example here:
|
||||
\begin{verbatim}
|
||||
Missing Packets : 224064
|
||||
Complete Frames : 3499
|
||||
Last Frame Caught : 3499
|
||||
\end{verbatim}
|
||||
|
||||
The {\tt{Last Frame Caught}}, meaning the packet from the last frame that was sent out by the detector, can help in understanding the problem:
|
||||
\begin{enumerate}
|
||||
\item If some packets are received, but not all, it could be a network optimization problem. In this case, the {\tt{Last Frame Caught}} will be a value close to the expected number of frames with missing frames distributed over the whole frame range. In this case:
|
||||
\begin{itemize}
|
||||
\item For receiving data over 1Gb, the switch must have FLOW CONTROL enabled
|
||||
\item If using 10GbE, check that the 10Gb link is active on the backpanel board. Then refer to Section~\ref{10g} to see how to configure the 10Gb ports on the receiving machine correctly.
|
||||
\end{itemize}
|
||||
\item If the {\tt{Last Frame Caught}} value is much lower than the expected frames and you are missing a bunch of frames from a point onwards, and you are using {\tt{receiver start, status start}}: then it can be that you are stopping the receiver too early. In particular when you are using {\tt{delay}} it might be that there is some time between when the detector is already done and in {\tt{idle}} state but the receiver is still receiving data. Check with {\tt{./sls\_detector\_get framescaught}} if the receiver is already done before doing {\tt{./sls\_detector\_put receiver stop}}.
|
||||
\item If the {\tt{Last Frame Caught}} value is much lower than the expected frames and you are missing a bunch of frames from a point onwards and you are running at a higher frame rate than the continuous framerate (see table~\ref{tcont}) with more images than the size of the memory (see table~\ref{timgs}). It might be that you are running out of memory to store images. There is no protection for this. see point~\ref{outmemory}
|
||||
\end{enumerate}
|
||||
|
||||
\subsection{'Got Frame Number Zero from Firmware'}\label{outmemory}
|
||||
In this case, you have run out of memory size (see table~\ref{timgs} for the size) on the boards so you are trying to store on the DDR2 memories more images that they can contain and the network is not fast enough to send everything out from the 10GbE.
|
||||
So if you see:
|
||||
\begin{verbatim}
|
||||
Got Frame Number Zero from Firmware. Discarding Packet
|
||||
\end{verbatim}
|
||||
it means that you run out of memory at the previous acquisition. The cure is taking 2 or 3 SINGLE images in a raw to clear out the memories.
|
||||
|
||||
|
||||
|
||||
\subsection{The module seems dead, no lights on BEBs, no IP addresses}
|
||||
\begin{itemize}
|
||||
@ -820,7 +987,7 @@ If the 1G LED (see Section~\ref{led}) on the backpanel board is not green:
|
||||
\item The IP address is assigned only at booting up of the boards. Try to reboot in case the board booted before it could have an IP address.
|
||||
\item Check that you did not run out of IP addresses
|
||||
\end{itemize}
|
||||
Check that the board is not in recovery mode (i.e. the central LED on the back is stable green). In this case reboot the board with the soft reset or power cycle it.
|
||||
Check that the board is not in recovery mode (i.e. the central LED on the back is stable green, see Fig~\ref{fLEDs}). In this case reboot the board with the soft reset or power cycle it.
|
||||
|
||||
If the 1Gb LED on the backpanel board is green (see Section~\ref{led}):
|
||||
\begin{itemize}
|
||||
@ -835,6 +1002,14 @@ It is connected to the TCPport which the receiver uses:
|
||||
%%%#To display only open UDP ports try the following command: netstat -vaun
|
||||
\end{itemize}
|
||||
|
||||
\subsection{The client ignores the commands}
|
||||
Make sure that in the configuration file you do not have {\tt{lock 1}} activated, as this will let only one username from one IP address talk to the detector.
|
||||
To deactivate it, you need to run {\tt{lock 0}} from the client session where you locked it.
|
||||
|
||||
\subsection{Zmq socket is blocked}
|
||||
It is connected to the TCPport which is used. In rare cases, it might be that the TCP port crashes. To find out which process uses the TCPPOrt do: \textbf{netstat -nlp | grep xxxx}, where xxxx is the tcpport number. To display open ports and established TCP connections, enter: \textbf{netstat -vatn}. Kill the process.
|
||||
|
||||
|
||||
\subsection{Client has \textbf{shmget error}}
|
||||
Note that occasionally if there is a shared memory of a different size (from an older software version), it will return also a line like this:
|
||||
\begin{verbatim}
|
||||
@ -843,14 +1018,18 @@ Note that occasionally if there is a shared memory of a different size (from an
|
||||
This needs to be cleaned with {\tt{ipcs -m}} and then {\tt{ipcrm -M xxx}}, where xxx are the keys with nattch 0. Alternative in the main slsDetectorFolder there is a script that can be used as {\tt{sh cleansharedmemory.sh}}. Note that you need to run the script with the account of the client user, as the shared memory belongs to the client. It is good procedure to implement an automatic cleanup of the shared memory if the client user changes often.
|
||||
|
||||
\subsection{Measure the HV}
|
||||
For every system but not the 9M:
|
||||
For every system:
|
||||
\begin{itemize}
|
||||
\item Software-wise measure it (now the software returns the measured value), with {\tt{sls\_detector\_get vhighvoltage}}. The returned value is the HV (for proper Eiger setting is approximately 150~V) if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:vhighvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
|
||||
\item Hardware-wise measure value of HV on C14 on the power distribution board. Check also that the small HV connector cable is really connected.
|
||||
\item Hardware-wise (opening the detector) measure value of HV on C14 on the power distribution board. Check also that the small HV connector cable is really connected.
|
||||
\end{itemize}
|
||||
|
||||
The 2M system at ESRF has a HV enable signal that needs to be shortcut in order to overwrite vacuum protections (when not in vacuum).
|
||||
The 1.5M for OMNY has a relay system that enables HV only when the vacuum is good.
|
||||
For both systems, it makes sense not to set the HV while running the configuration file but set it at a later stage when sure about the vacuum.
|
||||
|
||||
\subsection{The image now has a vertical line}
|
||||
Check if the vertical line has a length of 256 pixels and a width of 8 columns. In this case it is a dataline beeing bad. It can be either a wirebond problem or a frontend board problem. try to read the FEB temperature (see Section~\ref{}) and report the problem to the SLSDetector group. Most likely it will be a long term fix by checking the hardware.
|
||||
Check if the vertical line has a length of 256 pixels and a width of 8 columns. In this case it is a dataline being bad. It can be either a wirebond problem or a frontend board problem. try to read the FEB temperature (see Section~\ref{}) and report the problem to the SLSDetector group. Most likely it will be a long term fix by checking the hardware.
|
||||
|
||||
\subsection{The image now has more vertical lines}
|
||||
|
||||
@ -860,7 +1039,7 @@ If you see strange lines in vertical occurring at period patterns, it is a memor
|
||||
Depending on your network setup, to speed up the ssh to the boards from a pc with internal dhcp server running: \textbf{iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE; echo "1" > /proc/sys/net/ipv4/ip\_forward}, where eth1 has to be the 1Gb network device on the pc
|
||||
|
||||
\subsection{Check firmware version installed on BEB}
|
||||
Follow some steps described in Section~\label{server}.
|
||||
You can either ask in the client as described in section~\ref{api}, or login to the boards directly. Follow some steps described in Section~\ref{server}.
|
||||
\begin{verbatim}
|
||||
ssh root@bebxxx #password is root
|
||||
killall eigerDetectorServer # kill server and stopserver
|
||||
@ -870,7 +1049,7 @@ cd executables/
|
||||
Scroll up in the terminal till you find {\tt{Firmware Version: xx}}
|
||||
|
||||
\subsection{Check if half-module is a master, a slave, a top or a bottom}
|
||||
Follow some steps described in Section~\label{server}.
|
||||
Follow some steps described in Section~\ref{server}.
|
||||
\begin{verbatim}
|
||||
ssh root@bebxxx #password is root
|
||||
killall eigerDetectorServer # kill server and stopserver
|
||||
@ -882,9 +1061,34 @@ Scroll up in the terminal till you find:\\
|
||||
*************** MASTER/SLAVE ***************\\
|
||||
*************** NORMAL/SPECIAL ***************\\
|
||||
|
||||
\subsection{'Cannot connect to socket'}
|
||||
This error is typically due to the detector server not running. For why, see section~\ref{servernot}.
|
||||
|
||||
\subsection{Detector server is not running}\label{servernot}
|
||||
The detector server could not be running: either the detector was powered off, or it powered off itself due to too high temperature or, in the case of the 9M, if the waterflow sensor detected no flux and powered it off (the chiller stops occasionally as cSAXS).
|
||||
|
||||
If the powering and the temperature are OK, instead, it can be that the firmware version is incompatible to the server version and/or the client software version. So check the consistency of firmware/software/server versions.
|
||||
|
||||
\subsection{'Acquire has already started' error message}
|
||||
If you see the client returning the following error message:\\
|
||||
``Acquire has already started. If previous acquisition terminated unexpectedly, reset busy flag to restart.(sls\_detector\_put busy 0)''\\
|
||||
You need to run the command:
|
||||
\begin{verbatim}
|
||||
./sls_detector_put busy 0
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{There is noise running the detector in 32-bit}
|
||||
Short story (for now): You are running in {\tt{parallel}} mode, switch {\tt{flags}} to non {\tt{nonparallel}} mode.
|
||||
Long story: If you are running the detector in 32-bit (autosumming), there might be some noise, particularly at lower thereshold energies. This is due to the fact that the analog part of the chips require some latency time to settle which is larger than the redout time. At the present moment it is possible to run the detector only in {\tt{parallel}} or {\tt{nonparallel}} mode, respectively with readout times between frames of 12~$\mu$s and 504~$\mu$s. If you switch {\tt{flags}} to non {\tt{nonparallel}} mode you will giveenough time for teh signals to settle. For future realeas we are planning to introduce some configurable delay, such that you can remain with the {\tt{parallel}} flag, but can obtain a configurable dead time between frames in the range 12$-$504~$\mu$s.
|
||||
|
||||
\subsection{There is noise running the detector at high frame rate(4,8,16 bit)}
|
||||
If are running in {\tt{parallel}} mode, in particular at low thereshold energies, you might encounter some noise. The reason is that the analog part of the chips require some latency time to settle which is larger than the redout time.
|
||||
\begin{enumerate}
|
||||
\item You can lower the frame rate and relax requirements on period:
|
||||
At low frame rate, you normally leave enough time between the end of the acquisition and the starting of the next, so you should not see this effect. In any case setting a {\tt{period}}={\tt{exptime}}+readout time from Table~\ref{tchipro} +extra 20$\mu$s cures the problem. The 20$\mu$s could also be 10~$\mu$s, they are very hardware dependent.
|
||||
\item The frame rate requirement are stingent (as for time resolved measurements): the only option here is to reduce the {\tt{exptime}} to let the extra 20~$\mu$s (or 10)~$\mu$s. The {\tt{period}} remains the same.
|
||||
\end{enumerate}
|
||||
|
||||
\section{Client checks - command line}
|
||||
|
||||
Guide on returned strings:
|
||||
@ -1025,7 +1229,74 @@ where {\tt{number}} is a string that should be interpreted as an int for 0/1 me
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
\section{Complete data out rate tables}
|
||||
|
||||
In table~\ref{tframescomplete} is a list of all the readout times in the different configurations.
|
||||
\begin{tiny}
|
||||
\begin{table}
|
||||
\begin{flushleft}
|
||||
\begin{tabular}{|c|c|c|c|c|c|c|}
|
||||
\hline
|
||||
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{readout t($\mu$s)} & \tiny{max frame rate (kHz)} & \tiny{min period ($\mu$s)} & \tiny{max imgs (nominal/our network)}\\
|
||||
\hline
|
||||
4 & 0 & parallel & 3.4 & 22 & 44 & 30k/50k\\
|
||||
\hline
|
||||
4 & 0 & nonparallel & 44 & 21 & 49 & 30k/50k\\
|
||||
\hline
|
||||
4 & 1 & parallel & 6 & 10.5 & 92 & 30k/100k\\
|
||||
\hline
|
||||
4 & 1 & nonparallel & 88.7 & 10.5 & 93 & 30k/100k\\
|
||||
\hline
|
||||
4 & 2 & parallel & 11.2 & 5.4 & 197 & infinite\\
|
||||
\hline
|
||||
4 & 2 & nonparallel & 176.5 & 5.4 & 180 & infinite\\
|
||||
\hline
|
||||
\hline
|
||||
8 & 0 & parallel & 3.4 & 11.1 & 89 & 15k/24k\\
|
||||
\hline
|
||||
8 & 0 & nonparallel & 85.7 & 11.1 & 91 & 15k/24k\\
|
||||
\hline
|
||||
8 & 1 & parallel & 6.1 & 5.7 & 181 & 15k/52k\\
|
||||
\hline
|
||||
8 & 1 & nonparallel & 170.5 & 5.7 & 175 & 15k/52k\\
|
||||
\hline
|
||||
8 & 2 & parallel & 11.2 & 2.9 & 342 & infinite\\
|
||||
\hline
|
||||
8 & 2 & nonparallel & 340.3 & 2.9 & 344 & infinite\\
|
||||
\hline
|
||||
\hline
|
||||
16 & 0 & parallel & 3.4 & 6.1 & 164 & 8k/12k\\
|
||||
\hline
|
||||
16 & 0 & nonparallel & 126 & 5.6& 179 & 8k/23k\\
|
||||
\hline
|
||||
16 & 1 & parallel & 6.1 & 3.9& 257 & 8k/28k\\
|
||||
\hline
|
||||
16 & 1 & nonparallel & 255 & 3.3& 303 & infinite\\
|
||||
\hline
|
||||
16 & 2 & parallel & 11 & 1.9 & 526 &infinite \\
|
||||
\hline
|
||||
16 & 2 & nonparallel & 504 & 1.8 & 555 & infinite\\
|
||||
\hline
|
||||
\hline
|
||||
32 & 2 & parallel & 11 & 2 & &\\
|
||||
\hline
|
||||
32 & 2 & nonparallel & 504 & $<2$ & &\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\caption{Readout settings. The {\tiny{min exptime}} possible is 5$-$10~$\mu$s. This is due to the time to pass the pixel enable signal in the whole chip.}
|
||||
\label{tframescomplete}
|
||||
\end{flushleft}
|
||||
\end{table}
|
||||
\end{tiny}
|
||||
|
||||
Table~\ref{tx} shows the bandwidth of data trasnferring between the FEB and BEB and of the DDR2 memory access. the GTX lanes are only capable of 25.6~Gbit/s. This limits the 12/16 bit frame rate. The 2$\times$DDR2 memories have a bandwidth or 2$\cdot$25.6~Gb/s=51.2~Gb/s. Due to this memory access bandwidth, the 32 bit autosumming mode can only run in {\tt{clkdivider}} 2.
|
||||
\begin{figure}[t]
|
||||
\begin{center}
|
||||
\includegraphics[width=1.\textwidth]{TansmissionRates}
|
||||
\end{center}
|
||||
\caption{Transmission bandwidth for the FEB $\to$BEB transfer (second column) and the DDR2 memories (fourth column). }
|
||||
\label{tx}
|
||||
\end{figure}
|
||||
|
||||
\end{document}
|
||||
|
||||
|
BIN
manual/manual-client/LEDSim.png
Normal file
BIN
manual/manual-client/LEDSim.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 863 KiB |
BIN
manual/manual-client/TansmissionRates.png
Normal file
BIN
manual/manual-client/TansmissionRates.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
BIN
manual/manual-client/tiggerIN.png
Normal file
BIN
manual/manual-client/tiggerIN.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 167 KiB |
1
serverBin/eigerDetectorServer_developer
Symbolic link
1
serverBin/eigerDetectorServer_developer
Symbolic link
@ -0,0 +1 @@
|
||||
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer_developer
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.1.0.16.1
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv3.1.0.21.0
|
1
serverBin/gotthardDetectorServer_developer
Symbolic link
1
serverBin/gotthardDetectorServer_developer
Symbolic link
@ -0,0 +1 @@
|
||||
../slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer_developer
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv3.1.0.1
|
1
serverBin/jungfrauDetectorServer_developer
Symbolic link
1
serverBin/jungfrauDetectorServer_developer
Symbolic link
@ -0,0 +1 @@
|
||||
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServerv3.0.0.12
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServerv3.1.0.2
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 350
|
||||
Vib_test 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 350
|
||||
Vib_test 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 350
|
||||
Vib_test 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 350
|
||||
Vib_test 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 350
|
||||
Vib_test 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
VDAC0 1220
|
||||
VDAC1 3000
|
||||
VDAC2 1053
|
||||
VDAC3 1450
|
||||
VDAC4 750
|
||||
VDAC5 1000
|
||||
VDAC6 480
|
||||
VDAC7 420
|
@ -1 +0,0 @@
|
||||
dynamicgain
|
@ -1 +0,0 @@
|
||||
dynamicgain
|
@ -1 +0,0 @@
|
||||
dynamicgain
|
@ -1 +0,0 @@
|
||||
dynamicgain
|
@ -1 +0,0 @@
|
||||
dynamicgain
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
VDAC0 660
|
||||
VDAC1 650
|
||||
VDAC2 1480
|
||||
VDAC3 1520
|
||||
VDAC4 1320
|
||||
VDAC5 1350
|
||||
VDAC6 887
|
||||
VDAC7 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
VDAC0 660
|
||||
VDAC1 650
|
||||
VDAC2 1480
|
||||
VDAC3 1520
|
||||
VDAC4 1320
|
||||
VDAC5 1350
|
||||
VDAC6 887
|
||||
VDAC7 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
VDAC0 660
|
||||
VDAC1 650
|
||||
VDAC2 1480
|
||||
VDAC3 1520
|
||||
VDAC4 1320
|
||||
VDAC5 1350
|
||||
VDAC6 887
|
||||
VDAC7 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
VDAC0 660
|
||||
VDAC1 650
|
||||
VDAC2 1480
|
||||
VDAC3 1520
|
||||
VDAC4 1320
|
||||
VDAC5 1350
|
||||
VDAC6 887
|
||||
VDAC7 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
VDAC0 660
|
||||
VDAC1 650
|
||||
VDAC2 1480
|
||||
VDAC3 1520
|
||||
VDAC4 1320
|
||||
VDAC5 1350
|
||||
VDAC6 887
|
||||
VDAC7 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 887
|
||||
Vib_test 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 887
|
||||
Vib_test 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 887
|
||||
Vib_test 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 887
|
||||
Vib_test 2001
|
@ -1 +0,0 @@
|
||||
227 5.6
|
@ -1,8 +0,0 @@
|
||||
Vref 660
|
||||
VcascN 650
|
||||
VcascP 1480
|
||||
Vout 1520
|
||||
Vcasc 1320
|
||||
Vin 1350
|
||||
Vref_comp 887
|
||||
Vib_test 2001
|
@ -10,6 +10,17 @@
|
||||
#include "tiffIO.h"
|
||||
|
||||
|
||||
#ifdef ROOTSPECTRUM
|
||||
#include <TPaveText.h>
|
||||
#include <TLegend.h>
|
||||
#include <TF1.h>
|
||||
#include <TGraphErrors.h>
|
||||
#include <TH2F.h>
|
||||
#include <TASImage.h>
|
||||
#include <TImage.h>
|
||||
#include <TFile.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifndef FRAMEMODE_DEF
|
||||
@ -66,11 +77,30 @@ template <class dataType> class analogDetector {
|
||||
thr=0;
|
||||
myFile=NULL;
|
||||
fm=new pthread_mutex_t ;
|
||||
#ifdef ROOTSPECTRUM
|
||||
hs=new TH2F("hs","hs",2000,-100,10000,nx*ny,-0.5,nx*ny-0.5);
|
||||
#ifdef ROOTCLUST
|
||||
hs3=new TH2F("hs3","hs3",2000,-100,3*3*10000,nx*ny,-0.5,nx*ny-0.5);
|
||||
hs5=new TH2F("hs5","hs5",2000,-100,5*5*10000,nx*ny,-0.5,nx*ny-0.5);
|
||||
hs7=new TH2F("hs7","hs7",2000,-100,7*7*10000,nx*ny,-0.5,nx*ny-0.5);
|
||||
hs9=new TH2F("hs9","hs9",2000,-100,9*9*10000,nx*ny,-0.5,nx*ny-0.5);
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
/**
|
||||
destructor. Deletes the pdestalSubtraction array and the image
|
||||
*/
|
||||
virtual ~analogDetector() {for (int i=0; i<ny; i++) delete [] stat[i]; delete [] stat; delete [] image;};
|
||||
virtual ~analogDetector() {for (int i=0; i<ny; i++) delete [] stat[i]; delete [] stat; delete [] image;
|
||||
#ifdef ROOTSPECTRUM
|
||||
delete hs;
|
||||
#ifdef ROOTCLUST
|
||||
delete hs3;
|
||||
delete hs5;
|
||||
delete hs7;
|
||||
delete hs9;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
constructor cloning another analog detector
|
||||
@ -111,7 +141,16 @@ template <class dataType> class analogDetector {
|
||||
}
|
||||
}
|
||||
image=new int[nx*ny];
|
||||
|
||||
#ifdef ROOTSPECTRUM
|
||||
hs=(TH2F*)(orig->hs)->Clone();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
#ifdef ROOTCLUST
|
||||
hs3=(TH2F*)(orig->hs3)->Clone();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
hs5=(TH2F*)(orig->hs5)->Clone();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
hs7=(TH2F*)(orig->hs7)->Clone();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
hs9=(TH2F*)(orig->hs9)->Clone();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -220,6 +259,15 @@ template <class dataType> class analogDetector {
|
||||
image[iy*nx+ix]=0;
|
||||
}
|
||||
if (cmSub) cmSub->Clear();
|
||||
#ifdef ROOTSPECTRUM
|
||||
hs->Reset();
|
||||
#ifdef ROOTCLUST
|
||||
hs3->Reset();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
hs5->Reset();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
hs7->Reset();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
hs9->Reset();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
/** resets the commonModeSubtraction and increases the frame index */
|
||||
@ -253,24 +301,60 @@ template <class dataType> class analogDetector {
|
||||
\param iy pixel y coordinate
|
||||
\param cm 1 adds the value to common mod, 0 skips it. Defaults to 0. - not properly implemented
|
||||
*/
|
||||
virtual void addToPedestal(double val, int ix, int iy=0){
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
virtual void addToPedestal(double val, int ix, int iy=0, int cm=0){
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
if (cmSub && cm>0) {
|
||||
val-= getCommonMode(ix, iy);
|
||||
}
|
||||
stat[iy][ix].addToPedestal(val);
|
||||
if (cmSub) {
|
||||
if (det) if (det->isGood(ix, iy)==0) return;
|
||||
cmSub->addToCommonMode(val, ix, iy);
|
||||
};
|
||||
/* if (cmSub && cm>0) { */
|
||||
/* if (det) if (det->isGood(ix, iy)==0) return; */
|
||||
/* cmSub->addToCommonMode(val, ix, iy); */
|
||||
/* }; */
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
double getCommonMode(int ix, int iy) {
|
||||
if (cmSub) return cmSub->getCommonMode(ix, iy);
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
||||
virtual void addToCommonMode(char *data){
|
||||
if (cmSub) {
|
||||
for (int ix=xmin; ix<xmax; ix++) {
|
||||
for (int iy=ymin; iy<ymax; iy++) {
|
||||
// if (getNumpedestals(ix,iy)>0)
|
||||
addToCommonMode(data, ix, iy);
|
||||
}
|
||||
}
|
||||
//cout << "cm " << getCommonMode(0,0) << " " << getCommonMode(1,0) << endl;
|
||||
}
|
||||
}
|
||||
virtual void addToCommonMode(char *data, int ix, int iy=0){
|
||||
if (cmSub) {
|
||||
if (det) if (det->isGood(ix, iy)==0) return;
|
||||
if (getNumpedestals(ix,iy)>0){
|
||||
cmSub->addToCommonMode(subtractPedestal(data,ix,iy,0), ix, iy);
|
||||
// cout << ix << " " <<subtractPedestal(data,ix,iy,0) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
gets pedestal (and common mode)
|
||||
\param ix pixel x coordinate
|
||||
\param iy pixel y coordinate
|
||||
\param cm 0 (default) without common mode subtraction, 1 with common mode subtraction (if defined)
|
||||
\returns pedestal value
|
||||
*/
|
||||
virtual double getPedestal(int ix, int iy, int cm=0){if (ix>=0 && ix<nx && iy>=0 && iy<ny) if (cmSub && cm>0) return stat[iy][ix].getPedestal()-cmSub->getCommonMode(); else return stat[iy][ix].getPedestal(); else return -1;};
|
||||
virtual double getPedestal(int ix, int iy, int cm=0){
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny)
|
||||
if (cmSub && cm>0)
|
||||
return stat[iy][ix].getPedestal()+getCommonMode(ix,iy);
|
||||
else return stat[iy][ix].getPedestal();
|
||||
else return -1;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
gets pedestal rms (i.e. noise)
|
||||
@ -278,9 +362,17 @@ template <class dataType> class analogDetector {
|
||||
\param iy pixel y coordinate
|
||||
\returns pedestal rms
|
||||
*/
|
||||
virtual double getPedestalRMS(int ix, int iy){if (ix>=0 && ix<nx && iy>=0 && iy<ny) return stat[iy][ix].getPedestalRMS();else return -1;};
|
||||
virtual double getPedestalRMS(int ix, int iy){
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny)
|
||||
return stat[iy][ix].getPedestalRMS();
|
||||
else return -1;
|
||||
};
|
||||
|
||||
|
||||
virtual int getNumpedestals(int ix, int iy){
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny)
|
||||
return stat[iy][ix].getNumpedestals();
|
||||
else return -1;
|
||||
};
|
||||
/**
|
||||
gets pedestal (and common mode)
|
||||
\param ix pixel x coordinate
|
||||
@ -327,7 +419,6 @@ template <class dataType> class analogDetector {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
sets pedestal
|
||||
@ -396,17 +487,45 @@ template <class dataType> class analogDetector {
|
||||
virtual void *writeImage(const char * imgname) {
|
||||
float *gm=NULL;
|
||||
void *ret;
|
||||
#ifdef ROOTSPECTRUM
|
||||
|
||||
TH2F *hmap=new TH2F("hmap","hmap",nx, -0.5,nx-0.5, ny, -0.5, ny-0.5);
|
||||
|
||||
#endif
|
||||
gm=new float[nx*ny];
|
||||
for (int ix=0; ix<nx; ix++) {
|
||||
for (int iy=0; iy<ny; iy++) {
|
||||
gm[iy*nx+ix]=image[iy*nx+ix];
|
||||
#ifdef ROOTSPECTRUM
|
||||
hmap->SetBinContent(ix+1, iy+1,image[iy*nx+ix]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
ret=WriteToTiff(gm, imgname, ny, nx);
|
||||
delete [] gm;
|
||||
#ifdef ROOTSPECTRUM
|
||||
char rootfn[10000];
|
||||
sprintf(rootfn,"%s.root",imgname);
|
||||
TFile *f=new TFile(rootfn,"RECREATE");
|
||||
hs->Write("hs");
|
||||
#ifdef ROOTCLUST
|
||||
hs3->Write("hs3");
|
||||
hs5->Write("hs5");
|
||||
hs7->Write("hs7");
|
||||
hs9->Write("hs9");
|
||||
#endif
|
||||
hmap->Write("hmap");
|
||||
|
||||
|
||||
f->Close();
|
||||
delete f;
|
||||
delete hmap;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef ROOTSPECTRUM
|
||||
TH2F *getSpectrum(){return hs;};
|
||||
#endif
|
||||
/**
|
||||
write 32bit tiff file containing the pedestals
|
||||
\param imgname file name to be written
|
||||
@ -416,18 +535,43 @@ template <class dataType> class analogDetector {
|
||||
virtual void *writePedestals(const char * imgname) {
|
||||
float *gm=NULL;
|
||||
void *ret;
|
||||
gm=new float[nx*ny];
|
||||
for (int ix=0; ix<nx; ix++) {
|
||||
for (int iy=0; iy<ny; iy++) {
|
||||
if (cmSub)
|
||||
gm[iy*nx+ix]=stat[iy][ix].getPedestal()-cmSub->getCommonMode();
|
||||
else
|
||||
gm[iy*nx+ix]=stat[iy][ix].getPedestal();
|
||||
}
|
||||
gm=new float[nx*ny];
|
||||
#ifdef ROOTSPECTRUM
|
||||
|
||||
TH2F *hmap=new TH2F("hmap","hmap",nx, -0.5,nx-0.5, ny, -0.5, ny-0.5);
|
||||
|
||||
#endif
|
||||
for (int ix=0; ix<nx; ix++) {
|
||||
for (int iy=0; iy<ny; iy++) {
|
||||
/* if (cmSub) */
|
||||
/* gm[iy*nx+ix]=stat[iy][ix].getPedestal()-cmSub->getCommonMode(); */
|
||||
/* else */
|
||||
gm[iy*nx+ix]=stat[iy][ix].getPedestal();
|
||||
#ifdef ROOTSPECTRUM
|
||||
hmap->SetBinContent(ix+1, iy+1,gm[iy*nx+ix]);
|
||||
#endif
|
||||
}
|
||||
ret=WriteToTiff(gm, imgname, ny, nx);
|
||||
delete [] gm;
|
||||
return ret;
|
||||
}
|
||||
ret=WriteToTiff(gm, imgname, ny, nx);
|
||||
delete [] gm;
|
||||
|
||||
#ifdef ROOTSPECTRUM
|
||||
char rootfn[10000];
|
||||
sprintf(rootfn,"%s.root",imgname);
|
||||
TFile *f=new TFile(rootfn,"RECREATE");
|
||||
hs->Write("hs");
|
||||
#ifdef ROOTCLUST
|
||||
hs3->Write("hs3");
|
||||
hs5->Write("hs5");
|
||||
hs7->Write("hs7");
|
||||
hs9->Write("hs9");
|
||||
#endif
|
||||
hmap->Write("hmap");
|
||||
f->Close();
|
||||
delete f;
|
||||
delete hmap;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -538,18 +682,24 @@ template <class dataType> class analogDetector {
|
||||
\param data pointer to the data
|
||||
*/
|
||||
|
||||
virtual void addToPedestal(char *data) {
|
||||
virtual void addToPedestal(char *data, int cm=0) {
|
||||
|
||||
|
||||
newFrame();
|
||||
|
||||
|
||||
if (cmSub) {
|
||||
addToCommonMode(data);
|
||||
}
|
||||
|
||||
// cout << xmin << " " << xmax << endl;
|
||||
// cout << ymin << " " << ymax << endl;
|
||||
for (int ix=xmin; ix<xmax; ix++) {
|
||||
for (int iy=ymin; iy<ymax; iy++) {
|
||||
addToPedestal(data,ix,iy,1);
|
||||
|
||||
|
||||
addToPedestal(data,ix,iy);
|
||||
|
||||
#ifdef ROOTSPECTRUM
|
||||
subtractPedestal(data,ix,iy,cm);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
@ -585,6 +735,20 @@ template <class dataType> class analogDetector {
|
||||
}
|
||||
|
||||
|
||||
#ifdef ROOTSPECTRUM
|
||||
delete hs;
|
||||
hs=new TH2F("hs","hs",2000,-100,10000,(xmax-xmin)*(ymax-ymin),-0.5,(xmax-xmin)*(ymax-ymin)-0.5);
|
||||
#ifdef ROOTCLUST
|
||||
delete hs3;
|
||||
hs3=new TH2F("hs3","hs3",2000,-100,3*3*10000,(xmax-xmin)*(ymax-ymin),-0.5,(xmax-xmin)*(ymax-ymin)-0.5);
|
||||
delete hs5;
|
||||
hs5=new TH2F("hs5","hs5",2000,-100,5*5*10000,(xmax-xmin)*(ymax-ymin),-0.5,(xmax-xmin)*(ymax-ymin)-0.5);
|
||||
delete hs7;
|
||||
hs7=new TH2F("hs7","hs7",2000,-100,7*7*10000,(xmax-xmin)*(ymax-ymin),-0.5,(xmax-xmin)*(ymax-ymin)-0.5);
|
||||
delete hs9;
|
||||
hs9=new TH2F("hs9","hs9",2000,-100,9*9*10000,(xmax-xmin)*(ymax-ymin),-0.5,(xmax-xmin)*(ymax-ymin)-0.5);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
};
|
||||
/**
|
||||
@ -608,7 +772,7 @@ template <class dataType> class analogDetector {
|
||||
*/
|
||||
|
||||
|
||||
virtual void addToPedestal(char *data, int ix, int iy=0) {
|
||||
virtual void addToPedestal(char *data, int ix, int iy=0, int cm=0) {
|
||||
|
||||
|
||||
double val;
|
||||
@ -619,7 +783,15 @@ template <class dataType> class analogDetector {
|
||||
else
|
||||
val=((double*)data)[iy*nx+ix];
|
||||
|
||||
/* if (ix==10 && iy==10) */
|
||||
/* cout << ix << " " << iy << " " << val ; */
|
||||
/* if (ix==100 && iy==100) */
|
||||
/* cout << ix << " " << iy << " " << val; */
|
||||
addToPedestal(val,ix,iy);
|
||||
/* if (ix==10 && iy==10) */
|
||||
/* cout <<" " << getPedestal(ix,iy)<< endl; */
|
||||
/* if (ix==100 && iy==100) */
|
||||
/* cout << " " << getPedestal(ix,iy)<< endl; */
|
||||
}
|
||||
return ;
|
||||
|
||||
@ -631,19 +803,19 @@ template <class dataType> class analogDetector {
|
||||
\param data pointer to the data
|
||||
\param val pointer where the pedestal subtracted data should be added. If NULL, the internal image is used
|
||||
\returns pointer to the pedestal subtracted data
|
||||
*/
|
||||
|
||||
|
||||
virtual double *subtractPedestal(char *data, double *val=NULL) {
|
||||
*/
|
||||
// virtual int *subtractPedestal(char *data, int *val=NULL) {
|
||||
|
||||
virtual int *subtractPedestal(char *data, int *val=NULL, int cm=0) {
|
||||
|
||||
newFrame();
|
||||
|
||||
|
||||
if (val==NULL)
|
||||
val=new double[nx*ny];
|
||||
|
||||
val=image;//new double[nx*ny];
|
||||
|
||||
for (int ix=xmin; ix<xmax; ix++) {
|
||||
for (int iy=ymin; iy<ymax; iy++) {
|
||||
val[iy*nx+ix]+=subtractPedestal(data, ix, iy);
|
||||
val[iy*nx+ix]+=subtractPedestal(data, ix, iy,cm);
|
||||
}
|
||||
}
|
||||
return val;
|
||||
@ -662,8 +834,9 @@ template <class dataType> class analogDetector {
|
||||
|
||||
|
||||
|
||||
virtual double subtractPedestal(char *data, int ix, int iy=0) {
|
||||
virtual double subtractPedestal(char *data, int ix, int iy=0, int cm=0) {
|
||||
double g=1.;
|
||||
double val;
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
if (gmap) {
|
||||
g=gmap[iy*nx+ix];
|
||||
@ -671,10 +844,41 @@ template <class dataType> class analogDetector {
|
||||
}
|
||||
|
||||
if (det)
|
||||
return (dataSign*det->getValue(data, ix, iy)-getPedestal(ix,iy))/g;
|
||||
val= (dataSign*det->getValue(data, ix, iy)-getPedestal(ix,iy,cm))/g;
|
||||
else
|
||||
return (((double*)data)[iy*nx+ix]-getPedestal(ix,iy))/g;
|
||||
}
|
||||
val= (((double*)data)[iy*nx+ix]-getPedestal(ix,iy))/g;
|
||||
|
||||
#ifdef ROOTSPECTRUM
|
||||
hs->Fill(val,(iy-ymin)*(xmax-xmin)+(ix-xmin));
|
||||
#ifdef ROOTCLUST
|
||||
double v3=0,v5=0,v7=0,v9=0;
|
||||
for (int iix=-4; iix<5; iix++)
|
||||
for (int iiy=-4; iiy<5; iiy++) {
|
||||
if (det)
|
||||
val= (dataSign*det->getValue(data, ix+iix, iy+iiy)-getPedestal(ix+iix,iy+iiy,cm))/g;
|
||||
else
|
||||
val= (((double*)data)[(iy+iiy)*nx+ix+iix]-getPedestal(ix+iix,iy+iiy,cm))/g;
|
||||
|
||||
if (iix>-4 && iiy>-4 && iix<4 && iiy<4) {
|
||||
if (iix>-3 && iiy>-3 && iix<3 && iiy<3){
|
||||
if (iix>-2 && iiy>-2 && iix<2 && iiy<2){
|
||||
v3+=val;
|
||||
}
|
||||
v5+=val;
|
||||
}
|
||||
v7+=val;
|
||||
}
|
||||
v9+=val;
|
||||
}
|
||||
hs3->Fill(v3,(iy-ymin)*(xmax-xmin)+(ix-xmin));
|
||||
hs5->Fill(v5,(iy-ymin)*(xmax-xmin)+(ix-xmin));
|
||||
hs7->Fill(v7,(iy-ymin)*(xmax-xmin)+(ix-xmin));
|
||||
hs9->Fill(v9,(iy-ymin)*(xmax-xmin)+(ix-xmin));
|
||||
|
||||
#endif
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -703,12 +907,20 @@ template <class dataType> class analogDetector {
|
||||
double v;
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
v=subtractPedestal(data,ix,iy);
|
||||
|
||||
/* // cout << v << " " ; */
|
||||
/* #ifdef ROOTSPECTRUM */
|
||||
/* // cout << (iy-ymin)*(xmax-xmin)+(ix-xmin) << endl; */
|
||||
/* hs->Fill(v,(iy-ymin)*(xmax-xmin)+(ix-xmin)); */
|
||||
/* #endif */
|
||||
if (thr>0) {
|
||||
v+=0.5*thr;
|
||||
nph=v/thr;
|
||||
return nph;
|
||||
} else
|
||||
return v;
|
||||
if (nph>0)
|
||||
return nph;
|
||||
return 0;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
@ -722,15 +934,18 @@ template <class dataType> class analogDetector {
|
||||
int *getNPhotons(char *data, int *nph=NULL) {
|
||||
|
||||
double val;
|
||||
if (nph==NULL)
|
||||
nph=image;
|
||||
newFrame();
|
||||
for (int ix=xmin; ix<xmax; ix++) {
|
||||
for (int iy=ymin; iy<ymax; iy++) {
|
||||
nph[iy*nx+ix]+=getNPhotons(data, ix, iy);
|
||||
if (nph==NULL)
|
||||
nph=image;
|
||||
newFrame();
|
||||
|
||||
addToCommonMode(data);
|
||||
|
||||
for (int ix=xmin; ix<xmax; ix++) {
|
||||
for (int iy=ymin; iy<ymax; iy++) {
|
||||
nph[iy*nx+ix]+=getNPhotons(data, ix, iy);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nph;
|
||||
return nph;
|
||||
|
||||
}
|
||||
|
||||
@ -744,6 +959,23 @@ template <class dataType> class analogDetector {
|
||||
image[iy*nx+ix]=0;
|
||||
}
|
||||
}
|
||||
#ifdef ROOTSPECTRUM
|
||||
//cout << "reset histogram " << endl;
|
||||
if (hs)
|
||||
hs->Reset();
|
||||
#ifdef ROOTCLUST
|
||||
|
||||
if (hs3)
|
||||
hs3->Reset();
|
||||
if (hs5)
|
||||
hs5->Reset();
|
||||
if (hs7)
|
||||
hs7->Reset();
|
||||
if (hs9)
|
||||
hs9->Reset();
|
||||
#endif
|
||||
//cout << "done " << endl;
|
||||
#endif
|
||||
};
|
||||
|
||||
/** sets/gets number of samples for moving average pedestal calculation
|
||||
@ -806,10 +1038,12 @@ template <class dataType> class analogDetector {
|
||||
virtual void processData(char *data,int *val=NULL) {
|
||||
switch(fMode) {
|
||||
case ePedestal:
|
||||
// cout << "ped " << endl;
|
||||
addToPedestal(data);
|
||||
break;
|
||||
default:
|
||||
getNPhotons(data,val);
|
||||
//subtractPedestal(data);
|
||||
getNPhotons(data);
|
||||
}
|
||||
};
|
||||
|
||||
@ -831,13 +1065,13 @@ template <class dataType> class analogDetector {
|
||||
\param f file pointer
|
||||
\returns current file pointer
|
||||
*/
|
||||
FILE *setFilePointer(FILE *f){myFile=f; return myFile;};
|
||||
FILE *setFilePointer(FILE *f){myFile=f; return myFile;};
|
||||
|
||||
/** gets file pointer where to write the clusters to
|
||||
\returns current file pointer
|
||||
*/
|
||||
FILE *getFilePointer(){return myFile;};
|
||||
void setMutex(pthread_mutex_t *m){fm=m;};
|
||||
FILE *getFilePointer(){return myFile;};
|
||||
void setMutex(pthread_mutex_t *m){fm=m;};
|
||||
protected:
|
||||
|
||||
slsDetectorData<dataType> *det; /**< slsDetectorData to be used */
|
||||
@ -859,7 +1093,15 @@ template <class dataType> class analogDetector {
|
||||
// int nSigma; /**< number of sigma to be used for conversion into number of photons if threshold is undefined */
|
||||
frameMode fMode; /**< current detector frame mode */
|
||||
FILE *myFile; /**< file pointer to write to */
|
||||
|
||||
#ifdef ROOTSPECTRUM
|
||||
TH2F *hs;
|
||||
#ifdef ROOTCLUST
|
||||
TH2F *hs3;
|
||||
TH2F *hs5;
|
||||
TH2F *hs7;
|
||||
TH2F *hs9;
|
||||
#endif
|
||||
#endif
|
||||
pthread_mutex_t *fm;
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,9 @@ public:
|
||||
|
||||
|
||||
|
||||
#ifdef BCHIP074_BCHIP075
|
||||
cout << "This is a bchip074-bchip075 system " << endl;
|
||||
#endif
|
||||
|
||||
|
||||
uint16_t **dMask;
|
||||
@ -59,6 +62,11 @@ public:
|
||||
dMap[0][ix] = 1280*2+2*offset+ipix*2;//dataSize-2-ix;//+2*offset;
|
||||
// dMap[0][ix] = 2*ipix+offset*(imod+1)+1280*2*imod;
|
||||
dMask[0][ix] = 0x0;
|
||||
#ifdef BCHIP074_BCHIP075
|
||||
int ibad=ix/2+1280*imod;
|
||||
if ((ibad>=128*4 && ibad<128*5) || (ibad>=9*128 && ibad<10*128) || (ibad>=(1280+128*4) && ibad<ibad>=(1280+128*6)))
|
||||
dataROIMask[0][ix]=0;
|
||||
#endif
|
||||
}
|
||||
|
||||
setDataMap(dMap);
|
||||
@ -78,7 +86,7 @@ public:
|
||||
|
||||
int getFrameNumber(char *buff){if (offset>=sizeof(sls_detector_header)) return ((sls_detector_header*)buff)->frameNumber; return iframe;};//*((int*)(buff+5))&0xffffff;};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
gets the packets number (last packet is labelled with 0 and is replaced with 40)
|
||||
|
@ -0,0 +1,30 @@
|
||||
#ifndef GOTTHARDDOUBLECOMMONMODESUBTRACTION_H
|
||||
#define GOTTHARDDOUBLECOMMONMODESUBTRACTION_H
|
||||
|
||||
|
||||
#include "commonModeSubtractionNew.h"
|
||||
|
||||
class gotthardDoubleModuleCommonModeSubtraction : public commonModeSubtraction {
|
||||
|
||||
/** @short class to calculate the common mode of the pedestals based on an approximated moving average*/
|
||||
|
||||
public:
|
||||
|
||||
/** constructor
|
||||
\param nn number of samples for the moving average to calculate the average common mode
|
||||
\param iroi number of regions on which one can calculate the common mode separately. Defaults to 1 i.e. whole detector
|
||||
|
||||
*/
|
||||
gotthardDoubleModuleCommonModeSubtraction(int ns=3) : commonModeSubtraction(2, ns) {};
|
||||
|
||||
/**
|
||||
gets the common mode ROI for pixel ix, iy
|
||||
*/
|
||||
virtual int getROI(int ix, int iy){return ix%2;};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,215 +0,0 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
//#include <deque>
|
||||
//#include <list>
|
||||
//#include <queue>
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
|
||||
#include "gotthardModuleDataNew.h"
|
||||
#include "gotthardDoubleModuleDataNew.h"
|
||||
|
||||
#include "singlePhotonDetector.h"
|
||||
//#include "interpolatingDetector.h"
|
||||
//#include "linearInterpolation.h"
|
||||
#include "multiThreadedAnalogDetector.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#define NC 1280
|
||||
#define NR 1
|
||||
|
||||
#include "tiffIO.h"
|
||||
|
||||
|
||||
void *gotthardProcessFrame() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (argc < 3 ) {
|
||||
cprintf(RED, "Help: ./trial [receive socket ip] [receive starting port number] [send_socket ip] [send starting port number]\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// receive parameters
|
||||
bool send = false;
|
||||
char* socketip=argv[1];
|
||||
uint32_t portnum = atoi(argv[2]);
|
||||
int size = 32*2*5000;//atoi(argv[3]);
|
||||
|
||||
// send parameters if any
|
||||
char* socketip2 = 0;
|
||||
uint32_t portnum2 = 0;
|
||||
if (argc > 3) {
|
||||
send = true;
|
||||
socketip2 = argv[3];
|
||||
portnum2 = atoi(argv[4]);
|
||||
}
|
||||
cout << "\nrx socket ip : " << socketip <<
|
||||
"\nrx port num : " << portnum ;
|
||||
if (send) {
|
||||
cout << "\nsd socket ip : " << socketip2 <<
|
||||
"\nsd port num : " << portnum2;
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
char fname0[10000], fname1[10000];
|
||||
char fformat[10000];
|
||||
int fifosize=1000;
|
||||
strcpy(fformat,"/external_pool/gotthard_data/datadir_gotthardI/bchip074075/20170731/Xray/xray_15kV_200uA_5us_d%d_f000000000000_0.raw");
|
||||
sprintf(fname0,fformat,0,0);
|
||||
sprintf(fname1,fformat,1,1);
|
||||
|
||||
|
||||
int nthreads=3;
|
||||
|
||||
int nph, nph1;
|
||||
// single_photon_hit clusters[NR*NC];
|
||||
// cout << "hits "<< endl;
|
||||
int etabins=550;
|
||||
double etamin=-1, etamax=2;
|
||||
int nsubpix=1;
|
||||
float *etah=new float[etabins*etabins];
|
||||
// cout << "etah "<< endl;
|
||||
cout << "image size "<< nsubpix*nsubpix*NC*NR << endl;
|
||||
|
||||
int *heta, *himage;
|
||||
|
||||
gotthardModuleDataNew *decoder=new gotthardModuleDataNew();
|
||||
gotthardDoubleModuleDataNew *det=new gotthardDoubleModuleDataNew();
|
||||
// cout << "decoder "<< endl;
|
||||
// etaInterpolationPosXY *interp=new etaInterpolationPosXY(NC, NR, nsubpix, etabins, etamin, etamax);
|
||||
// cout << "interp "<< endl;
|
||||
// linearInterpolation *interp=new linearInterpolation(NC, NR, nsubpix);
|
||||
//noInterpolation *interp=new noInterpolation(NC, NR, nsubpix);
|
||||
// interp->readFlatField("/scratch/eta_100.tiff",etamin,etamax);
|
||||
// interpolatingDetector *filter0=new interpolatingDetector(decoder,interp, 5, 1, 0, 1000, 10);
|
||||
// interpolatingDetector *filter1=new interpolatingDetector(decoder,interp, 5, 1, 0, 1000, 10);
|
||||
//filter->readPedestals("/scratch/ped_100.tiff");
|
||||
//cout << "filter "<< endl;
|
||||
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, 5, 1, 0, 1000, 200);
|
||||
|
||||
filter->setFrameMode(eFrame);
|
||||
|
||||
char *buff;//[2*(48+1280*2)];
|
||||
|
||||
|
||||
char *buff0;
|
||||
char *buff1;
|
||||
|
||||
|
||||
multiThreadedAnalogDetector *mt=new multiThreadedAnalogDetector(filter,nthreads,fifosize);
|
||||
mt->setFrameMode(eFrame);
|
||||
mt->StartThreads();
|
||||
mt->popFree(buff);
|
||||
buff0=buff;
|
||||
buff1=buff+48+1280*2;
|
||||
|
||||
|
||||
int photons[1280*2];
|
||||
|
||||
int nf=0;
|
||||
int ok=0;
|
||||
ifstream filebin0,filebin1;
|
||||
std::time_t end_time;
|
||||
int16_t dout[1280*2];
|
||||
int iFrame=-1;
|
||||
int np=-1;
|
||||
|
||||
nph=0;
|
||||
nph1=0;
|
||||
//int np;
|
||||
int iph;
|
||||
int data_ready=1;
|
||||
int *image;
|
||||
|
||||
// filter->setROI(0,512,0,1);
|
||||
|
||||
filebin0.open((const char *)(fname0), ios::in | ios::binary);
|
||||
filebin1.open((const char *)(fname1), ios::in | ios::binary);
|
||||
if (filebin0.is_open() && filebin1.is_open()) {
|
||||
cout << "Opened file " << fname0<< endl;
|
||||
cout << "Opened file " << fname1<< endl;
|
||||
// mt->setFrameMode(eFrame);
|
||||
// mt->prepareInterpolation(ok);
|
||||
// mt->StartThreads();
|
||||
// mt->popFree(buff);
|
||||
nf=0;
|
||||
iFrame=-1;
|
||||
while ((decoder->readNextFrame(filebin0, iFrame, np, buff0)) && (decoder->readNextFrame(filebin1, iFrame, np, buff1))) {
|
||||
//filter->processData(buff, photons);
|
||||
// cout << nf << " " << decoder->getFrameNumber(buff0) << " " << decoder->getFrameNumber(buff1) << " " << filter->getPhFrame() << " " << filter->getPhTot() << endl;
|
||||
// for (int i=0; i<1280*2; i++) {
|
||||
// filter->addToPedestal(buff,i,0);
|
||||
// dout[i]=filter->subtractPedestal(buff,i,0);
|
||||
// if (nf>10 && i<512)
|
||||
// if (i%2)
|
||||
// cout << nf << " " << i << " " << filter->getPedestal(i,0) << " " << det->getValue(buff,i,0) << " " << decoder->getValue(buff1,1280-1-i/2,0)<< " " << dout[i] << endl;
|
||||
// else
|
||||
// cout << nf << " " << i << " " << filter->getPedestal(i,0) << " " << det->getValue(buff,i,0) << " " << decoder->getValue(buff0,i/2,0)<< " " << dout[i] << endl;
|
||||
|
||||
// }
|
||||
mt->pushData(buff);
|
||||
mt->nextThread();
|
||||
mt->popFree(buff);
|
||||
buff0=buff;
|
||||
buff1=buff+48+1280*2;
|
||||
|
||||
nf++;
|
||||
|
||||
// cout << id << " " << nf << endl;
|
||||
if (nf%10000==0) {
|
||||
while (mt->isBusy()) {;}
|
||||
image=filter->getImage();
|
||||
if (image) {
|
||||
cout << nf << "*****************" << endl;
|
||||
for (int i=0; i<512; i++) {
|
||||
cout << image[i] << "\t";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
filter->clearImage();
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << " " << nf << endl;
|
||||
}
|
||||
iFrame=-1;
|
||||
}
|
||||
|
||||
filebin0.close();
|
||||
filebin1.close();
|
||||
}
|
||||
else
|
||||
cout << "Could not open file " << fname0<< " or " << fname1 << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
|
||||
gotthardProcessFrame();
|
||||
|
||||
}
|
@ -14,8 +14,11 @@
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
|
||||
//#define BCHIP074_BCHIP075
|
||||
|
||||
#include "gotthardModuleDataNew.h"
|
||||
#include "gotthardDoubleModuleDataNew.h"
|
||||
#include "gotthardDoubleModuleCommonModeSubtractionNew.h"
|
||||
|
||||
#include "singlePhotonDetector.h"
|
||||
//#include "interpolatingDetector.h"
|
||||
@ -27,8 +30,7 @@
|
||||
#define NC 1280
|
||||
#define NR 1
|
||||
|
||||
#include "tiffIO.h"
|
||||
|
||||
//#include "tiffIO.h"
|
||||
|
||||
|
||||
|
||||
@ -40,19 +42,6 @@ int main(int argc, char *argv[]){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int fifosize=1000;
|
||||
int nthreads=1;
|
||||
int nph, nph1;
|
||||
@ -69,16 +58,22 @@ int main(int argc, char *argv[]){
|
||||
offset=48;
|
||||
#endif
|
||||
|
||||
//commonModeSubtraction *cm=NULL;
|
||||
|
||||
gotthardDoubleModuleCommonModeSubtraction *cm=new gotthardDoubleModuleCommonModeSubtraction();
|
||||
gotthardModuleDataNew *decoder=new gotthardModuleDataNew();
|
||||
gotthardDoubleModuleDataNew *det=new gotthardDoubleModuleDataNew(offset);
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, 5, 1, 0, 1000, 100);
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, 5, 1, cm, 1000, 100);
|
||||
// analogDetector<uint16_t> *filter=new analogDetector<uint16_t>(det, 1, cm, 1000);
|
||||
// analogDetector<uint16_t> *filter_nocm=new analogDetector<uint16_t>(det, 1, NULL, 1000);
|
||||
filter->setROI(0,2560,0,1);
|
||||
char *buff;//[2*(48+1280*2)];
|
||||
char *buff0;
|
||||
char *buff1;
|
||||
multiThreadedAnalogDetector *mt=new multiThreadedAnalogDetector(filter,nthreads,fifosize);
|
||||
mt->setFrameMode(eFrame);
|
||||
// mt->setFrameMode(eFrame);
|
||||
// mt->setFrameMode(ePedestal);
|
||||
mt->StartThreads();
|
||||
mt->popFree(buff);
|
||||
buff0=buff;
|
||||
@ -210,7 +205,8 @@ int main(int argc, char *argv[]){
|
||||
string filename0 = "";
|
||||
|
||||
|
||||
|
||||
int eoa0=0;
|
||||
int eoa1=0;
|
||||
|
||||
|
||||
|
||||
@ -230,7 +226,9 @@ int main(int argc, char *argv[]){
|
||||
|
||||
|
||||
char ofname[10000];
|
||||
char fn0[10000], fn1[10000];
|
||||
FILE *fout=NULL;
|
||||
FILE *fclust=NULL;
|
||||
for (int i=0; i<nnx; i++)
|
||||
dout[i]=0;
|
||||
char fname0[10000], fname1[10000];
|
||||
@ -279,89 +277,204 @@ int main(int argc, char *argv[]){
|
||||
int end_of_acquisition;
|
||||
while(1) {
|
||||
end_of_acquisition=0;
|
||||
eoa0=0;
|
||||
eoa1=0;
|
||||
|
||||
// cout << "Receive header " << nf << endl;
|
||||
if (!zmqsocket0->ReceiveHeader(0, acqIndex0, frameIndex0, subframeIndex0, filename0, fileindex0)) {
|
||||
|
||||
cout << "************************************************************************** packet0!*****************************"<< endl;
|
||||
|
||||
// cout << "************************************************************************** packet0!*****************************"<< endl;
|
||||
eoa0=1;
|
||||
end_of_acquisition++;
|
||||
}
|
||||
if (!zmqsocket1->ReceiveHeader(0, acqIndex1, frameIndex1, subframeIndex1, filename1, fileindex1)) {
|
||||
cout << "************************************************************************** packet1!*****************************"<< endl;
|
||||
|
||||
//cout << "************************************************************************** packet1!*****************************"<< endl;
|
||||
eoa1=1;
|
||||
end_of_acquisition++;
|
||||
}
|
||||
|
||||
// if ((!zmqsocket0->ReceiveHeader(0, acqIndex0, frameIndex0, subframeIndex0, filename0, fileindex0)) && (!zmqsocket1->ReceiveHeader(0, acqIndex1, frameIndex1, subframeIndex1, filename1, fileindex1))){
|
||||
if (end_of_acquisition) {
|
||||
cout << "************************************************************************** END OF FRAME" << end_of_acquisition << " !*****************************"<< endl;
|
||||
// return 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if ((!zmqsocket0->ReceiveHeader(0, acqIndex0, frameIndex0, subframeIndex0, filename0, fileindex0)) && (!zmqsocket1->ReceiveHeader(0, acqIndex1, frameIndex1, subframeIndex1, filename1, fileindex1))){
|
||||
if (end_of_acquisition==0) {
|
||||
|
||||
if (acqIndex0!=acqIndex1)
|
||||
cout << "different acquisition indexes " << acqIndex0 << " and " << acqIndex1 << endl;
|
||||
if (frameIndex0!=frameIndex1)
|
||||
cout << "different frame indexes " << frameIndex0 << " and " << frameIndex1 << endl;
|
||||
|
||||
|
||||
while (frameIndex0<frameIndex1) {
|
||||
cout << "aligning det 0 " << endl;
|
||||
length = zmqsocket0->ReceiveData(0, buff0, size/2);
|
||||
if (!zmqsocket0->ReceiveHeader(0, acqIndex0, frameIndex0, subframeIndex0, filename0, fileindex0)) {
|
||||
end_of_acquisition++;
|
||||
eoa0=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (frameIndex1<frameIndex0) {
|
||||
cout << "aligning det 1 " << endl;
|
||||
length = zmqsocket1->ReceiveData(0, buff1, size/2);
|
||||
if (!zmqsocket1->ReceiveHeader(0, acqIndex1, frameIndex1, subframeIndex1, filename1, fileindex1)) {
|
||||
end_of_acquisition++;
|
||||
eoa1=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (eoa0!=eoa1) {
|
||||
|
||||
while (eoa0<1) {
|
||||
length = zmqsocket0->ReceiveData(0, buff0, size/2);
|
||||
if (!zmqsocket0->ReceiveHeader(0, acqIndex0, frameIndex0, subframeIndex0, filename0, fileindex0)) {
|
||||
end_of_acquisition++;
|
||||
eoa0=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (eoa1<1) {
|
||||
length = zmqsocket1->ReceiveData(0, buff1, size/2);
|
||||
if (!zmqsocket1->ReceiveHeader(0, acqIndex1, frameIndex1, subframeIndex1, filename1, fileindex1)) {
|
||||
end_of_acquisition++;
|
||||
eoa1=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (end_of_acquisition) {
|
||||
// cout << "************************************************************************** END OF FRAME" << end_of_acquisition << " !*****************************"<< endl;
|
||||
// return 0;
|
||||
|
||||
sprintf(ofname,"%s_%d.ph",fn0,irun);
|
||||
while (mt->isBusy()) {;}
|
||||
image=filter->getImage();
|
||||
if (image) {
|
||||
//fout=fopen(ofname,"w");
|
||||
cout << nf << "*****************" << endl;
|
||||
fout=fopen(ofname,"w");
|
||||
cout << nf << "*****************" << endl;
|
||||
for (int i=0; i<2560; i++) {
|
||||
// // fprintf(fout,"%d %d\n",i,image[i]);
|
||||
dout[i]=image[i];
|
||||
fprintf(fout,"%d %d\n",i,image[i]);
|
||||
dout[i]=image[i];
|
||||
if (dout[i]<0)
|
||||
dout[i]=0;
|
||||
}
|
||||
// // fclose(fout);;
|
||||
fclose(fout);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (send) {
|
||||
strcpy(fname0,filename0.c_str());
|
||||
strcpy(fname1,filename1.c_str());
|
||||
// zmqsocket2->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,16,fileindex,400,400,400*400, acqIndex,frameIndex,fname, acqIndex, 0,0,0,0,0,0,0,0,0,0,0,1);
|
||||
zmqsocket2->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,0,0,0,0,0, 0,0,fname0, 0, 0,0,0,0,0,0,0,0,0,0,0,1);
|
||||
zmqsocket3->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,0,0,0,0,0, 0,0,fname1, 0, 0,0,0,0,0,0,0,0,0,0,0,1);
|
||||
|
||||
zmqsocket2->SendData((char*)dout,size/2);
|
||||
zmqsocket3->SendData(((char*)dout)+size/2,size/2);
|
||||
// cprintf(GREEN, "Sent Data\n");
|
||||
|
||||
|
||||
zmqsocket2->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,0,0,0,0,0, 0,0,fn0, 0, 0,0,0,0,0,0,0,0,0,0,0,1);
|
||||
zmqsocket3->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,0,0,0,0,0, 0,0,fn1, 0, 0,0,0,0,0,0,0,0,0,0,0,1);
|
||||
|
||||
zmqsocket2->SendData((char*)dout,size/2);
|
||||
zmqsocket3->SendData(((char*)dout)+size/2,size/2);
|
||||
// // cprintf(GREEN, "Sent Data\n");
|
||||
|
||||
|
||||
zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
|
||||
zmqsocket3->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
|
||||
|
||||
cprintf(RED, "Received %d frames\n", nf);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//mt->setFrameMode(eFrame);
|
||||
filter->clearImage();
|
||||
// std::time(&end_time);
|
||||
// cout << std::ctime(&end_time) << " " << nf << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
fclose(fclust);
|
||||
fclust=NULL;
|
||||
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
if (acqIndex0!=acqIndex1)
|
||||
cout << "different acquisition indexes " << acqIndex0 << " and " << acqIndex1 << endl;
|
||||
if (frameIndex0!=frameIndex1)
|
||||
cout << "different frame indexes " << frameIndex0 << " and " << frameIndex1 << endl;
|
||||
|
||||
if (fclust==NULL) {
|
||||
|
||||
strcpy(fn0,filename0.c_str());
|
||||
strcpy(fn1,filename1.c_str());
|
||||
sprintf(ofname,"%s_%d.clust",fn0,irun);
|
||||
fclust=fopen(ofname,"w");
|
||||
while (mt->isBusy()) {;}
|
||||
mt->setFilePointer(fclust);
|
||||
}
|
||||
|
||||
// strcpy(fn0,filename0.c_str());
|
||||
// strcpy(fn1,filename1.c_str());
|
||||
|
||||
// cout << "Receive data " << nf << endl;
|
||||
length = zmqsocket0->ReceiveData(0, buff0, size/2);
|
||||
length += zmqsocket1->ReceiveData(0, buff1, size/2);
|
||||
|
||||
|
||||
irun=fileindex0;
|
||||
sprintf(ofname,"%s_%d.ph",filename0.c_str(),fileindex0);
|
||||
|
||||
|
||||
|
||||
// // if (nf>100)
|
||||
// // mt->setFrameMode(eFrame);
|
||||
// //filter->clearImage();
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
mt->pushData(buff);
|
||||
mt->nextThread();
|
||||
// cout << "==" << nf << endl;
|
||||
|
||||
// while (mt->isBusy()) {;}
|
||||
// image=filter->getImage();
|
||||
// if (image) {
|
||||
// for (int i=0; i<2560; i++) {
|
||||
// // if (i<512)
|
||||
|
||||
// // fprintf(fout,"%d %d\n",i,image[i]);
|
||||
// dout[i]=filter->subtractPedestal(buff,i,0,1);//image[i];//filter->getPedestal(i,0);//
|
||||
// if (dout[i]<0)
|
||||
// dout[i]=0;
|
||||
// // cout << i << " " << image[i] << " " << dout[i] << endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// if (send) {
|
||||
// strcpy(fname0,filename0.c_str());
|
||||
// strcpy(fname1,filename1.c_str());
|
||||
// // zmqsocket2->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,16,fileindex,400,400,400*400, acqIndex,frameIndex,fname, acqIndex, 0,0,0,0,0,0,0,0,0,0,0,1);
|
||||
// zmqsocket2->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,0,0,0,0,0, 0,0,fname0, 0, 0,0,0,0,0,0,0,0,0,0,0,1);
|
||||
// zmqsocket3->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,0,0,0,0,0, 0,0,fname1, 0, 0,0,0,0,0,0,0,0,0,0,0,1);
|
||||
|
||||
// zmqsocket2->SendData((char*)dout,size/2);
|
||||
// zmqsocket3->SendData(((char*)dout)+size/2,size/2);
|
||||
// // cprintf(GREEN, "Sent Data\n");
|
||||
|
||||
|
||||
// // zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
|
||||
// // zmqsocket3->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
|
||||
|
||||
// // cprintf(RED, "Received %d frames\n", nf);
|
||||
|
||||
// }
|
||||
|
||||
|
||||
mt->popFree(buff);
|
||||
buff0=buff;
|
||||
buff1=buff+offset*2+1280*2;
|
||||
|
||||
|
||||
|
||||
nf++;
|
||||
|
||||
|
||||
@ -370,6 +483,8 @@ int main(int argc, char *argv[]){
|
||||
#ifndef ZMQ
|
||||
|
||||
|
||||
|
||||
|
||||
while (mt->isBusy()) {;}
|
||||
image=filter->getImage();
|
||||
if (image) {
|
||||
@ -378,7 +493,7 @@ int main(int argc, char *argv[]){
|
||||
for (int i=0; i<512; i++) {
|
||||
fprintf(fout,"%d %d\n",i,image[i]);
|
||||
}
|
||||
fclose(fout);;
|
||||
fclose(fout);
|
||||
}
|
||||
filter->clearImage();
|
||||
|
||||
|
436
slsDetectorCalibration/interpolations/eta2InterpolationBase.h
Normal file
436
slsDetectorCalibration/interpolations/eta2InterpolationBase.h
Normal file
@ -0,0 +1,436 @@
|
||||
#ifndef ETA2_INTERPOLATION_BASE_H
|
||||
#define ETA2_INTERPOLATION_BASE_H
|
||||
|
||||
#ifdef MYROOT1
|
||||
#include <TObject.h>
|
||||
#include <TTree.h>
|
||||
#include <TH2D.h>
|
||||
#include <TH2F.h>
|
||||
#endif
|
||||
|
||||
#include "etaInterpolationBase.h"
|
||||
|
||||
class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
|
||||
public:
|
||||
eta2InterpolationBase(int nx=400, int ny=400, int ns=25, int nb=-1, double emin=1, double emax=0) : etaInterpolationBase(nx,ny, ns, nb, emin, emax) {
|
||||
// cout << "e2ib " << nb << " " << emin << " " << emax << endl;
|
||||
|
||||
if (nbeta<=0) {
|
||||
nbeta=nSubPixels*10;
|
||||
}
|
||||
if (etamin>=etamax) {
|
||||
etamin=-1;
|
||||
etamax=2;
|
||||
cout << ":" <<endl;
|
||||
}
|
||||
etastep=(etamax-etamin)/nbeta;
|
||||
#ifdef MYROOT1
|
||||
delete heta;
|
||||
delete hhx;
|
||||
delete hhy;
|
||||
heta=new TH2D("heta","heta",nbeta,etamin,etamax,nbeta,etamin,etamax);
|
||||
hhx=new TH2D("hhx","hhx",nbeta,etamin,etamax,nbeta,etamin,etamax);
|
||||
hhy=new TH2D("hhy","hhy",nbeta,etamin,etamax,nbeta,etamin,etamax);
|
||||
#endif
|
||||
#ifndef MYROOT1
|
||||
delete [] heta;
|
||||
delete [] hhx;
|
||||
delete [] hhy;
|
||||
heta=new int[nbeta*nbeta];
|
||||
hhx=new float[nbeta*nbeta];
|
||||
hhy=new float[nbeta*nbeta];
|
||||
|
||||
#endif
|
||||
|
||||
// cout << nbeta << " " << etamin << " " << etamax << endl;
|
||||
};
|
||||
|
||||
eta2InterpolationBase(eta2InterpolationBase *orig): etaInterpolationBase(orig){ };
|
||||
|
||||
virtual eta2InterpolationBase* Clone()=0;/* {
|
||||
|
||||
return new eta2InterpolationBase(this);
|
||||
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////// /*It return position hit for the event in input */ //////////////
|
||||
virtual void getInterpolatedPosition(int x, int y, int *data, double &int_x, double &int_y)
|
||||
{
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
double etax,etay;
|
||||
|
||||
int corner;
|
||||
corner=calcQuad(data, tot, totquad, sDum);
|
||||
if (nSubPixels>2)
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double *data, double &int_x, double &int_y)
|
||||
{
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
double etax,etay;
|
||||
|
||||
int corner;
|
||||
corner=calcQuad(data, tot, totquad, sDum);
|
||||
if (nSubPixels>2)
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,double *cl,double &int_x, double &int_y) {
|
||||
|
||||
double cc[2][2];
|
||||
double *cluster[3];
|
||||
int xoff, yoff;
|
||||
cluster[0]=cl;
|
||||
cluster[1]=cl+3;
|
||||
cluster[2]=cl+6;
|
||||
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
xoff=0;
|
||||
yoff=0;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
xoff=1;
|
||||
yoff=0;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
xoff=0;
|
||||
yoff=1;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
xoff=1;
|
||||
yoff=1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
double etax, etay;
|
||||
if (nSubPixels>2) {
|
||||
cc[0][0]=cluster[yoff][xoff];
|
||||
cc[1][0]=cluster[yoff+1][xoff];
|
||||
cc[0][1]=cluster[yoff][xoff+1];
|
||||
cc[1][1]=cluster[yoff+1][xoff+1];
|
||||
calcEta(totquad,cc,etax,etay);
|
||||
}
|
||||
return getInterpolatedPosition(x,y,etax, etay,quad,int_x,int_y);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,int *cl,double &int_x, double &int_y) {
|
||||
|
||||
double cc[2][2];
|
||||
int *cluster[3];
|
||||
int xoff, yoff;
|
||||
cluster[0]=cl;
|
||||
cluster[1]=cl+3;
|
||||
cluster[2]=cl+6;
|
||||
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
xoff=0;
|
||||
yoff=0;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
xoff=1;
|
||||
yoff=0;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
xoff=0;
|
||||
yoff=1;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
xoff=1;
|
||||
yoff=1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
double etax, etay;
|
||||
if (nSubPixels>2) {
|
||||
cc[0][0]=cluster[yoff][xoff];
|
||||
cc[1][0]=cluster[yoff+1][xoff];
|
||||
cc[0][1]=cluster[yoff][xoff+1];
|
||||
cc[1][1]=cluster[yoff+1][xoff+1];
|
||||
calcEta(totquad,cc,etax,etay);
|
||||
}
|
||||
return getInterpolatedPosition(x,y,etax, etay,quad,int_x,int_y);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double etax, double etay, int corner, double &int_x, double &int_y)
|
||||
{
|
||||
|
||||
|
||||
double xpos_eta=0,ypos_eta=0;
|
||||
double dX,dY;
|
||||
int ex,ey;
|
||||
switch (corner)
|
||||
{
|
||||
case TOP_LEFT:
|
||||
dX=-1.;
|
||||
dY=0;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
;
|
||||
dX=0;
|
||||
dY=0;
|
||||
break;
|
||||
case BOTTOM_LEFT:
|
||||
dX=-1.;
|
||||
dY=-1.;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
dX=0;
|
||||
dY=-1.;
|
||||
break;
|
||||
default:
|
||||
cout << "bad quadrant" << endl;
|
||||
dX=0.;
|
||||
dY=0.;
|
||||
}
|
||||
|
||||
|
||||
if (nSubPixels>2) {
|
||||
|
||||
#ifdef MYROOT1
|
||||
xpos_eta=(hhx->GetBinContent(hhx->GetXaxis()->FindBin(etax),hhy->GetYaxis()->FindBin(etay)))/((double)nSubPixels);
|
||||
ypos_eta=(hhy->GetBinContent(hhx->GetXaxis()->FindBin(etax),hhy->GetYaxis()->FindBin(etay)))/((double)nSubPixels);
|
||||
#endif
|
||||
#ifndef MYROOT1
|
||||
ex=(etax-etamin)/etastep;
|
||||
ey=(etay-etamin)/etastep;
|
||||
if (ex<0) {
|
||||
cout << "x*"<< ex << endl;
|
||||
ex=0;
|
||||
}
|
||||
if (ex>=nbeta) {
|
||||
cout << "x?"<< ex << endl;
|
||||
ex=nbeta-1;
|
||||
|
||||
}
|
||||
if (ey<0) {
|
||||
cout << "y*"<< ey << endl;
|
||||
ey=0;
|
||||
}
|
||||
if (ey>=nbeta) {
|
||||
cout << "y?"<< ey << endl;
|
||||
ey=nbeta-1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
xpos_eta=(((double)hhx[(ey*nbeta+ex)]))+dX ;///((double)nSubPixels);
|
||||
ypos_eta=(((double)hhy[(ey*nbeta+ex)]))+dY ;///((double)nSubPixels);
|
||||
//else
|
||||
//return 0;
|
||||
|
||||
#endif
|
||||
} else {
|
||||
xpos_eta=0.5*dX+0.25;
|
||||
ypos_eta=0.5*dY+0.25;
|
||||
}
|
||||
|
||||
int_x=((double)x) + xpos_eta+0.5;
|
||||
int_y=((double)y) + ypos_eta+0.5;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual int addToFlatField(double totquad,int quad,int *cl,double &etax, double &etay) {
|
||||
double cc[2][2];
|
||||
int *cluster[3];
|
||||
int xoff, yoff;
|
||||
cluster[0]=cl;
|
||||
cluster[1]=cl+3;
|
||||
cluster[2]=cl+6;
|
||||
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
xoff=0;
|
||||
yoff=0;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
xoff=1;
|
||||
yoff=0;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
xoff=0;
|
||||
yoff=1;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
xoff=1;
|
||||
yoff=1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
cc[0][0]=cluster[yoff][xoff];
|
||||
cc[1][0]=cluster[yoff+1][xoff];
|
||||
cc[0][1]=cluster[yoff][xoff+1];
|
||||
cc[1][1]=cluster[yoff+1][xoff+1];
|
||||
|
||||
/* cout << cl[0] << " " << cl[1] << " " << cl[2] << endl; */
|
||||
/* cout << cl[3] << " " << cl[4] << " " << cl[5] << endl; */
|
||||
/* cout << cl[6] << " " << cl[7] << " " << cl[8] << endl; */
|
||||
/* cout <<"******"<<totquad << " " << quad << endl; */
|
||||
/* cout << cc[0][0]<< " " << cc[0][1] << endl; */
|
||||
/* cout << cc[1][0]<< " " << cc[1][1] << endl; */
|
||||
//calcMyEta(totquad,quad,cl,etax, etay);
|
||||
calcEta(totquad, cc,etax, etay);
|
||||
|
||||
// cout <<"******"<< etax << " " << etay << endl;
|
||||
|
||||
|
||||
return addToFlatField(etax,etay);
|
||||
}
|
||||
|
||||
virtual int addToFlatField(double totquad,int quad,double *cl,double &etax, double &etay) {
|
||||
double cc[2][2];
|
||||
double *cluster[3];
|
||||
int xoff, yoff;
|
||||
cluster[0]=cl;
|
||||
cluster[1]=cl+3;
|
||||
cluster[2]=cl+6;
|
||||
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
xoff=0;
|
||||
yoff=0;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
xoff=1;
|
||||
yoff=0;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
xoff=0;
|
||||
yoff=1;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
xoff=1;
|
||||
yoff=1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
cc[0][0]=cluster[yoff][xoff];
|
||||
cc[1][0]=cluster[yoff+1][xoff];
|
||||
cc[0][1]=cluster[yoff][xoff+1];
|
||||
cc[1][1]=cluster[yoff+1][xoff+1];
|
||||
|
||||
/* cout << cl[0] << " " << cl[1] << " " << cl[2] << endl; */
|
||||
/* cout << cl[3] << " " << cl[4] << " " << cl[5] << endl; */
|
||||
/* cout << cl[6] << " " << cl[7] << " " << cl[8] << endl; */
|
||||
/* cout <<"******"<<totquad << " " << quad << endl; */
|
||||
/* cout << cc[0][0]<< " " << cc[0][1] << endl; */
|
||||
/* cout << cc[1][0]<< " " << cc[1][1] << endl; */
|
||||
//calcMyEta(totquad,quad,cl,etax, etay);
|
||||
calcEta(totquad, cc,etax, etay);
|
||||
|
||||
// cout <<"******"<< etax << " " << etay << endl;
|
||||
|
||||
|
||||
return addToFlatField(etax,etay);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
virtual int addToFlatField(double *cluster, double &etax, double &etay){
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
int corner;
|
||||
corner=calcQuad(cluster, tot, totquad, sDum);
|
||||
|
||||
double xpos_eta,ypos_eta;
|
||||
double dX,dY;
|
||||
|
||||
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
|
||||
return addToFlatField(etax,etay);
|
||||
|
||||
};
|
||||
|
||||
virtual int addToFlatField(int *cluster, double &etax, double &etay){
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
int corner;
|
||||
corner=calcQuad(cluster, tot, totquad, sDum);
|
||||
|
||||
double xpos_eta,ypos_eta;
|
||||
double dX,dY;
|
||||
|
||||
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
|
||||
return addToFlatField(etax,etay);
|
||||
|
||||
};
|
||||
|
||||
|
||||
virtual int addToFlatField(double etax, double etay){
|
||||
#ifdef MYROOT1
|
||||
heta->Fill(etax,etay);
|
||||
#endif
|
||||
#ifndef MYROOT1
|
||||
int ex,ey;
|
||||
ex=(etax-etamin)/etastep;
|
||||
ey=(etay-etamin)/etastep;
|
||||
if (ey<nbeta && ex<nbeta && ex>=0 && ey>=0)
|
||||
heta[ey*nbeta+ex]++;
|
||||
#endif
|
||||
return 0;
|
||||
};
|
||||
|
||||
/* protected: */
|
||||
|
||||
/* #ifdef MYROOT1 */
|
||||
/* TH2D *heta; */
|
||||
/* TH2D *hhx; */
|
||||
/* TH2D *hhy; */
|
||||
/* #endif */
|
||||
/* #ifndef MYROOT1 */
|
||||
/* int *heta; */
|
||||
/* float *hhx; */
|
||||
/* float *hhy; */
|
||||
/* #endif */
|
||||
/* int nbeta; */
|
||||
/* double etamin, etamax, etastep; */
|
||||
|
||||
};
|
||||
|
||||
#endif
|
294
slsDetectorCalibration/interpolations/eta3InterpolationBase.h
Normal file
294
slsDetectorCalibration/interpolations/eta3InterpolationBase.h
Normal file
@ -0,0 +1,294 @@
|
||||
#ifndef ETA3_INTERPOLATION_BASE_H
|
||||
#define ETA3_INTERPOLATION_BASE_H
|
||||
|
||||
#ifdef MYROOT1
|
||||
#include <TObject.h>
|
||||
#include <TTree.h>
|
||||
#include <TH2D.h>
|
||||
#include <TH2F.h>
|
||||
#endif
|
||||
|
||||
#include "etaInterpolationBase.h"
|
||||
|
||||
class eta3InterpolationBase : public virtual etaInterpolationBase {
|
||||
|
||||
public:
|
||||
eta3InterpolationBase(int nx=400, int ny=400, int ns=25, int nb=-1, double emin=1, double emax=0) : etaInterpolationBase(nx, ny, ns, nb, emin, emax) {
|
||||
// cout << "e3ib " << nb << " " << emin << " " << emax << endl;
|
||||
if (nbeta<=0) {
|
||||
nbeta=nSubPixels*10;
|
||||
}
|
||||
if (etamin>=etamax) {
|
||||
etamin=-1;
|
||||
etamax=1;
|
||||
}
|
||||
|
||||
etastep=(etamax-etamin)/nbeta;
|
||||
#ifdef MYROOT1
|
||||
delete heta;
|
||||
delete hhx;
|
||||
delete hhy;
|
||||
heta=new TH2D("heta","heta",nbeta,etamin,etamax,nbeta,etamin,etamax);
|
||||
hhx=new TH2D("hhx","hhx",nbeta,etamin,etamax,nbeta,etamin,etamax);
|
||||
hhy=new TH2D("hhy","hhy",nbeta,etamin,etamax,nbeta,etamin,etamax);
|
||||
#endif
|
||||
#ifndef MYROOT1
|
||||
delete [] heta;
|
||||
delete [] hhx;
|
||||
delete [] hhy;
|
||||
|
||||
heta=new int[nbeta*nbeta];
|
||||
hhx=new float[nbeta*nbeta];
|
||||
hhy=new float[nbeta*nbeta];
|
||||
|
||||
#endif
|
||||
// cout << nbeta << " " << etamin << " " << etamax << endl;
|
||||
};
|
||||
|
||||
eta3InterpolationBase(eta3InterpolationBase *orig): etaInterpolationBase(orig){ };
|
||||
|
||||
virtual eta3InterpolationBase* Clone()=0;
|
||||
|
||||
|
||||
|
||||
|
||||
// virtual void prepareInterpolation(int &ok){};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////// /*It return position hit for the event in input */ //////////////
|
||||
virtual void getInterpolatedPosition(int x, int y, int *data, double &int_x, double &int_y)
|
||||
{
|
||||
double tot, totquad;
|
||||
double etax,etay;
|
||||
|
||||
int corner=calcEta3(data,etax,etay, totquad);
|
||||
|
||||
getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double *data, double &int_x, double &int_y)
|
||||
{
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
double etax,etay;
|
||||
|
||||
int corner=calcEta3(data,etax,etay, totquad);
|
||||
|
||||
getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,double *cl,double &int_x, double &int_y) {
|
||||
|
||||
|
||||
double etax, etay;
|
||||
if (nSubPixels>2) {
|
||||
calcEta3(cl,etax,etay, totquad);
|
||||
}
|
||||
return getInterpolatedPosition(x,y,etax, etay,quad,int_x,int_y);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,int *cl,double &int_x, double &int_y) {
|
||||
|
||||
|
||||
double etax, etay;
|
||||
if (nSubPixels>2) {
|
||||
calcEta3(cl,etax,etay, totquad);
|
||||
}
|
||||
return getInterpolatedPosition(x,y,etax, etay,quad,int_x,int_y);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double etax, double etay, int corner, double &int_x, double &int_y)
|
||||
{
|
||||
|
||||
|
||||
double xpos_eta=0,ypos_eta=0;
|
||||
int ex,ey;
|
||||
|
||||
if (nSubPixels>2) {
|
||||
|
||||
#ifdef MYROOT1
|
||||
xpos_eta=(hhx->GetBinContent(hhx->GetXaxis()->FindBin(etax),hhy->GetYaxis()->FindBin(etay)))/((double)nSubPixels);
|
||||
ypos_eta=(hhy->GetBinContent(hhx->GetXaxis()->FindBin(etax),hhy->GetYaxis()->FindBin(etay)))/((double)nSubPixels);
|
||||
#endif
|
||||
#ifndef MYROOT1
|
||||
ex=(etax-etamin)/etastep;
|
||||
ey=(etay-etamin)/etastep;
|
||||
if (ex<0) {
|
||||
/* cout << etax << " " << etamin << " "; */
|
||||
/* cout << "3x*"<< ex << endl; */
|
||||
ex=0;
|
||||
}
|
||||
if (ex>=nbeta) {
|
||||
/* cout << etax << " " << etamin << " "; */
|
||||
/* cout << "3x?"<< ex << endl; */
|
||||
ex=nbeta-1;
|
||||
}
|
||||
if (ey<0) {
|
||||
/* cout << etay << " " << etamin << " "; */
|
||||
/* cout << "3y*"<< ey << endl; */
|
||||
ey=0;
|
||||
}
|
||||
if (ey>=nbeta) {
|
||||
/* cout << etay << " " << etamin << " "; */
|
||||
/* cout << "3y?"<< ey << endl; */
|
||||
ey=nbeta-1;
|
||||
|
||||
}
|
||||
xpos_eta=(((double)hhx[(ey*nbeta+ex)]));///((double)nSubPixels);
|
||||
ypos_eta=(((double)hhy[(ey*nbeta+ex)]));///((double)nSubPixels);
|
||||
|
||||
#endif
|
||||
|
||||
} else {
|
||||
switch (corner) {
|
||||
case BOTTOM_LEFT:
|
||||
xpos_eta=-0.25;
|
||||
ypos_eta=-0.25;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
xpos_eta=0.25;
|
||||
ypos_eta=-0.25;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
xpos_eta=-0.25;
|
||||
ypos_eta=0.25;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
xpos_eta=0.25;
|
||||
ypos_eta=0.25;
|
||||
break;
|
||||
default:
|
||||
xpos_eta=0;
|
||||
ypos_eta=0;
|
||||
}
|
||||
|
||||
}
|
||||
int_x=((double)x) + xpos_eta;
|
||||
int_y=((double)y) + ypos_eta;
|
||||
// int_x=5. + xpos_eta;
|
||||
// int_y=5. + ypos_eta;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ///////////////////////////////////////////////////////////////////////////////////////////////// */
|
||||
/* virtual void getPositionETA3(int x, int y, double *data, double &int_x, double &int_y) */
|
||||
/* { */
|
||||
/* double sDum[2][2]; */
|
||||
/* double tot, totquad; */
|
||||
/* double eta3x,eta3y; */
|
||||
/* double ex,ey; */
|
||||
|
||||
/* calcQuad(data, tot, totquad, sDum); */
|
||||
/* calcEta3(data,eta3x, eta3y,tot); */
|
||||
|
||||
/* double xpos_eta,ypos_eta; */
|
||||
|
||||
/* #ifdef MYROOT1 */
|
||||
/* xpos_eta=((hhx->GetBinContent(hhx->GetXaxis()->FindBin(eta3x),hhy->GetYaxis()->FindBin(eta3y))))/((double)nSubPixels); */
|
||||
/* ypos_eta=((hhy->GetBinContent(hhx->GetXaxis()->FindBin(eta3x),hhy->GetYaxis()->FindBin(eta3y))))/((double)nSubPixels); */
|
||||
|
||||
/* #endif */
|
||||
/* #ifndef MYROOT1 */
|
||||
/* ex=(eta3x-etamin)/etastep; */
|
||||
/* ey=(eta3y-etamin)/etastep; */
|
||||
|
||||
/* if (ex<0) ex=0; */
|
||||
/* if (ex>=nbeta) ex=nbeta-1; */
|
||||
/* if (ey<0) ey=0; */
|
||||
/* if (ey>=nbeta) ey=nbeta-1; */
|
||||
|
||||
/* xpos_eta=(((double)hhx[(int)(ey*nbeta+ex)]))/((double)nSubPixels); */
|
||||
/* ypos_eta=(((double)hhy[(int)(ey*nbeta+ex)]))/((double)nSubPixels); */
|
||||
/* #endif */
|
||||
|
||||
/* int_x=((double)x) + xpos_eta; */
|
||||
/* int_y=((double)y) + ypos_eta; */
|
||||
|
||||
/* return; */
|
||||
/* }; */
|
||||
|
||||
virtual int addToFlatField(double totquad,int quad,int *cl,double &etax, double &etay) {
|
||||
|
||||
calcEta3(cl, etax, etay, totquad);
|
||||
return addToFlatField(etax,etay);
|
||||
}
|
||||
|
||||
virtual int addToFlatField(double totquad,int quad,double *cl,double &etax, double &etay) {
|
||||
|
||||
|
||||
calcEta3(cl, etax, etay, totquad);
|
||||
return addToFlatField(etax,etay);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
virtual int addToFlatField(double *cluster, double &etax, double &etay){
|
||||
double totquad;
|
||||
calcEta3(cluster, etax, etay, totquad);
|
||||
return addToFlatField(etax,etay);
|
||||
|
||||
};
|
||||
|
||||
virtual int addToFlatField(int *cluster, double &etax, double &etay){
|
||||
|
||||
double totquad;
|
||||
|
||||
calcEta3(cluster, etax, etay, totquad);
|
||||
return addToFlatField(etax,etay);
|
||||
|
||||
};
|
||||
|
||||
|
||||
virtual int addToFlatField(double etax, double etay){
|
||||
#ifdef MYROOT1
|
||||
heta->Fill(etax,etay);
|
||||
#endif
|
||||
#ifndef MYROOT1
|
||||
int ex,ey;
|
||||
ex=(etax-etamin)/etastep;
|
||||
ey=(etay-etamin)/etastep;
|
||||
if (ey<nbeta && ex<nbeta && ex>=0 && ey>=0)
|
||||
heta[ey*nbeta+ex]++;
|
||||
#endif
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
/* protected: */
|
||||
|
||||
/* #ifdef MYROOT1 */
|
||||
/* TH2D *heta; */
|
||||
/* TH2D *hhx; */
|
||||
/* TH2D *hhy; */
|
||||
/* #endif */
|
||||
/* #ifndef MYROOT1 */
|
||||
/* int *heta; */
|
||||
/* float *hhx; */
|
||||
/* float *hhy; */
|
||||
/* #endif */
|
||||
/* int nbeta; */
|
||||
/* double etamin, etamax, etastep; */
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -181,53 +181,73 @@ class etaInterpolationAdaptiveBins : public etaInterpolationPosXY {
|
||||
double avg=tot_eta/((double)(nSubPixels*nSubPixels));
|
||||
cout << "total eta entries is :"<< tot_eta << " avg: "<< avg << endl;
|
||||
cout << "Start " << endl;
|
||||
double old_diff=calcDiff(avg, hhx, hhy), new_diff=old_diff+1;
|
||||
cout << " diff= " << new_diff << endl;
|
||||
double old_diff=calcDiff(avg, hhx, hhy), new_diff=old_diff+1, best_diff=old_diff;
|
||||
cout << " diff= " << old_diff << endl;
|
||||
|
||||
|
||||
int iint=0;
|
||||
float *newhhx=new float[nbeta*nbeta]; //profile x
|
||||
float *newhhy=new float[nbeta*nbeta]; //profile y
|
||||
float *besthhx=hhx; //profile x
|
||||
float *besthhy=hhy; //profile y
|
||||
while (iint<nint) {
|
||||
|
||||
cout << "Iteration " << iint << endl;
|
||||
iterate(newhhx,newhhy);
|
||||
new_diff=calcDiff(avg, newhhx, newhhy);
|
||||
cout << " diff= " << new_diff << endl;
|
||||
#ifdef SAVE_ALL
|
||||
for (int ii=0; ii<etabins*etabins; ii++) {
|
||||
etah[ii]=newhhx[ii];
|
||||
if (etah[ii]>1 || etah[ii]<0 ) cout << "***"<< ii << etah[ii] << endl;
|
||||
/* #ifdef SAVE_ALL */
|
||||
/* for (int ii=0; ii<etabins*etabins; ii++) { */
|
||||
/* etah[ii]=newhhx[ii]; */
|
||||
/* if (etah[ii]>1 || etah[ii]<0 ) cout << "***"<< ii << etah[ii] << endl; */
|
||||
|
||||
}
|
||||
sprintf(tit,"/scratch/neweta_hhx_%d.tiff",iint);
|
||||
WriteToTiff(etah, tit, etabins, etabins);
|
||||
/* } */
|
||||
/* sprintf(tit,"/scratch/neweta_hhx_%d.tiff",iint); */
|
||||
/* WriteToTiff(etah, tit, etabins, etabins); */
|
||||
|
||||
for (int ii=0; ii<etabins*etabins; ii++) {
|
||||
etah[ii]=newhhy[ii];
|
||||
if (etah[ii]>1 || etah[ii]<0 ) cout << "***"<< ii << etah[ii] << endl;
|
||||
/* for (int ii=0; ii<etabins*etabins; ii++) { */
|
||||
/* etah[ii]=newhhy[ii]; */
|
||||
/* if (etah[ii]>1 || etah[ii]<0 ) cout << "***"<< ii << etah[ii] << endl; */
|
||||
/* } */
|
||||
/* sprintf(tit,"/scratch/neweta_hhy_%d.tiff",iint); */
|
||||
/* WriteToTiff(etah, tit, etabins, etabins); */
|
||||
/* #endif */
|
||||
if (new_diff<best_diff) {
|
||||
best_diff=new_diff;
|
||||
besthhx=newhhx;
|
||||
besthhy=newhhy;
|
||||
}
|
||||
sprintf(tit,"/scratch/neweta_hhy_%d.tiff",iint);
|
||||
WriteToTiff(etah, tit, etabins, etabins);
|
||||
#endif
|
||||
// if (new_diff<old_diff) {
|
||||
delete [] hhx;
|
||||
delete [] hhy;
|
||||
hhx=newhhx;
|
||||
hhy=newhhy;
|
||||
newhhx=new float[nbeta*nbeta]; //profile x
|
||||
newhhy=new float[nbeta*nbeta]; //profile y
|
||||
old_diff=new_diff;
|
||||
// } /* else { */
|
||||
|
||||
if (hhx!=besthhx)
|
||||
delete [] hhx;
|
||||
if (hhy!=besthhy)
|
||||
delete [] hhy;
|
||||
|
||||
hhx=newhhx;
|
||||
hhy=newhhy;
|
||||
newhhx=new float[nbeta*nbeta]; //profile x
|
||||
newhhy=new float[nbeta*nbeta]; //profile y
|
||||
|
||||
old_diff=new_diff;
|
||||
//} /* else { */
|
||||
/* cout << "Difference not decreasing after "<< iint << " iterations (" << old_diff << " < " << new_diff << ")"<< endl; */
|
||||
/* break; */
|
||||
/* } */
|
||||
|
||||
iint++;
|
||||
|
||||
iint++;
|
||||
}
|
||||
delete [] newhhx;
|
||||
delete [] newhhy;
|
||||
delete [] newhhx;
|
||||
delete [] newhhy;
|
||||
|
||||
if (hhx!=besthhx)
|
||||
delete [] hhx;
|
||||
if (hhy!=besthhy)
|
||||
delete [] hhy;
|
||||
|
||||
hhx=besthhx;
|
||||
hhy=besthhy;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -14,10 +14,16 @@
|
||||
class etaInterpolationBase : public slsInterpolation {
|
||||
|
||||
public:
|
||||
etaInterpolationBase(int nx=400, int ny=400, int ns=25, int nb=-1, double emin=1, double emax=0) : slsInterpolation(nx,ny,ns), hhx(NULL), hhy(NULL), heta(NULL),nbeta(nb),etamin(emin), etamax(emax) {
|
||||
if (nb<=0)
|
||||
nbeta=nSubPixels*10;
|
||||
|
||||
etaInterpolationBase(int nx=400, int ny=400, int ns=25, int nb=-1, double emin=1, double emax=0) : slsInterpolation(nx,ny,ns), hhx(NULL), hhy(NULL), heta(NULL), nbeta(nb), etamin(emin), etamax(emax) {
|
||||
// cout << "eb " << nb << " " << emin << " " << emax << endl;
|
||||
// cout << nb << " " << etamin << " " << etamax << endl;
|
||||
if (nbeta<=0) {
|
||||
cout << "aaa:" <<endl;
|
||||
nbeta=nSubPixels*10;
|
||||
}
|
||||
if (etamin>=etamax) {
|
||||
cout << "aaa:" <<endl;
|
||||
etamin=-1;
|
||||
etamax=2;
|
||||
}
|
||||
@ -34,6 +40,7 @@ class etaInterpolationBase : public slsInterpolation {
|
||||
|
||||
#endif
|
||||
|
||||
//cout << nbeta << " " << etamin << " " << etamax << endl;
|
||||
};
|
||||
|
||||
etaInterpolationBase(etaInterpolationBase *orig): slsInterpolation(orig){
|
||||
@ -60,11 +67,11 @@ class etaInterpolationBase : public slsInterpolation {
|
||||
|
||||
|
||||
};
|
||||
virtual etaInterpolationBase* Clone() {
|
||||
|
||||
virtual etaInterpolationBase* Clone()=0;/*{
|
||||
return new etaInterpolationBase(this);
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -179,8 +186,6 @@ class etaInterpolationBase : public slsInterpolation {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
virtual void prepareInterpolation(int &ok){};
|
||||
|
||||
/* ////////////////////////////////////////////////////////////////////////////// */
|
||||
|
||||
@ -214,277 +219,35 @@ float *gethhx()
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////// /*It return position hit for the event in input */ //////////////
|
||||
virtual void getInterpolatedPosition(int x, int y, double *data, double &int_x, double &int_y)
|
||||
{
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
double etax,etay;
|
||||
|
||||
int corner;
|
||||
corner=calcQuad(data, tot, totquad, sDum);
|
||||
if (nSubPixels>2)
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y);
|
||||
/* virtual void getInterpolatedPosition(int x, int y, int *data, double &int_x, double &int_y)=0; */
|
||||
/* virtual void getInterpolatedPosition(int x, int y, double *data, double &int_x, double &int_y)=0; */
|
||||
/* virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,double *cl,double &int_x, double &int_y)=0; */
|
||||
/* virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,int *cl,double &int_x, double &int_y)=0; */
|
||||
/* virtual void getInterpolatedPosition(int x, int y, double etax, double etay, int corner, double &int_x, double &int_y)=0; */
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
/* virtual int addToFlatField(double totquad,int quad,int *cl,double &etax, double &etay)=0; */
|
||||
/* virtual int addToFlatField(double totquad,int quad,double *cl,double &etax, double &etay)=0; */
|
||||
/* virtual int addToFlatField(double *cluster, double &etax, double &etay)=0; */
|
||||
/* virtual int addToFlatField(int *cluster, double &etax, double &etay)=0; */
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,double *cl,double &int_x, double &int_y) {
|
||||
|
||||
double cc[2][2];
|
||||
double *cluster[3];
|
||||
int xoff, yoff;
|
||||
cluster[0]=cl;
|
||||
cluster[1]=cl+3;
|
||||
cluster[2]=cl+6;
|
||||
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
xoff=0;
|
||||
yoff=0;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
xoff=1;
|
||||
yoff=0;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
xoff=0;
|
||||
yoff=1;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
xoff=1;
|
||||
yoff=1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
double etax, etay;
|
||||
if (nSubPixels>2) {
|
||||
cc[0][0]=cluster[yoff][xoff];
|
||||
cc[1][0]=cluster[yoff+1][xoff];
|
||||
cc[0][1]=cluster[yoff][xoff+1];
|
||||
cc[1][1]=cluster[yoff+1][xoff+1];
|
||||
calcEta(totquad,cc,etax,etay);
|
||||
}
|
||||
return getInterpolatedPosition(x,y,etax, etay,quad,int_x,int_y);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double etax, double etay, int corner, double &int_x, double &int_y)
|
||||
{
|
||||
|
||||
|
||||
double xpos_eta=0,ypos_eta=0;
|
||||
double dX,dY;
|
||||
int ex,ey;
|
||||
switch (corner)
|
||||
{
|
||||
case TOP_LEFT:
|
||||
dX=-1.;
|
||||
dY=0;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
;
|
||||
dX=0;
|
||||
dY=0;
|
||||
break;
|
||||
case BOTTOM_LEFT:
|
||||
dX=-1.;
|
||||
dY=-1.;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
dX=0;
|
||||
dY=-1.;
|
||||
break;
|
||||
default:
|
||||
cout << "bad quadrant" << endl;
|
||||
dX=0.;
|
||||
dY=0.;
|
||||
}
|
||||
|
||||
|
||||
if (nSubPixels>2) {
|
||||
|
||||
#ifdef MYROOT1
|
||||
xpos_eta=(hhx->GetBinContent(hhx->GetXaxis()->FindBin(etax),hhy->GetYaxis()->FindBin(etay)))/((double)nSubPixels);
|
||||
ypos_eta=(hhy->GetBinContent(hhx->GetXaxis()->FindBin(etax),hhy->GetYaxis()->FindBin(etay)))/((double)nSubPixels);
|
||||
#endif
|
||||
#ifndef MYROOT1
|
||||
ex=(etax-etamin)/etastep;
|
||||
ey=(etay-etamin)/etastep;
|
||||
if (ex<0) {
|
||||
ex=0;
|
||||
cout << "x*"<< ex << endl;
|
||||
}
|
||||
if (ex>=nbeta) {
|
||||
ex=nbeta-1;
|
||||
cout << "x?"<< ex << endl;
|
||||
|
||||
}
|
||||
if (ey<0) {
|
||||
ey=0;
|
||||
cout << "y*"<< ey << endl;
|
||||
}
|
||||
if (ey>=nbeta) {
|
||||
ey=nbeta-1;
|
||||
cout << "y?"<< ey << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
xpos_eta=(((double)hhx[(ey*nbeta+ex)]))+dX ;///((double)nSubPixels);
|
||||
ypos_eta=(((double)hhy[(ey*nbeta+ex)]))+dY ;///((double)nSubPixels);
|
||||
//else
|
||||
//return 0;
|
||||
|
||||
#endif
|
||||
} else {
|
||||
xpos_eta=0.5*dX+0.25;
|
||||
ypos_eta=0.5*dY+0.25;
|
||||
}
|
||||
|
||||
int_x=((double)x) + xpos_eta+0.5;
|
||||
int_y=((double)y) + ypos_eta+0.5;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
virtual void getPositionETA3(int x, int y, double *data, double &int_x, double &int_y)
|
||||
{
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
double eta3x,eta3y;
|
||||
double ex,ey;
|
||||
|
||||
calcQuad(data, tot, totquad, sDum);
|
||||
calcEta3(data,eta3x, eta3y,tot);
|
||||
|
||||
double xpos_eta,ypos_eta;
|
||||
|
||||
#ifdef MYROOT1
|
||||
xpos_eta=((hhx->GetBinContent(hhx->GetXaxis()->FindBin(eta3x),hhy->GetYaxis()->FindBin(eta3y))))/((double)nSubPixels);
|
||||
ypos_eta=((hhy->GetBinContent(hhx->GetXaxis()->FindBin(eta3x),hhy->GetYaxis()->FindBin(eta3y))))/((double)nSubPixels);
|
||||
|
||||
#endif
|
||||
#ifndef MYROOT1
|
||||
ex=(eta3x-etamin)/etastep;
|
||||
ey=(eta3y-etamin)/etastep;
|
||||
|
||||
if (ex<0) ex=0;
|
||||
if (ex>=nbeta) ex=nbeta-1;
|
||||
if (ey<0) ey=0;
|
||||
if (ey>=nbeta) ey=nbeta-1;
|
||||
|
||||
xpos_eta=(((double)hhx[(int)(ey*nbeta+ex)]))/((double)nSubPixels);
|
||||
ypos_eta=(((double)hhy[(int)(ey*nbeta+ex)]))/((double)nSubPixels);
|
||||
#endif
|
||||
|
||||
int_x=((double)x) + xpos_eta;
|
||||
int_y=((double)y) + ypos_eta;
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
virtual int addToFlatField(double totquad,int quad,double *cl,double &etax, double &etay) {
|
||||
double cc[2][2];
|
||||
double *cluster[3];
|
||||
int xoff, yoff;
|
||||
cluster[0]=cl;
|
||||
cluster[1]=cl+3;
|
||||
cluster[2]=cl+6;
|
||||
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
xoff=0;
|
||||
yoff=0;
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
xoff=1;
|
||||
yoff=0;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
xoff=0;
|
||||
yoff=1;
|
||||
break;
|
||||
case TOP_RIGHT:
|
||||
xoff=1;
|
||||
yoff=1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
cc[0][0]=cluster[yoff][xoff];
|
||||
cc[1][0]=cluster[yoff+1][xoff];
|
||||
cc[0][1]=cluster[yoff][xoff+1];
|
||||
cc[1][1]=cluster[yoff+1][xoff+1];
|
||||
|
||||
/* cout << cl[0] << " " << cl[1] << " " << cl[2] << endl; */
|
||||
/* cout << cl[3] << " " << cl[4] << " " << cl[5] << endl; */
|
||||
/* cout << cl[6] << " " << cl[7] << " " << cl[8] << endl; */
|
||||
/* cout <<"******"<<totquad << " " << quad << endl; */
|
||||
/* cout << cc[0][0]<< " " << cc[0][1] << endl; */
|
||||
/* cout << cc[1][0]<< " " << cc[1][1] << endl; */
|
||||
//calcMyEta(totquad,quad,cl,etax, etay);
|
||||
calcEta(totquad, cc,etax, etay);
|
||||
|
||||
// cout <<"******"<< etax << " " << etay << endl;
|
||||
|
||||
|
||||
return addToFlatField(etax,etay);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
virtual int addToFlatField(double *cluster, double &etax, double &etay){
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
int corner;
|
||||
corner=calcQuad(cluster, tot, totquad, sDum);
|
||||
|
||||
double xpos_eta,ypos_eta;
|
||||
double dX,dY;
|
||||
|
||||
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
|
||||
return addToFlatField(etax,etay);
|
||||
|
||||
};
|
||||
|
||||
|
||||
virtual int addToFlatField(double etax, double etay){
|
||||
|
||||
int ex,ey;
|
||||
|
||||
#ifdef MYROOT1
|
||||
heta->Fill(etax,etay);
|
||||
#endif
|
||||
#ifndef MYROOT1
|
||||
int ex,ey;
|
||||
ex=(etax-etamin)/etastep;
|
||||
ey=(etay-etamin)/etastep;
|
||||
// cout << etax << " " << ex << " " << etay << " " << ey << " " << ey*nbeta+ex << endl;
|
||||
if (ey<nbeta && ex<nbeta && ex>=0 && ey>=0)
|
||||
heta[ey*nbeta+ex]++;
|
||||
// cout << "*"<< etax << " " << etay << endl;
|
||||
/* cout << etax << " " << etay << " " << ex << " " << ey << " " << ey*nbeta+ex << endl; */
|
||||
/* cout <<"********"<< endl << endl ; */
|
||||
#endif
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// virtual void prepareInterpolation(int &ok)=0;
|
||||
|
||||
protected:
|
||||
|
||||
#ifdef MYROOT1
|
||||
|
@ -2,24 +2,27 @@
|
||||
#define ETA_INTERPOLATION_POSXY_H
|
||||
|
||||
|
||||
#include "tiffIO.h"
|
||||
//#include "tiffIO.h"
|
||||
#include "etaInterpolationBase.h"
|
||||
#include "eta2InterpolationBase.h"
|
||||
#include "eta3InterpolationBase.h"
|
||||
|
||||
class etaInterpolationPosXY : public etaInterpolationBase{
|
||||
class etaInterpolationPosXY : public virtual etaInterpolationBase{
|
||||
public:
|
||||
etaInterpolationPosXY(int nx=400, int ny=400, int ns=25, int nb=-1, double emin=1, double emax=0) : etaInterpolationBase(nx,ny,ns, nb, emin,emax){};
|
||||
etaInterpolationPosXY(int nx=400, int ny=400, int ns=25, int nb=-1, double emin=1, double emax=0) : etaInterpolationBase(nx,ny,ns, nb, emin,emax){
|
||||
// cout << "epxy " << nb << " " << emin << " " << emax << endl; cout << nbeta << " " << etamin << " " << etamax << endl;
|
||||
};
|
||||
|
||||
etaInterpolationPosXY(etaInterpolationPosXY *orig): etaInterpolationBase(orig){};
|
||||
etaInterpolationPosXY(etaInterpolationPosXY *orig): etaInterpolationBase(orig) {};
|
||||
|
||||
virtual etaInterpolationPosXY* Clone() {
|
||||
virtual etaInterpolationPosXY* Clone()=0;/** {
|
||||
|
||||
return new etaInterpolationPosXY(this);
|
||||
|
||||
};
|
||||
};*/
|
||||
|
||||
virtual void prepareInterpolation(int &ok)
|
||||
{
|
||||
cout <<"?"<< endl;
|
||||
ok=1;
|
||||
#ifdef MYROOT1
|
||||
if (hhx) delete hhx;
|
||||
@ -114,10 +117,6 @@ class etaInterpolationPosXY : public etaInterpolationBase{
|
||||
|
||||
// cout << "y " << nbeta << " " << (ii+1)*tot_eta_x*bsize << " " << ii << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#ifdef SAVE_ALL
|
||||
@ -150,4 +149,25 @@ class etaInterpolationPosXY : public etaInterpolationBase{
|
||||
|
||||
};
|
||||
|
||||
class eta2InterpolationPosXY : public virtual eta2InterpolationBase, public virtual etaInterpolationPosXY {
|
||||
public:
|
||||
eta2InterpolationPosXY(int nx=400, int ny=400, int ns=25, int nb=-1, double emin=1, double emax=0) : etaInterpolationBase(nx,ny,ns, nb, emin,emax),eta2InterpolationBase(nx,ny,ns, nb, emin,emax),etaInterpolationPosXY(nx,ny,ns, nb, emin,emax){
|
||||
// cout << "e2pxy " << nb << " " << emin << " " << emax << endl;
|
||||
};
|
||||
eta2InterpolationPosXY(eta2InterpolationPosXY *orig): etaInterpolationBase(orig), etaInterpolationPosXY(orig) {};
|
||||
|
||||
virtual eta2InterpolationPosXY* Clone() { return new eta2InterpolationPosXY(this);};
|
||||
|
||||
};
|
||||
class eta3InterpolationPosXY : public virtual eta3InterpolationBase, public virtual etaInterpolationPosXY {
|
||||
public:
|
||||
eta3InterpolationPosXY(int nx=400, int ny=400, int ns=25, int nb=-1, double emin=1, double emax=0) : etaInterpolationBase(nx,ny,ns, nb, emin,emax),eta3InterpolationBase(nx,ny,ns, nb, emin,emax), etaInterpolationPosXY(nx,ny,ns, nb, emin,emax){
|
||||
cout << "e3pxy " << nbeta << " " << etamin << " " << etamax << " " << nSubPixels<< endl;
|
||||
};
|
||||
|
||||
eta3InterpolationPosXY(eta3InterpolationPosXY *orig): etaInterpolationBase(orig), etaInterpolationPosXY(orig) {};
|
||||
|
||||
virtual eta3InterpolationPosXY* Clone() { return new eta3InterpolationPosXY(this);};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,417 @@
|
||||
#ifndef ETA_INTERPOLATION_RANDOMBINS_H
|
||||
#define ETA_INTERPOLATION_RANDOMBINS_H
|
||||
|
||||
|
||||
#include "tiffIO.h"
|
||||
//#include "etaInterpolationBase.h"
|
||||
#include "etaInterpolationPosXY.h"
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
//#include <math>
|
||||
#include <cmath> // std::abs
|
||||
|
||||
#define PI 3.14159265
|
||||
#define TWOPI 2.*PI
|
||||
|
||||
using namespace std;
|
||||
|
||||
class etaInterpolationRandomBins : public etaInterpolationPosXY {
|
||||
|
||||
private:
|
||||
double calcDiff(double avg, float *hx, float *hy) {
|
||||
double p_tot=0;
|
||||
double diff=0;
|
||||
double bsize=1./nSubPixels;
|
||||
|
||||
for (int ipx=0; ipx<nSubPixels; ipx++) {
|
||||
for (int ipy=0; ipy<nSubPixels; ipy++) {
|
||||
p_tot=0;
|
||||
for (int ibx=0; ibx<nbeta; ibx++) {
|
||||
for (int iby=0; iby<nbeta; iby++) {
|
||||
if ( hx[ibx+iby*nbeta]>=((ipx)*bsize) && hx[ibx+iby*nbeta]<((ipx+1)*bsize) && hy[ibx+iby*nbeta]>=((ipy)*bsize) && hy[ibx+iby*nbeta]<((ipy+1)*bsize)) {
|
||||
p_tot+=heta[ibx+iby*nbeta];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cout << p_tot << " \t ";
|
||||
|
||||
|
||||
|
||||
diff+=(p_tot-avg)*(p_tot-avg);
|
||||
|
||||
}
|
||||
// cout << "\n";
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
double iterate(float *newhhx, float *newhhy, double avg) {
|
||||
|
||||
double bsize=1./nSubPixels;
|
||||
|
||||
double hy[nbeta]; //profile y
|
||||
double hx[nbeta]; //profile x
|
||||
double hix[nbeta]; //integral of projection x
|
||||
double hiy[nbeta]; //integral of projection y
|
||||
|
||||
double tot_eta_x=0;
|
||||
double tot_eta_y=0;
|
||||
|
||||
int p0;
|
||||
int vx[(nSubPixels+1)*(nSubPixels+1)], vy[(nSubPixels+1)*(nSubPixels+1)];
|
||||
|
||||
int arrx[nSubPixels+1], arry[nSubPixels+1];
|
||||
|
||||
int bad=1;
|
||||
|
||||
|
||||
int isby, isbx;
|
||||
int ii=0;
|
||||
|
||||
|
||||
// using default comparison (operator <):
|
||||
// std::sort (myvector.begin(), myvector.begin()+4); //(12 32 45 71)26 80 53 33
|
||||
|
||||
for (isby=0; isby<(nSubPixels+1)/2+1; isby++) {
|
||||
|
||||
for (isbx=0; isbx<(nSubPixels+1)/2+1; isbx++) {
|
||||
p0=isby*(nSubPixels+1)+isbx;
|
||||
// for (int iv=0; iv<(nSubPixels+1)*(nSubPixels+1); iv++) {
|
||||
if (isbx==0) {
|
||||
vy[p0]=isby*nbeta/nSubPixels;
|
||||
vx[p0]=0;
|
||||
} else if ( isby==0 ) {
|
||||
vy[p0]=0;
|
||||
vx[p0]=isbx*nbeta/nSubPixels;
|
||||
}
|
||||
else {
|
||||
vy[p0]=rand()%(nbeta/2);
|
||||
vx[p0]=rand()%(nbeta/2);
|
||||
if (nSubPixels%2==0 && isbx==nSubPixels/2)
|
||||
vx[p0]=nbeta/2;
|
||||
if (nSubPixels%2==0 && isby==nSubPixels/2 )
|
||||
vy[p0]=nbeta/2;
|
||||
}
|
||||
// cout << "(" << vx[p0] << " , " << vy[p0] << " ) \t" ;
|
||||
// }
|
||||
}
|
||||
//cout << endl;
|
||||
}
|
||||
// cout << "rand" << endl;
|
||||
|
||||
|
||||
while (bad) {
|
||||
|
||||
for (isby=0; isby<(nSubPixels+1)/2+1; isby++) {
|
||||
|
||||
|
||||
for (isbx=0; isbx<(nSubPixels+1)/2+1; isbx++) {
|
||||
arrx[isbx]=vx[isby*(nSubPixels+1)+isbx];
|
||||
arry[isbx]=vy[isbx*(nSubPixels+1)+isby];
|
||||
//cout << isbx << " " << arrx[isbx] << " " << isby << " " << arry[isbx] << endl;
|
||||
}
|
||||
|
||||
sort(arrx,arrx+(nSubPixels+1)/2+1);
|
||||
sort(arry,arry+(nSubPixels+1)/2+1);
|
||||
|
||||
// cout << "*****"<< endl;
|
||||
// cout << endl;
|
||||
|
||||
for (int isbx=0; isbx<(nSubPixels+1)/2+1; isbx++) {
|
||||
vx[isby*(nSubPixels+1)+isbx]=arrx[isbx];
|
||||
vy[isbx*(nSubPixels+1)+isby]=arry[isbx];
|
||||
|
||||
|
||||
vx[(nSubPixels-isby)*(nSubPixels+1)+(nSubPixels-isbx)]=nbeta-arrx[isbx];
|
||||
vy[(nSubPixels-isbx)*(nSubPixels+1)+(nSubPixels-isby)]=nbeta-arry[isbx];
|
||||
|
||||
vx[isby*(nSubPixels+1)+(nSubPixels-isbx)]=nbeta-arrx[isbx];
|
||||
vy[isbx*(nSubPixels+1)+(nSubPixels-isby)]=arry[isbx];
|
||||
|
||||
|
||||
vx[(nSubPixels-isby)*(nSubPixels+1)+(isbx)]=arrx[isbx];
|
||||
vy[(nSubPixels-isbx)*(nSubPixels+1)+(isby)]=nbeta-arry[isbx];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* for (isby=0; isby<nSubPixels+1; isby++) { */
|
||||
|
||||
/* for (isbx=0; isbx<nSubPixels+1; isbx++) { */
|
||||
|
||||
/* cout << "("<< vx[isby*(nSubPixels+1)+isbx] << " " << vy[isby*(nSubPixels+1)+isbx] << ")\t";//<< endl; */
|
||||
/* } */
|
||||
/* cout << endl; */
|
||||
/* } */
|
||||
|
||||
bad=0;
|
||||
for (isby=1; isby<(nSubPixels+1)/2+1; isby++) {
|
||||
|
||||
for (isbx=1; isbx<(nSubPixels+1)/2+1; isbx++) {
|
||||
|
||||
if (heta[vx[isby*(nSubPixels+1)+isbx]+vy[isby*(nSubPixels+1)+isbx]*nbeta]<avg*(nSubPixels*nSubPixels)/(nbeta*nbeta)) {
|
||||
// cout << ii << " " << isbx << " " << isby << " " << vx[isby*(nSubPixels+1)+isbx] << " " << vy[isby*(nSubPixels+1)+isbx] << " " << heta[vx[isby*(nSubPixels+1)+isbx]+vy[isby*(nSubPixels+1)+isbx]*nbeta] << endl;
|
||||
if (nSubPixels%2==0 && isbx==nSubPixels/2)
|
||||
;
|
||||
else
|
||||
vx[isby*(nSubPixels+1)+isbx]=rand()%(nbeta/2);
|
||||
|
||||
if (nSubPixels%2==0 && isbx==nSubPixels/2)
|
||||
;
|
||||
else
|
||||
vy[isby*(nSubPixels+1)+isbx]=rand()%(nbeta/2);
|
||||
|
||||
if (bad==0)
|
||||
ii++;
|
||||
|
||||
bad=1;
|
||||
// break;
|
||||
}
|
||||
|
||||
}
|
||||
//if (bad) break;
|
||||
}
|
||||
// cout << "sort" << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
cout << ii << " sub iteractions " << avg*(nSubPixels*nSubPixels)/(nbeta*nbeta) << endl;
|
||||
|
||||
double m,q;
|
||||
int in_quad;
|
||||
int p[4];
|
||||
int p1x,p2x, p1y, p2y;
|
||||
// cout << nbeta << endl;
|
||||
double angle;
|
||||
double dtheta,theta1,theta2;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (int ibx=0; ibx<nbeta; ibx++) {
|
||||
|
||||
for (int iby=0; iby<nbeta; iby++) {
|
||||
|
||||
in_quad=0;
|
||||
|
||||
/* if (ibx==0) */
|
||||
/* isbx=0; */
|
||||
/* else */
|
||||
/* isbx= (newhhx[ibx-1+iby*nbeta])/bsize-1; */
|
||||
/* if (isbx<0) isbx=0; */
|
||||
/* if (isbx>nSubPixels-1) isbx=nSubPixels-1; */
|
||||
|
||||
/* if (iby==0) */
|
||||
/* isby=0; */
|
||||
/* else */
|
||||
/* isby= (newhhx[ibx+(iby-1)*nbeta])/bsize-1; */
|
||||
|
||||
/* if (isby<0) isbx=0; */
|
||||
/* if (isby>nSubPixels-1) isby=nSubPixels-1; */
|
||||
/* // cout << isbx << " " << isby << endl; */
|
||||
|
||||
for (isby=0; isby<nSubPixels; isby++) {
|
||||
|
||||
for (isbx=0; isbx<nSubPixels; isbx++) {
|
||||
|
||||
// cout << ibx << " " << iby << " " << isbx << " " << isby << endl;
|
||||
p[0]=isby*(nSubPixels+1)+isbx;
|
||||
p[1]=isby*(nSubPixels+1)+isbx+1;
|
||||
p[2]=(isby+1)*(nSubPixels+1)+isbx+1;
|
||||
p[3]=(isby+1)*(nSubPixels+1)+isbx;
|
||||
|
||||
|
||||
angle=0;
|
||||
for (int i=0;i<4;i++) {
|
||||
p1x = vx[p[i]] - ibx;
|
||||
p1y = vy[p[i]] - iby;
|
||||
p2x = vx[p[(i+1)%4]] - ibx;
|
||||
p2y = vy[p[(i+1)%4]] - iby;
|
||||
theta1 = atan2(p1y,p1x);
|
||||
theta2 = atan2(p2y,p2x);
|
||||
dtheta = theta2 - theta1;
|
||||
|
||||
while (dtheta > PI)
|
||||
dtheta -= TWOPI;
|
||||
while (dtheta < -PI)
|
||||
dtheta += TWOPI;
|
||||
|
||||
angle += dtheta;
|
||||
}
|
||||
|
||||
if (abs((double)angle) < PI)
|
||||
in_quad=0;
|
||||
else
|
||||
in_quad=1;
|
||||
|
||||
if (in_quad) {
|
||||
newhhx[ibx+iby*nbeta]=bsize*((double)isbx);
|
||||
newhhy[ibx+iby*nbeta]=bsize*((double)isby);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (in_quad) break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// cout << "hist" << endl;
|
||||
return calcDiff(avg, newhhx, newhhy);
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
etaInterpolationRandomBins(int nx=400, int ny=400, int ns=25, int nb=-1, double emin=1, double emax=0) : etaInterpolationPosXY(nx,ny,ns, nb, emin,emax){};
|
||||
|
||||
etaInterpolationRandomBins(etaInterpolationRandomBins *orig): etaInterpolationPosXY(orig){};
|
||||
|
||||
virtual etaInterpolationRandomBins* Clone() {
|
||||
|
||||
return new etaInterpolationRandomBins(this);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtual void prepareInterpolation(int &ok)
|
||||
{
|
||||
ok=1;
|
||||
cout << "Adaptive bins" << endl;
|
||||
|
||||
///*Eta Distribution Rebinning*///
|
||||
double bsize=1./nSubPixels; //precision
|
||||
// cout<<"nPixelsX = "<<nPixelsX<<" nPixelsY = "<<nPixelsY<<" nSubPixels = "<<nSubPixels<<endl;
|
||||
double tot_eta=0;
|
||||
for (int ip=0; ip<nbeta*nbeta; ip++)
|
||||
tot_eta+=heta[ip];
|
||||
if (tot_eta<=0) {ok=0; return;};
|
||||
|
||||
|
||||
int ii=0;
|
||||
|
||||
|
||||
|
||||
int nint=1000;
|
||||
|
||||
double thr=1./((double)nSubPixels);
|
||||
double avg=tot_eta/((double)(nSubPixels*nSubPixels));
|
||||
cout << "total eta entries is :"<< tot_eta << " avg: "<< avg << endl;
|
||||
cout << "Start " << endl;
|
||||
double old_diff=-1, new_diff=-1;
|
||||
// cout << " diff= " << new_diff << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
etaInterpolationPosXY::prepareInterpolation(ok);
|
||||
|
||||
old_diff=calcDiff(avg, hhx, hhy);
|
||||
cout << " diff= " << old_diff << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int iint=0;
|
||||
float *newhhx=new float[nbeta*nbeta]; //profile x
|
||||
float *newhhy=new float[nbeta*nbeta]; //profile y
|
||||
int igood=0, ibad=0;
|
||||
#ifdef SAVE_ALL
|
||||
int etabins=nbeta;
|
||||
float *etah=new float[nbeta*nbeta];
|
||||
char tit[1000];
|
||||
#endif
|
||||
|
||||
while (iint<nint) {
|
||||
|
||||
cout << "Iteration " << iint << endl;
|
||||
new_diff=iterate(newhhx,newhhy, avg);
|
||||
//new_diff=calcDiff(avg, newhhx, newhhy);
|
||||
cout << " diff= " << new_diff << " ( " << old_diff<< " ) " << endl;
|
||||
|
||||
|
||||
|
||||
/* #ifdef SAVE_ALL */
|
||||
/* for (int ii=0; ii<etabins*etabins; ii++) { */
|
||||
/* etah[ii]=newhhx[ii]; */
|
||||
/* if (etah[ii]>1 || etah[ii]<0 ) cout << "***"<< ii << etah[ii] << endl; */
|
||||
/* } */
|
||||
/* sprintf(tit,"/scratch/randeta_hhx_%d.tiff",iint); */
|
||||
/* WriteToTiff(etah, tit, etabins, etabins); */
|
||||
|
||||
/* for (int ii=0; ii<etabins*etabins; ii++) { */
|
||||
/* etah[ii]=newhhy[ii]; */
|
||||
/* if (etah[ii]>1 || etah[ii]<0 ) cout << "***"<< ii << etah[ii] << endl; */
|
||||
/* } */
|
||||
/* sprintf(tit,"/scratch/randeta_hhy_%d.tiff",iint); */
|
||||
/* WriteToTiff(etah, tit, etabins, etabins); */
|
||||
/* #endif */
|
||||
|
||||
if (new_diff<old_diff) {
|
||||
|
||||
cout << "******************** GOOD! ***********************"<< endl;
|
||||
delete [] hhx;
|
||||
delete [] hhy;
|
||||
igood++;
|
||||
hhx=newhhx;
|
||||
hhy=newhhy;
|
||||
newhhx=new float[nbeta*nbeta]; //profile x */
|
||||
newhhy=new float[nbeta*nbeta]; //profile y */
|
||||
old_diff=new_diff;
|
||||
} else
|
||||
ibad++;
|
||||
|
||||
iint++;
|
||||
}
|
||||
delete [] newhhx;
|
||||
delete [] newhhy;
|
||||
|
||||
cout << "performed " << iint << " iterations of which " << igood << " positive " << endl;
|
||||
|
||||
|
||||
/* #ifdef SAVE_ALL */
|
||||
|
||||
|
||||
/* for (int ii=0; ii<etabins*etabins; ii++) { */
|
||||
/* etah[ii]=hhx[ii]; */
|
||||
/* } */
|
||||
/* sprintf(tit,"/scratch/eta_hhx_%d.tiff",id); */
|
||||
/* WriteToTiff(etah, tit, etabins, etabins); */
|
||||
|
||||
/* for (int ii=0; ii<etabins*etabins; ii++) { */
|
||||
/* etah[ii]=hhy[ii]; */
|
||||
/* } */
|
||||
/* sprintf(tit,"/scratch/eta_hhy_%d.tiff",id); */
|
||||
/* WriteToTiff(etah, tit, etabins, etabins); */
|
||||
|
||||
/* for (int ii=0; ii<etabins*etabins; ii++) { */
|
||||
/* etah[ii]=heta[ii]; */
|
||||
/* } */
|
||||
/* sprintf(tit,"/scratch/eta_%d.tiff",id); */
|
||||
/* WriteToTiff(etah, tit, etabins, etabins); */
|
||||
/* delete [] etah; */
|
||||
/* #endif */
|
||||
return ;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -38,13 +38,31 @@ class noInterpolation : public slsInterpolation{
|
||||
|
||||
return ;
|
||||
};
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, int *data, double &int_x, double &int_y)
|
||||
{
|
||||
return getInterpolatedPosition(x, y, (double*)NULL, int_x, int_y);
|
||||
}
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double etax, double etay, int corner, double &int_x, double &int_y)
|
||||
{
|
||||
getInterpolatedPosition(x, y, NULL, int_x, int_y);
|
||||
getInterpolatedPosition(x, y, (double*)NULL, int_x, int_y);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,double *cl,double &etax, double &etay){
|
||||
getInterpolatedPosition(x, y, NULL, etax, etay);
|
||||
getInterpolatedPosition(x, y, (double*)NULL, etax, etay);
|
||||
};
|
||||
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,int *cl,double &etax, double &etay){
|
||||
getInterpolatedPosition(x, y, (double*)NULL, etax, etay);
|
||||
};
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
virtual void getPositionETA3(int x, int y, double *data, double &int_x, double &int_y)
|
||||
@ -55,13 +73,27 @@ class noInterpolation : public slsInterpolation{
|
||||
|
||||
return ;
|
||||
};
|
||||
|
||||
virtual void getPositionETA3(int x, int y, int *data, double &int_x, double &int_y)
|
||||
{
|
||||
return getPositionETA3(x, y, (double*)NULL, int_x, int_y);
|
||||
};
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
virtual int addToFlatField(double *cluster, double &etax, double &etay){return 0;};
|
||||
|
||||
virtual int addToFlatField(int *cluster, double &etax, double &etay){return 0;};
|
||||
|
||||
virtual int addToFlatField(double etax, double etay){return 0;};
|
||||
|
||||
virtual int addToFlatField(double totquad,int quad,double *cl,double &etax, double &etay){return 0;};
|
||||
|
||||
|
||||
virtual int addToFlatField(double totquad,int quad,int *cl,double &etax, double &etay){return 0;};
|
||||
|
||||
|
||||
protected:
|
||||
;
|
||||
// TRandom *eventGenerator;
|
||||
|
@ -8,7 +8,10 @@
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#ifndef MY_TIFF_IO_H
|
||||
#include "tiffIO.h"
|
||||
#endif
|
||||
|
||||
#ifndef DEF_QUAD
|
||||
#define DEF_QUAD
|
||||
enum quadrant {
|
||||
@ -88,7 +91,7 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
|
||||
|
||||
void *writeInterpolatedImage(const char * imgname) {
|
||||
cout << "!" <<endl;
|
||||
//cout << "!" <<endl;
|
||||
float *gm=NULL;
|
||||
gm=new float[ nSubPixels* nSubPixels* nPixelsX*nPixelsY];
|
||||
if (gm) {
|
||||
@ -107,8 +110,10 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
|
||||
//return position inside the pixel for the given photon
|
||||
virtual void getInterpolatedPosition(int x, int y, double *data, double &int_x, double &int_y)=0;
|
||||
virtual void getInterpolatedPosition(int x, int y, int *data, double &int_x, double &int_y)=0;
|
||||
//return position inside the pixel for the given photon
|
||||
virtual void getInterpolatedPosition(int x, int y, double etax, double etay, int quad, double &int_x, double &int_y)=0;
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,int *cluster,double &etax, double &etay)=0;
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,double *cluster,double &etax, double &etay)=0;
|
||||
|
||||
|
||||
@ -138,7 +143,9 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
#endif
|
||||
|
||||
#ifndef MYROOT1
|
||||
virtual int *addToImage(double int_x, double int_y){ int iy=nSubPixels*int_y; int ix=nSubPixels*int_x;
|
||||
virtual int *addToImage(double int_x, double int_y){
|
||||
int iy=((double)nSubPixels)*int_y;
|
||||
int ix=((double)nSubPixels)*int_x;
|
||||
// cout << int_x << " " << int_y << " " << " " << ix << " " << iy << " " << ix+iy*nPixelsX*nSubPixels << endl;
|
||||
if (ix>=0 && ix<(nPixelsX*nSubPixels) && iy<(nSubPixels*nPixelsY) && iy>=0 )(*(hint+ix+iy*nPixelsX*nSubPixels))+=1;
|
||||
return hint;
|
||||
@ -147,9 +154,10 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
|
||||
|
||||
virtual int addToFlatField(double *cluster, double &etax, double &etay)=0;
|
||||
virtual int addToFlatField(double etax, double etay)=0;
|
||||
|
||||
virtual int addToFlatField(int *cluster, double &etax, double &etay)=0;
|
||||
virtual int addToFlatField(double totquad,int quad,int *cl,double &etax, double &etay)=0;
|
||||
virtual int addToFlatField(double totquad,int quad,double *cluster,double &etax, double &etay)=0;
|
||||
virtual int addToFlatField(double etax, double etay)=0;
|
||||
|
||||
#ifdef MYROOT1
|
||||
virtual TH2D *getFlatField(){return NULL;};
|
||||
@ -167,6 +175,14 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
|
||||
//virtual void Streamer(TBuffer &b);
|
||||
|
||||
static int calcQuad(int *cl, double &sum, double &totquad, double sDum[2][2]){
|
||||
double cli[3*3];//=new int[3*3];
|
||||
for (int i=0; i<9; i++)
|
||||
cli[i]=cl[i];
|
||||
return calcQuad(cli, sum, totquad, sDum);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int calcQuad(double *cl, double &sum, double &totquad, double sDum[2][2]){
|
||||
|
||||
@ -175,48 +191,64 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
cluster[0]=cl;
|
||||
cluster[1]=cl+3;
|
||||
cluster[2]=cl+6;
|
||||
|
||||
sum=0;
|
||||
double sumBL=0;
|
||||
double sumTL=0;
|
||||
double sumBR=0;
|
||||
double sumTR=0;
|
||||
int xoff=0, yoff=0;
|
||||
for (int ix=0; ix<3; ix++) {
|
||||
for (int iy=0; iy<3; iy++) {
|
||||
sum+=cluster[iy][ix];
|
||||
if (ix<=1 && iy<=1) sumBL+=cluster[iy][ix];
|
||||
if (ix<=1 && iy>=1) sumTL+=cluster[iy][ix];
|
||||
if (ix>=1 && iy<=1) sumBR+=cluster[iy][ix];
|
||||
if (ix>=1 && iy>=1) sumTR+=cluster[iy][ix];
|
||||
}
|
||||
}
|
||||
|
||||
sum = cluster[0][0] + cluster[1][0] + cluster[2][0] + cluster[0][1] + cluster[1][1] + cluster[2][1] + cluster[0][2] + cluster[1][2] + cluster[2][2];
|
||||
|
||||
double sumBL = cluster[0][0] + cluster[1][0] + cluster[0][1] + cluster[1][1]; //2 ->BL
|
||||
double sumTL = cluster[1][0] + cluster[2][0] + cluster[2][1] + cluster[1][1]; //0 ->TL
|
||||
double sumBR = cluster[0][1] + cluster[0][2] + cluster[1][2] + cluster[1][1]; //3 ->BR
|
||||
double sumTR = cluster[1][2] + cluster[2][1] + cluster[2][2] + cluster[1][1]; //1 ->TR
|
||||
double sumMax = 0;
|
||||
double t, r;
|
||||
|
||||
// if(sumTL >= sumMax){
|
||||
sDum[0][0] = cluster[0][0]; sDum[1][0] = cluster[1][0];
|
||||
sDum[0][1] = cluster[0][1]; sDum[1][1] = cluster[1][1];
|
||||
/* sDum[0][0] = cluster[0][0]; sDum[1][0] = cluster[1][0]; */
|
||||
/* sDum[0][1] = cluster[0][1]; sDum[1][1] = cluster[1][1]; */
|
||||
corner = BOTTOM_LEFT;
|
||||
sumMax=sumBL;
|
||||
// }
|
||||
|
||||
if(sumTL >= sumMax){
|
||||
sDum[0][0] = cluster[1][0]; sDum[1][0] = cluster[2][0];
|
||||
sDum[0][1] = cluster[1][1]; sDum[1][1] = cluster[2][1];
|
||||
totquad=sumBL;
|
||||
|
||||
|
||||
if(sumTL >= totquad){
|
||||
/* sDum[0][0] = cluster[1][0]; sDum[1][0] = cluster[2][0]; */
|
||||
/* sDum[0][1] = cluster[1][1]; sDum[1][1] = cluster[2][1]; */
|
||||
|
||||
corner = TOP_LEFT;
|
||||
sumMax=sumTL;
|
||||
totquad=sumTL;
|
||||
xoff=0;
|
||||
yoff=1;
|
||||
}
|
||||
|
||||
if(sumBR >= sumMax){
|
||||
sDum[0][0] = cluster[0][1]; sDum[1][0] = cluster[1][1];
|
||||
sDum[0][1] = cluster[0][2]; sDum[1][1] = cluster[1][2];
|
||||
if(sumBR >= totquad){
|
||||
/* sDum[0][0] = cluster[0][1]; sDum[1][0] = cluster[1][1]; */
|
||||
/* sDum[0][1] = cluster[0][2]; sDum[1][1] = cluster[1][2]; */
|
||||
|
||||
xoff=1;
|
||||
yoff=0;
|
||||
corner = BOTTOM_RIGHT;
|
||||
sumMax=sumBR;
|
||||
totquad=sumBR;
|
||||
}
|
||||
|
||||
if(sumTR >= sumMax){
|
||||
sDum[0][0] = cluster[1][1]; sDum[1][0] = cluster[2][1];
|
||||
sDum[0][1] = cluster[1][2]; sDum[1][1] = cluster[2][2];
|
||||
|
||||
if(sumTR >= totquad){
|
||||
xoff=1;
|
||||
yoff=1;
|
||||
/* sDum[0][0] = cluster[1][1]; sDum[1][0] = cluster[2][1]; */
|
||||
/* sDum[0][1] = cluster[1][2]; sDum[1][1] = cluster[2][2]; */
|
||||
corner = TOP_RIGHT;
|
||||
sumMax=sumTR;
|
||||
totquad=sumTR;
|
||||
}
|
||||
|
||||
totquad=sumMax;
|
||||
|
||||
for (int ix=0; ix<2; ix++) {
|
||||
for (int iy=0; iy<2; iy++) {
|
||||
sDum[iy][ix] = cluster[iy+yoff][ix+xoff];
|
||||
}
|
||||
}
|
||||
|
||||
return corner;
|
||||
|
||||
@ -235,7 +267,6 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int calcEta(double *cl, double &etax, double &etay, double &sum, double &totquad, double sDum[2][2]) {
|
||||
int corner = calcQuad(cl,sum,totquad,sDum);
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
@ -244,6 +275,14 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
}
|
||||
|
||||
|
||||
static int calcEta(int *cl, double &etax, double &etay, double &sum, double &totquad, double sDum[2][2]) {
|
||||
int corner = calcQuad(cl,sum,totquad,sDum);
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
|
||||
return corner;
|
||||
}
|
||||
|
||||
|
||||
static int calcEtaL(double totquad, int corner, double sDum[2][2], double &etax, double &etay){
|
||||
double t,r, toth, totv;
|
||||
if (totquad>0) {
|
||||
@ -294,6 +333,13 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
return corner;
|
||||
}
|
||||
|
||||
static int calcEtaL(int *cl, double &etax, double &etay, double &sum, double &totquad, double sDum[2][2]) {
|
||||
int corner = calcQuad(cl,sum,totquad,sDum);
|
||||
calcEtaL(totquad, corner, sDum, etax, etay);
|
||||
|
||||
return corner;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int calcEtaC3(double *cl, double &etax, double &etay, double &sum, double &totquad, double sDum[2][2]){
|
||||
@ -306,23 +352,95 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
|
||||
|
||||
|
||||
static int calcEtaC3(int *cl, double &etax, double &etay, double &sum, double &totquad, double sDum[2][2]){
|
||||
|
||||
int corner = calcQuad(cl,sum,totquad,sDum);
|
||||
calcEta(sum, sDum, etax, etay);
|
||||
return corner;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int calcEta3(double *cl, double &etax, double &etay, double &sum) {
|
||||
double l,r,t,b;
|
||||
sum=cl[0]+cl[1]+cl[2]+cl[3]+cl[4]+cl[5]+cl[6]+cl[7]+cl[8];
|
||||
double l=0,r=0,t=0,b=0, val;
|
||||
sum=0;
|
||||
// int quad;
|
||||
for (int ix=0; ix<3; ix++) {
|
||||
for (int iy=0; iy<3; iy++) {
|
||||
val=cl[iy+3*ix];
|
||||
sum+=val;
|
||||
if (iy==0) l+=val;
|
||||
if (iy==2) r+=val;
|
||||
if (ix==0) b+=val;
|
||||
if (ix==2) t+=val;
|
||||
}
|
||||
}
|
||||
if (sum>0) {
|
||||
l=cl[0]+cl[3]+cl[6];
|
||||
r=cl[2]+cl[5]+cl[8];
|
||||
b=cl[0]+cl[1]+cl[2];
|
||||
t=cl[6]+cl[7]+cl[8];
|
||||
etax=(-l+r)/sum;
|
||||
etay=(-b+t)/sum;
|
||||
}
|
||||
/* if (etax<-1 || etax>1 || etay<-1 || etay>1) { */
|
||||
/* cout << "**********" << etax << " " << etay << endl; */
|
||||
/* for (int ix=0; ix<3; ix++) { */
|
||||
/* for (int iy=0; iy<3; iy++) { */
|
||||
/* cout << cl[iy+3*ix] << "\t" ; */
|
||||
|
||||
/* } */
|
||||
/* cout << endl; */
|
||||
/* } */
|
||||
/* cout << sum << " " << l << " " << r << " " << t << " " << b << endl; */
|
||||
|
||||
/* } */
|
||||
|
||||
|
||||
if (etax>=0 && etay>=0)
|
||||
return TOP_RIGHT;
|
||||
if (etax<0 && etay>=0)
|
||||
return TOP_LEFT;
|
||||
if (etax<0 && etay<0)
|
||||
return BOTTOM_LEFT;
|
||||
return BOTTOM_RIGHT;
|
||||
}
|
||||
|
||||
|
||||
static int calcEta3(int *cl, double &etax, double &etay, double &sum) {
|
||||
double cli[9];
|
||||
for (int ix=0; ix<9; ix++) cli[ix]=cl[ix];
|
||||
|
||||
return calcEta3(cli, etax, etay, sum);
|
||||
}
|
||||
|
||||
|
||||
static int calcMyEta(double totquad, int quad, double *cl, double &etax, double &etay) {
|
||||
double l,r,t,b, sum;
|
||||
int yoff;
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
case BOTTOM_RIGHT:
|
||||
yoff=0;
|
||||
break;
|
||||
case TOP_LEFT:
|
||||
case TOP_RIGHT:
|
||||
yoff=1;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
l=cl[0+yoff*3]+cl[0+yoff*3+3];
|
||||
r=cl[2+yoff*3]+cl[2+yoff*3+3];
|
||||
b=cl[0+yoff*3]+cl[1+yoff*3]*cl[2+yoff*3];
|
||||
t=cl[0+yoff*3+3]+cl[1+yoff*3+3]*cl[0+yoff*3+3];
|
||||
sum=t+b;
|
||||
if (sum>0) {
|
||||
etax=(-l+r)/sum;
|
||||
etay=(+t)/sum;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int calcMyEta(double totquad, int quad, double *cl, double &etax, double &etay) {
|
||||
static int calcMyEta(double totquad, int quad, int *cl, double &etax, double &etay) {
|
||||
double l,r,t,b, sum;
|
||||
int yoff;
|
||||
switch (quad) {
|
||||
@ -367,6 +485,21 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny);
|
||||
}
|
||||
|
||||
|
||||
static int calcEta3X(int *cl, double &etax, double &etay, double &sum) {
|
||||
double l,r,t,b;
|
||||
sum=cl[0]+cl[1]+cl[2]+cl[3]+cl[4]+cl[5]+cl[6]+cl[7]+cl[8];
|
||||
if (sum>0) {
|
||||
l=cl[3];
|
||||
r=cl[5];
|
||||
b=cl[1];
|
||||
t=cl[7];
|
||||
etax=(-l+r)/sum;
|
||||
etay=(-b+t)/sum;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -11,23 +11,29 @@ MAIN=moench03ClusterFinder.cpp
|
||||
#-lhdf5
|
||||
#DESTDIR?=../bin
|
||||
|
||||
all: moenchClusterFinder moenchMakeEta moenchInterpolation moenchNoInterpolation
|
||||
all: moenchClusterFinder moenchMakeEta moenchInterpolation moenchNoInterpolation moenchPhotonCounter moenchAnalog
|
||||
|
||||
|
||||
|
||||
moenchClusterFinder: $(MAIN) $(INCS) clean
|
||||
g++ -o moenchClusterFinder $(MAIN) $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DOLDDATA
|
||||
g++ -o moenchClusterFinder $(MAIN) $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DOLDDATA #-DNEWRECEIVER
|
||||
|
||||
moenchMakeEta: moench03MakeEta.cpp $(INCS) clean
|
||||
g++ -o moenchMakeEta moench03MakeEta.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL
|
||||
|
||||
moenchInterpolation: moench03Interpolation.cpp $(INCS) clean
|
||||
g++ -o moenchInterpolation moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL
|
||||
g++ -o moenchInterpolation moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL
|
||||
|
||||
moenchNoInterpolation: moench03NoInterpolation.cpp $(INCS) clean
|
||||
g++ -o moenchNoInterpolation moench03NoInterpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL
|
||||
|
||||
moenchPhotonCounter: moenchPhotonCounter.cpp $(INCS) clean
|
||||
g++ -o moenchPhotonCounter moenchPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DNEWRECEIVER
|
||||
|
||||
moenchAnalog: moenchPhotonCounter.cpp $(INCS) clean
|
||||
g++ -o moenchAnalog moenchPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DNEWRECEIVER -DANALOG
|
||||
|
||||
clean:
|
||||
rm -f moenchClusterFinder moenchMakeEta moenchInterpolation moenchNoInterpolation
|
||||
rm -f moenchClusterFinder moenchMakeEta moenchInterpolation moenchNoInterpolation moenchPhotonCounter
|
||||
|
||||
|
||||
|
@ -119,53 +119,11 @@ int main(int argc, char *argv[]) {
|
||||
cout << "input directory is " << indir << endl;
|
||||
cout << "output directory is " << outdir << endl;
|
||||
cout << "fileformat is " << fformat << endl;
|
||||
// cout << "pedestal file is " << fformat << endl;
|
||||
|
||||
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << endl;
|
||||
// filter->setFrameMode(eFrame);
|
||||
// mt->setFrameMode(ePedestal);
|
||||
// cout << pedfname<< endl;
|
||||
|
||||
// filebin.open((const char *)(pedfname), ios::in | ios::binary);
|
||||
// //filebin.open((const char *)(fname), ios::in | ios::binary);
|
||||
|
||||
// // //open file
|
||||
// if (filebin.is_open()){
|
||||
// // //while read frame
|
||||
// cout << "pedestal file " << endl;
|
||||
// while (decoder->readNextFrame(filebin, ff, np,data)) {
|
||||
// // cout << ff << " " << np << endl;
|
||||
// // //push
|
||||
// // mt->pushData(buff);
|
||||
// // // //pop
|
||||
// //mt->nextThread();
|
||||
// // // // cout << " " << (void*)buff;
|
||||
// //mt->popFree(buff);
|
||||
// filter->processData(data);
|
||||
// }
|
||||
// filebin.close();
|
||||
// // //close file
|
||||
// // //join threads
|
||||
// // while (mt->isBusy()) {;}//wait until all data are processed from the queues
|
||||
// // cout << outfname << endl;
|
||||
// // filter->writePedestals(outfname);
|
||||
// // sprintf(outfname,"%s/%s_pedimg.tiff",outdir,fn);
|
||||
|
||||
// // cout << outfname << endl;
|
||||
|
||||
// // filter->writeImage(outfname);
|
||||
// // //mt->clearImage();
|
||||
// } else
|
||||
// cout << "Could not open "<< pedfname << " for reading " << endl;
|
||||
|
||||
|
||||
|
||||
// // for (int ix=0; ix<400; ix++)
|
||||
// // for (int iy=0; iy<400; iy++)
|
||||
// // cout << ix << " " << iy << " " << filter->getPedestal(ix,iy) << " " << filter->getPedestalRMS(ix,iy) << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -176,9 +134,7 @@ int main(int argc, char *argv[]) {
|
||||
char* buff;
|
||||
multiThreadedAnalogDetector *mt=new multiThreadedAnalogDetector(filter,nthreads,fifosize);
|
||||
|
||||
|
||||
// mt->setFrameMode(eFrame); //need to find a way to switch between flat and frames!
|
||||
// mt->prepareInterpolation(ok);
|
||||
|
||||
mt->setFrameMode(eFrame);
|
||||
mt->StartThreads();
|
||||
mt->popFree(buff);
|
||||
@ -187,46 +143,7 @@ int main(int argc, char *argv[]) {
|
||||
cout << "mt " << endl;
|
||||
|
||||
int ifr=0;
|
||||
// //loop on files
|
||||
// mt->setFrameMode(eFrame);
|
||||
//mt->setFrameMode(eFlat);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// for (int irun=runmin; irun<runmin+5; irun++) {
|
||||
// sprintf(fn,fformat,irun);
|
||||
// sprintf(fname,"%s/%s.raw",indir,fn);
|
||||
|
||||
|
||||
|
||||
// filebin.open((const char *)(fname), ios::in | ios::binary);
|
||||
// // //open file
|
||||
// if (filebin.is_open()){
|
||||
// // //while read frame
|
||||
// while (decoder->readNextFrame(filebin, ff, np,buff)) {
|
||||
// // cout << "*"<<ifr++<<"*"<<ff<< endl;
|
||||
// // cout << ff << " " << np << endl;
|
||||
// // //push
|
||||
// mt->pushData(buff);
|
||||
// // // //pop
|
||||
// mt->nextThread();
|
||||
// // // // cout << " " << (void*)buff;
|
||||
// mt->popFree(buff);
|
||||
|
||||
// }
|
||||
// // cout << "--" << endl;
|
||||
// filebin.close();
|
||||
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// while (mt->isBusy()) {;}//wait until all data are processed from the queues
|
||||
// mt->clearImage();
|
||||
|
||||
|
||||
for (int irun=runmin; irun<runmax; irun++) {
|
||||
sprintf(fn,fformat,irun);
|
||||
@ -259,6 +176,8 @@ int main(int argc, char *argv[]) {
|
||||
mt->nextThread();
|
||||
// // // cout << " " << (void*)buff;
|
||||
mt->popFree(buff);
|
||||
ifr++;
|
||||
if (ifr%10000==0) cout << ifr << " " << ff << endl;
|
||||
ff=-1;
|
||||
}
|
||||
cout << "--" << endl;
|
||||
|
@ -2,53 +2,101 @@
|
||||
#include "ansi.h"
|
||||
#include <iostream>
|
||||
|
||||
#include "moench03T1ZmqData.h"
|
||||
#include "single_photon_hit.h"
|
||||
//#include "moench03T1ZmqData.h"
|
||||
//#define DOUBLE_SPH
|
||||
//#define MANYFILES
|
||||
|
||||
// #include "etaInterpolationPosXY.h"
|
||||
#include "etaInterpolationAdaptiveBins.h"
|
||||
#ifdef DOUBLE_SPH
|
||||
#include "single_photon_hit_double.h"
|
||||
#endif
|
||||
|
||||
#ifndef DOUBLE_SPH
|
||||
#include "single_photon_hit.h"
|
||||
#endif
|
||||
|
||||
#include "etaInterpolationPosXY.h"
|
||||
#include "noInterpolation.h"
|
||||
//#include "etaInterpolationAdaptiveBins.h"
|
||||
//#include "etaInterpolationRandomBins.h"
|
||||
using namespace std;
|
||||
#define NC 400
|
||||
#define NR 400
|
||||
|
||||
|
||||
#define XTALK
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
/**
|
||||
* trial.o [socket ip] [starting port number] [outfname]
|
||||
*
|
||||
*/
|
||||
|
||||
if (argc<7) {
|
||||
cout << "Wrong usage! Should be: "<< argv[0] << " infile " << " etafile outfile runmin runmax ns" << endl;
|
||||
if (argc<9) {
|
||||
cout << "Wrong usage! Should be: "<< argv[0] << " infile " << " etafile outfile runmin runmax ns cmin cmax" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
char infname[10000];
|
||||
char fname[10000];
|
||||
char outfname[10000];
|
||||
int runmin=atoi(argv[4]);
|
||||
int runmax=atoi(argv[5]);
|
||||
int nsubpix=atoi(argv[6]);
|
||||
float cmin=atof(argv[7]);
|
||||
float cmax=atof(argv[8]);
|
||||
|
||||
int etabins=1000;//nsubpix*2*100;
|
||||
double etamin=-1, etamax=2;
|
||||
double eta3min=-2, eta3max=2;
|
||||
int quad;
|
||||
double sum, totquad;
|
||||
double sDum[2][2];
|
||||
double etax, etay, int_x, int_y;
|
||||
double eta3x, eta3y, int3_x, int3_y, noint_x, noint_y;
|
||||
int ok;
|
||||
|
||||
int f0=-1;
|
||||
int ix, iy, isx, isy;
|
||||
|
||||
|
||||
int nframes=0, lastframe=-1;
|
||||
double d_x, d_y, res=5, xx, yy;
|
||||
#ifdef MANYFILES
|
||||
int ff=1000;
|
||||
#endif
|
||||
int nph=0, badph=0, totph=0;
|
||||
FILE *f=NULL;
|
||||
|
||||
#ifdef DOUBLE_SPH
|
||||
single_photon_hit_double cl(3,3);
|
||||
#endif
|
||||
|
||||
#ifndef DOUBLE_SPH
|
||||
single_photon_hit cl(3,3);
|
||||
// etaInterpolationPosXY *interp=new etaInterpolationPosXY(NC, NR, nsubpix, etabins, etamin, etamax);
|
||||
etaInterpolationAdaptiveBins *interp=new etaInterpolationAdaptiveBins (NC, NR, nsubpix, etabins, etamin, etamax);
|
||||
#endif
|
||||
|
||||
#ifdef XTALK
|
||||
int old_val[3][3];
|
||||
int new_val[3][3];
|
||||
double xcorr=0.04;
|
||||
|
||||
// int ix=0;
|
||||
#endif
|
||||
|
||||
|
||||
eta2InterpolationPosXY *interp=new eta2InterpolationPosXY(NC, NR, nsubpix, etabins, etamin, etamax);
|
||||
eta3InterpolationPosXY *interp3=new eta3InterpolationPosXY(NC, NR, nsubpix, etabins, eta3min, eta3max);
|
||||
noInterpolation *dummy=new noInterpolation(NC, NR, nsubpix);
|
||||
noInterpolation *nointerp=new noInterpolation(NC, NR, nsubpix);
|
||||
noInterpolation *mult=new noInterpolation(NC, NR, nsubpix);
|
||||
//etaInterpolationAdaptiveBins *interp=new etaInterpolationAdaptiveBins (NC, NR, nsubpix, etabins, etamin, etamax);
|
||||
//etaInterpolationRandomBins *interp=new etaInterpolationRandomBins (NC, NR, nsubpix, etabins, etamin, etamax);
|
||||
//#ifndef FF
|
||||
cout << "read ff " << argv[2] << endl;
|
||||
interp->readFlatField(argv[2]);
|
||||
sprintf(fname,"%s_eta2.tiff",argv[2]);
|
||||
interp->readFlatField(fname);
|
||||
interp->prepareInterpolation(ok);
|
||||
|
||||
sprintf(fname,"%s_eta3.tiff",argv[2]);
|
||||
interp3->readFlatField(fname);
|
||||
interp3->prepareInterpolation(ok);
|
||||
//#endif
|
||||
|
||||
int *img;
|
||||
@ -70,20 +118,99 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
for (int irun=runmin; irun<runmax; irun++) {
|
||||
int irun;
|
||||
for (irun=runmin; irun<runmax; irun++) {
|
||||
sprintf(infname,argv[1],irun);
|
||||
#ifndef MANYFILES
|
||||
sprintf(outfname,argv[3],irun);
|
||||
|
||||
#endif
|
||||
f=fopen(infname,"r");
|
||||
|
||||
if (f) {
|
||||
cout << infname << endl;
|
||||
nframes=0;
|
||||
f0=-1;
|
||||
|
||||
while (cl.read(f)) {
|
||||
quad=interp->calcQuad(cl.get_cluster(), sum, totquad, sDum);
|
||||
if (sum>200 && sum<580) {
|
||||
interp->getInterpolatedPosition(cl.x,cl.y, totquad,quad,cl.get_cluster(),int_x, int_y);
|
||||
interp->addToImage(int_x, int_y);
|
||||
totph++;
|
||||
if (lastframe!=cl.iframe) {
|
||||
lastframe=cl.iframe;
|
||||
// cout << cl.iframe << endl;
|
||||
// f0=cl.iframe;
|
||||
if (nframes==0) f0=lastframe;
|
||||
nframes++;
|
||||
#ifdef MANYFILES
|
||||
if (nframes%ff==0) {
|
||||
sprintf(outfname,argv[3],irun,nframes-ff);
|
||||
cout << outfname << endl;
|
||||
interp->writeInterpolatedImage(outfname);
|
||||
interp->clearInterpolatedImage();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
#ifdef XTALK
|
||||
if ((cl.x+1)%25!=0) {
|
||||
for (int ix=-1; ix<2; ix++) {
|
||||
for (int iy=-1; iy<2; iy++) {
|
||||
old_val[iy+1][ix+1]=cl.get_data(ix,iy);
|
||||
if (ix>=0) {
|
||||
new_val[iy+1][ix+1]=old_val[iy+1][ix+1]-old_val[iy+1][ix]*xcorr;
|
||||
cl.set_data(new_val[iy+1][ix+1],ix,iy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
quad=interp->calcQuad(cl.get_cluster(), sum, totquad, sDum);
|
||||
if (sum>cmin && totquad/sum>0.8 && totquad/sum<1.2 && totquad<cmax && quad<cmax) {
|
||||
nph++;
|
||||
// if (sum>200 && sum<580) {
|
||||
// interp->getInterpolatedPosition(cl.x,cl.y, totquad,quad,cl.get_cluster(),int_x, int_y);
|
||||
interp->getInterpolatedPosition(cl.x,cl.y, cl.get_cluster(),int_x, int_y);
|
||||
interp->addToImage(int_x, int_y);
|
||||
interp3->getInterpolatedPosition(cl.x,cl.y, cl.get_cluster(),int3_x, int3_y);
|
||||
interp3->addToImage(int3_x, int3_y);
|
||||
nointerp->getInterpolatedPosition(cl.x,cl.y, cl.get_cluster(),noint_x, noint_y);
|
||||
nointerp->addToImage(noint_x, noint_y);
|
||||
|
||||
|
||||
d_x= (int_x-int3_x)*25.;
|
||||
d_y= (int_y-int3_y)*25.;
|
||||
dummy->calcEta(totquad, sDum, etax, etay);
|
||||
xx=int_x;
|
||||
yy=int_y;
|
||||
if (etax<0.1 || etax>0.9) xx=int3_x;
|
||||
if (etay<0.1 || etay>0.9) yy=int3_y;
|
||||
dummy->addToImage(xx,yy);
|
||||
|
||||
if (d_x>res || d_x<-res || d_y>res || d_y<-res) {
|
||||
badph++;
|
||||
// cout << "delta (um): "<< d_x << " " << d_y << " " << cl.x << " " << cl.y << endl;
|
||||
// cout << sum << " " << totquad << " " << etax << " "<< etay << endl;
|
||||
// //cout<< int_x << " " << int_y << " " << int3_x << " " << int3_y << endl;
|
||||
}
|
||||
mult->addToImage(noint_x, noint_y);
|
||||
|
||||
if (nph%1000000==0) cout << nph << endl;
|
||||
if (nph%100000000==0) {
|
||||
sprintf(outfname,"%s_inteta2.tiff", argv[3]);
|
||||
interp->writeInterpolatedImage(outfname);
|
||||
sprintf(outfname,"%s_inteta3.tiff", argv[3]);
|
||||
interp3->writeInterpolatedImage(outfname);
|
||||
sprintf(outfname,"%s_mix.tiff", argv[3]);
|
||||
dummy->writeInterpolatedImage(outfname);
|
||||
sprintf(outfname,"%s_noint.tiff", argv[3]);
|
||||
nointerp->writeInterpolatedImage(outfname);
|
||||
sprintf(outfname,"%s_mult.tiff", argv[3]);
|
||||
mult->writeInterpolatedImage(outfname);
|
||||
}
|
||||
|
||||
} else {
|
||||
mult->getInterpolatedPosition(cl.x,cl.y, cl.get_cluster(),int_x, int_y);
|
||||
for (int imult=0; imult<2.*sum/(cmax+cmin); imult++) mult->addToImage(int_x, int_y);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
fclose(f);
|
||||
#ifdef FF
|
||||
@ -147,8 +274,22 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
#endif
|
||||
#ifndef FF
|
||||
|
||||
#ifdef MANYFILES
|
||||
sprintf(outfname,argv[3],irun,nframes-ff);
|
||||
cout << outfname << endl;
|
||||
#endif
|
||||
sprintf(outfname,"%s_inteta2.tiff", argv[3]);
|
||||
interp->writeInterpolatedImage(outfname);
|
||||
img=interp->getInterpolatedImage();
|
||||
sprintf(outfname,"%s_inteta3.tiff", argv[3]);
|
||||
interp3->writeInterpolatedImage(outfname);
|
||||
sprintf(outfname,"%s_mix.tiff", argv[3]);
|
||||
dummy->writeInterpolatedImage(outfname);
|
||||
sprintf(outfname,"%s_mult.tiff", argv[3]);
|
||||
mult->writeInterpolatedImage(outfname);
|
||||
|
||||
#ifndef MANYFILES
|
||||
img=interp->getInterpolatedImage();
|
||||
for (ix=0; ix<NC; ix++) {
|
||||
for (iy=0; iy<NR; iy++) {
|
||||
for (isx=0; isx<nsubpix; isx++) {
|
||||
@ -158,18 +299,24 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
cout << "Read " << nframes << " frames (first frame: " << f0 << " last frame: " << lastframe << " delta:" << lastframe-f0 << ")"<<endl;
|
||||
interp->clearInterpolatedImage();
|
||||
interp3->clearInterpolatedImage();
|
||||
dummy->clearInterpolatedImage();
|
||||
mult->clearInterpolatedImage();
|
||||
|
||||
}
|
||||
} else
|
||||
cout << "could not open file " << infname << endl;
|
||||
}
|
||||
|
||||
|
||||
cout << irun << " " << runmax << endl;
|
||||
#ifndef MANYFILES
|
||||
sprintf(outfname,argv[3],11111);
|
||||
WriteToTiff(totimg, outfname,NC*nsubpix,NR*nsubpix);
|
||||
|
||||
#endif
|
||||
cout << "Filled " << nph << " (/"<< totph <<") of which " << badph << " badly interpolated " << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ using namespace std;
|
||||
#define NC 400
|
||||
#define NR 400
|
||||
|
||||
#define XTALK
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
/**
|
||||
@ -20,6 +21,7 @@ int main(int argc, char *argv[]) {
|
||||
int nsubpix=10;
|
||||
int etabins=nsubpix*100;
|
||||
double etamin=-1, etamax=2;
|
||||
double eta3min=-2, eta3max=2;
|
||||
int quad;
|
||||
double sum, totquad;
|
||||
double sDum[2][2];
|
||||
@ -27,16 +29,29 @@ int main(int argc, char *argv[]) {
|
||||
double etax, etay;
|
||||
int runmin, runmax;
|
||||
single_photon_hit cl(3,3);
|
||||
|
||||
if (argc<5) {
|
||||
cout << "Wrong usage! Should be: "<< argv[0] << " infile " << " outfile runmin runmax" << endl;
|
||||
int iph=0;
|
||||
|
||||
if (argc<7) {
|
||||
cout << "Wrong usage! Should be: "<< argv[0] << " infile " << " outfile runmin runmax cmin cmax" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
etaInterpolationPosXY *interp=new etaInterpolationPosXY(NR, NC, nsubpix, etabins, etamin, etamax);
|
||||
eta2InterpolationPosXY *interp2=new eta2InterpolationPosXY(NR, NC, nsubpix, etabins, etamin, etamax);
|
||||
cout << "###########"<< endl;
|
||||
eta3InterpolationPosXY *interp3=new eta3InterpolationPosXY(NR, NC, nsubpix, etabins, eta3min, eta3max);
|
||||
// cout << eta3min << " " << eta3max << endl;
|
||||
runmin=atoi(argv[3]);
|
||||
runmax=atoi(argv[4]);
|
||||
double cmin=atof(argv[5]); //200
|
||||
double cmax=atof(argv[6]); //3000
|
||||
|
||||
#ifdef XTALK
|
||||
int old_val[3][3];
|
||||
int new_val[3][3];
|
||||
double xcorr=0.04;
|
||||
|
||||
// int ix=0;
|
||||
#endif
|
||||
|
||||
FILE *f;
|
||||
for (int i=runmin; i<runmax; i++) {
|
||||
@ -45,18 +60,55 @@ int main(int argc, char *argv[]) {
|
||||
if (f) {
|
||||
cout << "*" << endl;
|
||||
while (cl.read(f)) {
|
||||
interp->calcQuad(cl.get_cluster(), sum, totquad, sDum);
|
||||
if (sum>200 && sum<580 && cl.y<350)
|
||||
interp->addToFlatField(cl.get_cluster(),etax, etay);
|
||||
#ifdef XTALK
|
||||
if ((cl.x+1)%25!=0) {
|
||||
for (int ix=-1; ix<2; ix++) {
|
||||
for (int iy=-1; iy<2; iy++) {
|
||||
old_val[iy+1][ix+1]=cl.get_data(ix,iy);
|
||||
if (ix>=0) {
|
||||
new_val[iy+1][ix+1]=old_val[iy+1][ix+1]-old_val[iy+1][ix]*xcorr;
|
||||
cl.set_data(new_val[iy+1][ix+1],ix,iy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
quad=interp2->calcQuad(cl.get_cluster(), sum, totquad, sDum);
|
||||
|
||||
if (sum>cmin && totquad/sum>0.8 && totquad/sum<1.2 && totquad<cmax && quad<cmax) {
|
||||
/* Cross talk corrections !!! */
|
||||
// for (int ix=0; ix<2; ix++) {
|
||||
|
||||
|
||||
interp2->addToFlatField(cl.get_cluster(),etax, etay);
|
||||
// if (etax>0.49 && etax<0.51 && etay>0.49 && etay<0.51 ) {
|
||||
// cout << cl.y << " " << cl.x << " " << quad << " "<< totquad << " " <<sum << endl;
|
||||
|
||||
// }
|
||||
interp3->addToFlatField(cl.get_cluster(),etax, etay);
|
||||
iph++;
|
||||
if (iph%1000000==0) cout << iph << endl;
|
||||
if (iph%100000000==0) {
|
||||
sprintf(fname,"%s_eta2.tiff",argv[2]);
|
||||
interp2->writeFlatField(fname);
|
||||
sprintf(fname,"%s_eta3.tiff",argv[2]);
|
||||
interp3->writeFlatField(fname);
|
||||
}
|
||||
// if (iph>1E8) break;
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
fclose(f);
|
||||
interp->writeFlatField(argv[2]);
|
||||
|
||||
}
|
||||
else cout << "could not open file " << fname << endl;
|
||||
}
|
||||
|
||||
interp->writeFlatField(argv[2]);
|
||||
sprintf(fname,"%s_eta2.tiff",argv[2]);
|
||||
interp2->writeFlatField(fname);
|
||||
sprintf(fname,"%s_eta3.tiff",argv[2]);
|
||||
interp3->writeFlatField(fname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,160 +0,0 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
//#include <deque>
|
||||
//#include <list>
|
||||
//#include <queue>
|
||||
#include <fstream>
|
||||
|
||||
#include "moench03Ctb10GbT1Data.h"
|
||||
|
||||
#include "interpolatingDetector.h"
|
||||
#include "etaInterpolationPosXY.h"
|
||||
#include "linearInterpolation.h"
|
||||
#include "noInterpolation.h"
|
||||
#include "multiThreadedDetector.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#define NC 400
|
||||
#define NR 400
|
||||
|
||||
#include "tiffIO.h"
|
||||
|
||||
|
||||
void *moenchProcessFrame() {
|
||||
char fname[10000];
|
||||
strcpy(fname,"/mnt/moench_data/m03-15_mufocustube/plant_40kV_10uA/m03-15_100V_g4hg_300us_dtf_0.raw");
|
||||
|
||||
int nthreads=3;
|
||||
|
||||
int nph, nph1;
|
||||
single_photon_hit clusters[NR*NC];
|
||||
// cout << "hits "<< endl;
|
||||
int etabins=550;
|
||||
double etamin=-1, etamax=2;
|
||||
int nsubpix=4;
|
||||
float *etah=new float[etabins*etabins];
|
||||
// cout << "etah "<< endl;
|
||||
cout << "image size "<< nsubpix*nsubpix*NC*NR << endl;
|
||||
float *image=new float[nsubpix*nsubpix*NC*NR];
|
||||
int *heta, *himage;
|
||||
|
||||
moench03Ctb10GbT1Data *decoder=new moench03Ctb10GbT1Data();
|
||||
// cout << "decoder "<< endl;
|
||||
etaInterpolationPosXY *interp=new etaInterpolationPosXY(NC, NR, nsubpix, etabins, etamin, etamax);
|
||||
// cout << "interp "<< endl;
|
||||
//linearInterpolation *interp=new linearInterpolation(NC, NR, nsubpix);
|
||||
//noInterpolation *interp=new noInterpolation(NC, NR, nsubpix);
|
||||
interp->readFlatField("/scratch/eta_100.tiff",etamin,etamax);
|
||||
interpolatingDetector *filter=new interpolatingDetector(decoder,interp, 5, 1, 0, 1000, 10);
|
||||
filter->readPedestals("/scratch/ped_100.tiff");
|
||||
cout << "filter "<< endl;
|
||||
|
||||
|
||||
|
||||
char *buff;
|
||||
int nf=0;
|
||||
int ok=0;
|
||||
ifstream filebin;
|
||||
std::time_t end_time;
|
||||
|
||||
int iFrame=-1;
|
||||
int np=-1;
|
||||
|
||||
|
||||
filter->newDataSet();
|
||||
|
||||
|
||||
multiThreadedDetector *mt=new multiThreadedDetector(filter,nthreads,100);
|
||||
nph=0;
|
||||
nph1=0;
|
||||
//int np;
|
||||
int iph;
|
||||
|
||||
cout << "file name " << fname << endl;
|
||||
filebin.open((const char *)(fname), ios::in | ios::binary);
|
||||
if (filebin.is_open())
|
||||
cout << "Opened file " << fname<< endl;
|
||||
else
|
||||
cout << "Could not open file " << fname<< endl;
|
||||
mt->setFrameMode(eFrame);
|
||||
mt->prepareInterpolation(ok);
|
||||
mt->StartThreads();
|
||||
mt->popFree(buff);
|
||||
|
||||
while ((decoder->readNextFrame(filebin, iFrame, np, buff)) && nf<1.5E4) {
|
||||
if (nf<9E3)
|
||||
;
|
||||
else {
|
||||
|
||||
// if (nf>1.1E4 && ok==0) {
|
||||
// mt->prepareInterpolation(ok);
|
||||
// mt->setFrameMode(eFrame);
|
||||
// //ok=1;
|
||||
// }
|
||||
|
||||
mt->pushData(buff);
|
||||
mt->nextThread();
|
||||
// cout << " " << (void*)buff;
|
||||
mt->popFree(buff);
|
||||
|
||||
// if (ok==0) {
|
||||
// cout << "**************************************************************************"<< endl;
|
||||
// heta=interp->getFlatField();
|
||||
// // for (int ii=0; ii<etabins*etabins; ii++) {
|
||||
// // etah[ii]=(float)heta[ii];
|
||||
// // }
|
||||
|
||||
|
||||
// std::time(&end_time);
|
||||
// cout << std::ctime(&end_time) << " " << nf << endl;
|
||||
// // WriteToTiff(etah, "/scratch/eta.tiff", etabins, etabins);
|
||||
|
||||
// interp->prepareInterpolation(ok);
|
||||
// cout << "**************************************************************************"<< endl;
|
||||
// std::time(&end_time);
|
||||
// cout << std::ctime(&end_time) << " " << nf << endl;
|
||||
// }
|
||||
// filter->processData(buff,eFrame);
|
||||
// }
|
||||
|
||||
// nph+=nph1;
|
||||
}
|
||||
if (nf%1000==0) {
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << " " << nf << endl;
|
||||
}
|
||||
|
||||
nf++;
|
||||
//delete [] buff;
|
||||
iFrame=-1;
|
||||
}
|
||||
|
||||
if (filebin.is_open())
|
||||
filebin.close();
|
||||
else
|
||||
cout << "could not open file " << fname << endl;
|
||||
|
||||
mt->StopThreads();
|
||||
|
||||
char tit[10000];
|
||||
sprintf(tit,"/scratch/int_image_mt%d.tiff",nthreads);
|
||||
|
||||
mt->writeInterpolatedImage(tit);
|
||||
// delete [] etah;
|
||||
|
||||
// delete interp;
|
||||
//delete decoder;
|
||||
//cout << "Read " << nf << " frames" << endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
|
||||
moenchProcessFrame();
|
||||
|
||||
}
|
@ -1,267 +0,0 @@
|
||||
#include "../single_photon_hit.h"
|
||||
//#include "etaVEL/etaInterpolationPosXY.h"
|
||||
#include <TH1F.h>
|
||||
#include <TH2F.h>
|
||||
#include <TCanvas.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
TH2F *readClusters(char *fname, int nx, int ny, TH2F *h2=NULL) {
|
||||
FILE *f=fopen(fname,"r");
|
||||
int iph=0;
|
||||
int ns=4;
|
||||
double px, py;
|
||||
double left, right, top, bottom;
|
||||
if (f) {
|
||||
int x1,y1;
|
||||
if (h2==NULL)
|
||||
h2=new TH2F("h2",fname,nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
|
||||
//h2mult=new TH2F("h2mult",fname,nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
|
||||
// TH2F *hint=new TH2F("hint",fname,nx*ns, -0.5, nx-0.5, ny*ns, -0.5, ny-0.5);
|
||||
TH1F *hf=new TH1F("hf","hf",1000,0,10E6);
|
||||
//TH2F *hff=new TH2F("hff","hff",ns, -0.5, 0.5, ns, -0.5, +0.5);
|
||||
TH1F *hsp=new TH1F("hsp",fname,500,0,10000);
|
||||
// TH1F *hsp1=new TH1F("hsp1",fname,500,0,10000);
|
||||
// TH1F *hsp2=new TH1F("hsp2",fname,500,0,1000);
|
||||
// TH1F *hsp3=new TH1F("hsp3",fname,500,0,1000);
|
||||
// hsp1->SetLineColor(2);
|
||||
// hsp2->SetLineColor(3);
|
||||
// hsp3->SetLineColor(4);
|
||||
TCanvas *c=new TCanvas();
|
||||
h2->Draw("colz");
|
||||
TCanvas *c1=new TCanvas();
|
||||
hsp->Draw();
|
||||
c1->SetLogy(kTRUE);
|
||||
// hsp1->Draw("same");
|
||||
// hsp2->Draw("same");
|
||||
// hsp3->Draw("same");
|
||||
TCanvas *c2=new TCanvas();
|
||||
hf->Draw();
|
||||
// hint->Draw("colz");
|
||||
//c2->SetLogz(kTRUE);
|
||||
single_photon_hit cl(3,3);
|
||||
double tot;
|
||||
int w;
|
||||
double phw=340, phs=62;
|
||||
int f0=-1;
|
||||
double tl, bl, tr, br, qt;
|
||||
int iimage=0;
|
||||
|
||||
while (cl.read(f)) {
|
||||
//cl.get_pixel(x1, y1);
|
||||
//cout << cl.iframe << " " << cl.x << " " << cl.y << endl;
|
||||
//if (cl.x>80 && cl.x<280 && cl.y>80 && cl.y<300) {
|
||||
tot=0; /*
|
||||
left=0;
|
||||
right=0;
|
||||
top=0;
|
||||
bottom=0;*/
|
||||
tl=0; tr=0; bl=0; br=0;
|
||||
for (int ix=-1; ix<2; ix++)
|
||||
for (int iy=-1; iy<2; iy++){
|
||||
tot+=cl.get_data(ix,iy);
|
||||
if (ix<=0 && iy<=0) bl+=cl.get_data(ix,iy);
|
||||
if (ix<=0 && iy>=0) tl+=cl.get_data(ix,iy);
|
||||
if (ix>=0 && iy<=0) br+=cl.get_data(ix,iy);
|
||||
if (ix>=0 && iy>=0) tr+=cl.get_data(ix,iy);
|
||||
|
||||
//if (ix<0) left+=cl.get_data(ix,iy);
|
||||
// if (ix>0) right+=cl.get_data(ix,iy);
|
||||
// if (iy<0) bottom+=cl.get_data(ix,iy);
|
||||
// if (iy>0) top+=cl.get_data(ix,iy);
|
||||
|
||||
}
|
||||
qt=bl;
|
||||
if (br>qt) qt=br;
|
||||
if (tl>qt) qt=tl;
|
||||
if (tr>qt) qt=tr;
|
||||
/*
|
||||
px=(-left+right)/tot;
|
||||
py=(-bottom+top)/tot;*/
|
||||
//max at 340
|
||||
//if (tot>200) {
|
||||
w=1;
|
||||
if (qt>1000) {
|
||||
if (qt/tot>0.8 && qt/tot<1.2){
|
||||
if (f0<0)
|
||||
f0=cl.iframe;
|
||||
hf->Fill(cl.iframe-f0);
|
||||
// if (qt>540) w++;
|
||||
// if (qt>820) w++;
|
||||
//(tot+3.5*phs)/phw;
|
||||
//} else
|
||||
//w=0;
|
||||
// if (w) {
|
||||
// if (cl.y<350) {
|
||||
// if (cl.y<100 || cl.y>300) {
|
||||
// if (cl.x>150 && cl.x<250 && cl.y>200 && cl.y<250)
|
||||
// hsp1->Fill(qt);
|
||||
// else
|
||||
hsp->Fill(qt);
|
||||
|
||||
// hsp2->Fill(cl.get_data(0,0));
|
||||
// } else {
|
||||
// hsp1->Fill(qt);
|
||||
// hsp3->Fill(cl.get_data(0,0));
|
||||
// }
|
||||
//if (cl.x>160 && cl.x<260 && cl.y>30 && cl.y<80 && tot>0)
|
||||
//if (w==1) {
|
||||
// if (w==2)
|
||||
h2->Fill(cl.x,cl.y,w);
|
||||
// }
|
||||
//}
|
||||
// hint->Fill(px+cl.x,py+cl.y,w);
|
||||
// if (cl.y<350)
|
||||
// hff->Fill(px,py,w);
|
||||
|
||||
// }
|
||||
|
||||
//h2mult->Fill(cl.x,cl.y,w);
|
||||
|
||||
}
|
||||
iph+=w;
|
||||
if (iph%100000==0) {
|
||||
c->Modified();
|
||||
c->Update();
|
||||
c1->Modified();;
|
||||
c1->Update();
|
||||
c2->Modified();;
|
||||
c2->Update();
|
||||
}
|
||||
// if (iph>1E7)
|
||||
// break;
|
||||
//}
|
||||
// if (iph>0.5E7) break;
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
// hff->Scale(hff->GetNbinsX()*hff->GetNbinsY()/hff->Integral());
|
||||
// TH2F *hint2=(TH2F*)hint->Clone("hint2");
|
||||
// double ff;
|
||||
// for (int ibx=0; ibx<hint->GetNbinsX(); ibx++) {
|
||||
// for (int iby=0; iby<hint->GetNbinsY(); iby++) {
|
||||
// ff=hff->GetBinContent(ibx%ns+1, iby%ns+1);
|
||||
// // cout << ibx << " " << iby << " " << ibx%ns << " " << iby%ns << " " << ff << endl;
|
||||
// if (ff>0)
|
||||
// hint2->SetBinContent(ibx+1, iby+1,hint->GetBinContent(ibx+1,iby+1)/ff);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return h2;
|
||||
|
||||
} else
|
||||
cout << "could not open file " << fname << endl;
|
||||
return NULL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TH2F *getEta(char *fname, int nx, int ny, TH2F *h2=NULL) {
|
||||
// int ns=10;
|
||||
// slsInterpolation *inte=new etaInterpolationPosXY(nx,ny,ns,
|
||||
|
||||
// FILE *f=fopen(fname,"r");
|
||||
// int iph=0;
|
||||
// int ns=4;
|
||||
// double px, py;
|
||||
// double left, right, top, bottom;
|
||||
// if (f) {
|
||||
// int x1,y1;
|
||||
// if (h2==NULL)
|
||||
// h2=new TH2F("h2",fname,nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
|
||||
// h2mult=new TH2F("h2mult",fname,nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
|
||||
// TH2F *hint=new TH2F("hint",fname,nx*ns, -0.5, nx-0.5, ny*ns, -0.5, ny-0.5);
|
||||
// // TH2F *hff=new TH2F("hff","hff",ns, -0.5, 0.5, ns, -0.5, +0.5);
|
||||
// TH1F *hsp=new TH1F("hsp",fname,500,0,2000);
|
||||
// TCanvas *c=new TCanvas();
|
||||
// c->SetLogz(kTRUE);
|
||||
// h2->Draw("colz");
|
||||
// TCanvas *c1=new TCanvas();
|
||||
// hsp->Draw();
|
||||
// TCanvas *c2=new TCanvas();
|
||||
// hint->Draw("colz");
|
||||
// c2->SetLogz(kTRUE);
|
||||
// single_photon_hit cl(3,3);
|
||||
// double tot;
|
||||
// int w;
|
||||
// double phw=340, phs=62;
|
||||
// while (cl.read(f)) {
|
||||
// //cl.get_pixel(x1, y1);
|
||||
// //cout << cl.iframe << " " << cl.x << " " << cl.y << endl;
|
||||
// //if (cl.x>80 && cl.x<280 && cl.y>80 && cl.y<300) {
|
||||
// tot=0;
|
||||
// left=0;
|
||||
// right=0;
|
||||
// top=0;
|
||||
// bottom=0;
|
||||
// for (int ix=-1; ix<2; ix++)
|
||||
// for (int iy=-1; iy<2; iy++){
|
||||
// tot+=cl.get_data(ix,iy);
|
||||
// if (ix<0) left+=cl.get_data(ix,iy);
|
||||
// if (ix>0) right+=cl.get_data(ix,iy);
|
||||
// if (iy<0) bottom+=cl.get_data(ix,iy);
|
||||
// if (iy>0) top+=cl.get_data(ix,iy);
|
||||
|
||||
// }
|
||||
// px=(-left+right)/tot;
|
||||
// py=(-bottom+top)/tot;
|
||||
// //max at 340
|
||||
// if (tot>200) {
|
||||
// w=(tot+3.5*phs)/phw;
|
||||
// } else
|
||||
// w=0;
|
||||
// if (w) {
|
||||
// hsp->Fill(tot);
|
||||
// if (w==1) {
|
||||
// h2->Fill(cl.x,cl.y,w);
|
||||
// hint->Fill(px+cl.x,py+cl.y,w);
|
||||
// }
|
||||
|
||||
// h2mult->Fill(cl.x,cl.y,w);
|
||||
|
||||
// // if (cl.y<350)
|
||||
// // hff->Fill(px,py,w);
|
||||
// //}
|
||||
// iph+=w;
|
||||
// if (iph%100000==0) {
|
||||
// // c->Modified();
|
||||
// // c->Update();
|
||||
// c1->Modified();;
|
||||
// c1->Update();
|
||||
// // c2->Modified();;
|
||||
// // c2->Update();
|
||||
// }
|
||||
// }
|
||||
// // if (iph>0.5E7) break;
|
||||
// }
|
||||
// fclose(f);
|
||||
// // hff->Scale(hff->GetNbinsX()*hff->GetNbinsY()/hff->Integral());
|
||||
// // TH2F *hint2=(TH2F*)hint->Clone("hint2");
|
||||
// // double ff;
|
||||
// // for (int ibx=0; ibx<hint->GetNbinsX(); ibx++) {
|
||||
// // for (int iby=0; iby<hint->GetNbinsY(); iby++) {
|
||||
// // ff=hff->GetBinContent(ibx%ns+1, iby%ns+1);
|
||||
// // // cout << ibx << " " << iby << " " << ibx%ns << " " << iby%ns << " " << ff << endl;
|
||||
// // if (ff>0)
|
||||
// // hint2->SetBinContent(ibx+1, iby+1,hint->GetBinContent(ibx+1,iby+1)/ff);
|
||||
// // }
|
||||
// // }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// return h2;
|
||||
|
||||
// } else
|
||||
// cout << "could not open file " << fname << endl;
|
||||
// return NULL;
|
||||
|
||||
|
||||
// }
|
@ -51,8 +51,11 @@ class pedestalSubtraction {
|
||||
/** sets the moving average */
|
||||
virtual void setPedestalRMS(double rms) {stat.SetRMS(rms);}
|
||||
|
||||
|
||||
|
||||
/**sets/gets the number of samples for the moving average
|
||||
\returns actual number of samples for the moving average
|
||||
*/
|
||||
virtual int getNumpedestals() {return stat.NumDataValues();};
|
||||
|
||||
private:
|
||||
MovingStat stat; /**< approximated moving average struct */
|
||||
|
||||
|
@ -58,7 +58,7 @@ public analogDetector<uint16_t> {
|
||||
int sign=1,
|
||||
commonModeSubtraction *cm=NULL,
|
||||
int nped=1000,
|
||||
int nd=100, int nnx=-1, int nny=-1, double *gm=NULL) : analogDetector<uint16_t>(d, sign, cm, nped, nnx, nny, gm), nDark(nd), eventMask(NULL),nSigma (nsigma), clusterSize(csize), clusterSizeY(csize), cluster(NULL), quad(UNDEFINED_QUADRANT), tot(0), quadTot(0) {
|
||||
int nd=100, int nnx=-1, int nny=-1, double *gm=NULL) : analogDetector<uint16_t>(d, sign, cm, nped, nnx, nny, gm), nDark(nd), eventMask(NULL),nSigma (nsigma), clusterSize(csize), clusterSizeY(csize), clusters(NULL), quad(UNDEFINED_QUADRANT), tot(0), quadTot(0) {
|
||||
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ public analogDetector<uint16_t> {
|
||||
// cluster=new single_photon_hit(clusterSize,clusterSizeY);
|
||||
clusters=new single_photon_hit[nx*ny];
|
||||
|
||||
cluster=clusters;
|
||||
// cluster=clusters;
|
||||
setClusterSize(csize);
|
||||
nphTot=0;
|
||||
nphFrame=0;
|
||||
@ -82,7 +82,7 @@ public analogDetector<uint16_t> {
|
||||
/**
|
||||
destructor. Deletes the cluster structure, the pdestalSubtraction and the image array
|
||||
*/
|
||||
virtual ~singlePhotonDetector() {delete cluster; for (int i=0; i<ny; i++) delete [] eventMask[i]; delete [] eventMask; };
|
||||
virtual ~singlePhotonDetector() {delete [] clusters; for (int i=0; i<ny; i++) delete [] eventMask[i]; delete [] eventMask; };
|
||||
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ public analogDetector<uint16_t> {
|
||||
// cluster=new single_photon_hit(clusterSize,clusterSizeY);
|
||||
clusters=new single_photon_hit[nx*ny];
|
||||
|
||||
cluster=clusters;
|
||||
// cluster=clusters;
|
||||
|
||||
setClusterSize(clusterSize);
|
||||
|
||||
@ -147,8 +147,8 @@ public analogDetector<uint16_t> {
|
||||
if (n%2==0)
|
||||
n+=1;
|
||||
clusterSize=n;
|
||||
if (cluster)
|
||||
delete cluster;
|
||||
// if (clusters)
|
||||
// delete [] clusters;
|
||||
if (ny>clusterSize)
|
||||
clusterSizeY=clusterSize;
|
||||
else
|
||||
@ -192,29 +192,37 @@ public analogDetector<uint16_t> {
|
||||
double max=0, tl=0, tr=0, bl=0,br=0, v;
|
||||
|
||||
|
||||
if (thr>=0) {
|
||||
int cm=0;
|
||||
if (cmSub) cm=1;
|
||||
|
||||
if (thr>0) {
|
||||
cy=1;
|
||||
cs=1;
|
||||
ccs=1;
|
||||
ccy=1;
|
||||
}
|
||||
|
||||
if (iframe<nDark) {
|
||||
//cout << "ped " << iframe << endl;
|
||||
// cout << "ped " << iframe << endl;
|
||||
//this already adds to common mode
|
||||
addToPedestal(data);
|
||||
return nph;
|
||||
} else {
|
||||
if (thr>0) {
|
||||
|
||||
newFrame();
|
||||
if (cmSub) {
|
||||
addToCommonMode(data);
|
||||
}
|
||||
for (int ix=xmin; ix<xmax; ix++) {
|
||||
for (int iy=ymin; iy<ymax; iy++) {
|
||||
|
||||
val=subtractPedestal(data,ix,iy);
|
||||
val=subtractPedestal(data,ix,iy, cm);
|
||||
|
||||
nn=analogDetector<uint16_t>::getNPhotons(data,ix,iy);
|
||||
nn=val/tthr;//analogDetector<uint16_t>::getNPhotons(data,ix,iy);
|
||||
nph[ix+nx*iy]+=nn;
|
||||
rest[iy][ix]=(val-nn*tthr);
|
||||
|
||||
nphFrame+=nn;
|
||||
nphTot+=nn;
|
||||
}
|
||||
}
|
||||
// }
|
||||
@ -235,10 +243,10 @@ public analogDetector<uint16_t> {
|
||||
for (int ir=-(clusterSizeY/2); ir<(clusterSizeY/2)+1; ir++) {
|
||||
for (int ic=-(clusterSize/2); ic<(clusterSize/2)+1; ic++) {
|
||||
if ((iy+ir)>=0 && (iy+ir)<ny && (ix+ic)>=0 && (ix+ic)<nx) {
|
||||
//cluster->set_data(rest[iy+ir][ix+ic], ic, ir);
|
||||
//clusters->set_data(rest[iy+ir][ix+ic], ic, ir);
|
||||
|
||||
|
||||
v=rest[iy+ir][ix+ic];//cluster->get_data(ic,ir);
|
||||
v=rest[iy+ir][ix+ic];//clusters->get_data(ic,ir);
|
||||
tot+=v;
|
||||
|
||||
if (ir<=0 && ic<=0)
|
||||
@ -278,14 +286,15 @@ public analogDetector<uint16_t> {
|
||||
if (max>tthr || tot>sqrt(ccy*ccs)*tthr || quadTot>sqrt(cy*cs)*tthr) {
|
||||
eventMask[iy][ix]=PHOTON;
|
||||
nph[ix+nx*iy]++;
|
||||
nphFrame+=nph[ix+nx*iy];
|
||||
nphTot+=nph[ix+nx*iy];
|
||||
nphFrame++;
|
||||
nphTot++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cout << iframe << " " << nph << endl;
|
||||
// cout << iframe << " " << nphFrame << " " << nphTot << endl;
|
||||
//cout << iframe << " " << nph << endl;
|
||||
} else return getClusters(data, nph);
|
||||
}
|
||||
return NULL;
|
||||
@ -329,10 +338,10 @@ public analogDetector<uint16_t> {
|
||||
eventMask[iy][ix]=PEDESTAL;
|
||||
|
||||
|
||||
cluster->x=ix;
|
||||
cluster->y=iy;
|
||||
cluster->rms=getPedestalRMS(ix,iy);
|
||||
cluster->ped=getPedestal(ix,iy, cm);
|
||||
clusters->x=ix;
|
||||
clusters->y=iy;
|
||||
clusters->rms=getPedestalRMS(ix,iy);
|
||||
clusters->ped=getPedestal(ix,iy, cm);
|
||||
|
||||
|
||||
for (int ir=-(clusterSizeY/2); ir<(clusterSizeY/2)+1; ir++) {
|
||||
@ -341,8 +350,8 @@ public analogDetector<uint16_t> {
|
||||
|
||||
v=subtractPedestal(data, ix+ic, iy+ir);
|
||||
|
||||
cluster->set_data(v, ic, ir);
|
||||
// v=cluster->get_data(ic,ir);
|
||||
clusters->set_data(v, ic, ir);
|
||||
// v=clusters->get_data(ic,ir);
|
||||
tot+=v;
|
||||
if (ir<=0 && ic<=0)
|
||||
bl+=v;
|
||||
@ -357,7 +366,7 @@ public analogDetector<uint16_t> {
|
||||
max=v;
|
||||
}
|
||||
if (ir==0 && ic==0) {
|
||||
if (v<-nSigma*cluster->rms)
|
||||
if (v<-nSigma*clusters->rms)
|
||||
eventMask[iy][ix]=NEGATIVE_PEDESTAL;
|
||||
}
|
||||
}
|
||||
@ -378,8 +387,8 @@ public analogDetector<uint16_t> {
|
||||
quadTot=tr;
|
||||
}
|
||||
|
||||
if (max>nSigma*cluster->rms || tot>sqrt(clusterSizeY*clusterSize)*nSigma*cluster->rms || quadTot>cy*cs*nSigma*cluster->rms) {
|
||||
if (cluster->get_data(0,0)>=max) {
|
||||
if (max>nSigma*clusters->rms || tot>sqrt(clusterSizeY*clusterSize)*nSigma*clusters->rms || quadTot>cy*cs*nSigma*clusters->rms) {
|
||||
if (clusters->get_data(0,0)>=max) {
|
||||
eventMask[iy][ix]=PHOTON_MAX;
|
||||
} else {
|
||||
eventMask[iy][ix]=PHOTON;
|
||||
@ -420,7 +429,8 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
int ir, ic;
|
||||
|
||||
double max=0, tl=0, tr=0, bl=0,br=0, *v, vv;
|
||||
|
||||
int cm=0;
|
||||
if (cmSub) cm=1;
|
||||
if (ph==NULL)
|
||||
ph=image;
|
||||
|
||||
@ -429,6 +439,13 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
return 0;
|
||||
}
|
||||
newFrame();
|
||||
|
||||
|
||||
|
||||
if (cm)
|
||||
addToCommonMode(data);
|
||||
|
||||
|
||||
for (int ix=xmin; ix<xmax; ix++) {
|
||||
for (int iy=ymin; iy<ymax; iy++) {
|
||||
|
||||
@ -447,14 +464,14 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
|
||||
|
||||
(clusters+nph)->rms=getPedestalRMS(ix,iy);
|
||||
cluster=clusters+nph;
|
||||
// cluster=clusters+nph;
|
||||
|
||||
|
||||
for (int ir=-(clusterSizeY/2); ir<(clusterSizeY/2)+1; ir++) {
|
||||
for (int ic=-(clusterSize/2); ic<(clusterSize/2)+1; ic++) {
|
||||
|
||||
if ((iy+ir)>=iy && (iy+ir)<ny && (ix+ic)>=ix && (ix+ic)<nx) {
|
||||
val[iy+ir][ix+ic]=subtractPedestal(data,ix+ic,iy+ir);
|
||||
val[iy+ir][ix+ic]=subtractPedestal(data,ix+ic,iy+ir, cm);
|
||||
}
|
||||
|
||||
v=&(val[iy+ir][ix+ic]);
|
||||
@ -473,7 +490,7 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
|
||||
|
||||
if (ir==0 && ic==0) {
|
||||
if (*v<-nSigma*cluster->rms)
|
||||
if (*v<-nSigma*(clusters+nph)->rms)
|
||||
eventMask[iy][ix]=NEGATIVE_PEDESTAL;
|
||||
}
|
||||
|
||||
@ -494,7 +511,7 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
(clusters+nph)->quadTot=tr;
|
||||
}
|
||||
|
||||
if (max>nSigma*cluster->rms || tot>sqrt(clusterSizeY*clusterSize)*nSigma*cluster->rms || ((clusters+nph)->quadTot)>sqrt(cy*cs)*nSigma*cluster->rms) {
|
||||
if (max>nSigma*(clusters+nph)->rms || tot>sqrt(clusterSizeY*clusterSize)*nSigma*(clusters+nph)->rms || ((clusters+nph)->quadTot)>sqrt(cy*cs)*nSigma*(clusters+nph)->rms) {
|
||||
if (val[iy][ix]>=max) {
|
||||
eventMask[iy][ix]=PHOTON_MAX;
|
||||
(clusters+nph)->tot=tot;
|
||||
@ -507,6 +524,7 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
(clusters+nph)->set_data(val[iy+ir][ix+ic],ic,ir);
|
||||
}
|
||||
}
|
||||
// cout << (clusters+nph)->iframe << " " << ix << " " << nph << " " << tot << " " << (clusters+nph)->quadTot << endl;
|
||||
nph++;
|
||||
image[iy*nx+ix]++;
|
||||
|
||||
@ -514,7 +532,7 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
eventMask[iy][ix]=PHOTON;
|
||||
}
|
||||
} else if (eventMask[iy][ix]==PEDESTAL) {
|
||||
addToPedestal(data,ix,iy);
|
||||
addToPedestal(data,ix,iy,cm);
|
||||
}
|
||||
|
||||
|
||||
@ -559,7 +577,7 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
\param ir y coordinate (center is (0,0))
|
||||
\returns cluster element
|
||||
*/
|
||||
double getClusterElement(int ic, int ir=0){return cluster->get_data(ic,ir);};
|
||||
double getClusterElement(int ic, int ir=0){return clusters->get_data(ic,ir);};
|
||||
|
||||
/** returns event mask for the given pixel
|
||||
\param ic x coordinate (center is (0,0))
|
||||
@ -581,25 +599,25 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
if (iFrame)
|
||||
tall->Branch("iFrame",iFrame,"iframe/I");
|
||||
else
|
||||
tall->Branch("iFrame",&(cluster->iframe),"iframe/I");
|
||||
tall->Branch("iFrame",&(clusters->iframe),"iframe/I");
|
||||
|
||||
tall->Branch("x",&(cluster->x),"x/I");
|
||||
tall->Branch("y",&(cluster->y),"y/I");
|
||||
tall->Branch("x",&(clusters->x),"x/I");
|
||||
tall->Branch("y",&(clusters->y),"y/I");
|
||||
char tit[100];
|
||||
sprintf(tit,"data[%d]/D",clusterSize*clusterSizeY);
|
||||
tall->Branch("data",cluster->data,tit);
|
||||
tall->Branch("pedestal",&(cluster->ped),"pedestal/D");
|
||||
tall->Branch("rms",&(cluster->rms),"rms/D");
|
||||
tall->Branch("tot",&(cluster->tot),"tot/D");
|
||||
tall->Branch("quadTot",&(cluster->quadTot),"quadTot/D");
|
||||
tall->Branch("quad",&(cluster->quad),"quad/I");
|
||||
tall->Branch("data",clusters->data,tit);
|
||||
tall->Branch("pedestal",&(clusters->ped),"pedestal/D");
|
||||
tall->Branch("rms",&(clusters->rms),"rms/D");
|
||||
tall->Branch("tot",&(clusters->tot),"tot/D");
|
||||
tall->Branch("quadTot",&(clusters->quadTot),"quadTot/D");
|
||||
tall->Branch("quad",&(clusters->quad),"quad/I");
|
||||
return tall;
|
||||
};
|
||||
#else
|
||||
/** write cluster to filer
|
||||
\param f file pointer
|
||||
*/
|
||||
void writeCluster(FILE* f){cluster->write(f);};
|
||||
void writeCluster(FILE* f){clusters->write(f);};
|
||||
|
||||
/**
|
||||
write clusters to file
|
||||
@ -643,7 +661,7 @@ void writeClusters(FILE *f){for (int i=0; i<nphFrame; i++) (clusters+i)->write(f
|
||||
double nSigma; /**< number of sigma parameter for photon discrimination */
|
||||
int clusterSize; /**< cluster size in the x direction */
|
||||
int clusterSizeY; /**< cluster size in the y direction i.e. 1 for strips, clusterSize for pixels */
|
||||
single_photon_hit *cluster; /**< single photon hit data structure */
|
||||
// single_photon_hit *cluster; /**< single photon hit data structure */
|
||||
single_photon_hit *clusters; /**< single photon hit data structure */
|
||||
quadrant quad; /**< quadrant where the photon is located */
|
||||
double tot; /**< sum of the 3x3 cluster */
|
||||
|
@ -1,5 +1,7 @@
|
||||
#ifndef SINGLE_PHOTON_HIT_H
|
||||
#define SINGLE_PHOTON_HIT_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
@ -26,7 +28,7 @@ class single_photon_hit {
|
||||
\param nx cluster size in x direction
|
||||
\param ny cluster size in y direction (defaults to 1 for 1D detectors)
|
||||
*/
|
||||
single_photon_hit(int nx=3, int ny=3): dx(nx), dy(ny) {data=new double[dx*dy];};
|
||||
single_photon_hit(int nx=3, int ny=3): dx(nx), dy(ny) {data=new int[dx*dy];};
|
||||
|
||||
~single_photon_hit(){delete [] data;}; /**< destructor, deletes the data array */
|
||||
|
||||
@ -35,8 +37,9 @@ class single_photon_hit {
|
||||
*/
|
||||
size_t write(FILE *myFile) {
|
||||
//fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile);
|
||||
if (fwrite((void*)this, 1, 3*sizeof(int), myFile))
|
||||
return fwrite((void*)data, 1, dx*dy*sizeof(double), myFile);
|
||||
|
||||
if (fwrite((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
|
||||
return fwrite((void*)data, 1, dx*dy*sizeof(int), myFile);
|
||||
return 0;
|
||||
};
|
||||
|
||||
@ -47,8 +50,8 @@ class single_photon_hit {
|
||||
size_t read(FILE *myFile) {
|
||||
//fread((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile);
|
||||
|
||||
if (fread((void*)this, 1, 3*sizeof(int), myFile))
|
||||
return fread((void*)data, 1, dx*dy*sizeof(double), myFile);
|
||||
if (fread((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
|
||||
return fread((void*)data, 1, dx*dy*sizeof(int), myFile);
|
||||
return 0;
|
||||
};
|
||||
|
||||
@ -60,7 +63,7 @@ class single_photon_hit {
|
||||
*/
|
||||
void set_data(double v, int ix, int iy=0){data[(iy+dy/2)*dx+ix+dx/2]=v;};
|
||||
|
||||
void set_cluster_size(int nx, int ny) {if (nx>0) dx=nx; if (ny>0) dy=ny; delete [] data; data=new double[dx*dy];};
|
||||
void set_cluster_size(int nx, int ny) {if (nx>0) dx=nx; if (ny>0) dy=ny; delete [] data; data=new int[dx*dy];};
|
||||
void get_cluster_size(int &nx, int &ny) {nx=dx; ny=dy;};
|
||||
void get_pixel(int &x1, int &y1) {x1=x; y1=y;};
|
||||
|
||||
@ -71,11 +74,11 @@ class single_photon_hit {
|
||||
\returns value of the cluster element
|
||||
*/
|
||||
double get_data(int ix, int iy=0){return data[(iy+dy/2)*dx+ix+dx/2];};
|
||||
double *get_cluster() {return data;};
|
||||
int *get_cluster() {return data;};
|
||||
|
||||
int iframe; /**< frame number */
|
||||
int x; /**< x-coordinate of the center of hit */
|
||||
int y; /**< x-coordinate of the center of hit */
|
||||
int16_t x; /**< x-coordinate of the center of hit */
|
||||
int16_t y; /**< x-coordinate of the center of hit */
|
||||
double rms; /**< noise of central pixel l -- at some point it can be removed*/
|
||||
double ped; /**< pedestal of the central pixel -- at some point it can be removed*/
|
||||
double tot; /**< sum of the 3x3 cluster */
|
||||
@ -83,7 +86,7 @@ class single_photon_hit {
|
||||
double quadTot; /**< sum of the maximum 2x2cluster */
|
||||
int dx; /**< size of data cluster in x */
|
||||
int dy; /**< size of data cluster in y */
|
||||
double *data; /**< pointer to data */
|
||||
int *data; /**< pointer to data */
|
||||
};
|
||||
|
||||
|
||||
|
98
slsDetectorCalibration/single_photon_hit_double.h
Normal file
98
slsDetectorCalibration/single_photon_hit_double.h
Normal file
@ -0,0 +1,98 @@
|
||||
#ifndef SINGLE_PHOTON_HIT_H
|
||||
#define SINGLE_PHOTON_HIT_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
|
||||
#ifndef DEF_QUAD
|
||||
#define DEF_QUAD
|
||||
enum quadrant {
|
||||
TOP_LEFT=0,
|
||||
TOP_RIGHT=1,
|
||||
BOTTOM_LEFT=2,
|
||||
BOTTOM_RIGHT=3,
|
||||
UNDEFINED_QUADRANT=-1
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class single_photon_hit_double {
|
||||
|
||||
/** @short Structure for a single photon hit */
|
||||
|
||||
public:
|
||||
/** constructor, instantiates the data array -- all class elements are public!
|
||||
\param nx cluster size in x direction
|
||||
\param ny cluster size in y direction (defaults to 1 for 1D detectors)
|
||||
*/
|
||||
single_photon_hit_double(int nx=3, int ny=3): dx(nx), dy(ny) {
|
||||
data=new double[dx*dy];
|
||||
};
|
||||
|
||||
~single_photon_hit_double(){delete [] data;}; /**< destructor, deletes the data array */
|
||||
|
||||
/** binary write to file of all elements of the structure, except size of the cluster
|
||||
\param myFile file descriptor
|
||||
*/
|
||||
size_t write(FILE *myFile) {
|
||||
//fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile);
|
||||
if (fwrite((void*)this, 1, sizeof(int)+2*sizeof(int), myFile))
|
||||
return fwrite((void*)data, 1, dx*dy*sizeof(double), myFile);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
binary read from file of all elements of the structure, except size of the cluster. The structure is then filled with those args
|
||||
\param myFile file descriptor
|
||||
*/
|
||||
size_t read(FILE *myFile) {
|
||||
//fread((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile);
|
||||
|
||||
if (fread((void*)this, 1, sizeof(int)+2*sizeof(int), myFile))
|
||||
return fread((void*)data, 1, dx*dy*sizeof(double), myFile);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
assign the value to the element of the cluster matrix, with relative coordinates where the center of the cluster is (0,0)
|
||||
\param v value to be set
|
||||
\param ix coordinate x within the cluster (center is (0,0))
|
||||
\param iy coordinate y within the cluster (center is (0,0))
|
||||
*/
|
||||
void set_data(double v, int ix, int iy=0){data[(iy+dy/2)*dx+ix+dx/2]=v;};
|
||||
|
||||
void set_cluster_size(int nx, int ny) {
|
||||
|
||||
if (nx>0) dx=nx; if (ny>0) dy=ny; delete [] data; data=new double[dx*dy];
|
||||
};
|
||||
void get_cluster_size(int &nx, int &ny) {nx=dx; ny=dy;};
|
||||
void get_pixel(int &x1, int &y1) {x1=x; y1=y;};
|
||||
|
||||
/**
|
||||
gets the value to the element of the cluster matrix, with relative coordinates where the center of the cluster is (0,0)
|
||||
\param ix coordinate x within the cluster (center is (0,0))
|
||||
\param iy coordinate y within the cluster (center is (0,0))
|
||||
\returns value of the cluster element
|
||||
*/
|
||||
double get_data(int ix, int iy=0){return data[(iy+dy/2)*dx+ix+dx/2];};
|
||||
double *get_cluster() {return data;};
|
||||
|
||||
int iframe; /**< frame number */
|
||||
int x; /**< x-coordinate of the center of hit */
|
||||
int y; /**< x-coordinate of the center of hit */
|
||||
double rms; /**< noise of central pixel l -- at some point it can be removed*/
|
||||
double ped; /**< pedestal of the central pixel -- at some point it can be removed*/
|
||||
double tot; /**< sum of the 3x3 cluster */
|
||||
quadrant quad; /**< quadrant where the photon is located */
|
||||
double quadTot; /**< sum of the maximum 2x2cluster */
|
||||
int dx; /**< size of data cluster in x */
|
||||
int dy; /**< size of data cluster in y */
|
||||
double *data; /**< pointer to data */
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
93
slsDetectorCalibration/single_photon_hit_old.h
Normal file
93
slsDetectorCalibration/single_photon_hit_old.h
Normal file
@ -0,0 +1,93 @@
|
||||
#ifndef SINGLE_PHOTON_HIT_H
|
||||
#define SINGLE_PHOTON_HIT_H
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
|
||||
#ifndef DEF_QUAD
|
||||
#define DEF_QUAD
|
||||
enum quadrant {
|
||||
TOP_LEFT=0,
|
||||
TOP_RIGHT=1,
|
||||
BOTTOM_LEFT=2,
|
||||
BOTTOM_RIGHT=3,
|
||||
UNDEFINED_QUADRANT=-1
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class single_photon_hit {
|
||||
|
||||
/** @short Structure for a single photon hit */
|
||||
|
||||
public:
|
||||
/** constructor, instantiates the data array -- all class elements are public!
|
||||
\param nx cluster size in x direction
|
||||
\param ny cluster size in y direction (defaults to 1 for 1D detectors)
|
||||
*/
|
||||
single_photon_hit(int nx=3, int ny=3): dx(nx), dy(ny) {data=new int[dx*dy];};
|
||||
|
||||
~single_photon_hit(){delete [] data;}; /**< destructor, deletes the data array */
|
||||
|
||||
/** binary write to file of all elements of the structure, except size of the cluster
|
||||
\param myFile file descriptor
|
||||
*/
|
||||
size_t write(FILE *myFile) {
|
||||
//fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile);
|
||||
if (fwrite((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
|
||||
return fwrite((void*)data, 1, dx*dy*sizeof(int), myFile);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
binary read from file of all elements of the structure, except size of the cluster. The structure is then filled with those args
|
||||
\param myFile file descriptor
|
||||
*/
|
||||
size_t read(FILE *myFile) {
|
||||
//fread((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile);
|
||||
|
||||
if (fread((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
|
||||
return fread((void*)data, 1, dx*dy*sizeof(int), myFile);
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
assign the value to the element of the cluster matrix, with relative coordinates where the center of the cluster is (0,0)
|
||||
\param v value to be set
|
||||
\param ix coordinate x within the cluster (center is (0,0))
|
||||
\param iy coordinate y within the cluster (center is (0,0))
|
||||
*/
|
||||
void set_data(double v, int ix, int iy=0){data[(iy+dy/2)*dx+ix+dx/2]=v;};
|
||||
|
||||
void set_cluster_size(int nx, int ny) {if (nx>0) dx=nx; if (ny>0) dy=ny; delete [] data; data=new int[dx*dy];};
|
||||
void get_cluster_size(int &nx, int &ny) {nx=dx; ny=dy;};
|
||||
void get_pixel(int &x1, int &y1) {x1=x; y1=y;};
|
||||
|
||||
/**
|
||||
gets the value to the element of the cluster matrix, with relative coordinates where the center of the cluster is (0,0)
|
||||
\param ix coordinate x within the cluster (center is (0,0))
|
||||
\param iy coordinate y within the cluster (center is (0,0))
|
||||
\returns value of the cluster element
|
||||
*/
|
||||
double get_data(int ix, int iy=0){return data[(iy+dy/2)*dx+ix+dx/2];};
|
||||
int *get_cluster() {return data;};
|
||||
|
||||
int iframe; /**< frame number */
|
||||
int16_t x; /**< x-coordinate of the center of hit */
|
||||
int16_t y; /**< x-coordinate of the center of hit */
|
||||
double rms; /**< noise of central pixel l -- at some point it can be removed*/
|
||||
double ped; /**< pedestal of the central pixel -- at some point it can be removed*/
|
||||
double tot; /**< sum of the 3x3 cluster */
|
||||
quadrant quad; /**< quadrant where the photon is located */
|
||||
double quadTot; /**< sum of the maximum 2x2cluster */
|
||||
int dx; /**< size of data cluster in x */
|
||||
int dy; /**< size of data cluster in y */
|
||||
int *data; /**< pointer to data */
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -298,7 +298,7 @@ class slsDetectorData {
|
||||
|
||||
*/
|
||||
virtual int getFrameNumber(char *buff)=0;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Returns the packet number for the given dataset. purely virtual func
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
#ifndef MY_TIFF_IO_H
|
||||
#include "tiffIO.h"
|
||||
#endif
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
// #undef cbf_failnez
|
||||
|
@ -105,11 +105,6 @@ set_target_properties(slsDetectorGui PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
add_library(zmq STATIC IMPORTED )
|
||||
|
||||
set_target_properties(zmq PROPERTIES
|
||||
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../slsReceiverSoftware/include/libzmq.a
|
||||
)
|
||||
|
||||
target_link_libraries(slsDetectorGui
|
||||
slsDetectorShared
|
||||
|
@ -51,7 +51,7 @@
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="elideMode">
|
||||
<enum>Qt::ElideLeft</enum>
|
||||
@ -77,7 +77,7 @@
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>20</y>
|
||||
<width>324</width>
|
||||
<width>345</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -142,7 +142,7 @@
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>15</y>
|
||||
<width>242</width>
|
||||
<width>259</width>
|
||||
<height>44</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -198,7 +198,7 @@ Plots Trimbits from Detector. This will take time.
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>20</y>
|
||||
<width>195</width>
|
||||
<width>211</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -256,7 +256,7 @@ Plots Trimbits from Detector. This will take time.
|
||||
<x>25</x>
|
||||
<y>25</y>
|
||||
<width>696</width>
|
||||
<height>195</height>
|
||||
<height>208</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
@ -977,7 +977,7 @@ An extension given by the modules serial number will be attached.
|
||||
<x>25</x>
|
||||
<y>25</y>
|
||||
<width>686</width>
|
||||
<height>116</height>
|
||||
<height>148</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
@ -1357,7 +1357,7 @@ An extension given by the modules serial number will be attached.
|
||||
<x>35</x>
|
||||
<y>15</y>
|
||||
<width>686</width>
|
||||
<height>116</height>
|
||||
<height>146</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
@ -1748,6 +1748,320 @@ An extension given by the modules serial number will be attached.
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Acquisition</string>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>14</x>
|
||||
<y>13</y>
|
||||
<width>367</width>
|
||||
<height>110</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinSubExpTime">
|
||||
<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="toolTip">
|
||||
<string><nobr>
|
||||
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</nobr><br><nobr>
|
||||
#subexptime#
|
||||
</nobr></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>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumStoragecells">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #cycles * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Storage cells:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblSubExpTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</nobr><br><nobr>
|
||||
#subexptime#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sub Frame Exposure Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QComboBox" name="comboSubExpTimeUnit">
|
||||
<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="toolTip">
|
||||
<string><nobr>
|
||||
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</nobr><br><nobr>
|
||||
#subexptime#
|
||||
</nobr></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="0" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumStoragecells">
|
||||
<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="toolTip">
|
||||
<string><html><head/><body><p>Number of storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #cycles * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></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>15</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblSubPeriod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Period between sub frames. Only for Eiger in 32 bit mode.
|
||||
</nobr><br><nobr>
|
||||
Default value is 0. A value less than the required minimum is ignored.
|
||||
</nobr><br><nobr>
|
||||
#subperiod#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sub Frame Period:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinSubPeriod">
|
||||
<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="toolTip">
|
||||
<string><nobr>
|
||||
Period between sub frames. Only for Eiger in 32 bit mode.
|
||||
</nobr><br><nobr>
|
||||
Default value is 0. A value less than the required minimum is ignored.
|
||||
</nobr><br><nobr>
|
||||
#subperiod#
|
||||
</nobr></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>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QComboBox" name="comboSubPeriodUnit">
|
||||
<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="toolTip">
|
||||
<string><nobr>
|
||||
Period between sub frames. Only for Eiger in 32 bit mode.
|
||||
</nobr><br><nobr>
|
||||
Default value is 0. A value less than the required minimum is ignored.
|
||||
</nobr><br><nobr>
|
||||
#subperiod#
|
||||
</nobr></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>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
@ -133,44 +133,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnStartStop">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>289</y>
|
||||
<width>319</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Starts or Stops Acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Shift+Space</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frameTimeResolved">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -189,9 +151,9 @@
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>35</x>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>326</width>
|
||||
<width>357</width>
|
||||
<height>321</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -999,6 +961,104 @@ Frame period between exposures.
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>298</y>
|
||||
<width>318</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnStart">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Starts Acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Shift+Space</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnStop">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Stops Acquisition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/stop.png</normaloff>:/icons/images/stop.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>spinNumMeasurements</tabstop>
|
||||
|
@ -99,7 +99,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_6">
|
||||
<widget class="QWidget" name="gridLayoutWidget_5">
|
||||
@ -548,7 +548,7 @@
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>5</y>
|
||||
<width>314</width>
|
||||
<width>335</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -587,7 +587,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<width>10</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -596,7 +596,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkGainPlot">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -614,6 +614,43 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_22">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkGapPixels">
|
||||
<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>Gap Pixels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -1695,7 +1732,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>331</width>
|
||||
<width>357</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -2522,7 +2559,7 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>12</y>
|
||||
<width>331</width>
|
||||
<width>365</width>
|
||||
<height>36</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorGui
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: b58c3e8951625ed9124669404f6b68aca340a1b8
|
||||
Revision: 491
|
||||
Repsitory UUID: 51fd9ed423b7a8fb45a76b4f48316537c4fb0f5d
|
||||
Revision: 505
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3727
|
||||
Last Changed Date: 2018-03-14 15:24:03.000000002 +0100 ./src/qTabMeasurement.cpp
|
||||
Last Changed Rev: 3818
|
||||
Last Changed Date: 2018-05-15 13:48:54.000000002 +0200 ./src/qTabSettings.cpp
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "b58c3e8951625ed9124669404f6b68aca340a1b8"
|
||||
#define GITREPUUID "51fd9ed423b7a8fb45a76b4f48316537c4fb0f5d"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3727
|
||||
#define GITDATE 0x20180314
|
||||
#define GITREV 0x3818
|
||||
#define GITDATE 0x20180515
|
||||
#define GITBRANCH "developer"
|
||||
|
@ -617,7 +617,6 @@ void saveErrorSignal(QString);
|
||||
void AcquisitionErrorSignal(QString);
|
||||
void UpdatePlotSignal();
|
||||
void GainPlotSignal(bool);
|
||||
void AcquisitionFinishedSignal();
|
||||
};
|
||||
|
||||
|
||||
|
@ -198,6 +198,16 @@ private slots:
|
||||
*/
|
||||
void SetAllTrimbits();
|
||||
|
||||
/** Set storage cells */
|
||||
void SetNumStoragecells(int value);
|
||||
|
||||
/** Set sub frame exposure time */
|
||||
void SetSubExposureTime();
|
||||
|
||||
/** Set sub frame period */
|
||||
void SetSubPeriod();
|
||||
|
||||
|
||||
private:
|
||||
/** The multi detector object */
|
||||
multiSlsDetector *myDet;
|
||||
@ -242,7 +252,11 @@ private:
|
||||
vector <QSpinBox*> spinToY;
|
||||
int numRois;
|
||||
|
||||
/** sub period tool tip variables*/
|
||||
QString acqSubPeriodTip;
|
||||
QString errSubPeriodTip;
|
||||
|
||||
void CheckAcqPeriodGreaterThanExp();
|
||||
|
||||
|
||||
};
|
||||
|
@ -50,14 +50,14 @@ public:
|
||||
*/
|
||||
void SetExpertMode(bool enable);
|
||||
|
||||
/** Returns the status of the Start/Stop Acquisition button
|
||||
/** Returns the status of the acquisition in gui
|
||||
*/
|
||||
bool GetStartStatus(){return btnStartStop->isChecked();};
|
||||
bool GetStartStatus(){return (!btnStart->isEnabled());};
|
||||
|
||||
/** Click the Start/Stop Acquisition button
|
||||
* This is used if this command came from gui client
|
||||
*/
|
||||
void ClickStartStop(){btnStartStop->click();myPlot->SetClientInitiated();};
|
||||
void ClickStartStop(){startAcquisition();myPlot->SetClientInitiated();};
|
||||
|
||||
/** Returns progress bar value */
|
||||
int GetProgress(){return progressBar->value();};
|
||||
@ -65,10 +65,6 @@ public:
|
||||
|
||||
public slots:
|
||||
|
||||
/** Unconnects start/stop button when acquisition is finished
|
||||
*/
|
||||
void AcquisitionFinished();
|
||||
|
||||
/** update plot is finished,
|
||||
* changes start/stop text and enables/disables all widgets
|
||||
*/
|
||||
@ -131,9 +127,13 @@ private slots:
|
||||
*/
|
||||
void setRunIndex(int index);
|
||||
|
||||
/** starts/stops Acquisition
|
||||
/** starts Acquisition
|
||||
*/
|
||||
void startStopAcquisition();
|
||||
void startAcquisition();
|
||||
|
||||
/** stops Acquisition
|
||||
*/
|
||||
void stopAcquisition();
|
||||
|
||||
/** Set number of frames
|
||||
* @param val number of frames to be set
|
||||
@ -193,8 +193,6 @@ private:
|
||||
QPalette red;
|
||||
/** expert mode */
|
||||
bool expertMode;
|
||||
QIcon *iconStart;
|
||||
QIcon *iconStop;
|
||||
/** to access items in settings combobox */
|
||||
QStandardItemModel* model;
|
||||
|
||||
|
@ -174,6 +174,9 @@ private slots:
|
||||
/** Set histogram options */
|
||||
void SetHistogramOptions();
|
||||
|
||||
/** Enable Gap pixels */
|
||||
void EnableGapPixels(bool enable);
|
||||
|
||||
signals:
|
||||
void DisableZoomSignal(bool);
|
||||
void ResetZMinZMaxSignal(bool,bool,double,double);
|
||||
|
@ -137,13 +137,13 @@ void SlsQtNumberEntry::SetupNumberField(int type, int which_number_field){
|
||||
num_field[i]->setAlignment(Qt::AlignRight);
|
||||
|
||||
if(i==0){
|
||||
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(RefreshFirstNumberEntry()));
|
||||
connect(num_field[i],SIGNAL(editingFinished()),this,SLOT(RefreshFirstNumberEntry()));
|
||||
connect(num_field[i],SIGNAL(returnPressed()),this,SLOT(FirstValueEntered()));
|
||||
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(FirstValueEntered()));
|
||||
connect(num_field[i],SIGNAL(editingFinished()),this,SLOT(FirstValueEntered()));
|
||||
}else{
|
||||
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(RefreshSecondNumberEntry()));
|
||||
connect(num_field[i],SIGNAL(editingFinished()),this,SLOT(RefreshSecondNumberEntry()));
|
||||
connect(num_field[i],SIGNAL(returnPressed()),this,SLOT(SecondValueEntered()));
|
||||
connect(num_field[i],SIGNAL(lostFocus()),this,SLOT(SecondValueEntered()));
|
||||
connect(num_field[i],SIGNAL(editingFinished()),this,SLOT(SecondValueEntered()));
|
||||
}
|
||||
}else if(type==3){
|
||||
spin_box[i] = new QSpinBox();
|
||||
|
@ -99,8 +99,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, int& ret,
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
tempval = GITREV;
|
||||
tempval = (tempval <<32) | GITDATE;
|
||||
tempval = GITDATE;
|
||||
cout << "SLS Detector GUI " << GITBRANCH << " (0x" << hex << tempval << ")" << endl;
|
||||
return;
|
||||
|
||||
@ -337,7 +336,6 @@ void qDetectorMain::Initialization(){
|
||||
// Plotting
|
||||
// When the acquisition is finished, must update the meas tab
|
||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
||||
connect(myPlot, SIGNAL(AcquisitionFinishedSignal()), tab_measurement, SLOT(AcquisitionFinished()));
|
||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished()));
|
||||
//This should not be called as it will change file name to measurement when run finished
|
||||
//connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh()));
|
||||
@ -523,7 +521,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
}
|
||||
}
|
||||
else if(action==actionLoadTrimbits){
|
||||
QString fName = QString(myDet->getSettingsDir());
|
||||
QString fName = QString( (myDet->getSettingsDir()).c_str());
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
//gotthard
|
||||
if(actionLoadTrimbits->text().contains("Settings")){
|
||||
@ -570,7 +568,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
cout << "Saving Settings" << endl;
|
||||
#endif
|
||||
//different output directory so as not to overwrite
|
||||
QString fName = QString(myDet->getSettingsDir());
|
||||
QString fName = QString( (myDet->getSettingsDir()).c_str() );
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Settings"),fName,
|
||||
@ -587,7 +585,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
#ifdef VERBOSE
|
||||
cout << "Saving Trimbits" << endl;
|
||||
#endif//different output directory so as not to overwrite
|
||||
QString fName = QString(myDet->getSettingsDir());
|
||||
QString fName = QString( (myDet->getSettingsDir()).c_str() );
|
||||
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteUtilities");
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Trimbits"),fName,
|
||||
@ -605,7 +603,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
#ifdef VERBOSE
|
||||
cout << "Loading Calibration Data" << endl;
|
||||
#endif
|
||||
QString fName = QString(myDet->getCalDir());
|
||||
QString fName = QString( (myDet->getCalDir()).c_str() );
|
||||
qDefs::checkErrorMessage(myDet);
|
||||
|
||||
//so that even nonexisting files can be selected
|
||||
@ -628,7 +626,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
|
||||
#ifdef VERBOSE
|
||||
cout << "Saving Calibration Data" << endl;
|
||||
#endif//different output directory so as not to overwrite
|
||||
QString fName = QString(myDet->getCalDir());
|
||||
QString fName = QString( (myDet->getCalDir()).c_str() );
|
||||
qDefs::checkErrorMessage(myDet);
|
||||
fName = QFileDialog::getSaveFileName(this,
|
||||
tr("Save Current Detector Calibration Data"),fName,
|
||||
@ -666,8 +664,7 @@ void qDetectorMain::ExecuteHelp(QAction *action){
|
||||
cout << "About: Common GUI for Mythen, Eiger, Gotthard, Jungfrau, Moench and Propix detectors" << endl;
|
||||
#endif
|
||||
char version[200];
|
||||
long long unsigned int retval= GITREV;
|
||||
retval= (retval <<32) | GITDATE;
|
||||
long long unsigned int retval= GITDATE;
|
||||
sprintf(version,"%llx",retval);
|
||||
string thisGUIVersion = string(version);
|
||||
|
||||
|
@ -563,9 +563,13 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
||||
// Number of Exposures - must be calculated here to get npixelsy for allframes/frameindex scans
|
||||
int numFrames = (isFrameEnabled)*((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1));
|
||||
int numTriggers = (isTriggerEnabled)*((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1));
|
||||
int numStoragecells = 0;
|
||||
if (detType == slsDetectorDefs::JUNGFRAU)
|
||||
numStoragecells = (int)myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER, -1);
|
||||
numFrames = ((numFrames==0)?1:numFrames);
|
||||
numTriggers = ((numTriggers==0)?1:numTriggers);
|
||||
number_of_frames = numFrames * numTriggers;
|
||||
numStoragecells = ((numStoragecells<=0)?1:numStoragecells+1);
|
||||
number_of_frames = numFrames * numTriggers * numStoragecells;
|
||||
cout << "\tNumber of Frames per Scan/Measurement:" << number_of_frames << endl;
|
||||
//get #scansets for level 0 and level 1
|
||||
int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0);
|
||||
@ -1296,7 +1300,6 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
|
||||
#ifdef VERBOSE
|
||||
cout << "\nEntering Acquisition Finished with status " ;
|
||||
#endif
|
||||
emit AcquisitionFinishedSignal();
|
||||
QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str());
|
||||
#ifdef VERBOSE
|
||||
cout << status.toAscii().constData() << " and progress " << currentProgress << endl;
|
||||
@ -2233,9 +2236,9 @@ void qDrawPlot::toDoublePixelData(double* dest, char* source,int size, int datab
|
||||
// only data plot
|
||||
else {
|
||||
for (ichan = 0; ichan < size; ++ichan) {
|
||||
if ( (*((u_int16_t*)source)) == 0xFFFF )
|
||||
/*if ( (*((u_int16_t*)source)) == 0xFFFF )
|
||||
dest[ichan] = 0xFFFF;
|
||||
else
|
||||
else*/
|
||||
dest[ichan] = ((*((u_int16_t*)source)) & 0x3FFF);
|
||||
source += 2;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user