]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
added scripts to generate hub and eb config from extended data_sources.b containing...
authorJ.Adamczewski-Musch <j.adamczewski@gsi.de>
Mon, 30 Jan 2023 13:13:31 +0000 (14:13 +0100)
committerHadaq Hades <jan@lxhadeb07>
Mon, 30 Jan 2023 13:13:31 +0000 (14:13 +0100)
19 files changed:
evtbuild/change2newserver.sh [deleted file]
evtbuild/change2oldserver.sh [deleted file]
evtbuild/configgbe_ip_begin.db [new file with mode: 0644]
evtbuild/configgbe_ip_datasources.db [new file with mode: 0644]
evtbuild/configgbe_ip_hosts.db [new file with mode: 0644]
evtbuild/eb_bnet_fsd_newservers.conf [deleted file]
evtbuild/eb_bnet_ltsm.conf [deleted file]
evtbuild/eb_bnet_ltsm_newservers.conf [deleted file]
evtbuild/generate_ebhub_config.pl [new file with mode: 0755]
evtbuild/start_eb_gbe_feb22.pl
evtbuild/start_eb_gbe_newservers.pl [deleted file]
evtbuild/start_eb_gbe_oldservers.pl [deleted file]
hmon/QA.pm
hmon/hmon_endpoints.pl
hmon/hmon_logfrpc.pl [changed mode: 0755->0644]
hub/register_configgbe_ip.db
main/data_sources.db
oracle/collab/collab_fromora_daily.pl
trg/triggerbox.trbcmd

