]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
update hmon files
authorhadaq <jan@lxhadeb07>
Thu, 3 Feb 2022 22:47:49 +0000 (23:47 +0100)
committerhadaq <jan@lxhadeb07>
Thu, 3 Feb 2022 22:47:49 +0000 (23:47 +0100)
26 files changed:
hmon/QA.pm
hmon/doc/daq-busy.htt
hmon/doc/eb-errbits.htt
hmon/doc/eb-lostevt.htt
hmon/doc/eb-run.htt
hmon/doc/feeerr-tof.htt [new file with mode: 0644]
hmon/hmon_busynew.pl
hmon/hmon_eberrbits_withreset.pl
hmon/hmon_ecalresetthresholds.pl [new file with mode: 0755]
hmon/hmon_endpoints.pl
hmon/hmon_frpcrate.pl
hmon/hmon_itofrate.pl
hmon/hmon_logfrpc.pl [new file with mode: 0755]
hmon/hmon_rate2.pl
hmon/hmon_spill.pl
hmon/hmon_startrate.pl
hmon/hmon_startratesimple.pl
hmon/hmon_stsrate.pl
hmon/hmon_tofrate.pl
hmon/hmon_trgsource.pl
hmon/hmon_triggerratio.pl
hmon/index.cgi
hmon/permanent/hmon_logbook.pl [new file with mode: 0755]
hmon/permanent/hmon_mdchv.pl
hmon/permanent/hmon_stslv.pl
hmon/permanent/hmon_vertexplots.pl

index d6c247213031f89c3a4613cb1c96367734ea52da..f4757f79f7845b7d4d0d25c2fcb72a971dc4557a 100644 (file)
@@ -50,7 +50,7 @@ $entries->{'server'}  = ['fill', 'cpu', '', '', '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',''];
+$entries->{'feeerr'}  = ['feeerr','trginp','trgqual','rpc','tof'];
 $entries->{'rich'}    = ['temp','LV','bkpl','isob','richthr'];
 $entries->{'padiwa'}  = ['ecal','start','itof','hodo','sts'];
 $entries->{'hv'}      = ['richhv','ecalhv','rpchv','fwhv','tofhv'];
@@ -91,9 +91,9 @@ our @RichInnerTempLimits = (34.3,35.2,36);
 our @TrgErrLimits     = (100, 1000, 10000);
 our @CPULimits        = (95, 100, 100);
 our @TimeoutLimits    = (0, 0, 1);
-our @TimeoutLimitsOnlyRICHMDC = (0, 3, 4);
+our @TimeoutLimitsOnlyRICHMDC = (0, 5, 10);
 our @LinkErrLimits     = (50, 500, 1000);
-our @MdcEndpMissingLimits   =  (0, 2, 3);  #!!! Oh dear.
+our @MdcEndpMissingLimits   =  (0, 5, 8);  #!!! Oh dear.
 our @RichEndpMissingLimits   = (0, 3, 4);
 our @TofEndpMissingLimits   = (0, 0, 0);
 our @RpcEndpMissingLimits   = (0, 0, 0);
@@ -103,7 +103,7 @@ our $TrgCheckPolarity = 1;
 our @Eventsbroken     = (.5,2,5);
 our @MdcTokenMissLimits = (10,50,100);
 our @MdcNominalHV = (1750,1770,1900,2150);
-our $MdcHVOffsetLimits = [[5,10,55],[5,10,55],[5,10,55],[10,110,125]];
+our $MdcHVOffsetLimits = [[5,10,255],[5,10,255],[5,10,255],[10,110,325]];
 our @EcalHvLimits = (493,325,320);
 our @RpcHvLimits = (12,12,12);
 our @TofHvLimits = (764,760,759);
@@ -155,7 +155,7 @@ our $QAServerOff = 0;
 #  Missing Boards
 ###############################################################################
 
-our @mdc_boards_removed =(); #(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23
+our @mdc_boards_removed =(0x2203); #(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23
 our @mdc_chambers_removed =();
 our @rich_boards_removed =();
 our @tof_boards_removed =();
