bit depth parameter infrastructure. partial eiger assemble image routine.

This commit is contained in:
lhdamiani
2021-07-02 10:44:51 +02:00
parent 3f7fef4f61
commit c344daaffe
37 changed files with 4369 additions and 103 deletions
+1
View File
@@ -7,6 +7,7 @@
"gain_file": "",
"detector_name": "eiger",
"n_modules": 2,
"n_submodules": 2,
"start_udp_port": 50200,
"buffer_folder": ""
}
+17
View File
@@ -0,0 +1,17 @@
detsize 1024 512
hostname beb031+beb032
udp_dstmac 9c:dc:71:4d:2a:b5
udp_dstip 10.30.20.6
#top
0:udp_dstport 50200
0:udp_dstport2 50201
0:udp_srcip 10.30.20.201
#bottom
1:udp_dstport 50202
1:udp_dstport2 50203
1:udp_srcip 10.30.20.201
tengiga 1
+13
View File
@@ -0,0 +1,13 @@
{
"streamvis_stream": "tcp://0.0.0.0:9006",
"streamvis_rate": 10,
"live_stream": "tcp://0.0.0.0:9106",
"live_rate": 10,
"pedestal_file": "",
"gain_file": "",
"detector_name": "Eiger-16",
"n_modules": 1,
"n_submodules":4,
"start_udp_port": 50200,
"buffer_folder": ""
}
+13
View File
@@ -0,0 +1,13 @@
detsize 1024 512
hostname localhost:2070+localhost:2072+
udp_dstmac 9c:dc:71:5f:28:10
udp_srcmac 9c:dc:71:5f:28:10
udp_srcip 129.129.241.43
udp_dstip 129.129.241.43
0:udp_dstport 50250
0:udp_dstport2 50251
1:udp_dstport 50252
1:udp_dstport2 50253
+13
View File
@@ -0,0 +1,13 @@
{
"streamvis_stream": "tcp://0.0.0.0:9006",
"streamvis_rate": 10,
"live_stream": "tcp://0.0.0.0:9106",
"live_rate": 10,
"pedestal_file": "",
"gain_file": "",
"detector_name": "eiger",
"n_modules": 2,
"n_submodules":2,
"start_udp_port": 50250,
"buffer_folder": ""
}
+46
View File
@@ -0,0 +1,46 @@
#!/bin/bash
UDP=0
STREAM=0
ASSEMBLER=0
HELP_FLAG=0
while getopts h:u:s:a: flag
do
case "${flag}" in
h ) HELP_FLAG=${OPTARG};;
u ) UDP=${OPTARG};;
s ) STREAM=${OPTARG};;
a ) ASSEMBLER=${OPTARG};;
esac
done
if (( ${UDP} == 0 )) && (( ${STREAM} == 0 )) && (( ${ASSEMBLER} == 0 )); then
echo "Nothing to do..."
exit
fi
# prints help and exits
if (( ${HELP_FLAG} == 1 )); then
echo "Usage : $0 -u <udp_recvs> -s <stream> -a <assembler> -h <help_flag>"
echo " udp : kill udp receivers."
echo " stream : kill stream."
echo " assembler : kill assembler."
echo " help_flag : show this help and exits."
exit
fi
if (( ${UDP} == 1 )); then
echo "Killing upd recvs..."
ps aux | grep eiger_udp_recv | awk 'NR > 1 { print prev } { prev = $2 }' | xargs -I{} kill {}
fi
if (( ${STREAM} == 1 )); then
echo "Killing stream..."
ps aux | grep eiger_stream | awk 'NR > 1 { print prev } { prev = $2 }' | xargs -I{} kill {}
fi
if (( ${ASSEMBLER} == 1 )); then
echo "Killing assembler..."
ps aux | grep eiger_assembler | awk 'NR > 1 { print prev } { prev = $2 }' | xargs -I{} kill {}
fi
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# usage ./start_eiger_detector.sh Eiger 1
if [ $# -lt 1 ]
then
echo "Usage : $0 DETECTOR_NAME <number_of_cycles>"
echo " DETECTOR_NAME: Eiger..."
echo " number_of_cycles : optional, default 100"
exit
fi
#SLS_DET_PACKAGE_PATH='/home/dbe/git/sf_daq_buffer_eiger/slsDetectorPackage/build/bin/'
# SLS_DET_PACKAGE_PATH='/home/hax_l/sf_daq_buffer/slsDetectorPackage/build/bin/'
# DETECTOR=$1
n_cycles=100
if [ $# == 2 ]
then
n_cycles=$2
fi
${SLS_DET_PACKAGE_PATH}sls_detector_put timing auto
${SLS_DET_PACKAGE_PATH}sls_detector_put triggers ${n_cycles}
${SLS_DET_PACKAGE_PATH}sls_detector_put exptime 0.000005
${SLS_DET_PACKAGE_PATH}sls_detector_put frames 1000
${SLS_DET_PACKAGE_PATH}sls_detector_put dr 16
#sls_detector_put ${D}-clearbit to 0x5d 0 # normal mode, not highG0
${SLS_DET_PACKAGE_PATH}sls_detector_put acquire
echo "Now start trigger"
+49
View File
@@ -0,0 +1,49 @@
#!/bin/bash
MAKE_FLAG=0
ASSEMBLER='/home/hax_l/sf_daq_buffer/build/eiger_assembler'
CONFIG_FILE='/home/hax_l/sf_daq_buffer/eiger/sf-daq-4/config/eiger.json'
BUILD_PATH='/home/hax_l/sf_daq_buffer/build'
NAME='eiger_assembler'
BIT_DEPTH=16
HELP_FLAG=0
while getopts m:h:c:b: flag
do
case "${flag}" in
m ) MAKE_FLAG=${OPTARG};;
h ) HELP_FLAG=${OPTARG};;
c ) CONFIG_FILE=${OPTARG};;
b ) BIT_DEPTH=${OPTARG};;
esac
done
# prints help and exits
if (( ${HELP_FLAG} == 1 )); then
echo "Usage : $0 -c <config_file> -m <make_flag> -h <help_flag>"
echo " config_file : detector configuration file."
echo " make_flag : compile code before running."
echo " help_flag : show this help and exits."
exit
fi
# compiles the sf_buffer_daq
if (( ${MAKE_FLAG} == 1 )); then
echo "Compile flag detected..."
set -e
cd ${BUILD_PATH} && make
fi
# proceeds to start the receivers
echo "Starting the ${NAME} (config file: ${CONFIG_FILE})"
if [ -f "${ASSEMBLER}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
${ASSEMBLER} ${CONFIG_FILE} ${BIT_DEPTH} &
else
echo "Something went wrong with the config file..."
exit
fi
else
echo ${ASSEMBLER}
echo "Something went wrong with the assembler executable..."
exit
fi
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
MAKE_FLAG=0
STREAM='/home/hax_l/software/sf_daq_buffer/build/eiger_stream'
CONFIG_FILE='/home/hax_l/software/sf_daq_buffer/eiger/config/eiger.json'
BUILD_PATH='/home/hax_l/software/sf_daq_buffer/build'
STREAM_NAME='eiger'
HELP_FLAG=0
while getopts m:h:n:c: flag
do
case "${flag}" in
m ) MAKE_FLAG=${OPTARG};;
h ) HELP_FLAG=${OPTARG};;
n ) STREAM_NAME=${OPTARG};;
c ) CONFIG_FILE=${OPTARG};;
esac
done
# prints help and exits
if (( ${HELP_FLAG} == 1 )); then
echo "Usage : $0 -c <config_file> -n <stream_name> -m <make_flag> -h <help_flag>"
echo " config_file : detector configuration file."
echo " stream_name : stream name."
echo " make_flag : compile code before running."
echo " help_flag : show this help and exits."
exit
fi
# compiles the sf_buffer_daq
if (( ${MAKE_FLAG} == 1 )); then
echo "Compile flag detected..."
set -e
cd ${BUILD_PATH} && make
fi
# proceeds to start the receivers
echo "Starting stream name ${STREAM_NAME} (config file: ${CONFIG_FILE})"
if [ -f "${STREAM}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
${STREAM} ${CONFIG_FILE} ${STREAM_NAME} &
else
echo "Something went wrong with the config file..."
exit
fi
else
echo "Something went wrong with the stream executable..."
exit
fi
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
N_UDP_RECVS=2
MAKE_FLAG=0
UDP_RECV='/home/hax_l/sf_daq_buffer/build/eiger_udp_recv'
CONFIG_FILE='/home/hax_l/sf_daq_buffer/eiger/sf-daq-4/config/eiger.json'
BUILD_PATH='/home/hax_l/sf_daq_buffer/build'
HELP_FLAG=0
BIT_DEPTH=16
while getopts n:m:h:u:c:b: flag
do
case "${flag}" in
n ) N_UDP_RECVS=${OPTARG};;
m ) MAKE_FLAG=${OPTARG};;
h ) HELP_FLAG=${OPTARG};;
u ) UDP_RECV=${OPTARG};;
c ) CONFIG_FILE=${OPTARG};;
b ) BIT_DEPTH=${OPTARG};;
esac
done
# prints help and exits
if (( ${HELP_FLAG} == 1 )); then
echo "Usage : $0 -n <n_udp_recvs> -c <compile_flag> -h <help_flag> -u <udp_executable> -c <config_file> -b <bit_depth>"
echo " n_udp_recvs : number of receivers."
echo " compile_flag : compile code before running."
echo " help_flag : show this help and exits."
echo " udp_executable : executable for the udp receivers."
echo " config_file : detector configuration file."
echo " bit_depth : detector bit depth."
exit
fi
# compiles the sf_buffer_daq
if (( ${MAKE_FLAG} == 1 )); then
echo "Compile flag detected..."
set -e
cd ${BUILD_PATH} && make
fi
# proceeds to start the receivers
echo "Starting ${N_UDP_RECVS} udp receivers..."
COUNTER=0
if [ -f "${UDP_RECV}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
while [ $COUNTER -lt ${N_UDP_RECVS} ]; do
${UDP_RECV} ${CONFIG_FILE} ${COUNTER} ${BIT_DEPTH} &
let COUNTER=COUNTER+1
sleep 0.5
done
else
echo "Something went wrong with the udp recv executable..."
exit
fi
else
echo "Something went wrong with the udp recv executable..."
exit
fi
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
MAKE_FLAG=0
MASTER='/home/hax_l/sf_daq_buffer/slsDetectorPackage/build/bin/eigerDetectorServerMaster_virtual'
SLAVE='/home/hax_l/sf_daq_buffer/slsDetectorPackage/build/bin/eigerDetectorServerSlaveBottom_virtual'
DET_PUT='/home/hax_l/sf_daq_buffer/slsDetectorPackage/build/bin/sls_detector_put'
CONFIG_FILE='/home/hax_l/sf_daq_buffer/eiger/sf-daq-4/config/veiger-sf-daq-4.txt'
HELP_FLAG=0
PORT_MASTER=2070
while getopts h:p:c: flag
do
case "${flag}" in
h ) HELP_FLAG=${OPTARG};;
p ) PORT_MASTER=${OPTARG};;
c ) CONFIG_FILE=${OPTARG};;
esac
done
PORT_SLAVE=$(( $PORT_MASTER + 2 ))
# prints help and exits
if (( ${HELP_FLAG} == 1 )); then
echo "Usage : $0 -c <config_file> -h <help_flag>"
echo " port : port connection for master virtual eiger."
echo " config_file : detector configuration file."
echo " help_flag : show this help and exits."
exit
fi
# proceeds to start the receivers
echo "Starting the virtual eiger (master and slave) (config file: ${CONFIG_FILE})"
if [ -f "${MASTER}" ]; then
if [ -f "${MASTER}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
${MASTER} -p ${PORT_MASTER} &
sleep 1
${SLAVE} -p ${PORT_SLAVE} &
sleep 1
# ${DET_PUT} config ${CONFIG_FILE}
else
echo "Something went wrong with the config file..."
exit
fi
fi
else
echo "Something went wrong with the virtual eiger executable..."
exit
fi
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
IP:Port: 10.30.20.6 50200
+37
View File
@@ -0,0 +1,37 @@
import socket
import numpy as np
frame_header_dt = np.dtype(
[
("Frame Number", "u8"),
("SubFrame Number/ExpLength", "u4"),
("Packet Number", "u4"),
("Bunch ID", "u8"),
("Timestamp", "u8"),
("Module Id", "u2"),
("Row", "u2"),
("Column", "u2"),
("Reserved", "u2"),
("Debug", "u4"),
("Round Robin Number", "u2"),
("Detector Type", "u1"),
("Header Version", "u1"),
]
)
ip = "10.30.20.6"
ports = list(range(50200, 50204, 1))
sockets = [socket.socket(socket.AF_INET, socket.SOCK_DGRAM) for i in range(len(ports))]
for s, p in zip(sockets, ports):
print("IP:Port: ", ip, p)
s.bind((ip, p))
while True:
for s in sockets:
data, address = s.recvfrom(4096)
h = np.frombuffer(data, count=1, dtype=frame_header_dt)[0]
print(
f'[{h["Timestamp"]}] frame: {h["Frame Number"]}, pkt:{h["Packet Number"]}, explength:{h["SubFrame Number/ExpLength"]}, module id: {h["Module Id"]} ,row: {h["Row"]}, column: {h["Column"]}'
)
+2 -2
View File
@@ -1,6 +1,6 @@
#!/bin/bash
export PATH=/home/dbe/miniconda3/bin:$PATH
export PATH=/home/dbe/miniconda3/bin:$PATH:/home/hax_l/sf_daq_buffer/slsDetectorPackage/build/bin/
source /home/dbe/miniconda3/etc/profile.d/conda.sh
conda deactivate
conda activate sf-daq
conda activate sf-daq
+37
View File
@@ -0,0 +1,37 @@
import socket
import numpy as np
frame_header_dt = np.dtype(
[
("Frame Number", "u8"),
("SubFrame Number/ExpLength", "u4"),
("Packet Number", "u4"),
("Bunch ID", "u8"),
("Timestamp", "u8"),
("Module Id", "u2"),
("Row", "u2"),
("Column", "u2"),
("Reserved", "u2"),
("Debug", "u4"),
("Round Robin Number", "u2"),
("Detector Type", "u1"),
("Header Version", "u1"),
]
)
ip = "10.30.20.6"
ports = list(range(50200, 50204, 1))
sockets = [socket.socket(socket.AF_INET, socket.SOCK_DGRAM) for i in range(len(ports))]
for s, p in zip(sockets, ports):
print("IP:Port: ", ip, p)
s.bind((ip, p))
while True:
for s in sockets:
data, address = s.recvfrom(4096)
h = np.frombuffer(data, count=1, dtype=frame_header_dt)[0]
print(
f'pkt:{h["Packet Number"]}, frame: {h["Frame Number"]}, row: {h["Row"]}, column: {h["Column"]}'
)
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
INTERFACES=("$@")
echo $# interfaces will be analysed:
# array of proc ids
declare -a PROC_IDS=()
# start tcpdump for the specified interfaces
for i in "${INTERFACES[@]}"
do
if [ -f "$i".dump ]; then
echo "Removing file $i.dump"
rm "$i".dump
fi
if [ -f "$i".txt ]; then
echo "Removing file $i.txt"
rm $i.txt
fi
# starts the tcpdump for each interface
echo "Starting tcpdump on $i..."
#echo $i
nohup tcpdump -i $i -enn -B 400000000 -w $i.dump &
PROC_IDS+=($!)
done
# loop waiting to stop
echo "Press ESC key to quit"
# read a single character
while read -r -n1 key
do
# if input == ESC key
if [[ $key == $'\e' ]];
then
break;
fi
done
# kills tcp dump processes
for i in "${PROC_IDS[@]}"
do
echo Killing proccess with pid $i
kill $i
done
# delete if previous report file exists
report_filename='tcp_dump_report.txt'
if [ -f $report_filename ]; then
rm $report_filename
# creates an empty file
touch $report_filename
fi
touch $report_filename
# converts raw to text and parses the file
for i in "${INTERFACES[@]}"
do
echo "Treating raw data into txt file and parsing relevant info..."
tcpdump -r $i.dump > $i.txt && cat $i.txt | awk '{print $5" "$8}' | awk -F. '{print $4}' | awk -F: '{print $1" "$2}' | sort | uniq -c >> $report_filename && sed '/length/d' -i $report_filename
done
echo "Finishing tcpdump analysis..."
+42
View File
@@ -0,0 +1,42 @@
detsize 2048 2560
hostname BEB111+BEB070+BEB060+BEB042+BEB004+BEB120+BEB105+BEB121+BEB092+BEB091+BEB058+BEB059+BEB030+BEB038+BEB110+BEB115+BEB095+BEB094+BEB119+BEB055+
#
udp_dstmac 9c:dc:71:47:e5:dc
udp_dstip 10.30.20.6
0:rx_tcpport 1980
0:udp_dstport 50000
0:udp_dstport2 50001
1:rx_tcpport 1981
1:udp_dstport 50002
1:udp_dstport2 50003
2:rx_tcpport 1982
2:udp_dstport 50004
2:udp_dstport2 50005
3:rx_tcpport 1983
3:udp_dstport 50006
3:udp_dstport2 50007
4:rx_tcpport 1984
4:udp_dstport 50008
4:udp_dstport2 50009
5:rx_tcpport 1985
5:udp_dstport 50010
5:udp_dstport2 50011
6:rx_tcpport 1986
6:udp_dstport 50012
6:udp_dstport2 50013
7:rx_tcpport 1987
7:udp_dstport 50014
7:udp_dstport2 50015
8:rx_tcpport 1988
8:udp_dstport 50016
8:udp_dstport2 50017
9:rx_tcpport 1989
9:udp_dstport 50018
9:udp_dstport2 50019
+42
View File
@@ -0,0 +1,42 @@
import socket
import numpy as np
frame_header_dt = np.dtype(
[
("Frame Number", "u8"),
("SubFrame Number/ExpLength", "u4"),
("Packet Number", "u4"),
("Bunch ID", "u8"),
("Timestamp", "u8"),
("Module Id", "u2"),
("Row", "u2"),
("Column", "u2"),
("Reserved", "u2"),
("Debug", "u4"),
("Round Robin Number", "u2"),
("Detector Type", "u1"),
("Header Version", "u1"),
]
)
hostnames = ['BEB111','BEB070','BEB060','BEB042','BEB004','BEB120','BEB105','BEB121','BEB092','BEB091','BEB058','BEB059','BEB030', 'BEB038','BEB110', 'BEB115', 'BEB095', 'BEB094', 'BEB119', 'BEB055']
# ip = "10.30.20.6"
ips = []
for hostname in hostnames:
ips.append(socket.gethostbyname('BEB111'))
ports = list(range(50000, 50204, 1))
sockets = [socket.socket(socket.AF_INET, socket.SOCK_DGRAM) for i in range(len(ports))]
for s, p in zip(sockets, ports):
print("IP:Port: ", ip, p)
s.bind((ip, p))
while True:
for s in sockets:
data, address = s.recvfrom(4096)
h = np.frombuffer(data, count=1, dtype=frame_header_dt)[0]
print(
f'[{h["Timestamp"]}] frame: {h["Frame Number"]}, pkt:{h["Packet Number"]}, explength:{h["SubFrame Number/ExpLength"]}, module id: {h["Module Id"]} ,row: {h["Row"]}, column: {h["Column"]}'
)
+20
View File
@@ -0,0 +1,20 @@
output=`ping -c 1 BEB111 2>&1` || echo $output
output=`ping -c 1 BEB070 2>&1` || echo $output
output=`ping -c 1 BEB060 2>&1` || echo $output
output=`ping -c 1 BEB042 2>&1` || echo $output
output=`ping -c 1 BEB004 2>&1` || echo $output
output=`ping -c 1 BEB120 2>&1` || echo $output
output=`ping -c 1 BEB105 2>&1` || echo $output
output=`ping -c 1 BEB121 2>&1` || echo $output
output=`ping -c 1 BEB092 2>&1` || echo $output
output=`ping -c 1 BEB091 2>&1` || echo $output
output=`ping -c 1 BEB058 2>&1` || echo $output
output=`ping -c 1 BEB059 2>&1` || echo $output
output=`ping -c 1 BEB030 2>&1` || echo $output
output=`ping -c 1 BEB038 2>&1` || echo $output
output=`ping -c 1 BEB110 2>&1` || echo $output
output=`ping -c 1 BEB115 2>&1` || echo $output
output=`ping -c 1 BEB095 2>&1` || echo $output
output=`ping -c 1 BEB094 2>&1` || echo $output
output=`ping -c 1 BEB119 2>&1` || echo $output
output=`ping -c 1 BEB055 2>&1` || echo $output
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
NUM_MOD=20
# Unit are in 10ns
DELAY_DIFF=50000
for i in `seq 0 $((NUM_MOD-1))`; do
sls_detector_put $i:txndelay_left $((i*2*DELAY_DIFF))
sls_detector_put $i:txndelay_right $(((i*2+1)*DELAY_DIFF))
done
sls_detector_put txndelay_frame $((NUM_MOD*2*DELAY_DIFF))