]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
Added automatic storage of plot histograms for long-running HPlot diagrams.
authorhadaq@countinghouse <hadaq@CountingHouse>
Fri, 4 Jul 2014 14:33:58 +0000 (16:33 +0200)
committerhadaq@countinghouse <hadaq@CountingHouse>
Fri, 4 Jul 2014 14:33:58 +0000 (16:33 +0200)
14 files changed:
hmon/HPlot.pm
hmon/QA.pm
hmon/doc/server-icinga.htt
hmon/hmon_busynew.pl
hmon/hmon_rate2.pl
hmon/hmon_starthist.pl
hmon/hmon_startmon.pl [changed mode: 0755->0644]
hmon/hmon_trgsource.pl
hmon/permanent/hmon_mdchv.pl
hmon/permanent/hmon_mdcpressure.pl
hmon/permanent/hmon_pionlv.pl
hmon/permanent/hmon_pionsupply.pl
hmon/permanent/hmon_richhv.pl
hmon/permanent/hmon_vertexplots.pl

index 0c3d79ce4b30daf7e597c7735df4956e7f2a6ec8..a4c55ff90721a2181cddbca00dadf9f3604594b3 100755 (executable)
@@ -4,8 +4,10 @@ use Data::Dumper;
 use warnings;
 use strict;
 use FileHandle;
+use Storable qw(lock_store lock_retrieve);
 
 my $p;
+my $storefile;
 
 use constant {TYPE_HISTORY => 1, TYPE_BARGRAPH => 2, TYPE_HEATMAP => 3};
 
