]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
updated hmon files
authorhadaq@countinghouse <hadaq@CountingHouse>
Tue, 10 Jun 2014 14:11:11 +0000 (16:11 +0200)
committerhadaq@countinghouse <hadaq@CountingHouse>
Tue, 10 Jun 2014 14:11:11 +0000 (16:11 +0200)
24 files changed:
hmon/HPlot.pm
hmon/QA.pm
hmon/hmon_busynew.pl
hmon/hmon_diamond.pl [changed mode: 0644->0755]
hmon/hmon_endpoints.pl
hmon/hmon_hadplot.sh [changed from file to symlink]
hmon/hmon_hodo.pl
hmon/hmon_hodo_hist.pl
hmon/hmon_mdchv_plottemplate.pl
hmon/hmon_pionadc.pl
hmon/hmon_pionovfl.pl [new file with mode: 0755]
hmon/hmon_pionpileup.pl [new file with mode: 0755]
hmon/hmon_pionrate.pl
hmon/hmon_pionts.pl [new file with mode: 0755]
hmon/hmon_rate2.pl
hmon/hmon_starthist.pl [changed mode: 0644->0755]
hmon/hmon_trgsource.pl
hmon/index.cgi
hmon/monitor.cgi
hmon/permanent/hmon_archiver.pl [changed mode: 0755->0644]
hmon/permanent/hmon_mdchv.pl
hmon/permanent/hmon_mdcpressure.pl
hmon/permanent/hmon_pionsupply.pl
hmon/start.sh

