From: hadaq Date: Wed, 2 Feb 2022 00:02:22 +0000 (+0100) Subject: update hmon scripts X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=60b0ad461022cc85a71708f2c974f79d2c20fc65;p=hadesdaq.git update hmon scripts --- diff --git a/hmon/hmon_startrate.pl b/hmon/hmon_startrate.pl index 6229b50..9fe54c8 100755 --- a/hmon/hmon_startrate.pl +++ b/hmon/hmon_startrate.pl @@ -29,8 +29,8 @@ my $plot3 = { titles => ["X lower half position","X upper half position","Y left half position","Y right half position"],#,"Xrms_0","Xrms_1","Yrms_0","Yrms_1"], xlabel => "Seconds", ylabel => "Strips", - sizex => 970, - sizey => 720, + sizex => 950, + sizey => 360, ymin => "-0.5", ymax => "49.5", curves => 4, @@ -49,10 +49,10 @@ my $plot4 = { titles => ["X_rms lower half","X_rms upper half","Y_rms left half","Y_rms right half"], xlabel => "Seconds", ylabel => "Strips", - sizex => 970, - sizey => 720, + sizex => 950, + sizey => 360, ymin => "-0.5", - ymax => "49.5", + ymax => "19.5", curves => 4, xscale => 10, buffer => 1, @@ -82,8 +82,8 @@ my $plot5 = { stacked => 1, curvewidth => .9, additional => " - set obj 1 rect from -1, 3.5E6 to 200, 4E6 fc rgb '#ffffbb' behind \n - set obj 2 rect from -1, 4E6 to 200, 10E6 fc rgb '#ffdddd' behind + set obj 1 rect from -1, 7E7 to 2000, 10E7 fc rgb '#ffffbb' behind \n + set obj 2 rect from -1, 10E7 to 2000, 100E7 fc rgb '#ffdddd' behind " }; @@ -142,13 +142,39 @@ my $plot7 = { stacked => 1, curvewidth => .9, additional => " - set obj 1 rect from -1, 3.5E6 to 200, 4E6 fc rgb '#ffffbb' behind \n - set obj 2 rect from -1, 4E6 to 200, 10E6 fc rgb '#ffdddd' behind + set obj 1 rect from -1, 7E7 to 2000, 10E7 fc rgb '#ffffbb' behind \n + set obj 2 rect from -1, 10E7 to 2000, 100E7 fc rgb '#ffdddd' behind " }; +HPlot::PlotInit($plot7); +my $plot7a = { + name => "StartRateY_histbar_short", + file => "files/StartRateY_histbar_short", + entries => 200, + type => HPlot::TYPE_BARGRAPH, + output => HPlot::OUT_PNG, + titles => ["0","1","2","3","4","5","6","7","8","9","10","11"], + xlabel => "Time / 100 ms", + ylabel => "Hitrate [Hz]", + sizex => 950, + sizey => 330, + xmin => 0, + xmax => 200, + ymin => "0", + ymax => "100<*", + curves => 12, + xscale => 10, # xscale does not work with TYPE_BARGRAPH + buffer => 1, + stacked => 1, + curvewidth => .9, + additional => " + set obj 1 rect from -1, 7E7 to 200, 10E7 fc rgb '#ffffbb' behind \n + set obj 2 rect from -1, 10E7 to 200, 100E7 fc rgb '#ffdddd' behind + " + }; +HPlot::PlotInit($plot7a); -HPlot::PlotInit($plot7); # my $plot8 = { # name => "StartRateY_1histbar_VW", @@ -218,7 +244,7 @@ my $plot2 = { output => HPlot::OUT_PNG, zlabel => "Hitrate", sizex => 450, - sizey => 720, + sizey => 500, nokey => 1, buffer => 1, xmin => -0.5, @@ -343,18 +369,18 @@ HPlot::PlotInit({ # $str .= Hmon::MakeFooter(); # Hmon::WriteFile("StartRateSimple_VW",$str); -my $str = Hmon::MakeTitle(6, 16, "Start Hit Numbers"); +my $str = Hmon::MakeTitle(6, 12, "Start Hit Numbers"); $str .= qq@
\n@; $str .= Hmon::MakeFooter(); Hmon::WriteFile("StartRateNumbers",$str); -$str = Hmon::MakeTitle(13, 16, "Start Position",0); +$str = Hmon::MakeTitle(12, 8, "Start Position",0); $str .= qq@\n@; $str .= Hmon::MakeFooter(); Hmon::WriteFile("StartPosition",$str); -$str = Hmon::MakeTitle(13, 16, "Start Position RMS",0); +$str = Hmon::MakeTitle(12, 8, "Start Position RMS",0); $str .= qq@\n@; $str .= Hmon::MakeFooter(); Hmon::WriteFile("StartPositionRMS",$str); @@ -365,17 +391,21 @@ $str .= Hmon::MakeFooter(); Hmon::WriteFile("DutyFactor",$str); -$str = Hmon::MakeTitle(13, 32, "Start Summed Rates X",0); -$str .= qq@

Start X Spill


\n@; +$str = Hmon::MakeTitle(12, 7, "Start Summed Rates X",0); +$str .= qq@
\n@; $str .= Hmon::MakeFooter(); Hmon::WriteFile("StartRateX_histbar",$str); -$str = Hmon::MakeTitle(13, 32, "Start Summed Rates Y",0); -$str .= qq@

Start Y Spill


\n@; - +$str = Hmon::MakeTitle(12, 7, "Start Summed Rates Y",0); +$str .= qq@
\n@; $str .= Hmon::MakeFooter(); Hmon::WriteFile("StartRateY_histbar",$str); +$str = Hmon::MakeTitle(12, 7, "Start Summed Rates Y",0); +$str .= qq@
\n@; +$str .= Hmon::MakeFooter(); +Hmon::WriteFile("StartRateY_histbar_short",$str); + # Spill for START # $str = Hmon::MakeTitle(13, 32, "Start X Spill Summary",0); # $str .= qq@

Start X Spill


\n@; @@ -747,10 +777,10 @@ while(1) { my @hitRatesStartY_1 = calculate_rates($channels_y_1, $old, $current_readout); for my $i(1..48 ){ - HPlot::PlotFill('StartRateNumbers',$hitRatesStartX_0[$i],0, $i); - HPlot::PlotFill('StartRateNumbers',$hitRatesStartX_1[$i],1, $i); - HPlot::PlotFill('StartRateNumbers',$hitRatesStartY_0[$i],2, $i); - HPlot::PlotFill('StartRateNumbers',$hitRatesStartY_1[$i],3, $i); + HPlot::PlotFill('StartRateNumbers',$hitRatesStartX_0[$i]*$inspill,0, $i); + HPlot::PlotFill('StartRateNumbers',$hitRatesStartX_1[$i]*$inspill,1, $i); + HPlot::PlotFill('StartRateNumbers',$hitRatesStartY_0[$i]*$inspill,2, $i); + HPlot::PlotFill('StartRateNumbers',$hitRatesStartY_1[$i]*$inspill,3, $i); } @@ -776,6 +806,7 @@ while(1) { for my $i (0..11){ HPlot::PlotAdd("StartRateX_histbar",$summedRatesFor4Channels_X0[$i],$i); HPlot::PlotAdd("StartRateY_histbar",$summedRatesFor4Channels_Y0[$i],$i); + HPlot::PlotAdd("StartRateY_histbar_short",$summedRatesFor4Channels_Y0[$i],$i); } @@ -966,15 +997,28 @@ while(1) { HPlot::PlotDrawFork('StartDutyFactorY_0'); } - HPlot::PlotAdd("StartPosition",$avg_x_0,0); - HPlot::PlotAdd("StartPosition",$avg_x_1,1); - HPlot::PlotAdd("StartPosition",$avg_y_0,2); - HPlot::PlotAdd("StartPosition",$avg_y_1,3); - - HPlot::PlotAdd("StartPositionRMS",$rms_x_0,0); - HPlot::PlotAdd("StartPositionRMS",$rms_x_1,1); - HPlot::PlotAdd("StartPositionRMS",$rms_y_0,2); - HPlot::PlotAdd("StartPositionRMS",$rms_y_1,3); + if($inspill) { + HPlot::PlotAdd("StartPosition",$avg_x_0,0); + HPlot::PlotAdd("StartPosition",$avg_x_1,1); + HPlot::PlotAdd("StartPosition",$avg_y_0,2); + HPlot::PlotAdd("StartPosition",$avg_y_1,3); + + HPlot::PlotAdd("StartPositionRMS",$rms_x_0,0); + HPlot::PlotAdd("StartPositionRMS",$rms_x_1,1); + HPlot::PlotAdd("StartPositionRMS",$rms_y_0,2); + HPlot::PlotAdd("StartPositionRMS",$rms_y_1,3); + } + else { + HPlot::PlotAdd("StartPosition","NaN",0); + HPlot::PlotAdd("StartPosition","NaN",1); + HPlot::PlotAdd("StartPosition","NaN",2); + HPlot::PlotAdd("StartPosition","NaN",3); + + HPlot::PlotAdd("StartPositionRMS","NaN",0); + HPlot::PlotAdd("StartPositionRMS","NaN",1); + HPlot::PlotAdd("StartPositionRMS","NaN",2); + HPlot::PlotAdd("StartPositionRMS","NaN",3); + } HPlot::PlotDrawFork('StartPosition') if ($iter == 1); HPlot::PlotDrawFork('StartRateNumbers') if ($iter == 2); @@ -982,6 +1026,7 @@ while(1) { HPlot::PlotDrawFork('StartRateX_histbar') if ($iter == 4); # HPlot::PlotDrawFork('StartRateX_1histbar_VW') if ($iter == 5); HPlot::PlotDrawFork('StartRateY_histbar') if ($iter == 6); + HPlot::PlotDrawFork('StartRateY_histbar_short') if ($iter == 7); # HPlot::PlotDrawFork('StartRateY_1histbar_VW') if ($iter == 7); $iter = 1 if ($iter++ == 10) #dont change @@ -1142,7 +1187,7 @@ sub calculateMaximumRate{ $sumOfTotalDetectorHits[$i]=0; } for my $i (0..$lengthOfArray){ - $sumOfTotalDetectorHits[$i]= $totalDetectorHitsFirstHalf[$i]+ $totalDetectorHitsSecondHalf[$i]; + $sumOfTotalDetectorHits[$i]= ($totalDetectorHitsFirstHalf[$i]//0)+ ($totalDetectorHitsSecondHalf[$i]//0); } $maximumRate = max(@sumOfTotalDetectorHits); diff --git a/hmon/hmon_trgsource.pl b/hmon/hmon_trgsource.pl index a17feac..3accfd8 100755 --- a/hmon/hmon_trgsource.pl +++ b/hmon/hmon_trgsource.pl @@ -250,7 +250,7 @@ my $longmsgcheck = $longmsg; ###################################### ## QA check for spill sum on Start - if ($lastspillsum < 0 || $lastspillsum > 50000000) { + if ($lastspillsum < 0 || $lastspillsum > 20E8) { $qastatstart = QA::WARN; } ###################################### diff --git a/hmon/permanent/hmon_stslv.pl b/hmon/permanent/hmon_stslv.pl new file mode 100755 index 0000000..977d5a5 --- /dev/null +++ b/hmon/permanent/hmon_stslv.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl -w +use strict; +use warnings; +use Time::HiRes qw( gettimeofday usleep time ); +use POSIX qw(strftime); +use FileHandle; +use Data::Dumper; +use POSIX qw/floor ceil/; +use List::Util qw/min max/; +use Hmon; +use QA; +use Perl2Epics; +use HADES::TrbNet; +use HPlot; + +my $flog = QA::OpenQAFile(); + +my @lim = (2.96,2.96,2.7,2.6); + +while(1) { + + my @ret = qx(/home/hadaq/trbsoft/daq/utils/HMP_Powersupply.pl 'IP192.168.103.116&HMP&5025&INST OUT1&MEAS:CURR?&INST OUT2&MEAS:CURR?&INST OUT3&MEAS:CURR?&INST OUT4&MEAS:CURR?'); + + + my @vals = split('&',$ret[0]); + + + my $longvalue = "Currents on Pasttrec front-ends:
"; + $longvalue .= $vals[1]."A / ".$vals[2]."A / ".$vals[3]."A / ".$vals[4]."A
"; + $longvalue .= "Nominal: $lim[0] / $lim[1] / $lim[2] / $lim[3]"; + my $value = QA::SciNotation($vals[1])."/".QA::SciNotation($vals[2])."/".QA::SciNotation($vals[3])."/".QA::SciNotation($vals[4]).""; + + my $qastate = QA::OK; + $qastate = QA::WARN_2 if abs($lim[0]-$vals[1])>0.3; + $qastate = QA::WARN_2 if abs($lim[1]-$vals[2])>0.3; + $qastate = QA::WARN_2 if abs($lim[2]-$vals[3])>0.3; + $qastate = QA::WARN_2 if abs($lim[3]-$vals[4])>0.3; + + $longvalue .= "
Current is not right - check working state of FEE" if $qastate >= QA::WARN_2; + + QA::WriteQALog($flog,"padiwa","sts",30,$qastate,"STS",$value,$longvalue); + + sleep(10); + }