also commit everything else that was changes since..
#!/bin/bash
ssh hadaq@hadesp50 "killall -USR2 speakdaemon.pl"
+ssh hadaq@hades33 "killall -USR2 speakdaemon.pl"
#!/bin/bash
-#ssh hadaq@hades33 "killall -USR1 speakdaemon.pl"
+ssh hadaq@hades33 "killall -USR1 speakdaemon.pl"
ssh hadaq@hadesp50 "killall -USR1 speakdaemon.pl; pkill -f espeak"
echo \" <ECAL_Thr> Connected to lxhadesdaq...\"
echo \" <ECAL_Thr> Setting Thresholds...\"
ssh hadesp33 \"pkill -f ./hmon_ecal_recover_dead_slow_channels.pl\"
- cd /home/hadaq/trbsoft/hadesdaq/ecal/ecal_thresholds/trb_dirich_threshold/
- . ./setLD
- ./HADESthreshscan_v1 -l 0 --loading-file 20190220_155833_std_save.thr -t 0 500 500
- ./HADESthreshscan_v1 -l 0 --loading-file 20190220_155833_std_save.thr -t 0 45 n200
+ cd /home/hadaq/trbsoft/hadesdaq/ecal/
+ ./ecal_set_thresholds.pl
echo \"Done\"
tmux new-session -d -s \"ecal_recover_dead_channels\" \"cd ~/trbsoft/hadesdaq/hmon/; export PERL5LIB=.; ./hmon_ecal_recover_dead_slow_channels.pl\"
sleep 10
0xfe71 0 0x50003000 0x83ff00c0 0xffffffff 0x0000ffff 0x00000010 0xaaaaaaaa 0xaaaaaaaa# trb3sc1 TDC
-#Start
-0x5000 2 0x800a00c8 0 0 0
-0x5001 2 0x800a00c8 0 0 0
-0x5002 2 0x800a00c8 0 0 0
-0x5003 2 0x800a00c8 0 0 0
-
-#iTOF
-0x5d00 2 0x800a00c8 0 0 0
-0x5d01 2 0x800a00c8 0 0 0
-0x5d02 2 0x800a00c8 0 0 0
-0x5d03 2 0x800a00c8 0 0 0
-0x5d04 2 0x800a00c8 0 0 0
-0x5d05 2 0x800a00c8 0 0 0
-eb_bnet_fsd_newservers.conf
\ No newline at end of file
+eb_2021-test.conf
\ No newline at end of file
--- /dev/null
+#
+# #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 26-07-2021: extended for 7 input server nodes
+BNETINP: 1 1 1 1 1 1 1
+
+
+## below enough ltsm connections? default with new servers
+BNETBLD: 3 3 3 3 3 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: 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 upt to 16 EB processes
+# 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
# LTSM default options for all EB processes
#LTSM_PATH: /lustre/hades/raw/jun19test/default/tsm
-LTSM_PATH: /lustre/hades/raw/feb21
+LTSM_PATH: /lustre/hades/raw/jun21test
#LTSM_PATH: /hebetest/hades/raw/feb21/
#LTSM_Server: lxltsm01-tsm-server
LTSM_Server: lxltsm01
#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_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
+#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
-start_eb_gbe_newservers_fsd.pl
\ No newline at end of file
+start_eb_gbe_2021-test.pl
\ No newline at end of file
-./start_eb_gbe.pl -e restart -n 1-16 -d on -p te -b 5;
+./start_eb_gbe.pl -e restart -n 1-16 -d on -p te -b 10;
--- /dev/null
+#!/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 = "/home/hadaq/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 @bnetservers = ("192.168.100.8","192.168.100.9","192.168.105.14", "192.168.105.15", "192.168.105.16", "192.168.100.10", "192.168.105.11");
+
+#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.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',
+ '192.168.105.14' => 'lxhadeb14',
+ '192.168.105.15' => 'lxhadeb15',
+ '192.168.105.16' => 'lxhadeb16'
+ );
+
+
+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();
+# } els
+
+if ($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).
+ [-p|--prefix <prefix>] : Prefix of hld file.
+ [-b|--bnet <on|off>] : Specify number of bnet builder nodes(default: 5).
+ [-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
+
+
+EOF
+}
+
+sub init_CPU_status() {
+
+ # JAM 17-oct-2018 - for BNET this cpu reservation is deprecated TODO: remove it
+ my ($EB_CPU_status_href) = @_;
+
+
+ # MT 2020-12: reserve lower 16 (8?) cpus for network interrupts
+ $EB_CPU_status_href->{'192.168.100.8'}->{'input'} = "10-25";
+ $EB_CPU_status_href->{'192.168.100.8'}->{'build'} = "26-31";
+ $EB_CPU_status_href->{'192.168.100.9'}->{'input'} = "10-25";
+ $EB_CPU_status_href->{'192.168.100.9'}->{'build'} = "26-31";
+ $EB_CPU_status_href->{'192.168.100.10'}->{'input'} = "10-25";
+ $EB_CPU_status_href->{'192.168.100.10'}->{'build'} = "26-31";
+ $EB_CPU_status_href->{'192.168.105.11'}->{'input'} = "10-25";
+ $EB_CPU_status_href->{'192.168.105.11'}->{'build'} = "26-31";
+ $EB_CPU_status_href->{'192.168.105.12'}->{'input'} = "10-25";
+ $EB_CPU_status_href->{'192.168.105.12'}->{'build'} = "26-31";
+
+ # JAM 7-2021: new servers have 64 cores, reserve lower 32 cpus for network interrupts - TODO with new set_eth_affinity.pl
+ $EB_CPU_status_href->{'192.168.105.14'}->{'input'} = "32-47";
+ $EB_CPU_status_href->{'192.168.105.14'}->{'build'} = "48-63";
+ $EB_CPU_status_href->{'192.168.105.15'}->{'input'} = "32-47";
+
+ $EB_CPU_status_href->{'192.168.105.15'}->{'build'} = "48-63";
+ $EB_CPU_status_href->{'192.168.105.16'}->{'input'} = "32-47";
+ $EB_CPU_status_href->{'192.168.105.16'}->{'build'} = "48-63";
+
+ # MT, separate scheme, doesn't do so well
+ #$EB_CPU_status_href->{'192.168.105.12'}->{'input'} = "16-23";
+ #$EB_CPU_status_href->{'192.168.105.12'}->{'build'} = "24-31";
+
+
+}
+
+
+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'};
+
+ my $ltsm_usefsd = $temp_args_href->{'Parallel'}->{'LTSM_USEFSD'};
+ my $ltsm_fsd_servers = $temp_args_href->{'Parallel'}->{'LTSM_FSD_SERVERS'};
+ my @ltsm_fsd_server_list = split(/\s+/, $ltsm_fsd_servers);
+ my $ltsm_fsd_ports = $temp_args_href->{'Parallel'}->{'LTSM_FSD_PORT'};
+ my @ltsm_fsd_port_list = split(/\s+/, $ltsm_fsd_ports);
+
+ #my $ltsm_fsd_port = $temp_args_href->{'Parallel'}->{'LTSM_FSD_PORT'};
+
+
+ #- 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}->{'LTSM_USEFSD'} = $ltsm_usefsd;
+ $href->{$ebproc}->{'LTSM_FSD_PORT'} = $ltsm_fsd_port_list[$ebproc];
+ $href->{$ebproc}->{'LTSM_FSD_SERVER'} = $ltsm_fsd_server_list[$ebproc];
+
+# $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<7) {
+ # 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
+# }
+ } #foreach
+
+ $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 $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";
+
+ # JAM2020- enable this to switch different dabc version:
+ # my $dabclogin = ". /home/hadaq/soft/dabc/bin/dabclogin.jun20; ";
+ # my $cmd_dabc = "/home/hadaq/soft/dabc/bin/dabc_exe.jun20 ";
+ # my $conf_bnet_inp = " BnetInputHades.jun20.xml";
+ # my $conf_bnet_bld = " BnetBuilderHadesFSD.jun20.xml";
+
+
+ # 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 = 5; #exclude lxhadeb10, lxhadeb11 from data writing JAM2021
+ 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,0,0); # JAM21 entries also for servers that were deactivated as builders
+ 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<$maxbuildservers; $ebserver=$ebserver+1) {
+ print "Found $localbuilders[$ebserver] builders on EB server: $ebserver\n";
+ }
+
+ my $rcvport = 12100;
+ for ( my $ebserver=0; $ebserver<$#bnetservers+1; $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 from hub 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<$#bnetservers+1; $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 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 & (sleep 2; ~/bin/optimize_taskset.sh) &\"";
+# 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 & (sleep 2; ~/bin/optimize_taskset.sh) &\"";
+ # 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<$maxbuildservers; $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! (and dabc?)
+ 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_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'} ) {
+
+ # switch on by number of outputs
+ $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;";
+
+ # new for file system daemon JAM2020:
+ if ($EB_Args_href->{$ebproc}->{'LTSM_USEFSD'}) {
+ $exports = $exports . " export USEFSD=true;";
+ $exports = $exports . " export LTSMSESSIONFILES=999999;";
+ # increase number of session files if fsd is used:
+ } else {
+ $exports = $exports . " export USEFSD=false;";
+ $exports = $exports . " export LTSMSESSIONFILES=10;"
+ }
+ # $exports = $exports . " export FSDPORT=". $EB_Args_href->{$ebproc}->{'LTSM_FSD_PORT'} . ";";
+ # $exports = $exports . " export FSDSERVER=". $EB_Args_href->{$ebproc}->{'LTSM_FSD_SERVER'} . ";";
+ my $fsdix=$ebserver % 6; # number of FSD servers used TODO get from configuration
+ # in this case, server 4 will use first fsd
+ $exports = $exports . " export FSDPORT=". $EB_Args_href->{$fsdix}->{'LTSM_FSD_PORT'} . ";";
+ $exports = $exports . " export FSDSERVER=". $EB_Args_href->{$fsdix}->{'LTSM_FSD_SERVER'} . ";";
+ } else {
+ # no ltsm, 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, 'build');
+ my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports taskset -c $core_nr $cmd_dabc $conf_bnet_bld 1</dev/null & (sleep 4; ~/bin/optimize_taskset.sh) &\"";
+ #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 + $maxbuildservers; #5 ; # increment ebnum by 5 (JAM2020) per ebserver to re-use EPICS iocs (deprecated, but keep numbering logic JAM2021)
+ $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() {
+ # JAM21 - always use bnet now, disable support of old scheme
+ # 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");
+}
+
#
#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 & (sleep 2; ~/bin/optimize_taskset.sh) &\"";
+# my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports taskset -c $core_nr $cmd_dabc $conf_bnet_inp 1</dev/null & (sleep 2; ~/bin/optimize_taskset.sh) &\"";
+ 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 & (sleep 2; ~/bin/optimize_taskset.sh) &\"";
# my $exe_dabc = "ssh -n $cpu -l $username \"$dabclogin $cdworkdir $exports $cmd_dabc $conf_bnet_inp >senderlog_$cpu.log 2>&1 &\"";
}
# $exports = $exports . " export FSDPORT=". $EB_Args_href->{$ebproc}->{'LTSM_FSD_PORT'} . ";";
# $exports = $exports . " export FSDSERVER=". $EB_Args_href->{$ebproc}->{'LTSM_FSD_SERVER'} . ";";
- my $fsdix=$ebserver % 3; # number of FSD servers used TODO get from configuration
+ my $fsdix=$ebserver % 6; # number of FSD servers used TODO get from configuration
# in this case, server 4 will use first fsd
$exports = $exports . " export FSDPORT=". $EB_Args_href->{$fsdix}->{'LTSM_FSD_PORT'} . ";";
$exports = $exports . " export FSDSERVER=". $EB_Args_href->{$fsdix}->{'LTSM_FSD_SERVER'} . ";";
my $oldmsg;
sub Speak {
my ($id,$str) = @_;
-# print "$id $str $speaklog->{$id}\n";
+
if (!defined $speaklog->{$id} || $speaklog->{$id} < time()-120) {
-# my $cmd = "ssh hades30 'espeak -ven-male2 -s 120 -g 1 \"$str\" ' 2>/dev/null";
return if $id =~ /once/ && (($speaklog->{$id}||0) < time()-600);
#print $id." ".$oldmsg->{$id}." ".$str."\n";
#($oldmsg->{$id} eq $str)
my $fh;
- open($fh, ">>",Hmon::HMONDIR."/files/speaklog");
+ if($id =~ /MDC/) {
+ open($fh, ">>",Hmon::HMONDIR."/files/speaklog_mdc");
+ }
+ else {
+ open($fh, ">>",Hmon::HMONDIR."/files/speaklog");
+ }
$fh->autoflush(1);
print $fh $str."\n";
$speaklog->{$id} = time();
$entries->{'rich'} = ['temp','LV','bkpl','isob','richthr'];
$entries->{'ecal'} = ['temp','count','thr','',''];
$entries->{'hv'} = ['richhv','ecalhv','rpchv','fwhv','tofhv'];
-$entries->{'hv2'} = ['mdchv','stshv','starthv','sequencer',''];
-$entries->{'misc'} = ['irq','calib','magnet','env',''];
+$entries->{'hv2'} = ['mdchv','stshv','frpchv','starthv','itofhv'];
+$entries->{'misc'} = ['irq','calib','magnet','env','sequencer'];
$entries->{'pion'} = ['nxstatus', 'HV', 'HVcurr', 'cooling','seu'];
our @TrgErrLimits = (100, 1000, 10000);
our @CPULimits = (95, 100, 100);
our @TimeoutLimits = (0, 0, 1);
-our @TimeoutLimitsOnlyRICHMDC = (0, 3, 4);
+our @TimeoutLimitsOnlyRICHMDC = (0, 20, 30);
our @LinkErrLimits = (50, 500, 1000);
-our @MdcEndpMissingLimits = (0, 3, 4);
+our @MdcEndpMissingLimits = (3, 30, 30); #!!! Oh dear.
our @RichEndpMissingLimits = (0, 3, 4);
our @TofEndpMissingLimits = (0, 0, 0);
our @RpcEndpMissingLimits = (0, 0, 1);
-our @OtherEndpMissingLimits = (0, 0, 0);#!!!
+our @OtherEndpMissingLimits = (0, 0, 0);
our @EBDeltaRateLimits = (0.1, 0.2, 0.3); # as a ratio compared to the rate
our $TrgCheckPolarity = 1;
our @Eventsbroken = (.5,2,5);
our $MdcHVOffsetLimits = [[5,10,55],[5,10,55],[5,10,55],[10,110,125]];
our @EcalHvLimits = (493,325,320);
our @RpcHvLimits = (12,12,12);
-our @TofHvLimits = (766,760,759);
+our @TofHvLimits = (764,760,759);
our @FwHvLimits = (280,250,200);
our @TdcCalibrationInterval = (320000,450000,600000);
###############################################################################
# Switched off systems
###############################################################################
-our $MdcHvOff = 1;
+our $MdcHvOff = 0;
our $RichHvOff = 1;
our $TofHvOff = 0;
our $RpcHvOff = 0;
our $FwHvOff = 1;
our $MagnetOff = 1;
+our $StsHvOff = 0;
+our $StartHvOff = 0;
+our $ItofHvOff = 0;
+our $FrpcHvOff = 0;
###############################################################################
my $all_calib_files_fresh = 1;
foreach my $b (keys %{$temp}) {
- if(($b&0xF000) == 0x7000 || ($b&0xFF00) == 0x6000 || ($b&0xFF00) == 0x5000 ) {
+ if(($b&0xF000) == 0x7000 || ($b&0xF000) == 0x6000 || ($b&0xF000) == 0x5000 ) {
if ( $calib_file_epochs->{$b}){
if (abs($calib_file_epochs->{$b} - $data->{LastCalibr}{'time'}) <$max_calib_epoch_diff){
}
while(1) {
- my $o = trb_registertime_read_mem(0x5000,0xc000,0,17);
+ my $o = trb_registertime_read_mem(0xfe74,0xc000,0,49);
#Just the usual calculation of differences on counters & normalization based on time between reads.
if (defined $old) {
#sum strips & store
my $sum = 0;
- for my $c (1..16) {
- next if $c == 9; #remove noisy ch. 15 to disable it 2019-03-26
- $sum += $diff->{0x5000}[$c];
+ for my $c (1..47) {
+ $sum += $diff->{0x5000}[$c] if ($diff->{0x5000}[$c]);
+ $sum += $diff->{0x5001}[$c] if ($diff->{0x5001}[$c]);
}
# $sum = $dummy[$iter++]; #You can't do that on stage
push(@store,$sum);
- $empties++ if $sum < 10;
+ $empties++ if $sum < 100;
#end of spill
my $lastsum = 0;
cbmax => "100<*<1E5",
cbmin => 0,
noinit => 1,
-additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
+additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\";set xtics ('0' -0.5, '8' 7.5, '16' 15.5, '24' 23.5, '32' 31.5, '40' 39.5); set grid xtics front;",
showvalues => 0, });
my $str = Hmon::MakeTitle(16, 20, "ECal Hit Rate",0);
0x7070,0x7071,0x7080,0x7081,0x7090,0x7091,
);
-#TOF -> is TOF, RPC, fRPC
+#TOF -> is TOF, RPC, fRPC, FW
my @tof_boards =(
0x86c0,0x5c00,0x5c01,0x5c02,0x5c03,
0x86c1,0x5c10,0x5c11,0x5c12,0x5c13,
0x5840,0x5841,0x5842,0x5843,0x5844,0x5845,0x5846,0x5847,0x5848,
0x5850,0x5851,0x5852,0x5853,0x5854,0x5855,0x5856,0x5857,0x5858,
+0x8700,0x8701,0x8702,
+0x6700,0x6701,0x6702,0x6703,
+0x6710,0x6711,0x6712,0x6713,
+0x6720,0x6721,0x6722,0x6723,
+
);
#RPC -> is ECAL, STS
0x6460, 0x6461, 0x6462, 0x6463, 0x6464, 0x6465,
0x6470, 0x6471, 0x6472, 0x6473, 0x6474, 0x6475,
#fRPC
- 0x8c00,0x6800,0x6801,0x6802,0x6803,
+# 0x8c00,0x6800,0x6801,0x6802,0x6803,
0x8c10,0x6810,0x6811,0x6812,0x6813,
);
#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,
# 0x8910,0x3810,0x3811,
if ($num_rich_mistake > 0) {$rich_longtext .= " Endp @{$rich_results[4]} not known";}
+ $qastate = QA::GetQAState('below',$num_rich_missing,@QA::RichEndpMissingLimits);
+ $qastate = QA::NOTE;
if($qastate > 60) {
system("logger -p local1.info -t DAQ Endp \\<E\\> $rich_longtext") unless (($timecnt->{rich}++)%$loggerperiod);
}
- $qastate = QA::GetQAState('below',$num_rich_missing,@QA::RichEndpMissingLimits);
Hmon::Speak('richmissonce',"$num_rich_missing Rich Frontends missing") if($qastate > 60 && $qastate < QA::ERROR );
Hmon::Speak('richmiss',"$num_rich_missing Rich Frontends missing") if($qastate >= QA::ERROR );
$plot2->{ymax} = -0.5;
$plot2->{cbmax} = "100<*";
$plot2->{showvalues} = 1;
+$plot2->{additional} = "set xtics ('Bottom' 0.5, 'Right' 2.5); set x2tics ('Top' 0.5, 'Left' 2.5);";
+
HPlot::PlotInit($plot2);
my $plot = ();
HPlot::PlotInit($plot1);
+my $plot2 = ();
+$plot2->{name} = "ItofNumbers";
+$plot2->{file} = "files/ItofNumbers";
+$plot2->{entries} = 3;
+$plot2->{curves} = 6;
+$plot2->{type} = HPlot::TYPE_HEATMAP;
+$plot2->{output} = HPlot::OUT_PNG;
+$plot2->{zlabel} = "Hitrate";
+$plot2->{sizex} = 450;
+$plot2->{sizey} = 360;
+$plot2->{nokey} = 1;
+$plot2->{buffer} = 1;
+$plot2->{xmin} = -0.5;
+$plot2->{xmax} = 2.5;
+$plot2->{ymin} = 5.5;
+$plot2->{ymax} = -0.5;
+$plot2->{cbmin} = "0";
+$plot2->{cbmax} = "100<*";
+$plot2->{showvalues} = 1;
+$plot2->{additional} = "set xtics 1;";
+HPlot::PlotInit($plot2);
+
+
my $str = Hmon::MakeTitle(4, 7, "iTOF Hit Rate",0);
$str .= qq@<img src="%ADDPNG files/ItofRate.png%" type="image/png"><br>\n@;
-
$str .= Hmon::MakeFooter();
Hmon::WriteFile("ItofRate",$str);
+$str = Hmon::MakeTitle(6, 8, "iTOF Hit Rate");
+$str .= qq@<img src="%ADDPNG files/ItofNumbers.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("ItofRateNumbers",$str);
+
+
-my $old;
+my $old; my $old2;
my $oldtime = time();
my $time = time();
my $diff;
#my $max = 0 ;
#my $min = 5E9;
- my $o = trb_register_read_mem(0xfe74,0xc000,0,49) or die trb_strerror() or sleep 5 and next;
+ my $o = trb_register_read_mem(0xfe74,0xdfc0,0,48) or die trb_strerror() or sleep 5 and next;
+ my $tdiff = (time() - $oldtime)|1;
if (defined $old) {
- my $tdiff = (time() - $oldtime)|1;
- foreach my $b (keys %$o) {
+ foreach my $board (keys %$o) {
#my $ratesum = 0;
- next unless ($b>=0x5d00 && $b<=0x5dff);
- my $xpos = ($b&0xF)*4;
+ next unless ($board>=0x5d00 && $board<=0x5dff);
+ my $xpos = ($board&0xF)*4;
for my $v (0..47) {
- my $vdiff = ($o->{$b}->[$v+1]&0xfffffff) - ($old->{$b}->[$v+1]&0xfffffff);
+ my $vdiff = ($o->{$board}->[$v]&0xfffffff) - ($old->{$board}->[$v]&0xfffffff);
if ($vdiff < 0) { $vdiff += 2**28;}
- $diff->{$b}->[$v+1] = $vdiff/$tdiff;
+ $diff->{$board}->[$v] = $vdiff/$tdiff;
#$ratesum += $diff->{$b}->[$v+1];
- HPlot::PlotFill('ItofRate',$diff->{$b}->[$v+1],$v%16,$xpos+$v/16);
+ HPlot::PlotFill('ItofRate',$diff->{$board}->[$v],$v%16,$xpos+$v/16);
}
- #my $s = sprintf("0x%04x",$b);
- #$data->{$s}= int(100*($ratesum / 32) +0.5) /100;
-
- #$min = $data->{$s} if $data->{$s} < $min;
- #$max = $data->{$s} if $data->{$s}> $max;
+
}
- HPlot::PlotDraw('ItofRate');
-
-
+ HPlot::PlotDraw('ItofRate');
+ }
- # $data->{max} = $max;
- # $data->{min} = $min;
- # $data->{symbol} = " Hits/s";
- # $data->{title} = "Mean DiRICH TDC Rate";
+ my $o2 = trb_register_read_mem(0x10,0x9000,0,24) or die trb_strerror() or sleep 5 and next;
+ if (defined $old2) {
+ for my $v (0..23) {
+ my $vdiff = ($o2->{0x10}->[$v]&0xfffffff) - ($old2->{0x10}->[$v]&0xfffffff);
+ if ($vdiff < 0) { $vdiff += 2**28;}
+ $diff->{0x10}->[$v] = $vdiff/$tdiff;
+ }
+ for(my $s = 0; $s<6; $s++){
+ HPlot::PlotFill('ItofNumbers',$diff->{0x10}->[$s*4+1],0,$s);
+ HPlot::PlotFill('ItofNumbers',$diff->{0x10}->[$s*4+2],1,$s);
+ HPlot::PlotFill('ItofNumbers',$diff->{0x10}->[$s*4+3],2,$s);
+ }
+
+ HPlot::PlotDraw('ItofNumbers');
+ }
-
- # $data->{updatetime} = getTimeString;
- # my $fh;
- # open($fh, ">", Hmon::HMONDIR."/files/richMeanRateDiRICH.json");
- # print $fh encode_json($data);
- # close $fh;
- }
$old = $o;
+ $old2 = $o2;
$oldtime = time();
sleep 1;
}
if ($longcnt==6) {
#long Range Hist
for (my $i=0;$i<24;$i++){
- $TempLong[$i] /= $TempLongCnt[$i];
+ $TempLong[$i] /= $TempLongCnt[$i]||1;
HPlot::PlotAdd('RichInnerTempHistLong',$TempLong[$i],$i);
#print $TempLong[$i]."\n";
$TempLong[$i] = 0;
if ($max > $interlockTemperature ) {
- my $s = sprintf("HAD:RICH:PS:24:SETONOFF");
- Perl2Epics::Connect("PS_RICH_3_3V",$s);
- Perl2Epics::Put("PS_RICH_3_3V",1);
- $InterlockActive = "Shutting down RICH ...";
+# my $s = sprintf("HAD:RICH:PS:24:SETONOFF");
+# Perl2Epics::Connect("PS_RICH_3_3V",$s);
+# Perl2Epics::Put("PS_RICH_3_3V",1);
+# $InterlockActive = "Shutting down RICH ...";
}
#-------Software Interlock-------#
ymax => -0.5,
xmin => -0.5,
xmax => 47.5,
-cbmax => "100<*<1E5",
+cbmax => "1000<*<1E5",
cbmin => 0,
noinit => 1,
-additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
+additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\";set xtics ('0' -0.5, '8' 7.5, '16' 15.5, '24' 23.5, '32' 31.5, '40' 39.5); set grid xtics front;",
showvalues => 0, };
HPlot::PlotInit($plot1);
my $errtime = 0;
my $lastspillcount = 0;
my $countnochange = 0;
+my $iter = 0;
my $plot = ();
$plot->{name} = "EvtsPerSpill";
my $spillcount = 0;
while (1) {
+ $evtrate = 0 if $iter%2==0;
my $trbneterr = 0;
my $rh_result = trb_register_read(QA::CTSAddress, 0xa002) or $trbneterr = 1; #sleep 5 and next;
my $stopped = trb_register_read(0x3,0xa0c0) or sleep 5 and next;
$lastspill = $outofspill;
$outofspill = ($rh_result->{QA::CTSAddress} || 0) & 0x10;
- $spilllength++ ; #if($outofspill);
+ $spilllength++ if $iter%2==0; #if($outofspill);
$rh_result = trb_register_read(0x0002, 0x01) or $trbneterr = 1; #sleep 5 and next;
if($trbneterr == 0) {
my $res = $rh_result->{0x0002} & 0xffff;
- $evtrate = $res >= $lastres ? $res - $lastres : ($res + 2**16) - $lastres;
+ $evtrate += $res >= $lastres ? $res - $lastres : ($res + 2**16) - $lastres;
$events += $evtrate;
$midlastres = $res;
usleep(250000);
$res = $rh_result->{0x0002} & 0xffff;
my $evtrate2 = $res >= $midlastres ? $res - $midlastres : ($res + 2**16) - $midlastres;
$events += $evtrate2;
- $evtrate += $evtrate2;
- $evtrate *= 2; #just 2x 250ms right now!
+ $evtrate += $evtrate2;
+
# When end of spill is detected...
my $qastate;
my $qashort;
# my $data = Perl2Epics::GetAll();
# print STDERR $data->{'prefix'}->{val}."\n";
# if(($data->{'prefix'}->{val} eq '-1') || ($data->{'prefix'}->{val} eq 'be')) {
-# Hmon::Speak('nobeam', "No beam");
+# Hmon::Speak('nobeam', "No beam");
# }
my $prefix = get ($url_prefix);
-# print Dumper $prefix;
+ print Dumper $prefix;
$prefix = "--" unless defined $prefix;
- if(($prefix eq '-1') || ($prefix eq 'be')) {
+ if(($prefix =~ '-1') || ($prefix =~ 'be')) {
Hmon::Speak('nobeam', "No beam") unless $opt_debug>0;
}
}
}
-
+
$qashort = sprintf(" %i ", $evtrate);
$qastate = QA::OK;
$qastate = QA::WARN if $evtrate == 1;
$qastate = QA::WARN_2 if $stopped;
+if ($iter%2) {
Hmon::Speak('rate', "Data Acquisition does not work") if $qastate == QA::FATAL;
$qalong = sprintf("current: %i Events/second", $evtrate);
QA::WriteQALog($fqa, "main", "rate", 5, $qastate, "Current Rate",
$qashort, $qalong) unless $opt_debug>0;
-
+}
my $spillcountstate = QA::OK;
- if ($countnochange > 25) {$spillcountstate = QA::WARN;}
+ if ($countnochange > 30) {
+ $spillcountstate = QA::WARN;
+# my $prefix = get ($url_prefix);
+# $prefix = "--" unless defined $prefix;
+# if(($prefix eq '-1') || ($prefix =~ 'be')) {
+# Hmon::Speak('nobeam', "No beam") unless $opt_debug>0;
+# }
+ }
QA::WriteQALog($fqa, "daq", "spillcount", 5, $spillcountstate, "Spill Count",
$spillcount,"Number of spills: $spillcount" ) unless $opt_debug>0;
if($lastspillcount == $spillcount) {
#Perl2Epics::Put("Rate",$evtrate);
#my $dataRate = Perl2Epics::GetAll();
-
+ $iter++;
usleep(250000);
} else {
use QA;
use HADES::TrbNet;
use HPlot;
-use Time::HiRes qw(usleep);
+use Time::HiRes qw(usleep gettimeofday tv_interval);
use List::Util qw[min max];
trb_init_ports() or die trb_strerror();
HPlot::PlotInit({
name => "StartRateXhistbar",
file => "files/StartRateXhistbar",
- entries => 200,
+ entries => 2000,
type => HPlot::TYPE_BARGRAPH,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"],
sizex => 950,
sizey => 330,
xmin => 0,
- xmax => 200,
+ xmax => 2000,
ymin => "0",
ymax => "100<*",
curves => 16,
HPlot::PlotInit({
name => "StartRateYhistbar",
file => "files/StartRateYhistbar",
- entries => 200,
+ entries => 2000,
type => HPlot::TYPE_BARGRAPH,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"],
sizex => 950,
sizey => 330,
xmin => 0,
- xmax => 200,
+ xmax => 2000,
ymin => "0",
ymax => "100<*",
curves => 16,
$cts_set = trb_register_read(0x3,0xa0da);
}
- my $o = trb_registertime_read_mem(0xfe48,0xc000,0,17); # or die trb_strerror() or sleep 5 and next;
+ my $o = trb_registertime_read_mem(0xfe74,0xc000,0,17); # or die trb_strerror() or sleep 5 and next;
# print Dumper $o;
if (defined $old) {
foreach my $b (keys %$o) {
HPlot::PlotAdd("HaloPosition",$haloxpos,0);
HPlot::PlotAdd("HaloPosition",$haloypos,1);
-
-
- HPlot::PlotDraw('StartRateXhist') if ($iter == 1);
- HPlot::PlotDraw('StartRateYhist') if ($iter == 2);
- HPlot::PlotDraw('VetoRatehist') if ($iter == 3);
- HPlot::PlotDraw('StartRateXhistbar') if ($iter == 4);
- HPlot::PlotDraw('StartRateYhistbar') if ($iter == 4);
- HPlot::PlotDraw('VetoRatehistbar') if ($iter == 5);
- HPlot::PlotDraw('StartXbar') if ($iter == 6); #dont change
- HPlot::PlotDraw('StartYbar') if ($iter == 7); #dont change
- HPlot::PlotDraw('Vetobar') if ($iter == 8); #dont change
- HPlot::PlotDraw('StartPosition') if ($iter == 9);
- HPlot::PlotDraw('HaloPosition') if ($iter == 10);
- HPlot::PlotDraw('HALO') if ($iter == 10); #dont change
- HPlot::PlotDraw('Veto') if ($iter == 10); #dont change
- $iter = 1 if ($iter++ == 10) #dont change
+print $iter ." ".gettimeofday()."\n";
+
+ HPlot::PlotDrawFork('StartRateXhist') ;# if ($iter == 1);
+ HPlot::PlotDrawFork('StartRateYhist') ;# if ($iter == 2);
+ HPlot::PlotDrawFork('VetoRatehist') ;# if ($iter == 3);
+ HPlot::PlotDrawFork('StartRateXhistbar');# if ($iter == 4);
+ HPlot::PlotDrawFork('StartRateYhistbar');# if ($iter == 4);
+ HPlot::PlotDrawFork('VetoRatehistbar') ;# if ($iter == 5);
+ HPlot::PlotDrawFork('StartXbar') ;# if ($iter == 6); #dont change
+ HPlot::PlotDrawFork('StartYbar') ;# if ($iter == 7); #dont change
+ HPlot::PlotDrawFork('Vetobar') ;# if ($iter == 8); #dont change
+ HPlot::PlotDrawFork('StartPosition') ;# if ($iter == 9);
+ HPlot::PlotDrawFork('HaloPosition') ;# if ($iter == 10);
+ HPlot::PlotDrawFork('HALO') ;# if ($iter == 10); #dont change
+ HPlot::PlotDrawFork('Veto') ;# if ($iter == 10); #dont change
+ $iter = 1 if ($iter++ == 10) #dont change
}
$old = $o;
- usleep(100000);
+ usleep(50000);
}
sub inout {
use warnings;
use strict;
+
use Data::Dumper;
use Data::TreeDumper;
use Hmon;
use Encode qw(encode from_to);
use JSON::XS;
+my %users = (name => "wiily", lastname => 'Krüger');
+
+my $ref_users = \%users;
+
+
my $plot1 = {
-name => "StartRateSimple",
-file => "files/StartRateSimple",
-title => "Start Rate",
-entries => 16,
-curves => 16,
-type => HPlot::TYPE_HEATMAP,
-output => HPlot::OUT_PNG,
-zlabel => "Hitrate",
-sizex => 310,
-sizey => 310,
-nokey => 1,
-buffer => 1,
-ymin => 15.5,
-ymax => -0.5,
-xmin => -0.5,
-xmax => 15.5,
-cbmax => "100<*<1E5",
-cbmin => 0,
-noinit => 1,
-additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
-showvalues => 0, };
+ name => "StartRateSimple",
+ file => "files/StartRateSimple",
+ title => "Start Rate",
+ entries => 16,
+ curves => 16,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ zlabel => "Hitrate",
+ sizex => 310,
+ sizey => 310,
+ nokey => 1,
+ buffer => 1,
+ ymin => 15.5,
+ ymax => -0.5,
+ xmin => -0.5,
+ xmax => 15.5,
+ cbmax => "100<*<1E5",
+ cbmin => 0,
+ noinit => 1,
+ additional => "set logscale cb; unset ytics;set format cb \"_{10}{\%L}\"",
+ showvalues => 0, };
HPlot::PlotInit($plot1);
+my $plot2 = {
+ name => "StartRateNumbers",
+ file => "files/StartRateNumbers",
+ entries => 2,
+ curves => 60,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ zlabel => "Hitrate",
+ sizex => 450,
+ sizey => 720,
+ nokey => 1,
+ buffer => 1,
+ xmin => -0.5,
+ xmax => 1.5,
+ ymin => -0.5,
+ ymax => 59.5,
+ cbmax => "100<*<1E5",
+ cbmin => "0",
+ showvalues => 0,
+ additional => "set xtics ('Bottom' 0, 'Left' 1); set x2tics ('Top' 0, 'Right' 1);"
+ };
+HPlot::PlotInit($plot2);
+
+
my $str = Hmon::MakeTitle(4, 7, "Start Hit Rate",0);
$str .= qq@<img src="%ADDPNG files/StartRateSimple.png%" type="image/png"><br>\n@;
-
$str .= Hmon::MakeFooter();
Hmon::WriteFile("StartRateSimple",$str);
+$str = Hmon::MakeTitle(6, 16, "Start Hit Numbers");
+$str .= qq@<img src="%ADDPNG files/StartRateNumbers.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("StartRateNumbers",$str);
my $old;
my $oldtime = time();
my $iter = 0;
-
trb_init_ports() or die trb_strerror();
-
-while(1) {
+while (1) {
#my $data;
#my $max = 0 ;
#my $min = 5E9;
-
- my $o = trb_register_read_mem(0xfe74,0xc000,0,49) or die trb_strerror() or sleep 5 and next;
+ my $current = trb_register_read_mem(0xfe74,0xdfc0,0,48) or die trb_strerror() or sleep 5 and next;
+
+ #print Dumper $o;
if (defined $old) {
my $tdiff = (time() - $oldtime)|1;
- foreach my $b (keys %$o) {
+ foreach my $endpoint (sort keys %$current) {
+ #foreach my $endpoint (0x5000, 0x5001, 0x5002, 0x5003, 0x5004) {
#my $ratesum = 0;
- next unless ($b>=0x5000 && $b<=0x500f);
- my $xpos = ($b&0xF)*4;
-
- for my $v (0..47) {
- my $vdiff = ($o->{$b}->[$v+1]&0xfffffff) - ($old->{$b}->[$v+1]&0xfffffff);
-
- if ($vdiff < 0) { $vdiff += 2**28;}
- $diff->{$b}->[$v+1] = $vdiff/$tdiff;
- #$ratesum += $diff->{$b}->[$v+1];
- HPlot::PlotFill('StartRateSimple',$diff->{$b}->[$v+1],$v%16,$xpos+$v/16);
+ next unless ($endpoint>=0x5000 && $endpoint<=0x5003);
+ my $fpga = ($endpoint&0xF);
+
+ for my $channel_nr (0..47) {
+ my $vdiff = ($current->{$endpoint}->[$channel_nr] & 0xfffffff) - ($old->{$endpoint}->[$channel_nr]&0xfffffff);
+
+ if ($vdiff < 0) {
+ $vdiff += 2**28;
+ }
+ $diff->{$endpoint}->[$channel_nr] = $vdiff/$tdiff;
+ #$ratesum += $diff->{$endpoint}->[$channel_nr+1];
+ #HPlot::PlotFill('StartRateSimple',$diff->{$endpoint}->[$channel_nr],$channel_nr,);
+ HPlot::PlotFill('StartRateSimple',$diff->{$endpoint}->[$channel_nr],$channel_nr%16,$fpga*4+$channel_nr/16);
+
+ my $ypos = 0;
+ my $side = 0;
+ if ($fpga == 0 || $fpga == 3) {
+ next if $channel_nr < 10;
+ next if $channel_nr > 39;
+ $ypos= ($channel_nr-10)*2+1;
}
- #my $s = sprintf("0x%04x",$b);
+
+ if ($fpga == 1 || $fpga == 2) {
+ $ypos = ((15-($channel_nr%16)) + (int($channel_nr/16)*16) - 8)*2;
+ next if $ypos < 0;
+ next if $ypos > 59;
+ $side=1;
+ }
+
+
+ HPlot::PlotFill('StartRateNumbers',$diff->{$endpoint}->[$channel_nr],int($fpga/2), $ypos);
+
+ }
+ #my $s = sprintf("0x%04x",$endpoint);
#$data->{$s}= int(100*($ratesum / 32) +0.5) /100;
-
+
#$min = $data->{$s} if $data->{$s} < $min;
#$max = $data->{$s} if $data->{$s}> $max;
- }
- HPlot::PlotDraw('StartRateSimple');
-
-
-
- # $data->{max} = $max;
- # $data->{min} = $min;
- # $data->{symbol} = " Hits/s";
- # $data->{title} = "Mean DiRICH TDC Rate";
-
-
- # $data->{updatetime} = getTimeString;
-
- # my $fh;
- # open($fh, ">", Hmon::HMONDIR."/files/richMeanRateDiRICH.json");
- # print $fh encode_json($data);
- # close $fh;
- }
-
- $old = $o;
+ }
+
+ HPlot::PlotDraw('StartRateSimple');
+ HPlot::PlotDraw('StartRateNumbers');
+
+ # $data->{max} = $max;
+ # $data->{min} = $min;
+ # $data->{symbol} = " Hits/s";
+ # $data->{title} = "Mean DiRICH TDC Rate";
+
+ # $data->{updatetime} = getTimeString;
+ # my $fh;
+ # open($fh, ">", Hmon::HMONDIR."/files/richMeanRateDiRICH.json");
+ # print $fh encode_json($data);
+ # close $fh;
+ }
+
+ $old = $current;
$oldtime = time();
sleep 1;
- }
+}
cbmax => "100<*<1E5",
cbmin => 0,
noinit => 1,
-additional => "set logscale cb;set format cb \"_{10}{\%L}\"",
+additional => "set logscale cb;set format cb \"_{10}{\%L}\";set xtics ('0' -0.5, '8' 7.5, '16' 15.5, '24' 23.5, '32' 31.5, '40' 39.5); set grid xtics front;",
showvalues => 0, };
HPlot::PlotInit($plot1);
use List::Util qw(min max);
use LWP::Simple qw(get);
use Try::Tiny;
+trb_init_ports() or die trb_strerror();
+
+# my $regs = trb_register_read(0xffff,0xc802) or die trb_strerror() or sleep 5 and next;
+# my $numboards;# = scalar keys %$regs;
+
+ my $labels = 'set xtics (';
+
+ my $entry = 0;
+ my $regs = trb_register_read_mem(0xffff,0xc802,0,2) or die trb_strerror() or sleep 5 and next;
+ my $boards;
+ foreach my $b (sort {$a <=> $b} keys %$regs) {
+ next unless (defined $regs->{$b}[1]);
+ $boards->{$b}{enable} = $regs->{$b}[0] + ($regs->{$b}[1] << 32);
+ $labels .= sprintf("'%04x' %i,",$b,$entry++);
+ }
+ chomp $labels;
+ my $numboards = $entry;
+ $labels .= ') rotate by 90 offset 0,-1.4;';
+
+ my @names = qw(None Qrise StatRise FminRise FmaxRise Qfall StatFall FminFall FmaxFall StretchDelay StretchDeviation);
+
+for(my $i = 0; $i <11; $i++) {
+ HPlot::PlotInit({
+ name => "TdcCal$i",
+ file => "files/TdcCal$i",
+ cblabel => "TdcCal ".$names[$i],
+ entries => $numboards,
+ curves => 48,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ sizex => 2000,
+ sizey => 500,
+ nokey => 1,
+ buffer => 0,
+ xmin => -0.5,
+ xmax => $numboards-0.5,
+ ymin => -0.5,
+ ymax => 47.5,
+ noinit => 1,
+# palette => 'rgb 7,5,15',
+ additional => $labels,
+ showvalues => 0, });
+ }
while(1) {{
+
+ my $cmd = "ls -1 /home/hadaq/oper/lxhadeb*/local*.cal.info";
+ my @files = qx($cmd);
+ foreach my $f (@files) {
+ my ($addr) = $f =~ /local([0-9a-f]{4})\./;
+ $addr = hex($addr);
+ next unless defined $boards->{$addr};
+ chomp $f;
+
+ open(my $data, '<', $f) or print "Damn $f\n" and next;
+ chomp(my @lines = <$data>);
+ close $data;
+
+ for(my $i=0;$i<48;$i++) {
+ if($boards->{$addr}{enable} & (1<<$i)) {
+ my @fields = split(" ", $lines[$i+2]//"");
+# next if scalar @fields == 0;
+
+ for(my $e=1;$e<=11;$e++){
+ $boards->{$addr}{values}[$i][$e] = $fields[$e];
+ }
+ }
+ }
+ }
+
+ $entry = 0;
+ foreach my $b (sort {$a <=> $b} keys %$boards) {
+ for(my $i=0;$i<48;$i++) {
+ for(my $e=0;$e<11;$e++) {
+ next unless defined $boards->{$b}{values}[$i][$e];
+ HPlot::PlotFill("TdcCal$e",$boards->{$b}{values}[$i][$e],$entry,$i);
+ }
+ }
+
+ $entry++;
+ }
+
+
+ for(my $e = 1; $e < 11; $e++) {
+ HPlot::PlotDraw("TdcCal$e");
+ }
+
+ my $str = Hmon::MakeTitle(200, 110, "TDC Cal",1);
+ for(my $e = 0; $e < 11; $e++) {
+ $str .= qq@<img src="%ADDPNG files/TdcCal@.$e.qq@.png%" type="image/png"><br>\n@;
+ }
+ $str .= Hmon::MakeFooter();
+ Hmon::WriteFile("TdcCal",$str);
+
+
+###################################################################################################
+
+
+
my $dataerr = get ('http://localhost/mon/getrootjson.cgi?src=rawmon&histo=HADES/Run/HLD/HLD_ErrPerChannel');
my $datahit = get ('http://localhost/mon/getrootjson.cgi?src=rawmon&histo=HADES/Run/HLD/HLD_HitsPerChannel');
$str .= Hmon::MakeFooter();
Hmon::WriteFile("TDCErrors",$str);
- my $boards = scalar @{$data->{hit}{bins}};
+ $boards = scalar @{$data->{hit}{bins}};
my $channels = scalar @{$data->{hit}{bins}[0]};
}
# print Dumper @stats;
HPlot::PlotDraw('TDCErrors');
- sleep(300);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sleep(600);
}}
cbmax => "100<*<1E5",
cbmin => 0,
noinit => 1,
-additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
+additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\";set xtics ('0' -0.5, '8' 7.5, '16' 15.5, '24' 23.5, '32' 31.5); set grid xtics front;",
showvalues => 0, };
HPlot::PlotInit($plot1);
<li><a href="monitor.cgi?10-window-chat">Chat Log</a></li>
<li><a href="../daqtools/index.pl" target="_blank">Web Tools (daqtools)</a></li>
<li><a href="../eb/?browser=fix" target="_blank">Eventbuilder Monitor</a></li>
-<li class="outdated"><a href="../rawmon/" target="_blank">Raw Data Monitor</a></li>
-<li><a href="/mon/files/runstatscompare.png" target="_blank">Accumulated Run Statistics</a>
+<li><a href="../rawmon/" target="_blank">Raw Data Monitor</a></li>
+<li class="outdated"><a href="/mon/files/runstatscompare.png" target="_blank">Accumulated Run Statistics</a>
</ul></div>
<div class="linkbox" style="float:right"><h4>Documents</h4><ul>
</div>
<div class="linkbox" style="clear:both;width:730px;"><h4>Other Ressources</h4><ul>
+<li><a href="/qaweb">QA Plots (web-based)</a>
<li><a href="files/qa.htm">QA Plots (updated every 5 minutes)</a></li>
<li><a href="files/vertex.htm">Vertex Plots (updated after each file)</a></li>
<li class="outdated"><a href="../spillmon/?browser=no&monitoring=1000&layout=grid4x4&items=[%22EventBuilder/Run/HLD/HLD_HitsFast%22,%22EventBuilder/Run/HLD/HLD_HitsSlow%22,%22EventBuilder/Run/HLD/HLD_TrendX%22,%22EventBuilder/Run/HLD/HLD_TrendY%22,%22EventBuilder/Run/HLD/HLD_BeamX%22,%22EventBuilder/Run/HLD/HLD_BeamY%22,%22EventBuilder/Run/HLD/HLD_VETO_Patt%22,%22EventBuilder/Run/HLD/HLD_QSlow%22,%22EventBuilder/Run/HLD/HLD_HALO_Patt%22,%22EventBuilder/Run/HLD/HLD_XHALOSlow%22,%22EventBuilder/Run/HLD/HLD_YHALOSlow%22,%22EventBuilder/Run/HLD/HLD_LastSpill_Q_factor%22]">Beam Properties</a></li>
<li style="width:600px;"><a href="monitor.cgi?1-window8x26-busy-DutyFactor-Pt3AcceptRatio-EvtsPerSpill-StartCountSpill">Main Screen 2</a> Spill Info
<li style="width:600px;"><a href="monitor.cgi?1-window14x14-EBSummary-hldlast-CTSRates">Main Screen 3</a> EBs</li>
<li style="width:600px;"><a href="monitor.cgi?2-window18x16-EcalSimpleRate-RpcRate-StsRate-TofRate-ItofRate-StartRateSimple-FrpcRate">Main Screen 4</a> Tof Rpc STS Ecal iTOF fRPC Start rates</li>
+<li style="width:600px;"><a href="monitor.cgi?2-window13x16-StartRateNumbers-HodoRate-ItofRateNumbers">Main Screen 5</a> Positional map for Start Veto iTOF</li>
</ul></div>
<div class="linkbox" style="clear:both"><h4>DAQ Network</h4><ul>
<li class="outdated"><a href="monitor.cgi?1-window-StartRateBars">Rates for all Start / Veto (histo,bargraph)</a></li>
<li class="outdated"><a href="monitor.cgi?1-window-StartBars">Rates for all Start / Veto (bargraph) </a></li>
<li class="outdated"><a href="monitor.cgi?1-window-VetoHalo">Rates for Veto & HALO</a></li>
-<li class="outdated"><a href="monitor.cgi?1-window-StartPosition">Beam Position</a></li>
+<li><a href="monitor.cgi?1-window12x8-StartRateSimple-HodoRate">Beam Position</a></li>
<li class="outdated"><a href="monitor.cgi?1-window-SpillStructure">Spill Structure from Start</a></li>
<li class="outdated"><a href="monitor.cgi?1-StartRateBars-StartBars-StartPosition-VetoHalo-ForwardQuartz">Beam Summary</a></li>
</ul></div>
my $longtext = sprintf("HV channels On: %i/$TOTALCHANS",$ChnlsOn);
$qastate = QA::GetQAState('above', $ChnlsOn, @QA::EcalHvLimits);
-if ($ChnlsOn == 0){
- $qastate = QA::NOTE;}
+ if ($ChnlsOn == 0){ $qastate = QA::ERROR;}
+ if ($QA::EcalHvOff == 1) { $qastate = QA::NOTE;}
+
+
$str = "";
if($timer%8 == 0) {
$str .= Hmon::MakeFooter();
Hmon::WriteFile("Environment",$str);
-while (1) {
+while (1) {{
my $port = IO::Socket::INET->new(PeerAddr => "192.168.103.118", PeerPort => 2323, Proto => "tcp", Type => SOCK_STREAM, Timeout => 2)
- or (print("Device not found") && return);
+ or (print("Device not found") && next);
my ($mx,$my,$mz,$t,$p,$h);
my $i = 8;
$port->close();
sleep 9;
- }
+ }}
my $longtext = sprintf("HV channels On: %i/%i<br>%s",$ChnlsOn, scalar @channels,$str);
$qastate = QA::GetQAState('above', $ChnlsOn, @QA::FwHvLimits);
- if ($ChnlsOn == 0){ $qastate = QA::WARN_2;}
+ if ($ChnlsOn == 0){ $qastate = QA::WARN_2; $value = "HV is OFF";}
if ($QA::FwHvOff == 1) { $qastate = QA::NOTE;}
my $hubs = "8401 8411 8601 8701 8801 8800 8880 0x8204,0x8206,0x8212,0x8213,0x8214,0x8215,0x8216,0x8217,0x8221,0x8222,0x8223,0x8224,0x8225,0x8226,0x8227,0x8228,0x8229,
0x8231,0x8239,0x8240,0x8241,0x8242,0x8243,0x8244,0x8245,0x8246,0x8247,0x8248,0x8249,0x824a,0x8251,0x8252,0x8254,0x8256,0x8258,0x8259,
0x8260,0x8261,0x8262,0x8263,0x8264,0x8265,0x8266,0x8267,0x8268,0x8269,0x826a,0x8271,0x8279,0x8281,0x8282,0x8283,0x8284,0x8285,0x8286,0x8287,0x8288,0x8289,
- 0x8292,0x8293,0x8294,0x8295,0x8296,0x8297,0x82a4,0x82a6, 8a00 8a01 8a02 8a03 8a04 8a05 83c0 83c1 83c2 83c3 83c4 83c5 83c6 83c7 83c8 83c9 83ca 83cb 83cc";
+ 0x8292,0x8293,0x8294,0x8295,0x8296,0x8297,0x82a4,0x82a6, 8a00 8a01 8a02 8a03 8a04 8a05 83c0 83c1 83c2 83c3 83c4 83c5 83c6 83c7 83c8 83c9 83ca 83cb 83cc
+ 84c0 84c1 84c2 84c3 84c4 84c5
+ 86c0 86c1 86c2 86c3 86c4 86c5
+ 8b00 8b01 8b02 8b03 8b10 8b11 8b12 8b13 8b14 8b15
+ 8890
+ 8c00 8c10
+ 8d00
+";
my $hs = sprintf("%04x",$h);
# print $h."\n";
if (index($hubs,$hs) != -1) {
'TC1238' => {'min' => 4.6 , 'max' =>4.9 },
'TC1248' => {'min' => 4.5 , 'max' =>4.7 },
'FI1400' => {'min' => 0.36 , 'max' =>0.49 },
- 'PSUI_rbk' => {'min' => 2490 , 'max' =>2500 },
+ 'PSUI_rbk' => {'min' => 2990 , 'max' =>3210 },
'PSUV_rbk' => {'min' => 0 , 'max' =>1 },
'BBI' => {'min' => 419 , 'max' =>450 },
'LL1708' => {'min' => 55.2 , 'max' =>63.0 },
<ul>
<li><a href="qaplot_Main.htm">Main</a><br>
<li><a href="qaplot_Start.htm">Start</a><br>
+ <li><a href="qaplot_Hodo.htm">Hodo</a><br>
+ <li><a href="qaplot_InnerTOF.htm">InnerTOF</a><br>
+ <li><a href="qaplot_ForwardDet.htm">ForwardDet</a><br>
<li><a href="qaplot_RICH.htm">RICH</a><br>
<li><a href="qaplot_MDCMon.htm">MDC</a><br>
<li><a href="qaplot_MDCExpert.htm">MDC Expert</a><br>
print $fh $out;
close $fh;
-my @pages = qw(Main Start RICH MDCMon MDCTimes MDCTimesRaw MDCExpert MDCTimesCal TOFMon RPC WALLMon EcalMon Physics);
+my @pages = qw(Main Start InnerTOF Hodo ForwardDet RICH MDCMon MDCTimes MDCTimesRaw MDCExpert MDCTimesCal TOFMon RPC WALLMon EcalMon Physics);
my $files = {};
# $files->{'Main'} = ["MainPTScaler", "MainTRBNetDebugInfo", "MainTrigger", "MainTriggerTrend"];
# $files-> { "Hodo" } = [ "HodoMult" , "HodoTime" ];
# $files-> { "PionTrackerRaw" } = [ "Mult" , "TS" , "Strip" , "Pileup" , "Overflow" , "ADCStrip" , "TSStrip" , "XY" , "RawPTHodoDt" ];
# $files-> { "PionTrackerCal" } = [ "CalTS" , "CalADCStrip" , "CalTSStrip" , "CalPTHodoDt" ];
-$files-> { "Start" } = [ "StartMain" ];
+$files-> { "Start" } = [ "StartMain", "StartTestEfficiency", "StartTestRawStripToT", "StartTestTDIFFvsTOTmod0", "StartTestTDIFFvsTOTmod1" ];
+$files-> { "InnerTOF" } = [ "InnerTofMultiplicity", "InnerTofRawHitPattern", "InnerTofRawHitPatternWithSum"];
+
+$files-> { "Hodo" } = [ "HODOMain" ];
+$files-> { "ForwardDet" } = [ "StrawCounts", "StrawToT", "StrawLeadTime", "ToT", "DriftTime", "Multiplicity"];
+
$files-> { "RICH" } = [ "RICHMult" , "RICHCharge" , "RICHColRow" , "RICHHitMult" , "RICHDirClus" ];
$files-> { "MDCMon" } = [ "MDCMain" , "Errors" ];
$files-> { "MDCTimes" } = [ "potato" ];
$files-> { "WALLMon" } = [ "WALLMain" , "WALLHit" , "WALLControl" , "WALLControlLATCH" ];
# $files-> { "SHOWERMon" } = [ "SHOWERMain" , "SHOWERMults" , "SHOWERSUMS" , "SHOWERCAL" , "SHOWERSUMTREND" ];
$files-> { "Physics" } = [ "PhysMultCand" , "PhysMatch" , "PhysMultDist" , "PhysBetaMomSys0" , "PhysBetaMomSys1" , "PhysVertex" , "PhysToTmips" ];
-$files-> { "EcalMon"} = [];
+$files-> { "EcalMon"} = ["RawMult", "SlowTot"];
# while(1) {
my @i_integrated=(0,0,0,0,0,0,0,0,0,0,0,0);
my $ChnlsOn = 0;
+my $ChnlsLow = 0;
+
my $cnt;
while(1) {
my $data = Perl2Epics::GetAll();
$ChnlsOn=0;
+ $ChnlsLow=0;
for(my $i = 0; $i <=5; $i++) {
for(my $j = 0; $j<=1; $j++) {
$cnt = ($i*2)+$j;
if ($data->{"U$cnt"}->{val}>=5490){$ChnlsOn++;}
+ elsif ($data->{"U$cnt"}->{val}>=4990){$ChnlsLow++;}
}
}
my $longtext = sprintf("HV channels On: %i/12",$ChnlsOn);
$qastate = QA::GetQAState('above', $ChnlsOn, @QA::RpcHvLimits);
- if ($ChnlsOn == 0){ $qastate = QA::WARN_2;}
+ if ($ChnlsOn == 0){ $qastate = QA::ERROR;}
+ if ($ChnlsLow == 12){ $qastate = QA::WARN;}
if ($QA::RpcHvOff == 1) { $qastate = QA::NOTE;}
$timer++;
$str = "";
- if($timer%8 == 0) {
-
+ if($timer%2 == 0) {
+ print $ChnlsOn." ".$ChnlsLow."\n";
if ($ChnlsOn>0 and $ChnlsOn<12) {
for(my $i = 1; $i <=6; $i++) {
for(my $j = 1; $j<=2; $j++) {
}
# $value = sprintf("%i/652",$ChnlsOn);
$longtext = sprintf("HV channels On: %i/12<br>Check the current and voltage monitoring plots!<br>%s",$ChnlsOn,$str);
- }
+ }
+ elsif($ChnlsLow==12) {
+ $value = sprintf("HV is reduced");
+ }
elsif($ChnlsOn==0) {
$value = sprintf("HV is OFF");
$longtext = sprintf("HV is OFF");
$longtxt = "All sequencers running" if $longtxt eq "";
my $value = ((scalar @names)-$count)."/".(scalar @names);
- QA::WriteQALog($flog,"hv2","sequencer",20,$qastate,"HV Sequencer",$value,$longtxt);
+ QA::WriteQALog($flog,"misc","sequencer",20,$qastate,"HV Sequencer",$value,$longtxt);
if($qastate == QA::FATAL) {
if(!($errorcounter%15)){
Hmon::Speak('nobeam', "High Voltage Control is not working");
my $longtext = sprintf("HV channels On: %i/768",$ChnlsOn);
$qastate = QA::GetQAState('above', $ChnlsOn, @QA::TofHvLimits);
- if ($ChnlsOn == 0){ $qastate = QA::WARN_2;}
+ if ($ChnlsOn == 0){ $qastate = QA::ERROR;}
if ($QA::TofHvOff == 1) { $qastate = QA::NOTE;}
if ($inhibit == 0) {
# system("espeak -vus-mbrola-1 -s125 \"$a\" 2>/dev/null #-ven+m2 -s 130 -g 1 "); -ven-us+f2 -p50 -s120
# system("espeak -ven-us+f2 -p60 -s150 -g 1 \"oh-oh -- $a\" 2>/dev/null");
- system("espeak -ven-german -s120 -p 90 \"$a\" 2>/dev/null");
+ system("espeak-ng -ven-german -s140 -p 90 \"$a\" 2>/dev/null");
+# system("espeak -s120 -p 90 \"$a\" 2>/dev/null");
}
}
}
mkdir `pwd`/pion
-DISPLAY=:0 ssh -f -X lxhadeb06p "ping -i 100 lxhadesdaqp" &>/dev/null &
+#DISPLAY=:0 ssh -f -X lxhadeb06p "ping -i 100 lxhadesdaqp" &>/dev/null &
#sshfs -o allow_other hades-qa@lxhadeb06p:/home/hades-qa/online/mar19/pics/vertex `pwd`/vertex
#sshfs -o allow_other hades-qa@lxhadeb06p:/home/hades-qa/online/mar19/pics `pwd`/qa
+#sshfs -o allow_other hadaq@lxhadeb06p:/home/hadaq/local/hydra2/online/feb21_master/online/pics/vertex `pwd`/vertex
+#sshfs -o allow_other hadaq@lxhadeb06p:/home/hadaq/local/hydra2/online/feb21/online/pics `pwd`/qa
+
# sshfs -o allow_other hadaq@lxhadeb06p:/data01/tmp/ `pwd`/pion
echo " <Hmon> Linking files to server..."
ln -fs `pwd`/archive /srv/www/htdocs/mon/
-ln -fs `pwd`/qa /srv/www/htdocs/mon/
-ln -fs `pwd`/vertex /srv/www/htdocs/mon/
+#ln -fs `pwd`/qa /srv/www/htdocs/mon/
+#ln -fs `pwd`/vertex /srv/www/htdocs/mon/
ln -fs `pwd`/files /srv/www/htdocs/mon/
ln -fs `pwd`/doc /srv/www/htdocs/mon/
ln -fs `pwd`/doc.cgi /srv/www/htdocs/mon/
use warnings;
use strict;
use Data::Dumper;
+use Data::TreeDumper;
+use Hmon;
+use QA;
use HADES::TrbNet;
-
-
-
-trb_init_ports() or die trb_strerror();
-$|=1;
-
-my $res;
-my $daq_rate;
-while (1) {
- my $rh_rate = trb_register_read(0x0003, 0xa001);# or sleep 5 and next;
- if (!defined $rh_rate) {
- $res = trb_strerror();
- print "error output: $res\n";
- if ($res =~ /^RPC:/) {
- sleep 1;
- trb_init_ports();
- next;
- }
- else {
- sleep 1;
- exit;
- }
+use HPlot;
+use Time::HiRes qw(usleep);
+use List::Util qw[min max];
+
+
+HPlot::PlotInit({
+ name => "StartPositionWK",
+ file => "files/StartPositionWK",
+ entries => 200,
+ type => HPlot::TYPE_HISTORY,
+ output => HPlot::OUT_PNG,
+ titles => ["X position","Y position","Xrms","Yrms"],
+ xlabel => "Seconds",
+ ylabel => "Strips",
+ sizex => 970,
+ sizey => 350,
+ ymin => "0",
+ ymax => "10",
+ curves => 4,
+ xscale => 10,
+ buffer => 1,
+ });
+
+
+my $str = Hmon::MakeTitle(13, 8, "Start Position",0);
+$str .= qq@<img src="%ADDPNG files/StartPositionWK.png%" type="image/png">\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("StartPositionWK",$str);
+
+
+HPlot::PlotDraw('StartPositionnWK');
+
+exit;
+
+
+foreach (1..10) {
+ foreach (1) {
+ #HPlot::PlotAdd("StartPositionWK",1.2,0);
+ #exit;
+ #HPlot::PlotAdd("StartPositionWK",2.2,1);
+ #HPlot::PlotAdd("StartPositionWK",3.5,2);
+ #HPlot::PlotAdd("StartPositionWK",4.6,3);
}
- print Dumper $rh_rate;
- if ( !defined $rh_rate) {
- $daq_rate = 0;
- }
- else {
- $daq_rate = $rh_rate->{0x0003} & 0xfffff; # only 20bits
- }
-
- printf "%8d ", $daq_rate;
+ HPlot::PlotDraw('StartPositionWK');
+ print "draw done\n";
+ sleep 2;
+ print "test \n";
sleep 1;
}
-
-
-
#new TOF
0x86c0 241 5 0 0
-0x86c1 088 5 0 0
+0x86c1 264 5 0 0
0x86c2 006 5 0 0
0x86c3 242 5 0 0
-0x86c4 113 5 0 0
+0x86c4 265 5 0 0
0x86c5 094 5 0 0
#fRPC
0x8c00 237 5 0 0
0x8c10 244 5 0 0
+
+
+#Wall
+ 0x8700 267 5 0 0
+ 0x8701 074 5 0 0
+ 0x8702 266 5 0 0
0x86c5 1 0x86c5 1 1
0x86c6 1 0x86c6 1 1
+ 0x8700 1 0x8700 1 1
+ 0x8701 1 0x8701 1 1
+ 0x8702 1 0x8702 1 1
0x8800 1 0x8800 1 1
0x8810 1 0x8810 1 1
-register_configgbe_ip_2021.db
\ No newline at end of file
+register_configgbe_ip_2021-test.db
\ No newline at end of file
--- /dev/null
+###########################################################################################
+# JAM 17-10-2018 - introduce even more new server lxhadeb11, lxhadeb12, skip lxhadeb05
+# JAM2018 - setup for usage of NEW SERVERS lxhadeb08. lxhadeb09, lxhadeb10 - BNET only
+# JAM DEC-2019 - prepare for new trb3 datasources of rpc and tof
+# 0x84c0 - 0x84c5 : 6 new subevents for new RPC electronics.
+# 0x86c0 to 0x86c6 are the new hubs for TOF (1 TRB3 each, 128 channels each, 7 TRB3 total)
+#######
+# JAM july 2021: add new eventbuilders lxhadeb14,15,16; new setup with 7 inputs and 5 builders
+
+# Eventbuilders:
+# EB 0 is now used to define BNET destinations:
+
+# we define 7 input nodes in the setup for EB0-
+# BNET_IN 1: lxhadeb08 enp97s0f1 192.168.100.8 0xc0a86408 ports 50768 - 50805
+# BNET_IN 2: lxhadeb09 enp97s0f1 192.168.100.9 0xc0a86409 ports
+# BNET_IN 3: lxhadeb10 enp97s0f1 192.168.100.10 0xc0a8640a ports
+# BNET_IN 4: lxhadeb11 eno2 192.168.105.11 0xc0a8690b
+## BNET_IN 5: lxhadeb12 eno2 192.168.105.12 0xc0a8690c
+# lxhadeb14 enp67s0f0 192.168.105.14 0xc0a8690e
+# lxhadeb15 enp67s0f0 192.168.105.15 0xc0a8690f
+# lxhadeb16 enp67s0f0 192.168.105.16 0xc0a86910
+
+# the 5 builder nodes lxhadeb08 -lxhadeb11 are assigned in start_eb_gbe.pl
+#####################
+
+
+
+# EB 1: lxhadeb09 enp97s0f1 192.168.100.9 0xc0a86409 ports 50000 - 50099
+# EB 2: lxhadeb10 enp97s0f1 192.168.100.10 0xc0a8640a ports 50000 - 50099
+# EB 3: lxhadeb11 eth4 192.168.100.15 0xc0a8690b ports 50000 - 50099
+# EB 4: lxhadeb08 enp97s0f1 192.168.100.8 0xc0a86408 ports 50256 - 50293
+# EB 5: lxhadeb09 enp97s0f1 192.168.100.9 0xc0a86409 ports 50256 - 50293
+# EB 6: lxhadeb10 enp97s0f1 192.168.100.10 0xc0a8640a ports 50256 - 50293
+# EB 7: lxhadeb11 eno2 192.168.105.11 0xc0a8690b ports 50256 - 50293
+# EB 8: lxhadeb08 enp97s0f1 192.168.100.8 0xc0a86408 ports 50512 - 50549
+# EB 9: lxhadeb09 enp97s0f1 192.168.100.9 0xc0a86409 ports 50512 - 50549
+# EB 10: lxhadeb10 enp97s0f1 192.168.100.10 0xc0a8640a ports 50512 - 50549
+# EB 11: lxhadeb11 eno2 192.168.105.11 0xc0a8690b ports 50512 - 50549
+# EB 12: lxhadeb08 enp97s0f1 192.168.100.8 0xc0a86408 ports 50768 - 50805
+# EB 13: lxhadeb09 enp97s0f1 192.168.100.9 0xc0a86409 ports 50768 - 50805
+# EB 14: lxhadeb10 enp97s0f1 192.168.100.10 0xc0a8640a ports 50768 - 50805
+# EB 15: lxhadeb11 eno2 192.168.105.11 0xc0a8690b ports 50768 - 50805
+
+###########################################################################################
+
+
+#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
+##########################################################################################################
+# JAM 25-may-2018: this first EB will be also used as pseudo node to setup the dabc bnet
+# JAM 17-oct-2018: adjusted for new server hardware only
+# last column will distribute to bnet input nodes
+# EB_LUT must be 0x1 in CTS for bnet mode
+# 0xc0a86408 lxhadeb08 mac 90:e2:ba:f7:9b:b5 192.168.100.8
+# 0xc0a86409 lxhadeb09, mac 90:e2:ba:f7:cf:a1 192.168.100.9
+# 0xc0a8640a lxhadeb10, mac 90:e2:ba:e2:c9:95 192.168.100.10
+# 0xc0a8690b lxhadeb11 mac ac:1f:6b:66:2a:29 192.168.105.11
+## 0xc0a8690c lxhadeb12 mac ac:1f:6b:64:73:17 192.168.105.12
+# note: lxhadeb12 will be only master node (and spare) JAM 26-07-2021
+# 0xc0a8690e lxhadeb14 mac 40:a6:b7:3c:b2:0c 192.168.105.14
+# 0xc0a8690f lxhadeb15 mac 40:a6:b7:3c:5e:0c 192.168.105.15
+# 0xc0a86910 lxhadeb16 mac 40:a6:b7:3c:6d:98 192.168.105.16
+
+
+# note that we also need to set same destination ips in the hub table at the end of this file!
+#
+#lxhadebXX, EB1 XX
+# 0x8000 0 0xc65B 0xdead8000 0xc0a86480 0xc65B 0xc0a86408 0 # OLD cts -lxhadeb08
+ 0x8700 0 0xc65A 0xdead8700 0xc0a8648C 0xc65A 0xc0a86910 1 # fw new 1 lxhadeb16
+ 0x8701 0 0xc65B 0xdead8701 0xc0a8648C 0xc65B 0xc0a86910 1 # fw new 2 lxhadeb16
+ 0x8702 0 0xc65C 0xdead8702 0xc0a8648C 0xc65C 0xc0a86910 1 # fw new 3 lxhadeb16
+ 0x8800 0 0xc650 0xdead8800 0xc0a8648B 0xc650 0xc0a8690b 0 # central-cts lxhadeb11
+ 0x8880 0 0xc65D 0xdead8A00 0xc0a8648D 0xc65D 0xc0a86409 2 # start - lxhadeb09
+ 0x8890 0 0xc65F 0xdead8890 0xc0a8648F 0xc65F 0xc0a86409 2 # veto lxhadeb09
+# 0x8900 0 0xc65C 0xdead8900 0xc0a8648C 0xc65C 0xc0a86409 0 # pion1 lxhadeb09
+# 0x8910 0 0xc65E 0xdead8910 0xc0a8648E 0xc65E 0xc0a86409 0 # pion2 lxhadeb09
+ 0x1000 0 0xc660 0xdead1000 0xc0a86490 0xc660 0xc0a86408 0 # mdc - lxhadeb08
+ 0x1010 0 0xc661 0xdead1010 0xc0a86491 0xc661 0xc0a86408 0 # mdc - lxhadeb08
+ 0x1020 0 0xc662 0xdead1020 0xc0a86492 0xc662 0xc0a86408 0 # mdc - lxhadeb08
+ 0x1030 0 0xc663 0xdead1030 0xc0a86493 0xc663 0xc0a86408 0 # mdc - lxhadeb08
+ 0x1040 0 0xc664 0xdead1040 0xc0a86494 0xc664 0xc0a86408 0 # mdc - lxhadeb08
+ 0x1050 0 0xc665 0xdead1050 0xc0a86495 0xc665 0xc0a86408 0 # mdc - lxhadeb08
+ 0x1100 0 0xc666 0xdead1100 0xc0a86496 0xc666 0xc0a86910 0 # mdc - lxhadeb16 ->min for 16
+ 0x1110 0 0xc667 0xdead1110 0xc0a86497 0xc667 0xc0a8690f 0 # mdc - lxhadeb15 ->min for 15
+ 0x1120 0 0xc668 0xdead1120 0xc0a86498 0xc668 0xc0a86409 0 # mdc - lxhadeb09 - min for 09
+ 0x1130 0 0xc669 0xdead1130 0xc0a86499 0xc669 0xc0a8640a 0 # mdc - lxhadeb10 - min for 10
+ 0x1140 0 0xc66A 0xdead1140 0xc0a8649A 0xc66A 0xc0a8690b 0 # mdc - lxhadeb11 - min for 11
+ 0x1150 0 0xc66B 0xdead1150 0xc0a8649B 0xc66B 0xc0a8690e 0 # mdc - lxhadeb14 - min for 14
+ 0x8a00 0 0xc676 0xdead8a00 0xc0a864A6 0xc676 0xc0a86409 1 # ecal- lxhadeb09
+ 0x8a01 0 0xc677 0xdead8a01 0xc0a864A7 0xc677 0xc0a86409 1 # ecal- lxhadeb09
+ 0x8a02 0 0xc678 0xdead8a02 0xc0a864A8 0xc678 0xc0a86409 1 # ecal- lxhadeb09
+ 0x8a03 0 0xc679 0xdead8a03 0xc0a864A9 0xc679 0xc0a86409 1 # ecal- lxhadeb09
+ 0x8a04 0 0xc67a 0xdead8a04 0xc0a864AA 0xc67A 0xc0a8690e 1 # ecal- lxhadeb14
+ 0x8a05 0 0xc67b 0xdead8a05 0xc0a864AB 0xc67B 0xc0a8690e 1 # ecal- lxhadeb14
+ 0x83c0 0 0xc67c 0xdead83c0 0xc0a864AC 0xc67C 0xc0a8690e 11 # rich lxhadeb14
+ 0x83c1 0 0xc67d 0xdead83c1 0xc0a864AD 0xc67D 0xc0a8690e 11 # rich lxhadeb14
+ 0x83c2 0 0xc67e 0xdead83c2 0xc0a864AE 0xc67E 0xc0a8690e 11 # rich lxhadeb14
+ 0x83c3 0 0xc67f 0xdead83c3 0xc0a864AF 0xc67F 0xc0a8640a 11 # rich lxhadeb10
+ 0x83c4 0 0xc680 0xdead83c4 0xc0a864B0 0xc680 0xc0a8640a 11 # rich lxhadeb10
+ 0x83c5 0 0xc681 0xdead83c5 0xc0a864B1 0xc681 0xc0a8640a 11 # rich lxhadeb10
+ 0x83c6 0 0xc682 0xdead83c6 0xc0a864B2 0xc682 0xc0a8690e 11 # rich lxhadeb14
+ 0x83c7 0 0xc683 0xdead83c7 0xc0a864B3 0xc683 0xc0a8690e 11 # rich lxhadeb14
+ 0x83c8 0 0xc684 0xdead83c8 0xc0a864B4 0xc684 0xc0a86408 11 # rich lxhadeb08
+ 0x83c9 0 0xc685 0xdead83c9 0xc0a864B5 0xc685 0xc0a86408 11 # rich lxhadeb08
+ 0x83ca 0 0xc686 0xdead83ca 0xc0a864B6 0xc686 0xc0a8690b 11 # rich lxhadeb11
+ 0x83cb 0 0xc687 0xdead83cb 0xc0a864B7 0xc687 0xc0a8690b 11 # rich lxhadeb11
+ 0x8810 0 0xc653 0xdead8810 0xc0a864B8 0xc653 0xc0a8690b 0 # central-aux lxhadeb11
+ 0x84c0 0 0xc654 0xdead84c0 0xc0a864B9 0xc654 0xc0a8640a 2 # rpc sector 1 lxhadeb10
+ 0x84c1 0 0xc655 0xdead84c1 0xc0a864BA 0xc655 0xc0a8640a 2 # rpc sector 2 lxhadeb10
+ 0x84c2 0 0xc656 0xdead84c2 0xc0a864BB 0xc656 0xc0a8640a 2 # rpc sector 3 lxhadeb10
+ 0x84c3 0 0xc657 0xdead84c3 0xc0a864BC 0xc657 0xc0a8690b 2 # rpc sector 4 lxhadeb11
+ 0x84c4 0 0xc658 0xdead84c4 0xc0a864BD 0xc658 0xc0a8690b 2 # rpc sector 4 lxhadeb11
+ 0x84c5 0 0xc651 0xdead84c4 0xc0a864BE 0xc651 0xc0a8690b 2 # rpc sector 4 lxhadeb11
+ 0x86c0 0 0xc690 0xdead86c0 0xc0a864C0 0xc690 0xc0a86408 2 # tof hub 0 lxhadeb08
+ 0x86c1 0 0xc691 0xdead86c1 0xc0a864C1 0xc691 0xc0a86409 2 # tof hub 1 lxhadeb09
+ 0x86c2 0 0xc692 0xdead86c2 0xc0a864C2 0xc692 0xc0a8640A 2 # tof hub 2 lxhadeb10
+ 0x86c3 0 0xc693 0xdead86c3 0xc0a864C3 0xc693 0xc0a8690B 2 # tof hub 3 lxhadeb11
+ 0x86c4 0 0xc694 0xdead86c4 0xc0a864C4 0xc694 0xc0a8690B 2 # tof hub 4 lxhadeb11
+ 0x86c5 0 0xc695 0xdead86c5 0xc0a864C5 0xc695 0xc0a8690E 2 # tof hub 5 lxhadeb14
+ 0x86c6 0 0xc696 0xdead86c6 0xc0a864C6 0xc696 0xc0a8690E 2 # tof hub 6 lxhadeb14
+ 0x8b00 0 0xc6B0 0xdead8b00 0xc0a864D0 0xc6B0 0xc0a8690f 2 # STS1 0 lxhadeb15
+ 0x8b01 0 0xc6B1 0xdead8b01 0xc0a864D1 0xc6B1 0xc0a8690f 2 # STS1 1 lxhadeb15
+ 0x8b02 0 0xc6B2 0xdead8b02 0xc0a864D2 0xc6B2 0xc0a8690f 2 # STS1 2 lxhadeb15
+ 0x8b03 0 0xc6B3 0xdead8b03 0xc0a864D3 0xc6B3 0xc0a8690f 2 # STS1 3 lxhadeb15
+ 0x8b10 0 0xc6B4 0xdead8b10 0xc0a864D9 0xc6B4 0xc0a86910 2 # STS2 0 lxhadeb16
+ 0x8b11 0 0xc6B5 0xdead8b11 0xc0a864DA 0xc6B5 0xc0a86910 2 # STS2 1 lxhadeb16
+ 0x8b12 0 0xc6B6 0xdead8b12 0xc0a864DB 0xc6B6 0xc0a86910 2 # STS2 2 lxhadeb16
+ 0x8b13 0 0xc6B7 0xdead8b13 0xc0a864DC 0xc6B7 0xc0a86910 2 # STS2 3 lxhadeb16
+ 0x8b14 0 0xc6B8 0xdead8b14 0xc0a864DD 0xc6B8 0xc0a86910 2 # STS2 4 lxhadeb16
+ 0x8b15 0 0xc6B9 0xdead8b15 0xc0a864DE 0xc6B9 0xc0a86910 2 # STS2 5 lxhadeb16
+ 0x8c00 0 0xc6BA 0xdead8c00 0xc0a864C0 0xc6BA 0xc0a8690f 2 # fw-RPC 0 lxhadeb15
+ 0x8c10 0 0xc6BB 0xdead8c01 0xc0a864C0 0xc6BB 0xc0a8690f 2 # fw-RPC 1 lxhadeb15
+ 0x8d00 0 0xc6BC 0xdead86c1 0xc0a864C1 0xc6BC 0xc0a86409 2 # inner-tof lxhadeb09
+
+ #######################################################################################################################
+#######################################################################################################################
+
+
+
+# hub setup - destination macs and ips
+
+#############################################################################
+#
+# lxhadeb08 enp97s0f1 90:e2:ba:f7:9b:b5 192.168.100.8 0xc0a86408
+# lxhadeb09 enp97s0f1 90:e2:ba:f7:cf:a1 192.168.100.9 0xc0a86409
+# lxhadeb10 enp97s0f1 90:e2:ba:e2:c9:95 192.168.100.10 0xc0a8640a
+# lxhadeb11 eno2 ac:1f:6b:66:2a:29 192.168.105.11 0xc0a8690b
+# lxhadeb12 eno2 ac:1f:6b:64:73:17 192.168.105.12 0xc0a8690c
+
+# second gbe
+# lxhadeb11 enp19s0f1 ac:1f:6b:8b:62:f1 192.168.105.11 0xc0a8690b
+# lxhadeb12 enp19s0f1 ac:1f:6b:8b:60:1f 192.168.105.12 0xc0a8690c
+
+# lxhadeb14 enp67s0f0 40:a6:b7:3c:b2:0c 192.168.105.14 0xc0a8690e
+# lxhadeb15 enp67s0f0 40:a6:b7:3c:5e:0c 192.168.105.15 0xc0a8690f
+# lxhadeb16 enp67s0f0 40:a6:b7:3c:6d:98 192.168.105.16 0xc0a86910
+
+# EB 3: lxhadeb05 eth4 192.168.100.15 0xc0a8640f
+
+
+# Dest MAC Dest MAC Dest IP Src MAC Packet Size
+# Hub # Type # C0 # C1 # C2 # C5 # C8 #
+#####################################################################################
+ # 0xff7f 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 #lxhadeb08 EB0 90:e2:ba:f7:9b:b5 192.168.100.8
+ # JAM 27-apr-2018: for DABC-BNET (Type 100) the destination ips have to be set here for individual hubs
+# the ip entries in above table for eb1 needs to match this to configure EBs!
+ # 0xff7f 100 0x2157b095 0x001B 0xc0a8640f 0x0230 0x0578 #dummies to lxhadeb05, EB3 00:1b:21:57:b0:95 192.168.100.15
+#
+ 0x8700 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # fw new 1 lxhadeb16
+ 0x8701 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # fw new 2 lxhadeb16
+ 0x8702 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # fw new 3 lxhadeb16
+ 0x8800 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # central-cts lxhadeb11 ######
+ 0x8880 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # start - lxhadeb09
+ 0x8890 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # veto lxhadeb09
+# 0x8900 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # pion1 lxhadeb09
+# 0x8910 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # pion2 lxhadeb09
+ 0x1000 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 # mdc - lxhadeb08
+ 0x1010 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 # mdc - lxhadeb08
+ 0x1020 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 # mdc - lxhadeb08
+ 0x1030 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 # mdc - lxhadeb08
+ 0x1040 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 # mdc - lxhadeb08
+ 0x1050 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 # mdc - lxhadeb08
+ 0x1100 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # mdc - lxhadeb16 - min if others are off
+ 0x1110 100 0xb73c5e0c 0x40a6 0xc0a8690f 0x0230 0x0578 # mdc - lxhadeb15 - min if others are off
+ 0x1120 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # mdc - lxhadeb09 - minimum if rich is off
+ 0x1130 100 0xbae2c995 0x90e2 0xc0a8640a 0x0230 0x0578 # mdc - lxhadeb10 - minimum if ecal is off
+ 0x1140 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # mdc - lxhadeb11 - minimum subevent for 11
+ 0x1150 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # mdc - lxhadeb14 - minimum sub for 14
+# 0x1160 100 0x6b662a29 0xac1f 0xc0a8690b 0x0230 0x0578 # mdc - OLD lxhadeb11 ##### old?
+ 0x8a00 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # ecal- lxhadeb09
+ 0x8a01 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # ecal- lxhadeb09
+ 0x8a02 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # ecal- lxhadeb09
+ 0x8a03 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # ecal- lxhadeb09
+ 0x8a04 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # ecal- lxhadeb14
+ 0x8a05 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # ecal- lxhadeb14
+ 0x83c0 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # rich -lxhadeb14
+ 0x83c1 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # rich -lxhadeb14
+ 0x83c2 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # rich -lxhadeb14
+ 0x83c3 100 0xbae2c995 0x90e2 0xc0a8640a 0x0230 0x0578 # rich - lxhadeb10
+ 0x83c4 100 0xbae2c995 0x90e2 0xc0a8640a 0x0230 0x0578 # rich - lxhadeb10
+ 0x83c5 100 0xbae2c995 0x90e2 0xc0a8640a 0x0230 0x0578 # rich - lxhadeb10
+ 0x83c6 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # rich - lxhadeb14
+ 0x83c7 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # rich - lxhadeb14
+ 0x83c8 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 # rich - lxhadeb08
+ 0x83c9 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 # rich - lxhadeb08
+ 0x83ca 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # rich - lxhadeb11
+ 0x83cb 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # rich - lxhadeb11
+ 0x8810 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # central aux - lxhadeb11
+ 0x84c0 100 0xbae2c995 0x90e2 0xc0a8640a 0x0230 0x0578 # rpc sector 1 lxhadeb10
+ 0x84c1 100 0xbae2c995 0x90e2 0xc0a8640a 0x0230 0x0578 # rpc sector 2 lxhadeb10
+ 0x84c2 100 0xbae2c995 0x90e2 0xc0a8640a 0x0230 0x0578 # rpc sector 3 lxhadeb10
+ 0x84c3 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # rpc sector 4 lxhadeb11
+ 0x84c4 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # rpc sector 5 lxhadeb11
+ 0x84c5 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # rpc sector 6 lxhadeb11
+ 0x86c0 100 0xbaf79bb5 0x90e2 0xc0a86408 0x0230 0x0578 # tof hub 0 lxhadeb08
+ 0x86c1 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # tof hub 1 lxhadeb09
+ 0x86c2 100 0xbae2c995 0x90e2 0xc0a8640a 0x0230 0x0578 # tof hub 2 lxhadeb10
+ 0x86c3 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # tof hub 3 lxhadeb11
+ 0x86c4 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # tof hub 4 lxhadeb11
+ 0x86c5 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # tof hub 5 lxhadeb14
+ 0x86c6 100 0xb73cb20c 0x40a6 0xc0a8690e 0x0230 0x0578 # tof hub 6 lxhadeb14
+ 0x8b00 100 0xb73c5e0c 0x40a6 0xc0a8690f 0x0230 0x0578 # STS1 0 lxhadeb15
+ 0x8b01 100 0xb73c5e0c 0x40a6 0xc0a8690f 0x0230 0x0578 # STS1 1 lxhadeb15
+ 0x8b02 100 0xb73c5e0c 0x40a6 0xc0a8690f 0x0230 0x0578 # STS1 2 lxhadeb15
+ 0x8b03 100 0xb73c5e0c 0x40a6 0xc0a8690f 0x0230 0x0578 # STS1 3 lxhadeb15
+ 0x8b10 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # STS2 0 lxhadeb16
+ 0x8b11 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # STS2 1 lxhadeb16
+ 0x8b12 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # STS2 2 lxhadeb16
+ 0x8b13 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # STS2 3 lxhadeb16
+ 0x8b14 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # STS2 4 lxhadeb16
+ 0x8b15 100 0xb73c6d98 0x40a6 0xc0a86910 0x0230 0x0578 # STS2 5 lxhadeb16
+
+ 0x8c00 100 0xb73c5e0c 0x40a6 0xc0a8690f 0x0230 0x0578 # fwRPC-0 - lxhadeb15
+ 0x8c10 100 0xb73c5e0c 0x40a6 0xc0a8690f 0x0230 0x0578 # fwRPC-1 - lxhadeb15
+ 0x8d00 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # inner-tof lxhadeb09
+
+
+
+
+
+
# 0x8420 0 0xc658 0xdead8420 0xc0a86488 0xc658 0xc0a8690b 0 # OLD rpc old lxhadeb11
# 0x8600 0 0xc659 0xdead8600 0xc0a86489 0xc659 0xc0a8690b 0 # tof lxhadeb11
# 0x8700 0 0xc65A 0xdead8700 0xc0a8648A 0xc65A 0xc0a8690b 0 # fw lxhadeb11
+ 0x8700 0 0xc65A 0xdead8700 0xc0a8648C 0xc65A 0xc0a86409 1 # fw new 1 lxhadeb09
+ 0x8701 0 0xc65B 0xdead8701 0xc0a8648C 0xc65B 0xc0a86409 1 # fw new 2 lxhadeb09
+ 0x8702 0 0xc65C 0xdead8702 0xc0a8648C 0xc65C 0xc0a86409 1 # fw new 3 lxhadeb09
0x8800 0 0xc650 0xdead8800 0xc0a8648B 0xc650 0xc0a8690b 0 # central-cts lxhadeb11
0x8880 0 0xc65D 0xdead8A00 0xc0a8648D 0xc65D 0xc0a86409 2 # start - lxhadeb09
0x8890 0 0xc65F 0xdead8890 0xc0a8648F 0xc65F 0xc0a86409 2 # veto lxhadeb09
0x86c4 0 0xc694 0xdead86c4 0xc0a864C4 0xc694 0xc0a8690B 2 # tof hub 4 lxhadeb11
0x86c5 0 0xc695 0xdead86c5 0xc0a864C5 0xc695 0xc0a8690C 2 # tof hub 5 lxhadeb12
0x86c6 0 0xc696 0xdead86c6 0xc0a864C6 0xc696 0xc0a8690C 2 # tof hub 6 lxhadeb12
- 0x8b00 0 0xc6B0 0xdead8b00 0xc0a864D0 0xc6B0 0xc0a86409 1 # STS1 0 lxhadeb09
- 0x8b01 0 0xc6B1 0xdead8b01 0xc0a864D1 0xc6B1 0xc0a86409 1 # STS1 1 lxhadeb09
- 0x8b02 0 0xc6B2 0xdead8b02 0xc0a864D2 0xc6B2 0xc0a8690C 1 # STS1 2 lxhadeb12
- 0x8b03 0 0xc6B3 0xdead8b03 0xc0a864D3 0xc6B3 0xc0a8690C 1 # STS1 3 lxhadeb12
- 0x8b10 0 0xc6B4 0xdead8b10 0xc0a864D9 0xc6B4 0xc0a8640a 1 # STS2 0 lxhadeb10
- 0x8b11 0 0xc6B5 0xdead8b11 0xc0a864DA 0xc6B5 0xc0a8640a 1 # STS2 1 lxhadeb10
- 0x8b12 0 0xc6B6 0xdead8b12 0xc0a864DB 0xc6B6 0xc0a8640a 1 # STS2 2 lxhadeb10
- 0x8b13 0 0xc6B7 0xdead8b13 0xc0a864DC 0xc6B7 0xc0a8690b 1 # STS2 3 lxhadeb11
- 0x8b14 0 0xc6B8 0xdead8b14 0xc0a864DD 0xc6B8 0xc0a8690b 1 # STS2 4 lxhadeb11
- 0x8b15 0 0xc6B9 0xdead8b15 0xc0a864DE 0xc6B9 0xc0a8690b 1 # STS2 5 lxhadeb11
+ 0x8b00 0 0xc6B0 0xdead8b00 0xc0a864D0 0xc6B0 0xc0a86409 2 # STS1 0 lxhadeb09
+ 0x8b01 0 0xc6B1 0xdead8b01 0xc0a864D1 0xc6B1 0xc0a86409 2 # STS1 1 lxhadeb09
+ 0x8b02 0 0xc6B2 0xdead8b02 0xc0a864D2 0xc6B2 0xc0a8690C 2 # STS1 2 lxhadeb12
+ 0x8b03 0 0xc6B3 0xdead8b03 0xc0a864D3 0xc6B3 0xc0a8690C 2 # STS1 3 lxhadeb12
+ 0x8b10 0 0xc6B4 0xdead8b10 0xc0a864D9 0xc6B4 0xc0a8640a 2 # STS2 0 lxhadeb10
+ 0x8b11 0 0xc6B5 0xdead8b11 0xc0a864DA 0xc6B5 0xc0a8640a 2 # STS2 1 lxhadeb10
+ 0x8b12 0 0xc6B6 0xdead8b12 0xc0a864DB 0xc6B6 0xc0a8640a 2 # STS2 2 lxhadeb10
+ 0x8b13 0 0xc6B7 0xdead8b13 0xc0a864DC 0xc6B7 0xc0a8690b 2 # STS2 3 lxhadeb11
+ 0x8b14 0 0xc6B8 0xdead8b14 0xc0a864DD 0xc6B8 0xc0a8690b 2 # STS2 4 lxhadeb11
+ 0x8b15 0 0xc6B9 0xdead8b15 0xc0a864DE 0xc6B9 0xc0a8690b 2 # STS2 5 lxhadeb11
0x8c00 0 0xc6BA 0xdead8c00 0xc0a864C0 0xc6BA 0xc0a86408 2 # fw-RPC 0 lxhadeb08
0x8c10 0 0xc6BB 0xdead8c01 0xc0a864C0 0xc6BB 0xc0a86408 2 # fw-RPC 1 lxhadeb08
0x8d00 0 0xc6BC 0xdead86c1 0xc0a864C1 0xc6BC 0xc0a86409 2 # inner-tof lxhadeb09
# 0x8420 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # OLD rpc old lxhadeb11 ######
# 0x8600 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # tof lxhadeb11
# 0x8700 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # fw lxhadeb11
+ 0x8700 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # fw new 1 lxhadeb09
+ 0x8701 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # fw new 2 lxhadeb09
+ 0x8702 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # fw new 3 lxhadeb09
0x8800 100 0x6b8b62f1 0xac1f 0xc0a8690b 0x0230 0x0578 # central-cts lxhadeb11 ######
0x8880 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # start - lxhadeb09
0x8890 100 0xbaf7cfa1 0x90e2 0xc0a86409 0x0230 0x0578 # veto lxhadeb09
trbcmd setbit 0xfffd 0x22 0x08000000 #enable retransmission on oep
trbcmd setbit 0xfe11 0x22 0x08000000 #enable retransmission on mdchub
+#Remove Ecal
+#trbcmd clearbit 0x8013 0xc0 0x3f
+#trbcmd clearbit 0x8013 0xc1 0x3f
+#trbcmd clearbit 0x8013 0xc3 0x3f
+
+
+#Remove missing iTOF sectors
+trbcmd clearbit 0x8d00 0xc0 0x4d
+trbcmd clearbit 0x8d00 0xc1 0x4d
+trbcmd clearbit 0x8d00 0xc3 0x4d
+
trbcmd clearbit 0x8800 0xc1 0xc
trbcmd clearbit 0x8810 0xc0 0x4
trbcmd clearbit 0x8810 0xc1 0x4
+trbcmd clearbit 0x8800 0xc0 0x40 #beam abort
+trbcmd clearbit 0x8800 0xc1 0x40
+#trbcmd clearbit 0x8800 0xc3 0x40
+
+
+#trbcmd clearbit 0x8014 0xc0 0x40
+#trbcmd clearbit 0x8014 0xc1 0x40
+#trbcmd clearbit 0x8014 0xc3 0x40
#Remove both SCS from Trigger Distribution
iTOF 0x5d00 0x5dff TRB3sc
ECal 0x6000 0x60FF TRB3sc
STS 0x6400 0x64FF TRB3
+Wall 0x6700 0x67FF TRB3
fRPC 0x6800 0x68FF TRB3
Rich 0x7000 0x7FFF DiRich
Central-Hub 0x8000 0x80FF TRB3sc
Rich-Hub 0x83c0 0x83df TRB3sc
RPC-Hub 0x8400 0x84FF TRB3sc
TOF-Hub 0x8600 0x86FF TRB3
-Wall-Hub 0x8700 0x87FF TRB3sc
+Wall-Hub 0x8700 0x87FF TRB3
CTS-Hub 0x8800 0x887F TRB3sc
StartHub 0x8880 0x888F TRB3sc
VetoHub 0x8890 0x88FF TRB3
# Addr On/Off Name DataSize
#Start must be the first for EvtId
0x8800 1 CentralCTS low
-0x8880 1 StartTRB3 low
-0x8890 1 Veto mid
+0x8880 0 StartTRB3 low
+0x8890 0 Veto mid
0x84c0 1 RPCnew1 mid
0x84c1 1 RPCnew2 mid
0x84c2 1 RPCnew3 mid
0x1130 1 MDC34sec4 mid
0x1140 1 MDC34sec5 high
0x1150 1 MDC34sec6 high
-0x8a00 1 ECal0 mid
+0x8700 1 FW0 mid
+0x8701 1 FW1 mid
+0x8702 1 FW2 mid
0x8a01 1 ECal1 mid
0x8a02 1 ECal2 mid
0x8a03 1 ECal3 mid
0x8b13 1 STS2-3 mid
0x8b14 1 STS2-4 mid
0x8b15 1 STS2-5 mid
-0x8c00 1 FRPC-0 mid
+#0x8c00 0 FRPC-0 mid
0x8c10 1 FRPC-1 mid
-0x8d00 1 ITOF mid
+0x8d00 0 ITOF mid
trbcmd w 0x1031 0xc1 0xfbf
trbcmd w 0x1031 0xc3 0xfbf
+#switchport.pl 0x1104 2 off #2309 , didn't like spike rejection 0x10 (means off), mt 2021.02.14
+
#Quick network test
trbcmd i 0xffff | wc
0x2107 311 1 12 0 #ok #20100730: switched 2107 and 2109
0x210a 452 1 12 0 #ok
0x210b 496 1 12 0 #ok
-0x210c 354 1 12 0 #ok
-0x210d 276 1 12 0 #ok
-0x210e 405 1 12 0 #ok
-0x210f 304 1 12 0 #ok
+0x210c 354 1 12 0 #ok 354
+0x210d 276 1 12 0 #ok 276
+0x210e 405 1 12 0 #ok 405
+0x210f 304 1 12 0 #ok 304
###################################################
-0x2110 375 1 12 0
-0x2111 475 1 12 0
-0x2112 382 1 12 0
-0x2113 442 1 12 0
-0x2114 472 1 12 0
-0x2115 279 1 12 0 # 20120302 487 exchanged by 279
-0x2116 302 1 12 0
-0x2117 310 1 12 0
-0x2118 386 1 12 0
-0x2119 441 1 12 0
-0x211a 212 1 12 0
-0x211b 215 1 12 0
-0x211c 357 1 12 0
-0x211d 332 1 12 0
-0x211e 387 1 12 0
-0x211f 388 1 12 0
+0x2110 375 1 12 0 #375
+0x2111 475 1 12 0 #475
+0x2112 382 1 12 0 #382
+0x2113 442 1 12 0 #442
+0x2114 472 1 12 0 #472
+0x2115 279 1 12 0 #279 20120302 487 exchanged by 279
+0x2116 302 1 12 0 #302
+0x2117 310 1 12 0 #310
+0x2118 386 1 12 0 #386
+0x2119 441 1 12 0 #441
+0x211a 212 1 12 0 #212
+0x211b 215 1 12 0 #215
+0x211c 357 1 12 0 # correct 357
+0x211d 332 1 12 0 # correct 332
+0x211e 387 1 12 0 # correct 387
+0x211f 388 1 12 0 # correct 388
###################################################
0x2120 331 1 12 0
0x2121 478 1 12 0
-register_thresholds_current_2238high.db
\ No newline at end of file
+thresholds/register_thresholds_jul14.db
\ No newline at end of file
trbcmd setbit 0xfe11 0x22 0x08000000 #enable retransmission on mdchub
trbcmd w 0xfffd 0x20 0x30 # Clear statistics registers
- trbcmd w 0xfe15 0x4100 1
+ CTS 303 1e00000a6244da28 0010
CTS 900 9300000270e8dd28 0002
TRB3sc 1421 2c00000940a5fa28 8800
TRB3sc 3101 2900000a63092028 8810
TRB3 1541 9e0000070ee47628 8b15
TRB3 1551 360000070f366e28 8b11
TRB3 1571 b90000070f3dd528 8b14
- TRB3sc 4051 0c00000348060928 5003
- TRB3sc 4071 eb000003480c9c28 5002
+ TRB3sc 4051 0c00000348060928 5002
+ TRB3sc 4071 eb000003480c9c28 5003
TRB3sc 4091 5a00000347f16228 5001
TRB3sc 4391 d5000003480c5428 5000
TRB3sc 4121 3e000003480c5128 8880
#&readSerialsDB("../hub/serials_hub.db", "Pion-Hub",0);
#&readSerialsDB("../hub/serials_hub.db", "StartHub",0);
&readSerialsDB("../cts/serials_cts.db", "CTS",1);
+&readSerialsDB("../../daqtools/base/serials_trb3sc.db", "CTS",1);
&readSerialsDB("../mdc/serials_mdcaddon.db", "MDC-AddOn",1);
&readSerialsDB("../mdc/serials_oep.db", "MDC-OEP",1);
# &readSerialsDB("../ecal/serials_trb3sc.db", "ECal");
&readAddressesDB("../hub/addresses_hub_trb3sc.db","iTOF-Hub");
&readAddressesDB("../cts/addresses_cts.db", "CTS");
+ &readAddressesDB("../start/addresses_trb3sc.db", "CTS");
+
&readAddressesDB("../mdc/addresses_mdcaddon.db", "MDC-AddOn");
&readAddressesDB("../mdc/addresses_oep.db", "MDC-OEP");
&readAddressesDB("../ecal/addresses_ecal.db", "ECal");
sleep 1
/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb09/eb_runinfo2ora_2.txt > /home/hadaq/log/runinfo2ora_2_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb10/eb_runinfo2ora_3.txt > /home/hadaq/log/runinfo2ora_3_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb14/eb_runinfo2ora_3.txt > /home/hadaq/log/runinfo2ora_3_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb11/eb_runinfo2ora_4.txt > /home/hadaq/log/runinfo2ora_4_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb15/eb_runinfo2ora_4.txt > /home/hadaq/log/runinfo2ora_4_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb08/eb_runinfo2ora_5.txt > /home/hadaq/log/runinfo2ora_5_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb16/eb_runinfo2ora_5.txt > /home/hadaq/log/runinfo2ora_5_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb09/eb_runinfo2ora_6.txt > /home/hadaq/log/runinfo2ora_6_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb08/eb_runinfo2ora_6.txt > /home/hadaq/log/runinfo2ora_6_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb10/eb_runinfo2ora_7.txt > /home/hadaq/log/runinfo2ora_7_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb09/eb_runinfo2ora_7.txt > /home/hadaq/log/runinfo2ora_7_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb11/eb_runinfo2ora_8.txt > /home/hadaq/log/runinfo2ora_8_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb14/eb_runinfo2ora_8.txt > /home/hadaq/log/runinfo2ora_8_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb08/eb_runinfo2ora_9.txt > /home/hadaq/log/runinfo2ora_9_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb15/eb_runinfo2ora_9.txt > /home/hadaq/log/runinfo2ora_9_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb09/eb_runinfo2ora_10.txt > /home/hadaq/log/runinfo2ora_10_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb16/eb_runinfo2ora_10.txt > /home/hadaq/log/runinfo2ora_10_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb10/eb_runinfo2ora_11.txt > /home/hadaq/log/runinfo2ora_11_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb08/eb_runinfo2ora_11.txt > /home/hadaq/log/runinfo2ora_11_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb11/eb_runinfo2ora_12.txt > /home/hadaq/log/runinfo2ora_12_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb09/eb_runinfo2ora_12.txt > /home/hadaq/log/runinfo2ora_12_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb08/eb_runinfo2ora_13.txt > /home/hadaq/log/runinfo2ora_13_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb14/eb_runinfo2ora_13.txt > /home/hadaq/log/runinfo2ora_13_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb09/eb_runinfo2ora_14.txt > /home/hadaq/log/runinfo2ora_14_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb15/eb_runinfo2ora_14.txt > /home/hadaq/log/runinfo2ora_14_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb10/eb_runinfo2ora_15.txt > /home/hadaq/log/runinfo2ora_15_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb16/eb_runinfo2ora_15.txt > /home/hadaq/log/runinfo2ora_15_log.txt 2>&1 &
sleep 1
-/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb11/eb_runinfo2ora_16.txt > /home/hadaq/log/runinfo2ora_16_log.txt 2>&1 &
+/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb08/eb_runinfo2ora_16.txt > /home/hadaq/log/runinfo2ora_16_log.txt 2>&1 &
+# last is just dummy to get number of processes right
#my $runEnd = "$dtEnd->ymd('-') $dtEnd->hms(':')";
# this one is for testing
-my $runBegin = '2019-02-20 00:00:00';
+#my $runBegin = '2019-02-20 00:00:00';
+my $runBegin = '2021-02-10 00:00:00';
# default is begin of beam time with real beam
# will be replaced by last timestamp from summary file.
#!/bin/bash
+# $(date -d @1551679200 "+%Y-%m-%d %H:%M:%S") 0 0
+# $(date -d @$((1551679200+offset)) "+%Y-%m-%d %H:%M:%S") $(($offset*25/3600)) $(($offset*20/3600))
+# JAM 12-02-2021: adjusted this for feb21 first be run time
+
offset=2419200
cat <<EOF > /tmp/beam_trend.txt
# timestamp real propaganda
-$(date -d @1551679200 "+%Y-%m-%d %H:%M:%S") 0 0
-$(date -d @$((1551679200+offset)) "+%Y-%m-%d %H:%M:%S") $(($offset*25/3600)) $(($offset*20/3600))
+$(date -d @1612990204 "+%Y-%m-%d %H:%M:%S") 0 0
+$(date -d @$((1612990204+offset)) "+%Y-%m-%d %H:%M:%S") $(($offset*25/3600)) $(($offset*20/3600))
EOF
gnuplot -p <<ENDS
set key left top
-#set title "HADES Accumulated Statistics 2019"
-set xlabel "March 2019"
+#set title "HADES Accumulated Statistics 2021"
+set xlabel "February 2021"
set ylabel "Million Events"
#set y2label "Recorded Data [Gbyte]"
#set y2tics
set style line 2 lt rgb "#008800" lw 2
set style line 3 lt rgb "#5ce000" lw 2 #ffc155
set style fill transparent solid 0.4 border lc "#5ce000" #ffc155
-set yrange [0:16300]
+set yrange [0:1500]
-f(x) = 21./3600 * (x-1551679200);
-g(x) = 24./3600 * (x-1551679200);
+#f(x) = 21./3600 * (x-1612990204);
+#1551679200);
+f(x) = 24./3600 * (x-11612990204.0);
+#551679200);
set xdata time
set timefmt "%Y-%m-%d %H:%M:%S"
set format x "%d"
#set timefmt "%H:%M:%S"
#set format x "%H:%M"
-set xrange ["2019-03-03":"2019-04-01 09:00"]
-set xtics 3600*24*4
+set xrange ["2021-02-10 12:00":"2021-02-14 09:00"]
+#set xtics 3600*24*4
+set xtics 3600*24
+
+# plot '/tmp/beam_trend.txt' using 1.2:3:4 title 'Anticipated Events'ls 3 w filledcu, \
+# '/home/hadaq/oper/oraruns/runs_feb21.txt' using 2.3:(\$6/1000) title 'Recorded Events' ls 1 with lines
-plot '/tmp/beam_trend.txt' using 1.2:3:4 title 'Anticipated Events'ls 3 w filledcu, \
- '/home/hadaq/oper/oraruns/runs_mar19.txt' using 2.3:(\$6/1000) title 'Recorded Events' ls 1 with lines
+plot '/home/hadaq/oper/oraruns/runs_feb21.txt' using 2.3:(\$6/1000) title 'Recorded Events' ls 1 with lines
-# '/home/hadaq/oper/oraruns/runs_mar19.txt' using 2.3:7 ls 2 with lines axes x1y2
+# '/home/hadaq/oper/oraruns/runs_feb21.txt' using 2.3:7 ls 2 with lines axes x1y2
ENDS
scp /tmp/runstats.png hades33:/home/hadaq/trbsoft/daq/hmon/files/runstatscompare.png
-scp /tmp/runstats.png lxi001:/u/webhades/web-docs/media/logbook/mar19/
+scp /tmp/runstats.png lxi001:/u/webhades/web-docs/media/logbook/feb21/
0x5823 226 1
0x5824 228 1
0x5825 240 1
-0x5826 203 1
+0x5826 210 1
0x5827 205 1
0x5828 231 1
#Address # S/N # FPGA # Design # TRB #
###################################################
+0x0010 303 1 0 0 #Trigger box
0x0100 152 1 0 0 #central rack trig gen
0x0110 145 1 0 0 # RICH rack sensor board
0x0120 007 1 0 0 #ECal Laser Controller
+0x0130 200 1 0 0 #beam abort
0x5000 439 1 0 0
0x5001 409 1 0 0
-0x5002 407 1 0 0
-0x5003 405 1 0 0
+0x5003 407 1 0 0
+0x5002 405 1 0 0
0x5d00 338 1 0 0
###########################################################################
0 0xc800 0xc801 0xc802 0xc803 0xc804 0xc805 0xc806
2 0xc801 0xc803 0xc805 0xc806
+ 3 0xc802 0xc803
!Value table
# Gnl Conf Trg Window Ch En 1-32 Ch En 33-64 RingBufSize Invert Invert
0xfe74 0 0x50003000 0x800a00c8 0xffffffff 0x0000ffff 0x00000010 0 0
+0x5000 3 0xfffffc00 0x000000ff
+0x5003 3 0xfffffc00 0x000000ff
+0x5001 3 0xffff00ff 0x0000fc00
+0x5002 3 0xffff00ff 0x0000fc00
+0x5d00 3 0 0
+0x5d01 3 0x7fff7fff 0x7fff
+0x5d02 3 0 0
+0x5d03 3 0 0
+0x5d04 3 0x7fff7fff 0x7fff
+0x5d05 3 0 0
################################################################
0 0xc800 0xc801 0xc802 0xc803 0xc804 0xc805 0xc806
1 0xc802 0xc803
+ 2 0xc805 0xc806
!Value table
# Gnl Conf Trg Window Ch En 1-32 Ch En 33-64 RingBufSize Invert 1-32 Invert 33-64
0x6474 1 0x0 0x0
0x6475 1 0x0 0x0
+0x5010 2 0 0
+0x5011 2 0 0
+
0x5010 1 0xffffffff 0x0
0x5011 1 0xffffffff 0x0
0x5012 1 0x0 0x0
#Address # S/N # FPGA # Design # TRB #
###################################################
+#######################TOF#########################
0x5C00 241 0
0x5C01 241 1
0x5C02 241 2
0x5C03 241 3
-0x5C10 088 0
-0x5C11 088 1
-0x5C12 088 2
-0x5C13 088 3
+0x5C10 264 0
+0x5C11 264 1
+0x5C12 264 2
+0x5C13 264 3
0x5C20 006 0
0x5C21 006 1
0x5C32 242 2
0x5C33 242 3
-0x5C40 113 0
-0x5C41 113 1
-0x5C42 113 2
-0x5C43 113 3
+0x5C40 265 0
+0x5C41 265 1
+0x5C42 265 2
+0x5C43 265 3
0x5C50 094 0
0x5C51 094 1
0x5C52 094 2
0x5C53 094 3
+######################FWall########################
+0x6700 267 0
+0x6701 267 1
+0x6702 267 2
+0x6703 267 3
+
+0x6710 074 0
+0x6711 074 1
+0x6712 074 2
+0x6713 074 3
+
+0x6720 266 0
+0x6721 266 1
+0x6722 266 2
+0x6723 266 3
+
#!/bin/bash
+##################TOF#######################
/home/hadaq/trbsoft/daqtools/dac_program.pl /home/hadaq/trbsoft/hadesdaq/tof/thr_trb3/tof_thr_86c0.db
/home/hadaq/trbsoft/daqtools/dac_program.pl /home/hadaq/trbsoft/hadesdaq/tof/thr_trb3/tof_thr_86c1.db
/home/hadaq/trbsoft/daqtools/dac_program.pl /home/hadaq/trbsoft/hadesdaq/tof/thr_trb3/tof_thr_86c2.db
/home/hadaq/trbsoft/daqtools/dac_program.pl /home/hadaq/trbsoft/hadesdaq/tof/thr_trb3/tof_thr_86c4.db
/home/hadaq/trbsoft/daqtools/dac_program.pl /home/hadaq/trbsoft/hadesdaq/tof/thr_trb3/tof_thr_86c5.db
+#################FWall######################
+/home/hadaq/trbsoft/daqtools/dac_program.pl /home/hadaq/trbsoft/hadesdaq/tof/thr_trb3/fw_thr_8700.db
+/home/hadaq/trbsoft/daqtools/dac_program.pl /home/hadaq/trbsoft/hadesdaq/tof/thr_trb3/fw_thr_8701.db
+/home/hadaq/trbsoft/daqtools/dac_program.pl /home/hadaq/trbsoft/hadesdaq/tof/thr_trb3/fw_thr_8702.db
+
+
#!/bin/bash
-for i in {40960..41471}; do echo "trbcmd w" $i `trbcmd r 0xfe69 $i 2>/dev/null` | awk '{print $1,$2,$4,$3,$5}' | grep -v " " >> trigger.cmd; done;
+for i in {40960..41983}; do echo "w " $i `trbcmd r 0x0010 $i 2>/dev/null` | awk '{print $1,$3,$2,$4}' | grep "^w 0x"; done;
!Register table
-#simple or
-############################################################################################################
+#simple or #Trb3sc Pairs: 3,4,1,2. Trb3 pairs: TRG 4,3 - Clk 3,4
+############################################################################################################
#TrgEnOut1 TrgEnOut1 TrgEnOut2 TrgEnOut2 TrgEnOut3 TrgEnOut3 TrgEnOut4 TrgEnOut4
#Ch00-31 Ch32-63 Ch00-31 Ch32-63 Ch00-31 Ch32-63 Ch00-31 Ch32-63
200 0xdf00 0xdf01 0xdf04 0xdf05 0xdf08 0xdf09 0xdf0c 0xdf0d
#23..16 Lim0 15..8OutSel0 15..8OutSel2
111 0xdf32 0xdf34 0xdf37
+#4 coincidence registers
+###########################################################################################################
+ 300 0xdf40 0xdf41 0xdf42 0xdf43
+
+#simple coincidence
+###########################################################################################################
+ 400 0xdf28 0xdf2c 0xdf34 #34 overlap with 111 !
+
+
+#Monitoring for 64 channels
+###########################################################################################################
+ 900 0xdf80 0xdf85
+ 902 0xdf80
+ 901 0xdf81 0xdf86 #invert
+
+
+
+
!Value table
##################################
0xfe4c 200 0x0000ffff 0 0xffff0000 0 0 0x0000ffff 0 0
0xfe4c 201 0xffffffff 0xffff 0xffffffff 0xffff 3
+ 0x5010 201 0xffffffff 0xffff 0 0 3
+ 0x5011 201 0xffffffff 0xffff 0 0 3
0x6403 200 0x0000ffff 0 0xffff0000 0 0 0 0 0
0x6413 200 0x0000ffff 0 0xffff0000 0 0 0 0 0
0x6474 200 0 0 0 0 0 0 0 0
0x6475 200 0 0 0 0 0 0 0 0
- 0x6452 200 0 0 0 0 0 0 0 0 #noisy at 23.12.20
- 0x6453 200 0 0 0 0 0 0 0 0 #noisy at 23.12.20
+# 0x6452 200 0 0 0 0 0 0 0 0 #noisy at 23.12.20
+# 0x6453 200 0 0 0 0 0 0 0 0 #noisy at 23.12.20
0x5010 200 0x0000ffff 0 0xffff0000 0 0 0 0 0
0x5012 200 0 0 0 0 0 0 0 0
-#TOF, fRPC, Veto, STS central FPGA: 'or' of all peripherals to output 3
+#TOF, fRPC, Veto, STS central FPGA: 'or' of all peripherals to output 3 and 4
##################################
- 0xfe40 200 0 0 0 0 0xffff 0 0 0
- 0xfe40 201 0xffff 0 0 0 5
+ 0xfe40 200 0 0 0 0 0xffff 0 0xffff 0
+ 0xfe40 201 0xffff 0 0 0 3
+
+#TOF, fRPC TDC: forward to central FPGA in groups of 16
+ 0xfe47 200 0x0000ffff 0 0xffff0000 0 0 0x0000ffff 0xffffffff 0
+ 0x6810 100 0xF 0 0x30000 0x400 #mult2 for PMT signals
+#fRPC: 1 and 2 or 3 and 4
+ 0x8c00 111 0 0x80000 0
+ 0x8c00 300 0x80000703 0x80000F0B 0 0
+ 0x8c10 111 0 0x80000 0
+ 0x8c10 300 0x80000703 0x80000F0B 0 0
+ 0x8c10 200 0 0 0 0 4 0 0 0 #PMT signal
+
+#Veto
+ 0x8890 200 0 0 0 0 0x088 0 0 0
+ 0x5010 400 0xffff 0xffff0000 0x8 #left/right coincidence for bars
+ 0x5011 400 0xffff 0xffff0000 0x8
+
+#Wall: all to second output
+ 0x6700 200 0 0 0xffffffff 0
+ 0x6701 200 0 0 0xffffffff 0
+ 0x6702 200 0 0 0xffffffff 0
+ 0x6703 200 0 0 0xffffffff 0
+ 0x6710 200 0 0 0xffffffff 0
+ 0x6711 200 0 0 0xffffffff 0
+ 0x6712 200 0 0 0xffffffff 0
+ 0x6713 200 0 0 0xffffffff 0
+ 0x6720 200 0 0 0xffffffff 0
+ 0x6721 200 0 0 0xffffffff 0
+ 0x6722 200 0 0 0xffffffff 0
+ 0x6723 200 0 0 0xffffffff 0
+
+
#Start: or of all channels, in groups of 16 on Pair 1-3, or on Pair 4
##################################
- 0x5000 200 0 0x0000ffff 0xffffffff 0xffff 0x0000ffff 0 0xffff0000 0
- 0x5001 200 0 0x0000ffff 0xffffffff 0xffff 0x0000ffff 0 0xffff0000 0
- 0x5002 200 0 0x0000ffff 0xffffffff 0xffff 0x0000ffff 0 0xffff0000 0
- 0x5003 200 0 0x0000ffff 0xffffffff 0xffff 0x0000ffff 0 0xffff0000 0
+ 0x5000 200 0 0x000000ff 0xfffffc00 0x000000ff 0x0000fc00 0 0xffff0000 0
+ 0x5003 200 0 0x000000ff 0xfffffc00 0x000000ff 0x0000fc00 0 0xffff0000 0
+ 0x5001 200 0 0x0000fc00 0xffff00ff 0x0000fc00 0x000000ff 0 0xffff0000 0
+ 0x5002 200 0 0x0000fc00 0xffff00ff 0x0000fc00 0x000000ff 0 0xffff0000 0
+
#iTOF: or of all channels, multiplicity in groups of 12/16 on Pair 2,3,4 and or on 1
##################################
- 0x5d00 110 0x00000fff 0 0x0fff0000 0 0 0x00000fff
- 0x5d01 110 0x00000fff 0 0x0fff0000 0 0 0x00000fff
- 0x5d02 110 0x00000fff 0 0x0fff0000 0 0 0x00000fff
- 0x5d03 110 0x00000fff 0 0x0fff0000 0 0 0x00000fff
- 0x5d04 110 0x00000fff 0 0x0fff0000 0 0 0x00000fff
- 0x5d05 110 0x00000fff 0 0x0fff0000 0 0 0x00000fff
- 0x5d00 111 0x03030300 0x00000800 0x00000201
- 0x5d01 111 0x03030300 0x00000800 0x00000201
- 0x5d02 111 0x03030300 0x00000800 0x00000201
- 0x5d03 111 0x03030300 0x00000800 0x00000201
- 0x5d04 111 0x03030300 0x00000800 0x00000201
- 0x5d05 111 0x03030300 0x00000800 0x00000201
-
- 0x5d00 200 0 0 0 0 0xffffffff 0xffff 0 0
- 0x5d01 200 0 0 0 0 0xffffffff 0xffff 0 0
- 0x5d02 200 0 0 0 0 0xffffffff 0xffff 0 0
- 0x5d03 200 0 0 0 0 0xffffffff 0xffff 0 0
- 0x5d04 200 0 0 0 0 0xffffffff 0xffff 0 0
- 0x5d05 200 0 0 0 0 0xffffffff 0xffff 0 0
+# 0x5d00 110 0 0 0 0 0 0
+ 0x5d01 110 0x00007bde 0 0x7bde0000 0 0 0x00007bde
+# 0x5d02 110 0 0 0 0 0 0
+# 0x5d03 110 0 0 0 0 0 0
+ 0x5d04 110 0x00007bde 0 0x7bde0000 0 0 0x00007bde
+# 0x5d05 110 0 0 0 0 0 0
+# 0x5d00 111 0x03030300 0x00000800 0x00000201
+ 0x5d01 111 0x03030300 0x00000800 0x00000201
+# 0x5d02 111 0x03030300 0x00000800 0x00000201
+# 0x5d03 111 0x03030300 0x00000800 0x00000201
+ 0x5d04 111 0x03030300 0x00000800 0x00000201
+# 0x5d05 111 0x03030300 0x00000800 0x00000201
+
+# 0x5d00 200 0 0 0 0 0x7bde7bde 0x7bde 0 0
+ 0x5d01 200 0 0 0 0 0x7bde7bde 0x7bde 0 0
+# 0x5d02 200 0 0 0 0 0x7bde7bde 0x7bde 0 0
+# 0x5d03 200 0 0 0 0 0x7bde7bde 0x7bde 0 0
+ 0x5d04 200 0 0 0 0 0x7bde7bde 0x7bde 0 0
+# 0x5d05 200 0 0 0 0 0x7bde7bde 0x7bde 0 0
#Secondary trigger box
##################################
#from STS: STS-1 #16..19, STS-2 #32..37
#from fRPC: #42,46
-##Setup 1: or of all 12 half sectors on output 1 - needs update
-# 0x0100 200 0x00003e3e
-# 0x0100 201 0x00003e3e 0 0 0 0
+##Setup 1: or of all 12 Ecal half sectors on output 1 - needs update
+#Setup 2: or of all Veto channels
+#Setup 3: or of all STS boards on output 3
+#Setup 4: from fRPC (PMT mult2 plus both ends of RPC)
-##Setup 2: mult 2 on half sectors on output 2 - needs update
-# 0x0100 100 0x00003e3e 0 0x00020000 0x00000200
+ 0x0100 200 0 0x00003e3e 0x40000 0 0x00000037 0x000f0000 0x00000c00 0
+ 0x0100 201 0 0x00003e3e 0 0 0
-#Setup 3: or of all STS boards
- 0x0100 200 0x0000003f 0x000f0000
+
+#Monitoring Enable
+##################################
+ 0xfe60 900 0xffffffff 0xffffffff
+ 0xfe61 900 0xffffffff 0xffffffff
+ 0xfe71 900 0xffffffff 0xffffffff
+ 0xfe73 900 0xffffffff 0xffffffff
+ 0xfe47 902 0xffffffff
+ 0xfe4c 900 0xffffffff 0xffff
+ 0xfe40 902 0x000fffff
+ 0x0100 900 0xffffffff 0xffffffff #secondary box
+
+ 0x5000 900 0xffff0015 0x000000ff #disable unused channels in Start 0xffff0000
+ 0x5001 900 0xffff00ff 0x0000fc00
+ 0x5002 900 0xffff00ff 0x0000fc00
+ 0x5003 900 0xfffffc00 0x000000ff
+
+ 0x5d00 900 0 0 #innerTOF
+ 0x5d01 900 0x7fff7fff 0x7fff
+ 0x5d02 900 0 0
+ 0x5d03 900 0 0
+ 0x5d04 900 0x7fff7fff 0x7fff
+ 0x5d05 900 0 0
+
+ 0xfe4c 901 0xffffffff 0xffff #invert monitor for STS/Veto
-#All monitoring channels on crate masters
-trbcmd w 0xfe60 0xdf80 0xffffffff
-trbcmd w 0xfe60 0xdf85 0xffffffff
-
-trbcmd w 0xfe61 0xdf80 0xffffffff
-trbcmd w 0xfe61 0xdf85 0xffffffff
-
-trbcmd w 0xfe71 0xdf80 0xffffffff
-trbcmd w 0xfe71 0xdf85 0x0000ffff
-trbcmd w 0xfe74 0xdf80 0xffffffff
-trbcmd w 0xfe74 0xdf85 0x0000ffff
-
-trbcmd w 0xfe73 0xdf80 0xffffffff
-trbcmd w 0xfe73 0xdf85 0x0000ffff
-
-trbcmd w 0xfe47 0xdf80 0xffffffff
-trbcmd w 0xfe4c 0xdf80 0xffffffff
-trbcmd w 0xfe4c 0xdf85 0x0000ffff
-
-trbcmd w 0xfe40 0xdf80 0x000fffff
-
-trbcmd w 0x0100 0xdf80 0xffffffff
-trbcmd w 0x0100 0xdf85 0xffffffff
-
-trbcmd w 0xfe4c 0xdf81 0xffffffff #invert monitor for STS/Veto
-trbcmd w 0xfe4c 0xdf86 0x0000ffff
-
-
-
exec_cmd{local} /home/hadaq/trbsoft/daqtools/tools/loadregisterdb_file.pl /home/hadaq/trbsoft/daq/trg/register_trigger.db
-
+exec_cmd{local} trbcmd -f /home/hadaq/trbsoft/daq/trg/triggerbox.trbcmd