From: hadaq Date: Wed, 15 Nov 2023 16:40:35 +0000 (+0100) Subject: latest updates to hmon scripts X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=d8c413c7419bcdcd4c4233d821e08fb825a1abfd;p=hadesdaq.git latest updates to hmon scripts --- diff --git a/control/gui/daq/50_COSMICS_Files b/control/gui/daq/50_Cosmics_Files similarity index 100% rename from control/gui/daq/50_COSMICS_Files rename to control/gui/daq/50_Cosmics_Files diff --git a/control/gui/daq/52_TEST_File b/control/gui/daq/52_Test_Files similarity index 100% rename from control/gui/daq/52_TEST_File rename to control/gui/daq/52_Test_Files diff --git a/control/gui/expert/30_Start_TDC_Caltest b/control/gui/expert/30_TDC_Caltest similarity index 100% rename from control/gui/expert/30_Start_TDC_Caltest rename to control/gui/expert/30_TDC_Caltest diff --git a/control/gui/expert/31_Stop_TDC_Caltest b/control/gui/expert/old/31_Stop_TDC_Caltest similarity index 100% rename from control/gui/expert/31_Stop_TDC_Caltest rename to control/gui/expert/old/31_Stop_TDC_Caltest diff --git a/control/gui/monitor/10_CTS_Mon b/control/gui/monitor/10_CTS_Monitor similarity index 100% rename from control/gui/monitor/10_CTS_Mon rename to control/gui/monitor/10_CTS_Monitor diff --git a/control/gui/monitor/30_EPICS_Power b/control/gui/monitor/30_EPICS similarity index 100% rename from control/gui/monitor/30_EPICS_Power rename to control/gui/monitor/30_EPICS diff --git a/control/gui/monitor/80_Daq_VNC b/control/gui/monitor/80_Daq_Expert_VNC similarity index 100% rename from control/gui/monitor/80_Daq_VNC rename to control/gui/monitor/80_Daq_Expert_VNC diff --git a/control/gui/monitor/10_CTS_Mon.png b/control/gui/monitor/old/10_CTS_Mon.png similarity index 100% rename from control/gui/monitor/10_CTS_Mon.png rename to control/gui/monitor/old/10_CTS_Mon.png diff --git a/control/gui/monitor/20_Hmon.png b/control/gui/monitor/old/20_Hmon.png similarity index 100% rename from control/gui/monitor/20_Hmon.png rename to control/gui/monitor/old/20_Hmon.png diff --git a/control/gui/monitor/40_Eventbuilder.png b/control/gui/monitor/old/40_Eventbuilder.png similarity index 100% rename from control/gui/monitor/40_Eventbuilder.png rename to control/gui/monitor/old/40_Eventbuilder.png diff --git a/control/gui/monitor/45_DAQ_RawMon.png b/control/gui/monitor/old/45_DAQ_RawMon.png similarity index 100% rename from control/gui/monitor/45_DAQ_RawMon.png rename to control/gui/monitor/old/45_DAQ_RawMon.png diff --git a/control/gui/power/ECAL_Padiwa_Powercycle b/control/gui/power/Ecal_Padiwa similarity index 100% rename from control/gui/power/ECAL_Padiwa_Powercycle rename to control/gui/power/Ecal_Padiwa diff --git a/control/gui/power/ECAL_RPC_Powercycle b/control/gui/power/Ecal_RPC similarity index 100% rename from control/gui/power/ECAL_RPC_Powercycle rename to control/gui/power/Ecal_RPC diff --git a/control/gui/power/HUBS_Powercycle b/control/gui/power/Hubs similarity index 100% rename from control/gui/power/HUBS_Powercycle rename to control/gui/power/Hubs diff --git a/control/gui/power/MDC_LV_Powercycle b/control/gui/power/MDC_LV similarity index 100% rename from control/gui/power/MDC_LV_Powercycle rename to control/gui/power/MDC_LV diff --git a/control/gui/power/MDC_LV_Turn_On_ALL_Relais b/control/gui/power/MDC_Relais_On similarity index 100% rename from control/gui/power/MDC_LV_Turn_On_ALL_Relais rename to control/gui/power/MDC_Relais_On diff --git a/control/gui/power/RICH_Powercycle b/control/gui/power/RICH similarity index 100% rename from control/gui/power/RICH_Powercycle rename to control/gui/power/RICH diff --git a/control/gui/power/Start_Powercycle b/control/gui/power/Start similarity index 100% rename from control/gui/power/Start_Powercycle rename to control/gui/power/Start diff --git a/control/gui/power/TOF_MdcHub_Powercycle b/control/gui/power/TOF_MdcHub similarity index 100% rename from control/gui/power/TOF_MdcHub_Powercycle rename to control/gui/power/TOF_MdcHub diff --git a/control/gui/power/Triggerbox_Beam_Powercycle b/control/gui/power/Triggerbox_Beam similarity index 100% rename from control/gui/power/Triggerbox_Beam_Powercycle rename to control/gui/power/Triggerbox_Beam diff --git a/control/gui/power/Wall_Powercycle b/control/gui/power/Wall similarity index 100% rename from control/gui/power/Wall_Powercycle rename to control/gui/power/Wall diff --git a/control/gui/power/Hodo_Powercycle b/control/gui/power/old/Hodo similarity index 100% rename from control/gui/power/Hodo_Powercycle rename to control/gui/power/old/Hodo diff --git a/control/gui/settings/Beam_Abort_Toggle b/control/gui/settings/20_Beam_Abort_OnOff similarity index 100% rename from control/gui/settings/Beam_Abort_Toggle rename to control/gui/settings/20_Beam_Abort_OnOff diff --git a/control/gui/expert/Reset_Beamabort_Error b/control/gui/settings/21_Beam_Abort_Reset similarity index 100% rename from control/gui/expert/Reset_Beamabort_Error rename to control/gui/settings/21_Beam_Abort_Reset diff --git a/control/gui/settings/Thresholds_ECAL b/control/gui/settings/Ecal_Thrs similarity index 100% rename from control/gui/settings/Thresholds_ECAL rename to control/gui/settings/Ecal_Thrs diff --git a/control/gui/settings/Thresholds_RICH b/control/gui/settings/RICH_Thrs similarity index 100% rename from control/gui/settings/Thresholds_RICH rename to control/gui/settings/RICH_Thrs diff --git a/control/gui/settings/Thresholds_RPC b/control/gui/settings/RPC_Thrs similarity index 100% rename from control/gui/settings/Thresholds_RPC rename to control/gui/settings/RPC_Thrs diff --git a/control/gui/settings/Thresholds_Start b/control/gui/settings/Start_Thrs similarity index 100% rename from control/gui/settings/Thresholds_Start rename to control/gui/settings/Start_Thrs diff --git a/control/gui/settings/Thresholds_TOF_FW b/control/gui/settings/TOF_FW_Thrs similarity index 100% rename from control/gui/settings/Thresholds_TOF_FW rename to control/gui/settings/TOF_FW_Thrs diff --git a/hmon/QA.pm b/hmon/QA.pm index d7ca662..9e00607 100644 --- a/hmon/QA.pm +++ b/hmon/QA.pm @@ -14,13 +14,15 @@ our $cats = {'main'=>"Main", 'mdc'=>"MDC", 'endp'=>"Endp", 'feeerr'=>"Fee", - 'other'=>"Other", +# 'other'=>"Othe", 'pion'=>"Pion", 'rich'=>'RICH', 'padiwa'=>'Padiwa', 'hv'=>'HV', 'hv2'=>'HV', - 'misc'=>'misc'}; + 'misc'=>'misc', + 'misc2'=>'misc', +}; # Order of categories our $entries->{'cats'} = ["main", @@ -34,10 +36,11 @@ our $entries->{'cats'} = ["main", "feeerr", # "pion", "rich", - "padiwa", +# "padiwa", "hv", "hv2", "misc", + "misc2", ]; @@ -45,17 +48,19 @@ our $entries->{'cats'} = ["main", $entries->{'main'} = ['time', 'rate','beamabort','up','spillcount']; $entries->{'daq'} = ['trbnet', 'timeouts', 'busy','readout','outofsync']; $entries->{'trg'} = ['spill', 'accepted', 'source','pt1rate', 'start']; -$entries->{'rate'} = ['pt1','pt2','pt3','nothing','pt8']; -$entries->{'server'} = ['fill', 'cpu', 'to see', 'here', 'onlineqa']; #icinga, pwrsup +$entries->{'rate'} = ['pt1','pt2','pt3','here','pt8']; +$entries->{'server'} = ['fill', 'cpu', 'be', 'dragons', 'onlineqa']; #icinga, pwrsup $entries->{'eb'} = ['run', 'rate','bytes', 'lostevt', 'errbits']; $entries->{'mdc'} = ['token', 'blocked', 'temp', 'linkqual', 'voltage']; $entries->{'endp'} = ['mdc','rich', 'tof', 'rpc', 'other']; $entries->{'feeerr'} = ['feeerr','trginp','trgqual','rpc','tof']; $entries->{'rich'} = ['temp','LV','bkpl','isob','richthr']; -$entries->{'padiwa'} = ['ecal','start','','',''];#'sts','itof','hodo' +#$entries->{'padiwa'} = ['ecal','start','sts','itof','hodo']; $entries->{'hv'} = ['richhv','ecalhv','rpchv','fwhv','tofhv']; -$entries->{'hv2'} = ['mdchv','','','','valve'];#stshv,frpchv,itofhv +#$entries->{'hv2'} = ['mdchv','stshv','frpchv','itofhv','valve']; +$entries->{'hv2'} = ['mdchv','','','','valve']; $entries->{'misc'} = ['seu','calib','magnet','env','sequencer']; +$entries->{'misc2'} = ['ecal','m1','m2','m3','m4']; $entries->{'pion'} = ['nxstatus', 'HV', 'HVcurr', 'cooling','seu']; @@ -160,9 +165,9 @@ our $QAServerOff = 1; # Missing Boards ############################################################################### -our @mdc_boards_removed =(0x2203, 0x2027, 0x2057); #(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23 +our @mdc_boards_removed =();#(0x2203, 0x2027, 0x2057); #(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23 our @mdc_chambers_removed =(); -our @rich_boards_removed =(0x71a4,0x71a5,0x71b4,0x71b5,0x72a4,0x72a5,0x72b4,0x72b5,0x73a4,0x73a5,0x73b4,0x73b5,0x826a); +our @rich_boards_removed =();#(0x71a4,0x71a5,0x71b4,0x71b5,0x72a4,0x72a5,0x72b4,0x72b5,0x73a4,0x73a5,0x73b4,0x73b5,0x826a); our @tof_boards_removed =(); our @rpc_boards_removed =(); our @other_boards_removed =(); diff --git a/hmon/doc/endp-mdc.htt b/hmon/doc/endp-mdc.htt index da4e0d4..d9cd0ef 100644 --- a/hmon/doc/endp-mdc.htt +++ b/hmon/doc/endp-mdc.htt @@ -1,6 +1,6 @@

MDC Endpoints

-This button shows if all MDC front-end modules are active. The button is red if too many modules are +This button shows if all MDC boards (OEP, MDC-Hub) are active. The button is red if too many modules are missing or two boards in the same chamber are missing or few boards are missing for a long time.
@@ -11,7 +11,7 @@ missing or two boards in the same chamber are missing or few boards are missing
  • If this doesn't help, use "Reboot MdcHub" plus 2 DAQ restarts.
  • If the missing boards include a hub (0x1___) and a restart doesn't help, a power cycle of MDC Hubs might be needed.
  • If 14/16 boards show an error after a power-cycle, click "MDC LV Turn On ALL Relais". You can -check the status of relais here. +check the status of relais here.
    diff --git a/hmon/hmon_adcvolt.pl b/hmon/hmon_adcvolt.pl index 79cad32..db0d706 100755 --- a/hmon/hmon_adcvolt.pl +++ b/hmon/hmon_adcvolt.pl @@ -196,7 +196,8 @@ sub measure { while(1) { my $ret; - my $EPICS_data = Perl2Epics::GetAll(); +# my $EPICS_data = Perl2Epics::GetAll(); + my $EPICS_data; # foreach my $a (@{$config{AdcTrb3sc}}) { # $ret->[0] = measure($a,0); diff --git a/hmon/hmon_calibration.pl b/hmon/hmon_calibration.pl index 26764e2..44e0fdf 100755 --- a/hmon/hmon_calibration.pl +++ b/hmon/hmon_calibration.pl @@ -25,7 +25,7 @@ trb_init_ports() or die trb_strerror(); while(1){ my $data = getjsonhash('eb', 'Master/BNET/get.json'); unless($data->{Inputs}{value}) {sleep 5; next;} - +#print Dumper $data; my $export; my $store; diff --git a/hmon/hmon_endpoints.pl b/hmon/hmon_endpoints.pl index 704f1f1..8337781 100755 --- a/hmon/hmon_endpoints.pl +++ b/hmon/hmon_endpoints.pl @@ -448,7 +448,7 @@ while(1) { my $num_rpc_mistake = (scalar @{$rpc_results[4]}); my @sorted_rpc_results = sort @{$rpc_results[2]}; - my $rpc_title = "ECal/STT/fRPC"; + my $rpc_title = "ECal"; my $rpc_value = "OK ".(scalar @rpc_boards); if ($num_rpc_missing > 0) {$rpc_value = "$num_rpc_missing / ".(scalar @rpc_boards)." miss";} if ($num_rpc_mistake > 0) {$rpc_value = "Check Script";} diff --git a/hmon/hmon_padiwatemp_ecal.pl b/hmon/hmon_padiwatemp_ecal.pl index bd7ed05..a4c6c82 100755 --- a/hmon/hmon_padiwatemp_ecal.pl +++ b/hmon/hmon_padiwatemp_ecal.pl @@ -87,7 +87,7 @@ while(1) { $worstQaState = QA::OK; } - QA::WriteQALog($fqa,"padiwa","ecal", 45, $worstQaState, "ECAL", $nofStr . " | " . $tempStr, + QA::WriteQALog($fqa,"misc2","ecal", 45, $worstQaState, "ECAL", $nofStr . " | " . $tempStr, $tempStr2. "Temperature in ECAL " . $tempStr . "°C.
    " . $nofStr2 . $nofStr . " PADIWAs
    " . " Missing are: " . $missing_str); sleep(10); diff --git a/hmon/hmon_richMagnet.pl b/hmon/hmon_richMagnet.pl index 3afb082..ea7dc83 100755 --- a/hmon/hmon_richMagnet.pl +++ b/hmon/hmon_richMagnet.pl @@ -340,7 +340,8 @@ sub Val2Hist { my ($Hist,$val,$board,$sens) = @_; # print "$val $board $sens \n"; if ($board == 0) { - $board=7-$sens; $sens=8-$sens; + #$board=7-$sens; $sens=8-$sens; + return; # JOF: Since Arm 0 is not working '23-11-15 } elsif ($board == 1) { $board = 7-$sens; $sens = 4; } elsif ($board == 2) { diff --git a/hmon/hmon_tdcchanerrors_testmonitor.pl b/hmon/hmon_tdcchanerrors_testmonitor.pl new file mode 100755 index 0000000..b4e9bfc --- /dev/null +++ b/hmon/hmon_tdcchanerrors_testmonitor.pl @@ -0,0 +1,411 @@ +#!/usr/bin/perl + +use warnings; +use POSIX qw(strftime floor ceil); +use FileHandle; +use lib "./code"; +use lib "../daqtools/tools"; +use HADES::TrbNet; +use Time::HiRes qw(usleep); +use Dmon; +use Hmon; +use HPlot; +use QA; +use getebjson; +use getrootjson; +use JSON::XS; +use Data::Dumper; +use List::Util qw(min max sum); +use LWP::Simple qw(get); +use Try::Tiny; +trb_init_ports() or die trb_strerror(); + +my $data; +my $NUMPLOTS = 9; +my $SERVER = 'calib'; #calib or calibtest + + + 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 font ",6";'; + + my @names = qw(LeadingAverage[ns] LeadingSigma[ps] IgnoredOutliers IgnoredHits ToTAverage[ns] ToTSigma[ps] IgnoredToTOutliers IgnoredToT CorrectedHits); + +HPlot::PlotInit({ + name => "TdcCalMon0", + file => "files/TdcCalMon0", + cblabel => "TdcCalMon ".$names[0], + entries => $numboards, + curves => 49, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + sizex => 10000, + sizey => 500, + nokey => 1, + buffer => 0, + xmin => -0.5, + xmax => $numboards-0.5, + ymin => -0.5, + ymax => 48.5, + cbmin => -10, + cbmax => 10, + noinit => 1, + palette => 'defined (-10 "red", -9 "yellow", 9 "blue", 10 "red")', + additional => $labels, + showvalues => 0, }); + +HPlot::PlotInit({ + name => "TdcCalMon1", + file => "files/TdcCalMon1", + cblabel => "TdcCalMon ".$names[1], + entries => $numboards, + curves => 49, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + sizex => 10000, + sizey => 500, + nokey => 1, + buffer => 0, + xmin => -0.5, + xmax => $numboards-0.5, + ymin => -0.5, + ymax => 48.5, + cbmin => 0, + cbmax => 200, + noinit => 1, + palette => 'defined (0 "red", 0.1 "#008800", 10 "#00ff00", 25 "#ffff00", 35 "#ffaaaa", 50 "#ff00ff", 50.1 "#aa0000", 200 "#000000")', + additional => $labels, + showvalues => 0, }); + +HPlot::PlotInit({ + name => "TdcCalMon2", + file => "files/TdcCalMon2", + cblabel => "TdcCalMon ".$names[2], + entries => $numboards, + curves => 49, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + sizex => 10000, + sizey => 500, + nokey => 1, + buffer => 0, + xmin => -0.5, + xmax => $numboards-0.5, + ymin => -0.5, + ymax => 48.5, + noinit => 1, +# palette => 'defined (0 "red", 0.1 "#008800", 10 "#00ff00", 25 "yellow", 60 "violet", 300 "red")', + additional => $labels, + showvalues => 0, }); + +HPlot::PlotInit({ + name => "TdcCalMon3", + file => "files/TdcCalMon3", + cblabel => "TdcCalMon ".$names[3], + entries => $numboards, + curves => 49, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + sizex => 10000, + sizey => 500, + nokey => 1, + buffer => 0, + xmin => -0.5, + xmax => $numboards-0.5, + ymin => -0.5, + ymax => 48.5, + noinit => 1, +# palette => 'defined (0 "red", 0.1 "#008800", 10 "#00ff00", 25 "yellow", 60 "violet", 300 "red")', + additional => $labels, + showvalues => 0, }); + +################################################################################################### + +HPlot::PlotInit({ + name => "TdcCalMon4", + file => "files/TdcCalMon4", + cblabel => "TdcCalMon ".$names[4], + entries => $numboards, + curves => 49, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + sizex => 10000, + sizey => 500, + nokey => 1, + buffer => 0, + xmin => -0.5, + xmax => $numboards-0.5, + ymin => -0.5, + ymax => 48.5, + cbmin => 19, + cbmax => 31, + noinit => 1, + palette => 'defined (19 "red", 19.8 "red", 20 "green", 20.2 "red", 29.8 "red", 30 "blue", 30.2 "red", 31 "red")', + additional => $labels, + showvalues => 0, }); + +HPlot::PlotInit({ + name => "TdcCalMon5", + file => "files/TdcCalMon5", + cblabel => "TdcCalMon ".$names[5], + entries => $numboards, + curves => 49, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + sizex => 10000, + sizey => 500, + nokey => 1, + buffer => 0, + xmin => -0.5, + xmax => $numboards-0.5, + ymin => -0.5, + ymax => 48.5, + cbmin => 0, + cbmax => 400, + noinit => 1, + palette => 'defined (0 "red", 0.1 "#008800", 40 "#00ff00", 50 "#ffff00", 51 "orange", 100 "#ffaaaa", 120 "#ff00ff", 120.1 "#aa0000", 400 "#000000")', + additional => $labels, + showvalues => 0, }); + +HPlot::PlotInit({ + name => "TdcCalMon6", + file => "files/TdcCalMon6", + cblabel => "TdcCalMon ".$names[6], + entries => $numboards, + curves => 49, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + sizex => 10000, + sizey => 500, + nokey => 1, + buffer => 0, + xmin => -0.5, + xmax => $numboards-0.5, + ymin => -0.5, + ymax => 48.5, + noinit => 1, +# palette => 'defined (0 "red", 0.1 "#008800", 10 "#00ff00", 25 "yellow", 60 "violet", 300 "red")', + additional => $labels, + showvalues => 0, }); + +HPlot::PlotInit({ + name => "TdcCalMon7", + file => "files/TdcCalMon7", + cblabel => "TdcCalMon ".$names[7], + entries => $numboards, + curves => 49, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + sizex => 10000, + sizey => 500, + nokey => 1, + buffer => 0, + xmin => -0.5, + xmax => $numboards-0.5, + ymin => -0.5, + ymax => 48.5, + noinit => 1, +# palette => 'defined (0 "red", 0.1 "#008800", 10 "#00ff00", 25 "yellow", 60 "violet", 300 "red")', + additional => $labels."set logscale cb;", + showvalues => 0, }); + +HPlot::PlotInit({ + name => "TdcCalMon8", + file => "files/TdcCalMon8", + cblabel => "TdcCalMon ".$names[8], + entries => $numboards, + curves => 49, + type => HPlot::TYPE_HEATMAP, + output => HPlot::OUT_PNG, + sizex => 10000, + sizey => 500, + nokey => 1, + buffer => 0, + xmin => -0.5, + xmax => $numboards-0.5, + ymin => -0.5, + ymax => 48.5, + noinit => 1, + cbmin => 0, + cbmax => 0.1, + palette => 'defined (0 "#004400", 0.000001 "#00ff00", 0.0009 "#33ff00", 0.001 "yellow", 0.1 "red")', + additional => $labels,#."set logscale cb;", + showvalues => 0, }); + +while(1){ +################################################################################################### + #loop until run is finished + print "Wait for end of analysis run\n"; + my $eventhist; + my $oldevnum; my $evnum=0; + do{ + $oldevnum = $evnum; + $eventhist = getroothist($SERVER,"/HADES/Run/HLD/HLD_EvType"); + $evnum = $eventhist->{bins}[13]; + print "run".$evnum."\n"; + sleep 10; + }while($evnum == 0 || $evnum != $oldevnum); + +################################################################################################### + print "End detected. Start to work\n"; + + my $str = Hmon::MakeTitle(200, 110, "TDC Cal Mon",1); + $str .= '

    '.QA::getTimeString().'

    '; + $str .= '

    Working

    '; + $str .= Hmon::MakeFooter(); + Hmon::WriteFile("TdcCalMon",$str); + + + my $datahistlist = getjsonhash($SERVER,'h.json'); + #print Dumper $datahistlist->{'_allnames'}; + + $entry = -1; + + foreach my $b (sort {$a <=> $b} keys %$boards) { + $entry++; + my $activechannels = $boards->{$b}{enable}; + + my $p = sprintf("TDC_%04X_Edges",$b); + $p = $datahistlist->{'_allnames'}{$p}; + my $hits = getroothist($SERVER,$p) if($p) ; + next unless $hits; + + $p = sprintf("TDC_%04X_CorrectedHits",$b); + $p = $datahistlist->{'_allnames'}{$p}; + my $corr = getroothist($SERVER,$p) if($p) ; + next unless $corr; + + for(my $i=1;$i<=48;$i++) { + next unless $activechannels & (1<<($i-1)); + next if($b >= 0x5000 && $b < 0x5008 && !($i&1)); + + my $avg = ($corr->{bins}[$i]//0) / ($hits->{bins}[$i*2]||1); + HPlot::PlotFill("TdcCalMon8",$avg,$entry,$i); + } + } + + $entry = -1; + foreach my $b (sort {$a <=> $b} keys %$boards) { + $entry++; + my $activechannels = $boards->{$b}{enable}; + + my $p = sprintf("TDC_%04X_RisingChanneslDiff",$b); + $p = $datahistlist->{'_allnames'}{$p}; + if($p) { + my $d = getroothist($SERVER,$p); + next unless $d; + + for(my $i=1;$i<=48;$i++) { + next unless $activechannels & (1<<($i-1)); + next if($b < 0x5008 && $b >= 0x5000 && !($i&1)); + + my ($sum,$avg,$sigma,$outlier,$ignored) = stats($d->{bins}[$i]); + + $avg = ($avg/100.-10); + $sigma = ($sigma*10); + #printf("%04x\t%i\n",$b,$sigma); + HPlot::PlotFill("TdcCalMon0",$avg,$entry,$i); + HPlot::PlotFill("TdcCalMon1",$sigma,$entry,$i); + HPlot::PlotFill("TdcCalMon2",$outlier,$entry,$i); + HPlot::PlotFill("TdcCalMon3",$ignored,$entry,$i); + } + } + + $p = sprintf("TDC_%04X_TotVsChannel",$b); + $p = $datahistlist->{'_allnames'}{$p}; + if($p) { + my $d = getroothist($SERVER,$p); + next unless $d; + + for(my $i=1;$i<=48;$i++) { + next unless $activechannels & (1<<($i-1)); + next if($b >= 0x5000 && $b < 0x5008 && !($i&1)); + + my ($sum,$avg,$sigma,$outlier,$ignored) = stats($d->{bins}[$i],1460,1540) if ($b < 0x7000); + ($sum,$avg,$sigma,$outlier,$ignored) = stats($d->{bins}[$i],960,1040) if ($b >= 0x7000); + + $avg = ($avg/50); + $sigma = ($sigma*20); + #printf("%04x\t%i\n",$b,$sigma); + HPlot::PlotFill("TdcCalMon4",$avg,$entry,$i); + HPlot::PlotFill("TdcCalMon5",$sigma,$entry,$i); + HPlot::PlotFill("TdcCalMon6",$outlier,$entry,$i); + HPlot::PlotFill("TdcCalMon7",$ignored,$entry,$i); + } + } + +# last if $entry == 150; + } + + + for(my $e = 0; $e < $NUMPLOTS; $e++) { + HPlot::PlotDraw("TdcCalMon$e"); + } + + $str = Hmon::MakeTitle(200, 110, "TDC Cal Mon",1); + $str .= '

    '.QA::getTimeString().'

    '; + for(my $e = 0; $e < $NUMPLOTS; $e++) { + $str .= qq@
    \n@; + } + $str .= Hmon::MakeFooter(); + Hmon::WriteFile("TdcCalMon",$str); + + + do{ + $oldevnum = $evnum; + $eventhist = getroothist($SERVER,"/HADES/Run/HLD/HLD_EvType"); + $evnum = $eventhist->{bins}[13]; + print "wait".$evnum."\n"; + sleep 5; + }while($evnum == $oldevnum); +} + + + +sub stats { + my @arr = @{$_[0]}; + my $minwindow = $_[1] // 0; + my $maxwindow = $_[2] // (scalar @arr-1); + + my $weightedsum = 0; + my $sigma = 0; + my $outlier = 0; + my $ignored = 0; + my $sum = 0; + my $sigmasum = 0; + + for my $i ($minwindow..$maxwindow){ + $weightedsum += $arr[$i]*$i; + $sum += $arr[$i]; + } + return (0,0,0,0,0) unless $sum; + + my $avg = $weightedsum/$sum; + + for my $i (0..(scalar @arr-1)){ + if ($i > $maxwindow || $i < $minwindow) { + $ignored += $arr[$i]; + } + elsif($arr[$i] > 0 && $arr[$i] <= 2) { + $outlier+= $arr[$i]; + } + else { + $sigma += ($i-$avg)**2 * $arr[$i]; + $sigmasum += $arr[$i]; + } + } + $sigma = sqrt($sigma/($sigmasum||1)); + + return ($sum,$avg,$sigma,$outlier,$ignored); + } + diff --git a/hmon/hmon_tofrate.pl b/hmon/hmon_tofrate.pl index 6e11afb..980493f 100755 --- a/hmon/hmon_tofrate.pl +++ b/hmon/hmon_tofrate.pl @@ -26,7 +26,7 @@ curves => 30, type => HPlot::TYPE_HEATMAP, output => HPlot::OUT_PNG, zlabel => "Hitrate", -sizex => 470, +sizex => 310, sizey => 310, nokey => 1, buffer => 1, @@ -42,7 +42,7 @@ showvalues => 0, }; HPlot::PlotInit($plot1); -my $str = Hmon::MakeTitle(6, 7, "TOF Hit Rate",0); +my $str = Hmon::MakeTitle(4, 7, "TOF Hit Rate",0); $str .= qq@
    \n@; $str .= Hmon::MakeFooter(); diff --git a/hmon/index.cgi b/hmon/index.cgi index cadc0fe..4464178 100755 --- a/hmon/index.cgi +++ b/hmon/index.cgi @@ -38,10 +38,9 @@ function openwin(url) { @@ -65,8 +64,7 @@ function openwin(url) {
  • Vertex Plots (updated after each file)
  • -
  • Icinga Server Monitoring (local access only) -
  • Calibration Monitor +
  • Munin Server Monitoring
  • Archive of Hmon Windows (updated every 10 minutes)
  • @@ -126,8 +124,8 @@ function openwin(url) { @@ -176,14 +176,25 @@ function openwin(url) {
  • Beam Abort
  • -