From 048a4031b2d6fca07c57dd34d08cbd13967fbeff Mon Sep 17 00:00:00 2001 From: hadaq Date: Mon, 25 May 2020 13:59:05 +0200 Subject: [PATCH] update hmon scripts --- hmon/doc/ecal-starthv.htt | 1 + hmon/doc/misc-fwhv.htt | 1 + hmon/hmon_busynew.pl | 107 ++++++++++++++-------------- hmon/hmon_ecalrate.pl | 36 ++++++++++ hmon/hmon_mdc_voltage.pl | 2 +- hmon/hmon_rpcrate.pl | 110 +++++++++++++++++++++++++++++ hmon/hmon_rpctof_sectorwise.pl | 99 ++++++++++++++++++++++++++ hmon/hmon_stsrate.pl | 110 +++++++++++++++++++++++++++++ hmon/hmon_tofrate.pl | 110 +++++++++++++++++++++++++++++ hmon/index.cgi | 9 +-- hmon/permanent/hmon_eberrbits.pl | 57 ++++++++++----- hmon/permanent/hmon_mdcpressure.pl | 39 ++++++---- hmon/styles.css | 2 +- 13 files changed, 590 insertions(+), 93 deletions(-) create mode 100644 hmon/doc/ecal-starthv.htt create mode 100644 hmon/doc/misc-fwhv.htt create mode 100755 hmon/hmon_rpcrate.pl create mode 100755 hmon/hmon_rpctof_sectorwise.pl create mode 100755 hmon/hmon_stsrate.pl create mode 100755 hmon/hmon_tofrate.pl diff --git a/hmon/doc/ecal-starthv.htt b/hmon/doc/ecal-starthv.htt new file mode 100644 index 0000000..3563a18 --- /dev/null +++ b/hmon/doc/ecal-starthv.htt @@ -0,0 +1 @@ +Just a monitor - if it's red, please inform Jurek. diff --git a/hmon/doc/misc-fwhv.htt b/hmon/doc/misc-fwhv.htt new file mode 100644 index 0000000..8bc6575 --- /dev/null +++ b/hmon/doc/misc-fwhv.htt @@ -0,0 +1 @@ +Just a monitor - if it's red, it's in the responsibility of the FW operator, please inform them. diff --git a/hmon/hmon_busynew.pl b/hmon/hmon_busynew.pl index d53c3a6..9fbc2b7 100755 --- a/hmon/hmon_busynew.pl +++ b/hmon/hmon_busynew.pl @@ -25,7 +25,7 @@ $plot->{titles}->[2] = "ECal"; $plot->{titles}->[3] = "RPC"; $plot->{titles}->[4] = "Rich"; $plot->{titles}->[5] = "TOF"; -$plot->{titles}->[6] = "Wall"; +$plot->{titles}->[6] = "STS"; $plot->{titles}->[7] = "Cts"; $plot->{titles}->[8] = "Start"; # $plot->{titles}->[9] = "Pion"; @@ -44,7 +44,7 @@ HPlot::PlotInit($plot); HPlot::PlotInit({ name => "BusyTimeBars", file => "files/BusyTimeBars", - curves => 8, + curves => 1, type => HPlot::TYPE_BARGRAPH, output => HPlot::OUT_PNG, ylabel => "Deadtime (%)", @@ -52,10 +52,10 @@ HPlot::PlotInit({ sizex => 520, sizey => 265, nokey => 1, - entries => 10, + entries => 9, ymin => -1, ymax => 101, - bartitle => ["M12","M34","ECa","RPC","Ric1","Ric2","TOF","FW","Cts","St"], + bartitle => ["M12","M34","ECa","RPC","Rich","TOF","STS","Cts","St"], buffer => 1, storable => 0, bargap => 5, @@ -87,7 +87,7 @@ for my $p (0..8) { while (1) { my $o; - foreach my $b (0x8000,0x8012,0x8013,0x8015,0x8016,0x8017,0x8018) { + foreach my $b (0x8000, 0x8018){#,0x8012,0x8013,0x8015,0x8016,0x8017,0x8018) { my $t = trb_registertime_read_mem($b,0x4030,0,10); $o->{$b} = $t->{$b}; } @@ -104,17 +104,15 @@ while (1) { } } - my $rich1max = max($diff->{0x8017}->[0],$diff->{0x8017}->[1],$diff->{0x8017}->[2],$diff->{0x8017}->[3],$diff->{0x8017}->[4],$diff->{0x8017}->[5]); - my $rich2max = max($diff->{0x8018}->[0],$diff->{0x8018}->[1],$diff->{0x8018}->[2],$diff->{0x8018}->[3],$diff->{0x8018}->[4],$diff->{0x8018}->[5]); - + HPlot::PlotAdd('BusyTimes',$diff->{0x8000}->[5],0); #MDC12 HPlot::PlotAdd('BusyTimes',$diff->{0x8000}->[6],1); #MDC34 HPlot::PlotAdd('BusyTimes',$diff->{0x8000}->[3],2); #ECal - HPlot::PlotAdd('BusyTimes',max($diff->{0x8012}->[2],$diff->{0x8012}->[3]),3); #RPC + HPlot::PlotAdd('BusyTimes',$diff->{0x8000}->[1],3); #RPC HPlot::PlotAdd('BusyTimes',max($diff->{0x8000}->[7],$diff->{0x8000}->[8]),4); #Rich - HPlot::PlotAdd('BusyTimes',$diff->{0x8012}->[1],5); #Tof - HPlot::PlotAdd('BusyTimes',$diff->{0x8012}->[0],6); #Wall - HPlot::PlotAdd('BusyTimes',$diff->{0x8000}->[1],7); #Cts + HPlot::PlotAdd('BusyTimes',$diff->{0x8000}->[2],5); #Tof + HPlot::PlotAdd('BusyTimes',$diff->{0x8000}->[4],6); #STS + HPlot::PlotAdd('BusyTimes',$diff->{0x8000}->[0],7); #Cts HPlot::PlotAdd('BusyTimes',$diff->{0x8018}->[6],8); #Start TRB3 # HPlot::PlotAdd('BusyTimes',max($diff->{0x8003}->[1],$diff->{0x8003}->[2]),9); #Pion @@ -122,51 +120,50 @@ while (1) { HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[5],0); #MDC12 HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[6],1); #MDC34 HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[3],2); #ECal - HPlot::PlotFill('BusyTimeBars',max($diff->{0x8012}->[2],$diff->{0x8012}->[3]),3); #RPC - HPlot::PlotFill('BusyTimeBars',$rich1max,4); #Rich - HPlot::PlotFill('BusyTimeBars',$rich2max,5); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8012}->[1],6); #Tof - HPlot::PlotFill('BusyTimeBars',$diff->{0x8012}->[0],7); #Wall - HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[1],8); #Cts - HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[6],9); #Start TRB3 + HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[1],3); #RPC + HPlot::PlotFill('BusyTimeBars',max($diff->{0x8000}->[7],$diff->{0x8000}->[8]),4); #Rich + HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[2],5); #Tof + HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[4],6); #STS + HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[0],7); #Cts + HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[6],8); #Start TRB3 # HPlot::PlotAdd('BusyTimes',max($diff->{0x8003}->[1],$diff->{0x8003}->[2]),9); #Pion -#Extended view - HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[0],0,6); #MDC12 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[1],0,5); #MDC12 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[2],0,4); #MDC12 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[3],0,3); #MDC12 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[4],0,2); #MDC12 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[5],0,1); #MDC12 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[0],1,6); #MDC34 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[1],1,5); #MDC34 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[2],1,4); #MDC34 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[3],1,3); #MDC34 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[4],1,2); #MDC34 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[5],1,1); #MDC34 - HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[0],2,6); #ECal - HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[1],2,5); #ECal - HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[2],2,4); #ECal - HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[3],2,3); #ECal - HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[4],2,2); #ECal - HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[5],2,1); #ECal - HPlot::PlotFill('BusyTimeBars',$diff->{0x8012}->[2],3,5); #RPC - HPlot::PlotFill('BusyTimeBars',$diff->{0x8012}->[3],3,4); #RPC -# HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[7],4,5); #Rich -# HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[8],4,4); #Rich - - HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[0],4,6); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[1],4,5); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[2],4,4); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[3],4,3); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[4],4,2); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[5],4,1); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[0],5,6); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[1],5,5); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[2],5,4); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[3],5,3); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[4],5,2); #Rich - HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[5],5,1); #Rich +# #Extended view +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[0],0,6); #MDC12 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[1],0,5); #MDC12 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[2],0,4); #MDC12 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[3],0,3); #MDC12 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[4],0,2); #MDC12 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8015}->[5],0,1); #MDC12 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[0],1,6); #MDC34 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[1],1,5); #MDC34 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[2],1,4); #MDC34 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[3],1,3); #MDC34 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[4],1,2); #MDC34 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8016}->[5],1,1); #MDC34 +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[0],2,6); #ECal +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[1],2,5); #ECal +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[2],2,4); #ECal +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[3],2,3); #ECal +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[4],2,2); #ECal +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8013}->[5],2,1); #ECal +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8012}->[2],3,5); #RPC +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8012}->[3],3,4); #RPC +# # HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[7],4,5); #Rich +# # HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[8],4,4); #Rich +# +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[0],4,6); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[1],4,5); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[2],4,4); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[3],4,3); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[4],4,2); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8017}->[5],4,1); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[0],5,6); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[1],5,5); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[2],5,4); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[3],5,3); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[4],5,2); #Rich +# HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[5],5,1); #Rich # HPlot::PlotFill('BusyTimeBars',$diff->{0x8018}->[6],7,5); #Start # HPlot::PlotFill('BusyTimeBars',$diff->{0x8000}->[1],9,5); #Cts diff --git a/hmon/hmon_ecalrate.pl b/hmon/hmon_ecalrate.pl index 7a91281..b65f1f5 100755 --- a/hmon/hmon_ecalrate.pl +++ b/hmon/hmon_ecalrate.pl @@ -83,6 +83,29 @@ for my $i (0..5) { noinit => 0, showvalues => 0, }); } + +HPlot::PlotInit({ +name => "EcalRate", +file => "files/EcalRate", +title => "ECal Rate", +entries => 48, +curves => 60, +type => HPlot::TYPE_HEATMAP, +output => HPlot::OUT_PNG, +zlabel => "Hitrate", +sizex => 470, +sizey => 420, +nokey => 1, +buffer => 1, +ymin => 59.5, +ymax => -0.5, +xmin => -0.5, +xmax => 47.5, +cbmax => "100<*<1E5", +cbmin => 0, +noinit => 1, +additional => "set logscale cb;", +showvalues => 0, }); my $str = Hmon::MakeTitle(16, 20, "ECal Hit Rate",0); for my $i (0..5) { @@ -95,6 +118,13 @@ $str .= Hmon::MakeFooter(); Hmon::WriteFile("ECalRate",$str); +my $str = Hmon::MakeTitle(6, 9, "ECal Hit Rate",0); +$str .= qq@
\n@; + +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("EcalSimpleRate",$str); + + my $old; my $oldtime = time(); my $time = time(); @@ -114,6 +144,7 @@ while(1) { my $tdiff = (time() - $oldtime||0) || 1; foreach my $b (keys %$o) { my $sec = ($b>>4) & 0x7; + my $simpxpos = (($b>>4)&0xF)*10 + ($b&0xF); for my $v (0..23) { my $xpos = ($b&0xF)*3 + int($v/8); @@ -137,6 +168,10 @@ while(1) { HPlot::PlotFill('EcalRateFast'.$sec,$diff->{$b}->[$v*2+1],$xpos,$v % 8); HPlot::PlotFill('EcalRateSlow'.$sec,$diff->{$b}->[$v*2+2],$xpos,$v % 8); HPlot::PlotFill('EcalRateDiff'.$sec,$ratio,$xpos,$v % 8); + + HPlot::PlotFill('EcalRate',$diff->{$b}->[$v*2+1],$v*2,$simpxpos); + HPlot::PlotFill('EcalRate',$diff->{$b}->[$v*2+2],$v*2+1,$simpxpos); + } } for my $i (0..5) { @@ -144,6 +179,7 @@ while(1) { HPlot::PlotDraw('EcalRateSlow'.$i); HPlot::PlotDraw('EcalRateDiff'.$i); } + HPlot::PlotDraw('EcalRate'); } $old = $o; $oldtime = time(); diff --git a/hmon/hmon_mdc_voltage.pl b/hmon/hmon_mdc_voltage.pl index 93c4787..79a2181 100755 --- a/hmon/hmon_mdc_voltage.pl +++ b/hmon/hmon_mdc_voltage.pl @@ -19,7 +19,7 @@ my $status = ""; my @names = qw(5.8V 5V 3.8V 3.3V 1.8V 1.2V 3V -3V); my @minimum = (5.5, 4.75, 3.5, 3.15, 1.4, 1.15, 2.90, -3.05); -my @maximum = (6.1, 5.1, 4.0, 3.4, 2.0, 1.25, 3.10, -2.95); +my @maximum = (6.2, 5.1, 4.0, 3.4, 2.0, 1.25, 3.10, -2.95); my $fqa = QA::OpenQAFile(); diff --git a/hmon/hmon_rpcrate.pl b/hmon/hmon_rpcrate.pl new file mode 100755 index 0000000..357bb3f --- /dev/null +++ b/hmon/hmon_rpcrate.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 => "RpcRate", +file => "files/RpcRate", +title => "RPC Rate", +entries => 48, +curves => 60, +type => HPlot::TYPE_HEATMAP, +output => HPlot::OUT_PNG, +zlabel => "Hitrate", +sizex => 470, +sizey => 420, +nokey => 1, +buffer => 1, +ymin => 59.5, +ymax => -0.5, +xmin => -0.5, +xmax => 47.5, +cbmax => "100<*<1E5", +cbmin => 0, +noinit => 1, +additional => "set logscale cb;", +showvalues => 0, }; +HPlot::PlotInit($plot1); + + +my $str = Hmon::MakeTitle(6, 9, "RPC Hit Rate",0); +$str .= qq@
\n@; + +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("RpcRate",$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(0xfe73,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>=0x5800 && $b<=0x58ff); + my $xpos = (($b>>4)&0xF)*10 + ($b&0xF); + + 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('RpcRate',$diff->{$b}->[$v+1],$v,$xpos); + } + #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('RpcRate'); + + + + # $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 2; + } diff --git a/hmon/hmon_rpctof_sectorwise.pl b/hmon/hmon_rpctof_sectorwise.pl new file mode 100755 index 0000000..e4bcd37 --- /dev/null +++ b/hmon/hmon_rpctof_sectorwise.pl @@ -0,0 +1,99 @@ +#!/usr/bin/perl -w + +use warnings; +use Time::HiRes qw(usleep); +use Data::Dumper; +use Hmon; +use QA; +use HADES::TrbNet; +use HPlot; + + +HPlot::PlotInit({ + name => "RpcTofSectorRate", + file => "files/RpcTofSectorRate", + entries => 6, + curves => 2, + type => HPlot::TYPE_BARGRAPH, + output => HPlot::OUT_PNG, + titles => ["TOF","RPC"], + xlabel => "Sectors", + ylabel => "Counts [Hz]", + sizex => 370, + sizey => 370, + xmin => -0.3, + xmax => 5.8, + ymax => "500<*<1E5", + ymin => 0, + nokey => 0, + buffer => 1, + bargap => 0.4, + curvewidth => 1, + storable=> 1} + ); + +HPlot::PlotInit({ + name => "RpcTofSectorRateHist", + file => "files/RpcTofSectorRateHist", + entries => 60, + curves => 12, + type => HPlot::TYPE_HISTORY, + output => HPlot::OUT_PNG, + titles => ["R0","R1","R2","R3","R4","R5","T0","T1","T2","T3","T4","T5"], + xlabel => "Time [s]", + ylabel => "Counts [Hz]", + sizex => 550, + sizey => 370, +# nokey => 1, + buffer => 1, + storable=> 1} + ); + +my $str = Hmon::MakeTitle(12,8,"RpcTofSectorRate",0); + $str .= qq@\n@; + $str .= qq@@; + $str .= Hmon::MakeFooter(); + Hmon::WriteFile("RpcTofSectorRate",$str); + +# my $fqa = QA::OpenQAFile() or die "No connection to QA Logfile"; + +trb_init_ports() or die trb_strerror(); + +my @values; +my $oldrpc; +my $oldtof; + +while (1) { + my $rpcsum = 0; + my $tofsum = 0; + + my $o = trb_register_read(0xfe60,0xdfe6); + foreach my $b (keys %{$o}) { + next unless defined $oldrpc->{$b}; + my $diff = $o->{$b} - $oldrpc->{$b}; + $diff += 2**24 if $diff < 0; + if ($b >= 0x84c0 && $b <= 0x84c5) { + HPlot::PlotFill('RpcTofSectorRate',$diff,$b&0xF,1); + HPlot::PlotAdd( 'RpcTofSectorRateHist',$diff,$b&0xF); + } + } + $oldrpc = $o; + + $o = trb_register_read(0xfe60,0xdfe6); + foreach my $b (keys %{$o}) { + next unless defined $oldtof->{$b}; + my $diff = $o->{$b} - $oldtof->{$b}; + $diff += 2**24 if $diff < 0; + if ($b >= 0x86c0 && $b <= 0x86c5) { + HPlot::PlotFill('RpcTofSectorRate',$diff,$b&0xF,0); + HPlot::PlotAdd( 'RpcTofSectorRateHist',$diff,($b&0xF)+6); + } + } + $oldtof = $o; + + + HPlot::PlotDraw('RpcTofSectorRate'); + HPlot::PlotDraw('RpcTofSectorRateHist'); + sleep(1); + } + diff --git a/hmon/hmon_stsrate.pl b/hmon/hmon_stsrate.pl new file mode 100755 index 0000000..d73685e --- /dev/null +++ b/hmon/hmon_stsrate.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 => "StsRate", +file => "files/StsRate", +title => "STS Rate", +entries => 48, +curves => 80, +type => HPlot::TYPE_HEATMAP, +output => HPlot::OUT_PNG, +zlabel => "Hitrate", +sizex => 470, +sizey => 420, +nokey => 1, +buffer => 1, +ymin => 79.5, +ymax => -0.5, +xmin => -0.5, +xmax => 47.5, +cbmax => "100<*<1E5", +cbmin => 0, +noinit => 1, +additional => "set logscale cb;", +showvalues => 0, }; +HPlot::PlotInit($plot1); + + +my $str = Hmon::MakeTitle(6, 9, "STS Hit Rate",0); +$str .= qq@
\n@; + +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("StsRate",$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(0xfe4c,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>=0x6400 && $b<=0x64ff); + my $xpos = (($b>>4)&0xF)*10 + ($b&0xF); + + 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('StsRate',$diff->{$b}->[$v+1],$v,$xpos); + } + #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('StsRate'); + + + + # $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 2; + } diff --git a/hmon/hmon_tofrate.pl b/hmon/hmon_tofrate.pl new file mode 100755 index 0000000..8dbe969 --- /dev/null +++ b/hmon/hmon_tofrate.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 => "TofRate", +file => "files/TofRate", +title => "TOF Rate", +entries => 32, +curves => 70, +type => HPlot::TYPE_HEATMAP, +output => HPlot::OUT_PNG, +zlabel => "Hitrate", +sizex => 470, +sizey => 420, +nokey => 1, +buffer => 1, +ymin => 69.5, +ymax => -0.5, +xmin => -0.5, +xmax => 31.5, +cbmax => "100<*<1E5", +cbmin => 0, +noinit => 1, +additional => "set logscale cb;", +showvalues => 0, }; +HPlot::PlotInit($plot1); + + +my $str = Hmon::MakeTitle(6, 9, "TOF Hit Rate",0); +$str .= qq@
\n@; + +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("TofRate",$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(0xfe73,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>=0x5c00 && $b<=0x5cff); + my $xpos = (($b>>4)&0xF)*10 + ($b&0xF); + + 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('TofRate',$diff->{$b}->[$v+1],$v,$xpos); + } + #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('TofRate'); + + + + # $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 2; + } diff --git a/hmon/index.cgi b/hmon/index.cgi index 4e9ee8b..aa63c9c 100755 --- a/hmon/index.cgi +++ b/hmon/index.cgi @@ -56,10 +56,11 @@ function openwin(url) {