@@ -321,6 +321,7 @@ sub SciNotation {
     return  sprintf("%.1fM", $v / 1000000.) if (abs($v) < 20E6) ;
     return  sprintf("%iM", $v / 1000000.) if (abs($v) < 1E9) ;
     return  sprintf("%.2fG", $v / 1E9) if (abs($v) < 20E9) ;
+    return  sprintf("%.1fG", $v / 1E9) if (abs($v) < 100E9) ;
     return  sprintf("%i",$v);
     }
   else {
index f3e6313c7fb45448f633897d8a3b35355021aa75..7998e6008a1e7d526bbd4258c52010197106664d 100644 (file)
@@ -15,15 +15,16 @@ During normal operation, the full message gives the busy times for all sub-syste
 
 
 <h4>Additional notes</h4>
+<br><b>Note that in many cases this is not the real source of the error - </b>
+e.g. if the data transport to EB failed, the board with the smallest 
+buffer and the most data gets busy first. 
 <ul>
 <li>If the misbehaving board is from MDC and the error happens several times for the same board, 
 do a MDC power-cycle of the corresponding chamber.
 <li>If the board is from MDC, and there is a "FEE Error" at the same time, an MDC LV power-cycle is needed.
-<li>If the board is from another system* and fails several times, try a reboot of the corresponding system.
+<li>If the board is from another system* and fails several times, try a reboot (and then a powercycle of the corresponding system.
+<li>If reboot doesn't help, do a power cycle of the corresponding system.
 </ul>
-<br><b>Note that in many cases this is not the real source of the error - </b>
-e.g. if the data transport to EB failed, the board with the smallest 
-buffer and the most data gets busy first. 
 
 <p>*The list of addresses can be found on the main monitoring web page.
 
index 59a1ebd21064232c510c60b58e58cd14e8dac29b..598e4e6cd820f08479acd26fa6d68af457f844ec 100644 (file)
@@ -2,9 +2,17 @@
 <p>
 The number of accepted events (written to disk) with errors reported by the front-ends.
 <h4>Error handling</h4>
-<br>Try to do a DAQ restart 
+Check the long error message for the subsystems that cause the most errors, then try to solve these.
+
+<br><b>Partially Missing</b> errors usually refer to a detector with a lot of noise, try to reload thresholds for the corresponding detector. A few errors of this type are perfectly normal.
+<br><b>TriggerNumberMismatch TriggerCodeMismatch</b> errors are usually a problem in the hubs - if a DAQ restart doesn't help, try a reboot of the corresponding hubs (in RICH: combiners, or hubs).
+<br><b>TimingTriggerError</b> A board has problems receiving the reference time for the event. Check the "Trigger" box for more details.
+<br>If the reason is unclear, try to do a DAQ restart 
 <br>In some cases a reload or power-cycle of the corresponding system / chamber is necessary.
 
+<br>Error counters are cleared at DAQ restart. If you want to clear them manually, use the Eventbuilder GUI and click the "Hist" button.
+
+
 
 
 
index 416ea94310ff323a653cfac3203f7680db8b65cd..5584ccedad5202490dec0a870185aa3394d3c9e4 100644 (file)
@@ -1,13 +1,13 @@
 <h3>Number of discarded events</h3>
 <p>
-This button gives you the number of discarded events in the Eventbuilders. Few discarded events (<1%) are fine.
+This button gives you the number of discarded events in the Eventbuilders. Few discarded events (<1%) are acceptable.
 </p>
 
 <h4>Error Handling</h4>
 <dl>
 <dt>Check the datarate that is delivered by DAQ</dt>
 <dd> If many events are lost, the EB might be overloaded. Check that the trigger rate is about the expected value.</dd>
-<dd>Check that the number of eventbuilders can handle the intended datarate. Beam runs require at least 4 builder nodes, 8 is usual. Try to increase the number of event builders using the buttons "Set x EB" in the operator GUI</dd>
+<dd>Check that the number of eventbuilders can handle the intended datarate. Beam runs require at least 10 builder nodes. Try to increase the number of event builders using the buttons "Set x EB" in the operator GUI</dd>
 <dd> Check in the EB summary that writing data to local disk and TSM/lustre is working. There might be backpressure if too much data is written to tape. Try reducing the trigger rate.</dd>
 
 <dt>Restart the Eventbuilders</dt>
index 7e1487eeeb62c57b516c8689674c730138f0324c..1e3e88ee5aefb914441b6dd122b2b1fc8b45965c 100644 (file)
@@ -1,9 +1,9 @@
 <h3>Number of running Eventbuilders</h3>
 <p>
-Shown is the number of input nodes (i:5) and builder nodes (b:8) of the buider network BNET.<br>
-The input nodes are the data receivers from the detector front-ends. Their number should be always 5. <br>
+Shown is the number of input nodes (i:7) and builder nodes (b:10) of the buider network BNET.<br>
+The input nodes are the data receivers from the detector front-ends. Their number should be always 7. <br>
 The builder nodes are the parallel Eventbuilders writing data to disc. Their number depends on the setup: <br> 
-(Cosmics: 1 EB, Beamtime: 8 EB) Number of builders may be changed with the "Set x EB" button on operator GUI <br>
+(Cosmics: 1 EB, Beamtime: 10 EB) Number of builders may be changed with the "Set x EB" button on operator GUI <br>
 Also shown is the file prefix currently written ("be"). <b>For data taking with beam this should be "be"</b>
 
 </p>
diff --git a/hmon/doc/feeerr-tof.htt b/hmon/doc/feeerr-tof.htt
new file mode 100644 (file)
index 0000000..8cb3f74
--- /dev/null
@@ -0,0 +1,5 @@
+<h3>RPC Thresholds</h3>
+Monitors the noise level in TOF. Sometimes noise in a part of the detector gets too high because of problems with the thresholds. Problems should also be visible in the rate plots for the detector (in one of the main operator windows).
+<h4>Error Handling</h4>
+Use "Thresholds TOF" to reload the proper settings. A DAQ restart is not needed. 
+<br>If the situation doesn't change, inform the TOF operator.
index a4c9ef285a373981c23e8dadbe3fb53329e5301d..285b7a2cf69a4e933ac7b4cedb146a5376637ebb 100755 (executable)
@@ -181,8 +181,8 @@ while (1) {
       my $maxpercent = max(@{$diff->{0x8000}});
       my $msgstr = sprintf("%3.1f%%",$maxpercent);
       my $qastate = QA::OK;
-      $qastate = QA::WARN if ($maxpercent > 50);
-      $qastate = QA::WARN_2 if ($maxpercent > 75);
+      $qastate = QA::WARN if ($maxpercent > 70);
+      $qastate = QA::WARN_2 if ($maxpercent > 80);
       $qastate = QA::ERROR if ($maxpercent > 99);
       QA::WriteQALog($fqa,"daq","busy",5,$qastate,"Busy",$msgstr,"") unless  ($maxpercent >= 99);      
       }
index 5d70d95f54e7787f17ffd12575e1f6f20adbdff9..39cf1721ce9a6feabb2a607044f3ccfdd78f2231 100755 (executable)
@@ -221,7 +221,7 @@ foreach my $k (sort keys %$store) {
                                          $store->{$k}->{$b},
                                          $perc,
                                          $bits[$b]);
-          $longstring .= $ts;          
+          $longstring .= $ts."<br>";          
           $brokenevents += $store->{$k}->{$b};
           }
         } 