index 6230a67d6ceed7b9c2aaec185f10eb68765db5de..26af6683e1b6609b0263d061f11565e56b504ab2 100755 (executable)
@@ -135,7 +135,8 @@ sub PlotInit {
   elsif($p->{$name}->{type} == TYPE_BARGRAPH) {
     plot_write($fh,"set style fill   solid 1.00 border -1");
     plot_write($fh,"set grid noxtics ytics");
-    plot_write($fh,"set boxwidth 4 absolute");
+    plot_write($fh,"set boxwidth ".($p->{$name}->{curvewidth}||4)." absolute");
+    plot_write($fh,"set style histogram gap ".($p->{$name}->{bargap}||1));
     if(defined $p->{$name}->{bartitle} && scalar @{$p->{$name}->{bartitle}}) {
       plot_write($fh,"set xtics (",1);
       for(my $j=0; $j<scalar @{$p->{$name}->{bartitle}};$j++) {
@@ -199,7 +200,7 @@ sub PlotDraw {
   if($p->{$name}->{type} == TYPE_BARGRAPH) { 
     for(my $j=0; $j<$p->{$name}->{curves}; $j++) {
       for(my $i=0; $i< $p->{$name}->{entries}; $i++) {
-        plot_write($p->{$name}->{fh},$p->{$name}->{value}->[$j]->[$i]+1E-9);
+        plot_write($p->{$name}->{fh},' '.$p->{$name}->{value}->[$j]->[$i]);
         }
       plot_write($p->{$name}->{fh},"e");
       }
@@ -207,7 +208,6 @@ sub PlotDraw {
       
       
   if($p->{$name}->{type} == TYPE_HEATMAP) {    
-#     for(my $s=0; $s<=$p->{$name}->{showvalues}; $s++) {
       for(my $j=0; $j<$p->{$name}->{curves}; $j++) {
         for(my $i=0; $i< $p->{$name}->{entries}; $i++) {
           plot_write($p->{$name}->{fh},($p->{$name}->{value}->[$j]->[$i]||0)." ",1);
index c6ad492ee4de0a19160c6bb5d01b66a7f785d1e6..9e22721e486227ae92d62a21a2977198a029439b 100644 (file)
@@ -11,7 +11,7 @@ our $cats = {'main'=>"Main",
              'rate'=>"Rate",
              'server'=>"Srv",
              'eb'=>"EB",
-#             'mdc'=>"MDC",
+             'mdc'=>"MDC",
              'endp'=>"Endp",
              'feeerr'=>"Fee",
              'other'=>"Other",
@@ -24,7 +24,7 @@ our $entries->{'cats'} = ["main",
                           "rate",
                           "server",
                           "eb",
-#                          "mdc",
+                          "mdc",
                           "endp",
                           "feeerr",
                           "pion",
@@ -34,15 +34,15 @@ our $entries->{'cats'} = ["main",
 # Order of entries in each cat
 $entries->{'main'}    = ['time', 'rate','onlineqa','up'];
 $entries->{'daq'}     = ['trbnet', 'timeouts', 'busy','readout'];
-$entries->{'trg'}     = ['spill', 'source']; #, 'accepted', 'ptrate', 'start'
+$entries->{'trg'}     = ['spill', 'source','pt1rate',  'start']; #, 'accepted'
 $entries->{'rate'}    = ['pt1','start','hodo','pion1','pion2'];
 $entries->{'server'}  = ['fill', 'cpu', 'icinga', 'etrax', 'pwrsup'];
 $entries->{'eb'}      = ['run', 'rate','bytes', 'lostevt', 'errbits'];
-#$entries->{'mdc'}     = ['token', 'blocked', 'temp', 'linkqual', 'voltage'];
-$entries->{'endp'}    = ['rich', 'tof', 'rpc', 'other'];                       #'mdc'
+$entries->{'mdc'}     = ['token', 'blocked', 'temp', 'linkqual', 'voltage'];
+$entries->{'endp'}    = ['mdc','rich', 'tof', 'rpc', 'other'];
 $entries->{'feeerr'}  = ['rich', 'trb', 'feeerr','trginp','trgqual'];
-$entries->{'other'}   = ['speech','rich'];                                     #'magnet','mdcinvalid','shower'
-$entries->{'pion'}    = ['nxstatus', 'HV', 'cooling'];
+$entries->{'other'}   = ['speech','rich','mdcinvalid'];                                        #'magnet','shower'
+$entries->{'pion'}    = ['nxstatus', 'HV', 'HVcurr', 'cooling'];
 
 
 our $QAServer = "hades33";
index 65d07e39b8c6bfa8a21a78f1bcd3d2127b7fe70a..dd27ca62615c81d680532361afa8a3f0d207bb34 100755 (executable)
@@ -101,12 +101,12 @@ while (1) {
   if (defined $old) {
     foreach my $b (keys %$o) {
       for my $v (0..7) {
-        my $tdiff = $o->{$b}->{time}->[$v] - $old->{$b}->{time}->[$v];
+        my $tdiff = ($o->{$b}->{time}->[$v]||0) - ($old->{$b}->{time}->[$v]||0);
         if ($tdiff < 0) { $tdiff += 2**16;}
         $tdiff *= 16;
-        my $vdiff = $o->{$b}->{value}->[$v] - $old->{$b}->{value}->[$v];
+        my $vdiff = ($o->{$b}->{value}->[$v]||0) - ($old->{$b}->{value}->[$v]||0);
         if ($vdiff < 0) { $vdiff += 2**32;}
-        $diff->{$b}->[$v] = $vdiff/($tdiff|1);
+        $diff->{$b}->[$v] = $vdiff/($tdiff||1);
         }
       }
 
old mode 100644 (file)
new mode 100755 (executable)
index bb06b48..a97b324
@@ -77,28 +77,28 @@ Hmon::WriteFile("DiamondRate",$str);
 #    4    1    19   1    1    1    1    1    2    5000    03
 #    4    2    20   1    1    9    9    1    6    5000    0b
 #    4    3    21   2    1    7    7    2    5    5000    19
-#    4    4    22   2    3    13  13    6    8    5003    1f
-#    4    5    23   1    3    7    7    5    5    5003    09 !!!!!!
+#    4    4    22   2    3    13  13    6    2    5003    13
+#    4    5    23   1    3    7    7    5    5    5003    09
 #    4    6    24   1    2    13  13    3    8    5002    0f  
 
 #    5    1    25   2    1    5    5    2    4    5000    17
-#    5    2    26   2    3    11  11    6    7    5003    1d
+#    5    2    26   2    3    11  11    6    3    5003    15
 #    5    3    27   1    1    5    5    1    4    5000    07
 #    5    4    28   1    3    9    9    5    4    5003    07
-#    5    5    29   2    3    1    3    6    3    5003    15
-#    5    6    30   2    3    3    5    6    4    5003    17
+#    5    5    29   2    3    1    3    6    7    5003    1d
+#    5    6    30   2    3    3    5    6    4    5003    1b
 
 #    6    1    31   2    1    1    1    2    2    5000    13
 #    6    2    32   2    1    3    3    2    3    5000    15
 #    6    3    33   1    3    13  13    5    2    5003    03
 #    6    4    34   1    3    11  11    5    3    5003    05
-#    6    5    35   2    3    9    9    6    6    5003    1b
-#    6    6    36   2    3    7    7    6    5    5003    19 !!!!!!
+#    6    5    35   2    3    9    9    6    4    5003    17
+#    6    6    36   2    3    7    7    6    5    5003    19
 
 my $fpga = [[0,   2,   2,   2,   2,   2   ],[0,   0,   0,   2,   2,   2   ],[0,   0,   2,   2,   2,   2   ],
             [0,   0,   0,   3,   3,   2   ],[0,   3,   0,   3,   3,   3   ],[0,   0,   3,   3,   3,   3   ]];
 my $chan = [[0x1f,0x17,0x07,0x03,0x19,0x1d],[0x1d,0x1b,0x0f,0x05,0x15,0x1f],[0x05,0x0d,0x13,0x1b,0x0d,0x0b],
-            [0x03,0x0b,0x19,0x1f,0x09,0x0f],[0x17,0x1d,0x07,0x07,0x15,0x17],[0x13,0x15,0x03,0x05,0x1b,0x19]];
+            [0x03,0x0b,0x19,0x13,0x09,0x0f],[0x17,0x15,0x07,0x07,0x1d,0x1b],[0x13,0x15,0x03,0x05,0x17,0x19]];
 
 my $old;
 my $oldtime = time();
@@ -106,12 +106,13 @@ my $time = time();
 my $diff;
 my $iter = 0;
 
+$ENV{'DAQOPSERVER'} = "xboxp:6";
 trb_init_ports() or die trb_strerror();
 
 
 while (1) {
   my $o;
-  foreach my $b (0x5000,0x5002,0x5003) {
+  foreach my $b (0x50f0,0x50f2,0x50f3) {
     my $t = trb_register_read_mem($b,0xc000,0,33);
     $o->{$b} = $t->{$b};
     }
@@ -129,7 +130,7 @@ while (1) {
 
     for my $x (0..5) {
       for my $y (0..5) {
-        HPlot::PlotFill('DiamondRate',$diff->{$fpga->[$y]->[$x]+0x5000}->[$chan->[$y]->[$x]],$x+1,$y+1);
+        HPlot::PlotFill('DiamondRate',$diff->{$fpga->[$y]->[$x]+0x50f0}->[$chan->[$y]->[$x]],$x+1,$y+1);
         }
       }
     HPlot::PlotDraw('DiamondRate');      
index 0f97d9fdbdc077796fcebc06703698b1589b7c29..cd4fbe9fe5457ab65daf5acc3aeaaa544cf7b456 100755 (executable)
@@ -24,33 +24,33 @@ while(1) {
     my @all_boards =();
     my @mdc_boards =(
        ###OEPS
-       # 0x2010,0x2011,0x2012,0x2013,0x2014,0x2015,0x2016,0x2017,0x2018,0x2019,0x201a,
-       # 0x201b,0x201c,0x201d,0x2020,0x2021,0x2022,0x2023,0x2024,0x2025,0x2026,0x2027,
-       # 0x2028,0x2029,0x202a,0x202b,0x202c,0x202d,0x2030,0x2031,0x2032,0x2033,0x2034,
-       # 0x2035,0x2036,0x2037,0x2038,0x2039,0x203a,0x203b,0x203c,0x203d,0x2040,0x2041,
-       # 0x2042,0x2043,0x2044,0x2045,0x2046,0x2047,0x2048,0x2049,0x204a,0x204b,0x204c,
-       # 0x204d,0x2050,0x2051,0x2052,0x2053,0x2054,0x2055,0x2056,0x2057,0x2058,0x2059,
-       # 0x205a,0x205b,0x205c,0x205d,0x2100,0x2101,0x2102,0x2103,0x2104,0x2105,0x2106,
-       # 0x2107,0x2108,0x2109,0x210a,0x210b,0x210c,0x210d,0x210e,0x210f,0x2110,0x2111,
-       # 0x2112,0x2113,0x2114,0x2115,0x2116,0x2117,0x2118,0x2119,0x211a,0x211b,0x211c,
-       # 0x211d,0x211e,0x211f,0x2120,0x2121,0x2122,0x2123,0x2124,0x2125,0x2126,0x2127,
-       # 0x2128,0x2129,0x212a,0x212b,0x212c,0x212d,0x212e,0x212f,0x2130,0x2131,0x2132,
-       # 0x2133,0x2134,0x2135,0x2136,0x2137,0x2139,0x213a,0x213b,0x213c,0x213d,0x213e,
-       # 0x213f,0x2140,0x2141,0x2142,0x2143,0x2144,0x2145,0x2146,0x2147,0x2148,0x2149,
-       # 0x214a,0x214b,0x214c,0x214d,0x214e,0x214f,0x2150,0x2151,0x2152,0x2153,0x2154,
-       # 0x2155,0x2156,0x2157,0x2158,0x2159,0x215a,0x215b,0x215c,0x215d,0x215e,0x215f,
-       # 0x2200,0x2201,0x2202,0x2203,0x2204,0x2205,0x2206,0x2207,0x2208,0x2209,0x220a,
-       # 0x220b,0x220c,0x220d,0x220e,0x220f,0x2220,0x2221,0x2222,0x2223,0x2224,0x2225,
-       # 0x2226,0x2227,0x2228,0x2229,0x222a,0x222b,0x222c,0x222d,0x222e,0x222f,0x2240,
-       # 0x2241,0x2242,0x2243,0x2244,0x2245,0x2246,0x2247,0x2248,0x2249,0x224a,0x224b,
-       # 0x224c,0x224d,0x224e,0x224f,0x2250,0x2251,0x2252,0x2253,0x2254,0x2255,0x2256,
-       # 0x2257,0x2258,0x2259,0x225a,0x225b,0x225c,0x225d,0x225e,0x225f,0x2300,0x2301,
-       # 0x2302,0x2303,0x2304,0x2305,0x2306,0x2307,0x2308,0x2309,0x230a,0x230b,0x230c,
-       # 0x230d,0x230e,0x230f,0x2320,0x2321,0x2322,0x2323,0x2324,0x2325,0x2326,0x2327,
-       # 0x2328,0x2329,0x232a,0x232b,0x232c,0x232d,0x232e,0x232f,0x2340,0x2341,0x2342,
-       # 0x2343,0x2344,0x2345,0x2346,0x2347,0x2348,0x2349,0x234a,0x234c,0x234d,0x234e,
-       # 0x234f,0x2350,0x2351,0x2352,0x2353,0x2354,0x2355,0x2356,0x2357,0x2358,0x2359,
-       # 0x235a,0x235b,0x235c,0x235d,0x235e,0x235f,
+        0x2010,0x2011,0x2012,0x2013,0x2014,0x2015,0x2016,0x2017,0x2018,0x2019,0x201a,
+        0x201b,0x201c,0x201d,0x2020,0x2021,0x2022,0x2023,0x2024,0x2025,0x2026,0x2027,
+        0x2028,0x2029,0x202a,0x202b,0x202c,0x202d,0x2030,0x2031,0x2032,0x2033,0x2034,
+        0x2035,0x2036,0x2037,0x2038,0x2039,0x203a,0x203b,0x203c,0x203d,0x2040,0x2041,
+        0x2042,0x2043,0x2044,0x2045,0x2046,0x2047,0x2048,0x2049,0x204a,0x204b,0x204c,
+        0x204d,0x2050,0x2051,0x2052,0x2053,0x2054,0x2055,0x2056,0x2057,0x2058,0x2059,
+        0x205a,0x205b,0x205c,0x205d,0x2100,0x2101,0x2102,0x2103,0x2104,0x2105,0x2106,
+        0x2107,0x2108,0x2109,0x210a,0x210b,0x210c,0x210d,0x210e,0x210f,0x2110,0x2111,
+        0x2112,0x2113,0x2114,0x2115,0x2116,0x2117,0x2118,0x2119,0x211a,0x211b,0x211c,
+        0x211d,0x211e,0x211f,0x2120,0x2121,0x2122,0x2123,0x2124,0x2125,0x2126,0x2127,
+        0x2128,0x2129,0x212a,0x212b,0x212c,0x212d,0x212e,0x212f,0x2130,0x2131,0x2132,
+        0x2133,0x2134,0x2135,0x2136,0x2137,0x2139,0x213a,0x213b,0x213c,0x213d,0x213e,
+        0x213f,0x2140,0x2141,0x2142,0x2143,0x2144,0x2145,0x2146,0x2147,0x2148,0x2149,
+        0x214a,0x214b,0x214c,0x214d,0x214e,0x214f,0x2150,0x2151,0x2152,0x2153,0x2154,
+        0x2155,0x2156,0x2157,0x2158,0x2159,0x215a,0x215b,0x215c,0x215d,0x215e,0x215f,
+        0x2200,0x2201,0x2202,0x2203,0x2204,0x2205,0x2206,0x2207,0x2208,0x2209,0x220a,
+        0x220b,0x220c,0x220d,0x220e,0x220f,0x2220,0x2221,0x2222,0x2223,0x2224,0x2225,
+        0x2226,0x2227,0x2228,0x2229,0x222a,0x222b,0x222c,0x222d,0x222e,0x222f,0x2240,
+        0x2241,0x2242,0x2243,0x2244,0x2245,0x2246,0x2247,0x2248,0x2249,0x224a,0x224b,
+        0x224c,0x224d,0x224e,0x224f,0x2250,0x2251,0x2252,0x2253,0x2254,0x2255,0x2256,
+        0x2257,0x2258,0x2259,0x225a,0x225b,0x225c,0x225d,0x225e,0x225f,0x2300,0x2301,
+        0x2302,0x2303,0x2304,0x2305,0x2306,0x2307,0x2308,0x2309,0x230a,0x230b,0x230c,
+        0x230d,0x230e,0x230f,0x2320,0x2321,0x2322,0x2323,0x2324,0x2325,0x2326,0x2327,
+        0x2328,0x2329,0x232a,0x232b,0x232c,0x232d,0x232e,0x232f,0x2340,0x2341,0x2342,
+        0x2343,0x2344,0x2345,0x2346,0x2347,0x2348,0x2349,0x234a,0x234c,0x234d,0x234e,
+        0x234f,0x2350,0x2351,0x2352,0x2353,0x2354,0x2355,0x2356,0x2357,0x2358,0x2359,
+        0x235a,0x235b,0x235c,0x235d,0x235e,0x235f,
        # ###MDC Concentrator
        0x1000,0x1001,0x1002,0x1003,0x1004,0x1010,0x1011,0x1012,0x1013,0x1014,0x1020,
        0x1021,0x1022,0x1023,0x1024,0x1030,0x1031,0x1032,0x1033,0x1034,0x1040,0x1041,0x1042,0x1043,0x1044,0x1050,
@@ -106,9 +106,9 @@ while(1) {
        #start/veto hub
        0x8800,0x8801,
        #fw
-#      0x4400,0x4410,0x4420,
+       0x4400,0x4410,0x4420,
        #fw hub
-#      0x8700,0x8701,
+       0x8700,0x8701,
        #Pion
        0x8900,0x3800,0x3801,
        0x8910,0x3810,0x3811,
@@ -148,12 +148,12 @@ while(1) {
 
 
      my $qastate = QA::GetQAState('below',$num_mdc_missing,@QA::MdcEndpMissingLimits);
-#    Hmon::Speak('mdcmiss',"$num_mdc_missing MDC Frontends missing") if($qastate > 60);
-#    QA::WriteQALog($flog,"endp","mdc",$waittime,$qastate,$title,$value,$longtext);
-#    if($qastate > 60) {
-#      system("logger -p local1.info -t DAQ Endp \\<E\\> $longtext") unless (($timecnt->{mdc}++)%$loggerperiod);
-#      }
-#    else {$timecnt->{mdc} = 0;}
+    Hmon::Speak('mdcmiss',"$num_mdc_missing MDC Frontends missing") if($qastate > 60);
+    QA::WriteQALog($flog,"endp","mdc",$waittime,$qastate,$title,$value,$longtext);
+    if($qastate > 60) {
+      system("logger -p local1.info -t DAQ Endp \\<E\\> $longtext") unless (($timecnt->{mdc}++)%$loggerperiod);
+      }
+    else {$timecnt->{mdc} = 0;}
     
     ###rich
     my(%rich_mask, @rich_results);
deleted file mode 100755 (executable)
index d1e92770ed247d0c2e0dc6fce63d972606b934e7..0000000000000000000000000000000000000000
+++ /dev/null
-#!/usr/bin/perl -w
-use warnings;
-
-use FileHandle;
-use Time::HiRes qw( gettimeofday usleep time );
-use Getopt::Long;
-use Data::Dumper;
-use POSIX qw/floor strftime/;
-
-use constant AXISISTIME => 1;
-use constant AXISISNOTIME => 0;
-use constant DIFFY => 1;
-use constant DIFFX => 1;
-use constant NODIFFY => 0;
-use constant NODIFFX => 0;
-use constant NODELAY => 0;
-use constant NO => 0;
-use constant YES => 1;
-use constant NONEWLINE => 1;
-
-my $GPbuffer = "";
-my $buffercount = 0;
-
-my $windowtitle = ""; #Global var to store real name of GUI window
-
-my $PlotBuffer = {};
-my $PlotBufferCnt = 0;
-
-my @PlotBufArr = ();
-
-#my @color = ("#1155bb","#bb1111","#999900","#660000","#006633","#990066","#6633CC","#00CCCC");
-my @color = ("#2222dd","#880000","#00cc00","#ee00dd","#ffcc00","#00cc88","#6633CC","#00CCCC");
-our $write2file = "";
-our $plotendedbefore = 0;
-
-
-
-#################################################
-# Variables...
-#################################################
-my $delay     = 1000;
-my $samples   = 100; 
-my $downscale = 1;
-# my $system    = 0;
-my $address   = [];
-my $register  = [];
-my $regoffset = [];
-my $regwidth  = [];
-my $title     = [];
-my $timeref   = [];
-my $geom      = "700x400";
-my $style     = 0;
-my $nametmp   = "";
-my $regamount = [];
-my $xscale   = [];
-my $yscale   = [];
-my $xtitle   = "";
-my $ytitle   = "";
-my $windowname = "No Name";
-my $xistime  = AXISISNOTIME;
-my $xoverflow = [];
-my $yoverflow = [];
-my $ydiff     = 0;
-my $outputcfg = "";
-my $name      = "HadPlot";
-my $key       ;     
-my $curvestyle= 'points';  #points, steps, histo or histostacked
-my $xticks    = 0;  #show labels on x-axis
-my $yticks    = 1;  #show labels on y-axis
-my $plotoption= ""; #string with additional gnuplot commands
-my $curveoption= []; #options for plot command
-my $xgrid     = 1;
-my $ygrid     = 1;
-my $ymax;
-my $ymin;
-my $xmin;
-my $xmax;
-
-GetOptions('d=i' => \$delay,
-           'n=i' => \$samples,
-           'o=i' => \$downscale,
-           'a=s' => $address,
-           'r=s' => $register,
-           'w=i' => $regwidth,
-           'p=i' => $regoffset,
-           't=s' => $title,
-           'm=i' => $regamount,
-           'g=s' => \$geom,
-           'z=i' => \$style,
-           'output=s'     => \$outputcfg,
-           'windowname=s' => \$windowname,
-           'xscale=f'     => $xscale,
-           'yscale=f'     => $yscale,
-           'xtitle=s'     => \$xtitle,
-           'ytitle=s'     => \$ytitle,
-           'xistime!'     => \$xistime,
-           'timeref=s'    => $timeref,
-           'xoverflow=f'  => $xoverflow,
-           'yoverflow=f'  => $yoverflow,
-           'ydiff!'       => \$ydiff,
-           'name=s'       => \$name,
-           'key!'         => \$key,
-           'xticks!'      => \$xticks,
-           'yticks!'      => \$yticks,
-           'xgrid!'       => \$xgrid,
-           'ygrid!'       => \$ygrid,
-           'ymax=i'       => \$ymax,
-           'ymin=i'       => \$ymin,
-           'xmax=i'       => \$xmax,
-           'xmin=i'       => \$xmin,           
-           'curvestyle=s' => \$curvestyle,
-           'curveoption=s'=> $curveoption,
-           'plotoption=s' => \$plotoption
-           );
-
-for(my $i=0;$i<16;$i++) {
-       $regoffset->[$i]   = 0  unless defined $regoffset->[$i];
-       $regwidth->[$i]    = 32 unless defined $regwidth->[$i];
-       $xoverflow->[$i]   = 2**20 unless defined $xoverflow->[$i];
-       $yoverflow->[$i]   = 2**32 unless defined $yoverflow->[$i];
-       $xscale->[$i]      = 1 unless defined $xscale->[$i];
-       $yscale->[$i]      = 1 unless defined $yscale->[$i];
-       $title->[$i]       = "" unless defined $title->[$i];
-       $curveoption->[$i] = ""  unless defined $curveoption->[$i];
-       }
-
-for(my $i=0;$i < scalar @{$address};$i++) {
-  if(!defined($title->[$i])) {
-               $title->[$i] = hex($address->[$i])." $register->[$i] $regoffset->[$i]..".($regoffset->[$i]+$regwidth->[$i]-1);
-               }
-       }
-
-
-$delay *= 1000;
-if($style == 1) {$curvestyle="points";     $xticks=1;}
-if($style == 2) {$curvestyle="histo";      $xticks=0;}
-if($style == 3) {$curvestyle="histo";      $xticks=1;}
-if($style == 4) {$curvestyle="histostacked";      $xticks=0;}
-if($style == 5) {$curvestyle="histostacked";      $xticks=1;}
-
-
-
-#Open Gnuplot
-our $fh;
-my $fn = "gnuplot -geometry $geom -bg 'ghost white'";
-$fh = new FileHandle ("|$fn") or  die "error: no gnuplot";
-$fh->autoflush(1);
-
-
-sub makeTimeString{
-  return strftime("set label 100 \"%H:%M:%S\" at screen 0.02,0.02 left tc rgb \"#000044\" font \"monospace,8\"\n", localtime())
-  }
-
-#################################################
-# When exiting, close Gnuplot window
-#################################################
-sub finish {
-  print $fh "exit;\n";
-  close $fh;
-  exit;
-}
-
-$SIG{INT} = \&finish;
-$SIG{PIPE} = \&finish;
-
-
-
-my $last_wakeup;
-
-sub max {
-  my $a = shift;
-  my $b = shift;
-  return $a > $b ? $a : $b;
-  }
-
-sub min {
-  my $a = shift;
-  my $b = shift;
-  return $a < $b ? $a : $b;
-  }
-
-sub usleep_total {
-  my $delay = shift;
-  if(defined $last_wakeup) {
-    my $time = time();
-#     printf "%.0f\n",$delay-($time-$last_wakeup)*1E6;
-    usleep(max(0,$delay-($time-$last_wakeup)*1E6));
-    }
-  else {
-    usleep($delay);
-    }
-  $last_wakeup = time();
-  return $last_wakeup;
-  }
-
-
-#################################################
-# Write to gnuplot
-#################################################
-sub plot_write {
-  my ($str,$no) = @_;
-  if(defined($no) && $no) {
-    print $fh $str;
-#     print $str;
-    }
-  else {
-    print $fh $str."\n";
-#     print $str."\n";
-    }
-  }
-
-sub plot_add {
-  my ($x,$y) = @_;
-  $x = $x || $PlotBufferCnt;
-  $PlotBufArr[$PlotBufferCnt]->{x} = $x;
-  $PlotBufArr[$PlotBufferCnt]->{y} = $y;
-  
-  $PlotBufferCnt++;
-#   $PlotBuffer->{$x} = $y;
-#   print $x." ".$y."\n";
-  }
-  
-sub plot_end {
-  my ($single) = @_;
-  for(my $i = 0;$i<scalar @PlotBufArr;$i++) {
-    if($single) {
-      print $fh $PlotBufArr[$i]->{y}."\n";
-      }
-    else {
-      print $fh $PlotBufArr[$i]->{x}." ".$PlotBufArr[$i]->{y}."\n";
-      }
-    }
-#   foreach my $line (sort keys %{$PlotBuffer}) {
-#     if($single) {
-#       print $fh $PlotBuffer->{$line}."\n";
-# #       print     "plot_end: ".$PlotBuffer->{$line}."\n";
-#       }
-#     else {
-#       print $fh $line." ".$PlotBuffer->{$line}."\n";
-# #       print     "plot_end: ".$line." ".$PlotBuffer->{$line}."\n";
-#       }
-#     }
-  @PlotBufArr = ();
-  $PlotBuffer = {};
-  $PlotBufferCnt = 0;
-  print $fh "e\n";
-  $plotendedbefore = 1 unless $plotendedbefore;
-  }  
-
-
-sub plot_reset {
-  if($write2file eq ""){
-    system("xwininfo -name '$windowtitle' >/dev/null 2>/dev/null");
-               #print $?."\n";
-               if($? != 0) {
-                       usleep(1E5);
-                       system("xwininfo -name '$windowtitle' >/dev/null 2>/dev/null");
-                       if($? != 0) {
-                               finish();
-                               }
-                       }
-    if ($plotendedbefore != 0) {
-                       $plotendedbefore = 0;
-#                         my $datestring = makeTimeString();
-                        print $fh makeTimeString();                    
-                        print $fh "replot\n";
-                       }
-               }
-       else {
-    if ($plotendedbefore != 0) {
-                       system("mv $write2file.tmp $write2file");
-      plot_write("set out \"$write2file.tmp\"\n");
-      $plotendedbefore = 0;
-#       my $datestring = makeTimeString();
-      print $fh makeTimeString();
-      print $fh "replot\n";
-      
-#       print "reset\n";
-      }
-               }
-  }  
-
-sub plot_finished {
-       my ($store) = @_;
-       if($write2file ne "") {
-               if(defined $store) {
-                       if($store->{"initing"} != 2 and $store->{"iteration"} % $store->{"downscale"} == 0) {
-#                              system("mv $write2file.tmp $write2file");
-                               }
-                       }
-               else {
-                       if($write2file ne "") {
-#                              system("mv $write2file.tmp $write2file");
-                               }
-                       }
-               }
-       }
-
-sub plot_init {
-  my ($xtics) = @_;
-  $windowtitle = $name ." - ".$windowname;
-  if ($outputcfg =~ m$PNG.([/\w]*).(\d+).(\d+)$) {
-               print "Writing PNG to file $1\n";
-               $write2file = $1.".png";
-               plot_write("set term png size $2,$3 font \"monospace,8\"");
-               plot_write("set out \"$write2file.tmp\"");
-               }
-  elsif ($outputcfg =~ m$SVG.([/\w]*).(\d+).(\d+)$) {
-               print "Writing SVG to file $1\n";
-               $write2file = $1.".svg";
-               plot_write("set term svg size ".($2*2).",".($3*2)." dynamic font \"monospace,18\" lw 1.5 \n");
-               plot_write("set out \"$write2file.tmp\"\n");
-               }
-       else {
-    plot_write("set term x11 title '$windowtitle'");
-               }
-  plot_write("set grid");
-  plot_write("set xlabel \"$xtitle\"");
-  plot_write("set ylabel \"$ytitle\"");
-  
-  plot_write(makeTimeString());
-  
-  if(defined $xtics) {
-    plot_write("set xtics $xtics\n");
-    }
-  if(defined $xmin && defined $xmax) {
-    plot_write("set xrange [$xmin:$xmax]");
-    }
-  if(defined $ymin && defined $ymax) {
-    plot_write("set yrange [$ymin:$ymax]");
-    }
-  elsif(defined $ymax) {
-    plot_write("set yrange [:$ymax]");
-    }
-  elsif(defined $ymin) {
-    plot_write("set yrange [$ymin:]");
-    }
-  if (!defined $key || $key == 0) {
-               plot_write("unset key");
-               }
-       if($xgrid == 0) {
-         plot_write("set grid noxtics");
-               }
-       if($ygrid == 0) {
-         plot_write("set grid noytics");
-               }
-       if($plotoption ne "") {
-               plot_write($plotoption);
-               }
-  }
-
-sub plot_sleep {
-  my ($delay) = @_;
-  my $t = usleep_total($delay);
-  plot_reset();
-  return $t;
-  }
-
-sub plot_end_sleep {
-  my ($delay,$single) = @_;
-  plot_end($single);
-  return plot_sleep($delay);
-  }
-
-sub plot_storage_end_sleep {
-  my ($store, $single) = @_;
-  my $delay = $store->{"delay"};
-  my $t;
-  if($store->{"initing"} == 0) {
-    if($store->{"iteration"} % $store->{"downscale"} == 0) {
-      plot_end($single);
-      $t = usleep_total($delay);
-      plot_reset();
-      }
-    else {
-      $t = usleep_total($delay);
-      }
-    }
-  return $t;
-  }
-
-sub plot_storage_sleep {
-  my ($store,$noreset) = @_;
-  my $t;
-  my $delay = $store->{"delay"};
-  #print $store->{"initing"}.$store->{"iteration"}.$store->{"downscale"}."\n";
-  if($store->{"initing"} != 2) {
-    if($store->{"iteration"} % $store->{"downscale"} == 0) {
-      $t = usleep_total($delay);
-      plot_storage_reset() unless $noreset;
-      }
-    else {
-      $t = usleep_total($delay);
-      }
-    }
-  return $t;
-  }
-
-sub plot_storage_reset {
-  my ($store) = @_;
-  if(defined $store->{"initing"} && $store->{"initing"} != 2) {
-    if($store->{"iteration"} % $store->{"downscale"} == 0) {
-      plot_reset();
-      }
-    }
-  }
-  
-sub plot_storage_end {
-  my ($store) = @_;
-  if($store->{"initing"} == 0) {
-    if($store->{"iteration"} % $store->{"downscale"} == 0) {
-      plot_end();
-      }
-    }
-  }
-
-#################################################
-# Writes a new value pair to storage
-#################################################
-sub store_push {
-  my ($storage,$x,$y,$divtime) = @_;
-  my $xval = $x;
-  my $yval = $y;  
-  my $curtime = time();
-  
-  if ($storage->{"initing"} != 2) {
-    if (scalar(@{$storage->{"datax"}}) == $storage->{"size"}) {
-      my $tmp = shift(@{$storage->{"datax"}});
-      my $tmpy = shift(@{$storage->{"datay"}});
-      $storage->{"totalx"} -= $tmp;
-#       if($storage->{"initing"} == 0 && (($tmpy <= $storage->{"miny"}) || ($tmpy >= $storage->{"maxy"}))) {
-#         store_calc_range($storage);
-#         }
-      }  
-    if($storage->{"diffx"}) {
-      if(defined($storage->{"xmax"}) && $x < $storage->{"lastx"}) {
-        $xval = ($x - $storage->{"lastx"}  + $storage->{"xmax"});
-        }
-      else {
-        $xval = ($x - $storage->{"lastx"});
-        }
-      if(defined($storage->{"last_push"}) &&  $storage->{"last_push"} != 0) {
-        while (floor($xval/$storage->{"xmax"}) < floor(($curtime - $storage->{"last_push"})/($storage->{"xmax"}/1E6))){
-          $xval += $storage->{"xmax"};
-          }
-        }
-      }
-    if($storage->{"diffy"}) {
-                       $yval = $y - $storage->{"lasty"};
-      if(defined($storage->{"ymax"}) && $y < $storage->{"lasty"}) {
-        while($yval < 0) {
-                                       $yval += $storage->{"ymax"};
-                                       }
-        }
-      if($divtime) {  
-        $yval /= ($xval?$xval:1)/1000000;
-        }
-      }
-
-    
-    if($storage->{"initing"} == 1) {
-      $storage->{"initing"} = 0;
-      for(my $i = $storage->{"size"}-1; $i>0; $i--) {
-        push(@{$storage->{"datax"}},$storage->{"delay"});
-        push(@{$storage->{"datay"}},$yval);
-        $storage->{"totalx"} += $storage->{"delay"};         
-        }
-      }
-    
-    push(@{$storage->{"datax"}},$xval?$xval:0);
-    push(@{$storage->{"datay"}},$yval?$yval:0);
-    $storage->{"totalx"} += $xval?$xval:0;
-    }
-  else {
-    $storage->{"initing"} = 1;
-    }
-
-  $storage->{"last_push"} = $curtime;
-  $storage->{"lasty"} = $y;
-  $storage->{"lastx"} = $x;
-  }
-
-#################################################
-# Writes storage contents to stream
-#################################################
-sub store_print {
-  my $str = "";
-  my ($storage) = @_;
-  if($storage->{"initing"} != 2) {
-    if($storage->{"iteration"} % $storage->{"downscale"} == 0) {
-      my $xcnt = - $storage->{"totalx"} /1000000.0;
-      for (my $i = 0; $i < $storage->{"size"}; $i++) {
-        my $xval = $storage->{"datax"}->[$i];  #${}[]
-        my $yval = $storage->{"datay"}->[$i];
-        $xval = 0 unless defined($xval);
-        $yval = 0 unless defined($yval);
-        $xcnt += $xval/1000000.0;
-#        $str .= $xcnt." ".$yval."\n";
-        $str .= sprintf "%.3f %.2f\n", $xcnt,$yval;
-        #plot_write($xcnt/1000000.0." ".$yval);
-        }
-      plot_write($str,1);  
-#       print $str;
-      plot_end(1);
-      }
-    $storage->{"iteration"}++;
-    }
-  }
-
-
-#################################################
-# Initialize storage
-#################################################
-sub store_init {
-  my ($storage,$size,$diffx,$diffy,$delay,$downscale,$xmax,$ymax) = @_;
-  
-  $storage->{"datax"} = [];
-  $storage->{"datay"} = [];
-  $storage->{"size"}  = $size;
-  $storage->{"diffx"} = $diffx;
-  $storage->{"diffy"} = $diffy;
-  $storage->{"delay"} = $delay;
-  $storage->{"downscale"} = $downscale;
-  $storage->{"initing"}   = 2;
-  $storage->{"iteration"} = 0;
-  $storage->{"totalx"}    = 0;
-  $storage->{"xmax"}      = $xmax;
-  $storage->{"ymax"}      = $ymax;
-  $storage->{"maxy"} = 0;
-  $storage->{"miny"} = 1E100;
-  $storage->{"last_push"} = 0;
-  $storage->{"last_sleep"}  = 0;
-  }
-
-#################################################
-# Help Message
-#################################################
-sub help {
-  print <<EHELP;
-  hadplot plots values...
-  --------------------------------------------
-  Usage: hadplot [-d int] [-n int] [-o int]
-  \t\t [-a int -r int -w int -p int [-m int] [-t str]]*
-  \t\t [-output str] [-windowname str] [-(no)key] [-g geometry] [-z style]
-  \t\t [-curvestyle str] [-curveoption str] [-plotoption str]
-  \t\t [-xscale int] [-xmax int] [-xtitle str] [-(no)xticks] [-(no)xgrid] [-xoverflow float]
-  \t\t [-yscale int] [-ymax int] [-ytitle str] [-(no)yticks] [-(no)ygrid] [-yoverflow float]
-  \t\t  command
-  
-Options:
-  command         One of the commands listed below
-  -d delay        Time to sleep between readings in milliseconds
-  -n samples      Number of samples to store / display in histogram
-  -d downscaling  Replot histogram only every nth iteration
-  -g geometry     Size of the plot window in pixels
-  -a address      Board address when using generic option 
-  -p register     Register address when using generic option
-  -w regwidth     Width in bits of the value to plot
-  -r regoffset    Offset of the value to plot in the register
-  -z style        Selects one of the possible styles (deprecated)
-  -output         expects a string "(PNG|SVG).\$filename.\$xsize.\$ysize" to write to a file
-  -windowname     Name of window (shown in titlebar after "Hadplot - "
-  -timeref        In a differential plot, the endpoint with this addressis used for timestamping
-  -(x|y)scale     Scaling factor, the x/y values are divided by
-  -(x|y)max       Maximal value for x/y axis
-  -(x|y)title     Label for axes
-  -xistime        Marks x axis as containing time stamps (used for formatting)
-  -(no)(x|y)ticks Switches tick marks on axes on or off (e.g. OEP addresses / values)
-  -(no)(x|y)grid  Switches grid lines on or off
-  -(x|y)overflow  The value at which the register content has an overflow
-  -ydiff          Plot differences of register contents on y-axis
-  -(no)key        Show key for all plots
-  -curvestyle     Plot type: points, histo, histostacked, steps
-  -curveoption    Additional options given to the plot command (per curve)
-  -plotoption     Additional commands given to gnuplot
-  
-EHELP
-
-     
-  print "\nAvailable commands:\n";
-  print "\thelp\t\tPrints this message\n";
-  print "\trpcdatarate\tNumber of sent and received data words (RPC only)\n";
-  print "\toeptemp\t\tDisplays temperatures (OEP only)\n";
-  print "\toep5V\t\tShows the input and output voltages of 5V (OEP only)\n";
-  print "\toep3.3V\t\tShows the input and output voltages of 3.3V (OEP only)\n";
-  print "\toep1.2V\t\tShows the input and output voltages of 1.2V (OEP only)\n";
-  print "\toep3V\t\tShows the input  voltages of +-3V (OEP only)\n";
-  print "\tdatarate\tshows a histogram of data rates\n";
-  print "\teventrate\tHistogram of the trigger rate\n";
-  print "\tbusytime\tHistogram of busy times\n";
-  print "\tbusy\t\tBargraph of busy times\n";
-  print "\tfilllevel\tFill level of data buffers in all endpoints\n";
-  print "\toepfill\t\tFill level of OEP buffers\n";
-  print "\tshowerfill\tFill level of Shower buffers\n";
-  print "\toepspikehist\tSpike histogram of OEP CMS input\n";
-  print "\toepworktime\tStatistics about states of the OEP trigger handler\n";
-  print "\toeptrgerr\tNumbers of errors on CMS for indivual OEP\n";
-  print "\toeptrgerrhist\tHistory of errors on CMS of OEP\n";
-  print "\toepretr\t\tRetransmission statistics for individual OEP\n";
-  print "\toepretrhist\tHistory of retransmissions on OEP\n";
-  print "\toeptokenmiss\tNumber of missing tokens on OEP\n";
-  print "\toepwords\t\tNumber of data words sent by OEP\n";
-  print "\tmdcchannel\tData counters per TDC channel for MDC\n";
-  print "\tmdcchanneldiff\tdata counters per TDC channel for MDC, changes only\n";
-  print "\tgberate\t\tAmount of data sent by GbE links\n";
-  print "\ttimecmslvl1\tTime between CMS and LVL1 trigger on OEP\n";
-#  print "\t\t\n";
-  
-  print "\n";
-  print "\treg\t\tPrint any specified register from addressed boards\n";
-  print "\tregdiff\t\tPrint the changes of any specified register from addressed boards\n";
-  print "\thist\t\tShows a histogram of the specified value \n";
-  print "\thistdiff\tShows a histogram of the changes of the specified value\n";
-  print "\n\n";
-  }
-
-
-
-#################################################
-# Generic Register
-#################################################
-sub bitmap {
-  my ($delay,$address,$register,$regamount,$regoff,$regwidth,$title,$style,$name) = @_;
-  $style = 0 unless defined $style;
-  for(my $i = 0; $i<scalar(@{$address});$i++) {
-#     if(!(defined($title->[$i])) || ($title->[$i] eq "")) {
-#       $title->[$i] = hex($address->[$i])." ".$register->[$i]." ".$regoff->[$i]."..".($regoff->[$i]+$regwidth->[$i]-1);
-#       }
-    if (!(defined $regamount->[$i])) {
-      $regamount->[$i] = 1;
-      }
-    }
-  $ymin = $regoff->[0];
-  $ymax = $regoff->[0]+$regwidth->[0];
-  plot_init(256);  
-#   if ($style == 0) {
-#     plot_write("plot",1);
-#     for(my $i = 0; $i<scalar(@{$address});$i++) {
-#       plot_write("'-' using 1:2 with points pt 5 title \"$title->[$i]\" ",1);
-#       plot_write(", ",1) unless $i == scalar(@{$address})-1;
-#       }
-#     plot_write("");  
-#     }
-#   elsif($style == 1) {
-    plot_write("set xtics rotate by 90 offset .7,-2 scale 0 ");
-    plot_write("set style fill   solid 1.00 border -1");
-    plot_write("set boxwidth 1 absolute");    
-    plot_write("unset key");
-    plot_write('set format x "%x"');
-    plot_write("plot ",1);
-    for(my $i = 0; $i<scalar(@{$address});$i++) {
-      plot_write("'-'  with points pt 5 ps 1 title \"$title->[$i]\" ",1); #using 2:xticlabels(1)
-      plot_write(", ",1) unless $i == scalar(@{$address})-1;
-      }
-    plot_write(""); 
-#     }
-  while(1) {
-    for(my $i = 0; $i<scalar(@{$address});$i++) {
-      my $c;
-      if ($regamount->[$i] == 1) {
-        $c = "trbcmd r $address->[$i] $register->[$i] | sort";  
-        }
-      else {
-        $c = "trbcmd rm $address->[$i] $register->[$i] $regamount->[$i] 0";  
-        }
-      my @out = qx($c);
-      my $addr = undef;
-      my $cnt = 0;
-      foreach my $s (@out) {
-        if($s =~ /^H:\s*0x(\w\w\w\w)/) {
-          $addr = $1;
-          }
-        if($s =~ /^0x(\w\w\w\w)\s*0x(\w{8})/) {
-          $addr = hex($1) if($regamount->[$i] == 1);
-          if ($regamount->[$i] == 1) { plot_add($addr,-1);  }
-          else {                       plot_add("\"$addr.$1\"",-1); }
-          for(my $j = $regoff->[$i]; $j < $regoff->[$i] + $regwidth->[$i];$j++) {
-            if(hex($2) & (1<<$j)) {
-              if ($regamount->[$i] == 1) { plot_add("$addr",$j);  }
-              else {                       plot_add("\"$addr.$1\"",$j); }
-              }          
-            }
-          $cnt++;
-          }
-        }
-      plot_end(1);
-      }
-    plot_sleep($delay);
-    }
-  }
-
-
-
-#################################################
-# Generic Register differences
-#################################################
-sub genreg {
-  my %oldvals;
-
-  plot_init(undef);  
-
-  if($xticks) {
-    plot_write("set xtics rotate by 90 offset .7,-1.7 scale .7 ");
-    }
-  if($curvestyle eq "histo") {
-    plot_write("set style fill   solid 1.00 border -1");
-    plot_write("set boxwidth 2 absolute");    
-    }
-  elsif($curvestyle eq "histostacked") {
-    plot_write("set style fill   solid 1.00 border -1");
-    plot_write("set style histogram rowstacked");
-    plot_write("set boxwidth 1 absolute");   
-    plot_write("set key outside") unless defined $key && $key==0; 
-    plot_write("set autoscale xfix ");    
-    }
-
-  plot_write("plot",1);
-  for(my $i = 0; $i<scalar(@{$address});$i++) {
-    plot_write("'-' ",NONEWLINE);
-    if($xticks) {
-                       plot_write("using 2:xticlabels(1) ",NONEWLINE);
-                       }
-    if(($curvestyle =~ /histo/)) {
-      plot_write("with histograms lt rgb \"$color[$i]\" title \"$title->[$i]\" ",NONEWLINE);
-      }
-    elsif ($curvestyle eq "steps") {      
-                       plot_write("with histeps title \"$title->[$i]\" ",NONEWLINE);
-                       }
-    else {
-      plot_write("with points pt 5 title \"$title->[$i]\" ",NONEWLINE);
-      }
-    plot_write(" ".$curveoption->[$i],NONEWLINE);
-    plot_write(", ",NONEWLINE) unless $i == scalar(@{$address})-1;
-    }
-  plot_write(""); 
-
-
-  while(1) {
-    for(my $i = 0; $i<scalar(@{$address});$i++) {
-      my $c;
-      my $cnt;
-      if (!(defined $regamount->[$i]) || $regamount->[$i] == 1) {
-        $c = "trbcmd r $address->[$i] $register->[$i] | sort";  
-        }
-      else {
-        $c = "trbcmd rm $address->[$i] $register->[$i] $regamount->[$i] 0";  
-        }
-      my @out = qx($c);
-      my $addr = undef;
-      foreach my $s (@out) {
-        if($s =~ /^H:\s*0x(\w\w\w\w)/) {
-          $addr = $1;
-          $cnt = -1;
-          }
-        if($s =~ /^0x(\w{4})\s*0x(\w{8})/) {
-          my $tmp = (hex($2)>>$regoffset->[$i])&(2**$regwidth->[$i]-1);
-          my $val = 0;
-          my $board = $1;
-          if(defined $addr) {$board = $addr;}
-          $cnt++;
-          my $reg   = $1;
-          if($ydiff) {
-                                               if(defined $oldvals{$i}->{$board.$reg}) {
-                                                       if ($oldvals{$i}->{$board.$reg} > $tmp) {
-                                                               $val = $tmp - $oldvals{$i}->{$board.$reg} + 2**$regwidth->[$i];
-                                                               }
-                                                       else {
-                                                               $val = $tmp - $oldvals{$i}->{$board.$reg};
-                                                               }
-                                                       }
-                                               $oldvals{$i}->{$board.$reg} = $tmp;  
-                                               }
-                                 else {
-                                               $val = $tmp;
-                                               }
-          if($xticks) {
-            if (!(defined $regamount->[$i]) || $regamount->[$i] == 1) {
-              plot_add("\"$board\"",$val/($yscale->[$i]||1));
-              }
-            else {
-              plot_add("\"$board.$reg\"",$val/($yscale->[$i]||1));
-              }
-            }
-          else {
-            plot_add("",$val/($yscale->[$i]||1));
-            }
-          }
-        }
-        plot_end(!$xticks);
-      }
-    plot_sleep($delay);
-    }    
-  }
-
-#################################################
-# Generic Histogram
-#################################################
-sub genhist {
-  my %storearr;
-  my %oldvals;
-#   $xtitle = "Time [s]" unless $xtitle ne "";
-  plot_init();
-  plot_write("set autoscale fix");
-  plot_write("plot",1);
-  $diff = 0 unless defined($diff);
-  for(my $i = 0; $i<scalar(@{$address});$i++) {
-    $storearr{$i} = {};
-    store_init($storearr{$i},$samples,DIFFX,$ydiff,$delay,$downscale,$xoverflow->[$i],$yoverflow->[$i]); 
-    plot_write("'-' with lines title \"$title->[$i]\" ",1);
-    plot_write(", ",1) unless $i == scalar(@{$address})-1;
-    }
-  plot_write(""); 
-  
-  while(1) {
-    my $a, my $s, my $t;
-    my $val = 0 , my $time;
-    plot_storage_reset($storearr{0});
-    for(my $i = 0; $i<scalar(@{$address});$i++) {
-      $val = 0;
-      my $c = "trbcmd rt $address->[$i] $register->[$i] | sort";
-      my @out = qx($c);
-      $time += $delay;
-      foreach my $o (@out) {
-        if (($a,$s,$t) = $o =~ /^0x(\w{4})\s*0x(\w{8})\s*0x(\w{4})/) {
-          $val  += ((hex($s)>>($regoffset->[$i]))&(2**($regwidth->[$i])-1));
-          $time = hex($t)*16;
-          }
-        }
-      store_push($storearr{$i},$time/$xscale->[$i],$val/($yscale->[$i]||1),AXISISTIME);
-      store_print($storearr{$i});
-      }
-    plot_storage_sleep($storearr{0});
-               plot_finished($storearr{0});
-    }
-  }
-
-#################################################
-# Deadtime histogram
-#################################################
-sub deadtimehist2 {
-  my %values, my %lastvalues, my %diffvalues;
-  my @keys  = ("33","34","36","31","38","37","3b","35");
-  my @keys2 = ("43","44","46","41","48","47","4b","45");
-  my @names = ("MDC12","MDC34","TOF","RPC","RICH","SHW","Start","FW");
-  my %storearr;
-  
-  if ($style != 0) {
-    for(my $i= 0; $i < scalar(@keys); $i++) {
-      $storearr{$keys[$i]} = {};  
-      store_init($storearr{$keys[$i]},$samples,0,0,$delay*.0,$downscale,2**32,2**32);
-      }
-    for(my $i= 0; $i < scalar(@keys2); $i++) {
-      $storearr{$keys2[$i]} = {};  
-      store_init($storearr{$keys2[$i]},$samples,0,0,$delay*.0,$downscale,2**32,2**32);
-      }
-    }
-  
-  plot_init();
-  plot_write("set key left top Left");
-  plot_write("set autoscale fix");
-  plot_write("set yrange [-1:101]");
-  
-  if ($style != 0) {
-    plot_write("plot ",1);
-    plot_write("\"-\" title \"MDC12\" with lines,",1);
-    plot_write("\"-\" title \"MDC34\" with lines,",1);
-    plot_write("\"-\" title \"TOF\" with lines,",1);  
-    plot_write("\"-\" title \"RPC\" with lines,",1);
-    plot_write("\"-\" title \"RICH\" with lines,",1);
-    plot_write("\"-\" title \"SHW\" with lines,",1);
-    plot_write("\"-\" title \"Start\" with lines,",1);
-    plot_write("\"-\" title \"FW\" with lines");
-    }
-  else {
-    plot_write("set style fill   solid 1.00 border -1");
-    plot_write("set grid noxtics ytics");
-    plot_write("set boxwidth 2 absolute");
-    plot_write("set xtics ('MDC12' 0,'MDC34' 1,'TOF' 2, 'RPC' 3, 'RICH' 4, 'SHW' 5, 'Start' 6, 'FW' 7) offset 2,0 scale 0");
-    plot_write("set style histogram title offset character 0, 0, 0");
-    plot_write("set style data histograms");
-    plot_write("plot \"-\" title 'incl. busy' lt rgb \"#1155bb\", \"-\" title 'excl. busy' lt rgb \"#bb1111\"");
-    }
-       my $cmd = sprintf("trbcmd -n-1 -s%d rmt 0x8001 0x4031 31 0",$delay/1000);
-       if($style != 0) {
-               $cmd =  sprintf("trbcmd -n-1 -s%d rmt 0x8001 0x4031 12 0",$delay/1000);
-               }
-       open(FTRB, "$cmd|");
-
-  while(my $a = <FTRB>) {
-    if($a =~ /^0x\w{2}(\w{2})\s*0x(\w{8})\s*0x(\w{4})/) {
-      $values{$1}   = hex($2);
-      $values{"50"} = hex($3)*16;
-      }
-    if ($a eq "---\n") {
-                       $diffvalues{"50"} = 1E6;  
-                       if (defined $lastvalues{"50"}) {
-                               if ($values{"50"} > $lastvalues{"50"}) {
-                                       $diffvalues{"50"} = $values{"50"} - $lastvalues{"50"};
-                                       }
-                               else {
-                                       $diffvalues{"50"} = $values{"50"} - $lastvalues{"50"} + 2**20;
-                                       }
-                               }    
-                       #$diffvalues{"50"} = $values{"50"} - $lastvalues{"50"} if defined $lastvalues{"50"};
-                       my $time = $diffvalues{"50"};
-                       foreach my $key (keys %values) { 
-                               next unless hex($key)<0x50;
-                               $diffvalues{$key} = 0;
-                               if (defined $lastvalues{$key}) {
-                                       if ($values{$key} >= $lastvalues{$key}) {
-                                               $diffvalues{$key} = $values{$key} - $lastvalues{$key};
-                                               }
-                                       else {
-                                               $diffvalues{$key} = $values{$key} - $lastvalues{$key} + 2**32;
-                                               }
-                                       }
-                               $diffvalues{$key} /= $time if $time;
-                               #print $key." ".$values{$key}." ".$lastvalues{$key}." ".$diffvalues{$key}."\n";
-                               }  
-                       #print "=====\n";
-                       $diffvalues{"31"} = max($diffvalues{"31"},$diffvalues{"32"});
-                       $diffvalues{"38"} = max(max($diffvalues{"38"},$diffvalues{"39"}),$diffvalues{"3a"});
-                       if ($style == 0) {
-                               $diffvalues{"41"} = max($diffvalues{"41"},$diffvalues{"42"});
-                               $diffvalues{"48"} = max(max($diffvalues{"48"},$diffvalues{"49"}),$diffvalues{"4a"});
-                               }
-                       %lastvalues = %values;
-                       if($style != 0) {
-        plot_storage_reset($storearr{$keys[0]});
-                               for(my $i= 0; $i < scalar(@keys); $i++) {
-                                       store_push($storearr{$keys[$i]},$time,$diffvalues{$keys[$i]},0);
-                                       store_print($storearr{$keys[$i]});
-                                       }
-                               plot_storage_sleep($storearr{$keys[0]},1);      
-                               plot_finished($storearr{$keys[0]});
-        }
-                       else {
-        plot_reset();
-                               for(my $i= 0; $i < scalar(@keys); $i++) {    
-                                       plot_add("",$diffvalues{$keys[$i]});  #"\"".$names[$i]."\"",
-                                       }
-                               plot_end(1);  
-                               for(my $i= 0; $i < scalar(@keys2); $i++) {    
-                                       plot_add("",$diffvalues{$keys2[$i]});  #"\"".$names[$i]."\"",
-                                       }
-                               plot_end(1);
-                               plot_finished();
-        }
-                       }
-    }
-  } 
-
-
-#################################################
-# Select Operation
-#################################################
-
-if(!(defined $ARGV[0])  || $ARGV[0] =~ /help/) {help(); exit;}
-
-if($ARGV[0] =~ /oep5V/) {
-  $address     = [0xfffd,0xfffd];
-  $register    = [0x8010,0x8011];
-  $regwidth    = [12,12];
-  $regoffset   = [0,0];
-  $yscale      = [.5,.5];
-  $xtitle      = "Board";
-  $ytitle      = "Voltage [mV]";
-  $key         = YES;
-  $windowname  = "OEP Voltages";
-  $title       = ["5.8V input","5V reg."];
-  genreg();
-  }
-
-if($ARGV[0] =~ /oep3.3V/) {
-  $address     = [0xfffd,0xfffd];
-  $register    = [0x8012,0x8013];
-  $regwidth    = [12,12];
-  $regoffset   = [0,0];
-  $yscale      = [1,1];
-  $xtitle      = "Board";
-  $ytitle      = "Voltage [mV]";
-  $key         = YES;
-  $windowname  = "OEP Voltages";
-  $title       = ["3.8V input","3.3V reg."];
-  genreg();
-  }
-
-if($ARGV[0] =~ /oep1.2V/) {
-  $address     = [0xfffd,0xfffd];
-  $register    = [0x8014,0x8015];
-  $regwidth    = [12,12];
-  $regoffset   = [0,0];
-  $yscale      = [1,1];
-  $xtitle      = "Board";
-  $ytitle      = "Voltage [mV]";
-  $key         = YES;
-  $windowname  = "OEP Voltages";
-  $title       = ["1.8V input","1.2V reg."];
-  genreg();
-  }
-
-if($ARGV[0] =~ /oep3V/) {
-  $address     = [0xfffd,0xfffd];
-  $register    = [0x8016,0x8017];
-  $regwidth    = [12,12];
-  $regoffset   = [0,0];
-  $yscale      = [1,1];
-  $xtitle      = "Board";
-  $ytitle      = "Voltage [mV]";
-  $key         = YES;
-  $windowname  = "OEP Voltages";
-  $title       = ["+3V input","-3V reg."];
-  genreg();
-  }
-
-if($ARGV[0] =~ /oepminmaxp3V/) {
-  $address     = [0xfffd,0xfffd];
-  $register    = [0x801e,0x801e];
-  $regwidth    = [12,12];
-  $regoffset   = [0,16];
-  $yscale      = [1,1];
-  $xtitle      = "Board";
-  $ytitle      = "Voltage [mV]";
-  $key         = YES;
-  $windowname  = "OEP Voltages";
-  $title       = ["+3V minimum","+3V maximum"];
-  genreg();
-  }  
-
-if($ARGV[0] =~ /oepminmaxn3V/) {
-  $address     = [0xfffd,0xfffd];
-  $register    = [0x801f,0x801f];
-  $regwidth    = [12,12];
-  $regoffset   = [0,16];
-  $yscale      = [1,1];
-  $xtitle      = "Board";
-  $ytitle      = "Voltage [mV]";
-  $key         = YES;
-  $windowname  = "OEP Voltages";
-  $title       = ["-3V minimum","-3V maximum"];
-  genreg();
-  }    
-
-if($ARGV[0] =~ /oepminmax5Vin/) {
-  $address     = [0xfffd,0xfffd,0xfffd];
-  $register    = [0x8018,0x8018,0x8010];
-  $regwidth    = [12,12,12];
-  $regoffset   = [0,16,0];
-  $yscale      = [.5,.5,.5];
-  $xtitle      = "Board";
-  $ytitle      = "Voltage [mV]";
-  $key         = YES;
-  $windowname  = "OEP Voltages";
-  $title       = ["5Vin minimum","5Vin maximum","5Vin"];
-  genreg();
-  }    
-  
-if($ARGV[0] =~ /oeptemp/) {
-  oeptemp(($delay)?$delay:5000000,[$name." - OEP Temperature"]);
-  }
-
-
-if($ARGV[0] =~ /rpcdatarate/) {
-  $delay       = 1000000 unless $delay;
-       $xticks      = 1 ;
-       $xtitle      = "Sender ((Sector mod 3)*4+TRB)";
-       $ytitle      = "Data Words /1024";
-  $windowname  = "Data Words sent by RPC";
-  $curvestyle  = "histo";
-  $key         = YES;
-  $ydiff       = DIFFY;
-  $ymin        = 0;
-  $yscale      = [512,512];
-  $address     = [0x8401,0x8411];
-  $register    = [0x4001,0x4001];
-  $regamount   = [12,12];
-  $title       = ["Sector 0,1,2","Sector 3,4,5"];
-  $regoffset   = [0,0];
-  $regwidth    = [32,32]; 
-  genreg();
-  }
-
-#hadplot -a 2 -r 1 -p 0 -w 16 -d 5 -o 200 -n 1000 -yoverflow 65536 genhistdiff
-
-if($ARGV[0] =~ /eventratehighres/) {
-  $delay       = 5000 ; #unless $delay;
-  $samples     = 1000; # unless $samples;
-  $downscale   = 200;#  unless $downscale;
-#   $style       = 0 unless $style;
-  $windowname  = "Eventrate High Resolution";
-  $xistime     = AXISISTIME;
-  $ydiff       = DIFFY;
-  $xoverflow   = [2**20];
-  $title       = ["Event rate"];
-  $address     = [0x2];
-  $register    = [0x1];
-  $regoffset   = [0];
-  $regwidth    = [16];
-  $yoverflow   = [65536];
-  genhist();
-  } 
-  
-  
-if($ARGV[0] =~ /eventrate/) {
-  $address     = [0x2];
-  $register    = [0x1];
-  $regwidth    = [16];
-  $regoffset   = [0];
-  $timeref     = [0x2];
-  $delay       = 100000 unless $delay;
-  $samples     = 500    unless $samples;
-  $downscale   = 10     unless $downscale;
-  $windowname  = "Event rate history"; 
-  $key         = NO;
-       $ytitle      = "Event rate [Hz]" if $ytitle eq "";
-       $xistime     = AXISISTIME;
-       $ydiff       = DIFFY;
-       $xoverflow   = [2**20];
-       $yoverflow   = [2**16] unless $yoverflow->[0] != 2**32;
-       genhist();
-  }
-
-if($ARGV[0] =~ /datarate/) {
-  $address     = [0xff7f];
-  $register    = [0x83f3];
-  $regwidth    = [32];
-  $regoffset   = [0];
-  $timeref     = [0x8000];
-  $delay       = 100000 unless $delay;
-  $samples     = 500    unless $samples;
-  $downscale   = 5      unless $downscale;
-  $windowname  = "Total data rate history"; 
-       $xtitle      = "Time [s]" unless defined $xtitle;
-       $ytitle      = "Data rate [MiByte]" unless defined $ytitle;
-       $xistime     = AXISISTIME;
-       $ydiff       = DIFFY;
-       $xoverflow   = [2**20];
-       $yoverflow   = [2**12];
-       $yscale      = [2**20];
-       $key         = NO;
-       genhist();
-  }  
-
-if($ARGV[0] =~ /busytime/) {
-  $delay       = 100000 unless $delay;
-  $samples     = 100    unless $samples;
-  $downscale   = 5      unless $downscale;
-  $style       = 1;
-  $windowname  = "Busytime history";
-  deadtimehist2();
-  }  
-
-if($ARGV[0] =~ /busy/) {
-  $delay       = 100000 unless $delay;
-  $style       = 0;
-  $windowname  = "Busy time";
-  deadtimehist2();
-  }
-
-if($ARGV[0] =~ /oepspikehist/) {
-  $delay       = 100000 unless $delay;
-  $samples     = 1000 unless $samples;
-  $downscale   = 10   unless $downscale;
-#   $style       = 0 unless $style;
-  $windowname  = "OEP CMS Spikes";
-  $ydiff       = DIFFY;
-  $title       = ["OEP CMS Spikes"];
-  $address     = [0xfffd];
-  $register    = [7];
-  $regoffset   = [0];
-  $regwidth    = [16];
-  genhist();
-  } 
-
-if($ARGV[0] =~ /oepretrhist/) {
-  $delay       = 500000 unless $delay;
-  $samples     = 600 unless $samples;
-  $downscale   = 2   unless $downscale;
-  $style       = 0 unless $style;
-  $windowname  = "OEP Retransmissions";
-  $ydiff       = DIFFY;
-  $title       = ["Retransmit Received","Retransmit Sent"];
-  $address     = [0xfffd,0xfffd];
-  $register    = [4,4];
-  $regoffset   = [16,24];
-  $regwidth    = [8,8];
-  genhist();
-  }
-
-if($ARGV[0] =~ /oeptokenmisshist/) {
-  $delay       = 500000 unless $delay;
-  $samples     = 2000 unless $samples;
-  $downscale   = 4   unless $downscale;
-  $style       = 0 unless $style;
-  $windowname  = "OEP Token Missing";
-  $ydiff       = DIFFY;
-  $title       = ["Missing Tokens"];
-  $address     = [0xfffd];
-  $register    = [0x9101];
-  $regoffset   = [0];
-  $regwidth    = [24];
-  genhist();
-  } 
-
-  
-if($ARGV[0] =~ /oeptrgerrhist/) {
-  $delay       = 500000 unless $delay;
-  $samples     = 2000 unless $samples;
-  $downscale   = 2   unless $downscale;
-  $style       = 0 unless $style;
-  $windowname  = "OEP CMS Errors";
-  $ydiff       = DIFFY;
-  $title       = ["Spikes","Spurious","Invalid","Multiple"];
-  $address     = [0xfffd,0xfffd,0xfffd,0xfffd];
-  $register    = [7,7,6,6];
-  $regoffset   = [0,16,0,16];
-  $regwidth    = [16,16,16,16];  
-  genhist();
-  } 
-
-
-if($ARGV[0] =~ /histdiff/) {
-  $delay       = 1000000 unless $delay;
-  $samples     = 200 unless $samples;
-  $downscale   = 1   unless $downscale;
-  $style       = 0 unless $style;
-  $ydiff       = DIFFY;
-  genhist();
-  } 
-
-if($ARGV[0] =~ /hist/) {
-  $delay       = 1000000 unless $delay;
-  $samples     = 200 unless $samples;
-  $downscale   = 1   unless $downscale;
-  $style       = 0   unless $style;
-  $ydiff       = NODIFFY;
-  genhist();
-  } 
-
-if($ARGV[0] =~ /oepworktime/) {
-  $delay       = 1000000 unless $delay;
-       $curvestyle  = "histostacked";
-       $xticks      = 0 unless $xticks;
-       $ymax        = $delay*1.1/1000;
-       $yscale      = [1000];
-       $xtitle      = "OEP";
-       $ytitle      = "Time [ms]";
-  $windowname  = "OEP Trigger Handling Times";
-  $ydiff       = DIFFY;
-  $title       = ["Readout","Waiting","Initialization","Calibration","Idle"];
-  $address     = [0xfffd,0xfffd,0xfffd,0xfffd,0xfffd];
-  $register    = [0x9113,0x9114,0x9111,0x9112,0x9110];
-  $regoffset   = [0,0,0,0,0];
-  $regwidth    = [32,32,32,32,32]; 
-  genreg();
-  }
-
-if($ARGV[0] =~ /gberate/) {
-  $delay       = 1000000 unless $delay;
-       $curvestyle  = "histostacked";
-       $xticks      = 1 unless $xticks;
-       $xtitle      = "Sender";
-       $ytitle      = "Data Rate (kiB)" if $ytitle eq "";
-  $windowname  = "Gbe Data Rate";
-  $key         = NO;
-  $ydiff       = DIFFY;
-  $xgrid       = NO;
-  $address     = [0xff7f];
-  $register    = [0x83f3];
-  $regoffset   = [10];
-  $regwidth    = [22]; 
-  genreg();
-  }
-
-if($ARGV[0] =~ /oepwords/) {
-  $delay       = 1000000 unless $delay;
-       $xticks      = 1 unless defined $xticks;
-       $xtitle      = "Sender";
-       $ytitle      = "Data Words";
-  $windowname  = "Data Words sent by OEP";
-  $yscale      = [1];
-  $key         = NO;
-  $ydiff       = DIFFY;
-  $address     = [0xfffd];
-  $register    = [0x910B];
-  $regoffset   = [0];
-  $regwidth    = [32]; 
-  genreg();
-  }
-
-
-if($ARGV[0] =~ /mdcchan/) {
-  $delay       = 1000000 unless $delay;
-       $xticks      = 1;
-       $xtitle      = "Sender";
-       $ytitle      = "Data Words";
-  $windowname  = "Data words per TDC channel";
-  $yscale      = [1];
-  $key         = NO;
-  $ydiff       = NODIFFY;
-  if ($ARGV[0] =~ /diff/) {
-               $ydiff       = DIFFY;
-               }
-  $address     = [$address->[0]?$address->[0]:0xfffd];
-  $register    = [0xc088];
-  $regamount   = [96];
-  $regoffset   = [0];
-  $regwidth    = [32]; 
-  genreg();
-  }
-
-
-if($ARGV[0] =~ /regdiff/) {
-  $delay       = 1000000 unless $delay;
-#      $xticks      = 1 unless $xticks;
-  $ydiff       = DIFFY;
-#   $key         = NO unless defined $key;
-  $windowname  = "General Plot" unless $windowname;
-  genreg();
-  }
-
-if($ARGV[0] =~ /reg/) {
-  $delay       = 1000000 unless $delay;
-#      $xticks      = 1 unless $xticks;
-  $ydiff       = NODIFFY;
-#   $key         = NO unless defined $key;
-  $windowname  = "General Plot" unless $windowname;
-  genreg();
-  }
-
-if($ARGV[0] =~ /oeptrgerr/) {
-  $delay       = 1000000 unless $delay;
-       $xticks      = 1 unless defined $xticks;
-       $xtitle      = "Board";
-       $ytitle      = "# of errors";
-  $windowname  = "OEP CMS Errors";
-  $key         = YES;
-  $ydiff       = NODIFFY;
-  $title       = ["Spikes","Spurious","Invalid","Multiple"];
-  $address     = [0xfffd,0xfffd,0xfffd,0xfffd];
-  $register    = [7,7,6,6];
-  $regoffset   = [0,16,0,16];
-  $regwidth    = [16,16,16,16]; 
-  genreg();
-  }
-
-if($ARGV[0] =~ /oepfill/) {
-  $delay       = 1000000 unless $delay;
-       $xticks      = 1 unless defined $xticks;
-       $xtitle      = "Board";
-       $ytitle      = "Words in Buffer";
-  $windowname  = "OEP Buffer Fill Level";
-  $key         = NO;
-  $ydiff       = NODIFFY;
-  $address     = [0xfffd];
-  $register    = [0x7100];
-  $regoffset   = [0];
-  $regwidth    = [16]; 
-  genreg();
-  }
-
-if($ARGV[0] =~ /showerfill/) {
-  $delay       = 1000000 unless $delay;
-       $xticks      = 1 unless defined $xticks;
-       $xtitle      = "Board";
-       $ytitle      = "Words in Buffer";
-  $windowname  = "Shower Data Buffer Fill Level";
-  $key         = $key || NO;
-  $ydiff       = NODIFFY;
-  $address     = [0xfff7,0xfff7,0xfff7,0xfff7,0xfff7,0xfff7];
-  $register    = [0x7100,0x7101,0x7102,0x7103,0x7104,0x7105];
-  $regoffset   = [0,0,0,0,0,0];
-  $regwidth    = [16,16,16,16,16,16]; 
-  genreg();
-  }
-
-if($ARGV[0] =~ /filllevel/) {
-  $delay       = 1000000 unless $delay;
-       $xticks      = 1 unless defined $xticks;
-       $xtitle      = "Board";
-       $ytitle      = "Words in Buffer";
-  $windowname  = "Front-end Data Buffer Fill Level";
-  $key         = NO;
-  $ydiff       = NODIFFY;
-  $address     = [0xffff,0xffff,0xffff,0xffff,0xffff,0xffff];
-  $register    = [0x7100,0x7101,0x7102,0x7103,0x7104,0x7105];
-  $regoffset   = [0,0,0,0,0,0];
-  $regwidth    = [16,16,16,16,16,16]; 
-  genreg();
-  }
-
-if($ARGV[0] =~ /oepretr/) {
-  $delay       = 1000000 unless $delay;
-  $windowname  = "OEP Retransmissions";
-  $key         = YES;
-  $ydiff       = NODIFFY;
-  $title       = ["Retransmit Received","Retransmit Sent"];
-  $address     = [0xfffd,0xfffd];
-  $register    = [4,4];
-  $regoffset   = [16,24];
-  $regwidth    = [8,8];
-  genreg();
-  }
-
-if($ARGV[0] =~ /timecmslvl1/) {
-  $delay       = 1000000 unless $delay;
-  $windowname  = "Trigger Delay";
-  $key         = NO;
-  $ydiff       = NODIFFY;
-  $ytitle      = "Time between CMS and LVL1 [10ns]";
-  $address     = [0xfffd];
-  $register    = [2];
-  $regoffset   = [16];
-  $regwidth    = [11];
-  genreg();
-  }
-
-if($ARGV[0] =~ /oeptokenmiss/) {
-  $delay       = 1000000 unless $delay;
-  $windowname  = "OEP Token Missing";
-  $key         = NO;
-  $ydiff       = NODIFFY;
-  $ytitle      = "# of missing token";
-  $address     = [0xfffd];
-  $register    = [0x9101];
-  $regoffset   = [0];
-  $regwidth    = [24];
-  genreg();
-  }
-
-if($ARGV[0] =~ /slowcontrolrate/) {
-  $delay       = 1000000 unless $delay;
-  $samples     = 240 unless $samples;
-  $downscale   = 1   unless $downscale;
-  $style       = 0 unless $style;
-  $windowname  = "Slow Control Data Rate";
-  $ydiff       = DIFFY;
-  $ytitle      = "Slow Control Data / kByte/s";
-  $address     = [0x8000];
-  $register    = [0x4012];
-  $regoffset   = [0];
-  $regwidth    = [32];  
-  $yscale      = [102.4];
-  genhist();
-  } 
-
-
-
-if($ARGV[0] =~ /commonstatus/) {
-  bitmap(($delay)?$delay:1000000,[0xffff],[0],[1],[0],[20],["Common Status Bits"],0,$name." - Common Status Bit");
-  } 
-if($ARGV[0] =~ /genbit/ || $ARGV[0] =~ /bitmap/) {
-  bitmap(($delay)?$delay:1000000,$address,$register,$regamount,$regoffset,$regwidth,$title,$style,$name." - ".$windowname);
-  }   
-
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..93c6298106711feaeee01ace03baca01a8601cf1
--- /dev/null
@@ -0,0 +1 @@
+hmon_hadplotnew.sh
\ No newline at end of file
index 6172559fcc0f10287d741b225d56f1176970a46c..b7631c83e8ddceb39e002759b933bbffc567337d 100755 (executable)
@@ -20,8 +20,8 @@ $plot2->{curves}  = 16;
 $plot2->{type}    = HPlot::TYPE_HEATMAP;
 $plot2->{output}  = HPlot::OUT_PNG;
 $plot2->{zlabel}  = "Hitrate";
-$plot2->{sizex}   = 580;
-$plot2->{sizey}   = 465;
+$plot2->{sizex}   = 450;
+$plot2->{sizey}   = 360;
 $plot2->{nokey}   = 1;
 $plot2->{buffer}  = 1;
 $plot2->{xmin}    = -0.5;
@@ -36,7 +36,9 @@ $plot->{name}    = "HodoRatePlot";
 $plot->{file}    = "files/HodoRatePlot";
 $plot->{entries} = 16;
 $plot->{curves}  = 2;
-$plot->{type}    = HPlot::TYPE_HISTORY;
+$plot->{style}   = 'dots';
+$plot->{curvewidth} = 1;
+$plot->{type}    = HPlot::TYPE_BARGRAPH;
 $plot->{output}  = HPlot::OUT_PNG;
 $plot->{xlabel}  = "Bar";
 $plot->{ylabel}  = "Hitrate";
@@ -51,12 +53,12 @@ $plot->{buffer}  = 1;
 HPlot::PlotInit($plot);
 
 
-my $str  = Hmon::MakeTitle(9, 10, "Hodoscope Hit Rate");
+my $str  = Hmon::MakeTitle(6, 8, "Hodoscope Hit Rate");
 $str .= qq@<img src="%ADDPNG files/HodoRate.png%" type="image/png"><br>\n@;
 $str .= Hmon::MakeFooter();
 Hmon::WriteFile("HodoRate",$str);
 
-$str  = Hmon::MakeTitle(9, 8, "Hodoscope Hit Rate");
+$str  = Hmon::MakeTitle(8, 8, "Hodoscope Hit Rate");
 $str .= qq@<img src="%ADDPNG files/HodoRatePlot.png%" type="image/png"><br>\n@;
 $str .= Hmon::MakeFooter();
 Hmon::WriteFile("HodoRatePlot",$str);
index a9f441784a3028afc9d56c8b8a033039f5572d01..ca41168b610711019463df9dbeec05ca28c24e12 100755 (executable)
@@ -15,70 +15,266 @@ use List::Util qw[min max];
 my $plot = ();
 $plot->{name}    = "HodoHist";
 $plot->{file}    = "files/HodoHist";
-$plot->{curves}  = 8;
+$plot->{curves}  = 9;
+$plot->{titles}->[0]   = "Bar 1/2";
+$plot->{titles}->[1]   = "Bar 3/4";
+$plot->{titles}->[2]   = "Bar 5/6";
+$plot->{titles}->[3]   = "Bar 7/8";
+$plot->{titles}->[4]   = "Bar 9/10";
+$plot->{titles}->[5]   = "Bar 11/12";
+$plot->{titles}->[6]   = "Bar 13/14";
+$plot->{titles}->[7]   = "Bar 15/16";
+$plot->{titles}->[8]   = "Sum";
 $plot->{entries} = 200;
 $plot->{type}    = HPlot::TYPE_HISTORY;
 $plot->{output}  = HPlot::OUT_PNG;
 $plot->{zlabel}  = "Hitrate";
-$plot->{sizex}   = 880;
-$plot->{sizey}   = 465;
+$plot->{sizex}   = 830;
+$plot->{sizey}   = 415;
 $plot->{nokey}   = 0;
 $plot->{buffer}  = 1;
-$plot->{xscale}  = 10;
+$plot->{xscale}  = 5;
 $plot->{xlabel}  = "Time [s]";
 $plot->{ylabel}  = "Hits [1/s]";
 HPlot::PlotInit($plot);
 
+my $plot2 = ();
+$plot2->{name}    = "ScintiHist";
+$plot2->{file}    = "files/ScintiHist";
+$plot2->{curves}  = 1;
+$plot2->{entries} = 200;
+$plot2->{titles}->[0]   = "Scintillator";
+$plot2->{type}    = HPlot::TYPE_HISTORY;
+$plot2->{output}  = HPlot::OUT_PNG;
+$plot2->{zlabel}  = "Hitrate";
+$plot2->{sizex}   = 680;
+$plot2->{sizey}   = 365;
+$plot2->{nokey}   = 0;
+$plot2->{buffer}  = 1;
+$plot2->{xscale}  = 5;
+$plot2->{xlabel}  = "Time [s]";
+$plot2->{ylabel}  = "Hits [1/s]";
+HPlot::PlotInit($plot2);
 
-my $str  = Hmon::MakeTitle(12, 10, "Hodoscope Hit History");
+my $plot3 = ();
+$plot3->{name}    = "HitRatios";
+$plot3->{file}    = "files/HitRatios";
+$plot3->{entries} = 4;
+$plot3->{curves}  = 1;
+$plot3->{curvewidth} = 1;
+$plot3->{type}    = HPlot::TYPE_BARGRAPH;
+$plot3->{output}  = HPlot::OUT_PNG;
+$plot3->{ylabel}  = "Hit Ratio (dark rate substracted)";
+$plot3->{sizex}   = 450;
+$plot3->{sizey}   = 360;
+$plot3->{buffer}  = 1;
+$plot3->{nokey}   = 1;
+$plot3->{ymin}    = 0;
+$plot3->{ymax}    = 2;
+$plot3->{bartitle}->[0] = "Pi0 Y";
+$plot3->{bartitle}->[1] = "Pi0 X";
+$plot3->{bartitle}->[2] = "Pi1 Y";
+$plot3->{bartitle}->[3] = "Pi1 X";
+HPlot::PlotInit($plot3);
+
+my $plot4 = ();
+$plot4->{name}    = "HitRatioHist";
+$plot4->{file}    = "files/HitRatioHist";
+$plot4->{entries} = 200;
+$plot4->{curves}  = 4;
+$plot4->{xscale}  = 5;
+$plot4->{type}    = HPlot::TYPE_HISTORY;
+$plot4->{output}  = HPlot::OUT_PNG;
+$plot4->{ylabel}  = "Hit Ratio (dark rate substracted)";
+$plot4->{xlabel}  = "Time [s]";
+$plot4->{sizex}   = 650;
+$plot4->{sizey}   = 360;
+$plot4->{ymin}    = 0;
+$plot4->{ymax}    = 2;
+$plot4->{buffer}  = 1;
+$plot4->{titles}->[0] = "Pi0 Y / Hodo";
+$plot4->{titles}->[1] = "Pi0 X / Hodo";
+$plot4->{titles}->[2] = "Pi1 Y / Hodo";
+$plot4->{titles}->[3] = "Pi1 X / Hodo";
+HPlot::PlotInit($plot4);
+
+my $plot5 = ();
+$plot5->{name}    = "HitSumHist";
+$plot5->{file}    = "files/HitSumHist";
+$plot5->{entries} = 200;
+$plot5->{curves}  = 5;
+$plot5->{xscale}  = 5;
+$plot5->{type}    = HPlot::TYPE_HISTORY;
+$plot5->{output}  = HPlot::OUT_PNG;
+$plot5->{ylabel}  = "Hit Rate (dark rate substracted)";
+$plot5->{xlabel}  = "Time [s]";
+$plot5->{sizex}   = 650;
+$plot5->{sizey}   = 360;
+$plot5->{buffer}  = 1;
+$plot5->{titles}->[0] = "Pi0 Y";
+$plot5->{titles}->[1] = "Pi0 X";
+$plot5->{titles}->[2] = "Pi1 Y";
+$plot5->{titles}->[3] = "Pi1 X";
+$plot5->{titles}->[4] = "Hodo";
+HPlot::PlotInit($plot5);
+
+
+my $str  = Hmon::MakeTitle(11, 9, "Hodoscope Hit History");
 $str .= qq@<img src="%ADDPNG files/HodoHist.png%" type="image/png"><br>\n@;
 $str .= Hmon::MakeFooter();
 Hmon::WriteFile("HodoHist",$str);
 
+$str  = Hmon::MakeTitle(9, 8, "Scintillator Hit History");
+$str .= qq@<img src="%ADDPNG files/ScintiHist.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("ScintiHist",$str);
+
+$str  = Hmon::MakeTitle(6, 8, "Hit Ratios");
+$str .= qq@<img src="%ADDPNG files/HitRatios.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("HitRatios",$str);
+
+$str  = Hmon::MakeTitle(9, 8, "Hit Ratio Hist");
+$str .= qq@<img src="%ADDPNG files/HitRatioHist.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("HitRatioHist",$str);
+
+$str  = Hmon::MakeTitle(9, 8, "Hit Sums");
+$str .= qq@<img src="%ADDPNG files/HitSumHist.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("HitSumHist",$str);
+
 my $timer = 0;
 my $old;
-my $oldtime = 0;
+my $old2;
+my $oldtime;
 my $time = 0;
 my $diff;
+my $diff2;
 my $iter = 0;
+my $offset;
+my $histstore;
+
+$offset->{0x8890} = 0;
+$offset->{0x3800} = 0;
+$offset->{0x3801} = 0;
+$offset->{0x3810} = 0;
+$offset->{0x3811} = 0;
 
 trb_init_ports() or die trb_strerror();
 
 
 while (1) {
-  my $o;
-  foreach my $b (0x5010,0x5013) {
-    my $t = trb_registertime_read_mem($b,0xc000,0,33);
+  my $o, my $o2; my $t;
+  foreach my $b (0x5010,0x5012,0x5013) {
+    $t = trb_registertime_read_mem($b,0xc000,0,33);
     $o->{$b} = $t->{$b};
     }
+  $t = trb_registertime_read(0xfe49,0x8130);
+  if (defined $t) {
+    foreach my $b (keys $t) {
+      $o2->{$b}->{0x8130} = $t->{$b};
+      }
+    }
+    
+#   $t = trb_registertime_read(0xfe49,0x841f);
+#   foreach my $b (keys $t) {
+#     $o2->{$b}->{0x841f} = $t->{$b};
+#     }   
 
   if (defined $old) {
     foreach my $b (keys %$o) {
       for my $v (0..32) {
-        my $tdiff = $o->{0x5010}->{time}->[0] - $oldtime;
+        my $tdiff = $o->{$b}->{time}->[0] - ($oldtime->{$b}||0);
         my $vdiff = ($o->{$b}->{value}->[$v]&0xffffff) - ($old->{$b}->{value}->[$v]&0xffffff);
         if ($vdiff < 0) { $vdiff += 2**24;}
         if ($tdiff < 0) { $tdiff += 2**16;}
         $tdiff *= 16;
         $diff->{$b}->[$v] = $vdiff/($tdiff||1E6)*1E6;
         }
+      $oldtime->{$b} = $o->{$b}->{time}->[0];
       }
+      
+    foreach my $b (keys %$o2) { 
+      foreach my $a (keys $o2->{$b}) {
+        my $tdiff = $o2->{$b}->{$a}->{time}->[0] - ($oldtime->{$b}||0);
+        my $vdiff = ($o2->{$b}->{$a}->{value}->[0]) - ($old2->{$b}->{$a}->{value}->[0]);
+        if ($vdiff < 0) { $vdiff += 2**32;}
+        if ($tdiff < 0) { $tdiff += 2**16;}
+        $tdiff *= 16;
+        $diff2->{$b}->{$a} = $vdiff/($tdiff||1E6)*1E6;
+        $oldtime->{$b} = $o2->{$b}->{$a}->{time}->[0];
+        }
+      }
+
+    
     my @sum = qw(0 0 0 0 0 0 0 0);
+    my $total = 0;
     for my $bar (0..7) {
       for my $x (0..1) {
         $sum[$bar/2+4] += $diff->{0x5010}->[$bar*2+1+$x*16];
         $sum[$bar/2]   += $diff->{0x5013}->[$bar*2+1+$x*16];
+        $total         += $diff->{0x5010}->[$bar*2+1+$x*16];
+        $total         += $diff->{0x5013}->[$bar*2+1+$x*16];
         }
       }
     for my $i (0..7) {  
       HPlot::PlotAdd("HodoHist",$sum[$i]/2,$i);  
+#       $total += $sum[$i]/2;
       }
-    unless($timer++ %  10) {
+    HPlot::PlotAdd("ScintiHist",$diff->{0x5012}->[7],0);
+    HPlot::PlotAdd("HodoHist",$total/2,8);
+    
+
+
+    
+    if($total > 300) {
+      HPlot::PlotAdd("HitRatioHist",(($diff2->{0x3800}->{0x8130}||0)-$offset->{0x3800})/(($total-$offset->{0x8890})||1),0);    
+      HPlot::PlotAdd("HitRatioHist",(($diff2->{0x3801}->{0x8130}||0)-$offset->{0x3801})/(($total-$offset->{0x8890})||1),1);    
+      HPlot::PlotAdd("HitRatioHist",(($diff2->{0x3810}->{0x8130}||0)-$offset->{0x3810})/(($total-$offset->{0x8890})||1),2);    
+      HPlot::PlotAdd("HitRatioHist",(($diff2->{0x3811}->{0x8130}||0)-$offset->{0x3811})/(($total-$offset->{0x8890})||1),3);   
+      
+      HPlot::PlotFill("HitRatios",(($diff2->{0x3800}->{0x8130}||0)-$offset->{0x3800})/(($total-$offset->{0x8890})||1),0);
+      HPlot::PlotFill("HitRatios",(($diff2->{0x3801}->{0x8130}||0)-$offset->{0x3801})/(($total-$offset->{0x8890})||1),1);
+      HPlot::PlotFill("HitRatios",(($diff2->{0x3810}->{0x8130}||0)-$offset->{0x3810})/(($total-$offset->{0x8890})||1),2);
+      HPlot::PlotFill("HitRatios",(($diff2->{0x3811}->{0x8130}||0)-$offset->{0x3811})/(($total-$offset->{0x8890})||1),3);
+
+      }
+    else {
+      HPlot::PlotAdd("HitRatioHist",0,0);    
+      HPlot::PlotAdd("HitRatioHist",0,1);    
+      HPlot::PlotAdd("HitRatioHist",0,2);    
+      HPlot::PlotAdd("HitRatioHist",0,3);   
+
+      HPlot::PlotFill("HitRatios",0,0);    
+      HPlot::PlotFill("HitRatios",0,1);    
+      HPlot::PlotFill("HitRatios",0,2);    
+      HPlot::PlotFill("HitRatios",0,3);   
+      
+      $offset->{0x8890} += (($total||0) - $offset->{0x8890})/32;
+      $offset->{0x3800} += (($diff2->{0x3800}->{0x8130}) - $offset->{0x3800})/32;
+      $offset->{0x3801} += (($diff2->{0x3801}->{0x8130}) - $offset->{0x3801})/32;
+      $offset->{0x3810} += (($diff2->{0x3810}->{0x8130}) - $offset->{0x3810})/32;
+      $offset->{0x3811} += (($diff2->{0x3811}->{0x8130}) - $offset->{0x3811})/32;
+      
+      }
+
+    HPlot::PlotAdd('HitSumHist',(($diff2->{0x3800}->{0x8130})||0)-$offset->{0x3800},0);
+    HPlot::PlotAdd('HitSumHist',(($diff2->{0x3801}->{0x8130})||0)-$offset->{0x3801},1);
+    HPlot::PlotAdd('HitSumHist',(($diff2->{0x3810}->{0x8130})||0)-$offset->{0x3810},2);
+    HPlot::PlotAdd('HitSumHist',(($diff2->{0x3811}->{0x8130})||0)-$offset->{0x3811},3);
+    HPlot::PlotAdd('HitSumHist',($total||0)-$offset->{0x8890},4);      
+      
+    unless($timer++ %  5) {
       HPlot::PlotDraw('HodoHist');  
+      HPlot::PlotDraw('ScintiHist');  
+      HPlot::PlotDraw('HitRatioHist');  
+      HPlot::PlotDraw('HitRatios');  
+      HPlot::PlotDraw('HitSumHist');
       }
     }
 
   $old = $o;
-  $oldtime = $o->{0x5010}->{time}->[0];
-  usleep(100000);
+  $old2 = $o2;
+  usleep(200000);
   }
index c580a245a9643d31a357d656820ea144b88f3848..e79a004811a5e9e9b8574b0e4579ef6940cb9f53 100755 (executable)
@@ -14,7 +14,7 @@ my $title = qq$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
   <link href="../files/indexstyles.css" rel="stylesheet" type="text/css"/>
   <title>Hmon MDC HV Trends</title>
   </head>
-  <body class="index"  style="position:relative;background:#d8e8f8;width:850px;margin:auto;padding:120px 0 40px 0">
+  <body class="index"  style="position:relative;background:#d8e8f8;width:1650px;margin:auto;padding:120px 0 40px 10px">
   <div style="position:fixed;left:0;top:0;width:100%;height:40px;background:#d8e8f8;box-shadow:none;"></div>
   <h1 style="position:fixed;top:5px;left:0px;width:100%;display:block;text-align:center;margin:26px 0 0px 0">Hmon MDC HV Trends</h1>
   <div  style="position:fixed;left:10px;top:30px;background:#346;padding:10px;margin:-22px 5px 5px 15px;"><img style="background:white;padding:6px 0 6px 0;" src = "../doc/background.png" width=84></div>
@@ -30,14 +30,52 @@ my $out = $title;
 
 foreach my $i (0..3) {
   $out .= "<h4>Plane ".($i+1)."</h4>";
-  $out .= qq%Sector 1<br><img src="MDCHVP%.$i.qq%S0V.png"> <img src="MDCHVP%.$i.qq%S0I.png"><br>%;
-  $out .= qq%Sector 2<br><img src="MDCHVP%.$i.qq%S1V.png"> <img src="MDCHVP%.$i.qq%S1I.png"><br>%;
-  $out .= qq%Sector 3<br><img src="MDCHVP%.$i.qq%S2V.png"> <img src="MDCHVP%.$i.qq%S2I.png"><br>%;
-  $out .= qq%Sector 4<br><img src="MDCHVP%.$i.qq%S3V.png"> <img src="MDCHVP%.$i.qq%S3I.png"><br>%;
-  $out .= qq%Sector 5<br><img src="MDCHVP%.$i.qq%S4V.png"> <img src="MDCHVP%.$i.qq%S4I.png"><br>%;
-  $out .= qq%Sector 6<br><img src="MDCHVP%.$i.qq%S5V.png"> <img src="MDCHVP%.$i.qq%S5I.png"><br>%;
+  $out .= qq%<img src="MDCHVP%.$i.qq%CV.png"> <img src="MDCHVP%.$i.qq%FV.png"><br>%;
+#  $out .= qq%Sector 2<br><img src="MDCHVP%.$i.qq%S1V.png"> <img src="MDCHVP%.$i.qq%S1I.png"><br>%;
+#  $out .= qq%Sector 3<br><img src="MDCHVP%.$i.qq%S2V.png"> <img src="MDCHVP%.$i.qq%S2I.png"><br>%;
+#  $out .= qq%Sector 4<br><img src="MDCHVP%.$i.qq%S3V.png"> <img src="MDCHVP%.$i.qq%S3I.png"><br>%;
+#  $out .= qq%Sector 5<br><img src="MDCHVP%.$i.qq%S4V.png"> <img src="MDCHVP%.$i.qq%S4I.png"><br>%;
+#  $out .= qq%Sector 6<br><img src="MDCHVP%.$i.qq%S5V.png"> <img src="MDCHVP%.$i.qq%S5I.png"><br>%;
   }
 
 my $fh;
-open ($fh,"> ".Hmon::HMONDIR."/files/MDCHVtrends.htm") or die;
+open ($fh,"> ".Hmon::HMONDIR."/files/MDCHVvoltagetrends.htm") or die;
 print $fh $out;
+close $fh; 
+
+
+
+$title = qq$<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+  <!--<meta http-equiv="refresh" content="60"/>-->
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>    
+  <link href="../files/indexstyles.css" rel="stylesheet" type="text/css"/>
+  <title>Hmon MDC HV Current Trends</title>
+  </head>
+  <body class="index"  style="position:relative;background:#d8e8f8;width:1650px;margin:auto;padding:120px 0 40px 10px">
+  <div style="position:fixed;left:0;top:0;width:100%;height:40px;background:#d8e8f8;box-shadow:none;"></div>
+  <h1 style="position:fixed;top:5px;left:0px;width:100%;display:block;text-align:center;margin:26px 0 0px 0">Hmon MDC HV Current Trends</h1>
+  <div  style="position:fixed;left:10px;top:30px;background:#346;padding:10px;margin:-22px 5px 5px 15px;"><img style="background:white;padding:6px 0 6px 0;" src = 
+"../doc/background.png" width=84></div>
+  <div  style="position:fixed;right:10px;top:30px;float:right;background:#346;padding:10px;margin:-22px 15px 5px 5px;"><img src = "../doc/link.png" width=84 
+height=84></div>
+$;
+
+ $foot = qq$
+  </div> 
+  </body>  
+  </html>$;
+  
+ $out = $title;
+
+foreach my $i (0..3) {
+  $out .= "<h4>Plane ".($i+1)."</h4>";
+  $out .= qq%<img src="MDCHVP%.$i.qq%CI.png"> <img src="MDCHVP%.$i.qq%FI.png"><br>%;
+  }
+
+open ($fh,"> ".Hmon::HMONDIR."/files/MDCHVcurrenttrends.htm") or die;
+print $fh $out;
+close $fh; 
+
+
index e5712f975514842173f55dd8970ce5c0383187ff..8090d5acc17afdd487214b486d55c493c2681f4b 100755 (executable)
 use warnings;
 use strict;
 use Hmon;
+use HADES::TrbNet;
+use Data::Dumper;
+
+trb_init_ports() or die trb_strerror();
 
 my $str = "";
 
+my $plots = fork();
+
+
+if($plots) {
+    while(1) {
+       my $histname = "ADC";
+       my $address = 0;
+       my $addonfilter = 0;
+
+       $str = Hmon::MakeTitle(9,12,"Pion 1 ADC Values",0);
+        ########### Hist Start ###############################################################
+       $address = 0x3800;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/PionADC1X.png%\" type=\"image/png\">\n";
+       
+        ########### Hist Start ###############################################################
+       $address = 0x3801;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/PionADC1Y.png%\" type=\"image/png\">\n";
+
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion1adc",$str);
+
+       # -------------------------------------------------------------------------------------------------
+       #
+       $str = Hmon::MakeTitle(9,12,"Pion 2 ADC Values",0);
+        ########### Hist Start ###############################################################
+       $address = 0x3810;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
 
-$str = Hmon::MakeTitle(9,12,"Pion 1 ADC Values", 0);
-$str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/PionADC1X.png%\" type=\"image/png\"><br/>\n";
-$str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/PionADC1Y.png%\" type=\"image/png\">\n";
-$str .= Hmon::MakeFooter();
-Hmon::WriteFile("pion1adc",$str);
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/PionADC2X.png%\" type=\"image/png\"><br/>\n";
+        ########### Hist Start ###############################################################
+       $address = 0x3811;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
 
-$str = Hmon::MakeTitle(9,12,"Pion 2 ADC Values", 0);
-$str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/PionADC2X.png%\" type=\"image/png\"><br/>\n";
-$str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/PionADC2Y.png%\" type=\"image/png\">\n";
-$str .= Hmon::MakeFooter();
-Hmon::WriteFile("pion2adc",$str);
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/PionADC2Y.png%\" type=\"image/png\">\n";
 
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion2adc",$str);
+       sleep(5);
+    }
+} else {
 
 
-  qx(./hmon_hadplot.sh -d 2000 -a 0x3800 -r 0x8b00 -m 128 -w 32 -p 0 -t "Y Channel" -xtitle "Y Channels" -key -xtitle "DOWN (5cm)                                                                       UP (5cm)" -key -curvestyle steps -xmin -1 -xmax 128 -ymin 0 -ymax 4100 -output "PNG.files/PionADC1X.700.265" reg >/dev/null &
-     ./hmon_hadplot.sh -d 2000 -a 0x3801 -r 0x8b00 -m 128 -w 32 -p 0 -t "X Channel" -xtitle "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -key -curvestyle steps -xmin -1 -xmax 128 -ymin 0 -ymax 4100  -output "PNG.files/PionADC1Y.700.265" reg >/dev/null &
-     ./hmon_hadplot.sh -d 2000 -a 0x3810 -r 0x8b00 -m 128 -w 32 -p 0 -t "Y Channel" -xtitle "Y Channels" -key -xtitle "DOWN (5cm)                                                                       UP (5cm)" -key -curvestyle steps -xmin -1 -xmax 128 -ymin 0 -ymax 4100  -output "PNG.files/PionADC2X.700.265" reg >/dev/null &
-     ./hmon_hadplot.sh -d 2000 -a 0x3811 -r 0x8b00 -m 128 -w 32 -p 0 -t "X Channel" -xtitle "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -key -curvestyle steps -xmin -1 -xmax 128 -ymin 0 -ymax 4100  -output "PNG.files/PionADC2Y.700.265" reg >/dev/null &);
+    qx(./hmon_hadplotnew.sh -d 2000 -a 0x3800 -r 0x8b00 -m 128 -w 32 -p 0 -t "Y Channel" -xtitle "Y Channels" -key -xtitle "DOWN (5cm)                                                                       UP (5cm)" -key -curvestyle steps -xmin -1 -xmax 128 -ymin 0 -ymax 4100 -output "PNG.files/PionADC1X.700.265" reg >/dev/null &
+     ./hmon_hadplotnew.sh -d 2000 -a 0x3801 -r 0x8b00 -m 128 -w 32 -p 0 -t "X Channel" -xtitle "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -key -curvestyle steps -xmin -1 -xmax 128 -ymin 0 -ymax 4100  -output "PNG.files/PionADC1Y.700.265" reg >/dev/null &
+     ./hmon_hadplotnew.sh -d 2000 -a 0x3810 -r 0x8b00 -m 128 -w 32 -p 0 -t "Y Channel" -xtitle "Y Channels" -key -xtitle "DOWN (5cm)                                                                       UP (5cm)" -key -curvestyle steps -xmin -1 -xmax 128 -ymin 0 -ymax 4100  -output "PNG.files/PionADC2X.700.265" reg >/dev/null &
+     ./hmon_hadplotnew.sh -d 2000 -a 0x3811 -r 0x8b00 -m 128 -w 32 -p 0 -t "X Channel" -xtitle "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -key -curvestyle steps -xmin -1 -xmax 128 -ymin 0 -ymax 4100  -output "PNG.files/PionADC2Y.700.265" reg >/dev/null &);
 
-  
+    
+}
diff --git a/hmon/hmon_pionovfl.pl b/hmon/hmon_pionovfl.pl
new file mode 100755 (executable)
index 0000000..bf71752
--- /dev/null
@@ -0,0 +1,125 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Hmon;
+use HADES::TrbNet;
+use Data::Dumper;
+
+trb_init_ports() or die trb_strerror();
+
+my $str = "";
+
+my $plots = fork();
+
+
+if($plots) {
+    while(1) {
+       my $histname = "Overflow Rate";
+       my $address = 0;
+       my $filter = 0;
+       my $addonfilter = 0;
+       
+       $str = Hmon::MakeTitle(9,12,"Pion 1 Ovfl Rates",0);
+       
+       ########### Hist Start ###############################################################
+       $address = 0x3800;
+       $filter = trb_register_read($address, 0x8400);
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($filter->{$address} & 0x80000000) == 0) {
+           if (($addonfilter->{$address} & 0x80000000) > 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1XOvfl.png%\" type=\"image/png\">\n";
+       
+       ########### Hist Start ###############################################################
+       $address = 0x3801;
+       $filter = trb_register_read($address, 0x8400);
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+       
+       if (($filter->{$address} & 0x80000000) == 0) {
+           if (($addonfilter->{$address} & 0x80000000) > 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1YOvfl.png%\" type=\"image/png\">\n";
+
+
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion1ovfl",$str);
+
+       # ------------------------------------------------------------------------------------------------------
+       
+
+       $str = Hmon::MakeTitle(9,12,"Pion 2 Ovfl Rates",0);
+       
+       ########### Hist Start ###############################################################
+       $address = 0x3810;
+       $filter = trb_register_read($address, 0x8400);
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($filter->{$address} & 0x80000000) == 0) {
+           if (($addonfilter->{$address} & 0x80000000) > 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2XOvfl.png%\" type=\"image/png\">\n";
+
+       
+       #  
+       # Get Histogram Filter Status
+       #
+       ########### Hist Start ###############################################################
+       $address = 0x3811;
+       $filter = trb_register_read($address, 0x8400);
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+       
+       if (($filter->{$address} & 0x80000000) == 0) {
+           if (($addonfilter->{$address} & 0x80000000) > 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2YOvfl.png%\" type=\"image/png\">\n";
+
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion2ovfl",$str);
+       sleep(5);
+    }
+} else { 
+    qx(./hmon_hadplotnew.sh -d 1000 -a 0x3800 -r 0x8a00 -m 128 -w 32 -p 0  -t "Y Channels" -key -xtitle "DOWN (-5cm)                                                                      UP (5cm)" -output "PNG.files/Pion1XOvfl.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3801 -r 0x8a00 -m 128 -w 32 -p 0  -t "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -output "PNG.files/Pion1YOvfl.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3810 -r 0x8a00 -m 128 -w 32 -p 0  -t "Y Channels" -key -xtitle "DOWN (-5cm)                                                                      UP (5cm)" -output "PNG.files/Pion2XOvfl.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3811 -r 0x8a00 -m 128 -w 32 -p 0  -t "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -output "PNG.files/Pion2YOvfl.700.265" regdiff >/dev/null &);
+}
+
+
diff --git a/hmon/hmon_pionpileup.pl b/hmon/hmon_pionpileup.pl
new file mode 100755 (executable)
index 0000000..66dbc2f
--- /dev/null
@@ -0,0 +1,125 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Hmon;
+use HADES::TrbNet;
+use Data::Dumper;
+
+trb_init_ports() or die trb_strerror();
+
+my $str = "";
+
+my $plots = fork();
+
+
+if($plots) {
+    while(1) {
+       my $histname = "Pileup Rate";
+       my $address = 0;
+       my $filter = 0;
+       my $addonfilter = 0;
+       
+       $str = Hmon::MakeTitle(9,12,"Pion 1 Pileup Rates",0);
+       
+       ########### Hist Start ###############################################################
+       $address = 0x3800;
+       $filter = trb_register_read($address, 0x8400);
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($filter->{$address} & 0x80000000) == 0) {
+           if (($addonfilter->{$address} & 0x80000000) > 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1XPileup.png%\" type=\"image/png\">\n";
+       
+       ########### Hist Start ###############################################################
+       $address = 0x3801;
+       $filter = trb_register_read($address, 0x8400);
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+       
+       if (($filter->{$address} & 0x80000000) == 0) {
+           if (($addonfilter->{$address} & 0x80000000) > 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1YPileup.png%\" type=\"image/png\">\n";
+
+
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion1pileup",$str);
+
+       # ------------------------------------------------------------------------------------------------------
+       
+
+       $str = Hmon::MakeTitle(9,12,"Pion 2 Pileup Rates",0);
+       
+       ########### Hist Start ###############################################################
+       $address = 0x3810;
+       $filter = trb_register_read($address, 0x8400);
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($filter->{$address} & 0x80000000) == 0) {
+           if (($addonfilter->{$address} & 0x80000000) > 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2XPileup.png%\" type=\"image/png\">\n";
+
+       
+       #  
+       # Get Histogram Filter Status
+       #
+       ########### Hist Start ###############################################################
+       $address = 0x3811;
+       $filter = trb_register_read($address, 0x8400);
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+       
+       if (($filter->{$address} & 0x80000000) == 0) {
+           if (($addonfilter->{$address} & 0x80000000) > 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2YPileup.png%\" type=\"image/png\">\n";
+
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion2pileup",$str);
+       sleep(5);
+    }
+} else { 
+    qx(./hmon_hadplotnew.sh -d 1000 -a 0x3800 -r 0x8900 -m 128 -w 32 -p 0  -t "Y Channels" -key -xtitle "DOWN (-5cm)                                                                      UP (5cm)" -output "PNG.files/Pion1XPileup.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3801 -r 0x8900 -m 128 -w 32 -p 0  -t "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -output "PNG.files/Pion1YPileup.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3810 -r 0x8900 -m 128 -w 32 -p 0  -t "Y Channels" -key -xtitle "DOWN (-5cm)                                                                      UP (5cm)" -output "PNG.files/Pion2XPileup.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3811 -r 0x8900 -m 128 -w 32 -p 0  -t "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -output "PNG.files/Pion2YPileup.700.265" regdiff >/dev/null &);
+}
+
+
index 3a57ab7c922e1437d703572e1a098f53e7481ab6..b54d0907ce7b03cdc9a1a46558af6530b17150c5 100755 (executable)
@@ -14,70 +14,97 @@ my $plots = fork();
 
 
 if($plots) {
-  while(1) {
-    my $filter;
-
-    $str = Hmon::MakeTitle(9,12,"Pion 1 Rates",0);
-    #
-    # Get Histogram Filter Status
-    #
-    $filter = trb_register_read(0x3800, 0x8400);
-    print Dumper $filter;
-    if (($filter->{0x3800} & 0x80000000) > 0) {
-       $str .= "All Data";     
-    } else {
-       $str .= "Event Buffer Data";
-    }
-    $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1X.png%\" type=\"image/png\">\n";
-    
-    # Get Histogram Filter Status
-    #
-    $filter = trb_register_read(0x3801, 0x8400);
-    if (($filter->{0x3801} & 0x80000000) > 0) {
-       $str .= "All Data";     
-    } else {
-       $str .= "Event Buffer Data";
-    }
-    $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1Y.png%\" type=\"image/png\">\n";
-
-    $str .= Hmon::MakeFooter();
-    Hmon::WriteFile("pion1rate",$str);
-
-    # ---------------------------------------------------------------------------------------------------------
-    #
-    $str = Hmon::MakeTitle(9,12,"Pion 2 Rates",0);
-    #
-    # Get Histogram Filter Status
-    #
-    $filter = trb_register_read(0x3810, 0x8400);
-    if (($filter->{0x3810} & 0x80000000) > 0) {
-       $str .= "All Data";     
-    } else {
-       $str .= "Event Buffer Data";
-    }
-    $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2X.png%\" type=\"image/png\"><br/>\n";
-
-    #
-    # Get Histogram Filter Status
-    #
-    $filter = trb_register_read(0x3811, 0x8400);
-    if (($filter->{0x3811} & 0x80000000) > 0) {
-       $str .= "All Data";     
-    } else {
-       $str .= "Event Buffer Data";
-    }
-    $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2Y.png%\" type=\"image/png\">\n";
+    while(1) {
+       my $histname = "Hit Rate";
+       my $address = 0;
+       my $addonfilter = 0;
+       
+       $str = Hmon::MakeTitle(9,12,"Pion 1 Rates",0);
+
+       ########### Hist Start ###############################################################
+       $address = 0x3800;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1X.png%\" type=\"image/png\">\n";
+       
+       ########### Hist Start ###############################################################
+       $address = 0x3801;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1Y.png%\" type=\"image/png\">\n";
+
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion1rate",$str);
 
-    $str .= Hmon::MakeFooter();
-    Hmon::WriteFile("pion2rate",$str);
-    sleep(5);
+       # ---------------------------------------------------------------------------------------------------------
+
+       $str = Hmon::MakeTitle(9,12,"Pion 2 Rates",0);
+
+       ########### Hist Start ###############################################################
+       $address = 0x3810;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2X.png%\" type=\"image/png\"><br/>\n";
+
+       ########### Hist Start ###############################################################
+       $address = 0x3811;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} (TS Cut Level2)";  
+           } else { 
+               $str .= "${histname} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2Y.png%\" type=\"image/png\">\n";
+
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion2rate",$str);
+       sleep(5);
     }
-  }
-else{
-  qx(./hmon_hadplot.sh -d 1000 -a 0x3800 -r 0x8800 -m 128 -w 32 -p 0  -t "Y Channels" -key -xtitle "DOWN (5cm)                                                                       UP (5cm)" -output "PNG.files/Pion1X.700.265" regdiff >/dev/null &
-     ./hmon_hadplot.sh -d 1000 -a 0x3801 -r 0x8800 -m 128 -w 32 -p 0  -t "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -output "PNG.files/Pion1Y.700.265" regdiff >/dev/null &
-     ./hmon_hadplot.sh -d 1000 -a 0x3810 -r 0x8800 -m 128 -w 32 -p 0  -t "Y Channels" -key -xtitle "DOWN (5cm)                                                                       UP (5cm)" -output "PNG.files/Pion2X.700.265" regdiff >/dev/null &
-     ./hmon_hadplot.sh -d 1000 -a 0x3811 -r 0x8800 -m 128 -w 32 -p 0  -t "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -output "PNG.files/Pion2Y.700.265" regdiff >/dev/null &);
-  }
-
-  
+} else { 
+    qx(./hmon_hadplotnew.sh -d 1000 -a 0x3800 -r 0x8800 -m 128 -w 32 -p 0  -t "Y Channels" -key -xtitle "DOWN (-5cm)                                                                    UP (5cm)" -output "PNG.files/Pion1X.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3801 -r 0x8800 -m 128 -w 32 -p 0  -t "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -output "PNG.files/Pion1Y.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3810 -r 0x8800 -m 128 -w 32 -p 0  -t "Y Channels" -key -xtitle "DOWN (-5cm)                                                                      UP (5cm)" -output "PNG.files/Pion2X.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3811 -r 0x8800 -m 128 -w 32 -p 0  -t "X Channels" -key -xtitle "RIGHT (-5cm)                                                                  LEFT (5cm)" -output "PNG.files/Pion2Y.700.265" regdiff >/dev/null &);
+}
+
+
diff --git a/hmon/hmon_pionts.pl b/hmon/hmon_pionts.pl
new file mode 100755 (executable)
index 0000000..042b29d
--- /dev/null
@@ -0,0 +1,126 @@
+#!/usr/bin/perl -w
+
+use warnings;
+use strict;
+use Hmon;
+use HADES::TrbNet;
+use Data::Dumper;
+
+trb_init_ports() or die trb_strerror();
+
+my $str = "";
+
+my $plots = fork();
+my @rangestr = ("0.5&#956;s",
+               "  1&#956;s",
+               "  2&#956;s",
+               "  4&#956;s",
+               "  8&#956;s",
+               " 16&#956;s"
+    );
+
+if($plots) {
+    while(1) {
+       my $histname = "Timestamp";
+       my $address = 0;
+       my $addonfilter = 0;
+       my $range = 0;
+       my $Range;
+       
+       $str = Hmon::MakeTitle(9,12,"Pion 1 Timestamps",0);
+
+       ########### Hist Start ###############################################################
+       $address = 0x3800;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $range = trb_register_read($address, 0x8421);
+       $Range = $rangestr[$range->{$address}];
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} ${Range} (TS Cut Level2)"; 
+           } else { 
+               $str .= "${histname} ${Range} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname} ${Range}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1YTS.png%\" type=\"image/png\">\n";
+       
+       ########### Hist Start ###############################################################
+       $address = 0x3801;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $range = trb_register_read($address, 0x8421);
+       $Range = $rangestr[$range->{$address}];
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} ${Range} (TS Cut Level2)"; 
+           } else { 
+               $str .= "${histname} ${Range} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname} ${Range}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion1XTS.png%\" type=\"image/png\">\n";
+
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion1ts",$str);
+
+       # ---------------------------------------------------------------------------------------------------------
+
+       $str = Hmon::MakeTitle(9,12,"Pion 2 Timestamps",0);
+
+       ########### Hist Start ###############################################################
+       $address = 0x3810;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $range = trb_register_read($address, 0x8421);
+       $Range = $rangestr[$range->{$address}];
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} ${Range} (TS Cut Level2)"; 
+           } else { 
+               $str .= "${histname} ${Range} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname} ${Range}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2YTS.png%\" type=\"image/png\"><br/>\n";
+
+       ########### Hist Start ###############################################################
+       $address = 0x3811;
+       $addonfilter = trb_register_read($address, 0x8420);
+       $range = trb_register_read($address, 0x8421);
+       $Range = $rangestr[$range->{$address}];
+       $str .= "<strong>";
+
+       if (($addonfilter->{$address} & 0x80000000) != 0) {
+           if (($addonfilter->{$address} & 0x40000000) != 0) {   
+               $str .= "${histname} ${Range} (TS Cut Level2)"; 
+           } else { 
+               $str .= "${histname} ${Range} (TS Cut)";
+           }
+       } else {
+           $str .= "${histname} ${Range}";
+       }
+       $str .= "</strong>";
+       $str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2XTS.png%\" type=\"image/png\">\n";
+
+       $str .= Hmon::MakeFooter();
+       Hmon::WriteFile("pion2ts",$str);
+       sleep(5);
+    }
+} else { 
+    qx(./hmon_hadplotnew.sh -d 1000 -a 0x3800 -r 0x8c00 -m 512 -w 32 -p 0  -t "Y Timestamps" -key -output "PNG.files/Pion1YTS.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3801 -r 0x8c00 -m 512 -w 32 -p 0  -t "X Timestamps" -key -output "PNG.files/Pion1XTS.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3810 -r 0x8c00 -m 512 -w 32 -p 0  -t "Y Timestamps" -key -output "PNG.files/Pion2YTS.700.265" regdiff >/dev/null &
+     ./hmon_hadplotnew.sh -d 1000 -a 0x3811 -r 0x8c00 -m 512 -w 32 -p 0  -t "X Timestamps" -key -output "PNG.files/Pion2XTS.700.265" regdiff >/dev/null &);
+}
+
+
index 6c9488fe20faa9068d57fd6a8c09540b89797dcb..367303123e8d46949b0e21c708eb625b37f7ba2a 100755 (executable)
@@ -134,6 +134,12 @@ while (1) {
   $longtext  = sprintf("Trigger Rate from Start: %i Hz",$store{0xa009});
   QA::WriteQALog($fqa, "rate", "start", 10,
        $state, 'Start Rate', $shorttext, $longtext);        
+
+  $state = QA::OK;
+  $shorttext = QA::SciNotation(($store{0xa03c}-220)/(($store{0xa037}-780)||1));
+  $longtext  = sprintf("Trigger Rate from PT1/TOF vs. Hodoscope: %.2f",($store{0xa03c}-220)/(($store{0xa037}-780)||1));
+  QA::WriteQALog($fqa, "trg", "pt1rate", 10,
+       $state, 'Hodo/PT1', $shorttext, $longtext);            
        
   sleep 1;
 }
old mode 100644 (file)
new mode 100755 (executable)
index 2c4fea7..9e7fc0f
@@ -14,6 +14,15 @@ my $plots = fork();
 
 if($plots) {
   my $i = 0;
+  
+    $str = Hmon::MakeTitle(10,8,"Hodo Fine Histogram",0);
+    $str .= qq@
+    <img src="%ADDPNG files/hodofinehist.png%" type="image/png">
+    @;
+    $str .= Hmon::MakeFooter();
+    Hmon::WriteFile("HodoFineHist",$str);
+
+
   while(1) {
     my $binning = trb_register_read(3,0xa0c8) or sleep 5 and next;
     my $offset  = trb_register_read(3,0xa0c6) or sleep 5 and next;
@@ -58,50 +67,57 @@ if($plots) {
     }
   }
 else {
-  qx(./hmon_hadplot.sh -d 3000 \\
-          -a 0x0003 -r 42216 -m 500 -p 0 -w 32  -t "X 1" \\
-          -a 0x0003 -r 42716 -m 500 -p 0 -w 32  -t "X 2" \\
-          -a 0x0003 -r 43216 -m 500 -p 0 -w 32  -t "X 3" \\
-          -a 0x0003 -r 43716 -m 500 -p 0 -w 32  -t "X 4" \\
-          -a 0x0003 -r 44216 -m 500 -p 0 -w 32  -t "X 5" \\
-          -a 0x0003 -r 44716 -m 500 -p 0 -w 32  -t "X 6" \\
-          -a 0x0003 -r 45216 -m 500 -p 0 -w 32  -t "X 7" \\
-          -a 0x0003 -r 45716 -m 500 -p 0 -w 32  -t "X 8" \\
- -output "PNG.files/starthistx0.760.365" -curvestyle steps -key genreg 2>/dev/null &
-./hmon_hadplot.sh -d 3000 \\
-          -a 0x0003 -r 46216 -m 500 -p 0 -w 32  -t "Y 1" \\
-          -a 0x0003 -r 46716 -m 500 -p 0 -w 32  -t "Y 2" \\
-          -a 0x0003 -r 47216 -m 500 -p 0 -w 32  -t "Y 3" \\
-          -a 0x0003 -r 47716 -m 500 -p 0 -w 32  -t "Y 4" \\
-          -a 0x0003 -r 48216 -m 500 -p 0 -w 32  -t "Y 5" \\
-          -a 0x0003 -r 48716 -m 500 -p 0 -w 32  -t "Y 6" \\
-          -a 0x0003 -r 49216 -m 500 -p 0 -w 32  -t "Y 7" \\
-          -a 0x0003 -r 49716 -m 500 -p 0 -w 32  -t "Y 8" \\
--output "PNG.files/starthisty0.760.365" -curvestyle steps -key genreg 2>/dev/null  & 
-
-./hmon_hadplot.sh -d 3000 \\
-          -a 0x0003 -r 42216 -m 500 -p 0 -w 32  -t "X 1" \\
-          -a 0x0003 -r 42716 -m 500 -p 0 -w 32  -t "X 2" \\
-          -a 0x0003 -r 43216 -m 500 -p 0 -w 32  -t "X 3" \\
-          -a 0x0003 -r 43716 -m 500 -p 0 -w 32  -t "X 4" \\
-          -a 0x0003 -r 44216 -m 500 -p 0 -w 32  -t "X 5" \\
-          -a 0x0003 -r 44716 -m 500 -p 0 -w 32  -t "X 6" \\
-          -a 0x0003 -r 45216 -m 500 -p 0 -w 32  -t "X 7" \\
-          -a 0x0003 -r 45716 -m 500 -p 0 -w 32  -t "X 8" \\
- -output "PNG.files/starthiststackedx0.760.365" -curvestyle histostacked -key genreg 2>/dev/null &
-./hmon_hadplot.sh -d 3000 \\
-          -a 0x0003 -r 46216 -m 500 -p 0 -w 32  -t "Y 1" \\
-          -a 0x0003 -r 46716 -m 500 -p 0 -w 32  -t "Y 2" \\
-          -a 0x0003 -r 47216 -m 500 -p 0 -w 32  -t "Y 3" \\
-          -a 0x0003 -r 47716 -m 500 -p 0 -w 32  -t "Y 4" \\
-          -a 0x0003 -r 48216 -m 500 -p 0 -w 32  -t "Y 5" \\
-          -a 0x0003 -r 48716 -m 500 -p 0 -w 32  -t "Y 6" \\
-          -a 0x0003 -r 49216 -m 500 -p 0 -w 32  -t "Y 7" \\
-          -a 0x0003 -r 49716 -m 500 -p 0 -w 32  -t "Y 8" \\
--output "PNG.files/starthiststackedy0.760.365" -curvestyle histostacked -key genreg 2>/dev/null  & 
-
+  qx(./hmon_hadplot_old.sh -d 3000 \\
+      -a 0x0003 -r 53216 -m 500 -p 0 -w 32  -t "Hodo" \\
+      -a 0x0003 -r 53716 -m 500 -p 0 -w 32  -t "PionC" \\
+      -ytitle "Hits / 10 us"  \\
+      -output "PNG.files/hodofinehist.760.365" -curvestyle steps -key genreg 2>/dev/null &
     );
+
+#   qx(./hmon_hadplot_old.sh -d 3000 \\
+#           -a 0x0003 -r 42216 -m 500 -p 0 -w 32  -t "X 1" \\
+#           -a 0x0003 -r 42716 -m 500 -p 0 -w 32  -t "X 2" \\
+#           -a 0x0003 -r 43216 -m 500 -p 0 -w 32  -t "X 3" \\
+#           -a 0x0003 -r 43716 -m 500 -p 0 -w 32  -t "X 4" \\
+#           -a 0x0003 -r 44216 -m 500 -p 0 -w 32  -t "X 5" \\
+#           -a 0x0003 -r 44716 -m 500 -p 0 -w 32  -t "X 6" \\
+#           -a 0x0003 -r 45216 -m 500 -p 0 -w 32  -t "X 7" \\
+#           -a 0x0003 -r 45716 -m 500 -p 0 -w 32  -t "X 8" \\
+#  -output "PNG.files/starthistx0.760.365" -curvestyle steps -key genreg 2>/dev/null &
+#  
+# ./hmon_hadplot_old.sh -d 3000 \\
+#           -a 0x0003 -r 46216 -m 500 -p 0 -w 32  -t "Y 1" \\
+#           -a 0x0003 -r 46716 -m 500 -p 0 -w 32  -t "Y 2" \\
+#           -a 0x0003 -r 47216 -m 500 -p 0 -w 32  -t "Y 3" \\
+#           -a 0x0003 -r 47716 -m 500 -p 0 -w 32  -t "Y 4" \\
+#           -a 0x0003 -r 48216 -m 500 -p 0 -w 32  -t "Y 5" \\
+#           -a 0x0003 -r 48716 -m 500 -p 0 -w 32  -t "Y 6" \\
+#           -a 0x0003 -r 49216 -m 500 -p 0 -w 32  -t "Y 7" \\
+#           -a 0x0003 -r 49716 -m 500 -p 0 -w 32  -t "Y 8" \\
+# -output "PNG.files/starthisty0.760.365" -curvestyle steps -key genreg 2>/dev/null  & 
+# 
+# ./hmon_hadplot_old.sh -d 3000 \\
+#           -a 0x0003 -r 42216 -m 500 -p 0 -w 32  -t "X 1" \\
+#           -a 0x0003 -r 42716 -m 500 -p 0 -w 32  -t "X 2" \\
+#           -a 0x0003 -r 43216 -m 500 -p 0 -w 32  -t "X 3" \\
+#           -a 0x0003 -r 43716 -m 500 -p 0 -w 32  -t "X 4" \\
+#           -a 0x0003 -r 44216 -m 500 -p 0 -w 32  -t "X 5" \\
+#           -a 0x0003 -r 44716 -m 500 -p 0 -w 32  -t "X 6" \\
+#           -a 0x0003 -r 45216 -m 500 -p 0 -w 32  -t "X 7" \\
+#           -a 0x0003 -r 45716 -m 500 -p 0 -w 32  -t "X 8" \\
+#  -output "PNG.files/starthiststackedx0.760.365" -curvestyle histostacked -key genreg 2>/dev/null &
+#  
+# ./hmon_hadplot_old.sh -d 3000 \\
+#           -a 0x0003 -r 46216 -m 500 -p 0 -w 32  -t "Y 1" \\
+#           -a 0x0003 -r 46716 -m 500 -p 0 -w 32  -t "Y 2" \\
+#           -a 0x0003 -r 47216 -m 500 -p 0 -w 32  -t "Y 3" \\
+#           -a 0x0003 -r 47716 -m 500 -p 0 -w 32  -t "Y 4" \\
+#           -a 0x0003 -r 48216 -m 500 -p 0 -w 32  -t "Y 5" \\
+#           -a 0x0003 -r 48716 -m 500 -p 0 -w 32  -t "Y 6" \\
+#           -a 0x0003 -r 49216 -m 500 -p 0 -w 32  -t "Y 7" \\
+#           -a 0x0003 -r 49716 -m 500 -p 0 -w 32  -t "Y 8" \\
+# -output "PNG.files/starthiststackedy0.760.365" -curvestyle histostacked -key genreg 2>/dev/null  & 
+# 
+#     );
   }
 
index 1d2bee57b7382d54a5506e5f4aec0108c9e82ac8..502385514c81d95c7e173399b89dfaeb1323cb95 100755 (executable)
@@ -88,9 +88,18 @@ while (1) {
   
   $lastoutofspill = $outofspill;
   $outofspill = ($rStat->{0x3}->[2] || 0) & 0x10;
-  
+  my $trgacc = 0;
+
+#   printf("%i\n",$rh->{3}->[30]);  
   $rh->{3}->[0] <<= 2;  #shift to align with outputs
-  $rh->{3}->[30] = 200000000/($rh->{3}->[30] || 1) if $rh->{3}->[30];
+  if (($rh->{3}->[30]&0xffffff) != 0) {
+    $rh->{3}->[30] = 200000000./((($rh->{3}->[30]&0xffffff)+1)|| 1);
+    }
+  else {
+    $rh->{3}->[30] = 0;
+    }
+
+#   printf("%i\n",$rh->{3}->[30]);
 
 #Decode downscaling  
   for (my $i = 0; $i<8; $i++) {
@@ -105,8 +114,7 @@ while (1) {
   my $accmsg = "";
   my $acclmsg = "";
   my $trgprov = 0;
-  my $trgacc = 0;
-  
+
   if($rh->{3}->[30]) {
     $qastate = QA::NOTE;
     $msg     .= sprintf("%sHz ",QA::SciNotation($rh->{3}->[30]));
@@ -229,10 +237,14 @@ my $longmsgcheck = $longmsg;
   my $startmsg = "";
   my $startlongmsg = "";
   
-  foreach my $i (0..7) {
-    $startsum += $rStat->{3}->[$i+0x8] ;
-    }
+#   foreach my $i (0..7) {
+#     $startsum += $rStat->{3}->[$i+0x8] ;
+#     }
+#   $spillsum += $startsum;
+#   
+  $startsum  = $rStat->{3}->[0x29];
   $spillsum += $startsum;
+  
 ######################################
 ## QA check for spill sum on Start
   if ($lastspillsum < 0 || $lastspillsum > 50000000) {
@@ -246,8 +258,8 @@ my $longmsgcheck = $longmsg;
     $spillsum = 0;
     }
   $startmsg = sprintf("%s / %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
-  $startlongmsg = sprintf("Start counts per second %s/s  - Start counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
-  QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Start Count", $startmsg, $startlongmsg);
+  $startlongmsg = sprintf("Hodo counts per second %s/s  - Hodo counts per spill %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
+  QA::WriteQALog($fqa, "trg", "start", 10, $qastatstart, "Hodo Count", $startmsg, $startlongmsg);
    
   
   
index cb68effab06a4a560c433d5317312e743e91b0eb..4174278081b68b528c456c9c23c464de8cee062d 100755 (executable)
@@ -49,14 +49,18 @@ function openwin(url) {
 </ul></div>
 
 <div class="linkbox" style="float:right"><h4>Pion</h4><ul>
-<li><a href="monitor.cgi?1-window-DiamondRate">Rate on Start Diamond</a></li>
+<!--<li><a href="monitor.cgi?1-window-DiamondRate">Rate on Start Diamond</a></li>-->
 <li><a href="monitor.cgi?1-window-pion1rate">Rate on Pion 1</a></li>
 <li><a href="monitor.cgi?1-window-pion2rate">Rate on Pion 2</a></li>
 <li><a href="monitor.cgi?1-window-pion1adc">ADC values on Pion 1</a></li>
 <li><a href="monitor.cgi?1-window-pion2adc">ADC values on Pion 2</a></li>
 <li><a href="monitor.cgi?5-window-PionSupplies">Pion Power &amp; Cooling</a></li>
+<li><a href="monitor.cgi?2-window-HodoHist">Spill Shape from Hodoscope</a></li>
 <li><a href="monitor.cgi?1-window-HodoRate">Rate on Hodoscope (heatmap)</a></li>
-<li><a href="monitor.cgi?1-window-HodoRatePlot">Rate on Hodoscope (curve)</a></li>
+<li><a href="monitor.cgi?2-window-HodoRatePlot">Rate on Hodoscope (curve)</a></li>
+<li><a href="monitor.cgi?1-window-HitRatios">Hit Ratio Pion/Hodo (current)</a></li>
+<li><a href="monitor.cgi?2-window-HitRatioHist">Hit Ratio Pion/Hodo (history)</a></li>
+<li><a href="monitor.cgi?2-window-HitSumHist">Hit Rate Summary</a></li>
 </ul></div>
 
 
@@ -65,8 +69,8 @@ function openwin(url) {
 <li><a href="monitor.cgi?1-window-eventrateshort">Eventrate histogram (10s)</a></li>
 <li><a href="monitor.cgi?1-window-eventrate">Eventrate histogram (60s)</a></li>
 <li><a href="monitor.cgi?5-window-eventratelong">Eventrate histogram (10m)</a></li>
-<li><a href="monitor.cgi?10-window-StartCountSpill">Start counts per spill</a></li>
-<li><a href="monitor.cgi?10-window-Pt3AcceptRatio">Ratio of accepted PT3 per spill</a></li>
+<!--<li><a href="monitor.cgi?10-window-StartCountSpill">Start counts per spill</a></li>
+<li><a href="monitor.cgi?10-window-Pt3AcceptRatio">Ratio of accepted PT3 per spill</a></li>-->
 <li><a href="monitor.cgi?10-window-EvtsPerSpill">Recorded events per spill</a></li>
 <li><a href="monitor.cgi?5-window-Starthist">Start hit count histograms</a></li>
 <!--<li><a href="monitor.cgi?5-window-Vetohist">Veto hit count histograms</a></li>-->
@@ -90,12 +94,13 @@ function openwin(url) {
 
 <div class="linkbox" style="float:left"><h4>High Voltage</h4><ul>
 <li><a href="monitor.cgi?10-MDCHV">MDC HV settings</a></li>
-<li><a href="files/MDCHVtrends.htm">MDC HV trend plots</a></li>
+<li><a href="files/MDCHVvoltagetrends.htm">MDC HV voltage trend plots</a></li>
+<li><a href="files/MDCHVcurrenttrends.htm">MDC HV current trend plots</a></li>
 <li><a href="monitor.cgi?1-RichHV">RICH HV settings &amp; currents</a></li>
 </ul></div>
 
 
-<div class="linkbox" style="float:right"><h4>Eventbuilder</h4><ul>
+<div class="linkbox" style="float:left"><h4>Eventbuilder</h4><ul>
 <li><a href="monitor.cgi?30-window-EBDisks">Fill-level of disks</a></li>
 <li><a href="monitor.cgi?10-window-EBCPU">Server CPU load</a></li>
 <li><a href="monitor.cgi?10-window-hldlast">Last hld files written</a></li>
index 296fbb95cda7c5d4bf5a69c255d5108d5de6951d..87425d48f88059029f719fa98b07d63a2200ed80 100755 (executable)
@@ -70,6 +70,7 @@ $;
 $out .= qq$<script  language='javascript'>
   var reloadevery = setTimeout('reload()',10);
   var saveScrollTop = 0;
+  var forcereloadbecauseofmemoryleak = setTimeout("location.reload()",1800000);
   blinkcnt = 0;
   blinking = setInterval("blink()",490);
   currentzoom = 1;
@@ -105,6 +106,8 @@ function reload() {
 
       document.getElementById("stop").style.background="#444";
       reloadevery = setTimeout('reload()',$.($delay*1000).qq$);
+      delete xmlhttp;
+      delete saveScrollTop;
       }
     };
   if(document.getElementById('logbox')) {
old mode 100755 (executable)
new mode 100644 (file)
index 5e27089449d74e9937b35921e4a34673cc29ea7b..45770aeb523c7d7d1887222cdc11e15254b04864 100644 (file)
@@ -13,8 +13,8 @@ use HADES::TrbNet;
 use HPlot;
 
 my $timer = 0;
-my @colors = ("#003366","#006666","#00cc99","#00ff44","#00cc00","#00ff00","#666600","#aa6600","#ddcc00","#ffcc00","#aa2200","#ff0000");
-my @names = qw( F1 F2 F3 F4 F5 F6 C1 C2 C3 C4 C5 C6 );
+my @colors = ("#000000", "#ff0000","#00ff00","#0000ff","#cccc00","#cc00cc");
+my @names = qw( S0 S1 S2 S3 S4 S5 );
 my $connect_status = &trb_init_ports();
 if(!$connect_status) {
   die("could not connect to trbnetd");
@@ -26,68 +26,70 @@ if(!$connect_status) {
 
 # my $fqa = QA::OpenQAFile();
 my @plot;
-foreach my $s (0..5){
-  foreach my $p (0..1) {
-    $plot[$p*6+$s] = ();
-    $plot[$p*6+$s]->{name}    = "P".$p."S".$s."I";
-    $plot[$p*6+$s]->{file}    = "files/MDCHV".$plot[$p*6+$s]->{name};
-    $plot[$p*6+$s]->{entries} = 1440;
-    $plot[$p*6+$s]->{xscale}  = 12;
-    $plot[$p*6+$s]->{type}    = HPlot::TYPE_HISTORY;
-    $plot[$p*6+$s]->{output}  = HPlot::OUT_PNG;
-    $plot[$p*6+$s]->{xlabel}  = "Minutes";
-    $plot[$p*6+$s]->{ylabel}  = "Current";
-    $plot[$p*6+$s]->{sizex}   = 1130;
-    $plot[$p*6+$s]->{sizey}   = 420;
-    $plot[$p*6+$s]->{curves}  = 12;
-    $plot[$p*6+$s]->{dots}  = 1;
-    $plot[$p*6+$s]->{colors}  = \@colors;
-    foreach my $c (0..11) {
-      $plot[$p*6+$s]->{titles}->[$c] = $names[$c];
+foreach my $s (0..1) {
+  foreach my $p (0..3) {
+    $plot[$p*2+$s] = ();
+    $plot[$p*2+$s]->{name}    = "P".$p.($s?'C':'F')."I";
+    $plot[$p*2+$s]->{file}    = "files/MDCHV".$plot[$p*2+$s]->{name};
+    $plot[$p*2+$s]->{entries} = 360;
+    $plot[$p*2+$s]->{xscale}  = 12;
+    $plot[$p*2+$s]->{type}    = HPlot::TYPE_HISTORY;
+    $plot[$p*2+$s]->{output}  = HPlot::OUT_PNG;
+    $plot[$p*2+$s]->{xlabel}  = "Minutes";
+    $plot[$p*2+$s]->{ylabel}  = ($s?'C':'F')." Current";
+    $plot[$p*2+$s]->{sizex}   = 800;
+    $plot[$p*2+$s]->{sizey}   = 420;
+    $plot[$p*2+$s]->{curves}  = 6;
+    $plot[$p*2+$s]->{dots}    = 1;
+    $plot[$p*2+$s]->{colors}  = \@colors;
+    foreach my $c (0..5) {
+      $plot[$p*2+$s]->{titles}->[$c] = ($s?'C ':'F ').$names[$c];
       }
-    HPlot::PlotInit($plot[$p*6+$s]);
-    $plot[$p*6+$s+24]->{name}    = "P".$p."S".$s."V";
-    $plot[$p*6+$s+24]->{file}    = "files/MDCHV".$plot[$p*6+$s+24]->{name};
-    $plot[$p*6+$s+24]->{entries} = 1440;
-    $plot[$p*6+$s+24]->{xscale}  = 12;
-    $plot[$p*6+$s+24]->{type}    = HPlot::TYPE_HISTORY;
-    $plot[$p*6+$s+24]->{output}  = HPlot::OUT_PNG;
-    $plot[$p*6+$s+24]->{xlabel}  = "Minutes";
-    $plot[$p*6+$s+24]->{ylabel}  = "Voltage";
-    $plot[$p*6+$s+24]->{sizex}   = 1130;
-    $plot[$p*6+$s+24]->{sizey}   = 420;
-    $plot[$p*6+$s+24]->{curves}  = 12;
-    $plot[$p*6+$s+24]->{dots}  = 1;
-    $plot[$p*6+$s+24]->{colors}  = \@colors;
-    foreach my $c (0..11) {
-      $plot[$p*6+$s+24]->{titles}->[$c] = $names[$c];
+    HPlot::PlotInit($plot[$p*2+$s]);
+
+    $plot[$p*2+$s+8]->{name}    = "P".$p.($s?'C':'F')."V";
+    $plot[$p*2+$s+8]->{file}    = "files/MDCHV".$plot[$p*2+$s+8]->{name};
+    $plot[$p*2+$s+8]->{entries} = 360;
+    $plot[$p*2+$s+8]->{xscale}  = 12;
+    $plot[$p*2+$s+8]->{type}    = HPlot::TYPE_HISTORY;
+    $plot[$p*2+$s+8]->{output}  = HPlot::OUT_PNG;
+    $plot[$p*2+$s+8]->{xlabel}  = "Minutes";
+    $plot[$p*2+$s+8]->{ylabel}  = ($s?'C':'F')." Voltage";
+    $plot[$p*2+$s+8]->{sizex}   = 800;
+    $plot[$p*2+$s+8]->{sizey}   = 420;
+    $plot[$p*2+$s+8]->{curves}  = 6;
+    $plot[$p*2+$s+8]->{dots}  = 1;
+    $plot[$p*2+$s+8]->{colors}  = \@colors;
+    foreach my $c (0..5) {
+      $plot[$p*2+$s+8]->{titles}->[$c] = ($s?'C ':'F ').$names[$c];
       }    
-    HPlot::PlotInit($plot[$p*6+$s+24]);
+    HPlot::PlotInit($plot[$p*2+$s+8]);
     }
   }
 
 
 for(my $i = 1; $i<=4; $i++) {
   for(my $j = 1; $j<=6; $j++) {
-    for(my $v = 0; $v<=11; $v++) {
-#       print "$i-$j-$v\n";
-      my $s = sprintf("HAD:MDCHV:P%i:S%i:VMON_C%i",$i,$j,$v);
-      Perl2Epics::Connect("$i-$j-$v-V",$s);
-      $s = sprintf("HAD:MDCHV:P%i:S%i:IMON_C%i",$i,$j,$v);
-      Perl2Epics::Connect("$i-$j-$v-I",$s);
-      }
+    my $s = sprintf("HAD:MDC:HV:P%i:S%i:C:vmon",$i,$j);
+    Perl2Epics::Connect("$i-$j-0-V",$s);
+    $s = sprintf("HAD:MDC:HV:P%i:S%i:F:vmon",$i,$j);
+    Perl2Epics::Connect("$i-$j-1-V",$s);
+    $s = sprintf("HAD:MDC:HV:P%i:S%i:C:imon",$i,$j);
+    Perl2Epics::Connect("$i-$j-0-I",$s);
+    $s = sprintf("HAD:MDC:HV:P%i:S%i:F:imon",$i,$j);
+    Perl2Epics::Connect("$i-$j-1-I",$s);
     }
   }
 print "Connected.\n";
 
 while(1) {
   my $data = Perl2Epics::GetAll();
-  my $str = Hmon::MakeTitle(10, 23, "MDC HV", 1, "");
+  my $str = Hmon::MakeTitle(10, 9, "MDC HV", 1, "");
     $str .= "<table class=\"rates textbox\">"; #<div id=\"logbox\" class=\"textbox\" >
-  for(my $i = 1; $i<=2; $i++) {
+  for(my $i = 1; $i<=4; $i++) {
     $str .= "<tr><th colspan=7>Plane $i\n";
     $str .= "<tr><th><th colspan=1>1<th colspan=1>2<th colspan=1>3<th colspan=1>4<th colspan=1>5<th colspan=1>6";
-    for(my $v = 0; $v<=11; $v++) {
+    for(my $v = 0; $v<=1; $v++) {
       $str .= "<tr><td>".$names[$v]."&nbsp;";
       for(my $s = 1; $s<=6; $s++) {
         my $volt = $data->{"$i-$s-$v-V"}->{val};
@@ -96,8 +98,8 @@ while(1) {
         my $tc   = strftime("%H:%M:%S",localtime($data->{"$i-$s-$v-I"}->{tme} || 0));
         $volt = -1 unless defined $volt;
         $curr = -1 unless defined $curr;
-        HPlot::PlotAdd("P".($i-1)."S".($s-1)."I",$curr,$v);
-        HPlot::PlotAdd("P".($i-1)."S".($s-1)."V",$volt,$v);
+        HPlot::PlotAdd("P".($i-1).(($v-1)?'F':'C')."I",$curr,$s-1);
+        HPlot::PlotAdd("P".($i-1).(($v-1)?'F':'C')."V",$volt,$s-1);
         my $tmp .= sprintf(" %4i - %5i",$volt,$curr);
         $tmp =~ s/\s/&nbsp;/gi;
         $str .= "<td title=\"$tv / $tc\">".$tmp;
@@ -112,10 +114,10 @@ while(1) {
     Hmon::WriteFile("MDCHV", $str);  
     }
   if(!($timer%6)) {
-    foreach my $s (0..5){
-      foreach my $p (0..1) {
-        HPlot::PlotDraw("P".$p."S".$s."I");
-        HPlot::PlotDraw("P".$p."S".$s."V");
+    foreach my $s (0..1){
+      foreach my $p (0..3) {
+        HPlot::PlotDraw("P".$p.($s?'C':'F')."I");
+        HPlot::PlotDraw("P".$p.($s?'C':'F')."V");
         }
       }
     }
index b32281eeb3d9e5714732663917e5167adac4d613..8b696638a4f419694b6a4ac678a2c654f03121b4 100755 (executable)
@@ -64,7 +64,7 @@ my $timer = 0;
 
 
 
-for(my $i = 1; $i<=3; $i+=2) {
+for(my $i = 1; $i<=3; $i++) {
   for(my $j = 1; $j<=6; $j++) {
     my $s = sprintf("HAD:MDC:P%i:S%i:p_delta",$i,$j);
     Perl2Epics::Connect("p$i$j",$s);
@@ -89,7 +89,7 @@ while(1) {
   $str .= "<h4>p_Delta</h4>\n";
   $str .= "<table class=\"rates \">\n"; #<div id=\"logbox\" class=\"textbox\" >
   $str .= "<tr><th><th colspan=1>1<th colspan=1>2<th colspan=1>3<th colspan=1>4<th colspan=1>5<th colspan=1>6\n";
-  for(my $i = 1; $i<=3; $i+=2) {
+  for(my $i = 1; $i<=3; $i++) {
     $str .= "<tr><th>$i";
     for(my $v = 1; $v<=6; $v++) {
       $str .= sprintf("<td> %.2f\n",$data->{"p$i$v"}->{val} || -1);
index 860e34b09611f6757b32ebdbd78e1dabe14572df..38d1e43ba51fde158fecb7608139ba3836fd748d 100755 (executable)
@@ -73,14 +73,23 @@ while(1) {
     HPlot::PlotDraw("HVCurrent");  
     
     
-    my $shorttext = sprintf("%i/%i | %.1f/%.1f",$val[3],$val[25],$val[4],$val[26]);
-    my $longtext = sprintf("Pion 1: %.1f V / %.2fuA<br>Pion 2: %.1f V / %.2fuA",$val[3],$val[4],$val[25],$val[26]);
+    my $shorttext = sprintf("%.1f/%.3f",$val[3],$val[4]);
+    my $longtext = sprintf("Pion 1: %.1f V / %.4fuA",$val[3],$val[4]);
     my $state = QA::OK;
-       $state = QA::WARN if($val[3]<140 || $val[25]<140);    
-       $state = QA::FATAL if($val[25] > 5 || $val[26] > 5);
+       $state = QA::WARN if($val[3]<140);    
+       $state = QA::FATAL if($val[4] > 5);
        
     QA::WriteQALog($flog, "pion", "HV", 30,
-       QA::OK, 'Pion HV', $shorttext, $longtext);
+       QA::OK, 'Pion 0 HV', $shorttext, $longtext);
+
+    $shorttext = sprintf("%.1f/%.3f",$val[25],$val[26]);
+    $longtext = sprintf("Pion 2: %.2f V / %.3fuA",$val[25],$val[26]);
+    $state = QA::OK;
+    $state = QA::WARN if($val[25]<140);    
+    $state = QA::FATAL if($val[26] > 5);
+       
+    QA::WriteQALog($flog, "pion", "HVcurr", 30,
+       QA::OK, 'Pion 1 HV', $shorttext, $longtext);
 
     $shorttext = sprintf("%.1f&deg; / %.1f&deg;",$val[47],$val[53]);
     $longtext = sprintf("Pion 1: is %.1f&deg;, soll %.1f&deg;<br>Pion 2: is %.1f&deg;, soll %.1f&deg;",$val[47],$val[49],$val[53],$val[55]);
index 9235dce098cd6674953a715457927cb121136aec..6a555197d26150507a0799a5592a8087cd8efcd6 100755 (executable)
@@ -7,17 +7,15 @@ mkdir /dev/shm/hmon
 #Kill old tunnel, make new one. Better: Check if tunnel still exists, if not restart.
 echo "  <Hmon>     Renewing tunnels and environment..."
 
-pgrep -f 'hmon_ssh -R 8888' >/dev/null
+pgrep -f 'hmon_ssh -f -R 8888' >/dev/null
 if [ $? -eq 1 ]; then
 echo "  <Hmon>     No tunnel found, digging new one";
-./hmon_ssh -fR 8888:hades33.gsi.de:80 cerberus.x-matter.uni-frankfurt.de -N &
+./hmon_ssh -f -R 8888:hades33.gsi.de:80 -R 3060:hades33.gsi.de:80 cerberus.x-matter.uni-frankfurt.de -N &
 fi
 
 killall speakdaemon.pl
 cd /home/hadaq/trbsoft/hadesdaq/hmon/
 
-
-
  # cd permanent
  # killall hmon_*.pl 2>/dev/null 1>/dev/null
  # cd ../
@@ -29,6 +27,9 @@ mkdir `pwd`/logs
 mkdir `pwd`/vertex
 mkdir `pwd`/pion
 
+
+DISPLAY=:0 ssh -f -X lxhadeb06 "ping -i 100 lxhadesdaqp" &>/dev/null &
+
 sshfs -o allow_other hades-qa@lxhadeb06:/home/hades-qa/online/apr12/vertex/vertex_jpg `pwd`/vertex
 sshfs -o allow_other hades-qa@lxhadeb06:/home/hades-qa/online/apr12/pics `pwd`/qa
 sshfs -o allow_other hadaq@lxhadeb06:/data01/tmp/ `pwd`/pion