--- /dev/null
+#!/bin/bash
+export myvar=$(doyoureallywant.pl "to switch off all HV?" "Emergency Shutdown.")
+if [ $myvar == "256" ]; then exit; fi
+
+xterm -geometry 80x24 -bg orange -fg black -e bash --login -c '
+ ssh hadaq@lxhadesdaqp "
+ export DAQOPSERVER=hadesp31
+ echo \" <HV> Connected to lxhadesdaq...\"
+ echo \" <HV> Shutting off HV...\"
+ /home/hadaq/trbsoft/hadesdaq/utils/HV_switches.pl all off
+ echo \"Done\"
+ sleep 10
+"
+'
+
#!/bin/bash
-export myvar=$(doyoureallywant.pl "to powercycle the RICH LV?")
+export myvar=$(doyoureallywant.pl "to powercycle the MDC 1/2 LV?")
if [ $myvar == "256" ]; then exit; fi
xterm -e bash --login -c '
source /home/hadaq/.bash_profile
echo Switch off trigger
timeout 1s trbcmd setbit 0x0003 0xa0c0 0x400
- echo \"Starting a RICH power cycle...\"
+ echo \"Starting a MDC 1/2 power cycle...\"
cd /home/hadaq/trbsoft/hadesdaq/utils;
PERLLIB=/home/hadaq/EPICS/EPICS-3.15.6/base/lib/perl ./Powercycle_MDCnew.pl;
echo Done
# JAM 9-22: test new api servers
#LTSM_FSD_SERVERS: lxfsq12 lxfsq09 lxfsq10 lxfsq11 lxfsq12
-#LTSM_FSD_SERVERS: lxfsq11 lxfsq12 lxfsq15 lxfsq16 lxfsq11
-LTSM_FSD_SERVERS: lxfsq08 lxfsq08 lxfsq10 lxfsq11 lxfsq08
+LTSM_FSD_SERVERS: lxfsq11 lxfsq12 lxfsq15 lxfsq16 lxfsq11
+#LTSM_FSD_SERVERS: lxfsq08 lxfsq09 lxfsq10 lxfsq11 lxfsq08
#Start must be the first for EvtId
0x8800 1 CentralCTS low lxhadeb17 0
0x8810 1 CentralAUX low lxhadeb17 0
-0x8880 0 StartTRB3 low lxhadeb17 2
+0x8880 1 StartTRB3 low lxhadeb17 2
#0x8890 0 Veto mid lxhadeb15 2
0x84c0 1 RPCnew1 mid lxhadeb14 2
0x84c1 1 RPCnew2 mid lxhadeb16 2
#0x8590 1 MDC34sec4 high lxhadeb14 0
#0x85a0 1 MDC34sec5 high lxhadeb14 0
#0x85b0 1 MDC34sec6 high lxhadeb14 0
-0x8700 1 FW0 mid lxhadeb18 1
-0x8701 1 FW1 mid lxhadeb18 1
-0x8702 1 FW2 mid lxhadeb18 1
+0x8700 1 FW0 mid lxhadeb18 2
+0x8701 1 FW1 mid lxhadeb18 2
+0x8702 1 FW2 mid lxhadeb18 2
0x8a00 1 ECal0 mid lxhadeb16 2
0x8a01 1 ECal1 mid lxhadeb14 2
0x8a02 1 ECal2 mid lxhadeb15 2
#JAM feb-2014
# need to specify oracle environment for remote icinga restart:
-export ORACLE_HOME=/usr/lib/oracle/12.1/client64
+#export ORACLE_HOME=/usr/lib/oracle/12.1/client64
+# new for debian11 JAM:
+export ORACLE_HOME=/usr/lib/oracle/12-alternative/client64
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
cd /home/hadaq/oper/daq2ora/
&readSerialsDB("../../daqtools/base/serials_trb3.db", "VetoHub",1);
&readSerialsDB("../../daqtools/base/serials_trb3sc.db", "iTOF-Hub",1);
+
+
#&readSerialsDB("../hub/serials_hub.db", "RPC-Hub",0);
#&readSerialsDB("../hub/serials_hub.db", "TOF-Hub",0);
#&readSerialsDB("../hub/serials_hub.db", "Wall-Hub",0);
&readSerialsDB("../sts/serials_trb3.db", "Wall",1);
&readSerialsDB("../sts/serials_trb3.db", "STS",1);
&readSerialsDB("../frpc/serials_trb3.db", "fRPC",1);
+ # JAM1-2025: new for MDC upgrade:
+ &readSerialsDB("../../daqtools/base/serials_mdcmbo.db", "MDCnew-TDC",1);
+ &readSerialsDB("../../daqtools/base/serials_mdcmbo.db", "MDCnew-OEP",1);
+ &readSerialsDB("../../daqtools/base/serials_trb3sc.db", "MDCnew-Hub",1);
#- Read addresses_db
#&readAddressesDB("../start/addresses_start.db", "StartVeto");
&readAddressesDB("../hub/addresses_hub_trb3.db","VetoHub");
&readAddressesDB("../hub/addresses_hub_trb3sc.db","iTOF-Hub");
&readAddressesDB("../hub/addresses_hub_trb3.db","Wall-Hub");
+
+ # JAM1-2025: new for MDC upgrade:
+ &readAddressesDB("../hub/addresses_hub_mdcupgrade.db","MDCnew-Hub");
&readAddressesDB("../cts/addresses_cts.db", "CTS");
&readAddressesDB("../start/addresses_trb3sc.db", "CTS");
#&readAddressesDB("../wall/addresses_wall.db", "Wall");
&readAddressesDB("../sts/addresses_sts.db", "STS");
&readAddressesDB("../frpc/addresses_frpc.db", "fRPC");
-
-
-
+ # JAM1-2025: new for MDC upgrade:
+ &readAddressesDB("../../hades_mdc_settings/settings_oep/auto/addresses_mdc.db", "MDCnew-OEP");
+ &readAddressesDB("../../hades_mdc_settings/settings_oep/auto/addresses_mdc.db", "MDCnew-TDC");
}
sub readSubEvtIdsDB()
{
my ($file2read, $type) = @_;
- #print "readAddressesDB is reading file $file2read for type $type \n ";
+#print "readAddressesDB is reading file $file2read for type $type \n ";
my $fh = new FileHandle($file2read, "r") or die "could not open file $file2read";;
#JAM 16-mar-2017
# need to specify oracle environment for remote icinga restart:
-export ORACLE_HOME=/usr/lib/oracle/12.1/client64
+export ORACLE_HOME=/usr/lib/oracle/12-alternative/client64
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
cd /home/hadaq/oper/postgres2ora/
#/home/hadaq/trbsoft/daq/oracle/postgres2ora.pl -opass hades -ppass yyyyyy -o >> postgres2oraFeb24.log 2>&1
-/home/hadaq/trbsoft/daq/oracle/postgres2ora.pl -opass hades -ppass '$report' -o >> postgres2oraFeb24.log 2>&1
+/home/hadaq/trbsoft/daq/oracle/postgres2ora.pl -opass hades -ppass '$report' -o >> postgres2oraApr25deb.log 2>&1
#echo "killing old processes:" /bin/pidof -x runinfo2ora.pl
/bin/pidof -x runinfo2ora.pl | /usr/bin/xargs /bin/kill '-s 9'
# need to specify oracle environment for remote icinga restart:
-export ORACLE_HOME=/usr/lib/oracle/12.1/client64
+#export ORACLE_HOME=/usr/lib/oracle/12.1/client64
+export ORACLE_HOME=/usr/lib/oracle/12-alternative/client64
+#export ORACLE_HOME=/usr/lib/oracle/21/client64
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
/home/hadaq/trbsoft/daq/oracle/runinfo2ora.pl -f /home/hadaq/oper/lxhadeb08/eb_runinfo2ora_1.txt > /home/hadaq/log/runinfo2ora_1_log.txt 2>&1 &
-my $summary_file = "/home/hadaq/oper/oraruns/runs_feb24.txt";
-my $latest_file = "/home/hadaq/oper/oraruns/current_feb24.txt";
+my $summary_file = "/home/hadaq/oper/oraruns/runs_sep24.txt";
+my $latest_file = "/home/hadaq/oper/oraruns/current_sep24.txt";
#exit(0);
# $(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
-# JAM 10-01-2022: TODO for feb22
+# JAM 10-01-2022: TODO for feb22
# JAM 08-01-24 for feb24
+# SSP 01-03-24 for feb24 Au+Au part
+# SSP 04-03-24 for feb24 official values
-start=1707260400 # 7-feb-24
-breakstart=1707433200 # 9-feb-24
-breakend=1709161200 # 29-feb-24
-end=1711234800 # 24-mar-24
+StartCC=1707282000 # 07-FEB-2024 06:00
+EndCC=1707454800 # 09-FEB-2024 06:00
+StartAuAu=1709182800 # 29-FEB-2024 06:00
+EndAuAu=1711170000 # 23-MAR-2024 06:00
-cat <<EOF > /tmp/beam_trend.txt
+MEventsAnticipatedCCMin=2930
+MEventsAnticipatedCCMax=3130
+MEventsAnticipatedAuAuMin=10000
+MEventsAnticipatedAuAuMax=14000
+MEventsProposedAuAuMin=14000
+MEventsProposedAuAuMax=18000
+
+MEventsMax=$((((MEventsAnticipatedCCMax + MEventsProposedAuAuMax + 500) / 1000) * 1000))
+
+cat << EOF > /tmp/beam_trend_approved.txt
# timestamp real propaganda
-$(date -d @$(($start)) "+%Y-%m-%d %H:%M:%S") 0 0
-$(date -d @$(($breakstart)) "+%Y-%m-%d %H:%M:%S") $((($breakstart-$start)*1650/86400)) $((($breakstart-$start)*1450/86400))
-$(date -d @$(($breakend)) "+%Y-%m-%d %H:%M:%S") $((($breakstart-$start)*1650/86400)) $((($breakstart-$start)*1450/86400))
-$(date -d @$(($end+25000)) "+%Y-%m-%d %H:%M:%S") $((($end-$start+$breakstart-$breakend)*1650/86400)) $((($end-$start+$breakstart-$breakend)*1450/86400))
+$(date -d @${StartCC} "+%Y-%m-%d %H:%M:%S") 0 0
+$(date -d @${EndCC} "+%Y-%m-%d %H:%M:%S") ${MEventsAnticipatedCCMin} ${MEventsAnticipatedCCMax}
+$(date -d @${StartAuAu} "+%Y-%m-%d %H:%M:%S") ${MEventsAnticipatedCCMin} ${MEventsAnticipatedCCMax}
+$(date -d @${EndAuAu} "+%Y-%m-%d %H:%M:%S") $((MEventsAnticipatedCCMin + MEventsAnticipatedAuAuMin)) $((MEventsAnticipatedCCMax + MEventsAnticipatedAuAuMax))
+EOF
+
+cat << EOF > /tmp/beam_trend_proposal.txt
+# timestamp real propaganda
+$(date -d @${StartAuAu} "+%Y-%m-%d %H:%M:%S") ${MEventsAnticipatedCCMax} ${MEventsAnticipatedCCMax}
+$(date -d @${EndAuAu} "+%Y-%m-%d %H:%M:%S") $((MEventsAnticipatedCCMax + MEventsProposedAuAuMin)) $((MEventsAnticipatedCCMax + MEventsProposedAuAuMax))
EOF
-#1.6 million per day nominal + 10% due to PT2
-# TODO: adjust expected rates, different for first period and second
-#start=1643778000 #2.2. 6h
+# 1.6 million per day nominal + 10% due to PT2
+# TODO: adjust expected rates, different for first period and second
+# Proposal: 2 billion events C+C @ 800MeV on 2 days -> Increased to 3.030 billion events to adjust for the high rates run without magnetic field which cannot be used for physics analyses
+# Proposal: 3 billion events Au+Au @ 800 and 600MeV each and 0.94 billion events Au+Au @ 400 and 200MeV each on 23 days
+# Official decision for Au+Au: Anticipated events: Ideally: 16 billion total, Approved: 12 billion
-cat <<EOF > /tmp/beamtime.txt
+cat << EOF > /tmp/scheduled_breaks.txt
# timestamp real propaganda
-$(date -d @$(($start-1000000)) "+%Y-%m-%d %H:%M:%S") 50000 0
-$(date -d @$(($start-20001)) "+%Y-%m-%d %H:%M:%S") 50000 0
-$(date -d @$(($start-20000)) "+%Y-%m-%d %H:%M:%S") 0 0
-$(date -d @$(($breakstart-1)) "+%Y-%m-%d %H:%M:%S") 0 0
-$(date -d @$(($breakstart)) "+%Y-%m-%d %H:%M:%S") 50000 0
-$(date -d @$(($breakend)) "+%Y-%m-%d %H:%M:%S") 50000 0
-$(date -d @$(($breakend+1)) "+%Y-%m-%d %H:%M:%S") 0 0
-$(date -d @$(($end+25000)) "+%Y-%m-%d %H:%M:%S") 0 0
-$(date -d @$(($end+25001)) "+%Y-%m-%d %H:%M:%S") 50000 0
-$(date -d @$(($end+1000000)) "+%Y-%m-%d %H:%M:%S") 50000 0
+$(date -d @$((StartCC - 7*86400)) "+%Y-%m-%d %H:%M:%S") ${MEventsMax} 0 # One week before the start of C+C
+$(date -d @$((StartCC - 1)) "+%Y-%m-%d %H:%M:%S") ${MEventsMax} 0 # Directly before the start of C+C
+$(date -d @$((StartCC)) "+%Y-%m-%d %H:%M:%S") 0 0 # At the start of C+C
+$(date -d @$((EndCC - 1)) "+%Y-%m-%d %H:%M:%S") 0 0 # Directly before the end of C+C
+$(date -d @$((EndCC)) "+%Y-%m-%d %H:%M:%S") ${MEventsMax} 0 # At the end of C+C
+$(date -d @$((StartAuAu - 1)) "+%Y-%m-%d %H:%M:%S") ${MEventsMax} 0 # Directly before the start of Au+Au
+$(date -d @$((StartAuAu)) "+%Y-%m-%d %H:%M:%S") 0 0 # At the start of Au+Au
+$(date -d @$((EndAuAu - 1)) "+%Y-%m-%d %H:%M:%S") 0 0 # Directly before the end of Au+Au
+$(date -d @$((EndAuAu)) "+%Y-%m-%d %H:%M:%S") ${MEventsMax} 0 # At the end of Au+Au
+$(date -d @$((EndAuAu + 7*86400)) "+%Y-%m-%d %H:%M:%S") ${MEventsMax} 0 # One week after the end of Au+Au
+EOF
+
+cat << EOF > /tmp/magnet_failure.txt
+2024-03-04 13:50:00 ${MEventsMax} 0 # At the magnet failure
+$(date -d @${EndAuAu} "+%Y-%m-%d %H:%M:%S") ${MEventsMax} 0 # End of beamtime - Unfortunately
EOF
-gnuplot -p <<ENDS
+gnuplot -p << ENDS
set term png size 800,500 truecolor font "serif,13"
set out "/tmp/runstats.png"
+set tmargin 1
+set rmargin 1.6
+set lmargin 9
-set key left top
+set key at $((StartCC - 1*86400)),20300 left top vertical width -2 heigh 0.5 box opaque
#set title "HADES Accumulated Statistics 2024"
set xlabel "Feb/Mar 2024"
-set ylabel "Million Events"
+set ylabel "Million Events" offset 1
#set y2label "Recorded Data [Gbyte]"
#set y2tics
#set ytics nomirror
-set style line 1 lt rgb "#000000" lw 3 #dd7700
-set style line 2 lt rgb "#008800" lw 2
-set style line 3 lt rgb "#5ce000" lw 2 #ffc155
-set style line 4 lt rgb "#aaaaaa" lw 2 #888888
-set style fill transparent solid 0.4 border lc "#5ce000" #ffc155
-set yrange [0:46000]
-
-#f(x) = 65/3600 * (x-1612990204);
-#1551679200);
-# f(x) = 60/3600 * (x-1612990204.0);
-#551679200);
+set style line 1 lt rgb "#000000" lw 3
+set style line 2 lt rgb "#aaaaaa" lw 0
+set style line 3 lt rgb "#5ce000" lw 0
+set style line 4 lt rgb "#0000e0" lw 0
+set style line 5 lt rgb "#e00000" lw 0
+set style fill transparent solid 0.4 noborder #lc "#5ce000"
+set yrange [0:${MEventsMax}]
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 ["2024-02-01 00:00":"2024-03-24 00:00"]
-#set xtics 3600*24*4
-set xtics 7200*24
-
- plot '/tmp/beamtime.txt' using 1.2:3:4 title "Beamtime" ls 4 w filledcu, \
- '/tmp/beam_trend.txt' using 1.2:3:4 title 'Anticipated Events'ls 3 w filledcu, \
- '/home/hadaq/oper/oraruns/runs_feb24.txt' using 2.3:(\$6/1100) title 'Recorded Events' ls 1 with lines
-
+set xrange [$((StartCC - 2*86400)):$((EndAuAu))]
+set xtics 2*3600*24
+plot '/tmp/scheduled_breaks.txt' using 1.2:3:4 title 'Scheduled Breaks' ls 2 w filledcu, \
+ '/tmp/beam_trend_approved.txt' using 1.2:3:4 title 'Anticipated Events' ls 3 w filledcu, \
+ '/tmp/beam_trend_proposal.txt' using 1.2:3:4 title 'Proposed Events' ls 4 w filledcu, \
+ '/tmp/magnet_failure.txt' using 1.2:3:4 title 'HADES Magnet Failure' ls 5 w filledcu, \
+ '/home/hadaq/oper/oraruns/runs_feb24.txt' using 2.3:(\$6/1000) title 'Recorded Events' ls 1 with lines
ENDS
-
scp /tmp/runstats.png hades33:/home/hadaq/trbsoft/daq/hmon/files/runstatscompare.png
#scp /tmp/runstats.png lxpool:/u/webhades/web-docs/media/logbook/feb24/
scp /tmp/runstats.png lxi098:/u/webhades/web-docs/media/logbook/feb24/
# Address # S/N # FPGA
0x5003 004 1 # StartY2
-0x5000 005 1 # StartX2
-0x5001 006 1 # StartY1
+0x5000 010 1 # StartX2 (old #5) New #10
+0x5001 005 1 # StartY1 (old #6) (old #13) New #05
0x5002 007 1 # StartX1
# 0x5000 004 1 #
#~/trbsoft/daqtools/tools/padiwa.pl 0xfe76 0 invert 0xffff
#~/trbsoft/daqtools/tools/padiwa.pl 0xfe76 1 invert 0xffff
+echo current_thresholds
~/trbsoft/daqtools/thresholds/write_thresholds.pl current_thresholds --mode=dirich2 --offset=0
-2024/02/07 06:46:15 endpoint: 0x5000, chain: 00, channel: 0 threshold: 0xa699, uid: 0
-2024/02/07 06:46:15 endpoint: 0x5000, chain: 00, channel: 1 threshold: 0xa851, uid: 0
-2024/02/07 06:46:15 endpoint: 0x5000, chain: 00, channel: 2 threshold: 0xfffa, uid: 0
-2024/02/07 06:46:15 endpoint: 0x5000, chain: 00, channel: 3 threshold: 0xa519, uid: 0
-2024/02/07 06:46:15 endpoint: 0x5000, chain: 00, channel: 4 threshold: 0xa3cb, uid: 0
-2024/02/07 06:46:15 endpoint: 0x5000, chain: 00, channel: 5 threshold: 0xfffa, uid: 0
-2024/02/07 06:46:15 endpoint: 0x5000, chain: 00, channel: 6 threshold: 0xa64b, uid: 0
-2024/02/07 06:46:15 endpoint: 0x5000, chain: 00, channel: 7 threshold: 0xa91f, uid: 0
-2024/02/07 06:46:29 endpoint: 0x5001, chain: 00, channel: 0 threshold: 0x3da7, uid: 0
-2024/02/07 06:46:29 endpoint: 0x5001, chain: 00, channel: 1 threshold: 0x4110, uid: 0
-2024/02/07 06:46:29 endpoint: 0x5001, chain: 00, channel: 2 threshold: 0x000f, uid: 0
-2024/02/07 06:46:29 endpoint: 0x5001, chain: 00, channel: 3 threshold: 0x4508, uid: 0
-2024/02/07 06:46:29 endpoint: 0x5001, chain: 00, channel: 4 threshold: 0x41fd, uid: 0
-2024/02/07 06:46:29 endpoint: 0x5001, chain: 00, channel: 5 threshold: 0x000f, uid: 0
-2024/02/07 06:46:29 endpoint: 0x5001, chain: 00, channel: 6 threshold: 0x3cd5, uid: 0
-2024/02/07 06:46:29 endpoint: 0x5001, chain: 00, channel: 7 threshold: 0x45e5, uid: 0
-2024/02/07 06:46:44 endpoint: 0x5002, chain: 00, channel: 0 threshold: 0xa609, uid: 0
-2024/02/07 06:46:44 endpoint: 0x5002, chain: 00, channel: 1 threshold: 0xae05, uid: 0
-2024/02/07 06:46:44 endpoint: 0x5002, chain: 00, channel: 2 threshold: 0xfffa, uid: 0
-2024/02/07 06:46:44 endpoint: 0x5002, chain: 00, channel: 3 threshold: 0xaf7d, uid: 0
-2024/02/07 06:46:44 endpoint: 0x5002, chain: 00, channel: 4 threshold: 0xa1c7, uid: 0
-2024/02/07 06:46:44 endpoint: 0x5002, chain: 00, channel: 5 threshold: 0xfffa, uid: 0
-2024/02/07 06:46:44 endpoint: 0x5002, chain: 00, channel: 6 threshold: 0xa501, uid: 0
-2024/02/07 06:46:44 endpoint: 0x5002, chain: 00, channel: 7 threshold: 0xab3d, uid: 0
-2024/02/07 06:46:58 endpoint: 0x5003, chain: 00, channel: 0 threshold: 0x3e8e, uid: 0
-2024/02/07 06:46:58 endpoint: 0x5003, chain: 00, channel: 1 threshold: 0x45f9, uid: 0
-2024/02/07 06:46:58 endpoint: 0x5003, chain: 00, channel: 2 threshold: 0x000f, uid: 0
-2024/02/07 06:46:58 endpoint: 0x5003, chain: 00, channel: 3 threshold: 0x44bb, uid: 0
-2024/02/07 06:46:58 endpoint: 0x5003, chain: 00, channel: 4 threshold: 0x42d2, uid: 0
-2024/02/07 06:46:58 endpoint: 0x5003, chain: 00, channel: 5 threshold: 0x000f, uid: 0
-2024/02/07 06:46:58 endpoint: 0x5003, chain: 00, channel: 6 threshold: 0x4054, uid: 0
-2024/02/07 06:46:58 endpoint: 0x5003, chain: 00, channel: 7 threshold: 0x469c, uid: 0
-2024/02/07 06:47:13 endpoint: 0x5004, chain: 00, channel: 0 threshold: 0x7d05, uid: 0
-2024/02/07 06:47:13 endpoint: 0x5004, chain: 00, channel: 1 threshold: 0x7d31, uid: 0
-2024/02/07 06:47:13 endpoint: 0x5004, chain: 00, channel: 2 threshold: 0x7dbf, uid: 0
-2024/02/07 06:47:13 endpoint: 0x5004, chain: 00, channel: 3 threshold: 0x7bbb, uid: 0
-2024/02/07 06:47:13 endpoint: 0x5004, chain: 00, channel: 4 threshold: 0x7c01, uid: 0
-2024/02/07 06:47:13 endpoint: 0x5004, chain: 00, channel: 5 threshold: 0x7c67, uid: 0
-2024/02/07 06:47:13 endpoint: 0x5004, chain: 00, channel: 6 threshold: 0x7b41, uid: 0
-2024/02/07 06:47:13 endpoint: 0x5004, chain: 00, channel: 7 threshold: 0x7cf3, uid: 0
+2025/04/14 14:09:59 endpoint: 0x5000, chain: 00, channel: 0 threshold: 0x8c49, uid: 0
+2025/04/14 14:09:59 endpoint: 0x5000, chain: 00, channel: 1 threshold: 0x7ab5, uid: 0
+2025/04/14 14:09:59 endpoint: 0x5000, chain: 00, channel: 2 threshold: 0x7aad, uid: 0
+2025/04/14 14:09:59 endpoint: 0x5000, chain: 00, channel: 3 threshold: 0x7859, uid: 0
+2025/04/14 14:09:59 endpoint: 0x5000, chain: 00, channel: 4 threshold: 0x7cb3, uid: 0
+2025/04/14 14:09:59 endpoint: 0x5000, chain: 00, channel: 5 threshold: 0x7e69, uid: 0
+2025/04/14 14:09:59 endpoint: 0x5000, chain: 00, channel: 6 threshold: 0x809f, uid: 0
+2025/04/14 14:09:59 endpoint: 0x5000, chain: 00, channel: 7 threshold: 0x848b, uid: 0
+2025/04/14 14:10:13 endpoint: 0x5001, chain: 00, channel: 0 threshold: 0x6e09, uid: 0
+2025/04/14 14:10:13 endpoint: 0x5001, chain: 00, channel: 1 threshold: 0x6e50, uid: 0
+2025/04/14 14:10:13 endpoint: 0x5001, chain: 00, channel: 2 threshold: 0x706b, uid: 0
+2025/04/14 14:10:13 endpoint: 0x5001, chain: 00, channel: 3 threshold: 0x6f32, uid: 0
+2025/04/14 14:10:13 endpoint: 0x5001, chain: 00, channel: 4 threshold: 0x6fcf, uid: 0
+2025/04/14 14:10:13 endpoint: 0x5001, chain: 00, channel: 5 threshold: 0x6f80, uid: 0
+2025/04/14 14:10:13 endpoint: 0x5001, chain: 00, channel: 6 threshold: 0x6ff9, uid: 0
+2025/04/14 14:10:13 endpoint: 0x5001, chain: 00, channel: 7 threshold: 0x6ac7, uid: 0
+2025/04/14 14:10:28 endpoint: 0x5002, chain: 00, channel: 0 threshold: 0x79ed, uid: 0
+2025/04/14 14:10:28 endpoint: 0x5002, chain: 00, channel: 1 threshold: 0x74e3, uid: 0
+2025/04/14 14:10:28 endpoint: 0x5002, chain: 00, channel: 2 threshold: 0x72af, uid: 0
+2025/04/14 14:10:28 endpoint: 0x5002, chain: 00, channel: 3 threshold: 0x737d, uid: 0
+2025/04/14 14:10:28 endpoint: 0x5002, chain: 00, channel: 4 threshold: 0x73bb, uid: 0
+2025/04/14 14:10:28 endpoint: 0x5002, chain: 00, channel: 5 threshold: 0x735b, uid: 0
+2025/04/14 14:10:28 endpoint: 0x5002, chain: 00, channel: 6 threshold: 0x7319, uid: 0
+2025/04/14 14:10:28 endpoint: 0x5002, chain: 00, channel: 7 threshold: 0x7481, uid: 0
+2025/04/14 14:10:42 endpoint: 0x5003, chain: 00, channel: 0 threshold: 0x6db5, uid: 0
+2025/04/14 14:10:42 endpoint: 0x5003, chain: 00, channel: 1 threshold: 0x7022, uid: 0
+2025/04/14 14:10:42 endpoint: 0x5003, chain: 00, channel: 2 threshold: 0x6fdd, uid: 0
+2025/04/14 14:10:42 endpoint: 0x5003, chain: 00, channel: 3 threshold: 0x7009, uid: 0
+2025/04/14 14:10:42 endpoint: 0x5003, chain: 00, channel: 4 threshold: 0x7008, uid: 0
+2025/04/14 14:10:42 endpoint: 0x5003, chain: 00, channel: 5 threshold: 0x6fbc, uid: 0
+2025/04/14 14:10:42 endpoint: 0x5003, chain: 00, channel: 6 threshold: 0x7022, uid: 0
+2025/04/14 14:10:42 endpoint: 0x5003, chain: 00, channel: 7 threshold: 0x6af3, uid: 0
+2025/04/14 14:10:56 endpoint: 0x5004, chain: 00, channel: 0 threshold: 0x7695, uid: 0
+2025/04/14 14:10:56 endpoint: 0x5004, chain: 00, channel: 1 threshold: 0x75d5, uid: 0
+2025/04/14 14:10:56 endpoint: 0x5004, chain: 00, channel: 2 threshold: 0x7547, uid: 0
+2025/04/14 14:10:56 endpoint: 0x5004, chain: 00, channel: 3 threshold: 0x7547, uid: 0
+2025/04/14 14:10:56 endpoint: 0x5004, chain: 00, channel: 4 threshold: 0x75d1, uid: 0
+2025/04/14 14:10:56 endpoint: 0x5004, chain: 00, channel: 5 threshold: 0x7575, uid: 0
+2025/04/14 14:10:56 endpoint: 0x5004, chain: 00, channel: 6 threshold: 0x74e3, uid: 0
+2025/04/14 14:10:56 endpoint: 0x5004, chain: 00, channel: 7 threshold: 0x77d5, uid: 0
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Time::HiRes qw( gettimeofday usleep time );
+use Data::Dumper;
+use POSIX qw/floor ceil/;
+use List::Util 'max';
+use Env::Modify 'source';
+use Shell::GetEnv;
+
+if (scalar @ARGV != 2) {
+ print <<HT;
+
+Uses Epics to set HV on/off. "On" is only supported for some subsystems. "On" can't be combined with "all" subsystems.
+This script should only be used on lxhadesdaq.
+
+Subsystems are: all, rich, mdc, tof, rpc, ecal, fwall, start
+
+Example:
+./HV_switches.pl fwall off
+
+HT
+ exit;
+ }
+
+my $sys = lc($ARGV[0]);
+my $state = $ARGV[1];
+
+my $env = Shell::GetEnv->new( 'bash', "source epics" );
+
+my $epics = $env->{envs}{'EPICS_HOME'}.'/base/bin/linux-x86_64/';
+
+
+system($epics."caput HAD:FWALL:HV:pwonoff_G7 1") if $sys eq 'fwall' && $state eq 'on';
+system($epics."caput HAD:FWALL:HV:pwonoff_G7 0") if ($sys eq 'all' || $sys eq 'fwall') && $state eq 'off';
+
+system($epics."caput HAD:TOFHV:pwonoff_G1 1") if $sys eq 'tof' && $state eq 'on';
+system($epics."caput HAD:TOFHV:pwonoff_G2 1") if $sys eq 'tof' && $state eq 'on';
+system($epics."caput HAD:TOFHV:pwonoff_G3 1") if $sys eq 'tof' && $state eq 'on';
+system($epics."caput HAD:TOFHV:pwonoff_G4 1") if $sys eq 'tof' && $state eq 'on';
+system($epics."caput HAD:TOFHV:pwonoff_G5 1") if $sys eq 'tof' && $state eq 'on';
+system($epics."caput HAD:TOFHV:pwonoff_G6 1") if $sys eq 'tof' && $state eq 'on';
+system($epics."caput HAD:TOFHV:pwonoff_G1 0") if ($sys eq 'all' || $sys eq 'tof') && $state eq 'off';
+system($epics."caput HAD:TOFHV:pwonoff_G2 0") if ($sys eq 'all' || $sys eq 'tof') && $state eq 'off';
+system($epics."caput HAD:TOFHV:pwonoff_G3 0") if ($sys eq 'all' || $sys eq 'tof') && $state eq 'off';
+system($epics."caput HAD:TOFHV:pwonoff_G4 0") if ($sys eq 'all' || $sys eq 'tof') && $state eq 'off';
+system($epics."caput HAD:TOFHV:pwonoff_G5 0") if ($sys eq 'all' || $sys eq 'tof') && $state eq 'off';
+system($epics."caput HAD:TOFHV:pwonoff_G6 0") if ($sys eq 'all' || $sys eq 'tof') && $state eq 'off';
+
+system($epics."caput HAD:ECAL:HV:pwonoff_G5001 1") if $sys eq 'ecal' && $state eq 'on';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5002 1") if $sys eq 'ecal' && $state eq 'on';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5003 1") if $sys eq 'ecal' && $state eq 'on';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5004 1") if $sys eq 'ecal' && $state eq 'on';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5005 1") if $sys eq 'ecal' && $state eq 'on';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5006 1") if $sys eq 'ecal' && $state eq 'on';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5001 0") if ($sys eq 'all' || $sys eq 'ecal') && $state eq 'off';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5002 0") if ($sys eq 'all' || $sys eq 'ecal') && $state eq 'off';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5003 0") if ($sys eq 'all' || $sys eq 'ecal') && $state eq 'off';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5004 0") if ($sys eq 'all' || $sys eq 'ecal') && $state eq 'off';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5005 0") if ($sys eq 'all' || $sys eq 'ecal') && $state eq 'off';
+system($epics."caput HAD:ECAL:HV:pwonoff_G5006 0") if ($sys eq 'all' || $sys eq 'ecal') && $state eq 'off';
+
+system($epics."caput HAD:MDC:HV:pwonoff_DFANOUT 0") if ($sys eq 'all' || $sys eq 'mdc') && $state eq 'off';
+system($epics."caput HAD:MDC:HV:OUT_G41 0") if ($sys eq 'all' || $sys eq 'mdc') && $state eq 'off';
+system($epics."caput HAD:MDC:HV:OUT_G42 0") if ($sys eq 'all' || $sys eq 'mdc') && $state eq 'off';
+system($epics."caput HAD:MDC:HV:OUT_G43 0") if ($sys eq 'all' || $sys eq 'mdc') && $state eq 'off';
+system($epics."caput HAD:MDC:HV:OUT_G44 0") if ($sys eq 'all' || $sys eq 'mdc') && $state eq 'off';
+
+system($epics."caput HAD:RPC:HV:OUT_G8 0") if ($sys eq 'all' || $sys eq 'rpc') && $state eq 'off';
+
+print "For RICH HV please use the button in the control GUI\n" if $sys eq 'rich' && $state eq 'on';
+system($epics."caput HAD:RICH:HV:CR1:0:All:SwitchOn 0") if ($sys eq 'all' || $sys eq 'rich') && $state eq 'off';
+
+
+system($epics."caput HAD:MDC:HV:spare:10:pwonoff 0") if ($sys eq 'all' || $sys eq 'start') && $state eq 'off';
+system($epics."caput HAD:MDC:HV:spare:11:pwonoff 0") if ($sys eq 'all' || $sys eq 'start') && $state eq 'off';
+system($epics."caput HAD:MDC:HV:spare:12:pwonoff 0") if ($sys eq 'all' || $sys eq 'start') && $state eq 'off';
+system($epics."caput HAD:MDC:HV:positive:5:pwonoff 0") if ($sys eq 'all' || $sys eq 'start') && $state eq 'off';
+system($epics."caput HAD:MDC:HV:positive:6:pwonoff 0") if ($sys eq 'all' || $sys eq 'start') && $state eq 'off';
+
Perl2Epics::Put("MDC_PowerOnOff",1);
Perl2Epics::GetAll();
-sleep 8;
+sleep 2;
Perl2Epics::Put("MDC_PowerOnOff",0);
Perl2Epics::Update(0.2);