diff --git a/evtbuild/change2newserver.sh b/evtbuild/change2newserver.sh
deleted file mode 100755 (executable)
index ecb36dd..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-# JAM 8-mar-2019: switch bnet configuration to new servers
-export myvar=$(/home/hadaq/trbsoft/hadesdaq/utils/doyoureallywant.pl "Change eventbulder configuration to setup mar19?")
-if [ $myvar == "256" ]; then exit; fi
-
-# first stop eventbuilders
-/home/hadaq/trbsoft/daq/control/gui/eb/65_____Stop_EB;
-# stop trigger
-/home/hadaq/trbsoft/daq/control/gui/daq/15_Start_Stop_Trigger;
-# change setup files
-cd /home/hadaq/trbsoft/daq/hub;
-rm register_configgbe_ip.db;
-ln -s register_configgbe_ip_newservers_secondgbe.db register_configgbe_ip.db;
-cd /home/hadaq/trbsoft/daq/evtbuild;
-rm eb.conf;
-ln -s eb_bnet_ltsm_newservers.conf eb.conf;
-rm start_eb_gbe.pl;
-ln -s start_eb_gbe_newservers.pl start_eb_gbe.pl;
-
-# restart daq
-/home/hadaq/trbsoft/daq/control/gui/daq/10_Start_DAQ;
-# start bnet master
-/home/hadaq/trbsoft/daq/control/gui/expert/Restart_BNET_Control;
-# start eventbuilders with 8 nodes
-/home/hadaq/trbsoft/daq/control/gui/eb/75_Set_8_EB;
-# restart hmon (because bnet master webserver was restarted)
-/home/hadaq/trbsoft/daq/control/gui/expert/Restart_Hmon
-
-echo changed eventbuilder configuration to new servers (March 2019)
-
-
-
-
-
diff --git a/evtbuild/change2oldserver.sh b/evtbuild/change2oldserver.sh
deleted file mode 100755 (executable)
index 70c5f46..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-# JAM 8-mar-2019: switch bnet configuration to old servers
-export myvar=$(/home/hadaq/trbsoft/hadesdaq/utils/doyoureallywant.pl "Change eventbulder configuration to setup 2018?")
-if [ $myvar == "256" ]; then exit; fi
-
-# first stop eventbuilders
-/home/hadaq/trbsoft/daq/control/gui/eb/65_____Stop_EB;
-# stop trigger
-/home/hadaq/trbsoft/daq/control/gui/daq/15_Start_Stop_Trigger;
-# change setup files
-cd /home/hadaq/trbsoft/daq/hub;
-rm register_configgbe_ip.db;
-ln -s register_configgbe_ip_oldservers.db register_configgbe_ip.db;
-cd /home/hadaq/trbsoft/daq/evtbuild;
-rm eb.conf;
-ln -s eb_bnet_ltsm.conf eb.conf;
-rm start_eb_gbe.pl;
-ln -s start_eb_gbe_oldservers.pl start_eb_gbe.pl;
-
-# restart daq
-/home/hadaq/trbsoft/daq/control/gui/daq/10_Start_DAQ;
-# start bnet master
-/home/hadaq/trbsoft/daq/control/gui/expert/Restart_BNET_Control;
-# start eventbuilders with 8 nodes
-/home/hadaq/trbsoft/daq/control/gui/eb/75_Set_8_EB;
-# restart hmon (because bnet master webserver was restarted)
-/home/hadaq/trbsoft/daq/control/gui/expert/Restart_Hmon
-
-echo changed eventbuilder configuration to old servers (December 2018)
-
-
-
-
-
diff --git a/evtbuild/configgbe_ip_begin.db b/evtbuild/configgbe_ip_begin.db
new file mode 100644 (file)
index 0000000..c5d158f
--- /dev/null
@@ -0,0 +1,77 @@
+###########################################################################################
+# JAM 27-01-2023: First part of automatically hub configuration from data sources->EB setup
+#######
+
+## Following is fixed header concerning the eventbuilder destinations:
+#Broadcast to all GbE-Entities: 0xff7f
+
+!Register table
+#  Type  #   C0   #   C1   #   C2   #   C3   #   C4   #   C5   #   C6   #   C7   #   C8   #
+###########################################################################################
+# #old register set
+#     17     0xc100   0xc101   0xc102   0xc103   0xc104   0xc105   0xc106   0xc107   0xc108
+# #new memory locations
+#      0     0x8100   0x8101   0x8102   0x8103   0x8104   0x8105   0x8106   0x8107   0x8108
+#      1     0x8110   0x8111   0x8112   0x8113   0x8114   0x8115   0x8116   0x8117   0x8118
+#      2     0x8120   0x8121   0x8122   0x8123   0x8124   0x8125   0x8126   0x8127   0x8128
+#      3     0x8130   0x8131   0x8132   0x8133   0x8134   0x8135   0x8136   0x8137   0x8138
+#      4     0x8140   0x8141   0x8142   0x8143   0x8144   0x8145   0x8146   0x8147   0x8148
+#      5     0x8150   0x8151   0x8152   0x8153   0x8154   0x8155   0x8156   0x8157   0x8158
+#      6     0x8160   0x8161   0x8162   0x8163   0x8164   0x8165   0x8166   0x8167   0x8168
+#      7     0x8170   0x8171   0x8172   0x8173   0x8174   0x8175   0x8176   0x8177   0x8178
+#      8     0x8180   0x8181   0x8182   0x8183   0x8184   0x8185   0x8186   0x8187   0x8188
+#      9     0x8190   0x8191   0x8192   0x8193   0x8194   0x8195   0x8196   0x8197   0x8198
+#     10     0x81A0   0x81A1   0x81A2   0x81A3   0x81A4   0x81A5   0x81A6   0x81A7   0x81A8
+#     11     0x81B0   0x81B1   0x81B2   0x81B3   0x81B4   0x81B5   0x81B6   0x81B7   0x81B8
+#     12     0x81C0   0x81C1   0x81C2   0x81C3   0x81C4   0x81C5   0x81C6   0x81C7   0x81C8
+#     13     0x81D0   0x81D1   0x81D2   0x81D3   0x81D4   0x81D5   0x81D6   0x81D7   0x81D8
+#     14     0x81E0   0x81E1   0x81E2   0x81E3   0x81E4   0x81E5   0x81E6   0x81E7   0x81E8
+#     15     0x81F0   0x81F1   0x81F2   0x81F3   0x81F4   0x81F5   0x81F6   0x81F7   0x81F8
+
+
+#Sliced tables for broadcast settings follow:    
+#  Type  #   C0   #   C1   #   C2   #   C5   #   C8   #
+#######################################################    
+   100     0x8100   0x8101   0x8102   0x8105   0x8108
+   101     0x8110   0x8111   0x8112   0x8115   0x8118
+   102     0x8120   0x8121   0x8122   0x8125   0x8128
+   103     0x8130   0x8131   0x8132   0x8135   0x8138
+   104     0x8140   0x8141   0x8142   0x8145   0x8148
+   105     0x8150   0x8151   0x8152   0x8155   0x8158
+   106     0x8160   0x8161   0x8162   0x8165   0x8168
+   107     0x8170   0x8171   0x8172   0x8175   0x8178
+   108     0x8180   0x8181   0x8182   0x8185   0x8188
+   109     0x8190   0x8191   0x8192   0x8195   0x8198
+   110     0x81A0   0x81A1   0x81A2   0x81A5   0x81A8
+   111     0x81B0   0x81B1   0x81B2   0x81B5   0x81B8
+   112     0x81C0   0x81C1   0x81C2   0x81C5   0x81C8
+   113     0x81D0   0x81D1   0x81D2   0x81D5   0x81D8
+   114     0x81E0   0x81E1   0x81E2   0x81E5   0x81E8
+   115     0x81F0   0x81F1   0x81F2   0x81F5   0x81F8
+
+#Table for individual settings   
+#  Type  #   C3   #   C4   #   C6   #   C7   #
+##############################################
+    0     0x8103   0x8104   0x8106   0x8107  
+    1     0x8113   0x8114   0x8116   0x8117  
+    2     0x8123   0x8124   0x8126   0x8127  
+    3     0x8133   0x8134   0x8136   0x8137  
+    4     0x8143   0x8144   0x8146   0x8147  
+    5     0x8153   0x8154   0x8156   0x8157  
+    6     0x8163   0x8164   0x8166   0x8167  
+    7     0x8173   0x8174   0x8176   0x8177  
+    8     0x8183   0x8184   0x8186   0x8187  
+    9     0x8193   0x8194   0x8196   0x8197  
+   10     0x81A3   0x81A4   0x81A6   0x81A7  
+   11     0x81B3   0x81B4   0x81B6   0x81B7  
+   12     0x81C3   0x81C4   0x81C6   0x81C7  
+   13     0x81D3   0x81D4   0x81D6   0x81D7  
+   14     0x81E3   0x81E4   0x81E6   0x81E7  
+   15     0x81F3   0x81F4   0x81F6   0x81F7  
+    
+    
+    
+!Value table
+#                    Dest Port    Src MAC      Src IP        Src Port #          #   TDC Calib flag
+# Hub    #  Type  #     C3     #     C4     #     C6     #     C7     #   EB IP  # 1:NO 1:linear 2:complex 11:linear with ToT 15ns
+##########################################################################################################
diff --git a/evtbuild/configgbe_ip_datasources.db b/evtbuild/configgbe_ip_datasources.db
new file mode 100644 (file)
index 0000000..713a5dc
--- /dev/null
@@ -0,0 +1,80 @@
+# Table with active data sources
+# JAM 27-01-2023: extended by EBhost and TDCflag for automatic hub configuration script
+#########
+# Addr     On/Off     Name           DataSize  EBhost TDCflag
+#Start must be the first for EvtId
+0x8800      1         CentralCTS       low     lxhadeb11 0 
+0x8810      1         CentralAUX       low     lxhadeb11 0
+0x8880      1        StartTRB3         low     lxhadeb09 2
+0x8890      0         Veto              mid    lxhadeb09 2
+0x84c0      1         RPCnew1           mid    lxhadeb10 2
+0x84c1      1         RPCnew2           mid    lxhadeb10 2
+0x84c2      1         RPCnew3           mid    lxhadeb10 2
+0x84c3      1         RPCnew4           mid    lxhadeb11 2
+0x84c4      1         RPCnew5           mid    lxhadeb11 2
+0x84c5      1         RPCnew6           mid    lxhadeb11 2
+0x86c0      1         TOFnew1           mid    lxhadeb08 2
+0x86c1      1         TOFnew2           mid    lxhadeb10 2
+0x86c2      1         TOFnew3           mid    lxhadeb10 2
+0x86c3      1         TOFnew4           mid    lxhadeb11 2
+0x86c4      1         TOFnew5           mid    lxhadeb11 2
+0x86c5      1         TOFnew6           mid    lxhadeb14 2
+0x1000      1         MDC12sec1         high   lxhadeb08 0 
+0x1010      1         MDC12sec2         high   lxhadeb08 0
+0x1020      1         MDC12sec3         high   lxhadeb08 0
+0x1030      1         MDC12sec4         high   lxhadeb08 0
+0x1040      1         MDC12sec5         high   lxhadeb08 0
+0x1050      1         MDC12sec6         high   lxhadeb08 0
+0x1100      1         MDC34sec1         high   lxhadeb09 0
+0x1110      1         MDC34sec2         mid    lxhadeb09 0
+0x1120      1         MDC34sec3         high   lxhadeb09 0
+0x1130      1         MDC34sec4         mid    lxhadeb09 0
+0x1140      1         MDC34sec5         high   lxhadeb09 0
+0x1150      1         MDC34sec6         high   lxhadeb09 0
+# new MDC below: JAM
+#0x8500      1         MDC12sec1         high  lxhadeb08 2
+#0x8510      1         MDC12sec2         high  lxhadeb08 2
+#0x8520      1         MDC12sec3         high  lxhadeb08 2
+#0x8530      1         MDC12sec4         high  lxhadeb08 2
+#0x8540      1         MDC12sec5         high  lxhadeb08 2
+#0x8550      1         MDC12sec6         high  lxhadeb08 2
+#0x8560      1         MDC34sec1         high  lxhadeb09 2
+#0x8570      1         MDC34sec2         high  lxhadeb09 2
+#0x8580      1         MDC34sec3         high  lxhadeb09 2
+#0x8590      1         MDC34sec4         high  lxhadeb09 2
+#0x85a0      1         MDC34sec5         high  lxhadeb09 2
+#0x85b0      1         MDC34sec6         high  lxhadeb09 2
+0x8700      1         FW0               mid    lxhadeb16 1
+0x8701      1         FW1               mid    lxhadeb16 1
+0x8702      1         FW2               mid    lxhadeb16 1
+0x8a00      1         ECal0             mid    lxhadeb10 2
+0x8a01      1         ECal1             mid    lxhadeb10 2
+0x8a02      1         ECal2             mid    lxhadeb10 2
+0x8a03      1         ECal3             mid    lxhadeb10 2
+0x8a04      1         ECal4             mid    lxhadeb14 2
+0x8a05      1         ECal5             mid    lxhadeb14 2
+0x83c0      1         RICH0             mid    lxhadeb14 11
+0x83c1      1         RICH1             mid    lxhadeb14 11
+0x83c2      1         RICH2             mid    lxhadeb14 11
+0x83c3      1         RICH3             mid    lxhadeb10 11
+0x83c4      1         RICH4             mid    lxhadeb10 11
+0x83c5      1         RICH5             mid    lxhadeb16 11
+0x83c6      1         RICH6             mid    lxhadeb15 11
+0x83c7      1         RICH7             mid    lxhadeb15 11
+0x83c8      1         RICH8             mid    lxhadeb16 11
+0x83c9      1         RICH9             mid    lxhadeb16 11
+0x83ca      1         RICHa             mid    lxhadeb11 11
+0x83cb      1         RICHb             mid    lxhadeb15 11
+0x8b00      1         STS1-0             mid   lxhadeb15 2
+0x8b01      1         STS1-1             mid   lxhadeb15 2
+0x8b02      1         STS1-2             mid   lxhadeb15 2
+0x8b03      0         STS1-3             mid   lxhadeb15 2
+0x8b10      0         STS2-0             mid   lxhadeb16 2
+0x8b11      0         STS2-1             mid   lxhadeb16 2
+0x8b12      0         STS2-2             mid   lxhadeb16 2
+0x8b13      0         STS2-3             mid   lxhadeb16 2
+0x8b14      0         STS2-4             mid   lxhadeb16 2
+0x8b15      0         STS2-5             mid   lxhadeb16 2
+0x8c00      0         FRPC-0             mid   lxhadeb15 2
+0x8c10      0         FRPC-1             mid   lxhadeb15 2
+0x8d00      1         ITOF               mid   lxhadeb10 2
diff --git a/evtbuild/configgbe_ip_hosts.db b/evtbuild/configgbe_ip_hosts.db
new file mode 100644 (file)
index 0000000..c4853f5
--- /dev/null
@@ -0,0 +1,22 @@
+###########################################################################################
+# JAM 27-01-2023 - host definition table for hub/eventbuilder configuration
+##############################################################################
+#
+# Hostname  #  IP      #   MAC,LO   # MAC,HI    #  comments: nic - mac - ip
+#################################################################################################
+lxhadeb08   0xc0a86408   0xbaf79bb5   0x90e2    # enp97s0f1 - 90:e2:ba:f7:9b:b5 - 192.168.100.8
+lxhadeb09   0xc0a86409   0xbaf7cfa1   0x90e2    # enp97s0f1 - 90:e2:ba:f7:cf:a1 - 192.168.100.9  
+lxhadeb10   0xc0a8640a   0xbae2c995   0x90e2    # enp97s0f1 - 90:e2:ba:e2:c9:95 - 192.168.100.10
+lxhadeb11   0xc0a8690b   0x6b8b62f1   0xac1f    # enp19s0f1 - ac:1f:6b:8b:62:f1 - 192.168.105.11
+lxhadeb12   0xc0a8690c   0x6b8b601f   0xac1f    # enp19s0f1 - ac:1f:6b:8b:60:1f - 192.168.105.12
+lxhadeb14   0xc0a86972   0xb73cb20c   0x40a6    # enp67s0f0 - 40:a6:b7:3c:b2:0c - 192.168.105.114 
+lxhadeb15   0xc0a86973   0xb73c5e0c   0x40a6    # enp67s0f0 - 40:a6:b7:3c:5e:0c - 192.168.105.115 
+lxhadeb16   0xc0a86974   0xb73c6d98   0x40a6    # enp67s0f0 - 40:a6:b7:3c:6d:98 - 192.168.105.116 
+
+
+                                                            
+                                                                                    
+                                                                                    
+                                                                                    
+                                                                                    
diff --git a/evtbuild/eb_bnet_fsd_newservers.conf b/evtbuild/eb_bnet_fsd_newservers.conf
deleted file mode 100644 (file)
index bbfc372..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-#
-# #Install: Run CPAN and install
-# perl -MCPAN -e shell
-#
-# #At CPAN shell prompt
-# install Config::Std
-
-#----------------------------------------------
-[Main]
-
-PORT_BASE:      11000
-WMARK:          60000
-
-EB_IP:          192.168.100.12
-EB_OUTDIR:      /data/lxhadesdaq/tof_test
-
-# file/null
-EB_OUTDEV:      null
-
-EB_EXT:         te
-
-# file size in MBytes 
-EB_FSIZE:       1500
-
-EB_EVTID:       1   
-SHMEMNAME:      test
-
-QUEUESIZE:      4000000
-
-# enable online server: --online
-# disable online server:
-ONLINESERVER:   --online
-
-# buffer sizes for evtbuild and netmem (MB)
-BUF_SIZE_LOW:   8
-BUF_SIZE_MID:   16
-BUF_SIZE_HIGH:  32
-
-#----------------------------------------------
-[Parallel]
-
-# EB IPS NOT USED IF CONF_FROM_DB 
-
-EB_IP_1: 192.168.100.15
-EB_IP_2: 192.168.100.12
-EB_IP_3: 192.168.100.13
-EB_IP_4: 192.168.100.14
-EB_IP_5: 192.168.100.11
-
-# Number of EB processes per server NOT USED IF CONF_FROM_DB
-EB_NUM_1: 1
-EB_NUM_2: 1
-EB_NUM_3: 1
-EB_NUM_4: 1
-EB_NUM_5: 1
-
-BASE_PORT: 20100
-SHIFT_PORT: 100
-NUM_OF_SOURCES: 1
-
-QUEUESIZE: 32
-
-# JAM 12/2016-
-# the following list configures BNET for each EB SERVER node:
-# this will always imply DABC eventbuilder software.
-# BNETINP gives number of input processes per server node
-# BNETBLD gives maximum number of builder processes per node
-# set BNETINP to 0 for conventional EB setup
-# EB server     0 1 2 3
-#BNETINP:      0 0 0 0 0
-# JAM 17-10-2018: added one more input server node
-BNETINP:       1 1 1 1 1
-
-# JAM18 - following is old default setup for the control button selection:
-#BNETBLD:      3 3 3 0
-
-## below enough ltsm connections? default with new servers
-BNETBLD:       3 3 3 3 3
-
-# JAM - do not modify this anymore, please use control button "Restart BNET 1 Builder" instead
-#BNETBLD:      1 0 0 0
-##########################
-
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-#EB_LIST:       1  1  1  1  1  1  1  1  0  0  0  0  0  0  0  0
-EB_LIST:       1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  0
-
-# Switch to DABC mode (on=1/off=0) for 16 EB processes
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-#DABC:          0  0  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-#DABC:         0  0  0  0  1  1  1  1  0  0  0  0  0  0  0  0
-#DABC:         0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
-#DABC:         0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-DABC:          1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  0
-#DABC:         0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-
-# Switch multiple disk ctrl via daq_disks (1=on,0=off)
-MULTIDISK: 1
-WRITE_TO_DISK: 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-#WRITE_TO_DISK: 1  1  1  1  0  1  1  1  1  0  1  1  1  1  0  0
-
-
-# Log the output of EB processes (log=1/dev-null=0) (at lxhadeb0j:/tmp/log_eb_i.txt and log_nm_i.txt)
-EB_LOG:        1  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
-NM_LOG:        0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-
-# switch on extended evtbuild debug output for logfile (at lxhadeb0j:/tmp/log_eb_i.txt)
-EB_DEBUG:      0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-
-
-
-# Switch (on=1/off=0) EPICS Control of EB processes
-# IOC Master is by default the IOC for EB process 1
-EPICS_CTRL:    1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  0
-# RFIO switch (on=1/off=0) for 16 EB processes
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-#RFIO:          1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-RFIO:          0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-
-# RFIO default options for all EB processes
-RFIO_PATH:           /hadesnov14raw/prod01
-RFIO_pcOptions:       wb
-#### if LUSTRE fails, switch the following RFIO_iCopyMode to 0: #####
-# 0 no copy to Lustre/hera
-# 1 copy to Lustre after the file is in the write cash, 
-# 2 copy in parallel to Lustre
-RFIO_iCopyMode:       1 
-RFIO_pcCopyPath:      /hera/hades/raw/nov14/default
-RFIO_iCopyFraction:   1
-# Maxfile 100, pathconvention 1 to create new subfolder on lustre after 100 files
-RFIO_iMaxFile:        0
-RFIO_iPathConvention: 0
-
-### JAM May2017 something new:
-# LTSM - RFIO successor for tape storage interface
-# LTSM switch (on=1/off=0) for 16 EB processes
-# note: for bnet mode, only flag of EB15 is used!
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-LTSM:          1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-#LTSM:          0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-#LTSM:          0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-
-
-# LTSM default options for all EB processes
-
-#LTSM_PATH:      /lustre/hades/raw/jun19test/default/tsm
-LTSM_PATH:      /lustre/hades/raw/jun21test
-#LTSM_PATH:      /hebetest/hades/raw/feb21/
-#LTSM_Server:  lxltsm01-tsm-server
-LTSM_Server: lxltsm01
-
-#LTSM_Node:    LTSM_TEST01
-#LTSM_Passwd:  LTSM_TEST01
-
-#LTSM_Node:    hadestest
-#LTSM_Passwd:    hadestest
-
-## PRODUCTION SETUP HERE
-LTSM_Node:     hades
-LTSM_Passwd:    wDhgcvFF7
-LTSM_Filesystem:       /lustre
-
-# following is for first FSD test setup JAM 4-2020:
-# LTSM_Node:   hadestest
-# LTSM_Passwd:    hadestest
-# LTSM_Filesystem:     /lustre
-
-
-LTSM_USEFSD: 0
-# we need at least 5 entries here (number of eventbuilder servers)
-#LTSM_FSD_SERVERS: lxfsd01 lxfsd02-eth lxfsd03 lxfsd01
-#LTSM_FSD_SERVERS: lxfsd04-eth lxfsd07-eth lxfsd04-eth lxfsd07-eth lxfsd04-eth
-# setup tests january 2021:
-LTSM_FSD_SERVERS: lxfsd06-eth lxfsd02-eth lxfsd03-eth lxfsd07-eth lxfsd05-eth
-#LTSM_FSD_SERVERS: lxfsd01-eth lxfsd02 lxfsd03-eth lxfsd01-eth lxfsd02
-#LTSM_FSD_SERVERS: lxfsd01-eth lxfsd03-eth lxfsd01-eth lxfsd03-eth lxfsd01-eth
-LTSM_FSD_PORT: 7625 7625 7625 7625 7625
-
-
-
-
-########## end LTSM
-
-
-
-
-# Configure EBs based on info in DB files (1=yes,0=no)
-CONF_FROM_DB: 1
-
-# Table with active data sources
-
-DATA_SOURCES: ../main/data_sources.db
-GBE_CONF: ../hub/register_configgbe_ip.db
-CTS_CONF: ../cts/register_cts.db
-
-
-#
-# The following is the individual configuration of EBs
-#
-#----------------------------------------------
-[EB_PROC_1]
-
-OUTDIR: /data01/data/
-MULTIDISK: 1
-#RESDOWNSCALE: 20
-#RESNUMEVENTS: 2000
-#RESPATH: /data22/data/res 
-#RESPATH: /data.local1/data/res
-#RESSIZELIMIT: 80
-
-#RFIO_pcFile:
-#RFIO_pcOptions:
-
-#----------------------------------------------
-[EB_PROC_2]
-
-ONLINESERVER: on
-
-OUTDIR: /data01/data/
-
-RESDOWNSCALE: 20
-RESNUMEVENTS: 2000
-RESPATH: /data.local1/data/res
-RESSIZELIMIT: 80
-
-#RFIO_pcFile:
-#RFIO_pcOptions:
-
-#MULTIDISK: 18
-
-#----------------------------------------------
-[EB_PROC_3]
-
-OUTDIR: /data10/data/
-
-#----------------------------------------------
-[EB_PROC_4]
-
-OUTDIR: /data01/data/
-MULTIDISK: 5
-
-
-#----------------------------------------------
-[EB_PROC_5]
-
-OUTDIR: /data01/data/
-MULTIDISK: 2
-#----------------------------------------------
-[EB_PROC_6]
-
-OUTDIR: /data11/data/
-
-#----------------------------------------------
-[EB_PROC_7]
-
-OUTDIR: /data11/data/
-
-#----------------------------------------------
-[EB_PROC_8]
-OUTDIR: /data11/data/
-
-#----------------------------------------------
-[EB_PROC_9]
-
-OUTDIR: /data03/data/
-MULTIDISK: 3
-#----------------------------------------------
-[EB_PROC_10]
-
-OUTDIR: /data.local1/data
-
-#----------------------------------------------
-[EB_PROC_11]
-
-OUTDIR: /data12/data/
-
-#----------------------------------------------
-[EB_PROC_12]
-
-OUTDIR: /data12/data/
-
-#----------------------------------------------
-[EB_PROC_13]
-
-OUTDIR: /data04/data/
-MULTIDISK: 4
-#----------------------------------------------
-[EB_PROC_14]
-
-OUTDIR: /data13/data/
-
-#----------------------------------------------
-[EB_PROC_15]
-
-OUTDIR: /data.local1/data
-
-#----------------------------------------------
-[EB_PROC_16]
-
-OUTDIR: /data.local1/data
diff --git a/evtbuild/eb_bnet_ltsm.conf b/evtbuild/eb_bnet_ltsm.conf
deleted file mode 100644 (file)
index 614d902..0000000
+++ /dev/null
@@ -1,284 +0,0 @@
-#
-# #Install: Run CPAN and install
-# perl -MCPAN -e shell
-#
-# #At CPAN shell prompt
-# install Config::Std
-
-#----------------------------------------------
-[Main]
-
-PORT_BASE:      11000
-WMARK:          60000
-
-EB_IP:          192.168.100.12
-EB_OUTDIR:      /data/lxhadesdaq/tof_test
-
-# file/null
-EB_OUTDEV:      null
-
-EB_EXT:         te
-
-# file size in MBytes 
-EB_FSIZE:       1500
-
-EB_EVTID:       1   
-SHMEMNAME:      test
-
-QUEUESIZE:      4000000
-
-# enable online server: --online
-# disable online server:
-ONLINESERVER:   --online
-
-# buffer sizes for evtbuild and netmem (MB)
-BUF_SIZE_LOW:   8
-BUF_SIZE_MID:   16
-BUF_SIZE_HIGH:  32
-
-#----------------------------------------------
-[Parallel]
-
-# EB IPS NOT USED IF CONF_FROM_DB 
-
-EB_IP_1: 192.168.100.15
-EB_IP_2: 192.168.100.12
-EB_IP_3: 192.168.100.13
-EB_IP_4: 192.168.100.14
-EB_IP_5: 192.168.100.11
-
-# Number of EB processes per server NOT USED IF CONF_FROM_DB
-EB_NUM_1: 1
-EB_NUM_2: 1
-EB_NUM_3: 1
-EB_NUM_4: 1
-EB_NUM_5: 1
-
-BASE_PORT: 20100
-SHIFT_PORT: 100
-NUM_OF_SOURCES: 1
-
-QUEUESIZE: 32
-
-# JAM 12/2016-
-# the following list configures BNET for each EB SERVER node:
-# this will always imply DABC eventbuilder software.
-# BNETINP gives number of input processes per server node
-# BNETBLD gives maximum number of builder processes per node
-# set BNETINP to 0 for conventional EB setup
-# EB server     0 1 2 3
-#BNETINP:      0 0 0 0
-BNETINP:       1 1 1 1
-
-# JAM18 - following is default setup for the control button selection:
-#BNETBLD:      3 3 3 0
-
-## below not enough ltsm connections ?
-BNETBLD:       4 4 4 0
-
-# JAM - do not modify this anymore, please use control button "Restart BNET 1 Builder" instead
-#BNETBLD:      1 0 0 0
-##########################
-
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-#EB_LIST:       1  1  1  1  1  1  1  1  0  0  0  0  0  0  0  0
-EB_LIST:       1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  0
-
-# Switch to DABC mode (on=1/off=0) for 16 EB processes
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-#DABC:          0  0  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-#DABC:         0  0  0  0  1  1  1  1  0  0  0  0  0  0  0  0
-#DABC:         0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
-#DABC:         0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-DABC:          1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  0
-#DABC:         0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-
-# Switch multiple disk ctrl via daq_disks (1=on,0=off)
-MULTIDISK: 1
-WRITE_TO_DISK: 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-#WRITE_TO_DISK: 1  1  1  1  0  1  1  1  1  0  1  1  1  1  0  0
-
-
-# Log the output of EB processes (log=1/dev-null=0) (at lxhadeb0j:/tmp/log_eb_i.txt and log_nm_i.txt)
-EB_LOG:        1  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
-NM_LOG:        0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-
-# switch on extended evtbuild debug output for logfile (at lxhadeb0j:/tmp/log_eb_i.txt)
-EB_DEBUG:      0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-
-
-
-# Switch (on=1/off=0) EPICS Control of EB processes
-# IOC Master is by default the IOC for EB process 1
-EPICS_CTRL:    1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  0
-# RFIO switch (on=1/off=0) for 16 EB processes
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-#RFIO:          1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-RFIO:          0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-
-# RFIO default options for all EB processes
-RFIO_PATH:           /hadesnov14raw/prod01
-RFIO_pcOptions:       wb
-#### if LUSTRE fails, switch the following RFIO_iCopyMode to 0: #####
-# 0 no copy to Lustre/hera
-# 1 copy to Lustre after the file is in the write cash, 
-# 2 copy in parallel to Lustre
-RFIO_iCopyMode:       1 
-RFIO_pcCopyPath:      /hera/hades/raw/nov14/default
-RFIO_iCopyFraction:   1
-# Maxfile 100, pathconvention 1 to create new subfolder on lustre after 100 files
-RFIO_iMaxFile:        0
-RFIO_iPathConvention: 0
-
-### JAM May2017 something new:
-# LTSM - RFIO successor for tape storage interface
-# LTSM switch (on=1/off=0) for 16 EB processes
-# note: for bnet mode, only flag of EB15 is used!
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-LTSM:          1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-#LTSM:          0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-#LTSM:          0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-
-
-# LTSM default options for all EB processes
-
-LTSM_PATH:      /lustre/hebe/hades/raw/mar19/default/tsm
-#LTSM_Server:  lxltsm01-tsm-server
-LTSM_Server: lxltsm01
-
-#LTSM_Node:    LTSM_TEST01
-#LTSM_Passwd:  LTSM_TEST01
-
-#LTSM_Node:    hadestest
-#LTSM_Passwd:    hadestest
-LTSM_Node:     hades
-LTSM_Passwd:    wDhgcvFF7
-
-LTSM_Filesystem:       /lustre/hebe
-
-
-
-
-
-
-
-########## end LTSM
-
-
-
-
-# Configure EBs based on info in DB files (1=yes,0=no)
-CONF_FROM_DB: 1
-
-# Table with active data sources
-
-DATA_SOURCES: ../main/data_sources.db
-GBE_CONF: ../hub/register_configgbe_ip.db
-CTS_CONF: ../cts/register_cts.db
-
-
-#
-# The following is the individual configuration of EBs
-#
-#----------------------------------------------
-[EB_PROC_1]
-
-OUTDIR: /data01/data/
-MULTIDISK: 1
-#RESDOWNSCALE: 20
-#RESNUMEVENTS: 2000
-#RESPATH: /data22/data/res 
-#RESPATH: /data.local1/data/res
-#RESSIZELIMIT: 80
-
-#RFIO_pcFile:
-#RFIO_pcOptions:
-
-#----------------------------------------------
-[EB_PROC_2]
-
-ONLINESERVER: on
-
-OUTDIR: /data01/data/
-
-RESDOWNSCALE: 20
-RESNUMEVENTS: 2000
-RESPATH: /data.local1/data/res
-RESSIZELIMIT: 80
-
-#RFIO_pcFile:
-#RFIO_pcOptions:
-
-#MULTIDISK: 18
-
-#----------------------------------------------
-[EB_PROC_3]
-
-OUTDIR: /data10/data/
-
-#----------------------------------------------
-[EB_PROC_4]
-
-OUTDIR: /data01/data/
-MULTIDISK: 5
-
-
-#----------------------------------------------
-[EB_PROC_5]
-
-OUTDIR: /data01/data/
-MULTIDISK: 2
-#----------------------------------------------
-[EB_PROC_6]
-
-OUTDIR: /data11/data/
-
-#----------------------------------------------
-[EB_PROC_7]
-
-OUTDIR: /data11/data/
-
-#----------------------------------------------
-[EB_PROC_8]
-OUTDIR: /data11/data/
-
-#----------------------------------------------
-[EB_PROC_9]
-
-OUTDIR: /data03/data/
-MULTIDISK: 3
-#----------------------------------------------
-[EB_PROC_10]
-
-OUTDIR: /data.local1/data
-
-#----------------------------------------------
-[EB_PROC_11]
-
-OUTDIR: /data12/data/
-
-#----------------------------------------------
-[EB_PROC_12]
-
-OUTDIR: /data12/data/
-
-#----------------------------------------------
-[EB_PROC_13]
-
-OUTDIR: /data04/data/
-MULTIDISK: 4
-#----------------------------------------------
-[EB_PROC_14]
-
-OUTDIR: /data13/data/
-
-#----------------------------------------------
-[EB_PROC_15]
-
-OUTDIR: /data.local1/data
-
-#----------------------------------------------
-[EB_PROC_16]
-
-OUTDIR: /data.local1/data
diff --git a/evtbuild/eb_bnet_ltsm_newservers.conf b/evtbuild/eb_bnet_ltsm_newservers.conf
deleted file mode 100644 (file)
index 425c8f1..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-#
-# #Install: Run CPAN and install
-# perl -MCPAN -e shell
-#
-# #At CPAN shell prompt
-# install Config::Std
-
-#----------------------------------------------
-[Main]
-
-PORT_BASE:      11000
-WMARK:          60000
-
-EB_IP:          192.168.100.12
-EB_OUTDIR:      /data/lxhadesdaq/tof_test
-
-# file/null
-EB_OUTDEV:      null
-
-EB_EXT:         te
-
-# file size in MBytes 
-EB_FSIZE:       1500
-
-EB_EVTID:       1   
-SHMEMNAME:      test
-
-QUEUESIZE:      4000000
-
-# enable online server: --online
-# disable online server:
-ONLINESERVER:   --online
-
-# buffer sizes for evtbuild and netmem (MB)
-BUF_SIZE_LOW:   8
-BUF_SIZE_MID:   16
-BUF_SIZE_HIGH:  32
-
-#----------------------------------------------
-[Parallel]
-
-# EB IPS NOT USED IF CONF_FROM_DB 
-
-EB_IP_1: 192.168.100.15
-EB_IP_2: 192.168.100.12
-EB_IP_3: 192.168.100.13
-EB_IP_4: 192.168.100.14
-EB_IP_5: 192.168.100.11
-
-# Number of EB processes per server NOT USED IF CONF_FROM_DB
-EB_NUM_1: 1
-EB_NUM_2: 1
-EB_NUM_3: 1
-EB_NUM_4: 1
-EB_NUM_5: 1
-
-BASE_PORT: 20100
-SHIFT_PORT: 100
-NUM_OF_SOURCES: 1
-
-QUEUESIZE: 32
-
-# JAM 12/2016-
-# the following list configures BNET for each EB SERVER node:
-# this will always imply DABC eventbuilder software.
-# BNETINP gives number of input processes per server node
-# BNETBLD gives maximum number of builder processes per node
-# set BNETINP to 0 for conventional EB setup
-# EB server     0 1 2 3
-#BNETINP:      0 0 0 0 0
-# JAM 17-10-2018: added one more input server node
-BNETINP:       1 1 1 1 1
-
-# JAM18 - following is old default setup for the control button selection:
-#BNETBLD:      3 3 3 0
-
-## below enough ltsm connections? default with new servers
-BNETBLD:       3 3 3 3 
-
-# JAM - do not modify this anymore, please use control button "Restart BNET 1 Builder" instead
-#BNETBLD:      1 0 0 0
-##########################
-
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-#EB_LIST:       1  1  1  1  1  1  1  1  0  0  0  0  0  0  0  0
-EB_LIST:       1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  0
-
-# Switch to DABC mode (on=1/off=0) for 16 EB processes
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-#DABC:          0  0  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-#DABC:         0  0  0  0  1  1  1  1  0  0  0  0  0  0  0  0
-#DABC:         0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
-#DABC:         0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-DABC:          1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  0
-#DABC:         0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-
-# Switch multiple disk ctrl via daq_disks (1=on,0=off)
-MULTIDISK: 1
-WRITE_TO_DISK: 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-#WRITE_TO_DISK: 1  1  1  1  0  1  1  1  1  0  1  1  1  1  0  0
-
-
-# Log the output of EB processes (log=1/dev-null=0) (at lxhadeb0j:/tmp/log_eb_i.txt and log_nm_i.txt)
-EB_LOG:        1  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0
-NM_LOG:        0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-
-# switch on extended evtbuild debug output for logfile (at lxhadeb0j:/tmp/log_eb_i.txt)
-EB_DEBUG:      0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
-
-
-
-# Switch (on=1/off=0) EPICS Control of EB processes
-# IOC Master is by default the IOC for EB process 1
-EPICS_CTRL:    1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  0
-# RFIO switch (on=1/off=0) for 16 EB processes
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-#RFIO:          1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-RFIO:          0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-
-# RFIO default options for all EB processes
-RFIO_PATH:           /hadesnov14raw/prod01
-RFIO_pcOptions:       wb
-#### if LUSTRE fails, switch the following RFIO_iCopyMode to 0: #####
-# 0 no copy to Lustre/hera
-# 1 copy to Lustre after the file is in the write cash, 
-# 2 copy in parallel to Lustre
-RFIO_iCopyMode:       1 
-RFIO_pcCopyPath:      /hera/hades/raw/nov14/default
-RFIO_iCopyFraction:   1
-# Maxfile 100, pathconvention 1 to create new subfolder on lustre after 100 files
-RFIO_iMaxFile:        0
-RFIO_iPathConvention: 0
-
-### JAM May2017 something new:
-# LTSM - RFIO successor for tape storage interface
-# LTSM switch (on=1/off=0) for 16 EB processes
-# note: for bnet mode, only flag of EB15 is used!
-# EB Nr        0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-LTSM:          1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
-#LTSM:          0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-#LTSM:          0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
-
-
-# LTSM default options for all EB processes
-
-LTSM_PATH:      /lustre/hades/raw/jun19test/default/tsm
-#LTSM_Server:  lxltsm01-tsm-server
-LTSM_Server: lxltsm01
-
-#LTSM_Node:    LTSM_TEST01
-#LTSM_Passwd:  LTSM_TEST01
-
-#LTSM_Node:    hadestest
-#LTSM_Passwd:    hadestest
-LTSM_Node:     hades
-LTSM_Passwd:    wDhgcvFF7
-
-LTSM_Filesystem:       /lustre
-
-
-
-
-
-
-
-########## end LTSM
-
-
-
-
-# Configure EBs based on info in DB files (1=yes,0=no)
-CONF_FROM_DB: 1
-
-# Table with active data sources
-
-DATA_SOURCES: ../main/data_sources.db
-GBE_CONF: ../hub/register_configgbe_ip.db
-CTS_CONF: ../cts/register_cts.db
-
-
-#
-# The following is the individual configuration of EBs
-#
-#----------------------------------------------
-[EB_PROC_1]
-
-OUTDIR: /data01/data/
-MULTIDISK: 1
-#RESDOWNSCALE: 20
-#RESNUMEVENTS: 2000
-#RESPATH: /data22/data/res 
-#RESPATH: /data.local1/data/res
-#RESSIZELIMIT: 80
-
-#RFIO_pcFile:
-#RFIO_pcOptions:
-
-#----------------------------------------------
-[EB_PROC_2]
-
-ONLINESERVER: on
-
-OUTDIR: /data01/data/
-
-RESDOWNSCALE: 20
-RESNUMEVENTS: 2000
-RESPATH: /data.local1/data/res
-RESSIZELIMIT: 80
-
-#RFIO_pcFile:
-#RFIO_pcOptions:
-
-#MULTIDISK: 18
-
-#----------------------------------------------
-[EB_PROC_3]
-
-OUTDIR: /data10/data/
-
-#----------------------------------------------
-[EB_PROC_4]
-
-OUTDIR: /data01/data/
-MULTIDISK: 5
-
-
-#----------------------------------------------
-[EB_PROC_5]
-
-OUTDIR: /data01/data/
-MULTIDISK: 2
-#----------------------------------------------
-[EB_PROC_6]
-
-OUTDIR: /data11/data/
-
-#----------------------------------------------
-[EB_PROC_7]
-
-OUTDIR: /data11/data/
-
-#----------------------------------------------
-[EB_PROC_8]
-OUTDIR: /data11/data/
-
-#----------------------------------------------
-[EB_PROC_9]
-
-OUTDIR: /data03/data/
-MULTIDISK: 3
-#----------------------------------------------
-[EB_PROC_10]
-
-OUTDIR: /data.local1/data
-
-#----------------------------------------------
-[EB_PROC_11]
-
-OUTDIR: /data12/data/
-
-#----------------------------------------------
-[EB_PROC_12]
-
-OUTDIR: /data12/data/
-
-#----------------------------------------------
-[EB_PROC_13]
-
-OUTDIR: /data04/data/
-MULTIDISK: 4
-#----------------------------------------------
-[EB_PROC_14]
-
-OUTDIR: /data13/data/
-
-#----------------------------------------------
-[EB_PROC_15]
-
-OUTDIR: /data.local1/data
-
-#----------------------------------------------
-[EB_PROC_16]
-
-OUTDIR: /data.local1/data
diff --git a/evtbuild/generate_ebhub_config.pl b/evtbuild/generate_ebhub_config.pl
new file mode 100755 (executable)
index 0000000..0df5367
--- /dev/null
@@ -0,0 +1,125 @@
+#!/usr/bin/perl -w
+
+# generate hades eventbuilder hub configuration from setup files
+# 27-01-2023 JAM
+
+use English;
+use strict;
+use Getopt::Long;
+use FileHandle;
+use File::Path;
+use File::Basename;
+#use String::Scanf;
+
+my $daqpath = "/home/hadaq/trbsoft/daq/";
+#my $daqpath = "/home/hadaq/joern/ebdevel/";
+my $resultfile =$daqpath . "hub/register_configgbe_ip_generated.db";
+my $begin_config_file = $daqpath . "evtbuild/configgbe_ip_begin.db";
+my $host_config_file = $daqpath .  "evtbuild/configgbe_ip_hosts.db";
+my $datasources_file = $daqpath . "evtbuild/configgbe_ip_datasources.db";
+#my $datasources_file = $daqpath . "main/data_sources.db";
+
+my %hexips;
+my %himacs;
+my %lomacs;
+
+my @addresses;
+my %names;
+my %hosts;
+my %flags;
+
+
+open( OUTFILE, '>', $resultfile ) or die "Could not open $resultfile: $! \n";
+
+print "Generating EB and hub config file $resultfile ...\n";
+
+
+
+# first provide output file with standard header:
+ my ($sec, $min, $hr, $day, $mon, $year) = localtime;
+my $timestamp= sprintf("%02d.%02d.%04d at %02d:%02d:%02d",$day, $mon + 1, 1900 + $year, $hr, $min, $sec);
+
+
+print OUTFILE "###############################################################################\n";
+print OUTFILE "# Config File for HADES hub and eventbuilder setup \n";
+print OUTFILE "# This file was automatically generated by generate_ebhub_config.pl\n";
+print OUTFILE "# Creation time: $timestamp\n";
+print OUTFILE "###############################################################################\n";
+
+
+# now cat header into it:
+
+open( IFILE, '<', $begin_config_file ) or die "Could not open $begin_config_file: $! \n";
+my @hubconfigs= <IFILE>;
+foreach my $line (@hubconfigs) {
+    print OUTFILE $line;
+}
+close(IFILE) || die "Couldn't close file $begin_config_file properly";
+
+
+
+# evaluate information on existing EB hosts:
+open( HIFILE, '<', $host_config_file ) or die "Could not open $host_config_file: $! \n";
+my @ebconfigs= <HIFILE>;
+foreach my $line (@ebconfigs) {
+#- Remove all comments and whitespace:
+  next if ($line =~ /^\s*($|#)/);
+   my @larray=split(/\s+/,$line);
+   my $hostname=$larray[0];
+   $hexips{$hostname} = $larray[1];
+   $lomacs{$hostname} = $larray[2];
+   $himacs{$hostname} = $larray[3];
+}
+
+close(HIFILE) || die "Couldn't close file $host_config_file properly";
+
+# now extract host information and EB flags:
+open( SIFILE, '<', $datasources_file ) or die "Could not open $datasources_file: $! \n";
+my @sources= <SIFILE>;
+foreach my $line (@sources) {
+#- Remove all comments and whitespace:
+    next if ($line =~ /^\s*($|#)/);
+    my @sarray=split(/\s+/,$line);
+    
+    my $hub=$sarray[0];
+    push(@addresses, $hub);    
+    $names{$hub} = $sarray[2];
+    $hosts{$hub} = $sarray[4];
+    $flags{$hub} = $sarray[5];
+ }
+
+close(SIFILE) || die "Couldn't close file $datasources_file properly";
+
+
+# now we have everthing in memory. finally, loop over it and write output file:
+
+# first loop for ips and udp ports:
+
+my $port=50768;
+
+foreach my $hub(@addresses)
+{
+#my $srcip=$hexips{$hosts{$hub}}; # src and dest ip the same here?
+my $srcip="0xc0a86490"; # try any dummy 
+# or use real ip for each hub in setup table?
+my $hexport=sprintf("0x%x", $port);
+print OUTFILE " $hub 0 $hexport 0xdead$hub $srcip $hexport $hexips{$hosts{$hub}} $flags{$hub} # $names{$hub} - $hosts{$hub} \n";
+$port++;
+}
+
+# second loop for macs definitions
+print OUTFILE "\n\n#                    Dest MAC    Dest MAC       Dest IP       Src MAC    Packet Size \n";
+print OUTFILE "# Hub    #  Type  #     C0     #     C1     #     C2     #      C5     #     C8     # \n";
+print OUTFILE "##################################################################################### \n";
+
+
+foreach my $hub(@addresses)
+{
+my $srcip=$hexips{$hosts{$hub}}; # src and dest ip the same here?
+# or use real ip for each hub in setup table?
+print OUTFILE " $hub 100  $lomacs{$hosts{$hub}}  $himacs{$hosts{$hub}} $hexips{$hosts{$hub}} 0x0230 0x0578 # $names{$hub} - $hosts{$hub}\n";
+}
+
+
+close(OUTFILE) || die "Couldn't close file $resultfile properly";
+print "\tdone.\n";
index 0b94122df009956cb9daf1eed5e978abca95b4d8..a4447bf36d388ff8dbfdff4496c7d1d3d0286325 100755 (executable)
@@ -342,12 +342,20 @@ sub startBnet()   {
   my $cdworkdir = "cd /home/hadaq/oper;";
 
   # here the default installation. always the most recent... 
-  my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.head; ";
-  my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.head ";
-  #   my $cmd_dabc = "/usr/bin/gdb  -x /home/hadaq/soft/dabc/head/base/run/gdbcmd.txt --args /home/hadaq/soft/dabc/bin/dabc_exe.head ";
-  my $conf_bnet_inp = " BnetInputHades.head.xml";
-  #my $conf_bnet_bld = " BnetBuilderHades.head.xml";
-  my $conf_bnet_bld = " BnetBuilderHadesFSD.head.xml";
+  # new 11-2022: installation checked out from git JAM
+  my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.master; ";
+  my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.master ";
+  my $conf_bnet_inp = " BnetInputHades.master.xml";
+  my $conf_bnet_bld = " BnetBuilderHadesFSD.master.xml";
+    
+  
+  # below previous default installation on svn checkout
+#   my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.head; ";
+#   my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.head ";
+#   #   my $cmd_dabc = "/usr/bin/gdb  -x /home/hadaq/soft/dabc/head/base/run/gdbcmd.txt --args /home/hadaq/soft/dabc/bin/dabc_exe.head ";
+#   my $conf_bnet_inp = " BnetInputHades.head.xml";
+#   #my $conf_bnet_bld = " BnetBuilderHades.head.xml";
+#   my $conf_bnet_bld = " BnetBuilderHadesFSD.head.xml";
 
   # JAM2020- enable this to switch different dabc version: 
   #    my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.feb22; ";
diff --git a/evtbuild/start_eb_gbe_newservers.pl b/evtbuild/start_eb_gbe_newservers.pl
deleted file mode 100755 (executable)
index cda07f5..0000000
+++ /dev/null
@@ -1,2124 +0,0 @@
-#!/usr/bin/perl -w
-
-use English;
-use strict;
-use Getopt::Long;
-use Data::Dumper;
-use Config::Std;
-use FileHandle;
-use List::MoreUtils qw(any apply first_index);
-use File::Basename;
-use Cwd;
-
-#- Copy all the arguments because
-#  later on the @ARGV becomes empty
-my @arg_list = @ARGV;
-
-#- the command line option flags
-my $opt_help    = 0;
-my $opt_ebconf  = "/home/hadaq/trbsoft/hadesdaq/evtbuild/eb.conf";
-my $opt_ioc = "";
-my $opt_test = 0;
-my $opt_verb = 0;
-my $opt_eb = "";
-my @opt_ebrange = ();
-my $opt_rfio = 'undef';
-my $opt_disk = 'undef';
-my $opt_online = 'undef';
-my $opt_bnet = 3;
-my $opt_prefix;
-
-GetOptions ('h|help'      => \$opt_help,
-            'c|conf=s'    => \$opt_ebconf,
-            'e|eb=s'      => \$opt_eb,
-            'i|ioc=s'     => \$opt_ioc,
-            't|test'      => \$opt_test,
-            'n|nr=s'      => \@opt_ebrange,
-            'd|disk=s'    => \$opt_disk,
-            'r|rfio=s'    => \$opt_rfio,
-            'p|prefix=s'  => \$opt_prefix,
-            'o|online=s'  => \$opt_online,
-            'b|bnet=s'    => \$opt_bnet,            
-            'v|verb'      => \$opt_verb);
-
-if( $opt_help ) {
-    &help();
-    exit(0);
-}
-
-#- List of EBs provided via command line options
-my $active_EBs_aref = &setArgs();
-
-#- Hash with status of CPU cores of EBs (used for 'taskset')
-my %EB_CPU_status;
-my $EB_CPU_status_href = \%EB_CPU_status;
-&init_CPU_status($EB_CPU_status_href);
-
-my $expect_ioc_script = "/tmp/ioc_exit.exp";
-my $log_path          = "/tmp/log"; 
-my %temp_args;
-my $temp_args_href = \%temp_args;
-read_config $opt_ebconf => %$temp_args_href;
-#rint Dumper $temp_args_href;
-#exit;
-
-
-my @bnetservers = ("192.168.100.8","192.168.100.9","192.168.100.10","192.168.105.11", "192.168.105.12");
-
-#my @bnetservers = ("192.168.100.10","192.168.100.9","192.168.100.8","192.168.105.11", "192.168.105.12");
-
-
-
-# my %IP_GSI_lookup = (
-#     '192.168.100.15'   => '140.181.66.160',
-#     '192.168.100.12'   => '140.181.76.94',
-#     '192.168.100.13'   => '140.181.91.154',
-#     '192.168.100.14'   => '140.181.88.20',
-#     '192.168.100.8'    => '140.181.80.62',
-#     '192.168.100.9'    => '140.181.80.64',
-#     '192.168.100.10'   => '140.181.80.68',
-#     '192.168.105.11'   => '140.181.83.135',
-#     '192.168.105.12'   => '140.181.83.168',
-#     '192.168.105.13'   => '140.181.83.176'
-#   );
-  
-  
- my %IP_GSI_lookup = (
-    '192.168.100.15'   => 'lxhadeb05',
-    '192.168.100.12'   => 'lxhadeb02',
-    '192.168.100.13'   => 'lxhadeb03',
-    '192.168.100.14'   => 'lxhadeb04',
-    '192.168.100.8'    => 'lxhadeb08',
-    '192.168.100.9'    => 'lxhadeb09',
-    '192.168.100.10'   => 'lxhadeb10',
-    '192.168.105.11'   => 'lxhadeb11',
-    '192.168.105.12'   => 'lxhadeb12',
-    '192.168.105.13'   => 'lxhadeb13'
-  );
-   
-  
-my $IP_GSI_href = \%IP_GSI_lookup;
-
-
-my $numOfEBProcs = 0;
-my %EB_Args;
-my $EB_Args_href = \%EB_Args;
-
-#my @EB_IP_list;
-
-
-
-&getEBArgs( $EB_Args_href );
-
-if($opt_ioc eq "start"){
-    &killIOC();
-    &startIOC();
-}
-elsif($opt_ioc eq "stop"){
-    &killIOC();
-}
-elsif($opt_eb eq "start"){
-    &writeArgs2file();
-    &startEvtBuilders();
-}
-elsif($opt_eb eq "stop"){
-    &stopEvtBuilders();
-}
-elsif($opt_eb eq "restart"){
-    &stopEvtBuilders();
-    sleep 1;
-    &writeArgs2file();
-    &startEvtBuilders();
-}
-
-exit(0);
-
-################### END OF MAIN ####################
-
-sub help()
-{
-    print "\n";
-    print << 'EOF';
-start_eb_gbe.pl
-
-   This script starts parallel Event Building processes.
-   The script also starts IOC processes for the run control.
-
-Usage:
-
-   Command line:  start_eb_gbe.pl 
-   [-h|--help]                     : Show this help.
-   [-c|--conf <path/name>]         : Path to the config file (default: ../evtbuild/eb.conf).
-   [-e|--eb <start|stop|restart>]  : Start or stop Event Builders (default: start).
-   [-i|--ioc <start|stop>]         : Start or stop IOCs (default: start).
-   [-n|--nr <rangeOfEBs>]          : Range of numbers of Event Bulders to be started.
-   [-d|--disk <on|off>]            : Switch writing to disk on|off.
-   [-r|--rfio <on|off>]            : Switch writing to tape on|off.
-   [-p|--prefix <prefix>]          : Prefix of hld file.
-   [-o|--online <on|off>]          : Switch RPC server on|off.
-   [-b|--bnet <on|off>]            : Specify number of bnet builder nodes(default: 3).   
-   [-t|--test]                     : Test without execution.
-   [-v|--verb]                     : More verbouse.
-
-Examples:
-
-   Start 6 EBs with the numbers 1,2,3,5,7 and prefix 'md':
-   start_eb_gbe.pl -e start -n 1-3 -n 5 -n 7 -p md
-
-   Start EBs and enable writing to disks but disable writing to tape for all EBs:
-   start_eb_gbe.pl -e start --disk on --rfio off
-
-EOF
-}
-
-sub init_CPU_status()
-{
-
-
-# JAM 17-oct-2018 - for BNET this cpu reservation is deprecated TODO: remove it
-    my ($EB_CPU_status_href) = @_;
-
-    # CPU affinity with 'taskset'
-    #
-    # CPU dec     bin  hex
-    #     0         1    1
-    #     1        10    2 
-    #     2       100    4
-    #     3      1000    8
-    #     4     10000   10 
-
-    #cores 0/1 reserved for system 02-05
-    #cores 2/3 reserved for interrupts on 02-05
-
-#lxhadeb01 is gone    
-#     foreach my $core (0..7){
-#         if($core == 1){
-#             $EB_CPU_status_href->{'192.168.100.11'}->{$core} = "res"; #reserved
-#         }
-#         else{
-#             $EB_CPU_status_href->{'192.168.100.11'}->{$core} = "free";
-#         }
-#     }
-
-#JAM adjust this to actual affinities for eth0 settings TODO
-# eth0 interrupts are above core 8 now
-#  
-#     
-#    foreach my $core (0..11){
-#         if(($core < 2) || ($core> 8 ) ){
-#             $EB_CPU_status_href->{'192.168.100.12'}->{$core} = "res"; #reserved
-#             $EB_CPU_status_href->{'192.168.100.13'}->{$core} = "res"; #reserved
-#             $EB_CPU_status_href->{'192.168.100.14'}->{$core} = "res"; #reserved
-#         }
-#         else{
-#             $EB_CPU_status_href->{'192.168.100.12'}->{$core} = "free";
-#             $EB_CPU_status_href->{'192.168.100.13'}->{$core} = "free";
-#             $EB_CPU_status_href->{'192.168.100.14'}->{$core} = "free";
-#         }
-#     }
-#        
-## after upgrade to debian 7: ethernet reserved cores are below 6
-  foreach my $core (0..11){
-        if(($core < 6) ){
-            $EB_CPU_status_href->{'192.168.100.12'}->{$core} = "res"; #reserved
-            $EB_CPU_status_href->{'192.168.100.13'}->{$core} = "res"; #reserved
-            $EB_CPU_status_href->{'192.168.100.14'}->{$core} = "res"; #reserved
-        }
-        else{
-            $EB_CPU_status_href->{'192.168.100.12'}->{$core} = "free";
-            $EB_CPU_status_href->{'192.168.100.13'}->{$core} = "free";
-            $EB_CPU_status_href->{'192.168.100.14'}->{$core} = "free";
-            
-        }
-    }
-    
-# eth0 ir is set above core 11   
-    foreach my $core (0..23){
-        if( ($core < 2) ||( $core > 11) ){
-            $EB_CPU_status_href->{'192.168.100.15'}->{$core} = "res"; #reserved
-        }
-        else{
-            $EB_CPU_status_href->{'192.168.100.15'}->{$core} = "free";
-        }
-    }
-    
-    # add cores for new EB servers JAM2018
-   foreach my $core (0..63){
-        if( ($core < 2) ||( $core > 60) ){
-            $EB_CPU_status_href->{'192.168.100.8'}->{$core} = "res"; #reserved
-           $EB_CPU_status_href->{'192.168.100.9'}->{$core} = "res"; #reserved
-           $EB_CPU_status_href->{'192.168.100.10'}->{$core} = "res"; #reserved
-           $EB_CPU_status_href->{'192.168.105.11'}->{$core} = "res"; #reserved
-           $EB_CPU_status_href->{'192.168.105.12'}->{$core} = "res"; #reserved
-            }
-        else{
-            $EB_CPU_status_href->{'192.168.100.8'}->{$core} = "free";
-           $EB_CPU_status_href->{'192.168.100.9'}->{$core} = "free";
-           $EB_CPU_status_href->{'192.168.100.10'}->{$core} = "free";
-           $EB_CPU_status_href->{'192.168.105.11'}->{$core} = "free";
-           $EB_CPU_status_href->{'192.168.105.12'}->{$core} = "free";
-           
-        }
-    }  
- # alternative setup: specifiy cpu bitmasks for different roles:
-    
-    $EB_CPU_status_href->{'192.168.100.15'}->{'input'} = "2-23";
-    $EB_CPU_status_href->{'192.168.100.15'}->{'build'} = "2-23";
-    
-    # JAM12-2018: reserve lower 32 cpus for network interrupts
-    $EB_CPU_status_href->{'192.168.100.8'}->{'input'} = "32-47";
-    $EB_CPU_status_href->{'192.168.100.8'}->{'build'} = "48-63";
-    $EB_CPU_status_href->{'192.168.100.9'}->{'input'} = "32-47";
-    $EB_CPU_status_href->{'192.168.100.9'}->{'build'} = "48-63";
-    $EB_CPU_status_href->{'192.168.100.10'}->{'input'} = "32-47";
-    $EB_CPU_status_href->{'192.168.100.10'}->{'build'} = "48-63";
-    $EB_CPU_status_href->{'192.168.105.11'}->{'input'} = "32-47";
-    $EB_CPU_status_href->{'192.168.105.11'}->{'build'} = "48-63";
-    $EB_CPU_status_href->{'192.168.105.12'}->{'input'} = "32-47";
-    $EB_CPU_status_href->{'192.168.105.12'}->{'build'} = "48-63";
-    
-}
-
-
-sub getCoreNr()
-{
-    #my ($ip) = @_;
-    my ($ip, $role) = @_;
-    my $core_nr;
-    if(defined $role)
-    {
-    
-       $core_nr = $EB_CPU_status_href->{$ip}->{$role}
-    }
-    else
-    {
- ################### begin old       
-
-    foreach my $eb_ip (sort keys %$EB_CPU_status_href){
-        next unless($ip eq $eb_ip);
-            
-        foreach my $core ( sort {$a <=> $b} keys %{$EB_CPU_status_href->{$eb_ip}} ){
-            my $core_status = $EB_CPU_status_href->{$eb_ip}->{$core};
-            
-            next unless(lc($core_status) eq "free");
-
-            $core_nr = $core;
-            $EB_CPU_status_href->{$eb_ip}->{$core} = "busy";
-            last;
-        }
-    }
-
-    #- If no free cores left - take reserved cores
-    unless( defined $core_nr ){
-        foreach my $eb_ip (sort keys %$EB_CPU_status_href){
-            next unless($ip eq $eb_ip);
-            
-            foreach my $core ( sort {$a <=> $b} keys %{$EB_CPU_status_href->{$eb_ip}} ){
-                my $core_status = $EB_CPU_status_href->{$eb_ip}->{$core};
-                
-                if(lc($core_status) eq "res"){
-                    $core_nr = $core;
-                    $EB_CPU_status_href->{$eb_ip}->{$core} = "busy";
-                    last;
-                }
-            }
-        }
-    }
-    
-################### end old    
-}
-    unless( defined $core_nr ){
-        print "No free cores left on CPU $ip. Exit.\n";
-        exit(0);
-    }
-
-    print "found core numbers $core_nr for node $ip, role $role\n";  
-    return $core_nr;
-}
-
-
-
-
-sub setArgs()
-{
-    my @active_EBs;
-
-    if(@opt_ebrange){
-        foreach my $range (@opt_ebrange){
-            if($range =~ /(\d+)-(\d+)/){
-                my $max = $1;
-                my $min = $2;
-                
-                foreach my $eb ($max..$min){
-                    #- 1 must be subtracted to match
-                    #  EB numbering in the register_configgbe_ip.db
-                    #  which starts from zero
-                    &checkEB_nr($eb);
-                    push(@active_EBs, $eb-1);
-                }
-            }
-            elsif($range =~ /(\d+)/){
-                &checkEB_nr($1);
-                push(@active_EBs, $1-1);
-            }
-        }
-    }
-
-    return \@active_EBs;
-}
-
-sub checkEB_nr()
-{
-    my ($eb_nr) = @_;
-
-    if( $eb_nr < 1 || $eb_nr > 16 ){
-        print "ERROR: EB number should be in the range 1-16. Exit.";
-        exit(0);
-    }
-}
-
-sub getEBArgs()
-{
-    my ($href) = @_;
-
-    my $prefix = $temp_args_href->{'Main'}->{'EB_EXT'};
-    $prefix = $opt_prefix if( defined $opt_prefix );
-    my $filesize = $temp_args_href->{'Main'}->{'EB_FSIZE'};
-
-    my $base_port  = $temp_args_href->{'Parallel'}->{'BASE_PORT'};
-    my $shift_port = $temp_args_href->{'Parallel'}->{'SHIFT_PORT'};
-    my $source_num = $temp_args_href->{'Parallel'}->{'NUM_OF_SOURCES'};
-    my $queuesize  = $temp_args_href->{'Parallel'}->{'QUEUESIZE'};
-
-    my $multidisk  = $temp_args_href->{'Parallel'}->{'MULTIDISK'};
-
-    #- Number of EB process
-    my $ebproc = 0;
-
-    #- List of BEs
-    my $listOfEBs = $temp_args_href->{'Parallel'}->{'EB_LIST'};
-    my @eb_list = split(/\s+/, $listOfEBs);
-
-    #- DABC mode selection
-    my $listOfDABC = $temp_args_href->{'Parallel'}->{'DABC'};
-    my @dabc_list = split(/\s+/, $listOfDABC);
-    
-    
-    # BNET setup:
-    my $listOfBnetInputs = $temp_args_href->{'Parallel'}->{'BNETINP'};
-    my @bnet_in_list = split(/\s+/, $listOfBnetInputs);
-    
-    my $listOfBnetBuilders = $temp_args_href->{'Parallel'}->{'BNETBLD'};
-    my @bnet_bld_list = split(/\s+/, $listOfBnetBuilders);
-    #print Dumper @bnet_bld_list;
-     
-
-    #- Default RFIO settings
-    my $rfio               = $temp_args_href->{'Parallel'}->{'RFIO'};
-    my $rfio_path          = $temp_args_href->{'Parallel'}->{'RFIO_PATH'};
-    my $rfio_pcOptions     = $temp_args_href->{'Parallel'}->{'RFIO_pcOptions'};
-    my $rfio_iCopyMode     = $temp_args_href->{'Parallel'}->{'RFIO_iCopyMode'};
-    my $rfio_pcCopyPath    = $temp_args_href->{'Parallel'}->{'RFIO_pcCopyPath'};
-    my $rfio_iCopyFrac     = $temp_args_href->{'Parallel'}->{'RFIO_iCopyFraction'};
-    my $rfio_iMaxFile      = $temp_args_href->{'Parallel'}->{'RFIO_iMaxFile'};
-    my $rfio_iPathConv     = $temp_args_href->{'Parallel'}->{'RFIO_iPathConvention'};
-    
-    my @rfio_list = split(/\s+/, $rfio);
-    
-    
-    
-    #- LTSM settings
-    my $listOfLTSM = $temp_args_href->{'Parallel'}->{'LTSM'};
-    my @ltsm_list = split(/\s+/, $listOfLTSM);
-    
-    my $ltsm_path          = $temp_args_href->{'Parallel'}->{'LTSM_PATH'};
-    my $ltsm_server        = $temp_args_href->{'Parallel'}->{'LTSM_Server'};
-    my $ltsm_node          = $temp_args_href->{'Parallel'}->{'LTSM_Node'};
-    my $ltsm_passwd        = $temp_args_href->{'Parallel'}->{'LTSM_Passwd'};
-    my $ltsm_filesys       = $temp_args_href->{'Parallel'}->{'LTSM_Filesystem'};
-    
-    
-    
-    
-    #- EPICS Controled 
-    my $epics_ctrl = $temp_args_href->{'Parallel'}->{'EPICS_CTRL'};
-
-    my @epics_list = split(/\s+/, $epics_ctrl);
-
-     #- Logging the output of EBs
-    my $eb_log     = $temp_args_href->{'Parallel'}->{'EB_LOG'};
-    my $eb_debug     = $temp_args_href->{'Parallel'}->{'EB_DEBUG'};
-    my $nm_log     = $temp_args_href->{'Parallel'}->{'NM_LOG'};
-    my @eblog_list =  split(/\s+/, $eb_log);
-    my @ebdbg_list =  split(/\s+/, $eb_debug);
-    my @nmlog_list =  split(/\s+/, $nm_log);
-
-    
-    #- Write to disk
-    my $write2disk = $temp_args_href->{'Parallel'}->{'WRITE_TO_DISK'};
-    my @write2disk_list = split(/\s+/, $write2disk);
-
-    #--- Read GbE configuration
-    my %eb_ids_gbe_hash;
-    my $eb_ids_gbe_href = \%eb_ids_gbe_hash;
-
-    &getGbEconfig($eb_ids_gbe_href);
-
-    #--- Loop over all EB processes
-    #print Dumper $eb_ids_gbe_href;
-    #exit;
-    #foreach my $ebproc ( sort keys %{$eb_ids_gbe_href} ){
-    foreach my $ebproc ( 0 ..  $#bnetservers){
-    
-      #- If there was a list of EBs provided via command line options
-      #  go to the next $ebproc if the current $ebproc is not in this list.
-      #print "active EBs:\n";
-      #print Dumper $active_EBs_aref;
-
-        if(@$active_EBs_aref){
-            next unless( any {$_ == $ebproc} @$active_EBs_aref );  #from command line args
-        }
-        else{
-            next unless( $eb_list[$ebproc] );  #from eb.conf
-        }
-
-
-        #my $eb_ip = $eb_ids_gbe_href->{$ebproc}->{'IP'};
-
-        #- Save IP needed by other function to stop EBs.
-        #push(@EB_IP_list, $eb_ip) unless( any {$_ eq $eb_ip} @EB_IP_list );
-
-        #- Some checks on number of EB processes
-        die "Number of EB processes exceeds the number in RFIO setting! Exit." if($ebproc > $#rfio_list);
-        die "Number of EB processes exceeds the number in EPICS_CTRL setting! Exit." if($ebproc > $#epics_list);
-        
-        #- Here we can overwrite default rfio settings with individual settings per EB processes
-        my $procname = sprintf("EB_PROC_%d", 1+$ebproc);
-        # $rfio_iCopyMode     = $temp_args_href->{$procname}->{'RFIO_iCopyMode'};
-        
-        #$href->{$ebproc}->{'IP'}        = $eb_ip;
-        $href->{$ebproc}->{'IP'} = $bnetservers[$ebproc];
-        $href->{$ebproc}->{'EBNUM'}     = $ebproc+1;
-        $href->{$ebproc}->{'BASEPORT'}  = $base_port;
-        $href->{$ebproc}->{'PORT_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'port_list'};
-        $href->{$ebproc}->{'SOURCENUM'} = scalar @{$eb_ids_gbe_href->{$ebproc}->{'port_list'}};
-
-        # JAM2016: bnet requieres udp destination nodes in a list like the ports:
-        $href->{$ebproc}->{'IP_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'ip_list'};
-        
-        # JAM2018: bnet requieres calibration modes in a list like the ports:
-        $href->{$ebproc}->{'CALIB_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'calib_list'};
-        
-        # JAM2018: bnet requires hub addresses/subevents in a list like the ports:
-        $href->{$ebproc}->{'HUB_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'addr_list'};
-        
-        
-        $href->{$ebproc}->{'BUFSIZE_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'bufsize_list'};
-        $href->{$ebproc}->{'PREFIX'}    = $prefix;
-        $href->{$ebproc}->{'QUEUESIZE'} = $queuesize;
-        $href->{$ebproc}->{'MULTIDISK'} = $multidisk;
-        $href->{$ebproc}->{'FILESIZE'} = $filesize;
-
-        if( defined $temp_args_href->{$procname}->{'MULTIDISK'} ){
-            $href->{$ebproc}->{'MULTIDISK'} = $temp_args_href->{$procname}->{'MULTIDISK'};
-        }
-        elsif($multidisk){
-            $href->{$ebproc}->{'MULTIDISK'} = $href->{$ebproc}->{'EBNUM'};
-        }
-        else{
-            $href->{$ebproc}->{'MULTIDISK'} = $multidisk;
-        }
-
-        if( defined $temp_args_href->{$procname}->{'RESDOWNSCALE'} ){
-            $href->{$ebproc}->{'RESDOWNSCALE'} = $temp_args_href->{$procname}->{'RESDOWNSCALE'};
-            $href->{$ebproc}->{'RESNUMEVENTS'} = $temp_args_href->{$procname}->{'RESNUMEVENTS'};
-            $href->{$ebproc}->{'RESPATH'}      = $temp_args_href->{$procname}->{'RESPATH'};
-            $href->{$ebproc}->{'RESSIZELIMIT'} = $temp_args_href->{$procname}->{'RESSIZELIMIT'};
-        }
-
-        if( defined $temp_args_href->{$procname}->{'ONLINESERVER'} ){
-            if($opt_online eq "on"){
-                $href->{$ebproc}->{'ONLINESERVER'} = "on";
-            }
-            elsif($opt_online eq "off"){
-                $href->{$ebproc}->{'ONLINESERVER'} = "off";
-            }
-            else{
-                $href->{$ebproc}->{'ONLINESERVER'} = $temp_args_href->{$procname}->{'ONLINESERVER'};
-            }
-        }
-        else{
-            $href->{$ebproc}->{'ONLINESERVER'} = "off";
-        }
-
-        $href->{$ebproc}->{'RFIO'}             = $rfio_list[$ebproc] if(lc($opt_rfio) eq 'undef');  # 0|1
-        $href->{$ebproc}->{'RFIO'}             = 1 if(lc($opt_rfio) eq 'on');  # 0|1
-        $href->{$ebproc}->{'RFIO'}             = 0 if(lc($opt_rfio) eq 'off');  # 0|1
-        $href->{$ebproc}->{'RFIO_PATH'}        = $rfio_path;
-        $href->{$ebproc}->{'RFIO_pcOptions'}   = $rfio_pcOptions;
-        $href->{$ebproc}->{'RFIO_iCopyMode'}   = $rfio_iCopyMode;
-        $href->{$ebproc}->{'RFIO_pcCopyPath'}  = $rfio_pcCopyPath;
-        $href->{$ebproc}->{'RFIO_iCopyFrac'}   = $rfio_iCopyFrac;
-        $href->{$ebproc}->{'RFIO_iMaxFile'}    = $rfio_iMaxFile;
-        $href->{$ebproc}->{'RFIO_iPathConv'}   = $rfio_iPathConv;
-        
-        
-        
-        $href->{$ebproc}->{'LTSM'}             = $ltsm_list[$ebproc];  # 0|1
-        $href->{$ebproc}->{'LTSM_PATH'}        = $ltsm_path;
-        $href->{$ebproc}->{'LTSM_Server'}      = $ltsm_server;
-        $href->{$ebproc}->{'LTSM_Node'}        = $ltsm_node;
-        $href->{$ebproc}->{'LTSM_Passwd'}      = $ltsm_passwd;
-        $href->{$ebproc}->{'LTSM_Filesystem'}  = $ltsm_filesys;
-        
-
-        $href->{$ebproc}->{'EPICS_CTRL'}       = $epics_list[$ebproc];  # 0|1
-
-       $href->{$ebproc}->{'DABC'}             = $dabc_list[$ebproc];  # 0|1
-
-       $href->{$ebproc}->{'EB_DEBUG'}         = $ebdbg_list[$ebproc];  # 0|1
-
-        $href->{$ebproc}->{'EB_LOG'}           = $eblog_list[$ebproc];  # 0|1
-        $href->{$ebproc}->{'NM_LOG'}           = $nmlog_list[$ebproc];  # 0|1
-        
-        
-        if($ebproc<5)
-        {
-        # note that for bnet setup, index does not mean eb number, but machine number!
-        # we misuse this here to save complexity of setup
-         $href->{$ebproc}->{'BNET_INP'}       = $bnet_in_list[$ebproc];  # 0|1|2...
-         $href->{$ebproc}->{'BNET_BLD'}       = $bnet_bld_list[$ebproc];  # 0|1|2|3
-         #print "dump bnet_bld\n";
-         #print Dumper \$bnet_bld_list[$ebproc];
-        }
-       
-        
-        if( $write2disk_list[$ebproc] && lc($opt_disk) eq 'undef' ){
-            if(&isVarDefined($temp_args_href->{$procname}->{'OUTDIR'}, "OUTDIR for $procname")){
-                $href->{$ebproc}->{'OUTDIR'} = $temp_args_href->{$procname}->{'OUTDIR'};
-            }
-        }
-        elsif( lc($opt_disk) eq 'on' ){
-            if(&isVarDefined($temp_args_href->{$procname}->{'OUTDIR'}, "OUTDIR for $procname")){
-                $href->{$ebproc}->{'OUTDIR'} = $temp_args_href->{$procname}->{'OUTDIR'};
-            }
-        }
-        elsif( lc($opt_disk) eq 'off' ){
-            #- do not do anything. If $href->{$ebproc}->{'OUTDIR'} is undefined, 
-            #  the data will go to /dev/null
-        }
-    }    
-
-    $numOfEBProcs = $ebproc;
-    #print "result\n";
-    #print Dumper $ebproc;
-   # exit;
-}
-
-sub isVarDefined()
-{
-    my ($var, $msg) = @_;
-
-    my $retval = 1;
-
-    unless( defined $var ){
-        print "Undefined variable found: $msg\n";
-        $retval = 0;
-    }
-        
-    return $retval;
-}
-
-sub getVarSizeArg()
-{
-    my ($ebproc) = @_;
-    
-    my $i = 0;
-    my $arg = " ";
-
-    foreach my $size (@{$EB_Args_href->{$ebproc}->{'BUFSIZE_LIST'}}){
-
-        if($EB_Args_href->{$ebproc}->{'BUFSIZE_LIST'}->[$i] == 
-           $EB_Args_href->{$ebproc}->{'QUEUESIZE'}){
-            $i++;
-            next;
-        }
-
-        $arg = $arg . " -Q " . $i . ":" . $EB_Args_href->{$ebproc}->{'BUFSIZE_LIST'}->[$i];
-        $i++;
-    }
-
-    return $arg;
-}
-
-
-sub startBnet()
-{
-# here we launch the dabc bnet.
-# parameters in eb.conf can specify how many input and builder processes run on each node.
-# we misuse daq gbe setup for EB 15 to specify ports and destination nodes.
-my (@process_list);
-# setup for first EB
-my $ebproc =0; # setup for first EB will define the BNET
-  my $username = "hadaq";
-  my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.head; ";
-# here test special installations:
-  my $cdworkdir = "cd /home/hadaq/oper;";
-
-  my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.head ";
-#   my $cmd_dabc = "/usr/bin/gdb  -x /home/hadaq/soft/dabc/head/base/run/gdbcmd.txt --args /home/hadaq/soft/dabc/bin/dabc_exe.head ";
-
-   
-  my $conf_bnet_inp = " BnetInputHades.head.xml";
-  my $conf_bnet_bld = " BnetBuilderHades.head.xml";
-   
-#  my @bnetservers = ("192.168.100.8","192.168.100.9","192.168.100.10","192.168.105.11", "192.168.105.12");
-
-  # variable master node now:
-  my $bnetmaster = "lxhadeb07";
-  #lxhadeb12";
-  
-# before we start inidividual bnet processes, need to evaluate list of ports and nodes:
-# BNETSENDERS=[localhost:12501,localhost:12502]
-# BNETRECEIVERS= [localhost:12101,localhost:12102] 
-# HADAQPORTS =[50000,50001,50002]
-
-my $bnetsenders = "[";
-my $bnetrcvs = "[";
-my @bnet_port_list   = ();
-my @bnet_calib_list  = ();
-my @bnet_subevt_list = ();
-my $firstsnd = 1;
-my $firstrcv = 1;
-
- my $maxbuildservers = 4; #exclude lxhadeb12 from data writing
- my $maxbuilders=1; 
-    if ($opt_bnet>0 && $opt_bnet <16) {
-      $maxbuilders=$opt_bnet;
-    }
-    
-   print "Using $maxbuilders event builder nodes from option -b $opt_bnet\n";     
-my $totalbuilders=0;
-my @localbuilders = (0,0,0,0,0);
-while($totalbuilders < $maxbuilders)
-{
-    my $lasttotalbuilders=$totalbuilders;
-    for ( my $ebserver=0; $ebserver<$maxbuildservers; $ebserver=$ebserver+1){
-         my $bnet_numbuilders =  $EB_Args_href->{$ebserver}->{'BNET_BLD'};
-         #print "numbuilders for $ebserver is $bnet_numbuilders \n";
-         if($totalbuilders < $maxbuilders)
-           {
-             if($localbuilders[$ebserver] < $bnet_numbuilders)
-                 {
-                     $localbuilders[$ebserver]++;
-                     $totalbuilders++;
-                     #  print "Added 1 builder on EB server: $ebserver\n";
-                 }
-           }
-         }
-     if ($totalbuilders==$lasttotalbuilders){ last;} # more ebs demanded than configured             
-}
-
- for ( my $ebserver=0; $ebserver<5; $ebserver=$ebserver+1){
-         print "Found $localbuilders[$ebserver]  builders on EB server: $ebserver\n";
-         }
-
-my $rcvport = 12100;
-for ( my $ebserver=0; $ebserver<5; $ebserver=$ebserver+1){
-         print "Gathering processes at EB server: $ebserver\n";
-      my $sendport = 12501;
-      my $ip = $bnetservers[$ebserver];
-
-      
-      # JAM2018 - need to transform HADES VLAN IPs into GSI VLAN for BNET!
-      my $gsi_ip = getIP_hades2gsi($ip);
-      
-      # array of BNET values is already indexed with server id:
-      my $bnet_numsenders =  $EB_Args_href->{$ebserver}->{'BNET_INP'};
-      
-      for (my $six=0; $six<$bnet_numsenders; $six=$six+1)
-      {
-       $bnetsenders=$bnetsenders . "," unless ($firstsnd>0);
-       $bnetsenders=$bnetsenders . $gsi_ip.":". $sendport;
-       $sendport=$sendport+1;
-       $firstsnd=0 if($firstsnd>0);
-      }
-      
-      
-       for (my $rix=0; $rix<$localbuilders[$ebserver]; $rix=$rix+1)
-       {
-           $bnetrcvs=$bnetrcvs . "," unless ($firstrcv>0);
-           $bnetrcvs=$bnetrcvs . $gsi_ip.":". $rcvport;
-           $rcvport=$rcvport+1;
-           $firstrcv=0 if($firstrcv>0);
-       }      
-      my $hadaqports = "[";
-      my $calibflags = "[";
-      my $subevents  = "[";
-      my $firstport = 1;
-      
-  
-        #- add ports: note that we only use eb 1 setup and do check which ports belong to our eb server:
-       my $ix =0;
-        foreach my $port (@{$EB_Args_href->{$ebproc}->{'PORT_LIST'}}){ 
-           # here we only gather such ports that are assigned to our node:
-           # todo: how to distribute the ports to more than one bnet input process per server?
-           my $cflag = $EB_Args_href->{$ebproc}->{'CALIB_LIST'}[$ix];
-           my $hub = $EB_Args_href->{$ebproc}->{'HUB_LIST'}[$ix];
-           #print "ip" . $ip . " with port:" . $port ." index:" . $ix . " ip: ". $EB_Args_href->{$ebproc}->{'IP_LIST'}[$ix] . " calib: ". $cflag ." hub: ". $hub ."\n" ;
-           if($ip eq $EB_Args_href->{$ebproc}->{'IP_LIST'}[$ix])
-           {
-             $hadaqports=$hadaqports . "," unless ($firstport>0);
-             $hadaqports = $hadaqports . $port;
-             $calibflags=$calibflags . "," unless ($firstport>0);
-             $calibflags = $calibflags . $cflag;
-             $subevents=$subevents . "," unless ($firstport>0);
-             $subevents = $subevents . $hub;
-             $firstport=0 if($firstport>0);
-           }
-           $ix++;
-         
-    }
-    $hadaqports=$hadaqports . "]";   
-    push(@bnet_port_list, $hadaqports); # ports are per server
-    
-    $calibflags=$calibflags . "]";   
-    push(@bnet_calib_list, $calibflags); # flags per server
-    
-    $subevents=$subevents . "]";   
-    push(@bnet_subevt_list, $subevents); # flags per server
-    
-    
-    
-   # print "node ". $gsi_ip . " uses ports ".$hadaqports . ", calibflags " .$calibflags . " hubs: ". $subevents ."\n";
-}
-$bnetsenders = $bnetsenders . "]";
-$bnetrcvs = $bnetrcvs . "]";
-
-print "bnetsenders: ".   $bnetsenders ."\n";
-print "bnetreceivers: ". $bnetrcvs ."\n";
-
-  my $portid=0; #
-  my $sendid=0;
-   my $bnebport=12100;
-for ( my $ebserver=0; $ebserver<5; $ebserver=$ebserver+1){
-         print "Starting input processes on EB server: $ebserver\n";
-         my $ebid=$ebserver + 1; # still need unique eventbuilder ids on cluster because of epics!
-        
-         my $cpu = $bnetservers[$ebserver];
-
-         my $gsi_cpu = getIP_hades2gsi($cpu);
-        # in the following, the port and ip setup of the bnet is taken from ebproc 15 or 0 only!
-        
-        my $bnet_numsenders =  $EB_Args_href->{$ebserver}->{'BNET_INP'};
-        #my $bnet_numbuilders =  $EB_Args_href->{$ebserver}->{'BNET_BLD'};
-        print "found $bnet_numsenders senders on node $cpu \n";
-       
-        
-        
-        my $bninpport=12501;
-        
-        # loop over senders on this node and start them:
-        for(my $sender=0; $sender<$bnet_numsenders; $sender=$sender+1)
-        {
-           
-           #my $sendnum= $sender + 1;
-           
-           my $exports = " export MYHOST=" . $gsi_cpu . ";" .
-               " export BNETMASTER=" . $bnetmaster . ";" .
-               #" export BNINPNUM=" . $sendnum . ";" . # need to use different sender numbers on differentnodes
-               " export BNINPNUM=" . $ebid . ";" . # todo: extend if more than one sender per node
-               " export BNINPID=" . $sendid . "; " .
-               " export BNINPPORT=" . $bninpport . "; " .
-               " export BNETSENDERS=" . $bnetsenders . ";" .
-               " export BNETRECEIVERS=" . $bnetrcvs . ";" .
-               " export HADAQPORTS=" . $bnet_port_list[$ebserver] .";" .
-               " export SUBEVENTS=" . $bnet_subevt_list[$ebserver] .";" .
-               " export CALIBFLAGS=" . $bnet_calib_list[$ebserver] .";";
-               
-         # todo: how to configure situation with more than one bnet input per node? hadaqports must be distributed on them...
-         #     
-               
-         #my $core_nr = &getCoreNr($cpu) . "," . &getCoreNr($cpu);
-         my $core_nr = &getCoreNr($cpu, 'input'); 
-        my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports taskset -c $core_nr  $cmd_dabc $conf_bnet_inp 1</dev/null &\"";
-     #    my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports   $cmd_dabc $conf_bnet_inp >senderlog_$cpu.log 2>&1  &\"";
-
-
-         my $log = $log_path . "/log_" . $ebserver . "_" . "startBnetInp_". $sender. ".txt";
-   #my $log = "/dev/null 2>&1";
-   
-         print "Forking:" . $exe_dabc ."\n";
-         forkMe($exe_dabc, $log, \@process_list) unless($opt_test);
-
-         $sendid = $sendid +1; 
-         $bninpport =  $bninpport +1;  
-               
-         } # bnet sender/input processes
-       
-    } # end senders   
-    # todo: loop over builders
-    
-   for ( my $ebserver=0; $ebserver<4; $ebserver=$ebserver+1){
-         print "Starting builder processes on EB server: $ebserver\n";
-         my $ebid=$ebserver + 1; # still need unique eventbuilder ids on cluster because of epics!
-        
-          my $cpu = $bnetservers[$ebserver];
-       
-########### old       
-         # here we use the fact that first 4 eb processes are assigned to first 4 servers.
-         # so node ip is directly mapped from setup:
-#          my $cpu = $EB_Args_href->{$ebserver}->{'IP'};
-#          if ($ebserver == 0) {
-#             $cpu = '192.168.100.8';
-#      }
-#################
-         my $gsi_cpu = getIP_hades2gsi($cpu);
-        # in the following, the port and ip setup of the bnet is taken from ebproc 15 or 0 only!
-        
-        #my $bnet_numbuilders =  $EB_Args_href->{$ebserver}->{'BNET_BLD'};
-        
-        print "start $localbuilders[$ebserver] builders on node $cpu \n";     
-         
-         
-        
-         for(my $builder=0; $builder<$localbuilders[$ebserver]; $builder=$builder+1)
-        {
-        
-           my $exports = " export MYHOST=" . $gsi_cpu . ";" .
-               " export BNETMASTER=" . $bnetmaster . ";" .
-               " export BNEBNUM=" . $ebid . ";" .
-               " export BNEBID=" . $portid . "; " .
-               " export BNEBPORT=" . $bnebport . "; " .
-               # ignore prefix at startup. always start without files and show it:
-               #" export PREFIX=" . $EB_Args_href->{$ebproc}->{'PREFIX'}. "; " .
-               " export PREFIX=--;" .
-               " export BNETSENDERS=" . $bnetsenders . ";" .
-               " export BNETRECEIVERS=" . $bnetrcvs . ";" .
-               " export HADAQPORTS=" . $bnet_port_list[$ebserver]. "; " ;
-               
-               if($EB_Args_href->{$ebproc}->{'OUTDIR'} ){
-               # no daqdisk demon anymore for raid6-
-               $exports = $exports . "export DAQDISK=0; export OUTDIR=/data01/data; ";
-               
-#              if($EB_Args_href->{$ebproc}->{'MULTIDISK'}){
-#               $exports = $exports . "export DAQDISK=1; export OUTDIR=/data01; ";
-#              }
-#              else{
-#               $exports = $exports . "export DAQDISK=0; export OUTDIR=" . $EB_Args_href->{$ebproc}->{'OUTDIR'} .";";
-#              }
-         
-         
-         
-
-#      }
-          if( $EB_Args_href->{$ebproc}->{'LTSM'} ){
-         
-         $exports = $exports . " export FILEOUTPUTS=3;";
-       # additional exports for LTSM
-
-        $exports = $exports . " export LTSMPATH=". $EB_Args_href->{$ebproc}->{'LTSM_PATH'} . ";";
-         $exports = $exports . " export LTSMSERVER=". $EB_Args_href->{$ebproc}->{'LTSM_Server'} . ";";
-         $exports = $exports . " export LTSMNODE=". $EB_Args_href->{$ebproc}->{'LTSM_Node'} . ";";
-         $exports = $exports . " export LTSMPASSWD=". $EB_Args_href->{$ebproc}->{'LTSM_Passwd'} . ";";
-        $exports = $exports . " export LTSMFSNAME=". $EB_Args_href->{$ebproc}->{'LTSM_Filesystem'} . ";";
-        $exports = $exports . " export DSM_LOG=/home/hadaq/oper/ltsm". $ebid .".log;";
-
-# switch on by number of outputs
-       }
-       
-       else
-       {
-            # no rfio, just local file 
-            $exports = $exports . " export FILEOUTPUTS=2;";
-       }
-
-         
-         
-         
-         } #outdir
-         else{
-               $exports = $exports . " export FILEOUTPUTS=1;";
-               # no output except for the stream server...
-         }
-  
-       #my $core_nr = &getCoreNr($cpu) . "," . &getCoreNr($cpu);
-    my $core_nr = &getCoreNr($cpu, 'build');
-     
-       my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports taskset -c $core_nr  $cmd_dabc $conf_bnet_bld 1</dev/null &\"";
-       #my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports   $cmd_dabc $conf_bnet_bld  >builderlog_$cpu.log 2>&1  &\"";
-
-
-       my $log = $log_path . "/log_" . $ebserver . "_" . "startBnetBld_". $builder . ".txt";
-   #my $log = "/dev/null 2>&1";
-   
-       print "Forking:" . $exe_dabc ."\n";
-       forkMe($exe_dabc, $log, \@process_list) unless($opt_test);
-
-       $ebid = $ebid + 4 ; # increment ebnum by 4 per ebserver to re-use EPICS iocs
-       $portid = $portid + 1; 
-       $bnebport = $bnebport +1;
-       # 
-    } # builder processes
-        
-  } # servers
-
- # finally, we need to set eb lut on cts for setup of EB1 => bnet distribution
- #trbcmd w 0x0003 0xa0f0 0x8000`;
- #`trbcmd w 0x0003 0xa0f0 0x1`; 
- `trbcmd setbit 0x0003 0xa0f0 0x1`; 
- # use EB1 as pseude for BNET now
- # all calibration triggers also assigned to pseudo EB1=> bnet distribution for the moment
- #trbcmd w 0x0003 0xa0f3 0xfff`;
- # `trbcmd w 0x0003 0xa0f3 0xff0`; 
- `trbcmd setbit 0x0003 0xa0f3 0xff0`; 
- # use EB1 as pseudo receiver for calib triggers
-
-sleep (5); # seems also to be fine: michael, 2019-02-18
-
-# sleep (20) # old # need to wait until forking is done, otherwise it does not work via gui control xterm
-}
-
-
-
-sub startEvtBuilders()
-{
-    if( $EB_Args_href->{0}->{'BNET_INP'} ){
-    print "Starting Builder network...\n";
-      startBnet();
-      return;
-    }
-    
-#   print "DISABLING regular eventbuilder start for testing!\n";
-#    return;
-########################################
-    my $username = "hadaq";
-
-    my (@process_list);
-
-    foreach my $ebproc (sort {$a <=> $b} keys %$EB_Args_href){
-
-        my $ebnum2print = $ebproc+1;
-        print "EB process: $ebnum2print\n";
-
-if($ebproc==15)
-{
-  print "Ignore eventbuilder 16, setup is reserved for BNET. \n";
-  return;
-}
-        
-        
-# JAM first test if we should activate dabc eventbuilder or old one
-
- if( $EB_Args_href->{$ebproc}->{'DABC'} ){
-    print "Starting DABC process..\n";
-
-#". /home/joern/dabcwork/head/dabclogin;cd /home/joern/dabcwork/head/plugins/hadaq/app; export EBNUM=1; export STREAMS=5; export UDP00=10101; export UDP01=10102; export UDP02=10103; export UDP03=10104; export UDP04=10105 export PREFIX=be; /home/joern/dabcwork/head/bin/dabc_exe EventBuilderHades.xml &" > /dev/null 2>&1  &
-
-  my $cpu = $EB_Args_href->{$ebproc}->{'IP'};
-# JAM old, direct to version
-  #my $dabclogin = ". /home/hadaq/soft/dabc/head/dabclogin;";
-# JAM default:
-#my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin;";#
-#my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.275;";
-  my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.head; ";
-# here test special installations:
-  my $cdworkdir = "cd //home/hadaq/oper;";
-
-# JAM old, direct to version
-#my $cmd_dabc = "/home/hadaq/soft/dabc/head/bin/dabc_exe ";
-# JAM default:
-#my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe ";
-# here test special installations:
-#  my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.275 ";
-my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.head ";
-
-#  my $conf_dabc = " EventBuilderHades.xml";
-# my $conf_dabc = " EventBuilderHades.275.xml";
-  my $conf_dabc = " EventBuilderHades.head.xml";
-  my $exports = " export LC_ALL=C;" .
-               " export EBNUM=" . $EB_Args_href->{$ebproc}->{'EBNUM'} . "; " .
-               " export STREAMS=" . $EB_Args_href->{$ebproc}->{'SOURCENUM'} . "; " .
-               " export PREFIX=" . $EB_Args_href->{$ebproc}->{'PREFIX'}. "; " ;
-
-   my @port_list = ();
-
-        #- add ports
-       my $ix =0;
-        foreach my $port (@{$EB_Args_href->{$ebproc}->{'PORT_LIST'}}){ 
-            #$cmd_nm = $cmd_nm . " -i UDP:0.0.0.0:" . $port;
-           my $index=sprintf("%02d", $ix++);
-            $exports = $exports . " export UDP". $index. "=" . $port . "; "; 
-            push(@port_list, $port);
-     }
-        &cpPortList2EB(\@port_list, $EB_Args_href->{$ebproc}->{'EBNUM'}, $cpu);
-
-
-
-
-
-
-#      MULTIDISK
-
-#- add output type
-
-       if($EB_Args_href->{$ebproc}->{'OUTDIR'} ){            
-             if($EB_Args_href->{$ebproc}->{'MULTIDISK'}){
-                $exports = $exports . "export DAQDISK=1; export OUTDIR=/data01; ";
-             }
-             else{
-                $exports = $exports . "export DAQDISK=0; export OUTDIR=" . $EB_Args_href->{$ebproc}->{'OUTDIR'} .";";
-             }
-         
-         if( $EB_Args_href->{$ebproc}->{'LTSM'} ){
-         
-         $exports = $exports . " export FILEOUTPUTS=3;";
-       # additional exports for LTSM
-
-        $exports = $exports . " export LTSMPATH=". $EB_Args_href->{$ebproc}->{'LTSM_PATH'} . ";";
-         $exports = $exports . " export LTSMSERVER=". $EB_Args_href->{$ebproc}->{'LTSM_Server'} . ";";
-         $exports = $exports . " export LTSMNODE=". $EB_Args_href->{$ebproc}->{'LTSM_Node'} . ";";
-         $exports = $exports . " export LTSMPASSWD=". $EB_Args_href->{$ebproc}->{'LTSM_Passwd'} . ";";
-         $exports = $exports . " export LTSMFSNAME=". $EB_Args_href->{$ebproc}->{'LTSM_Filesystem'} . ";";
-       
-# switch on by number of outputs
-       }
-################## deprecated, keep code for optional testing?
-# JAM 5-2017 - we never run rfio and ltsm in parallel. 
-#       if( $EB_Args_href->{$ebproc}->{'RFIO'} ){
-#          
-#          $exports = $exports . " export FILEOUTPUTS=3;";
-#      # additional exports for RFIO
-# 
-#      $exports = $exports . " export RFIOPATH=". $EB_Args_href->{$ebproc}->{'RFIO_PATH'} . ";";
-#          $exports = $exports . " export RFIOLUSTREPATH=". $EB_Args_href->{$ebproc}->{'RFIO_pcCopyPath'} . ";";
-#          $exports = $exports . " export RFIOCOPYMODE=". $EB_Args_href->{$ebproc}->{'RFIO_iCopyMode'} . ";";
-#          $exports = $exports . " export RFIOCOPYFRAC=". $EB_Args_href->{$ebproc}->{'RFIO_iCopyFrac'} . ";";
-#          $exports = $exports . " export RFIOMAXFILE=". $EB_Args_href->{$ebproc}->{'RFIO_iMaxFile'} . ";";
-#          $exports = $exports . " export RFIOPATHCONV=". $EB_Args_href->{$ebproc}->{'RFIO_iPathConv'} . ";";
-#      
-# # switch on by number of outputs
-#      }
-#######################################
-       else
-       {
-            # no rfio, just local file 
-            $exports = $exports . " export FILEOUTPUTS=2;";
-       }
-
-         
-         
-         
-         } #outdir
-         else{
-               $exports = $exports . " export FILEOUTPUTS=1;";
-               # no output except for the stream server...
-         }
-
-         
-
-          
-
-
-
-
-
-#      EPICSCONTROL ? always enabled for production
-#       SMALLFILES  for online monitoring node
-
-# Jul14 beamtime setup 3 cores for dabc
-     #my $core_nr = &getCoreNr($cpu) . "," . &getCoreNr($cpu) .  "," . &getCoreNr($cpu);
-
-# try 2 cores each dabc for more dabc nodes:
-     my $core_nr = &getCoreNr($cpu) . "," . &getCoreNr($cpu);
-#      my $core_nr = &getCoreNr($cpu);
-# dabc is set to 3 cores
-     
-# JAM use fixed core number for kp1pc092 tests:
-#   my $core_nr = 1;
-  my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports taskset -c $core_nr  $cmd_dabc $conf_dabc 1</dev/null &\"";
-#    my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports $cmd_dabc $conf_dabc &\"";
-
-
-   my $log = $log_path . "/log_" . $ebproc . "_" . "startEB.txt";
-   #my $log = "/dev/null 2>&1";
-   
-   print "Forking:" . $exe_dabc ."\n";
-   forkMe($exe_dabc, $log, \@process_list) unless($opt_test);
-
-}
-
-else
-{
-# the standard EB processes mode:
- print "Starting evtbuild/netmem processes..\n";
-
-        #--- Prepare execution of daq_evtbuild
-        my $cmd_eb = "/home/hadaq/bin/daq_evtbuild" .
-            " -m "          . $EB_Args_href->{$ebproc}->{'SOURCENUM'} . 
-            " -q "          . $EB_Args_href->{$ebproc}->{'QUEUESIZE'} . 
-            " -S "          . $EB_Args_href->{$ebproc}->{'EBNUM'} .
-            " --ebnum "     . $EB_Args_href->{$ebproc}->{'EBNUM'} . 
-            " -x "          . $EB_Args_href->{$ebproc}->{'PREFIX'};
-
-        #- add queue variable size args
-        my $varsize_arg = &getVarSizeArg($ebproc);
-        $cmd_eb = $cmd_eb . $varsize_arg;
-
-        #- add output type
-        if( defined $EB_Args_href->{$ebproc}->{'OUTDIR'} ){
-            if($EB_Args_href->{$ebproc}->{'MULTIDISK'}){
-                $cmd_eb = $cmd_eb . " -d file -o " . "/data01/data";
-            }
-            else{
-                $cmd_eb = $cmd_eb . " -d file -o " . $EB_Args_href->{$ebproc}->{'OUTDIR'};
-            }
-        }
-        else{
-            $cmd_eb = $cmd_eb . " -d null";
-        }
-
-        #- add file size
-        $cmd_eb = $cmd_eb . " --filesize " . $EB_Args_href->{$ebproc}->{'FILESIZE'};
-
-        #- add second output with small hdl files
-        if( defined $EB_Args_href->{$ebproc}->{'RESDOWNSCALE'} ){
-            $cmd_eb = $cmd_eb . " --resdownscale " . $EB_Args_href->{$ebproc}->{'RESDOWNSCALE'} .
-                                " --resnumevents " . $EB_Args_href->{$ebproc}->{'RESNUMEVENTS'} .
-                                " --respath "      . $EB_Args_href->{$ebproc}->{'RESPATH'} .
-                                " --ressizelimit " . $EB_Args_href->{$ebproc}->{'RESSIZELIMIT'};
-        }
-
-        my $cpu = $EB_Args_href->{$ebproc}->{'IP'};
-
-        #- add rfio args
-        my $rfio;
-        if( $EB_Args_href->{$ebproc}->{'RFIO'} ){
-            $rfio = " --rfio rfiodaq:gstore:" . $EB_Args_href->{$ebproc}->{'RFIO_PATH'} .
-                " --rfiolustre "     . $EB_Args_href->{$ebproc}->{'RFIO_pcCopyPath'} .
-                " --rfio_pcoption "  . $EB_Args_href->{$ebproc}->{'RFIO_pcOptions'} .
-                " --rfio_icopymode " . $EB_Args_href->{$ebproc}->{'RFIO_iCopyMode'} .
-                " --rfio_icopyfrac " . $EB_Args_href->{$ebproc}->{'RFIO_iCopyFrac'} .
-                " --rfio_imaxfile "  . $EB_Args_href->{$ebproc}->{'RFIO_iMaxFile'} .
-                " --rfio_ipathconv " . $EB_Args_href->{$ebproc}->{'RFIO_iPathConv'};
-        }
-
-        $cmd_eb = $cmd_eb . $rfio if( defined $rfio );
-
-        #- add multiple disk arg (ctrl via daq_disks)
-        if($EB_Args_href->{$ebproc}->{'MULTIDISK'} && 
-           defined $EB_Args_href->{$ebproc}->{'OUTDIR'}){
-            $cmd_eb = $cmd_eb . " --multidisk " . $EB_Args_href->{$ebproc}->{'MULTIDISK'};
-        }
-
-        #- add online RPC server
-        if( $EB_Args_href->{$ebproc}->{'ONLINESERVER'} eq "on" ){
-            $cmd_eb = $cmd_eb . " --online";
-        }
-
-        #- add epics controlled
-        $cmd_eb = $cmd_eb . " --epicsctrl " if( $EB_Args_href->{$ebproc}->{'EPICS_CTRL'} );
-
-         # switch on debug output
-        $cmd_eb = $cmd_eb . " --debug trignr --debug errbit --debug word " if( $EB_Args_href->{$ebproc}->{'EB_DEBUG'} );
-
-
-        
-        #- logging the output
-        my $eblog_file = "/tmp/log_eb_" . $EB_Args_href->{$ebproc}->{'EBNUM'} . ".txt";
-        my $eb_log = "1>$eblog_file 2>$eblog_file";
-        $eb_log = "1>/dev/null 2>/dev/null" unless( $EB_Args_href->{$ebproc}->{'EB_LOG'} );
-
-        my $time = 1. * $ebproc;
-        my $sleep_cmd = "sleep " . $time;
-
-        my $core_nr = &getCoreNr($cpu);
-
-        my $exe_eb = "ssh -n $cpu -l $username \"cd /home/hadaq/oper; export DAQ_SETUP=/home/hadaq/oper/eb; taskset -c $core_nr  $cmd_eb $eb_log &\"";
-
-        #print "exec: $exe_eb\n";
-
-        #--- Prepare execution of daq_netmem
-        my $cmd_nm = "/home/hadaq/bin/daq_netmem" .
-            " -m " . $EB_Args_href->{$ebproc}->{'SOURCENUM'} . 
-            " -q " . $EB_Args_href->{$ebproc}->{'QUEUESIZE'} . 
-            " -S " . $EB_Args_href->{$ebproc}->{'EBNUM'};
-
-        #- add queue variable size args
-        $cmd_nm = $cmd_nm . $varsize_arg;
-
-        my @port_list = ();
-
-        #- add ports
-        foreach my $port (@{$EB_Args_href->{$ebproc}->{'PORT_LIST'}}){ 
-            #$cmd_nm = $cmd_nm . " -i UDP:0.0.0.0:" . $port;
-            $cmd_nm = $cmd_nm . " -i " . $port;
-
-            push(@port_list, $port);
-        }
-
-        &cpPortList2EB(\@port_list, $EB_Args_href->{$ebproc}->{'EBNUM'}, $cpu);
-
-        #- logging the output
-        my $nmlog_file = "/tmp/log_nm_" . $EB_Args_href->{$ebproc}->{'EBNUM'} . ".txt";
-        my $nm_log = "1>$nmlog_file 2>$nmlog_file";
-        $nm_log = "1>/dev/null 2>/dev/null" unless( $EB_Args_href->{$ebproc}->{'NM_LOG'} );
-
-        $core_nr = &getCoreNr($cpu);
-
-        my $exe_nm = "ssh -n $cpu -l $username \"cd /home/hadaq/oper; export DAQ_SETUP=/home/hadaq/oper/eb; taskset -c $core_nr $cmd_nm $nm_log &\"";
-
-        #print "exec: $exe_nm\n";
-
-        #--- Open permissions for shared memory
-        my $eb_shmem = "daq_evtbuild" . $EB_Args_href->{$ebproc}->{'EBNUM'} . ".shm";
-        my $nm_shmem = "daq_netmem" . $EB_Args_href->{$ebproc}->{'EBNUM'} . ".shm";
-        my $exe_open_eb = "ssh -n $cpu -l $username \"chmod 775 /dev/shm/$eb_shmem\"";
-        my $exe_open_nm = "ssh -n $cpu -l $username \"chmod 775 /dev/shm/$nm_shmem\"";
-        
-        &forkEB($exe_eb, $exe_nm, $exe_open_eb, $exe_open_nm, \@process_list);
-    }
-
-} 
-# if dabc
-
-    #- Wait for children
-    foreach my $cur_child_pid (@process_list) {
-        waitpid($cur_child_pid,0);
-    }
-
-} 
-# foreach
-
-sub stopEvtBuilders()
-{
-    my $username = "hadaq";
-
-    my @process_list = ();
-
-    #--- Loop over server IPs
-   # foreach my $ip (@EB_IP_list){
-foreach my $ip (@bnetservers){
-   
-        my $exe = "ssh -n $ip -l $username \"/home/hadaq/bin/cleanup_evtbuild.pl; /home/hadaq/bin/ipcrm.pl\"";
-
-        if($opt_verb){
-            print "Killing running EBs...\n";
-            print "Exec: $exe\n";
-        }
-
-        my $log = $log_path . "/log_" . $ip . "_" . "stopEB.txt";
-
-        forkMe($exe, $log, \@process_list) unless($opt_test);
-    }
-
-    #- Wait for children
-    foreach my $cur_child_pid (@process_list) {
-        print "wait for $cur_child_pid\n";
-        waitpid($cur_child_pid,0);
-    }
-}
-
-sub cpPortList2EB()
-{
-    my ($port_list_aref, $ebnr, $cpu) = @_;
-
-    my $tmpfile = "/tmp/eb" . $ebnr . "_" . $cpu . ".txt";
-
-    #- First write ports to tmp file
-    my $fh = new FileHandle(">$tmpfile");
-
-    if(!$fh) {
-        my $txt = "\nError! Could not open file \"$tmpfile\" for output. Exit.\n";
-        print STDERR $txt;
-        print $txt;
-        exit(128);
-    }
-    
-    foreach my $port (@$port_list_aref){
-        print $fh "$port\n";
-    }
-
-    $fh->close();
-
-    #- Copy this tmp file to EB
-    my $exe_cp = "scp $tmpfile hadaq\@$cpu:/tmp/ 1>/dev/null 2>/dev/null";
-    system($exe_cp);
-}
-sub startIOC()
-{
-    my $ioc_dir = "/home/scs/ebctrl/ioc/iocBoot/iocebctrl";
-
-    &writeIOC_stcmd( $ioc_dir );
-
-    print "Starting IOCs...\n" if($opt_verb);
-
-    foreach my $ebproc (keys %$EB_Args_href){
-
-        my $stcmd = sprintf("st_eb%02d.cmd", 1 + $ebproc);
-        my $screen_name = sprintf("ioc_eb%02d", 1 + $ebproc);
-
-        my $cmd = "bash; . /home/scs/.bashrc; export HOSTNAME=\\\$(hostname); cd $ioc_dir; screen -dmS $screen_name ../../bin/linux-x86_64/ebctrl $stcmd";
-        my $cpu = $EB_Args_href->{$ebproc}->{'IP'};
-        # JAM2016: this is kludge for bnet:
-        # first IP in hub configuration of pseude EB15 might be set differently
-        # we always reset it to match lxhadeb05 where epics for builder should belong 
-        if($ebproc == 15)
-         {
-           $cpu='192.168.100.15';
-         }
-       #another dirty workaround for bnet at eb0:
-        if ($ebproc == 0) {
-          $cpu = '192.168.100.8';
-       } 
-        # end bnet kludge
-        my $exe = "ssh -n $cpu -l scs \"$cmd\"";
-
-        print "Exec: $exe\n" if($opt_verb);
-        system($exe) unless($opt_test);
-    }
-}
-
-sub smallestEBProcNum()
-{
-    my $smallest = 1000;
-
-    foreach my $ebproc (keys %$EB_Args_href){
-        $smallest = $ebproc if($smallest > $ebproc);
-    }
-
-    return $smallest;
-}
-
-sub writeIOC_stcmd()
-{
-    my ($ioc_dir) = @_;
-
-    # JAM first evaluate ports for ca list
-    my $epicscalist = "192.168.111.255";
-    foreach my $ebproc (keys %$EB_Args_href){
-     $epicscalist=sprintf("%s 192.168.111.255:%d", $epicscalist, 10001 + $ebproc);
-    }
-    
-    print "Copying st.cmd files to servers...\n" if($opt_verb);
-
-    my $smallest_ebproc = &smallestEBProcNum();
-    
-    foreach my $ebproc (keys %$EB_Args_href){
-
-        my $ebNr  = 1 + $ebproc;
-        my $ebnum = sprintf("eb%02d", $ebNr);
-        my $serverport = 10001+ $ebproc;
-       
-       
-        #- in MBytes
-        my $maxFileSize = $EB_Args_href->{$ebproc}->{'FILESIZE'};
-
-        my $ebtype = "slave";
-        my $comment_genrunid   = "#";
-        my $comment_totalevt   = "#";
-
-        if($ebproc == $smallest_ebproc){
-            $ebtype           = "master";
-            $comment_genrunid = "";
-            $comment_totalevt   = "";
-        }
-
-#        if($ebNr == 1){
-#            $comment_totalevt   = "";
-#        }
-
-        my $ioc_stcmd = <<EOF;
-#!../../bin/linux-x86_64/ebctrl
-
-## Set EPICS environment
-
-< envPaths
-
-epicsEnvSet(FILESIZE,"$maxFileSize")
-epicsEnvSet(EBTYPE,"$ebtype")
-epicsEnvSet(EBNUM,"$ebNr")
-epicsEnvSet(ERRBITLOG, "1")
-epicsEnvSet(ERRBITWAIT, "30")
-epicsEnvSet(EPICS_CAS_SERVER_PORT,"$serverport")
-## epicsEnvSet(EPICS_CA_ADDR_LIST,"192.168.111.255")
-epicsEnvSet(EPICS_CA_ADDR_LIST,"$epicscalist")
-epicsEnvSet(EPICS_CA_AUTO_ADDR_LIST,"NO")
-epicsEnvSet(PATH,"/home/scs/base-3-14-11/bin/linux-x86_64:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:.")
-
-cd \${TOP}
-
-## Register all support components
-dbLoadDatabase("dbd/ebctrl.dbd")
-ebctrl_registerRecordDeviceDriver(pdbbase)
-
-## Load record instances
-dbLoadRecords("db/stats.db", "PREFIX=HAD:IOC:,IOC=$ebnum")
-dbLoadRecords("db/evtbuild.db","eb=$ebnum")
-dbLoadRecords("db/netmem.db","eb=$ebnum")
-dbLoadRecords("db/errbit1.db","eb=$ebnum")
-dbLoadRecords("db/errbit2.db","eb=$ebnum")
-dbLoadRecords("db/trignr1.db","eb=$ebnum")
-dbLoadRecords("db/trignr2.db","eb=$ebnum")
-dbLoadRecords("db/portnr1.db","eb=$ebnum")
-dbLoadRecords("db/portnr2.db","eb=$ebnum")
-dbLoadRecords("db/trigtype.db","eb=$ebnum")
-## JAM disable cpu module to test epicshangup issue:
-## dbLoadRecords("db/cpu.db","eb=$ebnum")
-dbLoadRecords("db/errbitstat.db","eb=$ebnum")
-$comment_totalevt dbLoadRecords("db/totalevtstat.db")
-$comment_genrunid dbLoadRecords("db/genrunid.db","eb=$ebnum")
-
-## Set this to see messages from mySub
-var evtbuildDebug 0
-var netmemDebug 0
-var genrunidDebug 0
-var writerunidDebug 0
-var errbit1Debug 0
-var errbit2Debug 0
-var trigtypeDebug 1
-var cpuDebug 0
-var errbitstatDebug 0
-$comment_totalevt var totalevtscompDebug 0
-cd \${TOP}/iocBoot/\${IOC}
-iocInit()
-
-## Start any sequence programs
-#seq sncExample,"user=scsHost"
-
-dbl > \${TOP}/iocBoot/\${IOC}/$ebnum.dbl
-
-EOF
-
-        my $outfile = "/tmp/st_" . $ebnum . ".cmd";
-        my $fh = new FileHandle(">$outfile");
-
-        if(!$fh) {
-            my $txt = "\nError! Could not open file \"$outfile\" for output. Exit.\n";
-            print STDERR $txt;
-            print $txt;
-            exit(128);
-        }
-
-        print $fh $ioc_stcmd;
-        $fh->close();
-
-        my $ip  = $EB_Args_href->{$ebproc}->{'IP'};
-        my $cmd = "scp $outfile scs\@$ip:$ioc_dir/.";
-        
-        print "Exec: $cmd\n" if($opt_verb);
-        system($cmd) unless($opt_test);        
-    }
-}
-
-sub killIOC()
-{
-    my %ioc;
-    my $ioc_href = \%ioc;
-
-    print "Looking for running IOCs...\n" if($opt_verb);
-
-    #--- Loop over server IPs
-    
-    #foreach my $ip (@EB_IP_list){
-    foreach my $ip (@bnetservers){
-
-        &findRunningIOC($ip, $ioc_href);
-    }
-
-    #print Dumper \%$ioc_href;
-
-    &writeExpectIOC() if(%$ioc_href);
-
-    if($opt_verb){
-        print "Killing running IOCs...\n";
-        print "No IOCs found - nothing to kill, continue...\n" unless(%$ioc_href);
-    }
-
-    my (@process_list);
-
-    foreach my $ip ( %$ioc_href ){
-        foreach my $ioc ( @{$ioc_href->{$ip}} ){
-            
-            my $cmd = $expect_ioc_script . " " . $ip . " " . $ioc;
-            my $log = $log_path . "/log_" . $ip . "_" . $ioc . ".txt";
-            print "cmd: $cmd\n" if($opt_verb);
-            &forkMe($cmd, $log, \@process_list);
-        }
-    }
-
-
-    
-
-    #- Wait for children
-    foreach my $cur_child_pid (@process_list) {
-        waitpid($cur_child_pid,0);
-    }
-
-    ### just kill the remaining stuff
-    @process_list = ();
-
-    #foreach my $ip (@EB_IP_list){
-    foreach my $ip (@bnetservers){
-       my $cmd = qq|ssh scs\@$ip "/usr/bin/pkill -f \\"SCREEN -dmS ioc_eb\\""|;
-       print $cmd;
-       &forkMe($cmd, "/tmp/ioc_kill_$ip", \@process_list);
-    }
-
-    foreach my $cur_child_pid (@process_list) {
-        waitpid($cur_child_pid,0);
-    }
-
-    #sleep 1;
-
-    ### just kill the remaining stuff
-    @process_list = ();
-    #foreach my $ip (@EB_IP_list){
-    foreach my $ip (@bnetservers){
-       my $cmd = qq|ssh scs\@$ip "/usr/bin/pkill -9 -f \\"SCREEN -dmS ioc_eb\\""|;
-       &forkMe($cmd, "/tmp/ioc_kill2_$ip", \@process_list);
-    }
-
-    foreach my $cur_child_pid (@process_list) {
-        waitpid($cur_child_pid,0);
-    }
-
-}
-
-sub forkMe()
-{
-    my ($cmd, $log, $proc_list) = @_;
-
-    my $child = fork();
-
-    if( $child ){                           # parent
-        push( @$proc_list, $child );
-    }
-    elsif( $child == 0 ) {                        # child
-        system("$cmd >$log 2>&1 ");
-        exit(0);
-    }
-    else{
-        print "Could not fork: $!\n";
-        exit(1);
-    }
-}
-
-sub forkEB()
-{
-    my ($exe_eb, $exe_nm, $exe_open_eb, $exe_open_nm, $proc_list) = @_;
-
-    my $child = fork();
-
-    if( $child ){                           # parent
-        push( @$proc_list, $child );
-    }
-    elsif( $child == 0 ) {                        # child
-        #--- Execute Event Builder
-        print "Exec: $exe_eb\n" if($opt_verb);
-        system($exe_eb) unless($opt_test);
-
-        #sleep(1);
-
-        #--- Open permissions for EB shared memory
-        #  ! Permissions should be opened by EB process
-        #print "Exec: $exe_open_eb\n" if($opt_verb);
-        #system($exe_open_eb) unless($opt_test);
-
-        #sleep(2);
-
-        #--- Execute Net-2-Memory
-        print "Exec: $exe_nm\n" if($opt_verb);
-        system($exe_nm) unless($opt_test);
-
-        #sleep(1);
-
-        #--- Open permissions for NM shared memory
-        #  ! Permissions should be opened by EB process
-        #print "Exec: $exe_open_nm\n" if($opt_verb);
-        #system($exe_open_nm) unless($opt_test);
-
-        exit(0);
-    }
-    else{
-        print "Could not fork: $!\n";
-        exit(1);
-    }
-}
-
-sub findRunningIOC()
-{
-    my ($cpu, $ioc_href) = @_;
-    
-    `ssh -n $cpu -l scs \"screen -wipe\"`;
-    my $exe = "ssh -n $cpu -l scs \"screen -ls\"";
-
-    my @output = `$exe`;
-
-    foreach my $line (@output){
-        if($line =~ /\d+\.(ioc_eb\d{2})\s+/){
-            my $name = $1;
-            push( @{$ioc_href->{$cpu}}, $name );
-            print "Found IOC: $name on $cpu\n" if($opt_verb);
-        }
-    }
-}
-
-sub writeExpectIOC()
-{
-    # This expect script can be executed to exit IOC.
-
-    #! Look if /tmp dir exists
-    my $tmp_dir = dirname("/tmp");
-    if ( !(-d $tmp_dir) ){
-        print "\nCannot access /tmp directory!\nExit.\n";
-        exit(1);
-    }
-
-    my $expect_script_my = <<EOF;
-#!/usr/bin/expect -f
-
-# This script is automatically generated by startup.pl
-# Do not edit, the changes will be lost.
-
-# Print args
-send_user "\$argv0 [lrange \$argv 0 \$argc]\\n"
-
-# Get args
-#
-# ip      : IP address of the server
-# iocname : name of IOC screen process (screen -ls)
-#
-if {\$argc>0} {
-  set ip      [lindex \$argv 0]
-  set iocname [lindex \$argv 1]
-} else {
-  send_user "Usage: \$argv0 ip iocname\\n"
-}
-
-spawn ssh scs@\$ip
-
-#expect {
-#        "error"     { exit; }
-#        "login:"    { exit; }
-#        "Password:" { exit; }
-#}
-
-set timeout 20
-#240
-
-expect "~\$ "
-send   "screen -r \$iocname\\r"
-expect "epics> "
-send   "exit\\r"
-expect "~\$ "
-    
-EOF
-
-    my $fh = new FileHandle(">$expect_ioc_script");
-
-    if(!$fh) {
-        my $txt = "\nError! Could not open file \"$expect_ioc_script\" for output. Exit.\n";
-        print STDERR $txt;
-        print $txt;
-        exit(128);
-    }
-
-    print $fh $expect_script_my;
-    $fh->close();    
-
-    #- open permissions
-    system("chmod 755 $expect_ioc_script");
-}
-
-sub getGbEconfig()
-{
-    #
-    # Read DB configurations of GbE and CTS,
-    # look for active data sources as well as
-    # for EB IPs and ports.
-    #
-
-    my ($eb_ids_href) = @_;
-
-    my $data_sources = $temp_args_href->{'Parallel'}->{'DATA_SOURCES'};
-    my $gbe_conf     = $temp_args_href->{'Parallel'}->{'GBE_CONF'};
-    #my $cts_conf     = $temp_args_href->{'Parallel'}->{'CTS_CONF'};
-
-    my %activeSources_hash;
-    my $activeSources_href = \%activeSources_hash;
-
-    &readActiveSources($data_sources, $activeSources_href);
-
-    my @id_list;
-    my $id_list_aref = \@id_list;
-
-    #&readEBids($cts_conf, $id_list_aref);
-
-    #- Overwrite array with EB numbers
-    @id_list = (0 .. 15);
-    #print Dumper $id_list_aref;
-
-    &readEBports($gbe_conf, $activeSources_href, $id_list_aref, $eb_ids_href);
-}
-
-sub readEBids()
-{
-    #
-    # Read EB Ids
-    #
-
-    my ($file, $id_list_aref) = @_;
-
-    my $nnn_table = 0;
-    my $val_table = 0;
-
-    my $SPACE = "";
-
-    my $fh = new FileHandle("$file", "r");
-
-    while(<$fh>){
-
-        #- Remove all comments
-        $_ =~ s{                # Substitue...
-                 \#             # ...a literal octothorpe
-                 [^\n]*         # ...followed by any number of non-newlines
-               }
-               {$SPACE}gxms;    # Raplace it with a single space        
-
-        #- Skip line if it contains only whitespaces
-        next unless(/\S/);
-
-            if(/^(\s+)?!Value\stable/){
-            $val_table = 1;
-            $nnn_table = 0;
-            next;
-        }
-        elsif(/^(\s+)?!\w+/){
-            $val_table = 0;
-            $nnn_table = 1;
-        }
-
-        if($val_table){
-            my (@vals)   = split(" ", $_);
-            my @id_list1 = split("", $vals[12]);
-            my @id_list2 = split("", $vals[13]);
-            foreach my $id (@id_list1){
-                push(@$id_list_aref, hex($id));
-            }
-            foreach my $id (@id_list2){
-                push(@$id_list_aref, hex($id));
-            }
-        }
-        elsif($nnn_table){
-        }
-    }
-
-    $fh->close;
-}
-
-sub readEBports()
-{
-    #
-    # Read EB IPs and ports accoring to EB Id (type) 
-    # and TRB-Net addresses of active data sources.
-    #
-
-    my ($file, $activeSources_href, $id_list_aref, $ports_href) = @_;
-
-    my $nnn_table = 0;
-    my $val_table = 0;
-
-    my $fh = new FileHandle("$file", "r");
-
-    &isFileDefined($fh, $file);
-
-    my %tmp;
-    my $tmp_href = \%tmp; 
-
-    my $SPACE = "";
-
-    while(<$fh>){
-
-        #print $_;
-        #- Remove all comments
-        $_ =~ s{                # Substitue...
-                 \#             # ...a literal octothorpe
-                 [^\n]*         # ...followed by any number of non-newlines
-               }
-               {$SPACE}gxms;    # Raplace it with a single space
-
-        #- Skip line if it contains only whitespaces
-        next unless(/\S/);
-
-        #print $_;
-            if(/^(\s+)?!Value\stable/){
-            $val_table = 1;
-            $nnn_table = 0;
-            next;
-        }
-        elsif(/^(\s+)?!\w+/){
-            $nnn_table = 1;
-            $val_table = 0;
-        }
-
-        if($val_table){
-            my (@vals)   = split(" ", $_);
-            my $id = $vals[1];
-
-            #if($id <0 or $id >15) {
-            #  print "error: in $file there is a line with an eventbuilder number different than 0..15, the number given in the file is $id. please correct the config file.\n";
-            #  exit(128);
-            #}
-
-
-            #- Accept only EB Ids from CTS config file
-            #print "value: $_";
-            next unless( any {$_ eq $id} @$id_list_aref );
-
-            #print Dumper \@vals;
-            #print "active sources: "; print Dumper $activeSources_href->{'addr_list'};
-            #exit;
-
-            my $ip   = &getIP_hex2dec($vals[6]);
-            my $port = &getPort_hex2dec($vals[2]);
-            my $addr = $vals[0];
-            my $calib = $vals[7]; # jam2018 - add list of trb3 tdc calibration modes
-
-          #  print "got: ip: $ip, port: $port, addr: $addr\n";
-            #- Accept only sources from active source list
-            if( any {hex($_) == hex($addr)} @{$activeSources_href->{'addr_list'}} ){
-                $tmp_href->{$id}->{'IP'} = $ip;
-                push( @{$tmp_href->{$id}->{'port_list'}}, $port );
-                push( @{$tmp_href->{$id}->{'addr_list'}}, $addr );
-                push( @{$tmp_href->{$id}->{'calib_list'}}, $calib );
-                
-                # JAM2016: for bnet we need the receiver nodes per port as list also:
-                 push( @{$tmp_href->{$id}->{'ip_list'}}, $ip );
-                
-            }
-        }
-    }
-
-    $fh->close;
-
-   # print Dumper $tmp_href;
-
-    #- Sort hash according to active data source list
-    my $numids= scalar keys %tmp;
-    #print "number of ids: $numids \n";
-    foreach my $id (keys %tmp){
-        $ports_href->{$id}->{'IP'} = $tmp_href->{$id}->{'IP'};
-        
-        foreach my $addr (@{$activeSources_href->{'addr_list'}}){
-            
-            my $ind1 = first_index {$_ eq $addr} @{$tmp_href->{$id}->{'addr_list'}};
-            my $ind2 = first_index {$_ eq $addr} @{$activeSources_href->{'addr_list'}};
-
-            next if($ind1 == -1);
-
-#             push( @{$ports_href->{$id}->{'port_list'}}, $tmp_href->{$id}->{'port_list'}->[$ind1]);
-#             # added for bnet JAM:
-#             push( @{$ports_href->{$id}->{'ip_list'}}, $tmp_href->{$id}->{'ip_list'}->[$ind1]);
-#             push( @{$ports_href->{$id}->{'calib_list'}}, $tmp_href->{$id}->{'calib_list'}->[$ind1]);
-#             
-#             push( @{$ports_href->{$id}->{'addr_list'}}, $addr);
-#             push( @{$ports_href->{$id}->{'bufsize_list'}}, $activeSources_href->{'bufsize_list'}->[$ind2]);
-            
-           
-            if($id == 0 && $numids==1){
-                 # fill all ids of active inputs with setup for id 0 of bnet
-                foreach my $bid (0 .. $#bnetservers){
-                    push( @{$ports_href->{$bid}->{'port_list'}}, $tmp_href->{$id}->{'port_list'}->[$ind1]);
-                    push( @{$ports_href->{$bid}->{'ip_list'}}, $tmp_href->{$id}->{'ip_list'}->[$ind1]);
-                    push( @{$ports_href->{$bid}->{'calib_list'}}, $tmp_href->{$id}->{'calib_list'}->[$ind1]);
-                    push( @{$ports_href->{$bid}->{'addr_list'}}, $addr);
-                    push( @{$ports_href->{$bid}->{'bufsize_list'}}, $activeSources_href->{'bufsize_list'}->[$ind2]);
-                }
-           }
-           else
-           {
-            #old EB mode/no bnet: config file defines all. DO WE NEED THIS STILL?
-            push( @{$ports_href->{$id}->{'port_list'}}, $tmp_href->{$id}->{'port_list'}->[$ind1]);
-            # added for bnet JAM:
-            #push( @{$ports_href->{$id}->{'ip_list'}}, $tmp_href->{$id}->{'ip_list'}->[$ind1]);
-            #push( @{$ports_href->{$id}->{'calib_list'}}, $tmp_href->{$id}->{'calib_list'}->[$ind1]);            
-            push( @{$ports_href->{$id}->{'addr_list'}}, $addr);
-            push( @{$ports_href->{$id}->{'bufsize_list'}}, $activeSources_href->{'bufsize_list'}->[$ind2]);
-           
-           }
-            }
-    }
-
-   # print Dumper $ports_href;
-}
-
-sub readActiveSources()
-{
-    #
-    # Read TRB-Net addresses of active data sources
-    #
-
-    my ($file, $activeSources_href) = @_;
-
-    my $fh = new FileHandle("$file", "r");
-
-    &isFileDefined($fh, $file);
-
-    my $SPACE = "";
-    
-   # this one contains list of deactivated data sources
-    my $log="/home/hadaq/trbsoft/hadesdaq/evtbuild/tmp/EB_NotActiveSources.txt";
-    system("truncate -s 0 $log ;");
-    while(<$fh>){
-        
-        #- Remove all comments
-        $_ =~ s{                # Substitue...
-                 \#             # ...a literal octothorpe
-                 [^\n]*         # ...followed by any number of non-newlines
-               }
-               {$SPACE}gxms;    # Raplace it with a single space
-
-        #- Skip line if it contains only whitespaces
-        next unless(/\S/);
-
-        my ($addr, $astat, $sys, $size)  = split(" ", $_);
-
-      if($astat == 0){
-         system("echo $addr >> $log 2>&1;");       
-        next;
-        }
-        push( @{$activeSources_href->{'addr_list'}}, $addr);
-        push( @{$activeSources_href->{'bufsize_list'}}, &getBufSize($size)); 
-    }
-
-    $fh->close;
-}
-
-sub getBufSize()
-{
-    my ($bufSize) = @_;
-
-    if(lc($bufSize) eq "low"){
-        return $temp_args_href->{'Main'}->{'BUF_SIZE_LOW'};
-    }
-    elsif(lc($bufSize) eq "mid"){
-        return $temp_args_href->{'Main'}->{'BUF_SIZE_MID'};
-    }
-    elsif(lc($bufSize) eq "high"){
-        return $temp_args_href->{'Main'}->{'BUF_SIZE_HIGH'};
-    }
-    else{
-        print "Cannot understand $bufSize from data_sources.db.\n";
-        exit(0);
-    }
-}
-
-sub getIP_hex2dec()
-{
-    my ($ip_hex) = @_;
-
-    my $ip_dec;
-
-    if( $ip_hex =~ /0x(\w{2})(\w{2})(\w{2})(\w{2})/ ){
-        $ip_dec = hex($1) . "." . hex($2) . "." . hex($3) . "." . hex($4);
-    }
-    else{
-        print "getIP_hex2dec(): cannot extract ip address because of diferent format! Exit.";
-        exit(0);
-    }
-
-    return $ip_dec;
-}
-
-sub getPort_hex2dec()
-{
-    my ($port_hex) = @_;
-
-    my $port_dec;
-
-    if( $port_hex =~ /0x(\w+)/ ){
-        $port_dec = hex($1);
-    }
-    else{
-        print "getPort_hex2dec(): cannot extract port number because of diferent format! Exit.";
-        exit(0);
-    }
-
-    return $port_dec;
-}
-
-sub getIP_hades2gsi()
-{
-    my ($ip_hades) = @_;
-    my $ip_gsi = "";
-    if (exists $IP_GSI_href->{$ip_hades}){ 
-      $ip_gsi = $IP_GSI_href->{$ip_hades};
-    }
-    else {
-      print "getIP_hades2gsi(): WARNING - unknown hades ip $ip_hades";
-    }
-    return $ip_gsi;
-}
-
-
-
-
-sub isFileDefined()
-{
-    my ($fh, $name) = @_;
-
-   if(!$fh) {
-        my $txt = "\nError! Could not open file \'$name\'. Exit.\n";
-        print STDERR $txt;
-        print $txt;
-        exit(128);
-    }
-
-    return 0;
-}
-
-sub writeArgs2file()
-{
-    my $fileName = $0;
-
-    #- Replace .pl with .sh
-    $fileName =~ s/\.pl/\.sh/;
-
-    my $fh = new FileHandle(">./$fileName");
-    if(!$fh) {
-        my $txt = "\nError! Could not open file \"$fileName\" for output. Exit.\n";
-        print STDERR $txt;
-        print $txt;
-        exit(128);
-    }
-
-    my $current_dir = cwd();
-    my $ptogName = $0;
-
-
-    #- Write to the file the script name itself
-    print $fh $0;
-
-    #- Write to the file the arguments
-    foreach my $arg (@arg_list){
-        print $fh " $arg";
-    }
-    print $fh ";\n";
-    
-    ## do not start te files by default. user should actively restart the file JAM 29-06-2018
-    # here put command to start the correct file prefix in bnet builders:
-    #my $prefix=$EB_Args_href->{0}->{'PREFIX'};
-    #print $fh "/usr/bin/wget  -a /tmp/EB_filestart.log  -O /tmp/EB_fileres.txt \"http://lxhadeb03:8090/Master/BNET/StartRun/execute?prefix=$prefix&oninit=10\"\n"; 
-    
-    
-    $fh->close();
-
-    system("chmod 755 ./$fileName");
-}
-
diff --git a/evtbuild/start_eb_gbe_oldservers.pl b/evtbuild/start_eb_gbe_oldservers.pl
deleted file mode 100755 (executable)
index b6ea629..0000000
+++ /dev/null
@@ -1,2063 +0,0 @@
-#!/usr/bin/perl -w
-
-use English;
-use strict;
-use Getopt::Long;
-use Data::Dumper;
-use Config::Std;
-use FileHandle;
-use List::MoreUtils qw(any apply first_index);
-use File::Basename;
-use Cwd;
-
-#- Copy all the arguments because
-#  later on the @ARGV becomes empty
-my @arg_list = @ARGV;
-
-#- the command line option flags
-my $opt_help    = 0;
-my $opt_ebconf  = "/home/hadaq/trbsoft/hadesdaq/evtbuild/eb.conf";
-my $opt_ioc = "";
-my $opt_test = 0;
-my $opt_verb = 0;
-my $opt_eb = "";
-my @opt_ebrange = ();
-my $opt_rfio = 'undef';
-my $opt_disk = 'undef';
-my $opt_online = 'undef';
-my $opt_bnet = 3;
-my $opt_prefix;
-
-GetOptions ('h|help'      => \$opt_help,
-            'c|conf=s'    => \$opt_ebconf,
-            'e|eb=s'      => \$opt_eb,
-            'i|ioc=s'     => \$opt_ioc,
-            't|test'      => \$opt_test,
-            'n|nr=s'      => \@opt_ebrange,
-            'd|disk=s'    => \$opt_disk,
-            'r|rfio=s'    => \$opt_rfio,
-            'p|prefix=s'  => \$opt_prefix,
-            'o|online=s'  => \$opt_online,
-            'b|bnet=s'    => \$opt_bnet,            
-            'v|verb'      => \$opt_verb);
-
-if( $opt_help ) {
-    &help();
-    exit(0);
-}
-
-#- List of EBs provided via command line options
-my $active_EBs_aref = &setArgs();
-
-#- Hash with status of CPU cores of EBs (used for 'taskset')
-my %EB_CPU_status;
-my $EB_CPU_status_href = \%EB_CPU_status;
-&init_CPU_status($EB_CPU_status_href);
-
-my $expect_ioc_script = "/tmp/ioc_exit.exp";
-my $log_path          = "/tmp/log"; 
-my %temp_args;
-my $temp_args_href = \%temp_args;
-read_config $opt_ebconf => %$temp_args_href;
-#print Dumper $temp_args_href;
-#exit;
-
-# my %IP_GSI_lookup = (
-#     '192.168.100.15'   => '140.181.66.160',
-#     '192.168.100.12'   => '140.181.76.94',
-#     '192.168.100.13'   => '140.181.91.154',
-#     '192.168.100.14'   => '140.181.88.20',
-#     '192.168.100.8'    => '140.181.80.62',
-#     '192.168.100.9'    => '140.181.80.64',
-#     '192.168.100.10'   => '140.181.80.68'
-#   );
-  
-  
- my %IP_GSI_lookup = (
-    '192.168.100.15'   => 'lxhadeb05',
-    '192.168.100.12'   => 'lxhadeb02',
-    '192.168.100.13'   => 'lxhadeb03',
-    '192.168.100.14'   => 'lxhadeb04',
-    '192.168.100.8'    => 'lxhadeb08',
-    '192.168.100.9'    => 'lxhadeb09',
-    '192.168.100.10'    => 'lxhadeb10'
-  );
-   
-  
-my $IP_GSI_href = \%IP_GSI_lookup;
-
-
-my $numOfEBProcs = 0;
-my %EB_Args;
-my $EB_Args_href = \%EB_Args;
-
-my @EB_IP_list;
-
-
-
-&getEBArgs( $EB_Args_href );
-
-if($opt_ioc eq "start"){
-    &killIOC();
-    &startIOC();
-}
-elsif($opt_ioc eq "stop"){
-    &killIOC();
-}
-elsif($opt_eb eq "start"){
-    &writeArgs2file();
-    &startEvtBuilders();
-}
-elsif($opt_eb eq "stop"){
-    &stopEvtBuilders();
-}
-elsif($opt_eb eq "restart"){
-    &stopEvtBuilders();
-    sleep 1;
-    &writeArgs2file();
-    &startEvtBuilders();
-}
-
-exit(0);
-
-################### END OF MAIN ####################
-
-sub help()
-{
-    print "\n";
-    print << 'EOF';
-start_eb_gbe.pl
-
-   This script starts parallel Event Building processes.
-   The script also starts IOC processes for the run control.
-
-Usage:
-
-   Command line:  start_eb_gbe.pl 
-   [-h|--help]                     : Show this help.
-   [-c|--conf <path/name>]         : Path to the config file (default: ../evtbuild/eb.conf).
-   [-e|--eb <start|stop|restart>]  : Start or stop Event Builders (default: start).
-   [-i|--ioc <start|stop>]         : Start or stop IOCs (default: start).
-   [-n|--nr <rangeOfEBs>]          : Range of numbers of Event Bulders to be started.
-   [-d|--disk <on|off>]            : Switch writing to disk on|off.
-   [-r|--rfio <on|off>]            : Switch writing to tape on|off.
-   [-p|--prefix <prefix>]          : Prefix of hld file.
-   [-o|--online <on|off>]          : Switch RPC server on|off.
-   [-b|--bnet <on|off>]            : Specify number of bnet builder nodes(default: 3).   
-   [-t|--test]                     : Test without execution.
-   [-v|--verb]                     : More verbouse.
-
-Examples:
-
-   Start 6 EBs with the numbers 1,2,3,5,7 and prefix 'md':
-   start_eb_gbe.pl -e start -n 1-3 -n 5 -n 7 -p md
-
-   Start EBs and enable writing to disks but disable writing to tape for all EBs:
-   start_eb_gbe.pl -e start --disk on --rfio off
-
-EOF
-}
-
-sub init_CPU_status()
-{
-    my ($EB_CPU_status_href) = @_;
-
-    # CPU affinity with 'taskset'
-    #
-    # CPU dec     bin  hex
-    #     0         1    1
-    #     1        10    2 
-    #     2       100    4
-    #     3      1000    8
-    #     4     10000   10 
-
-    #cores 0/1 reserved for system 02-05
-    #cores 2/3 reserved for interrupts on 02-05
-
-#lxhadeb01 is gone    
-#     foreach my $core (0..7){
-#         if($core == 1){
-#             $EB_CPU_status_href->{'192.168.100.11'}->{$core} = "res"; #reserved
-#         }
-#         else{
-#             $EB_CPU_status_href->{'192.168.100.11'}->{$core} = "free";
-#         }
-#     }
-
-#JAM adjust this to actual affinities for eth0 settings TODO
-# eth0 interrupts are above core 8 now
-#  
-#     
-#    foreach my $core (0..11){
-#         if(($core < 2) || ($core> 8 ) ){
-#             $EB_CPU_status_href->{'192.168.100.12'}->{$core} = "res"; #reserved
-#             $EB_CPU_status_href->{'192.168.100.13'}->{$core} = "res"; #reserved
-#             $EB_CPU_status_href->{'192.168.100.14'}->{$core} = "res"; #reserved
-#         }
-#         else{
-#             $EB_CPU_status_href->{'192.168.100.12'}->{$core} = "free";
-#             $EB_CPU_status_href->{'192.168.100.13'}->{$core} = "free";
-#             $EB_CPU_status_href->{'192.168.100.14'}->{$core} = "free";
-#         }
-#     }
-#        
-## after upgrade to debian 7: ethernet reserved cores are below 6
-#   foreach my $core (0..11){
-#         if(($core < 6) ){
-#             $EB_CPU_status_href->{'192.168.100.12'}->{$core} = "res"; #reserved
-#             $EB_CPU_status_href->{'192.168.100.13'}->{$core} = "res"; #reserved
-#             $EB_CPU_status_href->{'192.168.100.14'}->{$core} = "res"; #reserved
-#         }
-#         else{
-#             $EB_CPU_status_href->{'192.168.100.12'}->{$core} = "free";
-#             $EB_CPU_status_href->{'192.168.100.13'}->{$core} = "free";
-#             $EB_CPU_status_href->{'192.168.100.14'}->{$core} = "free";
-#             
-#         }
-#     }
-    
-# eth0 ir is set above core 11   
-    foreach my $core (0..23){
-        if( ($core < 2) ||( $core > 11) ){
-            $EB_CPU_status_href->{'192.168.100.15'}->{$core} = "res"; #reserved
-        }
-        else{
-            $EB_CPU_status_href->{'192.168.100.15'}->{$core} = "free";
-        }
-    }
-    
-    # add cores for new EB servers JAM2018
-   foreach my $core (0..63){
-    #    if( ($core < 2) ||( $core > 60) ){
-    # JAM2018: we only want cores of the lower half with common memory access for input nodes
-        if( ( $core > 31) ){ 
-            $EB_CPU_status_href->{'192.168.100.8'}->{$core} = "res"; #reserved
-           $EB_CPU_status_href->{'192.168.100.9'}->{$core} = "res"; #reserved
-           $EB_CPU_status_href->{'192.168.100.10'}->{$core} = "res"; #reserved
-            }
-        else{
-            $EB_CPU_status_href->{'192.168.100.8'}->{$core} = "free";
-           $EB_CPU_status_href->{'192.168.100.9'}->{$core} = "free";
-           $EB_CPU_status_href->{'192.168.100.10'}->{$core} = "free";
-        }
-    }  
-
-    # alternative setup: specifiy cpu bitmasks for different roles:
-    
-    $EB_CPU_status_href->{'192.168.100.15'}->{'input'} = "0-23";
-    $EB_CPU_status_href->{'192.168.100.15'}->{'build'} = "0-23";
-    
-    # JAM12-2018: reserve lower 32 cpus for network interrupts, ebs use only upper half
-    $EB_CPU_status_href->{'192.168.100.8'}->{'input'} = "32-47";
-    $EB_CPU_status_href->{'192.168.100.8'}->{'build'} = "48-63";
-    $EB_CPU_status_href->{'192.168.100.9'}->{'input'} = "32-47";
-    $EB_CPU_status_href->{'192.168.100.9'}->{'build'} = "48-63";
-    $EB_CPU_status_href->{'192.168.100.10'}->{'input'} = "32-47"; #"32-55"; #0-31
-    $EB_CPU_status_href->{'192.168.100.10'}->{'build'} = "48-63"; # 32-63
-    
-}
-
-sub getCoreNr()
-{
-    #my ($ip) = @_;
-    my ($ip, $role) = @_;
-    my $core_nr;
-    if(defined $role)
-    {
-    
-       $core_nr = $EB_CPU_status_href->{$ip}->{$role}
-    }
-    else
-    {
- ################### begin old       
-
-    foreach my $eb_ip (sort keys %$EB_CPU_status_href){
-        next unless($ip eq $eb_ip);
-            
-        foreach my $core ( sort {$a <=> $b} keys %{$EB_CPU_status_href->{$eb_ip}} ){
-            my $core_status = $EB_CPU_status_href->{$eb_ip}->{$core};
-            
-            next unless(lc($core_status) eq "free");
-
-            $core_nr = $core;
-            $EB_CPU_status_href->{$eb_ip}->{$core} = "busy";
-            last;
-        }
-    }
-
-    #- If no free cores left - take reserved cores
-    unless( defined $core_nr ){
-        foreach my $eb_ip (sort keys %$EB_CPU_status_href){
-            next unless($ip eq $eb_ip);
-            
-            foreach my $core ( sort {$a <=> $b} keys %{$EB_CPU_status_href->{$eb_ip}} ){
-                my $core_status = $EB_CPU_status_href->{$eb_ip}->{$core};
-                
-                if(lc($core_status) eq "res"){
-                    $core_nr = $core;
-                    $EB_CPU_status_href->{$eb_ip}->{$core} = "busy";
-                    last;
-                }
-            }
-        }
-    }
-    
-################### end old    
-}
-    unless( defined $core_nr ){
-        print "No free cores left on CPU $ip. Exit.\n";
-        exit(0);
-    }
-
-    print "found core numbers $core_nr for node $ip, role $role\n";  
-    return $core_nr;
-}
-
-sub setArgs()
-{
-    my @active_EBs;
-
-    if(@opt_ebrange){
-        foreach my $range (@opt_ebrange){
-            if($range =~ /(\d+)-(\d+)/){
-                my $max = $1;
-                my $min = $2;
-                
-                foreach my $eb ($max..$min){
-                    #- 1 must be subtracted to match
-                    #  EB numbering in the register_configgbe_ip.db
-                    #  which starts from zero
-                    &checkEB_nr($eb);
-                    push(@active_EBs, $eb-1);
-                }
-            }
-            elsif($range =~ /(\d+)/){
-                &checkEB_nr($1);
-                push(@active_EBs, $1-1);
-            }
-        }
-    }
-
-    return \@active_EBs;
-}
-
-sub checkEB_nr()
-{
-    my ($eb_nr) = @_;
-
-    if( $eb_nr < 1 || $eb_nr > 16 ){
-        print "ERROR: EB number should be in the range 1-16. Exit.";
-        exit(0);
-    }
-}
-
-sub getEBArgs()
-{
-    my ($href) = @_;
-
-    my $prefix = $temp_args_href->{'Main'}->{'EB_EXT'};
-    $prefix = $opt_prefix if( defined $opt_prefix );
-    my $filesize = $temp_args_href->{'Main'}->{'EB_FSIZE'};
-
-    my $base_port  = $temp_args_href->{'Parallel'}->{'BASE_PORT'};
-    my $shift_port = $temp_args_href->{'Parallel'}->{'SHIFT_PORT'};
-    my $source_num = $temp_args_href->{'Parallel'}->{'NUM_OF_SOURCES'};
-    my $queuesize  = $temp_args_href->{'Parallel'}->{'QUEUESIZE'};
-
-    my $multidisk  = $temp_args_href->{'Parallel'}->{'MULTIDISK'};
-
-    #- Number of EB process
-    my $ebproc = 0;
-
-    #- List of BEs
-    my $listOfEBs = $temp_args_href->{'Parallel'}->{'EB_LIST'};
-    my @eb_list = split(/\s+/, $listOfEBs);
-
-    #- DABC mode selection
-    my $listOfDABC = $temp_args_href->{'Parallel'}->{'DABC'};
-    my @dabc_list = split(/\s+/, $listOfDABC);
-    
-    
-    # BNET setup:
-     my $listOfBnetInputs = $temp_args_href->{'Parallel'}->{'BNETINP'};
-     my @bnet_in_list = split(/\s+/, $listOfBnetInputs);
-     
-     my $listOfBnetBuilders = $temp_args_href->{'Parallel'}->{'BNETBLD'};
-     my @bnet_bld_list = split(/\s+/, $listOfBnetBuilders);
-     
-
-    #- Default RFIO settings
-    my $rfio               = $temp_args_href->{'Parallel'}->{'RFIO'};
-    my $rfio_path          = $temp_args_href->{'Parallel'}->{'RFIO_PATH'};
-    my $rfio_pcOptions     = $temp_args_href->{'Parallel'}->{'RFIO_pcOptions'};
-    my $rfio_iCopyMode     = $temp_args_href->{'Parallel'}->{'RFIO_iCopyMode'};
-    my $rfio_pcCopyPath    = $temp_args_href->{'Parallel'}->{'RFIO_pcCopyPath'};
-    my $rfio_iCopyFrac     = $temp_args_href->{'Parallel'}->{'RFIO_iCopyFraction'};
-    my $rfio_iMaxFile      = $temp_args_href->{'Parallel'}->{'RFIO_iMaxFile'};
-    my $rfio_iPathConv     = $temp_args_href->{'Parallel'}->{'RFIO_iPathConvention'};
-    
-    my @rfio_list = split(/\s+/, $rfio);
-    
-    
-    
-    #- LTSM settings
-    my $listOfLTSM = $temp_args_href->{'Parallel'}->{'LTSM'};
-    my @ltsm_list = split(/\s+/, $listOfLTSM);
-    
-    my $ltsm_path          = $temp_args_href->{'Parallel'}->{'LTSM_PATH'};
-    my $ltsm_server        = $temp_args_href->{'Parallel'}->{'LTSM_Server'};
-    my $ltsm_node          = $temp_args_href->{'Parallel'}->{'LTSM_Node'};
-    my $ltsm_passwd        = $temp_args_href->{'Parallel'}->{'LTSM_Passwd'};
-    my $ltsm_filesys       = $temp_args_href->{'Parallel'}->{'LTSM_Filesystem'};
-    
-    
-    
-    
-    #- EPICS Controled 
-    my $epics_ctrl = $temp_args_href->{'Parallel'}->{'EPICS_CTRL'};
-
-    my @epics_list = split(/\s+/, $epics_ctrl);
-
-     #- Logging the output of EBs
-    my $eb_log     = $temp_args_href->{'Parallel'}->{'EB_LOG'};
-    my $eb_debug     = $temp_args_href->{'Parallel'}->{'EB_DEBUG'};
-    my $nm_log     = $temp_args_href->{'Parallel'}->{'NM_LOG'};
-    my @eblog_list =  split(/\s+/, $eb_log);
-    my @ebdbg_list =  split(/\s+/, $eb_debug);
-    my @nmlog_list =  split(/\s+/, $nm_log);
-
-    
-    #- Write to disk
-    my $write2disk = $temp_args_href->{'Parallel'}->{'WRITE_TO_DISK'};
-    my @write2disk_list = split(/\s+/, $write2disk);
-
-    #--- Read GbE configuration
-    my %eb_ids_gbe_hash;
-    my $eb_ids_gbe_href = \%eb_ids_gbe_hash;
-
-    &getGbEconfig($eb_ids_gbe_href);
-
-    #--- Loop over all EB processes
-    #print Dumper $eb_ids_gbe_href;
-    #exit;
-    foreach my $ebproc ( sort keys %{$eb_ids_gbe_href} ){
-
-        #- If there was a list of EBs provided via command line options
-        #  go to the next $ebproc if the current $ebproc is not in this list.
-        #print "active EBs:\n";
-        #print Dumper $active_EBs_aref;
-
-        if(@$active_EBs_aref){
-            next unless( any {$_ == $ebproc} @$active_EBs_aref );  #from command line args
-        }
-        else{
-            next unless( $eb_list[$ebproc] );  #from eb.conf
-        }
-
-
-        my $eb_ip = $eb_ids_gbe_href->{$ebproc}->{'IP'};
-
-        #- Save IP needed by other function to stop EBs.
-        push(@EB_IP_list, $eb_ip) unless( any {$_ eq $eb_ip} @EB_IP_list );
-
-        #- Some checks on number of EB processes
-        die "Number of EB processes exceeds the number in RFIO setting! Exit." if($ebproc > $#rfio_list);
-        die "Number of EB processes exceeds the number in EPICS_CTRL setting! Exit." if($ebproc > $#epics_list);
-        
-        #- Here we can overwrite default rfio settings with individual settings per EB processes
-        my $procname = sprintf("EB_PROC_%d", 1+$ebproc);
-        # $rfio_iCopyMode     = $temp_args_href->{$procname}->{'RFIO_iCopyMode'};
-        
-        $href->{$ebproc}->{'IP'}        = $eb_ip;
-        $href->{$ebproc}->{'EBNUM'}     = $ebproc+1;
-        $href->{$ebproc}->{'BASEPORT'}  = $base_port;
-        $href->{$ebproc}->{'PORT_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'port_list'};
-        $href->{$ebproc}->{'SOURCENUM'} = scalar @{$eb_ids_gbe_href->{$ebproc}->{'port_list'}};
-
-        # JAM2016: bnet requieres udp destination nodes in a list like the ports:
-        $href->{$ebproc}->{'IP_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'ip_list'};
-        
-        # JAM2018: bnet requieres calibration modes in a list like the ports:
-        $href->{$ebproc}->{'CALIB_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'calib_list'};
-        
-        # JAM2018: bnet requires hub addresses/subevents in a list like the ports:
-        $href->{$ebproc}->{'HUB_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'addr_list'};
-        
-        
-        $href->{$ebproc}->{'BUFSIZE_LIST'} = $eb_ids_gbe_href->{$ebproc}->{'bufsize_list'};
-        $href->{$ebproc}->{'PREFIX'}    = $prefix;
-        $href->{$ebproc}->{'QUEUESIZE'} = $queuesize;
-        $href->{$ebproc}->{'MULTIDISK'} = $multidisk;
-        $href->{$ebproc}->{'FILESIZE'} = $filesize;
-
-        if( defined $temp_args_href->{$procname}->{'MULTIDISK'} ){
-            $href->{$ebproc}->{'MULTIDISK'} = $temp_args_href->{$procname}->{'MULTIDISK'};
-        }
-        elsif($multidisk){
-            $href->{$ebproc}->{'MULTIDISK'} = $href->{$ebproc}->{'EBNUM'};
-        }
-        else{
-            $href->{$ebproc}->{'MULTIDISK'} = $multidisk;
-        }
-
-        if( defined $temp_args_href->{$procname}->{'RESDOWNSCALE'} ){
-            $href->{$ebproc}->{'RESDOWNSCALE'} = $temp_args_href->{$procname}->{'RESDOWNSCALE'};
-            $href->{$ebproc}->{'RESNUMEVENTS'} = $temp_args_href->{$procname}->{'RESNUMEVENTS'};
-            $href->{$ebproc}->{'RESPATH'}      = $temp_args_href->{$procname}->{'RESPATH'};
-            $href->{$ebproc}->{'RESSIZELIMIT'} = $temp_args_href->{$procname}->{'RESSIZELIMIT'};
-        }
-
-        if( defined $temp_args_href->{$procname}->{'ONLINESERVER'} ){
-            if($opt_online eq "on"){
-                $href->{$ebproc}->{'ONLINESERVER'} = "on";
-            }
-            elsif($opt_online eq "off"){
-                $href->{$ebproc}->{'ONLINESERVER'} = "off";
-            }
-            else{
-                $href->{$ebproc}->{'ONLINESERVER'} = $temp_args_href->{$procname}->{'ONLINESERVER'};
-            }
-        }
-        else{
-            $href->{$ebproc}->{'ONLINESERVER'} = "off";
-        }
-
-        $href->{$ebproc}->{'RFIO'}             = $rfio_list[$ebproc] if(lc($opt_rfio) eq 'undef');  # 0|1
-        $href->{$ebproc}->{'RFIO'}             = 1 if(lc($opt_rfio) eq 'on');  # 0|1
-        $href->{$ebproc}->{'RFIO'}             = 0 if(lc($opt_rfio) eq 'off');  # 0|1
-        $href->{$ebproc}->{'RFIO_PATH'}        = $rfio_path;
-        $href->{$ebproc}->{'RFIO_pcOptions'}   = $rfio_pcOptions;
-        $href->{$ebproc}->{'RFIO_iCopyMode'}   = $rfio_iCopyMode;
-        $href->{$ebproc}->{'RFIO_pcCopyPath'}  = $rfio_pcCopyPath;
-        $href->{$ebproc}->{'RFIO_iCopyFrac'}   = $rfio_iCopyFrac;
-        $href->{$ebproc}->{'RFIO_iMaxFile'}    = $rfio_iMaxFile;
-        $href->{$ebproc}->{'RFIO_iPathConv'}   = $rfio_iPathConv;
-        
-        
-        
-        $href->{$ebproc}->{'LTSM'}             = $ltsm_list[$ebproc];  # 0|1
-        $href->{$ebproc}->{'LTSM_PATH'}        = $ltsm_path;
-        $href->{$ebproc}->{'LTSM_Server'}      = $ltsm_server;
-        $href->{$ebproc}->{'LTSM_Node'}        = $ltsm_node;
-        $href->{$ebproc}->{'LTSM_Passwd'}      = $ltsm_passwd;
-        $href->{$ebproc}->{'LTSM_Filesystem'}  = $ltsm_filesys;
-        
-
-        $href->{$ebproc}->{'EPICS_CTRL'}       = $epics_list[$ebproc];  # 0|1
-
-       $href->{$ebproc}->{'DABC'}             = $dabc_list[$ebproc];  # 0|1
-
-       $href->{$ebproc}->{'EB_DEBUG'}         = $ebdbg_list[$ebproc];  # 0|1
-
-        $href->{$ebproc}->{'EB_LOG'}           = $eblog_list[$ebproc];  # 0|1
-        $href->{$ebproc}->{'NM_LOG'}           = $nmlog_list[$ebproc];  # 0|1
-        
-        
-        if($ebproc<4)
-        {
-        # note that for bnet setup, index does not mean eb number, but machine number!
-        # we misuse this here to save complexity of setup
-         $href->{$ebproc}->{'BNET_INP'}       = $bnet_in_list[$ebproc];  # 0|1|2...
-         $href->{$ebproc}->{'BNET_BLD'}       = $bnet_bld_list[$ebproc];  # 0|1|2|3
-        }
-       
-        
-        if( $write2disk_list[$ebproc] && lc($opt_disk) eq 'undef' ){
-            if(&isVarDefined($temp_args_href->{$procname}->{'OUTDIR'}, "OUTDIR for $procname")){
-                $href->{$ebproc}->{'OUTDIR'} = $temp_args_href->{$procname}->{'OUTDIR'};
-            }
-        }
-        elsif( lc($opt_disk) eq 'on' ){
-            if(&isVarDefined($temp_args_href->{$procname}->{'OUTDIR'}, "OUTDIR for $procname")){
-                $href->{$ebproc}->{'OUTDIR'} = $temp_args_href->{$procname}->{'OUTDIR'};
-            }
-        }
-        elsif( lc($opt_disk) eq 'off' ){
-            #- do not do anything. If $href->{$ebproc}->{'OUTDIR'} is undefined, 
-            #  the data will go to /dev/null
-        }
-    }    
-
-    $numOfEBProcs = $ebproc;
-}
-
-sub isVarDefined()
-{
-    my ($var, $msg) = @_;
-
-    my $retval = 1;
-
-    unless( defined $var ){
-        print "Undefined variable found: $msg\n";
-        $retval = 0;
-    }
-        
-    return $retval;
-}
-
-sub getVarSizeArg()
-{
-    my ($ebproc) = @_;
-    
-    my $i = 0;
-    my $arg = " ";
-
-    foreach my $size (@{$EB_Args_href->{$ebproc}->{'BUFSIZE_LIST'}}){
-
-        if($EB_Args_href->{$ebproc}->{'BUFSIZE_LIST'}->[$i] == 
-           $EB_Args_href->{$ebproc}->{'QUEUESIZE'}){
-            $i++;
-            next;
-        }
-
-        $arg = $arg . " -Q " . $i . ":" . $EB_Args_href->{$ebproc}->{'BUFSIZE_LIST'}->[$i];
-        $i++;
-    }
-
-    return $arg;
-}
-
-
-sub startBnet()
-{
-# here we launch the dabc bnet.
-# parameters in eb.conf can specify how many input and builder processes run on each node.
-# we misuse daq gbe setup for EB 15 to specify ports and destination nodes.
-my (@process_list);
-#my $ebproc =15;
-# new: test with setup for first EB
-my $ebproc =0;
-  my $username = "hadaq";
-  my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.head; ";
-# here test special installations:
-  my $cdworkdir = "cd /home/hadaq/oper;";
-
-  my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.head ";
-#   my $cmd_dabc = "/usr/bin/gdb  -x /home/hadaq/soft/dabc/head/base/run/gdbcmd.txt --args /home/hadaq/soft/dabc/bin/dabc_exe.head ";
-
-   
-  my $conf_bnet_inp = " BnetInputHades.head.xml";
-  my $conf_bnet_bld = " BnetBuilderHades.head.xml";
-   
-  my @bnetservers = ("192.168.100.8","192.168.100.9","192.168.100.10","192.168.100.15");
-
-  # variable master node now:
-  my $bnetmaster = "lxhadeb07";
-  #lxhadeb07";
-  
-# before we start inidividual bnet processes, need to evaluate list of ports and nodes:
-# BNETSENDERS=[localhost:12501,localhost:12502]
-# BNETRECEIVERS= [localhost:12101,localhost:12102] 
-# HADAQPORTS =[50000,50001,50002]
-
-my $bnetsenders = "[";
-my $bnetrcvs = "[";
-my @bnet_port_list   = ();
-my @bnet_calib_list  = ();
-my @bnet_subevt_list = ();
-my $firstsnd = 1;
-my $firstrcv = 1;
-
- my $maxbuilders=3; # do not use lxhadeb05 for data writing
-    if ($opt_bnet>0 && $opt_bnet <16) {
-      $maxbuilders=$opt_bnet;
-    }
-    
-   print "Using $maxbuilders event builder nodes from option -b $opt_bnet\n";     
-my $totalbuilders=0;
-my @localbuilders = (0,0,0,0);
-while($totalbuilders < $maxbuilders)
-{
-    my $lasttotalbuilders=$totalbuilders;
-    for ( my $ebserver=0; $ebserver<4; $ebserver=$ebserver+1){
-         my $bnet_numbuilders =  $EB_Args_href->{$ebserver}->{'BNET_BLD'};
-         if($totalbuilders < $maxbuilders)
-           {
-             if($localbuilders[$ebserver] < $bnet_numbuilders)
-                 {
-                     $localbuilders[$ebserver]++;
-                     $totalbuilders++;
-                     #  print "Added 1 builder on EB server: $ebserver\n";
-                 }
-           }
-         }
-     if ($totalbuilders==$lasttotalbuilders){ last;} # more ebs demanded than configured             
-}
-
- for ( my $ebserver=0; $ebserver<4; $ebserver=$ebserver+1){
-         print "Found $localbuilders[$ebserver]  builders on EB server: $ebserver\n";
-         }
-
-my $rcvport = 12100;
-for ( my $ebserver=0; $ebserver<4; $ebserver=$ebserver+1){
-         print "Gathering processes at EB server: $ebserver\n";
-      my $sendport = 12501;
-      my $ip = $bnetservers[$ebserver];
-
-      
-      # JAM2018 - need to transform HADES VLAN IPs into GSI VLAN for BNET!
-      my $gsi_ip = getIP_hades2gsi($ip);
-      
-      # array of BNET values is already indexed with server id:
-      my $bnet_numsenders =  $EB_Args_href->{$ebserver}->{'BNET_INP'};
-      #my $bnet_numbuilders =  $EB_Args_href->{$ebserver}->{'BNET_BLD'};
-      for (my $six=0; $six<$bnet_numsenders; $six=$six+1)
-      {
-       $bnetsenders=$bnetsenders . "," unless ($firstsnd>0);
-       $bnetsenders=$bnetsenders . $gsi_ip.":". $sendport;
-       $sendport=$sendport+1;
-       $firstsnd=0 if($firstsnd>0);
-      }
-      
-      
-       for (my $rix=0; $rix<$localbuilders[$ebserver]; $rix=$rix+1)
-       {
-           $bnetrcvs=$bnetrcvs . "," unless ($firstrcv>0);
-           $bnetrcvs=$bnetrcvs . $gsi_ip.":". $rcvport;
-           $rcvport=$rcvport+1;
-           $firstrcv=0 if($firstrcv>0);
-       }      
-      my $hadaqports = "[";
-      my $calibflags = "[";
-      my $subevents  = "[";
-      my $firstport = 1;
-      
-  
-        #- add ports: note that we only use eb 15 setup and do check which ports belong to our eb server:
-       my $ix =0;
-        foreach my $port (@{$EB_Args_href->{$ebproc}->{'PORT_LIST'}}){ 
-           # here we only gather such ports that are assigned to our node:
-           # todo: how to distribute the ports to more than one bnet input process per server?
-           my $cflag = $EB_Args_href->{$ebproc}->{'CALIB_LIST'}[$ix];
-           my $hub = $EB_Args_href->{$ebproc}->{'HUB_LIST'}[$ix];
-           #print "ip" . $ip . " with port:" . $port ." index:" . $ix . " ip: ". $EB_Args_href->{$ebproc}->{'IP_LIST'}[$ix] . " calib: ". $cflag ." hub: ". $hub ."\n" ;
-           if($ip eq $EB_Args_href->{$ebproc}->{'IP_LIST'}[$ix])
-           {
-             $hadaqports=$hadaqports . "," unless ($firstport>0);
-             $hadaqports = $hadaqports . $port;
-             $calibflags=$calibflags . "," unless ($firstport>0);
-             $calibflags = $calibflags . $cflag;
-             $subevents=$subevents . "," unless ($firstport>0);
-             $subevents = $subevents . $hub;
-             $firstport=0 if($firstport>0);
-           }
-           $ix++;
-         
-    }
-    $hadaqports=$hadaqports . "]";   
-    push(@bnet_port_list, $hadaqports); # ports are per server
-    
-    $calibflags=$calibflags . "]";   
-    push(@bnet_calib_list, $calibflags); # flags per server
-    
-    $subevents=$subevents . "]";   
-    push(@bnet_subevt_list, $subevents); # flags per server
-    
-    
-    
-    print "node ". $gsi_ip . " uses ports ".$hadaqports . ", calibflags " .$calibflags . " hubs: ". $subevents ."\n";
-}
-$bnetsenders = $bnetsenders . "]";
-$bnetrcvs = $bnetrcvs . "]";
-
-print "bnetsenders: ".   $bnetsenders ."\n";
-print "bnetreceivers: ". $bnetrcvs ."\n";
-
-  my $portid=0; #
-  my $sendid=0;
-   my $bnebport=12100;
-for ( my $ebserver=0; $ebserver<4; $ebserver=$ebserver+1){
-         print "Starting input processes on EB server: $ebserver\n";
-         my $ebid=$ebserver + 1; # still need unique eventbuilder ids on cluster because of epics!
-        
-         my $cpu = $bnetservers[$ebserver];
-
-         my $gsi_cpu = getIP_hades2gsi($cpu);
-        # in the following, the port and ip setup of the bnet is taken from ebproc 15 or 0 only!
-        
-        my $bnet_numsenders =  $EB_Args_href->{$ebserver}->{'BNET_INP'};
-        #my $bnet_numbuilders =  $EB_Args_href->{$ebserver}->{'BNET_BLD'};
-        print "found $bnet_numsenders senders on node $cpu \n";
-       
-        
-        
-        my $bninpport=12501;
-        
-        # loop over senders on this node and start them:
-        for(my $sender=0; $sender<$bnet_numsenders; $sender=$sender+1)
-        {
-           
-           #my $sendnum= $sender + 1;
-           
-           my $exports = " export MYHOST=" . $gsi_cpu . ";" .
-               " export BNETMASTER=" . $bnetmaster . ";" .
-               #" export BNINPNUM=" . $sendnum . ";" . # need to use different sender numbers on differentnodes
-               " export BNINPNUM=" . $ebid . ";" . # todo: extend if more than one sender per node
-               " export BNINPID=" . $sendid . "; " .
-               " export BNINPPORT=" . $bninpport . "; " .
-               " export BNETSENDERS=" . $bnetsenders . ";" .
-               " export BNETRECEIVERS=" . $bnetrcvs . ";" .
-               " export HADAQPORTS=" . $bnet_port_list[$ebserver] .";" .
-               " export SUBEVENTS=" . $bnet_subevt_list[$ebserver] .";" .
-               " export CALIBFLAGS=" . $bnet_calib_list[$ebserver] .";";
-               
-         # todo: how to configure situation with more than one bnet input per node? hadaqports must be distributed on them...
-         #     
-               
-       #  my $core_nr = &getCoreNr($cpu) . "," . &getCoreNr($cpu);
-     
-        # my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports taskset -c $core_nr  $cmd_dabc $conf_bnet_inp 1</dev/null &\"";
-        my $core_nr = &getCoreNr($cpu, 'input');
-        # my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports   $cmd_dabc $conf_bnet_inp >senderlog_$cpu.log 2>&1  &\"";
-        #my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports  taskset -c 0-23 $cmd_dabc $conf_bnet_inp >senderlog_$cpu.log 2>&1  &\"";
-        my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports  taskset -c $core_nr $cmd_dabc $conf_bnet_inp >senderlog_$cpu.log 2>&1  &\"";
-
-
-         my $log = $log_path . "/log_" . $ebserver . "_" . "startBnetInp_". $sender. ".txt";
-   #my $log = "/dev/null 2>&1";
-   
-         print "Forking:" . $exe_dabc ."\n";
-         forkMe($exe_dabc, $log, \@process_list) unless($opt_test);
-
-         $sendid = $sendid +1; 
-         $bninpport =  $bninpport +1;  
-               
-         } # bnet sender/input processes
-       
-    } # end senders   
-    # todo: loop over builders
-    
-   for ( my $ebserver=0; $ebserver<4; $ebserver=$ebserver+1){
-         print "Starting builder processes on EB server: $ebserver\n";
-         my $ebid=$ebserver + 1; # still need unique eventbuilder ids on cluster because of epics!
-        
-          my $cpu = $bnetservers[$ebserver];
-       
-########### old       
-         # here we use the fact that first 4 eb processes are assigned to first 4 servers.
-         # so node ip is directly mapped from setup:
-#          my $cpu = $EB_Args_href->{$ebserver}->{'IP'};
-#          if ($ebserver == 0) {
-#             $cpu = '192.168.100.8';
-#      }
-#################
-         my $gsi_cpu = getIP_hades2gsi($cpu);
-        # in the following, the port and ip setup of the bnet is taken from ebproc 15 or 0 only!
-        
-        #my $bnet_numbuilders =  $EB_Args_href->{$ebserver}->{'BNET_BLD'};
-        
-        print "start $localbuilders[$ebserver] builders on node $cpu \n";     
-         
-         
-        
-         for(my $builder=0; $builder<$localbuilders[$ebserver]; $builder=$builder+1)
-        {
-        
-           my $exports = " export MYHOST=" . $gsi_cpu . ";" .
-               " export BNETMASTER=" . $bnetmaster . ";" .
-               " export BNEBNUM=" . $ebid . ";" .
-               " export BNEBID=" . $portid . "; " .
-               " export BNEBPORT=" . $bnebport . "; " .
-               # ignore prefix at startup. always start without files and show it:
-               #" export PREFIX=" . $EB_Args_href->{$ebproc}->{'PREFIX'}. "; " .
-               " export PREFIX=--;" .
-               " export BNETSENDERS=" . $bnetsenders . ";" .
-               " export BNETRECEIVERS=" . $bnetrcvs . ";" .
-               " export HADAQPORTS=" . $bnet_port_list[$ebserver]. "; " ;
-               
-               if($EB_Args_href->{$ebproc}->{'OUTDIR'} ){
-               # no daqdisk demon anymore for raid6-
-               $exports = $exports . "export DAQDISK=0; export OUTDIR=/data01/data; ";
-               
-#              if($EB_Args_href->{$ebproc}->{'MULTIDISK'}){
-#               $exports = $exports . "export DAQDISK=1; export OUTDIR=/data01; ";
-#              }
-#              else{
-#               $exports = $exports . "export DAQDISK=0; export OUTDIR=" . $EB_Args_href->{$ebproc}->{'OUTDIR'} .";";
-#              }
-         
-         
-         
-
-#      }
-          if( $EB_Args_href->{$ebproc}->{'LTSM'} ){
-         
-         $exports = $exports . " export FILEOUTPUTS=3;";
-       # additional exports for LTSM
-
-        $exports = $exports . " export LTSMPATH=". $EB_Args_href->{$ebproc}->{'LTSM_PATH'} . ";";
-         $exports = $exports . " export LTSMSERVER=". $EB_Args_href->{$ebproc}->{'LTSM_Server'} . ";";
-         $exports = $exports . " export LTSMNODE=". $EB_Args_href->{$ebproc}->{'LTSM_Node'} . ";";
-         $exports = $exports . " export LTSMPASSWD=". $EB_Args_href->{$ebproc}->{'LTSM_Passwd'} . ";";
-        $exports = $exports . " export LTSMFSNAME=". $EB_Args_href->{$ebproc}->{'LTSM_Filesystem'} . ";";
-        $exports = $exports . " export DSM_LOG=/home/hadaq/oper/ltsm". $ebid .".log;";
-
-# switch on by number of outputs
-       }
-       
-       else
-       {
-            # no rfio, just local file 
-            $exports = $exports . " export FILEOUTPUTS=2;";
-       }
-
-         
-         
-         
-         } #outdir
-         else{
-               $exports = $exports . " export FILEOUTPUTS=1;";
-               # no output except for the stream server...
-         }
-  
-       #my $core_nr = &getCoreNr($cpu) . "," . &getCoreNr($cpu);
-        my $core_nr = &getCoreNr($cpu, 'build');
-       #my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports taskset -c $core_nr  $cmd_dabc $conf_bnet_bld 1</dev/null &\"";
-       #my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports   $cmd_dabc $conf_bnet_bld  >builderlog_$cpu.log 2>&1  &\"";
-        my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports  taskset -c $core_nr $cmd_dabc $conf_bnet_bld  >builderlog_$cpu.log 2>&1  &\"";
-
-
-       my $log = $log_path . "/log_" . $ebserver . "_" . "startBnetBld_". $builder . ".txt";
-   #my $log = "/dev/null 2>&1";
-   
-       print "Forking:" . $exe_dabc ."\n";
-       forkMe($exe_dabc, $log, \@process_list) unless($opt_test);
-
-       $ebid = $ebid + 4 ; # increment ebnum by 4 per ebserver to re-use EPICS iocs
-#      $ebid = $ebid + 3 ; # increment ebnum for the 3 remaining builder servers
-       $portid = $portid + 1; 
-       $bnebport = $bnebport +1;
-       # 
-    } # builder processes
-        
-  } # servers
- # finally, we need to set eb lut on cts for setup of EB15 => bnet distribution
- #trbcmd w 0x0003 0xa0f0 0x8000`;
- #`trbcmd w 0x0003 0xa0f0 0x1`; 
- `trbcmd setbit 0x0003 0xa0f0 0x1`; 
- # use EB1 as pseude for BNET now
- # all calibration triggers also assigned to pseudo EB15 => bnet distribution for the moment
- #trbcmd w 0x0003 0xa0f3 0xfff`;
- # `trbcmd w 0x0003 0xa0f3 0xff0`; 
- `trbcmd setbit 0x0003 0xa0f3 0xff0`; 
- # use EB1 as pseudo receiver for calib triggers
-  sleep (20); # need to wait until forking is done, otherwise it does not work via gui control xterm
-}
-
-
-
-sub startEvtBuilders()
-{
-    if( $EB_Args_href->{0}->{'BNET_INP'} ){
-    print "Starting Builder network...\n";
-      startBnet();
-      return;
-    }
-    
-#   print "DISABLING regular eventbuilder start for testing!\n";
-#    return;
-########################################
-    my $username = "hadaq";
-
-    my (@process_list);
-
-    foreach my $ebproc (sort {$a <=> $b} keys %$EB_Args_href){
-
-        my $ebnum2print = $ebproc+1;
-        print "EB process: $ebnum2print\n";
-
-if($ebproc==15)
-{
-  print "Ignore eventbuilder 16, setup is reserved for BNET. \n";
-  return;
-}
-        
-        
-# JAM first test if we should activate dabc eventbuilder or old one
-
- if( $EB_Args_href->{$ebproc}->{'DABC'} ){
-    print "Starting DABC process..\n";
-
-#". /home/joern/dabcwork/head/dabclogin;cd /home/joern/dabcwork/head/plugins/hadaq/app; export EBNUM=1; export STREAMS=5; export UDP00=10101; export UDP01=10102; export UDP02=10103; export UDP03=10104; export UDP04=10105 export PREFIX=be; /home/joern/dabcwork/head/bin/dabc_exe EventBuilderHades.xml &" > /dev/null 2>&1  &
-
-  my $cpu = $EB_Args_href->{$ebproc}->{'IP'};
-# JAM old, direct to version
-  #my $dabclogin = ". /home/hadaq/soft/dabc/head/dabclogin;";
-# JAM default:
-#my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin;";#
-#my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.275;";
-  my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.head; ";
-# here test special installations:
-  my $cdworkdir = "cd //home/hadaq/oper;";
-
-# JAM old, direct to version
-#my $cmd_dabc = "/home/hadaq/soft/dabc/head/bin/dabc_exe ";
-# JAM default:
-#my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe ";
-# here test special installations:
-#  my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.275 ";
-my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.head ";
-
-#  my $conf_dabc = " EventBuilderHades.xml";
-# my $conf_dabc = " EventBuilderHades.275.xml";
-  my $conf_dabc = " EventBuilderHades.head.xml";
-  my $exports = " export LC_ALL=C;" .
-               " export EBNUM=" . $EB_Args_href->{$ebproc}->{'EBNUM'} . "; " .
-               " export STREAMS=" . $EB_Args_href->{$ebproc}->{'SOURCENUM'} . "; " .
-               " export PREFIX=" . $EB_Args_href->{$ebproc}->{'PREFIX'}. "; " ;
-
-   my @port_list = ();
-
-        #- add ports
-       my $ix =0;
-        foreach my $port (@{$EB_Args_href->{$ebproc}->{'PORT_LIST'}}){ 
-            #$cmd_nm = $cmd_nm . " -i UDP:0.0.0.0:" . $port;
-           my $index=sprintf("%02d", $ix++);
-            $exports = $exports . " export UDP". $index. "=" . $port . "; "; 
-            push(@port_list, $port);
-     }
-        &cpPortList2EB(\@port_list, $EB_Args_href->{$ebproc}->{'EBNUM'}, $cpu);
-
-
-
-
-
-
-#      MULTIDISK
-
-#- add output type
-
-       if($EB_Args_href->{$ebproc}->{'OUTDIR'} ){            
-             if($EB_Args_href->{$ebproc}->{'MULTIDISK'}){
-                $exports = $exports . "export DAQDISK=1; export OUTDIR=/data01; ";
-             }
-             else{
-                $exports = $exports . "export DAQDISK=0; export OUTDIR=" . $EB_Args_href->{$ebproc}->{'OUTDIR'} .";";
-             }
-         
-         if( $EB_Args_href->{$ebproc}->{'LTSM'} ){
-         
-         $exports = $exports . " export FILEOUTPUTS=3;";
-       # additional exports for LTSM
-
-        $exports = $exports . " export LTSMPATH=". $EB_Args_href->{$ebproc}->{'LTSM_PATH'} . ";";
-         $exports = $exports . " export LTSMSERVER=". $EB_Args_href->{$ebproc}->{'LTSM_Server'} . ";";
-         $exports = $exports . " export LTSMNODE=". $EB_Args_href->{$ebproc}->{'LTSM_Node'} . ";";
-         $exports = $exports . " export LTSMPASSWD=". $EB_Args_href->{$ebproc}->{'LTSM_Passwd'} . ";";
-         $exports = $exports . " export LTSMFSNAME=". $EB_Args_href->{$ebproc}->{'LTSM_Filesystem'} . ";";
-       
-# switch on by number of outputs
-       }
-################## deprecated, keep code for optional testing?
-# JAM 5-2017 - we never run rfio and ltsm in parallel. 
-#       if( $EB_Args_href->{$ebproc}->{'RFIO'} ){
-#          
-#          $exports = $exports . " export FILEOUTPUTS=3;";
-#      # additional exports for RFIO
-# 
-#      $exports = $exports . " export RFIOPATH=". $EB_Args_href->{$ebproc}->{'RFIO_PATH'} . ";";
-#          $exports = $exports . " export RFIOLUSTREPATH=". $EB_Args_href->{$ebproc}->{'RFIO_pcCopyPath'} . ";";
-#          $exports = $exports . " export RFIOCOPYMODE=". $EB_Args_href->{$ebproc}->{'RFIO_iCopyMode'} . ";";
-#          $exports = $exports . " export RFIOCOPYFRAC=". $EB_Args_href->{$ebproc}->{'RFIO_iCopyFrac'} . ";";
-#          $exports = $exports . " export RFIOMAXFILE=". $EB_Args_href->{$ebproc}->{'RFIO_iMaxFile'} . ";";
-#          $exports = $exports . " export RFIOPATHCONV=". $EB_Args_href->{$ebproc}->{'RFIO_iPathConv'} . ";";
-#      
-# # switch on by number of outputs
-#      }
-#######################################
-       else
-       {
-            # no rfio, just local file 
-            $exports = $exports . " export FILEOUTPUTS=2;";
-       }
-
-         
-         
-         
-         } #outdir
-         else{
-               $exports = $exports . " export FILEOUTPUTS=1;";
-               # no output except for the stream server...
-         }
-
-         
-
-          
-
-
-
-
-
-#      EPICSCONTROL ? always enabled for production
-#       SMALLFILES  for online monitoring node
-
-# Jul14 beamtime setup 3 cores for dabc
-     #my $core_nr = &getCoreNr($cpu) . "," . &getCoreNr($cpu) .  "," . &getCoreNr($cpu);
-
-# try 2 cores each dabc for more dabc nodes:
-     my $core_nr = &getCoreNr($cpu) . "," . &getCoreNr($cpu);
-#      my $core_nr = &getCoreNr($cpu);
-# dabc is set to 3 cores
-     
-# JAM use fixed core number for kp1pc092 tests:
-#   my $core_nr = 1;
-  my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports taskset -c $core_nr  $cmd_dabc $conf_dabc 1</dev/null &\"";
-#    my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports $cmd_dabc $conf_dabc &\"";
-
-
-   my $log = $log_path . "/log_" . $ebproc . "_" . "startEB.txt";
-   #my $log = "/dev/null 2>&1";
-   
-   print "Forking:" . $exe_dabc ."\n";
-   forkMe($exe_dabc, $log, \@process_list) unless($opt_test);
-
-}
-
-else
-{
-# the standard EB processes mode:
- print "Starting evtbuild/netmem processes..\n";
-
-        #--- Prepare execution of daq_evtbuild
-        my $cmd_eb = "/home/hadaq/bin/daq_evtbuild" .
-            " -m "          . $EB_Args_href->{$ebproc}->{'SOURCENUM'} . 
-            " -q "          . $EB_Args_href->{$ebproc}->{'QUEUESIZE'} . 
-            " -S "          . $EB_Args_href->{$ebproc}->{'EBNUM'} .
-            " --ebnum "     . $EB_Args_href->{$ebproc}->{'EBNUM'} . 
-            " -x "          . $EB_Args_href->{$ebproc}->{'PREFIX'};
-
-        #- add queue variable size args
-        my $varsize_arg = &getVarSizeArg($ebproc);
-        $cmd_eb = $cmd_eb . $varsize_arg;
-
-        #- add output type
-        if( defined $EB_Args_href->{$ebproc}->{'OUTDIR'} ){
-            if($EB_Args_href->{$ebproc}->{'MULTIDISK'}){
-                $cmd_eb = $cmd_eb . " -d file -o " . "/data01/data";
-            }
-            else{
-                $cmd_eb = $cmd_eb . " -d file -o " . $EB_Args_href->{$ebproc}->{'OUTDIR'};
-            }
-        }
-        else{
-            $cmd_eb = $cmd_eb . " -d null";
-        }
-
-        #- add file size
-        $cmd_eb = $cmd_eb . " --filesize " . $EB_Args_href->{$ebproc}->{'FILESIZE'};
-
-        #- add second output with small hdl files
-        if( defined $EB_Args_href->{$ebproc}->{'RESDOWNSCALE'} ){
-            $cmd_eb = $cmd_eb . " --resdownscale " . $EB_Args_href->{$ebproc}->{'RESDOWNSCALE'} .
-                                " --resnumevents " . $EB_Args_href->{$ebproc}->{'RESNUMEVENTS'} .
-                                " --respath "      . $EB_Args_href->{$ebproc}->{'RESPATH'} .
-                                " --ressizelimit " . $EB_Args_href->{$ebproc}->{'RESSIZELIMIT'};
-        }
-
-        my $cpu = $EB_Args_href->{$ebproc}->{'IP'};
-
-        #- add rfio args
-        my $rfio;
-        if( $EB_Args_href->{$ebproc}->{'RFIO'} ){
-            $rfio = " --rfio rfiodaq:gstore:" . $EB_Args_href->{$ebproc}->{'RFIO_PATH'} .
-                " --rfiolustre "     . $EB_Args_href->{$ebproc}->{'RFIO_pcCopyPath'} .
-                " --rfio_pcoption "  . $EB_Args_href->{$ebproc}->{'RFIO_pcOptions'} .
-                " --rfio_icopymode " . $EB_Args_href->{$ebproc}->{'RFIO_iCopyMode'} .
-                " --rfio_icopyfrac " . $EB_Args_href->{$ebproc}->{'RFIO_iCopyFrac'} .
-                " --rfio_imaxfile "  . $EB_Args_href->{$ebproc}->{'RFIO_iMaxFile'} .
-                " --rfio_ipathconv " . $EB_Args_href->{$ebproc}->{'RFIO_iPathConv'};
-        }
-
-        $cmd_eb = $cmd_eb . $rfio if( defined $rfio );
-
-        #- add multiple disk arg (ctrl via daq_disks)
-        if($EB_Args_href->{$ebproc}->{'MULTIDISK'} && 
-           defined $EB_Args_href->{$ebproc}->{'OUTDIR'}){
-            $cmd_eb = $cmd_eb . " --multidisk " . $EB_Args_href->{$ebproc}->{'MULTIDISK'};
-        }
-
-        #- add online RPC server
-        if( $EB_Args_href->{$ebproc}->{'ONLINESERVER'} eq "on" ){
-            $cmd_eb = $cmd_eb . " --online";
-        }
-
-        #- add epics controlled
-        $cmd_eb = $cmd_eb . " --epicsctrl " if( $EB_Args_href->{$ebproc}->{'EPICS_CTRL'} );
-
-         # switch on debug output
-        $cmd_eb = $cmd_eb . " --debug trignr --debug errbit --debug word " if( $EB_Args_href->{$ebproc}->{'EB_DEBUG'} );
-
-
-        
-        #- logging the output
-        my $eblog_file = "/tmp/log_eb_" . $EB_Args_href->{$ebproc}->{'EBNUM'} . ".txt";
-        my $eb_log = "1>$eblog_file 2>$eblog_file";
-        $eb_log = "1>/dev/null 2>/dev/null" unless( $EB_Args_href->{$ebproc}->{'EB_LOG'} );
-
-        my $time = 1. * $ebproc;
-        my $sleep_cmd = "sleep " . $time;
-
-        my $core_nr = &getCoreNr($cpu);
-
-        my $exe_eb = "ssh -n $cpu -l $username \"cd /home/hadaq/oper; export DAQ_SETUP=/home/hadaq/oper/eb; taskset -c $core_nr  $cmd_eb $eb_log &\"";
-
-        #print "exec: $exe_eb\n";
-
-        #--- Prepare execution of daq_netmem
-        my $cmd_nm = "/home/hadaq/bin/daq_netmem" .
-            " -m " . $EB_Args_href->{$ebproc}->{'SOURCENUM'} . 
-            " -q " . $EB_Args_href->{$ebproc}->{'QUEUESIZE'} . 
-            " -S " . $EB_Args_href->{$ebproc}->{'EBNUM'};
-
-        #- add queue variable size args
-        $cmd_nm = $cmd_nm . $varsize_arg;
-
-        my @port_list = ();
-
-        #- add ports
-        foreach my $port (@{$EB_Args_href->{$ebproc}->{'PORT_LIST'}}){ 
-            #$cmd_nm = $cmd_nm . " -i UDP:0.0.0.0:" . $port;
-            $cmd_nm = $cmd_nm . " -i " . $port;
-
-            push(@port_list, $port);
-        }
-
-        &cpPortList2EB(\@port_list, $EB_Args_href->{$ebproc}->{'EBNUM'}, $cpu);
-
-        #- logging the output
-        my $nmlog_file = "/tmp/log_nm_" . $EB_Args_href->{$ebproc}->{'EBNUM'} . ".txt";
-        my $nm_log = "1>$nmlog_file 2>$nmlog_file";
-        $nm_log = "1>/dev/null 2>/dev/null" unless( $EB_Args_href->{$ebproc}->{'NM_LOG'} );
-
-        $core_nr = &getCoreNr($cpu);
-
-        my $exe_nm = "ssh -n $cpu -l $username \"cd /home/hadaq/oper; export DAQ_SETUP=/home/hadaq/oper/eb; taskset -c $core_nr $cmd_nm $nm_log &\"";
-
-        #print "exec: $exe_nm\n";
-
-        #--- Open permissions for shared memory
-        my $eb_shmem = "daq_evtbuild" . $EB_Args_href->{$ebproc}->{'EBNUM'} . ".shm";
-        my $nm_shmem = "daq_netmem" . $EB_Args_href->{$ebproc}->{'EBNUM'} . ".shm";
-        my $exe_open_eb = "ssh -n $cpu -l $username \"chmod 775 /dev/shm/$eb_shmem\"";
-        my $exe_open_nm = "ssh -n $cpu -l $username \"chmod 775 /dev/shm/$nm_shmem\"";
-        
-        &forkEB($exe_eb, $exe_nm, $exe_open_eb, $exe_open_nm, \@process_list);
-    }
-
-} 
-# if dabc
-
-    #- Wait for children
-    foreach my $cur_child_pid (@process_list) {
-        waitpid($cur_child_pid,0);
-    }
-
-} 
-# foreach
-
-sub stopEvtBuilders()
-{
-    my $username = "hadaq";
-
-    my @process_list = ();
-
-    #--- Loop over server IPs
-    foreach my $ip (@EB_IP_list){
-
-        my $exe = "ssh -n $ip -l $username \"/home/hadaq/bin/cleanup_evtbuild.pl; /home/hadaq/bin/ipcrm.pl\"";
-
-        if($opt_verb){
-            print "Killing running EBs...\n";
-            print "Exec: $exe\n";
-        }
-
-        my $log = $log_path . "/log_" . $ip . "_" . "stopEB.txt";
-
-        forkMe($exe, $log, \@process_list) unless($opt_test);
-    }
-
-    #- Wait for children
-    foreach my $cur_child_pid (@process_list) {
-        print "wait for $cur_child_pid\n";
-        waitpid($cur_child_pid,0);
-    }
-}
-
-sub cpPortList2EB()
-{
-    my ($port_list_aref, $ebnr, $cpu) = @_;
-
-    my $tmpfile = "/tmp/eb" . $ebnr . "_" . $cpu . ".txt";
-
-    #- First write ports to tmp file
-    my $fh = new FileHandle(">$tmpfile");
-
-    if(!$fh) {
-        my $txt = "\nError! Could not open file \"$tmpfile\" for output. Exit.\n";
-        print STDERR $txt;
-        print $txt;
-        exit(128);
-    }
-    
-    foreach my $port (@$port_list_aref){
-        print $fh "$port\n";
-    }
-
-    $fh->close();
-
-    #- Copy this tmp file to EB
-    my $exe_cp = "scp $tmpfile hadaq\@$cpu:/tmp/ 1>/dev/null 2>/dev/null";
-    system($exe_cp);
-}
-sub startIOC()
-{
-    my $ioc_dir = "/home/scs/ebctrl/ioc/iocBoot/iocebctrl";
-
-    &writeIOC_stcmd( $ioc_dir );
-
-    print "Starting IOCs...\n" if($opt_verb);
-
-    foreach my $ebproc (keys %$EB_Args_href){
-
-        my $stcmd = sprintf("st_eb%02d.cmd", 1 + $ebproc);
-        my $screen_name = sprintf("ioc_eb%02d", 1 + $ebproc);
-
-        my $cmd = "bash; . /home/scs/.bashrc; export HOSTNAME=\\\$(hostname); cd $ioc_dir; screen -dmS $screen_name ../../bin/linux-x86_64/ebctrl $stcmd";
-        my $cpu = $EB_Args_href->{$ebproc}->{'IP'};
-        # JAM2016: this is kludge for bnet:
-        # first IP in hub configuration of pseude EB15 might be set differently
-        # we always reset it to match lxhadeb05 where epics for builder should belong 
-        if($ebproc == 15)
-         {
-           $cpu='192.168.100.15';
-         }
-       #another dirty workaround for bnet at eb0:
-        if ($ebproc == 0) {
-          $cpu = '192.168.100.8';
-       } 
-        # end bnet kludge
-        my $exe = "ssh -n $cpu -l scs \"$cmd\"";
-
-        print "Exec: $exe\n" if($opt_verb);
-        system($exe) unless($opt_test);
-    }
-}
-
-sub smallestEBProcNum()
-{
-    my $smallest = 1000;
-
-    foreach my $ebproc (keys %$EB_Args_href){
-        $smallest = $ebproc if($smallest > $ebproc);
-    }
-
-    return $smallest;
-}
-
-sub writeIOC_stcmd()
-{
-    my ($ioc_dir) = @_;
-
-    # JAM first evaluate ports for ca list
-    my $epicscalist = "192.168.111.255";
-    foreach my $ebproc (keys %$EB_Args_href){
-     $epicscalist=sprintf("%s 192.168.111.255:%d", $epicscalist, 10001 + $ebproc);
-    }
-    
-    print "Copying st.cmd files to servers...\n" if($opt_verb);
-
-    my $smallest_ebproc = &smallestEBProcNum();
-    
-    foreach my $ebproc (keys %$EB_Args_href){
-
-        my $ebNr  = 1 + $ebproc;
-        my $ebnum = sprintf("eb%02d", $ebNr);
-        my $serverport = 10001+ $ebproc;
-       
-       
-        #- in MBytes
-        my $maxFileSize = $EB_Args_href->{$ebproc}->{'FILESIZE'};
-
-        my $ebtype = "slave";
-        my $comment_genrunid   = "#";
-        my $comment_totalevt   = "#";
-
-        if($ebproc == $smallest_ebproc){
-            $ebtype           = "master";
-            $comment_genrunid = "";
-            $comment_totalevt   = "";
-        }
-
-#        if($ebNr == 1){
-#            $comment_totalevt   = "";
-#        }
-
-        my $ioc_stcmd = <<EOF;
-#!../../bin/linux-x86_64/ebctrl
-
-## Set EPICS environment
-
-< envPaths
-
-epicsEnvSet(FILESIZE,"$maxFileSize")
-epicsEnvSet(EBTYPE,"$ebtype")
-epicsEnvSet(EBNUM,"$ebNr")
-epicsEnvSet(ERRBITLOG, "1")
-epicsEnvSet(ERRBITWAIT, "30")
-epicsEnvSet(EPICS_CAS_SERVER_PORT,"$serverport")
-## epicsEnvSet(EPICS_CA_ADDR_LIST,"192.168.111.255")
-epicsEnvSet(EPICS_CA_ADDR_LIST,"$epicscalist")
-epicsEnvSet(EPICS_CA_AUTO_ADDR_LIST,"NO")
-epicsEnvSet(PATH,"/home/scs/base-3-14-11/bin/linux-x86_64:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:.")
-
-cd \${TOP}
-
-## Register all support components
-dbLoadDatabase("dbd/ebctrl.dbd")
-ebctrl_registerRecordDeviceDriver(pdbbase)
-
-## Load record instances
-dbLoadRecords("db/stats.db", "PREFIX=HAD:IOC:,IOC=$ebnum")
-dbLoadRecords("db/evtbuild.db","eb=$ebnum")
-dbLoadRecords("db/netmem.db","eb=$ebnum")
-dbLoadRecords("db/errbit1.db","eb=$ebnum")
-dbLoadRecords("db/errbit2.db","eb=$ebnum")
-dbLoadRecords("db/trignr1.db","eb=$ebnum")
-dbLoadRecords("db/trignr2.db","eb=$ebnum")
-dbLoadRecords("db/portnr1.db","eb=$ebnum")
-dbLoadRecords("db/portnr2.db","eb=$ebnum")
-dbLoadRecords("db/trigtype.db","eb=$ebnum")
-## JAM disable cpu module to test epicshangup issue:
-## dbLoadRecords("db/cpu.db","eb=$ebnum")
-dbLoadRecords("db/errbitstat.db","eb=$ebnum")
-$comment_totalevt dbLoadRecords("db/totalevtstat.db")
-$comment_genrunid dbLoadRecords("db/genrunid.db","eb=$ebnum")
-
-## Set this to see messages from mySub
-var evtbuildDebug 0
-var netmemDebug 0
-var genrunidDebug 0
-var writerunidDebug 0
-var errbit1Debug 0
-var errbit2Debug 0
-var trigtypeDebug 1
-var cpuDebug 0
-var errbitstatDebug 0
-$comment_totalevt var totalevtscompDebug 0
-cd \${TOP}/iocBoot/\${IOC}
-iocInit()
-
-## Start any sequence programs
-#seq sncExample,"user=scsHost"
-
-dbl > \${TOP}/iocBoot/\${IOC}/$ebnum.dbl
-
-EOF
-
-        my $outfile = "/tmp/st_" . $ebnum . ".cmd";
-        my $fh = new FileHandle(">$outfile");
-
-        if(!$fh) {
-            my $txt = "\nError! Could not open file \"$outfile\" for output. Exit.\n";
-            print STDERR $txt;
-            print $txt;
-            exit(128);
-        }
-
-        print $fh $ioc_stcmd;
-        $fh->close();
-
-        my $ip  = $EB_Args_href->{$ebproc}->{'IP'};
-        my $cmd = "scp $outfile scs\@$ip:$ioc_dir/.";
-        
-        print "Exec: $cmd\n" if($opt_verb);
-        system($cmd) unless($opt_test);        
-    }
-}
-
-sub killIOC()
-{
-    my %ioc;
-    my $ioc_href = \%ioc;
-
-    print "Looking for running IOCs...\n" if($opt_verb);
-
-    #--- Loop over server IPs
-    foreach my $ip (@EB_IP_list){
-
-        &findRunningIOC($ip, $ioc_href);
-    }
-
-    #print Dumper \%$ioc_href;
-
-    &writeExpectIOC() if(%$ioc_href);
-
-    if($opt_verb){
-        print "Killing running IOCs...\n";
-        print "No IOCs found - nothing to kill, continue...\n" unless(%$ioc_href);
-    }
-
-    my (@process_list);
-
-    foreach my $ip ( %$ioc_href ){
-        foreach my $ioc ( @{$ioc_href->{$ip}} ){
-            
-            my $cmd = $expect_ioc_script . " " . $ip . " " . $ioc;
-            my $log = $log_path . "/log_" . $ip . "_" . $ioc . ".txt";
-            print "cmd: $cmd\n" if($opt_verb);
-            &forkMe($cmd, $log, \@process_list);
-        }
-    }
-
-
-    
-
-    #- Wait for children
-    foreach my $cur_child_pid (@process_list) {
-        waitpid($cur_child_pid,0);
-    }
-
-    ### just kill the remaining stuff
-    @process_list = ();
-
-    foreach my $ip (@EB_IP_list){
-       my $cmd = qq|ssh scs\@$ip "/usr/bin/pkill -f \\"SCREEN -dmS ioc_eb\\""|;
-       print $cmd;
-       &forkMe($cmd, "/tmp/ioc_kill_$ip", \@process_list);
-    }
-
-    foreach my $cur_child_pid (@process_list) {
-        waitpid($cur_child_pid,0);
-    }
-
-    sleep 1;
-
-    ### just kill the remaining stuff
-    @process_list = ();
-    foreach my $ip (@EB_IP_list){
-       my $cmd = qq|ssh scs\@$ip "/usr/bin/pkill -9 -f \\"SCREEN -dmS ioc_eb\\""|;
-       &forkMe($cmd, "/tmp/ioc_kill2_$ip", \@process_list);
-    }
-
-    foreach my $cur_child_pid (@process_list) {
-        waitpid($cur_child_pid,0);
-    }
-
-}
-
-sub forkMe()
-{
-    my ($cmd, $log, $proc_list) = @_;
-
-    my $child = fork();
-
-    if( $child ){                           # parent
-        push( @$proc_list, $child );
-    }
-    elsif( $child == 0 ) {                        # child
-        system("$cmd >$log 2>&1 ");
-        exit(0);
-    }
-    else{
-        print "Could not fork: $!\n";
-        exit(1);
-    }
-}
-
-sub forkEB()
-{
-    my ($exe_eb, $exe_nm, $exe_open_eb, $exe_open_nm, $proc_list) = @_;
-
-    my $child = fork();
-
-    if( $child ){                           # parent
-        push( @$proc_list, $child );
-    }
-    elsif( $child == 0 ) {                        # child
-        #--- Execute Event Builder
-        print "Exec: $exe_eb\n" if($opt_verb);
-        system($exe_eb) unless($opt_test);
-
-        sleep(1);
-
-        #--- Open permissions for EB shared memory
-        #  ! Permissions should be opened by EB process
-        #print "Exec: $exe_open_eb\n" if($opt_verb);
-        #system($exe_open_eb) unless($opt_test);
-
-        sleep(2);
-
-        #--- Execute Net-2-Memory
-        print "Exec: $exe_nm\n" if($opt_verb);
-        system($exe_nm) unless($opt_test);
-
-        sleep(1);
-
-        #--- Open permissions for NM shared memory
-        #  ! Permissions should be opened by EB process
-        #print "Exec: $exe_open_nm\n" if($opt_verb);
-        #system($exe_open_nm) unless($opt_test);
-
-        exit(0);
-    }
-    else{
-        print "Could not fork: $!\n";
-        exit(1);
-    }
-}
-
-sub findRunningIOC()
-{
-    my ($cpu, $ioc_href) = @_;
-    
-    `ssh -n $cpu -l scs \"screen -wipe\"`;
-    my $exe = "ssh -n $cpu -l scs \"screen -ls\"";
-
-    my @output = `$exe`;
-
-    foreach my $line (@output){
-        if($line =~ /\d+\.(ioc_eb\d{2})\s+/){
-            my $name = $1;
-            push( @{$ioc_href->{$cpu}}, $name );
-            print "Found IOC: $name on $cpu\n" if($opt_verb);
-        }
-    }
-}
-
-sub writeExpectIOC()
-{
-    # This expect script can be executed to exit IOC.
-
-    #! Look if /tmp dir exists
-    my $tmp_dir = dirname("/tmp");
-    if ( !(-d $tmp_dir) ){
-        print "\nCannot access /tmp directory!\nExit.\n";
-        exit(1);
-    }
-
-    my $expect_script_my = <<EOF;
-#!/usr/bin/expect -f
-
-# This script is automatically generated by startup.pl
-# Do not edit, the changes will be lost.
-
-# Print args
-send_user "\$argv0 [lrange \$argv 0 \$argc]\\n"
-
-# Get args
-#
-# ip      : IP address of the server
-# iocname : name of IOC screen process (screen -ls)
-#
-if {\$argc>0} {
-  set ip      [lindex \$argv 0]
-  set iocname [lindex \$argv 1]
-} else {
-  send_user "Usage: \$argv0 ip iocname\\n"
-}
-
-spawn ssh scs@\$ip
-
-#expect {
-#        "error"     { exit; }
-#        "login:"    { exit; }
-#        "Password:" { exit; }
-#}
-
-set timeout 20
-#240
-
-expect "~\$ "
-send   "screen -r \$iocname\\r"
-expect "epics> "
-send   "exit\\r"
-expect "~\$ "
-    
-EOF
-
-    my $fh = new FileHandle(">$expect_ioc_script");
-
-    if(!$fh) {
-        my $txt = "\nError! Could not open file \"$expect_ioc_script\" for output. Exit.\n";
-        print STDERR $txt;
-        print $txt;
-        exit(128);
-    }
-
-    print $fh $expect_script_my;
-    $fh->close();    
-
-    #- open permissions
-    system("chmod 755 $expect_ioc_script");
-}
-
-sub getGbEconfig()
-{
-    #
-    # Read DB configurations of GbE and CTS,
-    # look for active data sources as well as
-    # for EB IPs and ports.
-    #
-
-    my ($eb_ids_href) = @_;
-
-    my $data_sources = $temp_args_href->{'Parallel'}->{'DATA_SOURCES'};
-    my $gbe_conf     = $temp_args_href->{'Parallel'}->{'GBE_CONF'};
-    #my $cts_conf     = $temp_args_href->{'Parallel'}->{'CTS_CONF'};
-
-    my %activeSources_hash;
-    my $activeSources_href = \%activeSources_hash;
-
-    &readActiveSources($data_sources, $activeSources_href);
-
-    my @id_list;
-    my $id_list_aref = \@id_list;
-
-    #&readEBids($cts_conf, $id_list_aref);
-
-    #- Overwrite array with EB numbers
-    @id_list = (0 .. 15);
-    #print Dumper $id_list_aref;
-
-    &readEBports($gbe_conf, $activeSources_href, $id_list_aref, $eb_ids_href);
-}
-
-sub readEBids()
-{
-    #
-    # Read EB Ids
-    #
-
-    my ($file, $id_list_aref) = @_;
-
-    my $nnn_table = 0;
-    my $val_table = 0;
-
-    my $SPACE = "";
-
-    my $fh = new FileHandle("$file", "r");
-
-    while(<$fh>){
-
-        #- Remove all comments
-        $_ =~ s{                # Substitue...
-                 \#             # ...a literal octothorpe
-                 [^\n]*         # ...followed by any number of non-newlines
-               }
-               {$SPACE}gxms;    # Raplace it with a single space        
-
-        #- Skip line if it contains only whitespaces
-        next unless(/\S/);
-
-            if(/^(\s+)?!Value\stable/){
-            $val_table = 1;
-            $nnn_table = 0;
-            next;
-        }
-        elsif(/^(\s+)?!\w+/){
-            $val_table = 0;
-            $nnn_table = 1;
-        }
-
-        if($val_table){
-            my (@vals)   = split(" ", $_);
-            my @id_list1 = split("", $vals[12]);
-            my @id_list2 = split("", $vals[13]);
-            foreach my $id (@id_list1){
-                push(@$id_list_aref, hex($id));
-            }
-            foreach my $id (@id_list2){
-                push(@$id_list_aref, hex($id));
-            }
-        }
-        elsif($nnn_table){
-        }
-    }
-
-    $fh->close;
-}
-
-sub readEBports()
-{
-    #
-    # Read EB IPs and ports accoring to EB Id (type) 
-    # and TRB-Net addresses of active data sources.
-    #
-
-    my ($file, $activeSources_href, $id_list_aref, $ports_href) = @_;
-
-    my $nnn_table = 0;
-    my $val_table = 0;
-
-    my $fh = new FileHandle("$file", "r");
-
-    &isFileDefined($fh, $file);
-
-    my %tmp;
-    my $tmp_href = \%tmp; 
-
-    my $SPACE = "";
-
-    while(<$fh>){
-
-        #print $_;
-        #- Remove all comments
-        $_ =~ s{                # Substitue...
-                 \#             # ...a literal octothorpe
-                 [^\n]*         # ...followed by any number of non-newlines
-               }
-               {$SPACE}gxms;    # Raplace it with a single space
-
-        #- Skip line if it contains only whitespaces
-        next unless(/\S/);
-
-        #print $_;
-            if(/^(\s+)?!Value\stable/){
-            $val_table = 1;
-            $nnn_table = 0;
-            next;
-        }
-        elsif(/^(\s+)?!\w+/){
-            $nnn_table = 1;
-            $val_table = 0;
-        }
-
-        if($val_table){
-            my (@vals)   = split(" ", $_);
-            my $id = $vals[1];
-
-            #if($id <0 or $id >15) {
-            #  print "error: in $file there is a line with an eventbuilder number different than 0..15, the number given in the file is $id. please correct the config file.\n";
-            #  exit(128);
-            #}
-
-
-            #- Accept only EB Ids from CTS config file
-            #print "value: $_";
-            next unless( any {$_ eq $id} @$id_list_aref );
-
-            #print Dumper \@vals;
-            #print "active sources: "; print Dumper $activeSources_href->{'addr_list'};
-            #exit;
-
-            my $ip   = &getIP_hex2dec($vals[6]);
-            my $port = &getPort_hex2dec($vals[2]);
-            my $addr = $vals[0];
-            my $calib = $vals[7]; # jam2018 - add list of trb3 tdc calibration modes
-
-            #print "got: ip: $ip, port: $port, addr: $addr\n";
-            #- Accept only sources from active source list
-            if( any {hex($_) == hex($addr)} @{$activeSources_href->{'addr_list'}} ){
-                $tmp_href->{$id}->{'IP'} = $ip;
-                push( @{$tmp_href->{$id}->{'port_list'}}, $port );
-                push( @{$tmp_href->{$id}->{'addr_list'}}, $addr );
-                push( @{$tmp_href->{$id}->{'calib_list'}}, $calib );
-                
-                # JAM2016: for bnet we need the receiver nodes per port as list also:
-                 push( @{$tmp_href->{$id}->{'ip_list'}}, $ip );
-                
-            }
-        }
-    }
-
-    $fh->close;
-
-    #print Dumper $tmp_href;
-
-    #- Sort hash according to active data source list
-    foreach my $id (keys %tmp){
-        $ports_href->{$id}->{'IP'} = $tmp_href->{$id}->{'IP'};
-        
-        foreach my $addr (@{$activeSources_href->{'addr_list'}}){
-            
-            my $ind1 = first_index {$_ eq $addr} @{$tmp_href->{$id}->{'addr_list'}};
-            my $ind2 = first_index {$_ eq $addr} @{$activeSources_href->{'addr_list'}};
-
-            next if($ind1 == -1);
-
-            push( @{$ports_href->{$id}->{'port_list'}}, $tmp_href->{$id}->{'port_list'}->[$ind1]);
-            # added for bnet JAM:
-            push( @{$ports_href->{$id}->{'ip_list'}}, $tmp_href->{$id}->{'ip_list'}->[$ind1]);
-            push( @{$ports_href->{$id}->{'calib_list'}}, $tmp_href->{$id}->{'calib_list'}->[$ind1]);
-            
-            push( @{$ports_href->{$id}->{'addr_list'}}, $addr);
-            push( @{$ports_href->{$id}->{'bufsize_list'}}, $activeSources_href->{'bufsize_list'}->[$ind2]);
-        }
-    }
-
-    #print Dumper $ports_href;
-}
-
-sub readActiveSources()
-{
-    #
-    # Read TRB-Net addresses of active data sources
-    #
-
-    my ($file, $activeSources_href) = @_;
-
-    my $fh = new FileHandle("$file", "r");
-
-    &isFileDefined($fh, $file);
-
-    my $SPACE = "";
-    
-    # this one contains list of deactivated data sources
-    my $log="/home/hadaq/trbsoft/hadesdaq/evtbuild/tmp/EB_NotActiveSources.txt";
-    system("truncate -s 0 $log ;");
-    while(<$fh>){
-        
-        #- Remove all comments
-        $_ =~ s{                # Substitue...
-                 \#             # ...a literal octothorpe
-                 [^\n]*         # ...followed by any number of non-newlines
-               }
-               {$SPACE}gxms;    # Raplace it with a single space
-
-        #- Skip line if it contains only whitespaces
-        next unless(/\S/);
-
-        my ($addr, $astat, $sys, $size)  = split(" ", $_);
-
-        if($astat == 0){
-         system("echo $addr >> $log 2>&1;");       
-        next;
-        }
-        
-
-        push( @{$activeSources_href->{'addr_list'}}, $addr);
-        push( @{$activeSources_href->{'bufsize_list'}}, &getBufSize($size)); 
-    }
-
-    $fh->close;
-}
-
-sub getBufSize()
-{
-    my ($bufSize) = @_;
-
-    if(lc($bufSize) eq "low"){
-        return $temp_args_href->{'Main'}->{'BUF_SIZE_LOW'};
-    }
-    elsif(lc($bufSize) eq "mid"){
-        return $temp_args_href->{'Main'}->{'BUF_SIZE_MID'};
-    }
-    elsif(lc($bufSize) eq "high"){
-        return $temp_args_href->{'Main'}->{'BUF_SIZE_HIGH'};
-    }
-    else{
-        print "Cannot understand $bufSize from data_sources.db.\n";
-        exit(0);
-    }
-}
-
-sub getIP_hex2dec()
-{
-    my ($ip_hex) = @_;
-
-    my $ip_dec;
-
-    if( $ip_hex =~ /0x(\w{2})(\w{2})(\w{2})(\w{2})/ ){
-        $ip_dec = hex($1) . "." . hex($2) . "." . hex($3) . "." . hex($4);
-    }
-    else{
-        print "getIP_hex2dec(): cannot extract ip address because of diferent format! Exit.";
-        exit(0);
-    }
-
-    return $ip_dec;
-}
-
-sub getPort_hex2dec()
-{
-    my ($port_hex) = @_;
-
-    my $port_dec;
-
-    if( $port_hex =~ /0x(\w+)/ ){
-        $port_dec = hex($1);
-    }
-    else{
-        print "getPort_hex2dec(): cannot extract port number because of diferent format! Exit.";
-        exit(0);
-    }
-
-    return $port_dec;
-}
-
-sub getIP_hades2gsi()
-{
-    my ($ip_hades) = @_;
-    my $ip_gsi = "";
-    if (exists $IP_GSI_href->{$ip_hades}){ 
-      $ip_gsi = $IP_GSI_href->{$ip_hades};
-    }
-    else {
-      print "getIP_hades2gsi(): WARNING - unknown hades ip $ip_hades";
-    }
-    return $ip_gsi;
-}
-
-
-
-
-sub isFileDefined()
-{
-    my ($fh, $name) = @_;
-
-   if(!$fh) {
-        my $txt = "\nError! Could not open file \'$name\'. Exit.\n";
-        print STDERR $txt;
-        print $txt;
-        exit(128);
-    }
-
-    return 0;
-}
-
-sub writeArgs2file()
-{
-    my $fileName = $0;
-
-    #- Replace .pl with .sh
-    $fileName =~ s/\.pl/\.sh/;
-
-    my $fh = new FileHandle(">./$fileName");
-    if(!$fh) {
-        my $txt = "\nError! Could not open file \"$fileName\" for output. Exit.\n";
-        print STDERR $txt;
-        print $txt;
-        exit(128);
-    }
-
-    my $current_dir = cwd();
-    my $ptogName = $0;
-
-
-    #- Write to the file the script name itself
-    print $fh $0;
-
-    #- Write to the file the arguments
-    foreach my $arg (@arg_list){
-        print $fh " $arg";
-    }
-    print $fh ";\n";
-    
-    ## do not start te files by default. user should actively restart the file JAM 29-06-2018
-    # here put command to start the correct file prefix in bnet builders:
-    #my $prefix=$EB_Args_href->{0}->{'PREFIX'};
-    #print $fh "/usr/bin/wget  -a /tmp/EB_filestart.log  -O /tmp/EB_fileres.txt \"http://lxhadeb03:8090/Master/BNET/StartRun/execute?prefix=$prefix&oninit=10\"\n"; 
-    
-    
-    $fh->close();
-
-    system("chmod 755 ./$fileName");
-}
-
index b561bfdb1582ae3aac786000cc0d7ac5debff1c6..7fb8a80d3f031b3b3e2f051c0f8186a029b94f87 100644 (file)
@@ -52,9 +52,9 @@ $entries->{'mdc'}     = ['token', 'blocked', 'temp', 'linkqual', 'voltage'];
 $entries->{'endp'}    = ['mdc','rich', 'tof', 'rpc', 'other'];
 $entries->{'feeerr'}  = ['feeerr','trginp','trgqual','rpc','tof'];
 $entries->{'rich'}    = ['temp','LV','bkpl','isob','richthr'];
-$entries->{'padiwa'}  = ['ecal','start','itof','hodo','sts'];
+$entries->{'padiwa'}  = ['ecal','start','','',''];#'sts','itof','hodo'
 $entries->{'hv'}      = ['richhv','ecalhv','rpchv','fwhv','tofhv'];
-$entries->{'hv2'}     = ['mdchv','stshv','frpchv','itofhv','valve'];
+$entries->{'hv2'}     = ['mdchv','','','','valve'];#stshv,frpchv,itofhv
 $entries->{'misc'}    = ['seu','calib','magnet','env','sequencer'];
 
 
@@ -141,20 +141,20 @@ use constant {CTSAddress => 0x0003};
 ###############################################################################
 #  Switched off systems
 ###############################################################################
-our $MdcHvOff = 0;
-our $RichHvOff = 0;
-our $RichGasOff = 0;
-our $TofHvOff = 0;
-our $RpcHvOff = 0;
+our $MdcHvOff = 1;
+our $RichHvOff = 1;
+our $RichGasOff = 1;
+our $TofHvOff = 1;
+our $RpcHvOff = 1;
 our $FwHvOff = 0;
 our $MagnetOff = 1;
-our $StsHvOff = 0;
+our $StsHvOff = 1;
 our $StartHvOff = 1;
-our $ItofHvOff = 0;
-our $FrpcHvOff = 0;
-our $EcalHvOff = 0;
+our $ItofHvOff = 1;
+our $FrpcHvOff = 1;
+our $EcalHvOff = 1;
 
-our $QAServerOff = 0;
+our $QAServerOff = 1;
 
 ###############################################################################
 #  Missing Boards
index c7fff68445fe5989fc4e5dccaa6e3e61ccab1ea5..62e906f23503c70806f450dbf1a261637fd60706 100755 (executable)
@@ -203,21 +203,21 @@ while(1) {
        0x6050,0x6051,0x6052,0x6053,0x6054,0x6055,0x6056,
 
 #STT1
-        0x8b00, 0x8b01, 0x8b02, 0x8b03,
-        0x6400, 0x6401, 0x6402, 0x6403,
-        0x6410, 0x6411, 0x6412, 0x6413,
-        0x6420, 0x6421, 0x6422, 0x6423,
-        0x6430, 0x6431, 0x6432, 0x6433,
+#        0x8b00, 0x8b01, 0x8b02, 0x8b03,
+#        0x6400, 0x6401, 0x6402, 0x6403,
+#        0x6410, 0x6411, 0x6412, 0x6413,
+#        0x6420, 0x6421, 0x6422, 0x6423,
+#        0x6430, 0x6431, 0x6432, 0x6433,
 
 #STT2
-        0x8b10, 0x8b11, 0x8b12, 0x8b13, 0x8b14, 0x8b15,
-        0x6440, 0x6441, 0x6442, 0x6443, 0x6444, 0x6445,
-        0x6450, 0x6451, 0x6452, 0x6453, 0x6454, 0x6455,
-        0x6460, 0x6461, 0x6462, 0x6463, 0x6464, 0x6465,
-        0x6470, 0x6471, 0x6472, 0x6473, #0x6474, 0x6475,
+#        0x8b10, 0x8b11, 0x8b12, 0x8b13, 0x8b14, 0x8b15,
+#        0x6440, 0x6441, 0x6442, 0x6443, 0x6444, 0x6445,
+#        0x6450, 0x6451, 0x6452, 0x6453, 0x6454, 0x6455,
+#        0x6460, 0x6461, 0x6462, 0x6463, 0x6464, 0x6465,
+#        0x6470, 0x6471, 0x6472, 0x6473, #0x6474, 0x6475,
 #fRPC
-       0x8c00,0x6800,0x6801,0x6802,0x6803,
-       0x8c10,0x6810,0x6811,0x6812,0x6813,
+#      0x8c00,0x6800,0x6801,0x6802,0x6803,
+#      0x8c10,0x6810,0x6811,0x6812,0x6813,
        );
 
     my @other_boards =(
@@ -226,7 +226,7 @@ while(1) {
        #central hub
        0x8000,0x8011,0x8012,0x8013,0x8014,0x8800, 0x8810,
        #innerTOF
-        0x8d00,0x5d00,0x5d01,0x5d02,0x5d03,0x5d04,0x5d05,
+#        0x8d00,0x5d00,0x5d01,0x5d02,0x5d03,0x5d04,0x5d05,
 #        0x8d00,0x5d01,0x5d04,
 #      #Pion
 #      0x8900,0x3800,0x3801,
@@ -234,7 +234,7 @@ while(1) {
        #Start TRB3sc
        0x8880,0x5000,0x5001,0x5002,0x5003,0x5004,0x5005,0x5006,0x5007,
        #Hodo TRB3
-       0x8890,0x5010,0x5011, #0x5012,
+#      0x8890,0x5010,0x5011, #0x5012,
        #Trigger
         0x10,0x0100,0x0110,0x0120,0x130
        );
old mode 100755 (executable)
new mode 100644 (file)
index d5d38797294e749820e5aeb04cded87086405149..b31665b0490657277eb9e775a7991c03ce310bb7 120000 (symlink)
@@ -1 +1 @@
-register_configgbe_ip_feb22.db
\ No newline at end of file
+register_configgbe_ip_generated.db
\ No newline at end of file
index 58e89be755243e87947b339312057eb3e6dc0057..35a9a73be88095bdfa38eaf9509f3429e827dc1a 100644 (file)
@@ -3,14 +3,15 @@
 # Addr     On/Off     Name              DataSize
 #Start must be the first for EvtId
 0x8800      1         CentralCTS       low
+0x8810      1         CentralAUX       low
 0x8880      1        StartTRB3         low
-0x8890      1         Veto             mid
-0x84c0      0         RPCnew1           mid
-0x84c1      0         RPCnew2           mid
+0x8890      0         Veto             mid
+0x84c0      1         RPCnew1           mid
+0x84c1      1         RPCnew2           mid
 0x84c2      0         RPCnew3           mid
-0x84c3      0         RPCnew4           mid
-0x84c4      0         RPCnew5           mid
-0x84c5      0         RPCnew6           mid
+0x84c3      1         RPCnew4           mid
+0x84c4      1         RPCnew5           mid
+0x84c5      1         RPCnew6           mid
 0x86c0      1         TOFnew1           mid
 0x86c1      1         TOFnew2           mid
 0x86c2      1         TOFnew3           mid
 0x1130      1         MDC34sec4         mid
 0x1140      1         MDC34sec5         high
 0x1150      1         MDC34sec6         high
-#0x8700      1         FW0               mid
-#0x8701      1         FW1               mid
-#0x8702      1         FW2               mid
+# new MDC below: JAM
+#0x8500      1         MDC12sec1         high
+#0x8510      1         MDC12sec2         high
+#0x8520      1         MDC12sec3         high
+#0x8530      1         MDC12sec4         high
+#0x8540      1         MDC12sec5         high
+#0x8550      1         MDC12sec6         high
+#0x8560      1         MDC34sec1         high
+#0x8570      1         MDC34sec2         high
+#0x8580      1         MDC34sec3         high
+#0x8590      1         MDC34sec4         high
+#0x85a0      1         MDC34sec5         high
+#0x85b0      1         MDC34sec6         high
+0x8700      1         FW0               mid
+0x8701      1         FW1               mid
+0x8702      1         FW2               mid
 0x8a00      1         ECal0             mid
 0x8a01      1         ECal1             mid
 0x8a02      1         ECal2             mid
 0x83c3      1         RICH3             mid
 0x83c4      1         RICH4             mid
 0x83c5      1         RICH5             mid
-0x83c6      0         RICH6             mid
+0x83c6      1         RICH6             mid
 0x83c7      1         RICH7             mid
 0x83c8      1         RICH8             mid
 0x83c9      1         RICH9             mid
 0x83ca      1         RICHa             mid
 0x83cb      1         RICHb             mid
-0x8b00      1         STS1-0             mid
-0x8b01      1         STS1-1             mid
-0x8b02      1         STS1-2             mid
-0x8b03      1         STS1-3             mid
-0x8b10      1         STS2-0             mid
-0x8b11      1         STS2-1             mid
-0x8b12      1         STS2-2             mid
-0x8b13      1         STS2-3             mid
-0x8b14      1         STS2-4             mid
-0x8b15      1         STS2-5             mid
-0x8c00      1        FRPC-0             mid
-0x8c10      1       FRPC-1             mid
-0x8d00      0       ITOF             mid
+0x8b00      0         STS1-0             mid
+0x8b01      0         STS1-1             mid
+0x8b02      0         STS1-2             mid
+0x8b03      0         STS1-3             mid
+0x8b10      0         STS2-0             mid
+0x8b11      0         STS2-1             mid
+0x8b12      0         STS2-2             mid
+0x8b13      0         STS2-3             mid
+0x8b14      0         STS2-4             mid
+0x8b15      0         STS2-5             mid
+0x8c00              FRPC-0             mid
+0x8c10      0         FRPC-1             mid
+0x8d00      1         ITOF               mid
index e93a4bf71042c86202e07de02ce3de2996cafde2..d28e8cf6beb2df6312aa2a0ad1eed7e6d36ee17f 100755 (executable)
@@ -248,7 +248,7 @@ $orasth_persons_institutes->execute()  or die "Couldn't execute statement: " . $
 my $success = 1;
 my @data;
 while (@data = $orasth_persons_institutes->fetchrow_array()) {
-  print OUTFILE_PERS "$data[0], \t$data[1], $data[2], \t$data[3], $data[4], \t$data[5], $data[6]\n" or die "Could not append output file";
+  print OUTFILE_PERS "$data[0],\"$data[1]\",\"$data[2]\",\"$data[3]\",\"$data[4]\",\"$data[5]\",\"$data[6]\"\n" or die "Could not append output file";
   }
  $orasth_persons_institutes->finish();
 return $success;
@@ -278,14 +278,14 @@ return 1;
 sub readPersonsRoles()
 {                 
 my $orasth_persons_roles = $oradbh->prepare("
-SELECT DISTINCT  a.PEOPLE_ID, a.FAMILY_NAME, a.FIRST_NAME, c.PEOPLE_ROLE_ID, c.PEOPLE_ROLE_NAME, b.CONTACT from ALL_CURRENT_HADES_PEOPLE a left join people_contact b  on (a.PEOPLE_ID=b.PEOPLE_ID AND b.CONTACT_TYPE='E') left join PEOPLE_INVOLVEMENT_VIEW c on (a.PEOPLE_ID=c.PEOPLE_ID) order by a.FAMILY_NAME") or die "Couldn't prepare statement: " . $oradbh->errstr;  
+SELECT DISTINCT  a.PEOPLE_ID, a.FAMILY_NAME, a.FIRST_NAME, c.PEOPLE_ROLE_ID, c.PEOPLE_ROLE_NAME, b.CONTACT from ALL_CURRENT_HADES_PEOPLE a left join people_contact b  on (a.PEOPLE_ID=b.PEOPLE_ID AND b.CONTACT_TYPE='E')  inner join PEOPLE_INVOLVEMENT_VIEW c on (a.PEOPLE_ID=c.PEOPLE_ID and c.END_DATE > SYSDATE) order by a.FAMILY_NAME") or die "Couldn't prepare statement: " . $oradbh->errstr;  
 
 $orasth_persons_roles->execute()  or die "Couldn't execute statement: " . $orasth_persons_roles;
 my $success = 1;
 my @data;
 while (@data = $orasth_persons_roles->fetchrow_array()) {
   
-   print OUTFILE_ROLES "$data[0], \t\"$data[1]\", \t\"$data[2]\", \t$data[3], \t\"$data[4]\",  \t\"$data[5]\"\n" or die "Could not append output file";
+   print OUTFILE_ROLES "$data[0],\"$data[1]\",\"$data[2]\",$data[3],\"$data[4]\",\"$data[5]\"\n" or die "Could not append output file";
   
   
   }
@@ -300,7 +300,7 @@ sub putInstitutesFullHeader()
 # first provide output file with standard header:
 my ($sec, $min, $hr, $day, $mon, $year) = localtime;
 my $timestamp= sprintf("%02d.%02d.%04d at %02d:%02d:%02d",$day, $mon + 1, 1900 + $year, $hr, $min, $sec);
-print OUTFILE_FULL "\"ID\", \"NAME\",\"NAME_US\",\"SHORT_NAME\",\"COUNTRY\",\"TOWN\",\"TOWN_US\",\"CHARACTER_SET_ID\",\"ZIP_CODE\",\"ADDRESS\",\"PHONE_PREFIX\",\"EMAIL_EXTENSION\",\"HOMEPAGE\",\"LAST_CHANGE\",\"LOCAL_REPRESENTATIVE\",\"ADDRESS_TOWN\" \n" or die "Could not append output file";
+print OUTFILE_FULL "\"ID\",\"NAME\",\"NAME_US\",\"SHORT_NAME\",\"COUNTRY\",\"TOWN\",\"TOWN_US\",\"CHARACTER_SET_ID\",\"ZIP_CODE\",\"ADDRESS\",\"PHONE_PREFIX\",\"EMAIL_EXTENSION\",\"HOMEPAGE\",\"LAST_CHANGE\",\"LOCAL_REPRESENTATIVE\",\"ADDRESS_TOWN\" \n" or die "Could not append output file";
 
 print "Updated institutes full files at $timestamp\n";
 return 1;
@@ -314,7 +314,7 @@ $orasth_institutes_full->execute()  or die "Couldn't execute statement: " . $ora
 my $success = 1;
 my @data;
 while (@data = $orasth_institutes_full->fetchrow_array()) {
-  print OUTFILE_FULL "$data[0], \"$data[1]\", \"$data[2]\", \"$data[3]\", \"$data[4]\", \"$data[5]\", \"$data[6]\", $data[7],  \"$data[8]\", \"$data[9]\",  \"$data[10]\" , $data[11]\", \"$data[12]\", $data[13], $data[14] , \"$data[15]\" \n" or die "Could not append output file";
+  print OUTFILE_FULL "$data[0],\"$data[1]\",\"$data[2]\",\"$data[3]\",\"$data[4]\",\"$data[5]\",\"$data[6]\",$data[7],\"$data[8]\",\"$data[9]\",\"$data[10]\",\"$data[11]\",\"$data[12]\",$data[13],$data[14],\"$data[15]\"\n" or die "Could not append output file";
   }
  $orasth_institutes_full->finish();
 return $success;
index 264f9b1b3da899eb0905cf3c73672bafd1b223f8..0bbdbd70c751a3e89da4320bc1ed2e6be4687ce9 120000 (symlink)
@@ -1 +1 @@
-20220208_P1to8b.trbcmd
\ No newline at end of file
+20221201_wFW_as_PT3.trbcmd
\ No newline at end of file