@@ -40,11 +42,11 @@ sub PlotInit {
   my $name      = $c->{name};
 
   my $fn = "gnuplot";
-  my $fh = new FileHandle ("|$fn") or  die "error: no gnuplot";
+  #my $fh = new FileHandle ("|$fn") or  die "error: no gnuplot";
+  open my $fh, "|$fn" or  die "error: no gnuplot";
   $fh->autoflush(1);
 
 
-
   $p->{$name} = $c;
   $p->{$name}->{fh} = $fh;
   $p->{$name}->{run} = 0;
@@ -58,12 +60,25 @@ sub PlotInit {
   $p->{$name}->{output} or die "No destination specified";
   $p->{$name}->{colors} = $p->{$name}->{colors} || \@color;
   $p->{$name}->{showvalues} = $p->{$name}->{showvalues} || 0;
+  $p->{$name}->{storable} = $p->{$name}->{storable} || 0;
+
+  my $filename = $p->{$name}->{file};
+  $filename =~ s%/%%;
+  $storefile->{$name} = "/dev/shm/".$name.'-'.$p->{$name}->{curves}.'-'.$p->{$name}->{entries}.'-'.$filename.'.store';
 
+    
   foreach my $i (0..($c->{entries}-1)) {
     for my $j (0..($c->{curves}-1)) {
       push(@{$p->{$name}->{value}->[$j]},0) ;
       }
     }
+  
+  if($p->{$name}->{storable}) {
+    if (-e $storefile->{$name}) {
+      $p->{$name}->{value} = lock_retrieve($storefile->{$name});
+      }
+    }
+
 
   if($p->{$name}->{output} == OUT_PNG) {
     $p->{$name}->{file} or die "No filename specified";
@@ -233,6 +248,11 @@ sub PlotDraw {
     
     
   $p->{$name}->{run}++;
+  
+  
+  if($p->{$name}->{storable}) {
+    lock_store($p->{$name}->{value},$storefile->{$name});
+    }
   }
 
 
index d523cafee7a1ec9d38a0081e648c30757f0320a6..5852b8d0ec260918d3be0b39cf70db7cacdc7f97 100644 (file)
@@ -34,7 +34,7 @@ our $entries->{'cats'} = ["main",
 # Order of entries in each cat
 $entries->{'main'}    = ['time', 'rate','onlineqa','up'];
 $entries->{'daq'}     = ['trbnet', 'timeouts', 'busy','readout'];
-$entries->{'trg'}     = ['spill', 'source','pt1rate',  'start']; #, 'accepted'
+$entries->{'trg'}     = ['spill', 'accepted', 'source','pt1rate',  'start']; #, 
 $entries->{'rate'}    = ['pt1','start','hodo','pion1','pion2'];
 $entries->{'server'}  = ['fill', 'cpu', 'icinga', 'etrax', 'pwrsup'];
 $entries->{'eb'}      = ['run', 'rate','bytes', 'lostevt', 'errbits'];
index ca22f67c5e3cd0526de680c2e208e88d4e9eaf77..72ae5de6a4f7c1639a22029a8e1149194e0ec12a 100644 (file)
@@ -9,6 +9,6 @@ This field shows if the Icinga Server is up and checks its status.
 In case of an error (red field), please take a look to
 the Icinga <a href="http://icingaadmin@cerberus.x-matter.uni-frankfurt.de:8888/icinga/" target="_blank">tactical overview</a>. An eMail is automatically sent to a DAQ-expert,
 who should know how to proceed.
-
+<p>A DAQ restart will not change the situation.
 <p>An overview of the different servers and services monitored is given in the <a href="http://hades-wiki.gsi.de/cgi-bin/view/DaqSlowControl/IcingaMonitor" target="_blank">HADES Wiki</a>.
 
index aad7af1ada71b7e44bd1372a3e7f1fd31d4ddaa7..46771823c9210532bf0d1f8b4f6a90959422e7ad 100755 (executable)
@@ -38,6 +38,7 @@ $plot->{xscale}  = 8;
 $plot->{ymin}    = -1;
 $plot->{ymax}    = 101;
 $plot->{buffer}  = 1;
+$plot->{storable} = 1;
 HPlot::PlotInit($plot);
 
 my $plot2 = ();
@@ -65,6 +66,7 @@ $plot2->{bartitle}->[7] = "St2";
 $plot2->{bartitle}->[8] = "St3";
 $plot2->{bartitle}->[9] = "Pi";
 $plot2->{buffer}  = 1;
+$plot2->{storable} = 0;
 HPlot::PlotInit($plot2);
 
 my  $str = Hmon::MakeTitle(12,9,"Busy Times",0);
index 367303123e8d46949b0e21c708eb625b37f7ba2a..a24f31ca2dafb4667d721fefed71b28a08078d26 100755 (executable)
@@ -136,8 +136,8 @@ while (1) {
        $state, 'Start Rate', $shorttext, $longtext);        
 
   $state = QA::OK;
-  $shorttext = QA::SciNotation(($store{0xa03c}-220)/(($store{0xa037}-780)||1));
-  $longtext  = sprintf("Trigger Rate from PT1/TOF vs. Hodoscope: %.2f",($store{0xa03c}-220)/(($store{0xa037}-780)||1));
+  $shorttext = QA::SciNotation(($store{0xa03c}-8)/(($store{0xa037}-2100)||1));
+  $longtext  = sprintf("Trigger Rate from PT1/TOF vs. Hodoscope: %.2f",($store{0xa03c}-8)/(($store{0xa037}-2100)||1));
   QA::WriteQALog($fqa, "trg", "pt1rate", 10,
        $state, 'Hodo/PT1', $shorttext, $longtext);            
        
index 9e7fc0f795b51b31dde7b4605b74ed1cd0343ef7..3556c37d63a0316c1f3e4ea0dd7db65f5f813fbb 100755 (executable)
@@ -22,49 +22,49 @@ if($plots) {
     $str .= Hmon::MakeFooter();
     Hmon::WriteFile("HodoFineHist",$str);
 
-
-  while(1) {
-    my $binning = trb_register_read(3,0xa0c8) or sleep 5 and next;
-    my $offset  = trb_register_read(3,0xa0c6) or sleep 5 and next;
-    my $select  = trb_register_read(3,0xa0da) or sleep 5 and next;
-    
-#     print $binning->{3}."\n";
-    $binning = $binning->{3}*100E-9;
-#     print $binning."\n";
-    $binning = QA::SciNotation($binning);
-#     print $binning."\n";
-    $offset  = QA::SciNotation($offset->{3}*100E-9);
-    my $selx = "err";
-    my $sely = "err";
-    $selx = "X 0-7"  if ($select->{3} & 0x3) == 0;
-    $selx = "X 4-11" if ($select->{3} & 0x3) == 1;
-    $selx = "X 8-15" if ($select->{3} & 0x3) == 2;
-    $sely = "Y 0-7"  if ($select->{3} & 0xC) == 0;
-    $sely = "Y 4-11" if ($select->{3} & 0xC) == 4;
-    $sely = "Y 8-15" if ($select->{3} & 0xC) == 8;
-    
-
-  
-    $str = Hmon::MakeTitle(10,16,"Start Histogram",0);
-    $str .= qq@
-    Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely
-    <br><img src="%ADDPNG files/starthistx0.png%" type="image/png">
-    <img src="%ADDPNG files/starthisty0.png%" type="image/png">
-    @;
-    $str .= Hmon::MakeFooter();
-    Hmon::WriteFile("Starthist",$str);
-    
-    $str = Hmon::MakeTitle(10,16,"Start Histogram",0);
-    $str .= qq@
-    Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely
-    <br><img src="%ADDPNG files/starthiststackedx0.png%" type="image/png">
-    <img src="%ADDPNG files/starthiststackedy0.png%" type="image/png">
-    @;
-    $str .= Hmon::MakeFooter();
-    Hmon::WriteFile("StarthistStacked",$str);
-    
-    sleep(5);
-    }
+# 
+  while(1) {
+    my $binning = trb_register_read(3,0xa0c8) or sleep 5 and next;
+    my $offset  = trb_register_read(3,0xa0c6) or sleep 5 and next;
+    my $select  = trb_register_read(3,0xa0da) or sleep 5 and next;
+#     
+#     print $binning->{3}."\n";
+    $binning = $binning->{3}*100E-9;
+#     print $binning."\n";
+    $binning = QA::SciNotation($binning);
+#     print $binning."\n";
+    $offset  = QA::SciNotation($offset->{3}*100E-9);
+    my $selx = "err";
+    my $sely = "err";
+    $selx = "X 0-7"  if ($select->{3} & 0x3) == 0;
+    $selx = "X 4-11" if ($select->{3} & 0x3) == 1;
+    $selx = "X 8-15" if ($select->{3} & 0x3) == 2;
+    $sely = "Y 0-7"  if ($select->{3} & 0xC) == 0;
+    $sely = "Y 4-11" if ($select->{3} & 0xC) == 4;
+    $sely = "Y 8-15" if ($select->{3} & 0xC) == 8;
+#     
+# 
+#   
+    $str = Hmon::MakeTitle(10,16,"Start Histogram",0);
+    $str .= qq@
+    Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely
+    <br><img src="%ADDPNG files/starthistx0.png%" type="image/png">
+    <img src="%ADDPNG files/starthisty0.png%" type="image/png">
+    @;
+    $str .= Hmon::MakeFooter();
+    Hmon::WriteFile("Starthist",$str);
+#     
+    $str = Hmon::MakeTitle(10,16,"Start Histogram",0);
+    $str .= qq@
+    Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely
+    <br><img src="%ADDPNG files/starthiststackedx0.png%" type="image/png">
+    <img src="%ADDPNG files/starthiststackedy0.png%" type="image/png">
+    @;
+    $str .= Hmon::MakeFooter();
+    Hmon::WriteFile("StarthistStacked",$str);
+#     
+    sleep(5);
+    }
   }
 else {
   qx(./hmon_hadplot_old.sh -d 3000 \\
old mode 100755 (executable)
new mode 100644 (file)
index dfc297c7a728dc0f251f052fda13b897e116d179..030a273b88f0b9eff756a56e8de4f77e2f863215 100755 (executable)
@@ -60,20 +60,20 @@ my  $str = Hmon::MakeTitle(8,5,"Start Counts per Spill (millions)",0);
 
 
 my $plot2 = ();
-$plot2->{name}    = "Pt3AcceptRatio";
-$plot2->{file}    = "files/Pt3AcceptRatio";
+$plot2->{name}    = "Pt1AcceptRatio";
+$plot2->{file}    = "files/Pt1AcceptRatio";
 $plot2->{entries} = 40;
 $plot2->{type}    = HPlot::TYPE_HISTORY;
 $plot2->{output}  = HPlot::OUT_PNG;
 $plot2->{titles}->[0] = "";
 $plot2->{xlabel}  = "Spill Number";
-$plot2->{ylabel}  = "accepted PT3 Ratio";
+$plot2->{ylabel}  = "accepted PT1 Ratio";
 $plot2->{sizex}   = 630;
 $plot2->{sizey}   = 220;
 $plot2->{nokey} = 1;
 HPlot::PlotInit($plot2);
-  $str = Hmon::MakeTitle(8,5,"PT3 accepted over total PT3 per spill (%)",0);
-  $str .= qq@<img src="%ADDPNG files/Pt3AcceptRatio.png%" type="image/png">@;
+  $str = Hmon::MakeTitle(8,5,"PT1 accepted over total PT1 per spill (%)",0);
+  $str .= qq@<img src="%ADDPNG files/Pt1AcceptRatio.png%" type="image/png">@;
   $str .= Hmon::MakeFooter();
   Hmon::WriteFile("Pt3AcceptRatio",$str);  
   
@@ -207,17 +207,17 @@ my $longmsgcheck = $longmsg;
     $accpt3sum  = 0;
     }
   else {
-    $pt3sum    += $rStat->{3}->[0x4c] || 0;
-    $accpt3sum += $rStat->{3}->[0x39] || 0;  #was 0x5D
+    $pt3sum    += $rStat->{3}->[0x4a] || 0;
+    $accpt3sum += $rStat->{3}->[0x37] || 0;  #was 0x5D
     }
-  $accmsg = sprintf("%i%% / %i%%", $rStat->{3}->[0x4c]/($rStat->{3}->[0x39]||1)*100, $lastaccpt3 || 0);    
+  $accmsg = sprintf("%i%% / %i%%", $rStat->{3}->[0x4a]/($rStat->{3}->[0x37]||1)*100, $lastaccpt3 || 0);    
   my $qastateacc = QA::OK;    
       
   QA::WriteQALog($fqa, "trg", "source", 10, $qastate, "Trigger Source", $msg, $longmsg);
-  QA::WriteQALog($fqa, "trg", "accepted", 10, $qastateacc, "Accept. PT3", $accmsg, $acclmsg);
+  QA::WriteQALog($fqa, "trg", "accepted", 10, $qastateacc, "Accept. PT1", $accmsg, $acclmsg);
 
   my $qastatept = QA::OK;
-  my $ptoverStattart = $rStat->{3}->[0x26]/($rStat->{3}->[0x2c] || 1)*100;
+  my $ptoverStattart = $rStat->{3}->[0x24]/($rStat->{3}->[0x2c] || 1)*100;
   if ($ptoverStattart > 100) {$ptoverStattart = 100;}
 ######################################
 ## QA check for PT3/Start rate
@@ -226,10 +226,10 @@ my $longmsgcheck = $longmsg;
     }
 ######################################  
   my $ptmsg = "";
-  $ptmsg = sprintf("%s/s / %1.2f%%",QA::SciNotation($rStat->{3}->[0x26]),$ptoverStattart) if $ptoverStattart<=10;
+  $ptmsg = sprintf("%s/s / %1.2f%%",QA::SciNotation($rStat->{3}->[0x24]),$ptoverStattart) if $ptoverStattart<=10;
   $ptmsg = sprintf("%i/s / %1.1f%%",$rStat->{3}->[0x26],$ptoverStattart) if $ptoverStattart> 10;
-  my $ptlongmsg = sprintf("PT3 counts per second: %i - PT3 / Start: %1.2f%%", $rStat->{3}->[0x26], $ptoverStattart);
-  QA::WriteQALog($fqa, "trg", "ptrate", 10, $qastatept, "PT3 / Start", $ptmsg, $ptlongmsg);
+  my $ptlongmsg = sprintf("PT1 counts per second: %i - PT1 / Start: %1.2f%%", $rStat->{3}->[0x24], $ptoverStattart);
+  QA::WriteQALog($fqa, "trg", "ptrate", 10, $qastatept, "PT1 / Start", $ptmsg, $ptlongmsg);
   
   
   my $startsum = 0;
index 728557528eae67b82a6feef8f4c7cc039aee198d..f6384e689485d05c0d5198c9fa505a9c8e4a54c3 100755 (executable)
@@ -44,6 +44,8 @@ foreach my $s (0..1) {
     $plot[$p*2+$s]->{dots}    = 1;
     $plot[$p*2+$s]->{colors}  = \@colors;
     $plot[$p*2+$s]->{buffer}  = 1;
+    $plot[$p*2+$s]->{storable}  = 1;
+    
     foreach my $c (0..5) {
       $plot[$p*2+$s]->{titles}->[$c] = ($s?'F ':'C ').$names[$c];
       }
@@ -63,6 +65,7 @@ foreach my $s (0..1) {
     $plot[$p*2+$s+8]->{dots}  = 1;
     $plot[$p*2+$s+8]->{colors}  = \@colors;
     $plot[$p*2+$s+8]->{buffer}  = 1;
+    $plot[$p*2+$s+8]->{storable}  = 1;
     foreach my $c (0..5) {
       $plot[$p*2+$s+8]->{titles}->[$c] = ($s?'F ':'C ').$names[$c];
       }    
index 7bf3f49c31088320ade73faff6222e91c714e34c..29456b31d1c9ca532f742d6f75398766c5388fe9 100755 (executable)
@@ -33,6 +33,7 @@ $plot->{ymin} = 950;
 $plot->{ymax} = 1050;
 $plot->{nokey} = 1;
 $plot->{buffer} = 1;
+$plot->{storable} = 1;
 HPlot::PlotInit($plot);
 
 
@@ -51,6 +52,7 @@ $plot2->{sizey}   = 220;
 $plot2->{nokey} = 0;
 $plot2->{curves} = 2;
 $plot2->{buffer} = 1;
+$plot2->{storable} = 1;
 HPlot::PlotInit($plot2);
 
 my $plotPrePlane1 = ();
@@ -73,6 +75,7 @@ $plotPrePlane1->{nokey} = 0;
 $plotPrePlane1->{curves} = 6;
 $plotPrePlane1->{buffer} = 1;
 $plotPrePlane1->{xscale};
+$plotPrePlane1->{storable} = 1;
 HPlot::PlotInit($plotPrePlane1);
 
 my $plotPrePlane2 = ();
@@ -94,6 +97,7 @@ $plotPrePlane2->{sizey}   = 220;
 $plotPrePlane2->{nokey} = 0;
 $plotPrePlane2->{curves} = 6;
 $plotPrePlane2->{buffer} = 1;
+$plotPrePlane2->{storable} = 1;
 HPlot::PlotInit($plotPrePlane2);
 
 
@@ -116,6 +120,7 @@ $plotPrePlane3->{sizey}   = 220;
 $plotPrePlane3->{nokey} = 0;
 $plotPrePlane3->{curves} = 6;
 $plotPrePlane3->{buffer} = 1;
+$plotPrePlane3->{storable} = 1;
 HPlot::PlotInit($plotPrePlane3);
 
 
index 78cd8c601e17a65e3b07ea4094291bdf0f1116f0..a57d14e52f3e1c96176f32f708dce820910835f4 100644 (file)
@@ -41,6 +41,8 @@ $plot->{xlabel}  = "Seconds";
 $plot->{ylabel}  = "mA";
 $plot->{sizex}   = 630;
 $plot->{sizey}   = 220;
+$plot->{storable}= 1;
+
 HPlot::PlotInit($plot);
 
 
index 38d1e43ba51fde158fecb7608139ba3836fd748d..879289ed29a96e386ffd53f16168e6c6b60dfbff 100755 (executable)
@@ -21,6 +21,7 @@ $plot->{ylabel}  = "Volt";
 $plot->{sizex}   = 630;
 $plot->{sizey}   = 220;
 $plot->{ymax}    = 200;
+$plot->{storable}= 1;
 HPlot::PlotInit($plot);
 
 
@@ -38,6 +39,7 @@ $plot2->{xlabel}  = "Entries (~0.5h total)";
 $plot2->{ylabel}  = "Microampere";
 $plot2->{sizex}   = 630;
 $plot2->{sizey}   = 220;
+$plot2->{storable}= 1;
 HPlot::PlotInit($plot2);
 
 while(1) {
index 910b8d203330ce4f4b3792e2152c939a1943d441..90d8fb8aee072a47b778fc147adeace6cc9a07b1 100755 (executable)
@@ -29,6 +29,7 @@ my $plot = {
     curves  => 6,
     xscale  => 4,
     colors  => ["#333333","#00ff00","#ff0000","#0000ff","#dddd00","#dd00dd"]};
+$plot->{storable}= 1;
 HPlot::PlotInit($plot);
 
 my $plot2 = {
@@ -45,6 +46,7 @@ my $plot2 = {
     curves  => 6,
     xscale  => 30,
     colors  => ["#333333","#00ff00","#ff0000","#0000ff","#dddd00","#dd00dd"]};
+$plot2->{storable}= 1;
 HPlot::PlotInit($plot2);
 
 
index f3950bea53158d898a1dcac6915ba56a1234d359..4bf00a9ac7f78fc208cf96fd46b9418b0a51d8f3 100755 (executable)
@@ -29,25 +29,30 @@ while(1) {
 
   $out .= "<table>";
 
-  my $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/target_*e*.jpg | tail -n 5";
+  my $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/target_*.jpg | tail -n 5";
   my @files = qx($cmd);
   @files = reverse @files;
 
-  $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/targetSum10*e*.jpg | tail -n 5";
+  $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/targetSum*.jpg | tail -n 5";
   my @files2 = qx($cmd);
   @files2 = reverse @files2;
 
 
   foreach my $i (0..(scalar @files)-1) {
+    next if scalar @files == 0;
     $out .= "<tr><td style='text-align:center'>";
     my @n = split('/',$files[$i]);
     chop $n[-1];
-    my ($y,$d,$h,$m,$s) = $n[-1] =~ /.*_[\w-][\w-](\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d)_.*/;
+    my ($y,$d,$h,$m,$s) = $n[-1] =~ /.*_(\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d)_.*/;
     $out .= qq@20$y-$d $h:$m:$s<br><div class=\"linkbox\" style=\"width:567px\"><img src="../vertex/$n[-1]" style="padding:10px;background:white;"></div>@;
+    }
+
+  foreach my $i (0..(scalar @files2)-1) {
+    next if scalar @files2 == 0;
     $out .= "<td style='text-align:center'>";  
-    @n = split('/',$files2[$i]);
+    my @n = split('/',$files2[$i]);
     chop $n[-1];
-    my ($y1,$d1,$h1,$m1,$s1,$y2,$d2,$h2,$m2,$s2) = $n[-1] =~ /.*_[\w-][\w-](\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d)-[\w-][\w-](\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d).*/;
+    my ($y1,$d1,$h1,$m1,$s1,$y2,$d2,$h2,$m2,$s2) = $n[-1] =~ /.*_(\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d)-[\w-][\w-](\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d).*/;
     $out .= qq@20$y1-$d1 $h1:$m1:$s1 - $h2:$m2:$s2<br><div class=\"linkbox\" style=\"width:567px\"><img src="../vertex/$n[-1]" style="padding:11px 10px;background:white;"></div>\n@;
     }