From 7e3a01e7a7c62856f6f721ce71fd80a88a209c89 Mon Sep 17 00:00:00 2001 From: Hades DAQ Date: Sun, 3 Mar 2019 17:38:52 +0100 Subject: [PATCH] cleaned up a bit --- .../conf => example_conf}/addresses.sh | 3 + .../conf => example_conf}/conf.sh | 8 +- go4_trbnet/example_conf/conf_tdcs.sh | 19 + .../conf => example_conf}/dhcpd.conf | 6 +- .../register_configgbe.db | 0 .../register_configgbe_ip.db | 0 .../TdcEventBuilder.xml | 3 +- .../workdir => example_workdir}/first.C | 0 go4_trbnet/example_workdir/info.txt | 18 + .../my_hotstart.hotstart | 0 go4_trbnet/example_workdir/start.sh | 58 +++ .../conf | 1 + .../conf/.register_configgbe.db.swp | Bin 12288 -> 0 bytes .../conf/conf_cts.sh | 64 --- .../conf/conf_log.txt | 25 - .../conf/conf_tdcs.sh | 55 --- .../conf/reload_all.sh | 11 - .../workdir | 1 + .../workdir/second.C | 454 ------------------ .../workdir/start.sh | 45 -- 20 files changed, 109 insertions(+), 662 deletions(-) rename go4_trbnet/{go4_trbnet_leap_15.0_stable_2018-03-01/conf => example_conf}/addresses.sh (78%) rename go4_trbnet/{go4_trbnet_leap_15.0_stable_2018-03-01/conf => example_conf}/conf.sh (91%) create mode 100755 go4_trbnet/example_conf/conf_tdcs.sh rename go4_trbnet/{go4_trbnet_leap_15.0_stable_2018-03-01/conf => example_conf}/dhcpd.conf (81%) rename go4_trbnet/{go4_trbnet_leap_15.0_stable_2018-03-01/conf => example_conf}/register_configgbe.db (100%) rename go4_trbnet/{go4_trbnet_leap_15.0_stable_2018-03-01/conf => example_conf}/register_configgbe_ip.db (100%) rename go4_trbnet/{go4_trbnet_leap_15.0_stable_2018-03-01/workdir => example_workdir}/TdcEventBuilder.xml (97%) rename go4_trbnet/{go4_trbnet_leap_15.0_stable_2018-03-01/workdir => example_workdir}/first.C (100%) create mode 100644 go4_trbnet/example_workdir/info.txt rename go4_trbnet/{go4_trbnet_leap_15.0_stable_2018-03-01/workdir => example_workdir}/my_hotstart.hotstart (100%) create mode 100755 go4_trbnet/example_workdir/start.sh create mode 120000 go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf delete mode 100644 go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/.register_configgbe.db.swp delete mode 100755 go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_cts.sh delete mode 100644 go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_log.txt delete mode 100755 go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_tdcs.sh delete mode 100755 go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/reload_all.sh create mode 120000 go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir delete mode 100644 go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/second.C delete mode 100755 go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/start.sh diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/addresses.sh b/go4_trbnet/example_conf/addresses.sh similarity index 78% rename from go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/addresses.sh rename to go4_trbnet/example_conf/addresses.sh index e935b37..94dd9b6 100755 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/addresses.sh +++ b/go4_trbnet/example_conf/addresses.sh @@ -1,5 +1,8 @@ #!/bin/bash +## this script is called by conf.sh ## + +### set addresses of FPGAs ### trbcmd s 0x7100000390255228 0x00 0x0350 trbcmd s 0x8c0000039025fa28 0x01 0x0351 diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf.sh b/go4_trbnet/example_conf/conf.sh similarity index 91% rename from go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf.sh rename to go4_trbnet/example_conf/conf.sh index 3bc6482..39fbf1d 100755 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf.sh +++ b/go4_trbnet/example_conf/conf.sh @@ -13,12 +13,12 @@ export CTS_GUI_PORT=1148 export CTS_ENDPOINT=0xc035 export DISPLAY=:2 # go4 window will be sent to $DISPLAY, if provide_vnc == yes , then it will be this x11 display -export PULSER=192.168.103.74 > conf_log.txt -provide_dhcp=yes +provide_dhcp=no #edit conf/dhcpd.conf, enter your trb3 MAC address ### + provide_trbnetd=yes provide_cts_gui=yes @@ -63,9 +63,7 @@ if [ $provide_trbnetd == "yes" ]; then fi if [ $provide_cts_gui == "yes" ]; then -# screen -S cts_gui -d -m ./start_cts_gui.sh tmux new-session -d -s cts_gui -n cts_gui "cd /daqtools/web; perl ./cts_gui --endpoint $CTS_ENDPOINT --quiet --noopenxterm --port $CTS_GUI_PORT" -# tmux new-window -t main:1 -n "cts_gui" "cd /daqtools/web; perl ./cts_gui --endpoint $CTS_ENDPOINT --quiet --noopenxterm --port $CTS_GUI_PORT" echo ... >> conf_log.txt echo started cts_gui with following parameters:>> conf_log.txt echo --endpoint $CTS_ENDPOINT >> conf_log.txt @@ -93,7 +91,7 @@ fi /daqtools/tools/loadregisterdb.pl register_configgbe.db /daqtools/tools/loadregisterdb.pl register_configgbe_ip.db sleep 1 -./conf_cts.sh +#./conf_cts.sh ### here you could call a cts settings dump ... ./conf_tdcs.sh diff --git a/go4_trbnet/example_conf/conf_tdcs.sh b/go4_trbnet/example_conf/conf_tdcs.sh new file mode 100755 index 0000000..6103173 --- /dev/null +++ b/go4_trbnet/example_conf/conf_tdcs.sh @@ -0,0 +1,19 @@ +#!/bin/bash + + +## this script is called by conf.sh ## + +### all tdcs ### + +for TDC in 0x0350 0x0351 0x0352 0x0353; do + + # invert the first 32 channels + #trbcmd w $TDC 0xc805 0xFFFFFFFF + + # enable trigger windows +-1000 ns + trbcmd w $TDC 0xc801 0x80c800c8 + + # set channel ringbuffer size + trbcmd w $TDC 0xc804 10 + +done diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/dhcpd.conf b/go4_trbnet/example_conf/dhcpd.conf similarity index 81% rename from go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/dhcpd.conf rename to go4_trbnet/example_conf/dhcpd.conf index e361b85..e5dc11a 100644 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/dhcpd.conf +++ b/go4_trbnet/example_conf/dhcpd.conf @@ -1,11 +1,13 @@ +### adapt this to your network/trb addresses ### +### then ### +### set "provide_dhp" to yes in conf.sh ### + shared-network em1 { subnet 192.168.4.0 netmask 255.255.255.0 { option subnet-mask 255.255.255.0; option broadcast-address 192.168.4.255; option routers 192.168.4.254; - #option domain-name-servers 141.2.242.36; - #option domain-name "x-matter.uni-frankfurt.de"; default-lease-time 86400; max-lease-time 172800; } diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/register_configgbe.db b/go4_trbnet/example_conf/register_configgbe.db similarity index 100% rename from go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/register_configgbe.db rename to go4_trbnet/example_conf/register_configgbe.db diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/register_configgbe_ip.db b/go4_trbnet/example_conf/register_configgbe_ip.db similarity index 100% rename from go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/register_configgbe_ip.db rename to go4_trbnet/example_conf/register_configgbe_ip.db diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/TdcEventBuilder.xml b/go4_trbnet/example_workdir/TdcEventBuilder.xml similarity index 97% rename from go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/TdcEventBuilder.xml rename to go4_trbnet/example_workdir/TdcEventBuilder.xml index 536498d..ff1ba23 100644 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/TdcEventBuilder.xml +++ b/go4_trbnet/example_workdir/TdcEventBuilder.xml @@ -124,9 +124,10 @@ When starting analysis from the go4 gui, one should specify stream server with p + - + diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/first.C b/go4_trbnet/example_workdir/first.C similarity index 100% rename from go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/first.C rename to go4_trbnet/example_workdir/first.C diff --git a/go4_trbnet/example_workdir/info.txt b/go4_trbnet/example_workdir/info.txt new file mode 100644 index 0000000..47c505b --- /dev/null +++ b/go4_trbnet/example_workdir/info.txt @@ -0,0 +1,18 @@ + + +everything that is automatically running in this container +was started by /workdir/start.sh +which first calls /conf/conf.sh +and then starts some user processes (e.g. dabc, Go4 ...) +in separate tmux tabs + +you are in a tmux (terminal multiplexer) +do not panic! - you can manage the tabs (called "windows") +with the following shortcuts: + +ctrl-b n to switch to the next window +ctrl-b p to switch to the previous window +ctrl-b 0-9 to switch to the n-th window directly +ctrl-b c to create new a window +ctrl-b , to rename current window + diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/my_hotstart.hotstart b/go4_trbnet/example_workdir/my_hotstart.hotstart similarity index 100% rename from go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/my_hotstart.hotstart rename to go4_trbnet/example_workdir/my_hotstart.hotstart diff --git a/go4_trbnet/example_workdir/start.sh b/go4_trbnet/example_workdir/start.sh new file mode 100755 index 0000000..e27e5c9 --- /dev/null +++ b/go4_trbnet/example_workdir/start.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +echo "container started" + +echo "create main tmux session" + +echo "run /conf/conf.sh" +. /conf/conf.sh # keep environment variables set in conf.sh + +cd /workdir + +# create new tmux session named "main" +tmux new -d -s main + +# display some info +tmux new-window -t main -n "info" "cat /conf/conf_log.txt; cat info.txt; /bin/bash" + +tmux link-window -s cts_gui:cts_gui -t main # attach window opened by conf.sh +tmux link-window -s vnc:vnc -t main # attach window opened by conf.sh + + + +### start a dabc service ### +tmux new-window -t main -n "dabc" "dabc_exe TdcEventBuilder.xml;/bin/bash" + +### start a go4 session ### +#tmux new-window -t main -n "go4" "rm *.root; go4 my_hotstart.hotstart;/bin/bash" + +### start a go4analysis session with web server ### +GO4_WEB_PORT=8080 +tmux new-window -t main -n "go4_ana" "rm *.root; go4analysis -stream localhost:6790 -http localhost:$GO4_WEB_PORT;/bin/bash" + + +### some new tabs to use for ... whatever ### +tmux new-window -t main -n "new" "/bin/bash" +tmux new-window -t main -n "new" "/bin/bash" +tmux new-window -t main -n "new" "/bin/bash" +tmux new-window -t main -n "new" "/bin/bash" +tmux new-window -t main -n "new" "/bin/bash" + +# open CTS GUI and GO4 Web interface in firefox (running in VNC) +tmux new-window -t main -n "x11_apps" "lxpanel& sleep 5 && firefox -new-tab -url localhost:$CTS_GUI_PORT -new-tab -url localhost:$GO4_WEB_PORT& /bin/bash" + + + +### select info tab ### +tmux select-window -t main:info + +### finally attach tmux to the above configured session ### +tmux a -t main + + + +### if tmux session closed ### +echo "drop user to shell" +/bin/bash + +echo "terminate container" diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf new file mode 120000 index 0000000..26178e5 --- /dev/null +++ b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf @@ -0,0 +1 @@ +../example_conf \ No newline at end of file diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/.register_configgbe.db.swp b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/.register_configgbe.db.swp deleted file mode 100644 index 78f78310c982043214ba22d82e01836399820cbd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&rcIk5XT2kMn#Dxa-F&!rM$L4%L$T#$^jFh5DzA%+rHLKw!6*#z{QIPPsVuA zlX~%w@a%u%&G;vv&dlzTMnOG5lw@8q-S52L?=$n7G+o#1Zfs(+x&TyW06yJXdH7~# z7e2NCqA*Oj`cK98f;5}+TS2QDdx<@^`+P492J?{}dU0Z-N9=jSp=+ys_t-Jopahh_ zNfDTaM!jZuHs?kKuU*|asfl$SC7=Y9fD%vwNOxK@S1FmtWCB`wnBDr3E(-|d9qiu2Cs9S*V3W{ zlzUz~<9OLb{9*8NmPm diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_cts.sh b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_cts.sh deleted file mode 100755 index 04cefd1..0000000 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_cts.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -# CTS Configuration dump -# generated: 2019-02-05 15:10 -# CTS Compile time: 2019-01-21 14:47 -# -# trbcmd Dev. Reg. Value -trbcmd setbit 0xc035 0xa00c 0x80000000 # Disable all triggers -trbcmd w 0xc035 0xa008 0xffffffff # cts_fsm_limits: ro=65535, td=65535 -trbcmd w 0xc035 0xa009 0x00000001 # cts_readout_config: - # channel_cnt=false, idle_dead_cnt=false, input_cnt=true - # timestamp=false, trg_cnt=false -trbcmd w 0xc035 0xa00c 0x80000400 # cts_throttle: enable=true, stop=false, threshold=0 -trbcmd w 0xc035 0xa00d 0x00000001 # cts_eventbuilder: - # cal_eb=0, mask=0000 0000 0000 0001, rr_interval=0 - # use_cal_eb=false -trbcmd w 0xc035 0xa101 0xffff0400 # trg_channel_mask: edge=1111 1111 1111 1111, mask=0000 0100 0000 0000 -trbcmd w 0xc035 0xa124 0x00000000 # trg_input_config0: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa125 0x00000000 # trg_input_config1: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa126 0x00000000 # trg_input_config2: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa127 0x00000000 # trg_input_config3: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa128 0x00000000 # trg_input_config4: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa129 0x00000000 # trg_input_config5: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa12a 0x00000000 # trg_input_config6: delay=0, invert=false, override=off, spike_rej=0 -trbcmd w 0xc035 0xa13b 0x000f0000 # trg_coin_config0: - # coin_mask=0000 0000, inhibit_mask=0000 0000 - # window=15 -trbcmd w 0xc035 0xa13c 0x000f0000 # trg_coin_config1: - # coin_mask=0000 0000, inhibit_mask=0000 0000 - # window=15 -trbcmd w 0xc035 0xa13e 0x00000000 # trg_input_mux0: input=extclk[0] -trbcmd w 0xc035 0xa13f 0x00000001 # trg_input_mux1: input=extclk[1] -trbcmd w 0xc035 0xa140 0x00000002 # trg_input_mux2: input=trgext[2] -trbcmd w 0xc035 0xa141 0x00000003 # trg_input_mux3: input=trgext[3] -trbcmd w 0xc035 0xa142 0x00000004 # trg_input_mux4: input=jeclin[0] -trbcmd w 0xc035 0xa143 0x00000005 # trg_input_mux5: input=jeclin[1] -trbcmd w 0xc035 0xa144 0x00000006 # trg_input_mux6: input=jeclin[2] -trbcmd w 0xc035 0xa146 0x00000000 # trg_addon_output_mux0: input=itc[0] -trbcmd w 0xc035 0xa147 0x00000001 # trg_addon_output_mux1: input=itc[1] -trbcmd w 0xc035 0xa148 0x00000002 # trg_addon_output_mux2: input=itc[2] -trbcmd w 0xc035 0xa149 0x00000003 # trg_addon_output_mux3: input=itc[3] -trbcmd w 0xc035 0xa14a 0x00000004 # trg_addon_output_mux4: input=itc[4] -trbcmd w 0xc035 0xa14b 0x00000005 # trg_addon_output_mux5: input=itc[5] -trbcmd w 0xc035 0xa14c 0x00000006 # trg_addon_output_mux6: input=itc[6] -trbcmd w 0xc035 0xa14d 0x00000007 # trg_addon_output_mux7: input=itc[7] -trbcmd w 0xc035 0xa14f 0x00010000 # trg_periph_config0: mask=0001 0000 0000 0000 0000 -trbcmd w 0xc035 0xa150 0x00000000 # trg_periph_config1: mask=0000 0000 0000 0000 0000 -trbcmd w 0xc035 0xa151 0x00000000 # trg_periph_config2: mask=0000 0000 0000 0000 0000 -trbcmd w 0xc035 0xa152 0x00000000 # trg_periph_config3: mask=0000 0000 0000 0000 0000 -trbcmd w 0xc035 0xa154 0x000061a7 # trg_pulser_config0: low_duration=24999 -trbcmd w 0xc035 0xa155 0x00000003 # trg_pulser_config1: low_duration=3 -trbcmd w 0xc035 0xa157 0x00000000 # trg_random_pulser_config0: threshold=0 -trbcmd w 0xc035 0xa159 0x1111111d # _trg_trigger_types0: - # type0=0xd_tdc_calibration_trigger, type1=0x1_physics_trigger - # type2=0x1_physics_trigger, type3=0x1_physics_trigger - # type4=0x1_physics_trigger, type5=0x1_physics_trigger - # type6=0x1_physics_trigger, type7=0x1_physics_trigger -trbcmd w 0xc035 0xa15a 0x11111111 # _trg_trigger_types1: - # type10=0x1_physics_trigger, type11=0x1_physics_trigger - # type12=0x1_physics_trigger, type13=0x1_physics_trigger - # type14=0x1_physics_trigger, type15=0x1_physics_trigger - # type8=0x1_physics_trigger, type9=0x1_physics_trigger -trbcmd clearbit 0xc035 0xa00c 0x80000000 # Enable all triggers - diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_log.txt b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_log.txt deleted file mode 100644 index d3ca223..0000000 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_log.txt +++ /dev/null @@ -1,25 +0,0 @@ -... -DAQOPSERVER=localhost:35 - -... -dhcp server started -using config file /conf/dhcpd.conf - -... -started trbnetd -TRB3_SERVER=192.168.4.240 -port 35 - -... -started cts_gui with following parameters: ---endpoint 0xc035 ---port 1148 - -... -started vnc server (e.g. for Go4 window) -port=5902 -DISPLAY=:2 -password= - -connect with: vncviewer localhost:5902 - diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_tdcs.sh b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_tdcs.sh deleted file mode 100755 index a2cc702..0000000 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/conf_tdcs.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - - - -### all tdcs ### - -for TDC in 0x0350 0x0351 0x0352 0x0353; do - - # invert the first 32 channels - trbcmd w $TDC 0xc805 0xFFFFFFFF - - # enable trigger windows +-1000 ns - trbcmd w $TDC 0xc801 0x80c800c8 - - # set channel ringbuffer size - trbcmd w $TDC 0xc804 10 - -done - - -### tdcs with pasttrec attached ### - -for TDC in 0x0350 0x0351; do - - # enable the first 16 channels (CONN1) - trbcmd setbit $TDC 0xc802 0x0000FFFF - - # enable the second 16 channels (CONN2) - trbcmd setbit $TDC 0xc802 0xFFFF0000 - -done - - -### reference time TDC ### - -for TDC in 0x0353; do - - # non- invert the first channel - trbcmd clearbit $TDC 0xc805 0x1 - - # enable the first channel - trbcmd setbit $TDC 0xc802 0x1 - - # enable Florian's trigger Logic - trbcmd setbit $TDC 0xe000 0x1 - # enable edge detect - trbcmd setbit $TDC 0xe008 0x1 - # merge outputs - trbcmd setbit $TDC 0xe018 0x1 - # delay 0 cycles - trbcmd setbit $TDC 0xe100 0x0 - # stretcher on, five cycles - #trbcmd setbit $TDC 0xe200 0x10005 - -done diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/reload_all.sh b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/reload_all.sh deleted file mode 100755 index a016ca9..0000000 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/conf/reload_all.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -trbcmd reload 0x0350 -trbcmd reload 0x0351 -trbcmd reload 0x0352 -trbcmd reload 0x0353 -trbcmd reload 0xc035 - -sleep 4 - -./addresses.sh diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir new file mode 120000 index 0000000..7b18276 --- /dev/null +++ b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir @@ -0,0 +1 @@ +../example_workdir \ No newline at end of file diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/second.C b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/second.C deleted file mode 100644 index 7a2a4f1..0000000 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/second.C +++ /dev/null @@ -1,454 +0,0 @@ -#include -#include -#include -#include - -#include "TTree.h" -#include "TFile.h" -#include "TSystem.h" -#include "TString.h" -#include "TH1.h" -#include "TH2.h" -#include "TCanvas.h" -#include "TGo4AnalysisObjectManager.h" - - -#include "base/EventProc.h" -#include "base/Event.h" -#include "hadaq/TdcSubEvent.h" - -#define CHANNELS 33 -#define REFCHAN 0 -// #define REFCHAN_B 0 - -#define VERBOSE 0 -#define TAKE_FIRST_HIT 1 - - - -// Muentz-Torte -#define t1_L -400 // EE -#define t1_R 400 // EE -#define tot_L -10 // EE -#define tot_R 1000 // EE - -#define ref_channel_offset -75 //ns fine measured ref channel relative to coarse measured cts trigger channel -//#define ref_channel_offset 0 //ns fine measured ref channel relative to coarse measured cts trigger channel - -// in the first iteration, scanning through data in the coincidence window, rejecting hits (fuzzy edges) - -//#define spike_rejection 90 //ns for ASD8 0x72 (25000) with LASER -// #define spike_rejection 90 //ns for PASTTREC pt10 // for t1 calibration -//#define spike_rejection 60 //ns for PASTTREC pt10 -// #define spike_rejection 45 //ns for PASTTREC with all the nice filters -// #define spike_rejection 90 //ns for PASTTREC pt15 -//#define spike_rejection 100 //ns for PASTTREC pt20 -// #define spike_rejection 30 //ns for ASD8 0xA9 -// #define spike_rejection 60 //ns for ASD8 0x72 -// #define spike_rejection 75 //ns for ASD8 0x52 -//#define spike_rejection 47 //ns for ASD8 thr 37000 with LASER -// #define spike_rejection 90 //ns for PASTTREC pt20 with LASER -//#define spike_rejection 90 //ns for PASTTREC pt20 with Fe55 - -#define spike_rejection 30 -#define spike_rejection_refchan 10 - -#define individual_spike_rejection 0 - -//#define ref_spike_rejection 100 - - -//#define t1_accept_L (-250 + ref_channel_offset) //ns // GSI Dlab -//#define t1_accept_L (-1000000 + ref_channel_offset) //ns // HZDR fe55 -#define t1_accept_L (-2000 + ref_channel_offset) //ns // EE -//#define t1_accept_L (-150 + ref_channel_offset) //ns // Muentz-Torte -//#define t1_accept_R (100 + ref_channel_offset)//ns // GSI Dlab -//#define t1_accept_R (1000000 + ref_channel_offset)//ns // HZDR fe55 -#define t1_accept_R (2000 + ref_channel_offset)//ns // EE -// #define t1_accept_R (-130 + ref_channel_offset)//ns // Muentz-Torte -// #define t1_accept_R (-90 + ref_channel_offset)//ns // ASD8 with thr 0x52 - -#define fish_proj_cut 20 - - - -// real cuts on selected data - -#define max_tot 1000000 // Muentz-Torte -#define t1_cut_L -2000 -#define t1_cut_R 2000 - - -// #define coincidence_rejection 7 -#define accept_hits_per_layer 20 - -#define enable_coincidence_rejection 0 - -#define enable_single_hits 0 -#define enable_one_hit_per_layer 1 -#define enable_two_to_one_hits 0 - - - -// TFile* tree_out; -std::map trig_no; -std::map data_tree; -Bool_t write_tree = false; - - - -Bool_t file_exists(TString fname){ - - fstream src_file(fname.Data()); - return src_file.good(); -} - -TString from_env(TString env_var,TString default_val){ - if(gSystem->Getenv(env_var)){ - return gSystem->Getenv(env_var); - } - return default_val; -} - - - -class SecondProc : public base::EventProc { - protected: - - std::string fTdcId; //!< tdc id where channels will be selected - - double fHits[8]; //!< 8 channel, abstract hits - - base::H1handle hNumHits; //!< histogram with hits number -// base::H2handle h2D; - -// base::H1handle totCh1; //!< histogram with hits number -// base::H1handle totCh2; //!< histogram with hits number - - - base::H1handle tot_h[CHANNELS]; - base::H1handle tot_untrig_h[CHANNELS]; - base::H1handle t1_h[CHANNELS]; - base::H1handle potato_h[CHANNELS]; - base::H1handle meta_potato_h; - base::H1handle meta_t1_h; - base::H1handle meta_tot_h; - base::H1handle meta_tot_2d; - base::H1handle meta_t1_2d; - base::H1handle coinc_matrix; -// base::H1handle meta_fish; -// base::H1handle meta_fish_proj; -// base::H1handle fishes[FISHES]; -// base::H1handle fish_proj[FISHES]; - base::H1handle efficiency_h; - base::H1handle ref_counts_h; - base::H1handle dut_counts_h; - - - int entry_chan; - int entry_ref_chan; - double entry_t1; - double entry_tot; - - - - - -// int evt_no; - - public: - SecondProc(const char* procname, const char* _tdcid) : - base::EventProc(procname), - fTdcId(_tdcid), - hNumHits(0) - { - printf("Create %s for %s\n", GetName(), fTdcId.c_str()); - - hNumHits = MakeH1("FineAll","Fine all", 1020, 0, 1020, "fine"); -// h2D = MakeH2("h2d","title", 100, -20, 20, 100, -20,20,"x;y"); -// totCh1 = MakeH1("totCh1","totCh1", 20000, -200, 200, "ns"); -// totCh2 = MakeH1("totCh2","totCh2", 20000, -200, 200, "ns"); - - - if(from_env("tree_out","false") == "true"){ - write_tree = true; - } - - trig_no[fTdcId] = 0; - data_tree[fTdcId] = new TTree((TString) fTdcId,"data recorded"); - data_tree[fTdcId]->Branch("trig_no",&trig_no[fTdcId]); - data_tree[fTdcId]->Branch("t1",&entry_t1); - data_tree[fTdcId]->Branch("tot",&entry_tot); - data_tree[fTdcId]->Branch("chan",&entry_chan); - data_tree[fTdcId]->Branch("ref_chan",&entry_ref_chan); - - - for( unsigned i=0; iSetDrawOption("P0"); - ((TH1F*) efficiency_h)->SetMarkerStyle(22); - ((TH1F*) efficiency_h)->GetXaxis()->SetNdivisions(55); - - coinc_matrix = MakeH2("coinc_matrix","coinc_matrix",12,-2.5,9.5,10,15-0.5,24+0.5, "channels 0-7;channels 16-23"); - //meta_fish = MakeH2("meta_fish","meta_fish",250,-300,200,200,-100,100, "T_A+T_B;T_B-T_A"); - - //meta_fish_proj = MakeH1("meta_fish_proj","meta_fish_proj",250,-300,200, "T_A+T_B;counts"); - - - - // enable storing already in constructor - SetStoreEnabled(); - } - - virtual void UserPostLoop(void) { - - static Int_t was_called_before = 0; - - cout << "--- User Post Loop " << fTdcId << endl; -// TFile* tree_out = new TFile( Form("tree_out_%s.root",fTdcId.c_str()) ,"RECREATE"); - - if(from_env("tree_out","false") == "true"){ - - cout << "write tree_out.root" << endl; - TFile* tree_out; - - - if(was_called_before){ - tree_out = new TFile("tree_out.root","UPDATE"); - } else { - tree_out = new TFile("tree_out.root","RECREATE"); - } - tree_out->cd(); - data_tree[fTdcId]->Write(); - tree_out->Write(); - tree_out->Close(); - delete tree_out; - } - was_called_before ++; - } - - - virtual void CreateBranch(TTree* t) - { - // only called when tree is created in first.C - // one can ignore - t->Branch(GetName(), fHits, "hits[8]/D"); - } - - virtual bool Process(base::Event* ev) - { -// printf("### DEBUG ###\n"); - for (unsigned n=0;n<8;n++) fHits[n] = 0.; - - hadaq::TdcSubEvent* sub = - dynamic_cast (ev->GetSubEvent(fTdcId)); - - if(VERBOSE) cout<< "tdc: " << fTdcId << " evt no: " << trig_no[fTdcId] << endl; - if (sub==0) return false; - -// printf("%s process sub %d %s\n", GetName(), sub->Size(), fTdcId.c_str()); - - - static float effective_spike_rejection = from_env("spike_rejection", TString::Itoa(spike_rejection,10) ).Atof(); - - -// static int ref_counts[CHANNELS]; -// static int dut_counts[CHANNELS]; -// static bool is_dut[CHANNELS]; - - - // this is only run once -- - static bool is_initialized=false; - if(not(is_initialized)){ - for( int i = 0; i<31; i++){ -// ref_counts[i] = 0; -// dut_counts[i] = 0; -// is_dut[i] = false; -// if((overlaps[i][0] >= 0) && (overlaps[i][1] >= 0)){ -// is_dut[i] = true; -// } - } - - - - - is_initialized = true; - } - // ------ - - double num(0), ch0tm(0), ch1tm(0), ch2tm(0), ch3tm(0); - double t1_candidate[CHANNELS]; - double t2_candidate[CHANNELS]; - double t1[CHANNELS]; - double t2[CHANNELS]; - bool got_rising[CHANNELS]; - bool got_falling[CHANNELS]; - bool got_real_hit[CHANNELS]; - double tot[CHANNELS]; - for (unsigned i=0; iSize();cnt++) { - const hadaq::TdcMessageExt& ext = sub->msg(cnt); - - unsigned chid = ( ext.msg().getHitChannel() ); - bool rising = ext.msg().isHitRisingEdge(); // use this line for rising edge first/positive pulses - - if (chid==0) { - ch0tm = ext.GetGlobalTime(); - got_real_hit[chid] = true; - t1[chid] = 0; - tot[chid] = 100e-9; - continue; - - } - - - // full time - double tm = ext.GetGlobalTime(); - if((chid) >= CHANNELS) {continue;} // channel out of range of analysis - if(rising){ - - - if( !(TAKE_FIRST_HIT && got_real_hit[chid]) ){ // block subsequent hits if TAKE_FIRST_HIT setting is active - if((( ((tm)*1e9) > t1_accept_L) && (((tm)*1e9) < t1_accept_R )) ) { // this condition sets another coincidence window, except for REFCHAN_A - got_rising[chid] = true; - got_falling[chid] = false; - t1_candidate[chid] = tm; - } - } - }else{ // if falling edge -// printf("got falling edge, ch %d\n",(chid)); - if(got_rising[chid]){ - if(not(got_falling[chid])){ - got_falling[chid] = true; - t2_candidate[chid] = tm; - Double_t candidate_tot_ns = (t2_candidate[chid] - t1_candidate[chid])*1e9; - - if( candidate_tot_ns > effective_spike_rejection || (chid==REFCHAN || candidate_tot_ns > spike_rejection_refchan) ){ - // hit is long enough not to be rejected - t1[chid] = t1_candidate[chid]; - t2[chid] = t2_candidate[chid]; - tot[chid] = t2[chid] - t1[chid]; - got_real_hit[chid] = true; - - // fill untriggered tot histogram - FillH1(tot_untrig_h[chid],tot[chid]*1e9); - } -// printf("got hit, ch %d, tot = %f ns\n",(chid), tot[chid]*1e9); - } - } - } - - } - - - - for( unsigned i=0; i t1_cut_L) && (t1_vs_ref < t1_cut_R) && (tot[i]*1e9 < max_tot) ) { - - // fill histograms - FillH1(tot_h[i],tot[i]*1e9); - FillH2(potato_h[i],t1_vs_ref ,tot[i]*1e9); - FillH1(t1_h[i],t1_vs_ref ); // without cuts -// if(t1_vs_ref < -200 && tot[i]*1e9 > 0 ) FillH1(t1_h[i],t1_vs_ref ); // with noise rejecting cuts - // if( tot[i]*1e9 > 50 ) FillH1(t1_h[i],t1_vs_ref ); // with noise rejecting cuts - - - if( i != 0 ) { - FillH2(meta_potato_h,t1_vs_ref,tot[i]*1e9); - FillH1(meta_tot_h,tot[i]*1e9); - FillH1(meta_t1_h,t1_vs_ref ); - FillH2(meta_tot_2d,tot[i]*1e9,i); - FillH2(meta_t1_2d,t1_vs_ref,i); - entry_chan = i; - entry_t1 = t1_vs_ref; - entry_tot = tot[i]*1e9; - if(write_tree){ - data_tree[fTdcId]->Fill(); - } - } - - // efficiency estimation ... this cell, cell #i, is a reference detector -// ref_counts[i]++; // count up reference counts -// FillH1(counts_h,i-0.5); - } - } - } - - - - for (int i = 1 ; iSetBinContent(i,((float) (((TH1F*) t1_h[i])->GetEntries()) )/((float) (((TH1F*) t1_h[0])->GetEntries()))); - ((TH1F*) efficiency_h)->SetBinContent(i,((float) (((TH1F*) t1_h[i])->Integral()) )/ 600. ); // fixed numer of pulses sent for each channel - // ((TH1F*) efficiency_h)->SetBinContent(i,((float) (((TH1F*) t1_h[i])->Integral()) )/((float) (((TH1F*) tot_h[i])->Integral()))); ; // normalize by number of signals in same channel without couts, as for almost each trigger a noise signal is measured - } - - - - -// if(got_real_hit[0]){ -// FillH1(totCh1,tot[0]*1e9); -// } -// if(got_real_hit[1]){ -// FillH1(totCh2,tot[1]*1e9);ref_counts[i] -// } - -// FillH1(hNumHits, num); - - -// draw_and_save((TH2F*) meta_fish, "meta_fish","./","colz"); - -// tree_out->cd(); -// data_tree[fTdcId]->Write(); - trig_no[fTdcId]++; - - return true; - } - - -}; - - -void second() -{ - //hadaq::TdcProcessor::SetDefaults(700); -// tree_out = new TFile("./tree_out.root","RECREATE"); -// new SecondProc("Sec_1130", "TDC_1130"); -// new SecondProc("Sec_0352", "TDC_0353"); - new SecondProc("Sec_0350", "TDC_0350"); - new SecondProc("Sec_0353", "TDC_0353"); -// tree_out->Write(); -// tree_out->Close(); -} - diff --git a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/start.sh b/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/start.sh deleted file mode 100755 index 0914180..0000000 --- a/go4_trbnet/go4_trbnet_leap_15.0_stable_2018-03-01/workdir/start.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -echo "container started" - -echo "create main tmux session" - -echo "run /conf/conf.sh" -. /conf/conf.sh - -cd /workdir -tmux new -d -s main - - - -tmux link-window -s cts_gui:cts_gui -t main -tmux link-window -s vnc:vnc -t main - - -tmux new-window -t main -n "dabc" "dabc_exe TdcEventBuilder_noHLD.xml;/bin/bash" - - -#tmux new-window -t main -n "go4" "rm *.root; go4 0350_meta.hotstart;/bin/bash" -tmux new-window -t main -n "go4_ana" "rm *.root; tree_out=false go4analysis -stream localhost:6790 -http localhost:8080;/bin/bash" - -# tmux new-window -t main -n "htop" "htop;/bin/bash" -tmux new-window -t main -n "info" "cat /conf/conf_log.txt; cat info.txt; /bin/bash" -tmux new-window -t main -n "PT_ctrl" "cd /workdir/pasttrec_ctrl; /bin/bash" -tmux new-window -t main -n "new" "/bin/bash" -tmux new-window -t main -n "new" "/bin/bash" -tmux new-window -t main -n "new" "/bin/bash" -tmux new-window -t main -n "new" "/bin/bash" -tmux new-window -t main -n "new" "/bin/bash" -tmux new-window -t main -n "x11_apps" "lxpanel& sleep 10; firefox localhost:8080& /bin/bash" -tmux select-window -t main:info - - -tmux a -t main - - - - -echo "drop user to shell" -/bin/bash - -echo "terminate container" -- 2.43.0