From 0f7b10d7d7233d53dfbfbd71922336962d5fb97a Mon Sep 17 00:00:00 2001 From: hadaq Date: Thu, 7 Jan 2021 12:40:57 +0100 Subject: [PATCH] update Hmon rate monitors --- hmon/hmon_ecalrate.pl | 2 +- hmon/hmon_frpcrate.pl | 110 +++++++++++++++++++++++++++++++++++ hmon/hmon_itofrate.pl | 110 +++++++++++++++++++++++++++++++++++ hmon/hmon_rpcrate.pl | 2 +- hmon/hmon_startratesimple.pl | 110 +++++++++++++++++++++++++++++++++++ hmon/hmon_tofrate.pl | 16 ++--- hmon/permanent/hmon_qa.pl | 2 +- hub/startup.script | 22 +++---- 8 files changed, 352 insertions(+), 22 deletions(-) create mode 100755 hmon/hmon_frpcrate.pl create mode 100755 hmon/hmon_itofrate.pl create mode 100755 hmon/hmon_startratesimple.pl diff --git a/hmon/hmon_ecalrate.pl b/hmon/hmon_ecalrate.pl index b5f34e2..9c3b3fc 100755 --- a/hmon/hmon_ecalrate.pl +++ b/hmon/hmon_ecalrate.pl @@ -104,7 +104,7 @@ xmax => 47.5, cbmax => "100<*<1E5", cbmin => 0, noinit => 1, -additional => "set logscale cb;set format cb \"_{10}{\%L}\"", +additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"", showvalues => 0, }); my $str = Hmon::MakeTitle(16, 20, "ECal Hit Rate",0); diff --git a/hmon/hmon_frpcrate.pl b/hmon/hmon_frpcrate.pl new file mode 100755 index 0000000..ca27996 --- /dev/null +++ b/hmon/hmon_frpcrate.pl @@ -0,0 +1,110 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; +use Data::Dumper; +use Data::TreeDumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; +use Time::HiRes qw(usleep time); +use List::Util qw[min max]; + +use Encode qw(encode from_to); +use JSON::XS; + + +my $plot1 = { +name => "FrpcRate", +file => "files/FrpcRate", +title => "fRPC Rate", +entries => 16, +curves => 20, +type => HPlot::TYPE_HEATMAP, +output => HPlot::OUT_PNG, +zlabel => "Hitrate", +sizex => 310, +sizey => 310, +nokey => 1, +buffer => 1, +ymin => 19.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 $str = Hmon::MakeTitle(4, 7, "fRPC Hit Rate",0); +$str .= qq@
\n@; + +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("FrpcRate",$str); + + +my $old; +my $oldtime = time(); +my $time = time(); +my $diff; +my $iter = 0; + + + +trb_init_ports() or die trb_strerror(); + + +while(1) { + #my $data; + #my $max = 0 ; + #my $min = 5E9; + + my $o = trb_register_read_mem(0xfe47,0xc000,0,33) or die trb_strerror() or sleep 5 and next; + + if (defined $old) { + my $tdiff = (time() - $oldtime)|1; + foreach my $b (keys %$o) { + #my $ratesum = 0; + next unless ($b>=0x6800 && $b<=0x68ff); + my $xpos = ($b&0xF)*2 + ($b>>4 & 0xF)*10; + + for my $v (0..31) { + 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('FrpcRate',$diff->{$b}->[$v+1],$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('FrpcRate'); + + + + # $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; + $oldtime = time(); + sleep 1; + } diff --git a/hmon/hmon_itofrate.pl b/hmon/hmon_itofrate.pl new file mode 100755 index 0000000..24db645 --- /dev/null +++ b/hmon/hmon_itofrate.pl @@ -0,0 +1,110 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; +use Data::Dumper; +use Data::TreeDumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; +use Time::HiRes qw(usleep time); +use List::Util qw[min max]; + +use Encode qw(encode from_to); +use JSON::XS; + + +my $plot1 = { +name => "ItofRate", +file => "files/ItofRate", +title => "iTOF Rate", +entries => 16, +curves => 24, +type => HPlot::TYPE_HEATMAP, +output => HPlot::OUT_PNG, +zlabel => "Hitrate", +sizex => 310, +sizey => 310, +nokey => 1, +buffer => 1, +ymin => 23.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 $str = Hmon::MakeTitle(4, 7, "iTOF Hit Rate",0); +$str .= qq@
\n@; + +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("ItofRate",$str); + + +my $old; +my $oldtime = time(); +my $time = time(); +my $diff; +my $iter = 0; + + + +trb_init_ports() or die trb_strerror(); + + +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; + + if (defined $old) { + my $tdiff = (time() - $oldtime)|1; + foreach my $b (keys %$o) { + #my $ratesum = 0; + next unless ($b>=0x5d00 && $b<=0x5dff); + 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('ItofRate',$diff->{$b}->[$v+1],$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'); + + + + # $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; + $oldtime = time(); + sleep 1; + } diff --git a/hmon/hmon_rpcrate.pl b/hmon/hmon_rpcrate.pl index a201324..b1ab32c 100755 --- a/hmon/hmon_rpcrate.pl +++ b/hmon/hmon_rpcrate.pl @@ -35,7 +35,7 @@ xmax => 47.5, cbmax => "100<*<1E5", cbmin => 0, noinit => 1, -additional => "set logscale cb;set format cb \"_{10}{\%L}\"", +additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"", showvalues => 0, }; HPlot::PlotInit($plot1); diff --git a/hmon/hmon_startratesimple.pl b/hmon/hmon_startratesimple.pl new file mode 100755 index 0000000..0a6acb9 --- /dev/null +++ b/hmon/hmon_startratesimple.pl @@ -0,0 +1,110 @@ +#!/usr/bin/perl -w + +use warnings; +use strict; +use Data::Dumper; +use Data::TreeDumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; +use Time::HiRes qw(usleep time); +use List::Util qw[min max]; + +use Encode qw(encode from_to); +use JSON::XS; + + +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, }; +HPlot::PlotInit($plot1); + + +my $str = Hmon::MakeTitle(4, 7, "Start Hit Rate",0); +$str .= qq@
\n@; + +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("StartRateSimple",$str); + + +my $old; +my $oldtime = time(); +my $time = time(); +my $diff; +my $iter = 0; + + + +trb_init_ports() or die trb_strerror(); + + +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; + + if (defined $old) { + my $tdiff = (time() - $oldtime)|1; + foreach my $b (keys %$o) { + #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); + } + #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('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; + $oldtime = time(); + sleep 1; + } diff --git a/hmon/hmon_tofrate.pl b/hmon/hmon_tofrate.pl index 9642182..5ce70b0 100755 --- a/hmon/hmon_tofrate.pl +++ b/hmon/hmon_tofrate.pl @@ -19,19 +19,19 @@ my $plot1 = { name => "TofRate", file => "files/TofRate", title => "TOF Rate", -entries => 16, -curves => 60, +entries => 32, +curves => 30, type => HPlot::TYPE_HEATMAP, output => HPlot::OUT_PNG, zlabel => "Hitrate", -sizex => 310, +sizex => 470, sizey => 310, nokey => 1, buffer => 1, -ymin => 59.5, +ymin => 29.5, ymax => -0.5, xmin => -0.5, -xmax => 15.5, +xmax => 31.5, cbmax => "100<*<1E5", cbmin => 0, noinit => 1, @@ -40,7 +40,7 @@ showvalues => 0, }; HPlot::PlotInit($plot1); -my $str = Hmon::MakeTitle(4, 7, "TOF Hit Rate",0); +my $str = Hmon::MakeTitle(6, 7, "TOF Hit Rate",0); $str .= qq@
\n@; $str .= Hmon::MakeFooter(); @@ -70,7 +70,7 @@ while(1) { foreach my $b (keys %$o) { #my $ratesum = 0; next unless ($b>=0x5c00 && $b<=0x5cff); - my $xpos = (($b>>4)&0xF)*10 + ($b&0xF)*2; + my $xpos = (($b>>4)&0xF)*5 + ($b&0xF); for my $v (0..31) { my $vdiff = ($o->{$b}->[$v+1]&0xfffffff) - ($old->{$b}->[$v+1]&0xfffffff); @@ -78,7 +78,7 @@ while(1) { if ($vdiff < 0) { $vdiff += 2**28;} $diff->{$b}->[$v+1] = $vdiff/$tdiff; #$ratesum += $diff->{$b}->[$v+1]; - HPlot::PlotFill('TofRate',$diff->{$b}->[$v+1],$v%16,$xpos+$v/16); + HPlot::PlotFill('TofRate',$diff->{$b}->[$v+1],$v,$xpos); } #my $s = sprintf("0x%04x",$b); #$data->{$s}= int(100*($ratesum / 32) +0.5) /100; diff --git a/hmon/permanent/hmon_qa.pl b/hmon/permanent/hmon_qa.pl index 57d6783..f5736dc 100755 --- a/hmon/permanent/hmon_qa.pl +++ b/hmon/permanent/hmon_qa.pl @@ -43,7 +43,7 @@ while($a = ) { #Generate output file at most once per second if($oldtime < time) { $oldtime = scalar time(); - $str = Hmon::MakeTitle(7,14,"Tactical Overview",1); + $str = Hmon::MakeTitle(7,16,"Tactical Overview",1); $str .= "
"; foreach my $c (@{$entries->{'cats'}}) { $str .= "
$cats->{$c}
\n"; diff --git a/hub/startup.script b/hub/startup.script index 9f727e5..80bfa0f 100644 --- a/hub/startup.script +++ b/hub/startup.script @@ -1,16 +1,19 @@ -# #Assign addresses -# !ifndef RESTART -# set_addresses serials_hub.db addresses_hub.db #addresses for old hubs -# set_addresses serials_trb3.db addresses_hub_trb3.db #addresses for hubs -# set_addresses serials_trb3sc.db addresses_hub_trb3sc.db #addresses for hubs -# set_addresses serials_mdcaddon.db addresses_mdcaddon.db #addresses for addons -# !endif -# wait exec_cmd{local} ~/trbsoft/daq/main/merge_serial_address.pl ~/trbsoft/daq/hub/serials_trb3.db ~/trbsoft/daq/hub/addresses_hub_trb3.db #addresses for hubs exec_cmd{local} ~/trbsoft/daq/main/merge_serial_address.pl ~/trbsoft/daq/hub/serials_trb3sc.db ~/trbsoft/daq/hub/addresses_hub_trb3sc.db #addresses for hubs exec_cmd{local} ~/trbsoft/daq/main/merge_serial_address.pl ~/trbsoft/daq/hub/serials_mdcaddon.db ~/trbsoft/daq/hub/addresses_mdcaddon.db #addresses for addons +wait + + trbcmd w 0xfffe 0xc5 0x4000 + + + +#Retransmission on as early as possible + trbcmd setbit 0xfffd 0x22 0x08000000 #enable retransmission on oep + trbcmd setbit 0xfe11 0x22 0x08000000 #enable retransmission on mdchub + + #Switch off Trigger Generation Boards from trigger @@ -30,9 +33,6 @@ trbcmd clearbit 0x8810 0xc1 0x4 trbcmd clearbit 0x8000 0xc0 0x200 #remove pexor from trigger trbcmd clearbit 0x8000 0xc1 0x200 - - -wait #Configure GbE load_register register_configgbe.db -- 2.43.0