]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
add RICH spoke temperature to QA
authorHades DAQ <jan@lxhadeb07>
Mon, 8 Oct 2018 11:59:23 +0000 (13:59 +0200)
committerHades DAQ <jan@lxhadeb07>
Mon, 8 Oct 2018 11:59:23 +0000 (13:59 +0200)
hmon/QA.pm
hmon/hmon_richMagnet.pl
hmon/hmon_rich_temp.pl
hmon/hmon_rich_temp_backplane.pl
hmon/hmon_richrate.pl

index 634274d52ce90621a27ada5c5c48407226fa4af1..094b555fb706daccdab4f514f4a842ad57f30a88 100644 (file)
@@ -286,5 +286,18 @@ sub SciNotation {
     }
 }
 
+############################################
+# A simple date string
+sub getTimeString {
+  my $timeStamp = localtime();
+   
+  my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
+  my @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
+  my ($sec,$minute,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
+  my $updatetime = sprintf("%03s, %02d %s %04d  -  %02d:%02d:%02d",$days[$wday], $mday, $months[$mon], 1900 + $year, $hour, $minute, $sec);
+  return $updatetime;
+  }
+
+
 1;
 __END__
index e09b32f99a8b8f5a9e08091103e3b3bf757cd18f..48e6612a60a095e760d4e557326469eec981c564 100755 (executable)
@@ -11,6 +11,8 @@ use HPlot;
 use Time::HiRes qw(usleep time);
 use List::Util qw[min max];
 
+use Encode qw(encode from_to);
+use JSON::XS;
 
 #my $flog = Hmon::OpenLogfile();
 #my $fqa  = QA::OpenQAFile();
@@ -89,7 +91,7 @@ xlabel  => "RICH Arm number",
 ylabel  => "Sensor Number on Board",
 ymin    => -0.5,
 ymax    => 3.5,
-cbmax   => "",#"40<*<1E5",
+cbmax   => "15<*<35",
 cbmin   => 0.0,
 cblabel => "Temperature [°C]",
 noinit  => 1,
@@ -110,6 +112,7 @@ my $cnt=0;
 while(1){
   my $count = 0;
   my $data;
+  my $mintemp = 100; my $maxtemp = 0;
   my $magActive = trb_register_read_mem(0x0110, 0xe001,0,0x6) or sleep 5 and next;
   my $rich = trb_register_read_mem(0x0110, 0xe010,0,0x60) or sleep 5 and next;
   #print Dumper $magActive->{0x0110}[2];
@@ -126,6 +129,9 @@ while(1){
         if (($magActive->{0x0110}[$boardT] >> 8) == 0 ) {
           #print "$boardT  $sensT  $t\n";
           HPlot::PlotFill('RichInnerTemp',$t,$boardT,$sensT);#
+          $data->{$boardT}{$sensT} = $t;
+          $mintemp = $t if $t < $mintemp;
+          $maxtemp = $t if $t > $maxtemp;
           my $reg = 4*$boardT+$sensT;
           #print "$reg $t\n";
           if ($cnt > 7) {$cnt =0;} else {$cnt++;}
@@ -154,5 +160,21 @@ while(1){
     HPlot::PlotDraw('RichMagnet');  
     HPlot::PlotDraw('RichInnerTemp');   
     HPlot::PlotDraw('RichInnerTempHist');
+    
+    
+   $data->{max} = $maxtemp;
+   $data->{min} = $mintemp;
+   $data->{symbol} = " &degC";
+   $data->{title} = "RICH spoke temperature";
+    
+   
+   $data->{updatetime} = QA::getTimeString(); 
+    
+   my $fh;
+   open($fh, ">", Hmon::HMONDIR."/files/richSpokeTemperature.json");
+   print $fh   encode_json($data);
+   close $fh;
+
+    
   sleep 10;
 }
index 7bf6ec8bf58d6e32590dd5f96a3d91afb3b4e474..d7cfd44cdebfa1e3f864b82706db6bae5bf5435a 100755 (executable)
@@ -57,14 +57,7 @@ while (1) {
   $data->{symbol} = " &degC";
   $data->{title} = "RICH Temperature";
   
-  my $timeStamp = localtime();
-  
-  my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
-  my @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
-  my ($sec,$minute,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
-  my $updatetime = sprintf("%03s, %02d %s %04d  -  %02d:%02d:%02d",$days[$wday], $mday, $months[$mon], 1900 + $year, $hour, $minute, $sec);
-  
-  $data->{updatetime} = $updatetime;
+  $data->{updatetime} = QA::getTimeString();
   
   
 
index 6837d88d85cc80bc0fd77198f6e03d6f94081412..2687a265a68143bde104dd0ba39acb24584bb08e 100755 (executable)
@@ -78,14 +78,8 @@ while (1) {
   $data->{min} = $min;
   $data->{symbol} = " &degC";
   $data->{title} = "RICH Temperature on Backplane";
-  my $timeStamp = localtime();
-  
-  my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
-  my @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
-  my ($sec,$minute,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
-  my $updatetime = sprintf("%03s, %02d %s %04d  -  %02d:%02d:%02d",$days[$wday], $mday, $months[$mon], 1900 + $year, $hour, $minute, $sec);
-  
-  $data->{updatetime} = $updatetime;
+   
+  $data->{updatetime} = QA::getTimeString();
   
   #-------Software Interlock-------#
   my $InterlockValHW = (($Interlock_value->{0x0110} || 0) & 0xfff)/16;
@@ -111,12 +105,24 @@ while (1) {
 
   my $qastate = QA::GetQAState('below', $max, @QA::RichInnerTempLimits);
   
+  my $fh;
+  open($fh, "<", Hmon::HMONDIR."/files/richSpokeTemperature.json");
+  chomp(my @lines = <$fh>);
+  close $fh;
+  
+  eval {
+    $data = decode_json(join " ",@lines);
+    1;
+    } 
+  or sleep 5 and next;
+  my $strspokes  = sprintf("%i - %i", $data->{min}, $data->{max});
+  
   my $qastate_interlock = QA::GetQAState('below', $max, @QA::RichInnerTempLimits);
   my $str = sprintf("%i - %i", $min, $max);
   QA::WriteQALog($fqa,"rich","bkpl", 40, $qastate, "Temperature", $str, 
-                 "Min/Max temperature in RICH " . $str . " &degC<br> Software Interlock Temperature: " . $interlockTemperature . " &degC | " .$InterlockActive ."<br>". $strHWInterlock);
+                 "Min/Max temperature in RICH BKPL " . $str . " &degC<br>Min/Max temperature on RICH spokes " . $strspokes . " &degC<br> Software Interlock Temperature: " . $interlockTemperature . " &degC | " .$InterlockActive ."<br>". $strHWInterlock);
   
-  my $fh;
+
   open($fh, ">", Hmon::HMONDIR."/files/richTemperatureBackplane.json");
   print $fh   encode_json($data);
   close $fh;
index 8706539d2c9314870bb238fd5641b84e3eb949a6..af18fdebf0dacc6c45835dacc4b279a235a6c201 100755 (executable)
@@ -172,16 +172,9 @@ while(1) {
    # $data->{symbol} = " Hits/s";
    # $data->{title} = "Mean DiRICH TDC Rate";
     
-   # my $timeStamp = localtime();
+   
+   # $data->{updatetime} = getTimeString; 
     
-   # my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
-   # my @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
-   # my ($sec,$minute,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
-   # my $updatetime = sprintf("%03s, %02d %s %04d  -  %02d:%02d:%02d",$days[$wday], $mday, $months[$mon], 1900 + $year, $hour, $minute, $sec);
-    
-   # $data->{updatetime} = $updatetime; 
-    
-    #print Dumper $data;
    # my $fh;
    # open($fh, ">", Hmon::HMONDIR."/files/richMeanRateDiRICH.json");
    # print $fh   encode_json($data);