From 77f29df403a2d10a80ce0c9d20546fb02dd9fd80 Mon Sep 17 00:00:00 2001 From: hadaq Date: Fri, 8 May 2015 14:36:11 +0200 Subject: [PATCH] cleaner startup scripts --- users/gsi_dirc/prepare_padiwas_invert_leds.pl | 65 ++++----- users/gsi_dirc/register_config_tdc.db | 35 +++-- users/gsi_dirc/startup.sh | 132 ++++++++---------- 3 files changed, 114 insertions(+), 118 deletions(-) diff --git a/users/gsi_dirc/prepare_padiwas_invert_leds.pl b/users/gsi_dirc/prepare_padiwas_invert_leds.pl index 309c50f..b7cd5bb 100755 --- a/users/gsi_dirc/prepare_padiwas_invert_leds.pl +++ b/users/gsi_dirc/prepare_padiwas_invert_leds.pl @@ -8,6 +8,7 @@ use Getopt::Long; my $help; my $opt_invert; +my $opt_stretch; my @opt_endpoints; my @opt_chains; @@ -15,6 +16,7 @@ my $result = GetOptions ( "h|help" => \$help, "i|invert=s" => \$opt_invert, "e|endpoints=s" => \@opt_endpoints, + "s|stretch=s" => \$opt_stretch, "c|chains=s" => \@opt_chains, ); @@ -37,67 +39,58 @@ my $pm = Parallel::ForkManager->new($MAX_PROCESSES); #my $padiwa_invert_setting = "0xffff"; -print "padiwas: setting padiwa invert-setting to $opt_invert: "; +my $str_endpoints= join " ", @opt_endpoints; -foreach my $cur_endpoint (@$endpoints) { - my $pid = $pm->start and next; - $cur_endpoint = sprintf "0x%4x", $cur_endpoint; - print "$cur_endpoint "; +print "current padiwa range: $str_endpoints\n"; +print "\tsetting padiwa invert-setting to $opt_invert "; +execute_command("invert $opt_invert"); +$pm->wait_all_children; +print "\n"; - for my $chain (@$chains) { - my $c="/home/hadaq/trbsoft/daqtools/padiwa.pl $cur_endpoint $chain invert $opt_invert 1>/dev/null"; - #print $c . "\n"; - my $r = qx($c); - die "could not execute command $c" if $?; - print $r; - } - $pm->finish; # Terminates the child process -}; +print "\tturn off all leds "; +execute_command("led 0x10"); +$pm->wait_all_children; +print "\n"; + +print "\tset temp compensation to 0x02c0 "; +execute_command("comp 0x02c0"); $pm->wait_all_children; print "\n"; -print "padiwas: turn off all leds: "; -foreach my $cur_endpoint (@$endpoints) { - my $pid = $pm->start and next; - $cur_endpoint = sprintf "0x%4x", $cur_endpoint; - print "$cur_endpoint "; +if($opt_stretch) { + print "\tset stretching to $opt_stretch"; + execute_command("stretch $opt_stretch"); + $pm->wait_all_children; + print "\n"; +} - for my $chain (0..2) { - my $c="/home/hadaq/trbsoft/daqtools/padiwa.pl $cur_endpoint $chain led 0x10 >/dev/null"; - #print $c . "\n"; - qx($c); die "could not execute command $c" if $?; - } - $pm->finish; # Terminates the child process -}; +exit; -$pm->wait_all_children; -print "\n"; +sub execute_command { -print "DOBpadiwas: set temp compensation to 0x02c0: "; + (my $padiwa_command) = @_; -foreach my $cur_endpoint (@$endpoints) { + foreach my $cur_endpoint (@$endpoints) { my $pid = $pm->start and next; $cur_endpoint = sprintf "0x%4x", $cur_endpoint; - print "$cur_endpoint "; + #print "$cur_endpoint "; for my $chain (0..2) { - my $c="/home/hadaq/trbsoft/daqtools/padiwa.pl $cur_endpoint $chain comp 0x02c0 >/dev/null"; + my $c="/home/hadaq/trbsoft/daqtools/padiwa.pl $cur_endpoint $chain $padiwa_command >/dev/null"; #print $c . "\n"; qx($c); die "could not execute command $c" if $?; } $pm->finish; # Terminates the child process -}; + }; -$pm->wait_all_children; -print "\n"; +} -exit; sub get_ranges { (my $ra_data) = @_; diff --git a/users/gsi_dirc/register_config_tdc.db b/users/gsi_dirc/register_config_tdc.db index 66789a1..eeb6234 100644 --- a/users/gsi_dirc/register_config_tdc.db +++ b/users/gsi_dirc/register_config_tdc.db @@ -9,13 +9,32 @@ !Value table # Hub # Type # lower 32 channels # upper 32 channels # ################################################################# - 0x0010 0 0xffffffff 0x00000000 - 0x0011 0 0xffffffff 0x00000000 - 0x0012 0 0xffffffff 0x00000000 - 0x0013 0 0xffffffff 0x00000000 - 0x0014 0 0xffffffff 0x00000000 - 0x0015 0 0xffffffff 0x00000000 - 0x0016 0 0xffffffff 0x00000000 - 0x0017 0 0xffffffff 0x00000000 +# FLASH + 0x2021 0 0x00000000 0x00000000 + 0x2022 0 0x00000000 0x00000000 +# TOF1 + 0x2014 0 0x0000ffff 0x00000000 + 0x2015 0 0xffffffff 0x00000000 + 0x2016 0 0xffffffff 0x00000000 + 0x2017 0 0x0000ffff 0x00000000 + +# TOF3 + + 0x2018 0 0x0000ffff 0x00000000 + 0x2019 0 0xffffffff 0x00000000 + 0x201a 0 0xffffffff 0x00000000 + 0x201b 0 0x00000000 0x00000000 + +# #Hodo + + 0x201c 0 0xffffffff 0x00000000 + 0x201d 0 0x00000000 0x00000000 + 0x201e 0 0x00000000 0x00000000 + 0x201f 0 0x00000000 0x00000000 + +#DISC DIRC +# 0x2029 0 0x00000000 0x00000000 +# 0x202a 0 0x00000000 0x00000000 +# 0x202b 0 0x00000000 0x00000000 diff --git a/users/gsi_dirc/startup.sh b/users/gsi_dirc/startup.sh index d83f02c..721cb3b 100755 --- a/users/gsi_dirc/startup.sh +++ b/users/gsi_dirc/startup.sh @@ -1,10 +1,10 @@ #!/bin/bash -# PATH should already be marked as exported... -#PATH=${HOME}/trbsoft/bin:${PATH} -#PATH=${HOME}/trbsoft/daqdata/bin:${PATH} -#PATH=${HOME}/trbsoft/trbnettools/bin:${PATH} -export TRB3_SERVER=trb056:26000 +export PATH=$PATH:~/trbsoft/daqtools/users/gsi_dirc + +check_ping.pl + +export TRB3_SERVER=trb056:26000 export TRBNETDPID=$(pgrep trbnetd) echo "- trbnetd pid: $TRBNETDPID" @@ -12,12 +12,8 @@ echo "- trbnetd pid: $TRBNETDPID" if [[ -z "$TRBNETDPID" ]] then ~/bin/trbnetd -i 56 - #~/trbsoft/trbnettools/binlocal/trbnetd -i 56 fi -#export TRB3_SERVER=trb056 - - export DAQOPSERVER=localhost:56 #export DAQOPSERVER=localhost @@ -26,12 +22,6 @@ trbcmd reset echo -n "- number of trb endpoints in the system: " trbcmd i 0xffff | wc -l - -################################################## -## System Reset -################################################## -#trbcmd reset - ################################################## ## Set addresses ################################################## @@ -40,30 +30,61 @@ trbcmd i 0xffff | wc -l ################################################## ## Configure GbE for DAQ ################################################## -trbcmd w 0xff7f 0x8308 0xffffff # Trigger counter - +trbcmd w 0xff7f 0x8308 0xffffff # Trigger counter for startup trbcmd w 0xff7f 0x830e 0x10 - ~/trbsoft/daqtools/tools/loadregisterdb.pl register_configgbe.db ~/trbsoft/daqtools/tools/loadregisterdb.pl register_configgbe_ip.db + + ################################################## ## Configure TDCs ################################################## -#trbcmd w 0xfe4c 0xc801 0x000f0005 ## trigger window enable & trigger window width + +# standard TDCs trbcmd w 0xfe4c 0xc800 0x00002000 ## Triggered mode #trbcmd w 0xfe4c 0xc800 0x00003000 ## Triggerless mode #trbcmd w 0xfe4c 0xc801 0x000f0005 ## trigger window enable & trigger window width - #trbcmd w 0xfe4c 0xc800 0x00000001 ## logic analyser control register #trbcmd w 0xfe4c 0xc800 0x00001001 ## 2014-10-02 disable the "triggered mode" + trbcmd w 0xfe4c 0xc801 0x80620062 ## triggerwindow +/-490ns ;5ns granularity #trbcmd w 0xfe4c 0xc801 0x801e001e ## triggerwindow +/-150ns ;5ns granularity + +# Default TDC-channel enable for all channels trbcmd w 0xfe4c 0xc802 0xffffffff ## channel 01-32 enable trbcmd w 0xfe4c 0xc803 0x0000ffff ## channel 33-64 enable -trbcmd w 0xfe4c 0xc804 0x0000007c ## data transfer limit +#trbcmd w 0xfe4c 0xc804 0x0000007c ## data transfer limit + + +# special Matthias TDCs +trbcmd w 0xfe48 0xc800 0x00002000 ## Triggered mode +trbcmd w 0xfe48 0xc801 0x80620062 ## triggerwindow +/-490ns ;5ns granularity +trbcmd w 0xfe48 0xc802 0xffffffff ## channel 01-32 enable +trbcmd w 0xfe48 0xc803 0xffffffff ## channel 33-64 enable + + +~/trbsoft/daqtools/tools/loadregisterdb.pl register_config_tdc.db +# disable unused TDCs +# turn off two unused TDCs in FLASH +switchport.pl 0x8008 1 off +switchport.pl 0x8008 2 off + +# turn off two unused TDCs in HODO +switchport.pl 0x8007 1 off +switchport.pl 0x8007 2 off +switchport.pl 0x8007 3 off + +# turn off two unused TDCs in TOF1 +switchport.pl 0x8005 3 off + +# turn off two unused TDCs in TOF1 +switchport.pl 0x8006 3 off + +echo -n "- number of trb endpoints in the system after turning off unused tdcs: " +trbcmd i 0xffff | wc -l #trbcmd w 0x1510 0xc800 0x00000001 ## logic analyser control register #trbcmd w 0x1510 0xc800 0x00001001 ## 2014-10-02 disable the "triggered mode" @@ -77,81 +98,44 @@ trbcmd w 0xfe4c 0xc804 0x0000007c ## data transfer limit # Reset trigger logic - only a workaround for a bug #trbcmd w 0xffff 0x20 0x33 -#~/trbsoft/daqtools/users/gsi_dirc/prepare_padiwa2015.sh - -~/trbsoft/daqtools/users/gsi_dirc/prepare_padiwas_invert_leds.pl --endpoints=0x2000-0x209,0x2010-0x2019 --chains=0..2 --invert=0xffff +# Barrel DIRC +prepare_padiwas_invert_leds.pl --endpoints=0x2000-0x2013 --chains=0..2 --invert=0xffff --stretch=0x0000 -# aug2014: no SciFis -#~/trbsoft/daqtools/users/gsi_dirc/prepare_padiwas_invert_leds.pl "0x010 0x011 0x012 0x013 0x110 0x111 0x112 0x113 0x210 0x211 0x212 0x213" +# Beam +prepare_padiwas_invert_leds.pl --endpoints=0x2014-0x201f --chains=0..2 --invert=0xffff -# enable used channels -#echo "- turn on/off TDC-channels" - -#~/trbsoft/daqtools/tools/loadregisterdb.pl register_config_tdc.db -#~/trbsoft/daqtools/tools/loadregisterdb.pl register_config_tdc_scifi_mcp1.db -#~/trbsoft/daqtools/tools/loadregisterdb.pl register_config_tdc_scifi_mcp2.db -#echo "-done" - -# disable all channels -#trbcmd w 0xfe4c 0xc802 0x00000000 -#trbcmd w 0xfe4c 0xc803 0x00000000 +# DISC-DIRC +prepare_padiwas_invert_leds.pl --endpoints=0x2024-0x202b --chains=0..2 --invert=0xffff # timeouts trbcmd w 0xfffe 0xc5 0x800050ff -# pulser #1 to 1k Hz -#trbcmd w 0x8000 0xa140 0x0001869f -trbcmd w 0x7999 0xa150 0x000007cf - -# pulser enable -#trbcmd setbit 0x7999 0xa101 0x2 -#trbcmd clearbit 0x8000 0xa101 0x3 # divert TDC inputs to the CTS for trigger -echo "- divert TDC inputs to the CTS for trigger"; +#echo "- divert TDC inputs to the CTS for trigger"; # trbcmd setbit 0xfe4c 0xcf00 0x1 - - - #trbcmd setbit 0x8000 0xa1d4 0x10000 ## ??? -# set proto MCP 0-14 thresholds -echo "- loading proto MCP-PMT 0-14 thresholds from old scan with 1mV delta..." + cd ~/trbsoft/daqtools/thresholds/ # july ./load_thresh_orig.sh # 1mV # switch 8/27 ./load_thresh_aug2014.sh # 4mV for first few days ## ./load_thresh_sep2014-2mV.sh # 2mV starting evening Sep 8 -###./load_thresh_sep2014-2mV-new.sh # 2mV starting evening Sep 9 -###./load_thresh_2015.sh # 2mV starting evening Sep 10 -# ./load_thresh_scifi.sh # 3mV - -#set MCPTOF thresholds -# 2015 echo "- loading proto MCP-TOF thresholds..." -# 2015cd ~/trbsoft/daqtools/thresholds/ - -# Finger weg Fred! - -# TOF2 TOF2out TOF1 TOF1out ## 2015 ./load_thresh_mcptof.sh 1500 1500 1500 1500 -#./write_thresholds.pl MCPTOF_all_thresholds_zero.log -o 0 >> /dev/null -#./write_thresholds.pl MCPTOF_all_thresholds_zero.log -o 1500 >> /dev/null # =75mV after amp -# # special threshold for MCP-out front -#./load_thresh_mcptof.sh 1500 1500 -# ./write_thresholds.pl MCPTOF_all_thresholds_zero_2010.log -o 0x2ee >> /dev/null # =37.5mV after amp +./write_thresholds.pl padiwa_threshold_results_mcp_tof.log -o 0x2000 >> /dev/null # =14.5mV after amp +cd - -#8103 3 -#trbcmd clearbit 0x7999 0xc0 0x7 -#trbcmd clearbit 0x7999 0xc1 0x7 -#trbcmd clearbit 0x7999 0xc3 0x7 -#trbcmd clearbit 0x8103 0xc0 0xf6 -#trbcmd clearbit 0x8103 0xc1 0xf6 -#trbcmd clearbit 0x8103 0xc3 0xf6 echo "ready to go" #echo "- setting trigger rate register in TDC"; # trigger rate 1500Hz -#trbcmd w 0x7999 0xa150 0x10000 +trbcmd w 0x7999 0xa150 0x10000 +# pulser enable +#trbcmd setbit 0x7999 0xa101 0x2 + +# enable multiplexer 2 +trbcmd setbit 0x7999 0xa101 0x40 -- 2.43.0