]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
DMON: CTS dead time script added
authorManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Fri, 7 Nov 2014 18:29:02 +0000 (19:29 +0100)
committerManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Fri, 7 Nov 2014 18:29:02 +0000 (19:29 +0100)
dmon/scripts/dmon_deadtime.pl [new file with mode: 0755]

diff --git a/dmon/scripts/dmon_deadtime.pl b/dmon/scripts/dmon_deadtime.pl
new file mode 100755 (executable)
index 0000000..b8a837a
--- /dev/null
@@ -0,0 +1,61 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use POSIX qw(strftime);
+use FileHandle;
+use lib "./code";
+use lib "../tools";
+use HADES::TrbNet;
+use Time::HiRes qw(usleep);
+use Dmon;
+use HPlot;
+use Data::Dumper;
+
+my %config = Dmon::StartUp();
+
+
+my $deadtimePercent;
+my $cnt = 0;
+
+HPlot::PlotInit({
+  name    => "CtsDeadTime",
+  file    => Dmon::DMONDIR."CtsDeadTime",
+  entries => 600,
+  type    => HPlot::TYPE_HISTORY,
+  output  => HPlot::OUT_PNG,
+  titles  => ["Dead Time"],
+  xlabel  => "Time [s]",
+  ylabel  => "Dead Time / Time [%]",
+  sizex   => 750,
+  sizey   => 270,
+  ymin    => -1,
+  ymax    => 101,
+  xscale  => 5,
+  nokey   => 1,
+  buffer  => 1
+  });
+
+my $str = Dmon::MakeTitle(10,6,"CtsDeadTime",0);
+   $str .= qq@<img src="%ADDPNG CtsDeadTime.png%" type="image/png">@;
+   $str .= Dmon::MakeFooter();
+Dmon::WriteFile("CtsDeadTime",$str);
+
+while(1) {
+  my $r = trb_registertime_read($config{CtsAddress},0xa00e) ;
+  my $t; $t = Dmon::MakeRate(0,32,1,$r)   if( defined $r );
+
+  if( defined $t) { 
+    $deadtimePercent = 100 * $t->{$config{CtsAddress}}{rate}[0] * 1e-8;
+   
+    HPlot::PlotAdd('CtsDeadTime',$deadtimePercent,0);
+    
+    my $title    = "Dead Time";
+    my $value    = sprintf("%.2f %%", $deadtimePercent);
+    my $longtext = $value." dead time";
+    my $status   = Dmon::GetQAState('below',$deadtimePercent,(50,80,90));
+    Dmon::WriteQALog($config{flog},"deadtime",5,$status,$title,$value,$longtext,'2-CtsDeadTime');
+    HPlot::PlotDraw('CtsDeadTime');
+  }
+  usleep(8e5);
+}
+