]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
update hmon scripts
authorhadaq <jan@lxhadeb07>
Thu, 29 Feb 2024 19:55:55 +0000 (20:55 +0100)
committerhadaq <jan@lxhadeb07>
Thu, 29 Feb 2024 19:55:55 +0000 (20:55 +0100)
19 files changed:
hmon/doc/endp-rich.htt
hmon/doc/server-ip.htt
hmon/hmon_adcvolt.pl
hmon/hmon_ecal_recover_dead_slow_channels.pl
hmon/hmon_ecalresetthresholds.pl
hmon/hmon_endpoints.pl
hmon/hmon_fwrate.pl
hmon/hmon_ipcheck.pl
hmon/hmon_rpctof_sectorwise_highres.pl
hmon/hmon_startrate.pl
hmon/hmon_veto.pl [new file with mode: 0755]
hmon/index.cgi
hmon/permanent/hmon_expertsoncall.pl
hmon/permanent/hmon_magnet.pl
hmon/permanent/hmon_mdchv.pl
hmon/permanent/hmon_mdcpressure.pl
hmon/permanent/hmon_richIsobutan.pl
hmon/permanent/hmon_rpchv.pl
hmon/permanent/hmon_spillmon.pl

index e09d42cef8eb2151f38f96825905753247d5ab18..7f1431eb794ac6112884d85a3274d0f6fe216c7f 100644 (file)
@@ -6,7 +6,6 @@ modules are missing.
 
 <h4>Error Handling</h4>
 <ul>
-<li>Try a Resync DiRich
 <li>Do a DAQ restart 
 <li>Do another DAQ restart 
 <li>If this doesn't help, use "Reboot -&gt; Rich" and a DAQ restart
index dc951fb472380f2f28ff245d034b8a9ead2c1e64..71554638583069e58d317267836a6f501809a6ce 100644 (file)
@@ -6,7 +6,12 @@ If a link is not working, data from this subsystem will not reach the Eventbuild
 preventing them from writing files.
 
 <h4>Error Handling</h4>
-Do a "fix missing IP" followed by a DAQ restart<br>
-If this doesn't help and some endpoints are missing (with an address in the 0x8000 range), a power cycle of that system might be needed.
+<ul><li>Check if the event builders work (Delta-Rate, EB Inputs, Data Rate). If they are fine, ignore this error.
+<ul><li>If you plan to do a reload of the corresponding system: The button in the GUI will not work, do a power cycle instead.
+<li>The error message will be gone after a reload of the problematic system, which might be done using trbcmd.
+</ul>
 
+<li>Do a "fix missing IP" followed by a DAQ restart<br>
+<li>If this doesn't help and some endpoints are missing (with an address in the 0x8000 range), a power cycle of that system might be needed.
+</ul>
 
index f5095a35fe2c410e5df44f666e06acd4af2ff6ad..def467206b5ef1201d60511b1a3a8e6c9a0c68d8 100755 (executable)
@@ -33,11 +33,9 @@ my $channel = [7,7,7,6,6]; #SPI interface number
 
 #1:4V, 2:2V, 3:1V
 my $resolution = [[2,1,2,1],  [2,2,2,1],  [2,2,2,4],      [2,2,2,2],       [2,3,2,2]];
-my $multiplier=  [[1,1,0.5,2],[1,1,0.5,0],[1,1,0.5,3.125],[1,1,0.5,0.5],   [5,1.25,1,0.5]];
+my $multiplier=  [[1,1,0.5,2],[1,1,0.5,0],[1,1,0.5,3.125],[1,1,0.5,0.5],   [6.0625,1.625,1.075,0.5375]];#Apparently the current is measured incorrectly 1V1*1.21, 1V2*1.3, 2V5*1.075, 3V3*1.075
 my $modedesc =   [ 'Trb3sc',  'DiRich',   'Concentrator', 'Power-Voltages','Power-Currents'];
 