@@ -231,7 +231,7 @@ foreach my $k (sort keys %$store) {
   $longstring = "Total Events in file: ".($store->{TRB_8800}->{0} || "")." - ".
                 "Events with errors: ".$value." - ".
                 $longstring;
-  chop $longstring;chop $longstring;chop $longstring;
+  chop $longstring;chop $longstring;chop $longstring;chop $longstring;chop $longstring;chop $longstring;chop $longstring;
   print "$longstring \n" if $opt_debug;
   $qastate = QA::GetQAState('below', $sumperc, @QA::Eventsbroken);
   QA::WriteQALog($flog, "eb", "errbits", 10,
diff --git a/hmon/hmon_ecalresetthresholds.pl b/hmon/hmon_ecalresetthresholds.pl
new file mode 100755 (executable)
index 0000000..8f50c50
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Data::Dumper;
+use Hmon;
+use QA;
+use HADES::TrbNet;
+use POSIX qw(strftime);
+my $fh;
+
+  
+trb_init_ports() or die trb_strerror();
+my $inspill;
+while (1) {
+  do{{
+    sleep(1);
+    my $o = trb_register_read(0x10,0x905d);
+    $inspill = $o->{0x10} >> 31;
+#     print ".\n";
+  }}while($inspill);
+
+  system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds.pl");
+
+#  system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds_sec2_sec4.pl");
+
+
+  sleep(15);
+  }
index 99012e3e854f7d767e4c58e533000fee17fd2f1d..e274c8ccfd13a88d5b9bbdbf06372b65f6f24eb7 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
 
 use strict;
 use warnings;
@@ -9,6 +9,7 @@ use QA;
 use Getopt::Long;
 use Data::Dumper;
 use List::MoreUtils qw(uniq);
+use List::Util qw(max);
 use HADES::TrbNet;
 
 trb_init_ports() or die trb_strerror();
@@ -250,7 +251,7 @@ while(1) {
     my @sorted_mdc_results = sort @{$mdc_results[2]};
 
     $mdcmissingtime = 0 if $num_mdc_missing == 0;
-    $mdcmissingtime += $num_mdc_missing;
+    $mdcmissingtime += max(0,$num_mdc_missing-2);
     
     #Are two boards from the same chamber missing?
     my @mdcboards = @sorted_mdc_results;
@@ -259,6 +260,12 @@ while(1) {
     my $samechamberboards = 0;
     if(scalar @mdcboards != scalar @uniqchambers) {$samechamberboards = 1;}
 
+    #Are two boards from the same sector missing?
+    chop(@mdcboards);
+    @uniqchambers = uniq @mdcboards;
+    my $samesectorboards = 0;
+    if(scalar @mdcboards != scalar @uniqchambers) {$samesectorboards = 1;}    
+    
     print $fh "$num_mdc_missing\n";
     $fh->autoflush(1);
     seek($fh, 0, 0);
@@ -273,8 +280,9 @@ while(1) {
 
     my $qastate = QA::GetQAState('below',$num_mdc_missing,@QA::MdcEndpMissingLimits);
        $qastate = QA::ERROR  if $samechamberboards;
+       $qastate = QA::WARN   if $samesectorboards;
        $qastate = QA::ERROR  if $mdcmissingtime > 360;
-       $longtext .= "<br>Few boards missing, but for a long time. Better do a restart." if $mdcmissingtime > 1800;
+       $longtext .= "<br>Few boards missing, but for a long time. Better do a restart." if $mdcmissingtime > 360;
        
     Hmon::Speak('mdcmissonce',"$num_mdc_missing MDC Frontends missing") if($qastate > 60 && $qastate < QA::ERROR );
     Hmon::Speak('mdcmiss',"$num_mdc_missing MDC Frontends missing") if($qastate >= QA::ERROR );
index a6864224257160c74def5a169715c3b84ee69fb3..8e164e067e9416a4096f121d08908ec12f27fa38 100755 (executable)
@@ -32,7 +32,7 @@ HPlot::PlotInit({
     ymax    => -0.5,
     xmin    => -0.5,
     xmax    => 15.5,
-    cbmax   => "100<*<1E5",
+    cbmax   => "100<*<1E7",
     cbmin   => 0,
     noinit  => 1,
     additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
index 234a9de0135697fb51dd95068c9a8efe3f0b47fd..2b6ad1e322ca3a0e13d0fef96e5fd4c1e061de1f 100755 (executable)
@@ -32,7 +32,7 @@ ymin    => 23.5,
 ymax    => -0.5,
 xmin    => -0.5,
 xmax    => 15.5,
-cbmax   => "100<*<1E5",
+cbmax   => "100<*<1E7",
 cbmin   => 0,
 noinit  => 1,
 additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
diff --git a/hmon/hmon_logfrpc.pl b/hmon/hmon_logfrpc.pl
new file mode 100755 (executable)
index 0000000..58e7769
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Data::Dumper;
+use Hmon;
+use QA;
+use HADES::TrbNet;
+use POSIX qw(strftime);
+my $fh;
+
+  
+trb_init_ports() or die trb_strerror();
+my $inspill;
+while (1) {
+  do{{
+    sleep(1);
+    my $o = trb_register_read(0x10,0x905d);
+    $inspill = $o->{0x10} >> 31;
+#     print ".\n";
+  }}while($inspill);
+
+
+  my $o = trb_register_read_mem(0xfe47,0xdfc0,0,32);
+  sleep 1;
+  my $p = trb_register_read_mem(0xfe47,0xdfc0,0,32);
+  my @diff;
+  foreach my $b (sort keys %$p) {
+    next if ($b < 0x6800 || $b > 0x6813);
+    for my $v (0..31) {
+      my $d = ($p->{$b}[$v]&0xffffff)-($o->{$b}[$v]&0xffffff);
+         $d += 2**24 if $d < 0;
+      push(@diff, $d);
+      }
+    }
+my $day =   strftime("%Y%m%d",localtime());
+
+  my $str = "";
+  $str .= strftime("%Y.%m.%d %H:%M:%S",localtime())."\t";
+  $str .= time()."\t";
+  for my $i (0..scalar @diff -1) {
+    $str .= sprintf("%u\t",$diff[$i]);
+    }
+  $str .= "\n";  
+  open($fh, ">>",Hmon::HMONDIR."/archive/frpcscalerlog-$day.csv");
+  print $fh $str;
+#   print $str;
+  close $fh;
+  sleep(50);
+  }
index cf832d8a7cd458721a08de2bd3a7771555b06ad6..88e80ed4c73741e54ccc08e93d496155db464da6 100755 (executable)
@@ -155,6 +155,7 @@ while (1) {
        $state, 'PT3 Rate', $shorttext, $longtext); 
 
   $state = QA::OK;
+#   $state = QA::WARN_2 if $offset->{0xa025} > 100;
   $shorttext = QA::SciNotation($store{0xa025})." / ".getCorrected($store{0xa025},$offset->{0xa025});
   $longtext  = sprintf("Trigger Rate from PT2 %i Hz / %i Hz after offset correction",$store{0xa025}, getCorrectedValue($store{0xa025},$offset->{0xa025}) );
   QA::WriteQALog($fqa, "rate", "pt2", 10,
index deb18699783bb474b5d35fd2582e37011c49a157..49dbbca1cb7f755a77af056cf8f503f9810905c8 100755 (executable)
@@ -136,7 +136,7 @@ while (1) {
             HPlot::PlotDraw("EvtsPerSpill")  unless $opt_debug>0;
            $events = 0;
            $spilllength = 0;
-       } elsif ($spilllength > 20) {
+       } elsif ($spilllength > 30) {
               QA::WriteQALog($fqa, "trg", "spill", 30, QA::NOTE, "Spill Sum",
                           "No Spills", "No Spills detected at the moment") unless $opt_debug>0;;  
             #print $spilllength."\n" unless $spilllength%10;
index 9fe54c8f44acdf77ef4497ec43a02ae791a5af1d..b41e2b530dd30314a46ef9afc5d895872f5b7289 100755 (executable)
@@ -151,7 +151,7 @@ HPlot::PlotInit($plot7);
 my $plot7a = {
     name    => "StartRateY_histbar_short",
     file    => "files/StartRateY_histbar_short",
-    entries => 200,
+    entries => 400,
     type    => HPlot::TYPE_BARGRAPH,
     output  => HPlot::OUT_PNG,
     titles  => ["0","1","2","3","4","5","6","7","8","9","10","11"],
@@ -160,7 +160,7 @@ my $plot7a = {
     sizex   => 950,
     sizey   => 330,
     xmin    => 0,
-    xmax    => 200,
+    xmax    => 400,
     ymin    => "0",
     ymax    => "100<*",
     curves  => 12,
@@ -455,11 +455,11 @@ my $empties_x_1 = 0;
 my $empties_y_1 = 0;
 
 
-my($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $spillEnds_x_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
-my($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0, $spillEnds_y_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
+my($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $spillEnds_x_0, $avgRate_x_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
+my($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0, $spillEnds_y_0, $avgRate_y_0) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
 
-my($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $spillEnds_x_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
-my($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1, $spillEnds_y_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
+my($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $spillEnds_x_1, $avgRate_x_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
+my($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1, $spillEnds_y_1, $avgRate_y_1) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
 
 my $maxTotalX;
 my $maxTotalY;
@@ -891,23 +891,23 @@ while(1) {
             $spillends = $inspill == 0 && $lastinspill == 1;
             
             if($spillends){
-                ($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $time_x_0, $empties_x_0, $spillEnds_x_0) = spillAnalysisACCSIG(\@totalDetectorHitsX_0, \@lastspills_x_0, $time_x_0, $empties_x_0);
+                ($max_x_0, $duty_x_0, $total_x_0, $spillmin_x_0, $spillmax_x_0, $spillavg_x_0, $flucqual_x_0, $offtime_x_0, $length_x_0, $time_x_0, $empties_x_0, $spillEnds_x_0, $avgRate_x_0) = spillAnalysisACCSIG(\@totalDetectorHitsX_0, \@lastspills_x_0, $time_x_0, $empties_x_0);
                 
                 $maxTotalX= calculateMaximumRate(\@totalDetectorHitsX_0,\@totalDetectorHitsX_1);
                 $maxTotalY= calculateMaximumRate(\@totalDetectorHitsY_0,\@totalDetectorHitsY_1);
                 
                 @totalDetectorHitsX_0 = ();
                 
-                ($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0,$time_y_0, $empties_y_0, $spillEnds_y_0) = spillAnalysisACCSIG(\@totalDetectorHitsY_0, \@lastspills_y_0, $time_y_0, $empties_y_0);
+                ($max_y_0, $duty_y_0, $total_y_0, $spillmin_y_0, $spillmax_y_0, $spillavg_y_0, $flucqual_y_0, $offtime_y_0, $length_y_0, $time_y_0, $empties_y_0, $spillEnds_y_0, $avgRate_y_0) = spillAnalysisACCSIG(\@totalDetectorHitsY_0, \@lastspills_y_0, $time_y_0, $empties_y_0);
                 
                 @totalDetectorHitsY_0 = ();
                 
 #                 added W.K. 01.2.22 to include values of whole detector in plots
-                ($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $time_x_1, $empties_x_1, $spillEnds_x_1) = spillAnalysisACCSIG(\@totalDetectorHitsX_1, \@lastspills_x_1, $time_x_1, $empties_x_1);
+                ($max_x_1, $duty_x_1, $total_x_1, $spillmin_x_1, $spillmax_x_1, $spillavg_x_1, $flucqual_x_1, $offtime_x_1, $length_x_1, $time_x_1, $empties_x_1, $spillEnds_x_1, $avgRate_x_1) = spillAnalysisACCSIG(\@totalDetectorHitsX_1, \@lastspills_x_1, $time_x_1, $empties_x_1);
                 
                 @totalDetectorHitsX_1 = ();
                 
-                ($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1,$time_y_1, $empties_y_1, $spillEnds_y_1) = spillAnalysisACCSIG(\@totalDetectorHitsY_1, \@lastspills_y_1, $time_y_1, $empties_y_1);
+                ($max_y_1, $duty_y_1, $total_y_1, $spillmin_y_1, $spillmax_y_1, $spillavg_y_1, $flucqual_y_1, $offtime_y_1, $length_y_1, $time_y_1, $empties_y_1, $spillEnds_y_1, $avgRate_y_1) = spillAnalysisACCSIG(\@totalDetectorHitsY_1, \@lastspills_y_1, $time_y_1, $empties_y_1);
                 
                 @totalDetectorHitsY_1 = ();
 
@@ -924,7 +924,7 @@ while(1) {
 #                 HPlot::PlotAdd("StartSpillSumX_0", $total_x_0,0);
                 
 #                 changed W.K 01.02.22 max_x and total_x for whole detector
-                HPlot::PlotAdd("StartDutyFactorX_0", $duty_x_0,0);
+                HPlot::PlotAdd("StartDutyFactorX_0", ($avgRate_x_0+$avgRate_x_1)/$maxTotalX,0);
                 HPlot::PlotAdd("StartSpillPeakX_0", $maxTotalX,0);
                 HPlot::PlotAdd("StartSpillSumX_0", $total_x_0+$total_x_1,0);
 #                 end changed
@@ -937,10 +937,11 @@ while(1) {
 #                 $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($total_x_0);
                 
 #                 changed W.K. 01.02.22 total spill sum total_x=total_x_1+total_x_0 
-                $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation( $maxTotalX);
+#                 $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation( $maxTotalX);
+                $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation( $total_x_0+$total_x_1);
 # end changed
                 
-                $str .= "<td>Last Duty<td>".sprintf("%0.3f",$duty_x_0);
+                $str .= "<td>Last Duty<td>".sprintf("%0.3f",($avgRate_x_0+$avgRate_x_1)/$maxTotalX);
                 $str .= "<tr><td>Last Duration<td>".$length_x_0;
                 $str .= "<td>Last Break<td>".$offtime_x_0." s";
 #                 $str .= "<tr><td>Last Max<td>".QA::SciNotation($max_x_0)." Hz (100ms)";
@@ -961,7 +962,7 @@ while(1) {
 #                 HPlot::PlotAdd("StartSpillPeakY_0", $max_y_0,0);
 #                 HPlot::PlotAdd("StartSpillSumY_0", $total_y_0,0);
 #                 changed W.K 01.02.22
-                HPlot::PlotAdd("StartDutyFactorY_0", $duty_y_0,0);
+                HPlot::PlotAdd("StartDutyFactorY_0", ($avgRate_y_0+$avgRate_y_1)/$maxTotalY,0);
                 HPlot::PlotAdd("StartSpillPeakY_0",$maxTotalY,0);
                 HPlot::PlotAdd("StartSpillSumY_0", $total_y_0+$total_y_1,0);
 #                 end changed
@@ -977,10 +978,11 @@ while(1) {
 #                 $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($total_x_0);
 
 #                 changed W.K. 01.02.22
-                $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($maxTotalY);
+#                 $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($maxTotalY);
+                $str .= "<table style=\"margin:auto;\"><tr><td>Last Sum<td>".QA::SciNotation($total_y_0+$total_y_1);
 #                end changed
 
-                $str .= "<td>Last Duty<td>".sprintf("%0.3f",$duty_y_0);
+                $str .= "<td>Last Duty<td>".sprintf("%0.3f",($avgRate_y_0+$avgRate_y_1)/$maxTotalY);
                 $str .= "<tr><td>Last Duration<td>".$length_y_0;
                 $str .= "<td>Last Break<td>".$offtime_y_0." s";
 #                 $str .= "<tr><td>Last Max<td>".QA::SciNotation($max_y_0)." Hz (100ms)";
@@ -1135,14 +1137,14 @@ sub spillAnalysisACCSIG{
     
     my @totalDetectorHits = @{$totalDetectorHitsReference};
     my @lastSpills = @{$lastSpillReference};
-    my ($max, $duty, $total, $spillmin, $spillmax, $spillavg, $flucqual, $offtime, $length, $spillEnds) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0);
+    my ($max, $duty, $total, $spillmin, $spillmax, $spillavg, $flucqual, $offtime, $length, $spillEnds, $avg) = (0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0);
     
     
     #end of spill signaled by last 15 readouts having an average below spillThreshold entries and the one before having more 
 #     if($inspill == 0 && $lastinspill == 1){
         $max = max(@totalDetectorHits);
         my $samples = scalar @totalDetectorHits;
-        my $avg  = sum(@totalDetectorHits)/$samples;
+        $avg  = sum(@totalDetectorHits)/$samples;
         $duty = $avg/($max||1);
         $total = sum(@totalDetectorHits)/$samplesPerSecond;# sum and mulitply by bin width -> Integral. Gives total hits in a spill
         
@@ -1162,7 +1164,7 @@ sub spillAnalysisACCSIG{
       #  @totalDetectorHits = ();
 
 #         $lastinspill = $inspill;
-        return ($max, $duty, $total, $spillmin, $spillmax, $spillavg, $flucqual, $offtime, $length,$time, $empties, 1);
+        return ($max, $duty, $total, $spillmin, $spillmax, $spillavg, $flucqual, $offtime, $length,$time, $empties, 1, $avg);
 #     }
 #     $lastinspill = $inspill;
 #     return (0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
index 8a2ce6ca156c58be355a403797eccdf58111c42a..bb35a11df05593d05de1cb61a1c5d94dd5172ba4 100755 (executable)
@@ -38,7 +38,7 @@ my $plot1 = {
              ymax       => -0.5,
              xmin       => -0.5,
              xmax       => 15.5,
-             cbmax      => "100<*<1E5",
+             cbmax      => "100<*<1E8",
              cbmin      => 0,
              noinit     => 1,
              additional => "set logscale cb; unset ytics;set format cb \"_{10}{\%L}\"",
index 8e64b105908bf123d1e97f5f317b61141655fd17..4cbc49dd7103cf0688e3c8ffcfd26ec1790aa3be 100755 (executable)
@@ -32,7 +32,7 @@ ymin    => 79.5,
 ymax    => -0.5,
 xmin    => -0.5,
 xmax    => 47.5,
-cbmax   => "100<*<1E5",
+cbmax   => "100<*<1E7",
 cbmin   => 0,
 noinit  => 1,
 additional => "set logscale cb;set format cb \"_{10}{\%L}\";set xtics ('0' -0.5, '8' 7.5, '16' 15.5, '24' 23.5, '32' 31.5, '40' 39.5); set grid xtics front;",
index 15c6ebe75d5c4aa6e2ae9f0f04c7169abebfc3d0..1ce074a70e3d75b74b04c91761f49de3ed1caffe 100755 (executable)
@@ -14,6 +14,8 @@ use List::Util qw[min max];
 use Encode qw(encode from_to);
 use JSON::XS;
 
+my $fqa  = QA::OpenQAFile();
+
 
 my $plot1 = {
 name    => "TofRate",
@@ -53,7 +55,14 @@ my $time = time();
 my $diff;
 my $iter = 0;
 
+my $lowratelimit = 200;
+my $highratelimit = 50000;
+my $lowratecount = 500;
+my $highratecount = 30;
 
+my $qastate = QA::OK;  
+my $text = "OK";
+my $shorttext = "OK";
 
 trb_init_ports() or die trb_strerror();
 
@@ -62,7 +71,7 @@ while(1) {
   #my $data;
   #my $max = 0 ;
   #my $min = 5E9;
-  
+  my $lowrate = 0; my $highrate = 0;  
   my $o = trb_register_read_mem(0xfe47,0xdfc0,0,32) or die trb_strerror() or sleep 5 and next;
 
   if (defined $old) {
@@ -77,33 +86,32 @@ while(1) {
         
         if ($vdiff < 0) { $vdiff += 2**28;}
         $diff->{$b}->[$v] = $vdiff/$tdiff;
-        #$ratesum += $diff->{$b}->[$v+1];
         HPlot::PlotFill('TofRate',$diff->{$b}->[$v],$v,$xpos);
+        
+        $highrate++ if ($diff->{$b}->[$v] > $highratelimit);
+        $lowrate++  if ($diff->{$b}->[$v] < $lowratelimit);        
         }
-      #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;
+
    }
+
+  if($lowrate > $lowratecount) {
+  
+    $qastate = QA::OK;  
+    $text = "OK";
+    $shorttext = "OK";
     
+    if ($highrate > $highratecount) {
+      $qastate = QA::ERROR;
+      $shorttext = "Problem";
+      $text = "Some TOF channels seem to have too high rates.";
+      }
+      
+    QA::WriteQALog($fqa,"feeerr","tof", 60, $qastate, "TOF Thresh", $shorttext, $text);
+    }   
+   
+   
   $old = $o;
   $oldtime = time();
   sleep 2;
index 3accfd86c28e8b53959bba72e3e9e2ba43e65040..24405d5b2445bfe22c16eb68c3d86e059eaaa2a1 100755 (executable)
@@ -219,52 +219,52 @@ my $longmsgcheck = $longmsg;
   QA::WriteQALog($fqa, "trg", "source", 10, $qastate, "Trigger Source", $msg, $longmsg);
   QA::WriteQALog($fqa, "trg", "accepted", 10, $qastateacc, "Accept. PT3", $accmsg, $acclmsg);
 
-  my $qastatept = QA::OK;
-  my $ptoverStattart = $rStat->{3}->[0x24]/($rStat->{3}->[0x2c] || 1)*100;
-  if ($ptoverStattart > 100) {$ptoverStattart = 100;}
-######################################
-## QA check for PT3/Start rate
-  if ($ptoverStattart > 100 || $ptoverStattart < 0) {
-    $qastatept = QA::WARN;
-    }
-######################################  
-  my $ptmsg = "";
-  $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("PT1 counts per second: %i - PT1 / Start: %1.2f%%", $rStat->{3}->[0x24], $ptoverStattart);
+  my $qastatept = QA::OK;
+  my $ptoverStattart = $rStat->{3}->[0x24]/($rStat->{3}->[0x2c] || 1)*100;
+  if ($ptoverStattart > 100) {$ptoverStattart = 100;}
+# ######################################
+# ## QA check for PT3/Start rate
+  if ($ptoverStattart > 100 || $ptoverStattart < 0) {
+    $qastatept = QA::WARN;
+    }
+# ######################################  
+  my $ptmsg = "";
+  $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("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;
-  my $qastatstart = QA::OK;
-  my $startmsg = "";
-  my $startlongmsg = "";
-  
-  foreach my $i (0..7) {
-    $startsum += $rStat->{3}->[$i+0x8] ;
-    }
-  $spillsum += $startsum;
-  
-#   $startsum  = $rStat->{3}->[0x29];
+#   my $startsum = 0;
+#   my $qastatstart = QA::OK;
+#   my $startmsg = "";
+#   my $startlongmsg = "";
+#   
+#   foreach my $i (0..7) {
+#     $startsum += $rStat->{3}->[$i+0x8] ;
+#     }
 #   $spillsum += $startsum;
-  
-######################################
-## QA check for spill sum on Start
-  if ($lastspillsum < 0 || $lastspillsum > 20E8) {
-    $qastatstart = QA::WARN;
-    }
-######################################  
-  if($outofspill && !$lastoutofspill ) {
-    $lastspillsum = $spillsum;
-    HPlot::PlotAdd("StartCountSpills",$spillsum/1E6);
-    HPlot::PlotDraw("StartCountSpills");
-    $spillsum = 0;
-    }
-  $startmsg = sprintf("%s / %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
-  $startlongmsg = sprintf("counts per second %s/s  - counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
- QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Start Count", $startmsg, $startlongmsg);
-   
-  
+#   
+# #   $startsum  = $rStat->{3}->[0x29];
+# #   $spillsum += $startsum;
+#   
+# ######################################
+# ## QA check for spill sum on Start
+#   if ($lastspillsum < 0 || $lastspillsum > 20E8) {
+#     $qastatstart = QA::WARN;
+#     }
+# ######################################  
+#   if($outofspill && !$lastoutofspill ) {
+#     $lastspillsum = $spillsum;
+#     HPlot::PlotAdd("StartCountSpills",$spillsum/1E6);
+#     HPlot::PlotDraw("StartCountSpills");
+#     $spillsum = 0;
+#     }
+#   $startmsg = sprintf("%s / %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
+#   $startlongmsg = sprintf("counts per second %s/s  - counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
+#  QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Start Count", $startmsg, $startlongmsg);
+#    
+#   
   
   
   if ($lastlongmsg ne $longmsgcheck && $longmsg ne "") {
index 2e74321857f54adef7c2c5d7bb6ed159aa538da3..134869f0b701d3cf00440aecf75e67ffd04d8164 100755 (executable)
@@ -13,7 +13,8 @@ use List::Util qw[min max sum];
 
 my $STARTRATELIMIT = 50000;
 my $UPPERLIMIT = 0.03;
-my $oldtb;
+my $UPPERLIMIT_PT3 = 0.004;
+my $oldtb; my $oldst;
 my $diff;
 my $iter = 0;
 my $vdiff;
@@ -38,6 +39,26 @@ HPlot::PlotInit({
     storable => 1,
     });   
 
+HPlot::PlotInit({
+    name    => "Pt3StartRatio",
+    file    => "files/Pt3StartRatio",
+    entries => 1000,
+    type    => HPlot::TYPE_HISTORY,
+    output  => HPlot::OUT_PNG,
+    xlabel  => "Time",
+    ylabel  => "Ratio",
+    sizex   => 950,
+    sizey   => 330,
+    ymin    => -0.001,
+    ymax    => "$UPPERLIMIT_PT3"."1",
+    xscale  => 5,
+    curves  => 2,
+    buffer  => 1,
+    nokey   => 1,
+    dots    => 1,
+    storable => 1,
+    });       
+    
 HPlot::PlotInit({
     name    => "M2Rate",
     file    => "files/M2Rate",
@@ -57,23 +78,56 @@ HPlot::PlotInit({
 #     dots    => 1,
     storable => 1,
     });       
+
     
-my $str  = Hmon::MakeTitle(12, 7, "M2 / Start Ratio",0);
+HPlot::PlotInit({
+    name     => "StartCountSpills",
+    file     => "files/StartCountSpills",
+    entries  => 100,
+    type     => HPlot::TYPE_HISTORY,
+    output   => HPlot::OUT_PNG,
+    xlabel   => "Spill Number",
+    ylabel   => "Start Counts per Spill [Mcnt]",
+    sizex    => 630,
+    sizey    => 220,
+    nokey    => 1,
+    buffer   => 1,
+    storable => 1,
+    });
+
+my $str = Hmon::MakeTitle(8,5,"Start X Counts per Spill (millions)",0);
+   $str .= qq@<img src="%ADDPNG files/StartCountSpills.png%" type="image/png">@;
+   $str .= Hmon::MakeFooter();
+   Hmon::WriteFile("StartCountSpill",$str);
+    
+    
+   $str  = Hmon::MakeTitle(12, 7, "M2 / Start Ratio",0);
    $str .= qq@<img src="%ADDPNG files/M2StartRatio.png%" type="image/png"><br>\n@;
    $str .= Hmon::MakeFooter();
    Hmon::WriteFile("M2StartRatio",$str);
-    
+
+   $str  = Hmon::MakeTitle(12, 7, "PT3 / Start Ratio",0);
+   $str .= qq@<img src="%ADDPNG files/Pt3StartRatio.png%" type="image/png"><br>\n@;
+   $str .= Hmon::MakeFooter();
+   Hmon::WriteFile("Pt3StartRatio",$str);   
+   
    $str  = Hmon::MakeTitle(12, 7, "M2 Rate",0);
    $str .= qq@<img src="%ADDPNG files/M2Rate.png%" type="image/png"><br>\n@;
    $str .= Hmon::MakeFooter();
    Hmon::WriteFile("M2Rate",$str);        
     
 trb_init_ports() or die trb_strerror();
+my $fqa = QA::OpenQAFile();
+
 
+my $spillsumstart = 0;
+my $lastinspill = 0;
+my $lastspillsumstart = 0;
 
 while (1) {
   my $tb = trb_registertime_read_mem(0x10,0x9000,0,224);
-
+  my $st = trb_registertime_read_mem(0xfe76,0xdfc0,0,24);
+  
   my $inspill = $tb->{0x10}{value}[0x5d] >> 31;
 
   if (defined $oldtb) {
@@ -82,16 +136,30 @@ while (1) {
       $tdiff += 2**16 if ($tdiff <= 0);
       $tdiff = ($tdiff * 16 / 1E6) || 1;
       for my $v (0..223) {
-        $vdiff = ($tb->{$b}{value}[$v]&0xffffff) - ($oldtb->{$b}{value}[$v]&0xffffff);
+        $vdiff = (($tb->{$b}{value}[$v]||0)&0xffffff) - (($oldtb->{$b}{value}[$v]||0)&0xffffff);
         $vdiff += 2**24 if ($vdiff < 0);
         $diff->{$b}->[$v] = $vdiff/$tdiff;
         }
       }
+    foreach my $b (keys %$st) {
+      next if ($b < 0x5000 || $b > 0x5003);
+      my $tdiff = $st->{$b}{time}[0] - ($oldst->{$b}{time}[0]||0);
+      $tdiff += 2**16 if ($tdiff <= 0);
+      $tdiff = ($tdiff * 16 / 1E6) || 1;
+      for my $v (0..23) {
+        $vdiff = (($st->{$b}{value}[$v]||0)&0xffffff) - (($oldst->{$b}{value}[$v]||0)&0xffffff);
+        $vdiff += 2**24 if ($vdiff < 0);
+        $diff->{$b}->[$v] = $vdiff/$tdiff;
+        }
+      } 
   
+    my $startdirect = sum(@{$diff->{0x5000}},@{$diff->{0x5001}},@{$diff->{0x5002}},@{$diff->{0x5003}});
     my $start = sum(@{$diff->{0x10}}[56..63]) + sum(@{$diff->{0x10}}[72..79]); #sum from start
     my $m2    = $diff->{0x10}[0x50];
-
+    my $pt3   = $diff->{0x10}[218];  
+    
+#     print $startdirect." ".$start."\n";
+###Ratio M2 over Start
     my $ratio = $m2/($start||1);
     if  ($start <= $STARTRATELIMIT || !$inspill) {
       HPlot::PlotAdd("M2StartRatio",0,1);
@@ -101,35 +169,76 @@ while (1) {
       HPlot::PlotAdd("M2StartRatio",$UPPERLIMIT,1);
       HPlot::PlotAdd("M2StartRatio","NaN",0)
       }
-    
     else {
       HPlot::PlotAdd("M2StartRatio","NaN",1);
       HPlot::PlotAdd("M2StartRatio",$ratio,0)
       }
-
       
+      
+###Ratio PT3 over Start
+    $ratio = $pt3/($start||1);
+    if  ($start <= $STARTRATELIMIT || !$inspill) {
+      HPlot::PlotAdd("Pt3StartRatio",0,1);
+      HPlot::PlotAdd("Pt3StartRatio","NaN",0)
+      }
+    elsif     ($ratio >= $UPPERLIMIT_PT3) {
+      HPlot::PlotAdd("Pt3StartRatio",$UPPERLIMIT_PT3,1);
+      HPlot::PlotAdd("Pt3StartRatio","NaN",0)
+      }
+    else {
+      HPlot::PlotAdd("Pt3StartRatio","NaN",1);
+      HPlot::PlotAdd("Pt3StartRatio",$ratio,0)
+      }     
+      
+###M2 Rate
     if  (!$inspill) {
       HPlot::PlotAdd("M2Rate",0,1);
       HPlot::PlotAdd("M2Rate","NaN",0)
       }
-#     elsif     ($ratio >= $UPPERLIMIT) {
-#       HPlot::PlotAdd("M2StartRatio",$UPPERLIMIT,1);
-#       HPlot::PlotAdd("M2StartRatio","NaN",0)
-#       }
     else {
       HPlot::PlotAdd("M2Rate","NaN",1);
       HPlot::PlotAdd("M2Rate",$m2,0)
       }
       
       
-    if($iter++ == 5){
+    if($iter == 4){
       HPlot::PlotDrawFork("M2StartRatio");
+      HPlot::PlotDrawFork("Pt3StartRatio");
       HPlot::PlotDrawFork("M2Rate");
-      $iter = 0;
       }
+      
+###Spill Sum from Start      
+    if(!$inspill && $lastinspill) {
+      $lastspillsumstart = $spillsumstart / 5;    #DIVIDED BY 200ms period!
+      $spillsumstart = 0;
+      HPlot::PlotAdd("StartCountSpills",$lastspillsumstart/1E6);
+      HPlot::PlotDrawFork("StartCountSpills");
+      }
+    if($inspill) {
+      $spillsumstart += $start;
+      }
+    
+    if($iter==5) {
+      my $qastatstart = QA::OK;
+      my $startmsg = "";
+      my $startlongmsg = "";       
+      if ($lastspillsumstart < 10000 || $lastspillsumstart > 20E8) {
+        $qastatstart = QA::WARN;
+        }      
+      $startmsg = sprintf("%s / %s",QA::SciNotation($start),QA::SciNotation($lastspillsumstart));
+      $startlongmsg = sprintf("counts per second %s/s  - counts per spill %s",QA::SciNotation($start),QA::SciNotation($lastspillsumstart));
+      QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Start Count", $startmsg, $startlongmsg);
+      }
+      
+      
     }
     
   $oldtb = $tb;
+  $oldst = $st;
+  $lastinspill = $inspill;
+  $iter++;
+  $iter = 0 if $iter == 6;
+  print time()."\n";
   usleep(200000);
   }
 
index 4169801ddaafbe7643c3f318dde22bee53316a68..c1f0d79d1ea530b4aeb4b23a7ede3a5d3e4f328c 100755 (executable)
@@ -34,7 +34,7 @@ function openwin(url) {
 <li><a href="../daqtools/index.pl" target="_blank">Web Tools (daqtools)</a></li>
 <li><a href="../eb/?browser=fix" target="_blank">Eventbuilder Monitor</a></li>
 <li><a href="../rawmon/" target="_blank">Raw Data Monitor</a></li>
-<li class="outdated"><a href="/mon/files/runstatscompare.png" target="_blank">Accumulated Run Statistics</a>
+<li><a href="http://web-docs.gsi.de/~webhades/media/logbook/feb22/hades-online.html" target="_blank">Accumulated Run Statistics</a>
 </ul></div>
 
 <div class="linkbox" style="float:right"><h4>Documents</h4><ul>
diff --git a/hmon/permanent/hmon_logbook.pl b/hmon/permanent/hmon_logbook.pl
new file mode 100755 (executable)
index 0000000..8d0c9a9
--- /dev/null
@@ -0,0 +1,80 @@
+#!/usr/bin/perl
+
+use warnings;
+binmode(STDOUT, ":utf8");
+binmode(STDIN, ":utf8");
+use open qw( :encoding(UTF-8) :std );
+use LWP;
+use IPC::Run3;
+use Data::Dumper;
+use Encode qw(encode from_to);
+use JSON;
+
+
+my $firstrun =1;
+my $command = "curl 'https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.show' -X POST -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' -H 'Accept-Language: de,en-US;q=0.7,en;q=0.3' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: https://hades-db.gsi.de' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Referer: https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hlogbook2.form_selection' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-User: ?1' --data-raw 'p_exp_id=FEB22&p_begin=&p_end=&p_num_days=&p_num_entries=8&p_author=&p_action=Show&p_log_type=All&p_run_type=None&p_current=&p_filename=*&p_search_text=*'  -u hades:6\\\$ectors  2>/dev/null";
+
+my $store;
+my $hash;
+$hash->{username}='daqi';
+
+while(1) {
+  my @res = qx($command);  #webserver uses iso-8859-1 -(
+
+# print Dumper @res;
+# exit;
+  my ($date,$topic,$user,$text);
+
+  my $cnt = 0;
+  my $found = 0;
+
+  foreach my $line (@res) {
+    if ($line =~ /^\s*<tr>\s*$/) {$cnt = 0;$found=1;};
+    if ($line =~ /^<td>/  && $cnt == 2) { $date = stripped($line); $found++;}
+    if ($line =~ /^<td /  && $cnt == 4) { $topic = stripped($line);$found++;}
+    if ($line =~ /^<td /  && $cnt == 5) { $user = stripped($line); $found++;}
+    if ($line =~ /^<td /  && $cnt == 6) { $text = stripped($line); $found++;}
+    
+    if($found == 5 && $cnt == 6 && !$store->{$date}==1) {
+      
+      $store->{$date} = 1;
+      
+      if (!$firstrun) {
+        my $cmd = "pandoc --from html --to markdown_strict";    
+        run3($cmd, \$text, \@ret);
+        
+        my $string = "[$topic] **$user** ($date)\n";
+          $string .= join('',@ret);
+        print $string;  
+
+        $hash->{text} = $string;
+        $string = encode_json($hash);
+        
+        my $ua  = LWP::UserAgent->new();
+        my $req = new HTTP::Request( 
+            'POST' => "https://coop.gsi.de/mm/hooks/85pmt5r7ypf9ibujt8keyjf3xh", 
+            ['Content-Type' => 'application/json'],
+            $string
+            );
+        print Dumper $ua->request($req);
+        
+#         exit;
+        }
+      }
+    $found = 0 if $found == 5;
+    $cnt++;  
+    }
+  $firstrun=0;
+  sleep 60;
+  }
+  
+sub stripped {
+  my $str = $_[0];
+  $str =~ s!^<td>!!;
+  $str =~ s!^<td class="l">!!;
+  $str =~ s!</td>$!!;
+  $str =~ s!<br/>$!!;
+  chomp $str;
+  return $str;
+  }
+  
index 4019a2c42b16a4b54d67c33eabf30c996e63e230..932e0062787a723429e5616ada6df1f4bf8c0e29 100755 (executable)
@@ -207,14 +207,14 @@ while(1) {
       my $ch_qastate   = QA::OK;
       my $chamberHVmin = min($data->{"$p-$s-0-V"}->{val},$data->{"$p-$s-1-V"}->{val});
       
-      if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][0]) {$qastate = max($qastate,QA::WARN);}
-      if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][1]) {$qastate = max($qastate,QA::WARN_2);}
-      if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][2]) {$qastate = max($qastate,QA::ERROR);}
+      if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][0]) {$qastate = QA::WARN;}
+      if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][1]) {$qastate = QA::WARN_2;}
+      if($chamberHVmin < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits->[$p-1][2]) {$qastate = QA::ERROR;}
       
       if ($ch_qastate >= QA::WARN_2) {
         $errortimer[$chamnum]++;
         $ch_qastate = QA::ERROR  if $errortimer[$chamnum] > 220 ;
-        $ch_qastate = QA::WARN_2 if $errortimer[$chamnum] <= 220 ;
+        $ch_qastate = QA::WARN   if $errortimer[$chamnum] <= 220 ;
         $chamberswitherror++     if $errortimer[$chamnum] > 10 ;
         }
       else {
index 977d5a5178345c70627279e4a80b0d36fe01235a..f72e86cb83d918880bd3e5a9e5adbad0e31ce043 100755 (executable)
@@ -15,7 +15,7 @@ use HPlot;
 
 my $flog = QA::OpenQAFile();
 
-my @lim = (2.96,2.96,2.7,2.6);
+my @lim = (2.96,2.96,2.96,2.96);
 
 while(1) {
 
index f66dc717562e7d67aa97d8431261e5f3325c1764..9867dc8f86c78dc0f29b2e348a4c406a9d0cab43 100755 (executable)
@@ -29,11 +29,11 @@ while(1) {
 
   $out .= "<table>";
 
-  my $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/target_*.jpg | tail -n 5";
+  my $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/target_*.gif | tail -n 5";
   my @files = qx($cmd);
   @files = reverse @files;
 
-  $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/targetSum*.jpg | tail -n 5";
+  $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/targetSum*.gif | tail -n 5";
   my @files2 = qx($cmd);
   @files2 = reverse @files2;