-my $fudgefactor = 0.78; #Apparently the current is measured incorrectly. This fudge-factor should approximately fix that
-
 HPlot::PlotInit({
   name    => "DiRichVolt",
   file    => 'files/DiRichVolt',
@@ -182,7 +180,6 @@ sub measure {
     if($i) {
       foreach my $t (keys %$s) {
         $return->[$i-1]{$t} = ($s->{$t}>>19&0xfff)*$multiplier->[$mode][$i-1];
-        $return->[$i-1]{$t} *= $fudgefactor if $mode == 4;
         }
       }
     usleep(5000);
index 39a8866b3fe93f589bd50d304da4c9d9103db159..d55e0d8acac3a3e0362a1e00424683009f199c03 100755 (executable)
@@ -5,9 +5,18 @@ use HADES::TrbNet;
 use Time::HiRes qw(usleep);
 use Data::Dumper;
 
+use Log::Log4perl qw(get_logger);
+
+
 use lib "/home/hadaq/trbsoft/daqtools/dmon/code";
 use Dmon;
 
+my $HADESDAQ="/home/hadaq/trbsoft/hadesdaq/";
+Log::Log4perl::init($HADESDAQ . "hmon/ecal_recover_dead_slow_channels_logger.conf");
+
+my $logger = get_logger("automatic_restart");
+$logger->info("startup");
+
 my $dirich = 0xfe71;
 my $std_thresh = 0x6800;
 
@@ -75,12 +84,16 @@ while (1) {
   my $rh_affected = {};
   my $rh_final_list = {};
   my $rh_diffs = {};
+  my $rh_list_with_reasons = {};
+
   for my $channel (0 .. $last_channel) {
     foreach my $cur_ep (keys %{$res[0]}) {
       my $rate = $res[0]->{$cur_ep}->[$channel] - $res[1]->{$cur_ep}->[$channel];
       $rh_diffs->{$cur_ep}->[$channel] = $rate;
       if ($rate > 1E6 and $rate < 2E9) {
         printf STDERR "rate > 1MHz. Endpoint: %04x, channel: %d => rate: %d\n", $cur_ep, $channel, $rate;
+        $rh_list_with_reasons->{$cur_ep}->[$channel] = "1MHz";
+        $rh_affected->{$cur_ep}->[$channel] = 1;
       }
     }
   }
@@ -134,6 +147,10 @@ while (1) {
       if (!defined $value or $value == 0) {
         next;
       }
+
+      if (!defined $rh_list_with_reasons->{$cur_ep}->[$channel]) {
+        $rh_list_with_reasons->{$cur_ep}->[$channel] = "dead";
+      }
       $rh_final_list->{$cur_ep}->{$channel} = 1;
       $final_counter++;
     }
@@ -143,14 +160,36 @@ while (1) {
   print STDERR "\n$now_string\n";
   if ($final_counter>0) {
     print STDERR "final list of channels to set high slow threshold and then back to original thereshold stored in padiwa\n";
+    my $log_string;
+    my $log_string_mhz;
+    my $log_string_dead;
     foreach my $cur_ep (keys %$rh_final_list) {
       printf STDERR "Endpoint: 0x%04x => channels: ", $cur_ep;
+      $log_string_dead = "";
+      $log_string_mhz  = "";
+      #$log_string =     sprintf("Reset the following channels: Endpoint: 0x%04x => channels: ", $cur_ep);
+      #$log_string_mhz = sprintf("Channels with >1MHz rate    : Endpoint: 0x%04x => channels: ", $cur_ep);
       foreach my $channel (keys %{$rh_final_list->{$cur_ep}}) {
         print STDERR "$channel, ";
+
+        if ($rh_list_with_reasons->{$cur_ep}->[$channel] eq "1MHz") {
+          $log_string_mhz .= "$channel ";
+        }
+        elsif ($rh_list_with_reasons->{$cur_ep}->[$channel] eq "dead") {
+          $log_string_dead .= "$channel ";
+        }
+      }
+      #print STDERR "\n";
+      $log_string = sprintf("Endpoint: 0x%04x: dead channels: $log_string_dead", $cur_ep);
+        if ($log_string_mhz) {
+          $log_string .= "  oscillating channels: $log_string_mhz";
       }
-      print STDERR "\n";
+
+      $logger->info($log_string);
+      #$logger->info($log_string_mhz);
     }
 
+
     #print STDERR Dumper $rh_final_list;
     print STDERR "number of thresholds to be written: $final_counter\n";
   }
@@ -159,7 +198,6 @@ while (1) {
   }
 
 
-
   if (1) { # really recover channels
     foreach my $cur_ep (keys %$rh_final_list) {
       foreach my $channel (keys %{$rh_final_list->{$cur_ep}}) {
index 824cda13bc8e9f4cb8a8b6aed2f03e18102c8bf2..0cfa3078be2467df81d516f0d392517ebb7340aa 100644 (file)
@@ -7,23 +7,24 @@ use Hmon;
 use QA;
 use HADES::TrbNet;
 use POSIX qw(strftime);
+use Time::HiRes 'usleep';
 my $fh;
 
 #set thresholds after every other spill  
 trb_init_ports() or die trb_strerror();
 my $inspill;
 while (1) {
-  do{{
-    sleep(1);
+  do {
+    usleep(100*1000);
     my $o = trb_register_read(0x10,0x905d);
     $inspill = $o->{0x10} >> 31;
-    print ".\n";
-  }}while($inspill);
+    print ".\n";
+  } while($inspill);
 
-  system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds.pl");
+  #system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds_high.pl");
 
-  system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds_sec2_sec4.pl");
+  system ("/home/hadaq/trbsoft/daq/ecal/ecal_set_thresholds.pl");
 
 
-  sleep(15);
+  sleep(10);
   }
index 0be8c3f16245e7f090140cbfb09ec2aae3d10ba9..e68f411e8aa1e08dfef47258e07225660b7cf4bb 100755 (executable)
@@ -297,7 +297,7 @@ while(1) {
        $qastate = max($qastate,QA::WARN)   if $mdcmissingtime > 600;
        $qastate = max($qastate,QA::NOTE)   if $num_mdc_missing >= 1;
        
-       $longtext .= "<br>Few boards missing, but for a long time. Better do a restart." if $mdcmissingtime > 360;
+       $longtext .= "<br>Some boards are missing for a long time. Better do a restart." if $mdcmissingtime > 360;
        
     Hmon::Speak('mdcmissonce',"$num_mdc_missing M-D-C Frontends missing") if($qastate > 60 && $qastate < QA::ERROR );
     Hmon::Speak('mdcmiss',"$num_mdc_missing M-D-C Frontends missing") if($qastate >= QA::ERROR );
index c09b7ac3ca6e0d8c43f2c2779c7d2274ad8497ff..2c19d7691eabdc6eaef38ac34490bac3abba01ae 100755 (executable)
@@ -22,9 +22,9 @@ my @x = (0,16,17,18,19,20,21,22,23,24,25,26,27,16,17,18,19,20,21,22,23,24,25,26,
 my @y = (0,
 16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,12,12,12,12,12,12,12,12,12,12,14,14,14,14,14,14,14,14,14,14,16,16,16,16,18,18,18,18,20,20,20,20,22,22,22,22,24,24,24,24,26,26,26,26,28,28,28,28,28,28,28,28,28,28,30,30,30,30,30,30,30,30,30,30,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,8,8,8,8,8,8,8,8,8,8,8,12,12,12,12,12,12,16,16,16,16,16,16,20,20,20,20,20,20,24,24,24,24,24,24,28,28,28,28,28,28,32,32,32,32,32,32,32,32,32,32,32,36,36,36,36,36,36,36,36,36,36,36,40,40,40,40,40,40,40,40,40);
 
-my @bo = (0,0x6700  ,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6723,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6700,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6720,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6701,0x6702,0,0,0x6702,0x6720,0x6702,0x6720,0x6723,0x6723,0x6723,0x6702,0x6702,0x6702,0,0,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6702,0x6703,0x6703,0x6703,0x6703,0x6722,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6703,0x6723,0x6723,0x6723,0x6723,0x6703,0x6703,0x6703,0x6710,0x6710,0x6710,0x6710,0x6710,0x6723,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6710,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6711,0x6712,0x6712,0x6712,0x6712,0x6723,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0,0,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0,0,0,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0x6712,0,0x6712,0x6712,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6713,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0x6720,0,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0,0,0,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0x6722,0,0);
+my @bo = (0,0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6723, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6723, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6700, 0x6723, 0x6700, 0x6700, 0x6700, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6723, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6720, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6701, 0x6702, 0x0000, 0x0000, 0x6702, 0x6720, 0x6702, 0x6723, 0x6723, 0x6723, 0x6723, 0x6702, 0x6702, 0x6702, 0x0000, 0x0000, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6702, 0x6703, 0x6703, 0x6703, 0x6703, 0x6722, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6703, 0x6723, 0x6723, 0x6723, 0x6723, 0x6703, 0x6703, 0x6703, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6723, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6710, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6711, 0x6712, 0x6712, 0x6712, 0x6712, 0x6723, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x0000, 0x0000, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x0000, 0x0000, 0x0000, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x6712, 0x0000, 0x6712, 0x6712, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6713, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x6720, 0x0000, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x0000, 0x0000, 0x0000, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x6722, 0x0000, 0x0000);
 
-my @ch = (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,30,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,24,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,1,0,0,2,31,4,30,13,14,15,9,10,11,0,0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,16, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,9,10,11,12,30,31,32,1,2,3,4,5,31,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,32,6,7,8,9,10,11,12,13,14,0,0,15,16,17,18,19,20,21,0,0,0,22,23,24,25,26,27,28,29,30,0,31,32,1,2,3,4,5,6,8,10,11,13,14,15,17,18,19,20,21,22,17,18,19,20,21,22,23,24,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,32,0,1,2,3,4,5,6,7,8,9,0,0,0,10,11,12,13,14,15,32,0,0);
+my @ch = (0,2,3,4,5,6,7,8,9,10,26,12,13,14,15,16,17,18,19,20,30,22,23,24,25,26,27,28,28,30,31,32,1,2,3,4,5,6,27,8,9,10,11,12,13,14,15,16,24,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,1,0,0,2,31,4,29,13,14,15,9,10,11,0,0,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,16,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,9,10,11,12,30,31,32,1,2,3,4,5,31,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,32,1,2,3,4,32,6,7,8,9,10,11,12,13,14,0,0,15,16,17,18,19,20,21,0,0,0,22,23,24,25,26,27,28,29,30,0,31,32,1,2,3,4,5,6,8,10,11,13,14,15,17,18,19,20,21,22,17,18,19,20,21,22,23,24,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,32,0,1,2,3,4,5,6,7,8,9,0,0,0,10,11,12,13,14,15,32,0,0);
 
 HPlot::PlotInit({
     name    => "FwRate",
index 460625bbdbe28b82c76219a5f027ed75c59099bc..c186fd3caf33c77c8dc5f6a00e917e2f25a7a158 100755 (executable)
@@ -22,13 +22,41 @@ use Try::Tiny;
 # trb_init_ports() or die trb_strerror();
 my $fqa = QA::OpenQAFile();
 
-
-my @hubnames = (
-'trb3sc317', 'trb3sc319', 'trb3sc320', 'trb3sc315', 'trb3sc318', 'trb3sc316',  #ECal
-'trb3sc134', 'trb3sc009', 'trb3sc130', 'trb3sc128', 'trb3sc131', 'trb3sc129',  #RPC
-'trb3sc438',   #Start
-'trb3sc136', 'trb3sc158', 'trb3sc144', 'trb3sc139', 'trb3sc163', 'trb3sc153', 'trb3sc164', 'trb3sc166', 'trb3sc137', 'trb3sc138', 'trb3sc162', 'trb3sc141',  #RICH
-'trbp088', 'trbp263', 'trbp006', 'trbp262', 'trbp265', 'trbp242', 'trbp074', 'trbp267', 'trbp266',  #TOF, FW
+my %hubnames = (
+  'trb3sc317' => 'ECal',
+  'trb3sc319' => 'ECal',
+  'trb3sc320' => 'ECal',
+  'trb3sc315' => 'ECal',
+  'trb3sc318' => 'ECal',
+  'trb3sc316' => 'ECal',
+  'trb3sc134' => 'RPC',
+  'trb3sc009' => 'RPC',
+  'trb3sc130' => 'RPC',
+  'trb3sc128' => 'RPC',
+  'trb3sc131' => 'RPC',
+  'trb3sc129' => 'RPC',
+  'trb3sc438' => 'Start',
+  'trb3sc136' => 'RICH',
+  'trb3sc158' => 'RICH',
+  'trb3sc144' => 'RICH',
+  'trb3sc139' => 'RICH',
+  'trb3sc163' => 'RICH',
+  'trb3sc153' => 'RICH',
+  'trb3sc164' => 'RICH',
+  'trb3sc166' => 'RICH',
+  'trb3sc137' => 'RICH',
+  'trb3sc138' => 'RICH',
+  'trb3sc162' => 'RICH',
+  'trb3sc141' => 'RICH',
+  'trbp088'   => 'TOF',
+  'trbp263'   => 'TOF',
+  'trbp006'   => 'TOF',
+  'trbp262'   => 'TOF',
+  'trbp265'   => 'TOF',
+  'trbp242'   => 'TOF',
+  'trbp074'   => 'FW',
+  'trbp267'   => 'FW',
+  'trbp266'   => 'FW',
 );
 
 while(1) {
@@ -38,7 +66,7 @@ while(1) {
   my $longstatus = 0;
   my $qastate = QA::OK;
 
-  for my $b (@hubnames) {
+  while(my($b, $det) = each %hubnames) {
     $counter++;
 #     print $b."\n";
     my $cmd = "ping $b -c 1 -w 1  >/dev/null 2>&1";
@@ -52,7 +80,7 @@ while(1) {
       }
     if($err) {
       $errorcnt++;
-      $longstatus .= "Hub $b not reached<br>";
+      $longstatus .= "Hub $b ($det) not reached<br>";
 #       print $longstatus."\n";
       $qastate = QA::ERROR;
       }      
index 7587a66d20bb74db650b215a45129ce601b20995..033b495100920bc50294905b29eb0393b7b5f063 100755 (executable)
@@ -27,7 +27,7 @@ HPlot::PlotInit({
   xmax    => 2000,  
 #   nokey   => 1,
   buffer  => 1,
-  storable=> 1
+  storable=> 1
   }
   );  
   
index bffc34a135295242782d84dd9857b0eb8ef12711..afa08569f20ed6c8c305cd88c6b4990626bbcf87 100755 (executable)
@@ -82,8 +82,8 @@ my $plot5 = {
     stacked => 1,
     curvewidth  => .9,
     additional => "
-  set obj 1 rect from   -1, 5E6 to  400, 10E6 fc rgb '#ffffbb' behind \n
-  set obj 2 rect from   -1, 1E7 to  400, 10E7 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,8 +142,8 @@ my $plot7 = {
     stacked => 1,
     curvewidth  => .9,
     additional => "
-  set obj 1 rect from   -1, 5E6 to  400, 10E6 fc rgb '#ffffbb' behind \n
-  set obj 2 rect from   -1, 1E7 to  400, 10E7 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);
@@ -170,8 +170,8 @@ my $plot7a = {
     curvewidth  => .9,
     key => 0,
     additional => "
-  set obj 1 rect from   -1, 5E6 to  400, 10E6 fc rgb '#ffffbb' behind \n
-  set obj 2 rect from   -1, 1E7 to  400, 10E7 fc rgb '#ffdddd' behind
+  set obj 1 rect from   -1, 7E7 to  400, 10E7 fc rgb '#ffffbb' behind \n
+  set obj 2 rect from   -1, 10E7 to  400, 100E7 fc rgb '#ffdddd' behind
     "
     };
 HPlot::PlotInit($plot7a);
@@ -199,8 +199,8 @@ my $plot7b = {
     curvewidth  => .9,
     key => 0,
     additional => "
-  set obj 1 rect from   -1, 5E6 to  400, 10E6 fc rgb '#ffffbb' behind \n
-  set obj 2 rect from   -1, 1E7 to  400, 10E7 fc rgb '#ffdddd' behind
+  set obj 1 rect from   -1, 7E7 to  400, 10E7 fc rgb '#ffffbb' behind \n
+  set obj 2 rect from   -1, 10E7 to  400, 100E7 fc rgb '#ffdddd' behind
     "
     };
 HPlot::PlotInit($plot7b);
@@ -576,49 +576,49 @@ HPlot::PlotDrawFork('StartDutyFactorY_0');
 
 
 my $channels_x_1 = [
-                  { pch =>   1,  tdc => 2, ch => 0},                  # Int(ch/2) because we read from monitoring register, which counts 0-23 for each TDC.
-                  { pch =>   3,  tdc => 2, ch => 1},                  # Take care that the functions copy pasted DO NOT have a "-1" for the channels!
-                  { pch =>   5,  tdc => 2, ch => 1},                  # pch: physical channel. The thing which will be plotted
-                  { pch =>   7,  tdc => 2, ch => 3},                  # tdc: tdc number
-                  { pch =>   9,  tdc => 2, ch => 4},                  # ch: channel in the TDC
-                  { pch =>  11,  tdc => 2, ch => 6},
-                  { pch =>  13,  tdc => 2, ch => 6},
-                  { pch =>  15,  tdc => 2, ch => 7}
+                  { pch =>   1,  tdc => 2, ch => 7},                  # Int(ch/2) because we read from monitoring register, which counts 0-23 for each TDC.
+                  { pch =>   3,  tdc => 2, ch => 6},                  # Take care that the functions copy pasted DO NOT have a "-1" for the channels!
+                  { pch =>   5,  tdc => 2, ch => 5},                  # pch: physical channel. The thing which will be plotted
+                  { pch =>   7,  tdc => 2, ch => 4},                  # tdc: tdc number
+                  { pch =>   9,  tdc => 2, ch => 3},                  # ch: channel in the TDC
+                  { pch =>  11,  tdc => 2, ch => 2},
+                  { pch =>  13,  tdc => 2, ch => 1},
+                  { pch =>  15,  tdc => 2, ch => 0}
 
                  ];                              
                                                  
 my $channels_x_0 = [
-                  { pch =>  2 ,  tdc => 0, ch => 7 },               # Int(ch/2) because we read from monitoring register, which counts 0-23 for each TDC.
-                  { pch =>  4 ,  tdc => 0, ch => 6 },               # Take care that the functions copy pasted DO NOT have a "-1" for the channels!
-                  { pch =>  6 ,  tdc => 0, ch => 6 },
-                  { pch =>  8 ,  tdc => 0, ch => 4 },
-                  { pch =>  10,  tdc => 0, ch => 3 },
-                  { pch =>  12,  tdc => 0, ch => 1 },
-                  { pch =>  14,  tdc => 0, ch => 1 },
-                  { pch =>  16,  tdc => 0, ch => 0 }
+                  { pch =>  2 ,  tdc => 0, ch => 0 },               # Int(ch/2) because we read from monitoring register, which counts 0-23 for each TDC.
+                  { pch =>  4 ,  tdc => 0, ch => 1 },               # Take care that the functions copy pasted DO NOT have a "-1" for the channels!
+                  { pch =>  6 ,  tdc => 0, ch => 2 },
+                  { pch =>  8 ,  tdc => 0, ch => 3 },
+                  { pch =>  10,  tdc => 0, ch => 4 },
+                  { pch =>  12,  tdc => 0, ch => 5 },
+                  { pch =>  14,  tdc => 0, ch => 6 },
+                  { pch =>  16,  tdc => 0, ch => 7 }
 
                  ];
 my $channels_y_1 = [
-                  { pch =>  2 ,  tdc => 3, ch => 7 },                 # Int(ch/2) because we read from monitoring register, which counts 0-23 for each TDC.
-                  { pch =>  4 ,  tdc => 3, ch => 6 },                 # Take care that the functions copy pasted DO NOT have a "-1" for the channels!
-                  { pch =>  6 ,  tdc => 3, ch => 6 },
-                  { pch =>  8 ,  tdc => 3, ch => 4 },
-                  { pch =>  10,  tdc => 3, ch => 3 },
-                  { pch =>  12,  tdc => 3, ch => 1 },
-                  { pch =>  14,  tdc => 3, ch => 1 },
-                  { pch =>  16,  tdc => 3, ch => 0 }
+                  { pch =>  1 ,  tdc => 3, ch => 0 },                 # Int(ch/2) because we read from monitoring register, which counts 0-23 for each TDC.
+                  { pch =>  3 ,  tdc => 3, ch => 1 },                 # Take care that the functions copy pasted DO NOT have a "-1" for the channels!
+                  { pch =>  5 ,  tdc => 3, ch => 2 },
+                  { pch =>  7 ,  tdc => 3, ch => 3 },
+                  { pch =>  9,  tdc => 3, ch => 4 },
+                  { pch =>  11,  tdc => 3, ch => 5 },
+                  { pch =>  13,  tdc => 3, ch => 6 },
+                  { pch =>  15,  tdc => 3, ch => 7 }
                  ];
                  
                  
 my $channels_y_0 = [
-                  { pch =>   1,  tdc => 1, ch => 0},             # Int(ch/2) because we read from monitoring register, which counts 0-23 for each TDC.
-                  { pch =>   3,  tdc => 1, ch => 1},             # Take care that the functions copy pasted DO NOT have a "-1" for the channels!
-                  { pch =>   5,  tdc => 1, ch => 1},
-                  { pch =>   7,  tdc => 1, ch => 3},
-                  { pch =>   9,  tdc => 1, ch => 4},
-                  { pch =>  11,  tdc => 1, ch => 6},
-                  { pch =>  13,  tdc => 1, ch => 6},
-                  { pch =>  15,  tdc => 1, ch => 7}
+                  { pch =>   2,  tdc => 1, ch => 7},             # Int(ch/2) because we read from monitoring register, which counts 0-23 for each TDC.
+                  { pch =>   4,  tdc => 1, ch => 6},             # Take care that the functions copy pasted DO NOT have a "-1" for the channels!
+                  { pch =>   6,  tdc => 1, ch => 5},
+                  { pch =>   8,  tdc => 1, ch => 4},
+                  { pch =>   10,  tdc => 1, ch => 3},
+                  { pch =>  12,  tdc => 1, ch => 2},
+                  { pch =>  14,  tdc => 1, ch => 1},
+                  { pch =>  16,  tdc => 1, ch => 0}
                  ];
 
 
@@ -1037,7 +1037,6 @@ while(1) {
 
 
 # VK: Jan said register is 24 bit, not 28 => change all 2**28 to 2**24
-# SS: Jan said register is 28 bit, not 24 => change all 2**24 to 2**28
 sub calculate_rates{
     my ($ra_channels, $old,$current_readout) = @_ ;
     
@@ -1050,21 +1049,21 @@ sub calculate_rates{
         my ($trbnet, $channel, $phy_channel) = ($ch->{tdc}, $ch->{ch},$ch->{pch});
         $trbnet += $trbnet_endpoint_offset;
         my $hits = $current_readout->{$trbnet}->{value}->[$channel]//0;
-        my $hitdiff = ($hits & 0xfffffff)-(($old->{$trbnet}->{value}->[$channel]//0) & 0xfffffff);
-        $hitdiff +=2**28 if $hitdiff < 0;
+        my $hitdiff = ($hits & 0xffffff)-(($old->{$trbnet}->{value}->[$channel]//0) & 0xffffff);
+        $hitdiff +=2**24 if $hitdiff < 0;
         my $time = $current_readout->{$trbnet}->{time}->[$channel];
         my $tdiff = ($time//0) - ($old->{$trbnet}->{time}->[$channel]//0);
         $tdiff += 2**16 if $tdiff <0;
         $tdiff *= 16;
         my $rate = $hitdiff / ($tdiff || 1E6) * 1E6 ;
         
-        if ($channel==1 || $channel==6) {$result[$phy_channel] = $rate/2;} # added 16.1.24 by Willy to accound for double bonded readout channels
-        else{$result[$phy_channel] = $rate;}# added 16.1.24 by Willy to accound for double bonded readout channels
-        #$result[$phy_channel] = $rate; # commented 16.1.24 by Willy to accound for double bonded readout channels
+        #if ($channel==1 || $channel==6) {$result[$phy_channel] = $rate/2;} # added 16.1.24 by Willy to accound for double bonded readout channels
+        #else{$result[$phy_channel] = $rate;}# added 16.1.24 by Willy to accound for double bonded readout channels
+        $result[$phy_channel] = $rate; # commented 16.1.24 by Willy to accound for double bonded readout channels
     }
     
      for my $i(1..16){
-         $result[$i] +=2**28 if $result[$i] < 0;
+         $result[$i] +=2**24 if $result[$i] < 0;
      }
     
     return @result;
@@ -1090,11 +1089,11 @@ sub calculate_diff_time_and_sum {
       #print Dumper $old;
       #exit;
       # vdiff is difference in read out values (Read: ValueDifference)
-      my $vdiff = ($hits & 0xfffffff) - (($old->{$trbnet}->{value}->[$channel]//0) & 0xfffffff);
-      $vdiff += 2**28 if $vdiff < 0;
+      my $vdiff = ($hits & 0xffffff) - (($old->{$trbnet}->{value}->[$channel]//0) & 0xffffff);
+      $vdiff += 2**24 if $vdiff < 0;
       my $diff = $vdiff/($tdiff||1E6)*1E6;
       #print "vdiff: $vdiff, diff: $diff, tdiff: $tdiff\n";
-      if ($channel==1 || $channel==6){ $diff = $diff/2;} # added 16.1.24 by Willy to accound for double bonded readout channels
+      #if ($channel==1 || $channel==6){ $diff = $diff/2;} # added 16.1.24 by Willy to accound for double bonded readout channels
 
 
       $sum += $diff;
@@ -1114,16 +1113,16 @@ sub calculate_weighted_sum_difference_from_mean{
     my ($trbnet, $channel, $phy_channel) = ($ch->{tdc}, $ch->{ch},$ch->{pch});
     $trbnet += $trbnet_endpoint_offset;
     my $hits = $current_readout->{$trbnet}->{value}->[$channel]//0;
-    my $hitdiff = ($hits & 0xfffffff)-(($old->{$trbnet}->{value}->[$channel]//0) & 0xfffffff);
+    my $hitdiff = ($hits & 0xffffff)-(($old->{$trbnet}->{value}->[$channel]//0) & 0xffffff);
     printf("%04x %04x\n",$trbnet,$channel) unless defined $hits;
-    $hitdiff +=2**28 if $hitdiff < 0;
+    $hitdiff +=2**24 if $hitdiff < 0;
     my $time = $current_readout->{$trbnet}->{time}->[$channel]//0;
     my $tdiff = $time - ($old->{$trbnet}->{time}->[$channel]//0);
     $tdiff += 2**16 if $tdiff <0;
     $tdiff *= 16;
     my $rate = $hitdiff / ($tdiff || 1E6) * 1E6 ;
 #     $weighted_sum_difference_from_mean += $hitdiff * ( ($phy_channel-$avg)**2); # this was a bug. One has to weight with the rate, not with the recorded hits, as weighted sum is also a rate
-    if ($channel==1 || $channel==6){ $rate = $rate/2;} # added 16.1.24 by Willy to accound for double bonded readout channels
+    #if ($channel==1 || $channel==6){ $rate = $rate/2;} # added 16.1.24 by Willy to accound for double bonded readout channels
     $weighted_sum_difference_from_mean += $rate * ( ($phy_channel-$avg)**2);
   }
   return $weighted_sum_difference_from_mean;
diff --git a/hmon/hmon_veto.pl b/hmon/hmon_veto.pl
new file mode 100755 (executable)
index 0000000..ba206b4
--- /dev/null
@@ -0,0 +1,132 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use Data::Dumper;
+use Data::TreeDumper;
+use Hmon;
+use QA;
+use HADES::TrbNet;
+use HPlot;
+use Time::HiRes qw(usleep time);
+use List::Util qw[min max];
+
+use Encode qw(encode from_to);
+use JSON::XS;
+
+
+HPlot::PlotInit({
+    name    => "VetoMap",
+    file    => "files/VetoMap",
+    title   => "VetoMap",
+    entries => 7,
+    curves  => 7,
+    type    => HPlot::TYPE_HEATMAP,
+    output  => HPlot::OUT_PNG,
+    zlabel  => "Hitrate",
+    sizex   => 310,
+    sizey   => 220,
+    nokey   => 1,
+    buffer  => 1,
+    ymin    => -0.5,
+    ymax    => 6.5,
+    xmin    => -0.5,
+    xmax    => 6.5,
+    cbmax   => "100<*<1E7",
+    cbmin   => 0,
+    noinit  => 1,
+#     additional => "set logscale cb;unset ytics;set format cb \"_{10}{\%L}\"",
+    additional => "unset ytics; unset xtics",
+    showvalues => 0, 
+    });
+
+
+my $str  = Hmon::MakeTitle(4, 6, "Veto Hit Rate",0);
+$str .= qq@<img src="%ADDPNG files/VetoMap.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("VetoMap",$str);
+
+my $old;
+my $oldtime = time();
+my $time = time();
+my $diff;
+my $iter = 0;
+
+
+
+trb_init_ports() or die trb_strerror();
+
+
+while(1) {
+
+  
+  my $o = trb_register_read_mem(0x5004,0xc000,0,9) or die trb_strerror() or sleep 5 and next;
+
+  if (defined $old) {
+    my $tdiff = (time() - $oldtime)|1;
+    foreach my $b (keys %$o) {
+      #my $ratesum = 0;
+
+      for my $v (0..8) {
+        my $vdiff = ($o->{$b}->[$v]&0xffffff) - ($old->{$b}->[$v]&0xffffff);
+        
+        if ($vdiff < 0) { $vdiff += 2**24;}
+        my $d = $vdiff/$tdiff;
+
+        if($v == 1) {
+          HPlot::PlotFill('VetoMap',$d,3,0);
+          HPlot::PlotFill('VetoMap',$d,3,1);
+          HPlot::PlotFill('VetoMap',$d,3,2);
+          }
+        if($v == 2) {
+          HPlot::PlotFill('VetoMap',$d,0,0);
+          HPlot::PlotFill('VetoMap',$d,0,1);
+          HPlot::PlotFill('VetoMap',$d,1,0);
+          HPlot::PlotFill('VetoMap',$d,1,1);
+          }
+        if($v == 3) {
+          HPlot::PlotFill('VetoMap',$d,0,3);
+          HPlot::PlotFill('VetoMap',$d,1,3);
+          HPlot::PlotFill('VetoMap',$d,2,3);
+          }
+        if($v == 4) {
+          HPlot::PlotFill('VetoMap',$d,0,5);
+          HPlot::PlotFill('VetoMap',$d,1,5);
+          HPlot::PlotFill('VetoMap',$d,0,6);
+          HPlot::PlotFill('VetoMap',$d,1,6);
+          }
+        if($v == 5) {
+          HPlot::PlotFill('VetoMap',$d,3,4);
+          HPlot::PlotFill('VetoMap',$d,3,5);
+          HPlot::PlotFill('VetoMap',$d,3,6);
+          }
+        if($v == 6) {
+          HPlot::PlotFill('VetoMap',$d,5,5);
+          HPlot::PlotFill('VetoMap',$d,6,5);
+          HPlot::PlotFill('VetoMap',$d,5,6);
+          HPlot::PlotFill('VetoMap',$d,6,6);
+          }
+        if($v == 7) {
+          HPlot::PlotFill('VetoMap',$d,4,3);
+          HPlot::PlotFill('VetoMap',$d,5,3);
+          HPlot::PlotFill('VetoMap',$d,6,3);
+          }
+        if($v == 8) {
+          HPlot::PlotFill('VetoMap',$d,5,0);
+          HPlot::PlotFill('VetoMap',$d,5,1);
+          HPlot::PlotFill('VetoMap',$d,6,0);
+          HPlot::PlotFill('VetoMap',$d,6,1);
+          }
+          
+        }
+      }
+    HPlot::PlotDrawFork('VetoMap');    
+    
+    
+
+   }
+    
+  $old = $o;
+  $oldtime = time();
+  sleep 1;
+  }
index 9fee89dc4bb6cd7931340907024b145bcdd06cda..7bbe1535d8eef99544ce7a965b5eea63542c7d4a 100755 (executable)
@@ -128,7 +128,7 @@ function openwin(url) {
 <li class="outdated"><a href="monitor.cgi?1-window-VetoHalo">Rates for Veto &amp; HALO</a></li>
 <li><a href="monitor.cgi?1-window12x8-StartRateSimple-HodoRate">Beam Position</a></li>
 <li><a href="monitor.cgi?1-window-SpillStructure">Spill Structure from Start</a></li>  -->
-<li><a href="monitor.cgi?6-window12x21-StartRateNumbers-StartMap-StartPosition-StartPositionRMS">Start position</a></li>
+<li><a href="monitor.cgi?6-window12x21-StartRateNumbers-StartMap-VetoMap-StartPosition-StartPositionRMS">Start position</a></li>
 <li><a href="monitor.cgi?6-StartSpillShapeAnalysisX_0-StartSpillShapeAnalysisY_0">Spill Structure from Start</a></li>
 <!--<li><a href="monitor.cgi?6-StartRateX_histbar-StartRateY_histbar">Start rate (histbar)</a></li>-->
 <!-- <li class="outdated"><a href="monitor.cgi?1-StartRateBars-StartBars-StartPosition-VetoHalo-ForwardQuartz">Beam Summary</a></li> -->
index 3f8e0fbcd4fd904b3f9d7994f232a44fb58c3bb9..8c08ebc5bd1374fb24c6c686a2b0f9fddb198d3d 100755 (executable)
@@ -31,15 +31,20 @@ my @experts = qw(SL DaqOp QA DaqTr DaqProf DaqEx Start RICH MDC RPC ECAL TOF_FW
 #contact       Expert  Name    Phone   Alias
 #$store->{contact}{Name}
 
+my $store;
 
 while(1) {
-  my $store;
+  %$store = ();
 
   my $offset = 0; #for testing
-  my $oracledatestart = strftime("%d-%b-%Y %H:%M", localtime(time-3600*8+$offset*86400)); #-864000-7200
-  my $oracledateend = strftime("%d-%b-%Y %H:%M", localtime(time+$offset*86400));
-  my $date = strftime ("%Y-%m-%d", localtime(time+$offset*86400));
-  my $hour = strftime ("%H", localtime(time+$offset*86400));
+  my $oracledatestart = strftime("%d-%b-%Y %H:%M", localtime(time-3600*8+150+$offset*86400)); #-864000-7200
+  my $oracledateend = strftime("%d-%b-%Y %H:%M", localtime(time+$offset*86400+150));
+#   my $date = strftime ("%Y-%m-%d", localtime(time+$offset*86400+150));
+  my $nowmonth = strftime ("%m", localtime(time+$offset*86400+150));
+     $nowmonth =~ s/^0//;  
+  my $nowday   = strftime ("%d", localtime(time+$offset*86400+150));
+     $nowday =~ s/^0//;  
+  my $hour = strftime ("%H", localtime(time+$offset*86400+150));
      $hour =~ s/\s//;  
 
   my $plan = get("https://hessenbox-a10.rz.uni-frankfurt.de/dl/fiUP5enanrB2pwwuBDJxGj/ExpertsPlan.csv");
@@ -54,16 +59,15 @@ while(1) {
       $store->{alias}{$s[4]} = $s[2];
       $store->{alias}{$s[2]} = $s[4];
       }
-    if (scalar @s == 28 &&  $s[0] ne '') {
+    if (scalar @s == 29 &&  $s[0] ne '') {
       my $exp = $store->{contact}{$s[0]}{expert} //'';
-      if($date eq $s[2]) {
-        $store->{onshift}{$exp}{$s[0]} = $s[$hour+3];
+      if($nowmonth eq $s[2] && $nowday eq $s[3]) {
+        $store->{onshift}{$exp}{$s[0]} = $s[$hour+4];
         }
       }
     }
 
 
-  
   my $oraclecmd = "curl 'https://hades-db.gsi.de/pls/hades_webdbs/hades_oper.hshiftcrews2.show_shifts' -b /tmp/cookiefile -c /tmp/cookiefile -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.hshiftcrews2.form_select' -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=FEB24&p_begin=$oracledatestart&p_end=$oracledateend&p_purpose_id=&p_responsible=&p_action=Show+Shift+Crew'   -u hades:6\\\$ectors   2>/dev/null" ;
   my $text; my @ret;
   run3($oraclecmd, \$text, \@ret);
@@ -90,30 +94,32 @@ while(1) {
     my $name= $store->{alias}{$e[0]} || $e[0];
     if($name ne ' ') {
       $store->{contact}{$name}{phone} //= $e[1];
-      $store->{onshift}{$experts[$cnt]}{$name} = 'S' if $onshift;
-      $store->{onshift}{$experts[$cnt]}{$name} = 'X' unless $onshift;
+      unless ($store->{onshift}{$experts[$cnt]}{$name}) {
+        $store->{onshift}{$experts[$cnt]}{$name} = 'S' if $onshift;
+        $store->{onshift}{$experts[$cnt]}{$name} = 'X' unless $onshift;
+        }
       }
     
     $cnt++;
     }
 
-
-  my $str  = Hmon::MakeTitle(6, 9, "Experts on Shift",1);
-  $str .= "HADES knowledge at hand<br><table class=\"expertlist\">";
+  my $tstr = strftime("%d-%b-%Y %H:%M",localtime(time+$offset*86400+150));
+  my $str  = Hmon::MakeTitle(7, 10, "Experts on Shift",0);
+  $str .= "HADES knowledge at hand @ $tstr<br><table class=\"expertlist\">";
 
 
-  foreach my $ex (qw(DaqProf DaqEx Start RICH MDC RPC ECAL TOF_FW Ana SL)) {
+  foreach my $ex (qw(DaqProf DaqEx Start RICH MDC MDCEx RPC ECAL TOF_FW Ana SL)) {
     next unless $store->{onshift}{$ex};
     foreach my $n (sort {cmpstate($ex,$a,$b)} keys %{$store->{onshift}{$ex}}) {
       next if $store->{onshift}{$ex}{$n} eq '.';
       next if $store->{onshift}{$ex}{$n} eq '';
       
-      $str .= "<tr><td>$ex<td>";
-      $str .=  "<div class=\"greenbutton inline\"></div>"     if $store->{onshift}{$ex}{$n} eq 'S';
+      $str .= "<tr><td>".($ex eq 'DaqProf'?'DAQ':$ex)."<td>";
+      $str .=  "<div class=\"greenbutton inline\"></div>"     if $store->{onshift}{$ex}{$n} eq 'S' and $ex ne "SL";
       $str .=  "<div class=\"darkgreenbutton inline\"></div>" if $store->{onshift}{$ex}{$n} eq 'X';
       $str .=  "<div class=\"yellowbutton inline\"></div>"    if $store->{onshift}{$ex}{$n} eq '-';
       $str .=  "<div class=\"greybutton inline\"></div>"      if $store->{onshift}{$ex}{$n} eq 'n';
-      $str .=  "<div class=\"redbutton inline\"></div>"       if $store->{onshift}{$ex}{$n} eq '.';
+      $str .=  "<div class=\"redbutton inline\"></div>"       if $store->{onshift}{$ex}{$n} eq '.'  or $ex eq "SL";
 
       $str .=  "<td>$n<td>".($store->{contact}{$n}{phone}//"");
       }
@@ -138,20 +144,24 @@ while(1) {
 
 sub cmpstate {
   my ($ex,$a,$b) = @_;
-  my $x = $store->{onshift}{$ex}{$a} //'.';
-  my $y = $store->{onshift}{$ex}{$b} // '.';
+  my ($x,$y);
+  $x = $store->{onshift}{$ex}{$a} //'.';
+  $y = $store->{onshift}{$ex}{$b} //'.';
+
+  my $xn = 0;
+  $xn = 10 if $x eq 'S';
+  $xn = 8  if $x eq 'X';
+  $xn = 6  if $x eq '-';
+  $xn = 4  if $x eq 'n';
+  $xn = 2  if $x eq '.';
   
-  $x = 10 if $x eq 'S';
-  $x = 8  if $x eq 'X';
-  $x = 6  if $x eq '-';
-  $x = 4  if $x eq 'n';
-  $x = 2  if $x eq '.';
-  
-  $y = 10 if $y eq 'S';
-  $y = 8  if $y eq 'X';
-  $y = 6  if $y eq '-';
-  $y = 4  if $y eq 'n';
-  $y = 2  if $y eq '.';
-
-  return $y <=> $x;
+  my $yn = 0;
+  $yn = 10 if $y eq 'S';
+  $yn = 8  if $y eq 'X';
+  $yn = 6  if $y eq '-';
+  $yn = 4  if $y eq 'n';
+  $yn = 2  if $y eq '.';
+  $yn = 2  if $y eq ' ';
+
+  return $yn <=> $xn;
   }
index 7aefc8c4b1ddd38a3348d50fbf4f950bc9596598..2e1070244340f52609ca8f7fb294afba4b186b9a 100755 (executable)
@@ -31,7 +31,7 @@ my %range_list = (
                   'HAD:MAGNET:TC1238'           => {},#{'min' => 4.6    , 'max' => 4.9  },
                   'HAD:MAGNET:TC1248'           => {},#{'min' => 4.5    , 'max' => 4.7  },
                   'HAD:MAGNET:FI1400'           => {},#{'min' => 0.36   , 'max' => 0.62 },
-                  'HAD:MAGNET:PSUI_rbk'         => {},#{'min' => 2990   , 'max' => 3210 },
+                  'HAD:MAGNET:PSUI_rbk'         => {'min' => 1840   , 'max' => 1860 },
                   'HAD:MAGNET:PSUV_rbk'         => {},#{'min' => 0      , 'max' => 1    },
                   'HAD:MAGNET:BBI'              => {},#{'min' => 419    , 'max' => 620  },
                   'HAD:MAGNET:LL1708'           => {'minerror' => 30, 'min' => 38,  'max' => 65, 'maxerror' => 65},
@@ -79,7 +79,7 @@ my %range_list = (
                   'HAD:MAGNET:HR3104(a)'        => {},#{},     
                   'HAD:MAGNET:HR3108R'          => {},#{}, 
                   'HAD:MAGNET:MV1106R'          => {},#{}, 
-                  'HAD:CRYO:TS105'              => {'minerror' => 100, 'min' => 105, 'max' => 130 , 'maxerror' => 135  },
+                  'HAD:CRYO:TS105'              => {'minerror' => 125, 'min' => 130, 'max' => 155 , 'maxerror' => 160  },
                   'HAD:CRYO:TIC106'             => {'minerror' => 8.5, 'min' => 8.7, 'max' => 10.2, 'maxerror' => 10.3 },
                   'HAD:CRYO:UpdateCounter:roc'  => {}#{},
                  );
@@ -221,9 +221,9 @@ while (1) {
     QA::WriteQALog($flog,"misc","magnet",$interval+20,$state,$title,$value,$fatal_error_string);
   } else {
     $longtext = "Checked at $time</br>";
-    $longtext .= "TIC106: 8.5 K < <b>$TIC106 K</b> < 10.3 K</br>";
-    $longtext .= "TS105: 100 K < <b>$TS105 K</b> < 135 K</br>";
-    $longtext .= sprintf("LL1708: 30%% < <b>%.2f%%</b> < 65%%",$LL1708);
+    $longtext .= "TIC106: ".$range_list_href->{"HAD:CRYO:TIC106"}->{'min'}." K < <b>$TIC106 K</b> < ".$range_list_href->{"HAD:CRYO:TIC106"}->{'max'}." K</br>";
+    $longtext .= "TS105: ".$range_list_href->{"HAD:CRYO:TS105"}->{'min'}." K < <b>$TS105 K</b> < ".$range_list_href->{"HAD:CRYO:TS105"}->{'max'}." K</br>";
+    $longtext .= sprintf("LL1708: %.2f%% < <b>%.2f%%</b> < %.2f%%", $range_list_href->{"HAD:MAGNET:LL1708"}->{'min'}, $LL1708, $range_list_href->{"HAD:MAGNET:LL1708"}->{'max'});
     QA::WriteQALog($flog,"misc","magnet",$interval+20,QA::OK,$title,$value,$longtext);
     $last_good_time = $time;
   } 
index 02085df0ca9a0280d59d3873982e8c99b47514f5..ccc35d507e5fd88ec2be290d87de45d2232d2798 100755 (executable)
@@ -201,7 +201,7 @@ while(1) {
         if(! defined $mdcHvMax[$p] || $mdcHvMax[$p] < $volt) {
           $mdcHvMax[$p] = $volt;
           }     
-        if($current > 10 ) {
+        if($current > 90 ) {
           $spikeString .= "P $p S $s F/C $i: HV = ".$volt." , I = ".$current."  -  ".localtime()."\n"; 
           $speakPlane = $p;
           $speakSector = $s;
@@ -251,7 +251,7 @@ sprintf("%.1f/%.1f/%.1f/%.1f",$mdcHvMin[1]/1000.,$mdcHvMin[2]/1000.,$mdcHvMin[3]
                  $mdcHvMax[1],$mdcHvMax[2],$mdcHvMax[3],$mdcHvMax[4],
                  min(@{$QA::MdcNominalHV->[0]}),min(@{$QA::MdcNominalHV->[1]}),min(@{$QA::MdcNominalHV->[2]}),min(@{$QA::MdcNominalHV->[3]})
                  );
-  QA::WriteQALog($flog,"hv2","mdchv",10,$qastate,"MDC HV",$value,$longtext);  
+  QA::WriteQALog($flog,"hv2","mdchv",20,$qastate,"MDC HV",$value,$longtext);  
   
   Hmon::Speak('MDC',"M D C  teeest");
 
@@ -295,5 +295,5 @@ sprintf("%.1f/%.1f/%.1f/%.1f",$mdcHvMin[1]/1000.,$mdcHvMin[2]/1000.,$mdcHvMin[3]
   
   $timer++;
   sleep(1);
-  Hmon::Speak('MDC',"M D C sleep");
+#  Hmon::Speak('MDC',"M D C sleep");
   }
index 83e94abf7a25e4e86e962f4120f50efcc43a9147..f65dda9a675a5ad39f5a0213887fd654ea743937 100755 (executable)
@@ -35,8 +35,8 @@ HPlot::PlotInit({
     ylabel  => "mbar",
     sizex   => 600,
     sizey   => 250,
-    ymin    => "40",
-    ymax    => "150",
+    ymin    => "20",
+    ymax    => "100",
     curves  => 1,
     xscale  => 6,
     buffer  => 1,
@@ -383,11 +383,11 @@ while(1) {
   $str .= qq@<img src="%ADDPNG files/VacuumHigh.png%" type="image/png">\n@;
   $str .= qq@<img src="%ADDPNG files/VacuumLow.png%" type="image/png"><br>@;
   my $vallow = $data->{"Vaclow"}->{val};
-  my $valhigh = $data->{"Vachigh"}->{val}*1E7;
-  print("vallow = $vallow\n");
-  print("valhigh = $valhigh\n");
+  my $valhigh = $data->{"Vachigh"}->{val};
+  print("vallow = $vallow\n");
+  print("valhigh = $valhigh\n");
   $str .= sprintf("Low Vacuum %.2f mbar</br>",$vallow);
-  $str .= sprintf("High Vacuum %.2fE-7 mbar</br>",$valhigh);
+  $str .= sprintf("High Vacuum %.2fE-7 mbar</br>",$valhigh*1e7);
   if($H2_run) {
     $str .= "Beamline Gate ";
     
@@ -404,26 +404,26 @@ while(1) {
   my $qastat = QA::OK;
   my $msg = "";
   my $longmsg = "";
-  if($vallow < 30 || $vallow > 110){
+  if($vallow < 20 || $vallow > 110){
     $qastat = QA::ERROR;
     $msg .= "VacLow LOLO </br>" if $vallow < 30;
     $msg .= "VacLow HIHI </br>" if $vallow > 110;
     $longmsg .= "VacLow LOLO </br>" if $vallow < 30;
     $longmsg .= "VacLow HIHI </br>" if $vallow > 110;
   }
-  if($qastat != QA::ERROR && ($vallow < 50 || $vallow > 90)){
+  if($qastat != QA::ERROR && ($vallow < 25 || $vallow > 80)){
     $qastat = QA::WARN;
     $msg .= "VacLow LO </br>" if $vallow < 50;
     $msg .= "VacLow HI </br>" if $vallow > 90;
     $longmsg .= "VacLow LO </br>" if $vallow < 50;
     $longmsg .= "VacLow HI </br>" if $vallow > 90;
   }
-  if($valhigh > 70){
+  if($valhigh > 70e-5){
     $qastat = QA::ERROR;
     $msg .= "VacHigh HIHI </br>";
     $longmsg .= "VacHigh HIHI </br>";
   }
-  if($qastat != QA::ERROR && $valhigh > 7){
+  if($qastat != QA::ERROR && $valhigh > 7e-5){
     $qastat = QA::WARN if $qastat != QA::ERROR;
     $msg .= "VacHigh HI </br>";
     $longmsg .= "VacHigh HI </br>";
@@ -431,8 +431,8 @@ while(1) {
   if($qastat == QA::OK) {
     $msg = sprintf("%s / %s",QA::SciNotation($vallow),QA::SciNotation($valhigh));
   }
-  $longmsg .= sprintf("low vacuum: 30 mbar << 50 mbar < <b>%s mbar</b> < 90 mbar << 110 mbar </br>",QA::SciNotation($vallow));
-  $longmsg .= sprintf("high vacuum: <b>%s mbar</b> < 7 mbar << 70 mbar </br>",QA::SciNotation($valhigh));
+  $longmsg .= sprintf("low vacuum: 20 mbar << 25 mbar < <b>%s mbar</b> < 80 mbar << 110 mbar </br>",QA::SciNotation($vallow));
+  $longmsg .= sprintf("high vacuum: <b>%s mbar</b> < 60u mbar << 150u mbar </br>",QA::SciNotation($valhigh));
 
   if($H2_run) {  
     if ($data->{"Gate"}->{tme}==-1) {
index b01681052969ca2a1d8f550e6ebd2d9207b9b411..355dcc2c9e236f6f04625e9c626e361dbc6d97a6 100755 (executable)
@@ -166,8 +166,8 @@ while(1) {
   my $longtext = "";
 
   $qastate = QA::OK      if ($IsobPress <= 2.0 && $IsobPress >= 0.9);    
-  $qastate = QA::WARN_2  if (($IsobPress < 0.9) || ($IsobO2 >300.0) || ($IsobRefR < 70.0));
-  $qastate = QA::ERROR_2 if (($IsobPress > 2.0) || ($IsobPress < 0.7) || ($IsobO2 > 800.0) || ($IsobRefR < 50.0));
+  $qastate = QA::WARN_2  if (($IsobPress < 0.9) || ($IsobO2 >2000.0) || ($IsobRefR < 70.0));
+  $qastate = QA::ERROR_2 if (($IsobPress > 2.0) || ($IsobPress < 0.7) || ($IsobO2 > 5000.0) || ($IsobRefR < 50.0));
   # $qastate = QA::WARN_2  if (($IsobPress < 0.9) || ($IsobO2 >300.0) || ($IsobRefR < 70.0) || ($IsobScale1 < 40) || ($IsobScale2 < 40));
   # $qastate = QA::ERROR_2 if (($IsobPress > 2.0) || ($IsobPress < 0.7) || ($IsobO2 > 800.0) || ($IsobRefR < 50.0) || ($IsobScale1 < 37) || ($IsobScale2 < 37));
   $qastate = min(QA::WARN_2,$qastate) if $QA::RichHvOff;
index c039dcf439d22a2a4b4a974a8ffde0e597edfb79..0434fd3fbbfe2c00a04d0c16d2494c70223bcd37 100755 (executable)
@@ -67,7 +67,7 @@ while(1) {
           $cnt = ($i*2)+$j;
           if ($data->{"U$cnt"}->{val}>=5490){$ChnlsOn++;}
           elsif ($data->{"U$cnt"}->{val}>=4990){$ChnlsLow++;}
-          
+          print $data->{"U$cnt"}->{val}."\n";
         }
     }
   
index d6e838d3c38bec9f8d6d3c82ff9be5d0003dcf22..fe698ec470c9907721abbf61f93b10d1a4e6b0de 100755 (executable)
@@ -38,7 +38,7 @@ HPlot::PlotInit({
     ymin    => "0.95",
     ymax    => "10.05",
 #    ymax    => "1.05<*",
-    curves  => 2,
+    curves  => 3,
     xscale  => 23.81,
     nokey   => 1,
     buffer  => 1,
@@ -154,8 +154,9 @@ $str .= qq@<img src="%ADDPNG files/MicroRate10ms.png%" type="image/png">\n@;
 $str .= Hmon::MakeFooter();
 Hmon::WriteFile("MicroSpillStructureLong",$str);
 
-$str  = Hmon::MakeTitle(5, 7, "StartMap",0);
-$str .= qq@<div style="padding-top:35px;padding-left:15px;overflow:hidden;max-height:400px;width:90%;text-align:center;"><img src="%ADDPNG files/StartMap.png%" type="image/png" style="transform:rotate(45deg);"></div>\n@;
+$str  = Hmon::MakeTitle(4, 7, "StartMap",0);
+# $str .= qq@<div style="padding-top:35px;padding-left:15px;overflow:hidden;max-height:400px;width:90%;text-align:center;"><img src="%ADDPNG files/StartMap.png%" type="image/png" style="transform:rotate(45deg);"></div>\n@;
+$str .= qq@<img src="%ADDPNG files/StartMap.png%" type="image/png">\n@;
 $str .= Hmon::MakeFooter();
 Hmon::WriteFile("StartMap",$str);
 
@@ -171,8 +172,14 @@ my $oldtime = time();
 my $time = time();
 my $diff;
 my $round = 0;
-my @xpos = (15,13,11,9,7,5,3,1,0,2,4,6,8,10,12,14);
-my @ypos = (0,2,4,6,8,10,12,14,15,13,11,9,7,5,3,1);
+
+#C+C beam
+#my @xpos = (15,13,11,9,7,5,3,1,0,2,4,6,8,10,12,14);
+#my @ypos = (0,2,4,6,8,10,12,14,15,13,11,9,7,5,3,1);
+
+my @xpos = (1,3,5,7,9,11,13,15,14,12,10,8,6,4,2,0);
+my @ypos = (15,13,11,9,7,5,3,1,0,2,4,6,8,10,12,14);
+
 
 while(1) {
 
@@ -184,6 +191,9 @@ while(1) {
     my $maxbin = 0;
     my $mean = 0;
     my $total = 0;
+    my $avgq = 0;
+    my $avgqcnt = 0;
+    my $avgqtimer = 0;
     
     foreach my $val (@{$o->{$b}}) {
       if(($val & 0xf0000000) == 0x80000000) {
@@ -205,6 +215,21 @@ while(1) {
         HPlot::PlotAdd('QFactor',1,1)     if($total <  $MINRATE);
         HPlot::PlotAdd('QFactor',10,1)    if($total >= $MINRATE && $qfactor >= 10);
 
+        if($total >= $MINRATE && $qfactor < 10) {
+          $avgq += $qfactor;
+          $avgqcnt++;
+          }
+        
+        if($avgqtimer++ == 10) {
+          HPlot::PlotAdd('QFactor',$avgq/$avgqcnt,2) if $avgqcnt;
+          HPlot::PlotAdd('QFactor',"NaN",2)          unless $avgqcnt;
+          $avgq      = 0;
+          $avgqtimer = 0;
+          $avgqcnt   = 0;
+          }
+        else {
+          HPlot::PlotAdd('QFactor',"NaN",2);
+          }
         }
       }
     }
@@ -249,46 +274,46 @@ while(1) {
         }
       
 
-      for my $x (0..15) {
-        for my $y (0..15) {
-          if($x == 2) {
-            $diff->[2][$y] /= 2;
-            $diff->[4][$y] = $diff->[2][$y]; 
-            }
-          if($x == 3) {
-            $diff->[3][$y] /= 2;
-            $diff->[5][$y] = $diff->[3][$y]; 
-            }
-          if($x == 13) {
-            $diff->[13][$y] /= 2;
-            $diff->[11][$y] = $diff->[13][$y]; 
-            }
-          if($x == 12) {
-            $diff->[12][$y] /= 2;
-            $diff->[10][$y] = $diff->[12][$y]; 
-            }
-          }
-        }
-      for my $x (0..15) {
-        for my $y (0..15) {
-          if($y == 2) {
-            $diff->[$x][2] /= 2;
-            $diff->[$x][4] = $diff->[$x][2]; 
-            }
-          if($y == 3) {
-            $diff->[$x][3] /= 2;
-            $diff->[$x][5] = $diff->[$x][3]; 
-            }
-          if($y == 13) {
-            $diff->[$x][13] /= 2;
-            $diff->[$x][11] = $diff->[$x][13]; 
-            }
-          if($y == 12) {
-            $diff->[$x][12] /= 2;
-            $diff->[$x][10] = $diff->[$x][12]; 
-            }
-          }
-        }
+      for my $x (0..15) {
+        for my $y (0..15) {
+          if($x == 2) {
+            $diff->[2][$y] /= 2;
+            $diff->[4][$y] = $diff->[2][$y]; 
+            }
+          if($x == 3) {
+            $diff->[3][$y] /= 2;
+            $diff->[5][$y] = $diff->[3][$y]; 
+            }
+          if($x == 13) {
+            $diff->[13][$y] /= 2;
+            $diff->[11][$y] = $diff->[13][$y]; 
+            }
+          if($x == 12) {
+            $diff->[12][$y] /= 2;
+            $diff->[10][$y] = $diff->[12][$y]; 
+            }
+          }
+        }
+      for my $x (0..15) {
+        for my $y (0..15) {
+          if($y == 2) {
+            $diff->[$x][2] /= 2;
+            $diff->[$x][4] = $diff->[$x][2]; 
+            }
+          if($y == 3) {
+            $diff->[$x][3] /= 2;
+            $diff->[$x][5] = $diff->[$x][3]; 
+            }
+          if($y == 13) {
+            $diff->[$x][13] /= 2;
+            $diff->[$x][11] = $diff->[$x][13]; 
+            }
+          if($y == 12) {
+            $diff->[$x][12] /= 2;
+            $diff->[$x][10] = $diff->[$x][12]; 
+            }
+          }
+        }
         
       for my $x (0..15) {
         for my $y (0..15) {