use warnings;
use strict;
use FileHandle;
+use Storable qw(lock_store lock_retrieve);
my $p;
+my $storefile;
use constant {TYPE_HISTORY => 1, TYPE_BARGRAPH => 2, TYPE_HEATMAP => 3};
my $name = $c->{name};
my $fn = "gnuplot";
- my $fh = new FileHandle ("|$fn") or die "error: no gnuplot";
+ #my $fh = new FileHandle ("|$fn") or die "error: no gnuplot";
+ open my $fh, "|$fn" or die "error: no gnuplot";
$fh->autoflush(1);
-
$p->{$name} = $c;
$p->{$name}->{fh} = $fh;
$p->{$name}->{run} = 0;
$p->{$name}->{output} or die "No destination specified";
$p->{$name}->{colors} = $p->{$name}->{colors} || \@color;
$p->{$name}->{showvalues} = $p->{$name}->{showvalues} || 0;
+ $p->{$name}->{storable} = $p->{$name}->{storable} || 0;
+
+ my $filename = $p->{$name}->{file};
+ $filename =~ s%/%%;
+ $storefile->{$name} = "/dev/shm/".$name.'-'.$p->{$name}->{curves}.'-'.$p->{$name}->{entries}.'-'.$filename.'.store';
+
foreach my $i (0..($c->{entries}-1)) {
for my $j (0..($c->{curves}-1)) {
push(@{$p->{$name}->{value}->[$j]},0) ;
}
}
+
+ if($p->{$name}->{storable}) {
+ if (-e $storefile->{$name}) {
+ $p->{$name}->{value} = lock_retrieve($storefile->{$name});
+ }
+ }
+
if($p->{$name}->{output} == OUT_PNG) {
$p->{$name}->{file} or die "No filename specified";
$p->{$name}->{run}++;
+
+
+ if($p->{$name}->{storable}) {
+ lock_store($p->{$name}->{value},$storefile->{$name});
+ }
}
# Order of entries in each cat
$entries->{'main'} = ['time', 'rate','onlineqa','up'];
$entries->{'daq'} = ['trbnet', 'timeouts', 'busy','readout'];
-$entries->{'trg'} = ['spill', 'source','pt1rate', 'start']; #, 'accepted'
+$entries->{'trg'} = ['spill', 'accepted', 'source','pt1rate', 'start']; #,
$entries->{'rate'} = ['pt1','start','hodo','pion1','pion2'];
$entries->{'server'} = ['fill', 'cpu', 'icinga', 'etrax', 'pwrsup'];
$entries->{'eb'} = ['run', 'rate','bytes', 'lostevt', 'errbits'];
In case of an error (red field), please take a look to
the Icinga <a href="http://icingaadmin@cerberus.x-matter.uni-frankfurt.de:8888/icinga/" target="_blank">tactical overview</a>. An eMail is automatically sent to a DAQ-expert,
who should know how to proceed.
-
+<p>A DAQ restart will not change the situation.
<p>An overview of the different servers and services monitored is given in the <a href="http://hades-wiki.gsi.de/cgi-bin/view/DaqSlowControl/IcingaMonitor" target="_blank">HADES Wiki</a>.
$plot->{ymin} = -1;
$plot->{ymax} = 101;
$plot->{buffer} = 1;
+$plot->{storable} = 1;
HPlot::PlotInit($plot);
my $plot2 = ();
$plot2->{bartitle}->[8] = "St3";
$plot2->{bartitle}->[9] = "Pi";
$plot2->{buffer} = 1;
+$plot2->{storable} = 0;
HPlot::PlotInit($plot2);
my $str = Hmon::MakeTitle(12,9,"Busy Times",0);
$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));
+ $shorttext = QA::SciNotation(($store{0xa03c}-8)/(($store{0xa037}-2100)||1));
+ $longtext = sprintf("Trigger Rate from PT1/TOF vs. Hodoscope: %.2f",($store{0xa03c}-8)/(($store{0xa037}-2100)||1));
QA::WriteQALog($fqa, "trg", "pt1rate", 10,
$state, 'Hodo/PT1', $shorttext, $longtext);
$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;
- my $select = trb_register_read(3,0xa0da) or sleep 5 and next;
-
-# print $binning->{3}."\n";
- $binning = $binning->{3}*100E-9;
-# print $binning."\n";
- $binning = QA::SciNotation($binning);
-# print $binning."\n";
- $offset = QA::SciNotation($offset->{3}*100E-9);
- my $selx = "err";
- my $sely = "err";
- $selx = "X 0-7" if ($select->{3} & 0x3) == 0;
- $selx = "X 4-11" if ($select->{3} & 0x3) == 1;
- $selx = "X 8-15" if ($select->{3} & 0x3) == 2;
- $sely = "Y 0-7" if ($select->{3} & 0xC) == 0;
- $sely = "Y 4-11" if ($select->{3} & 0xC) == 4;
- $sely = "Y 8-15" if ($select->{3} & 0xC) == 8;
-
-
-
- $str = Hmon::MakeTitle(10,16,"Start Histogram",0);
- $str .= qq@
- Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely
- <br><img src="%ADDPNG files/starthistx0.png%" type="image/png">
- <img src="%ADDPNG files/starthisty0.png%" type="image/png">
- @;
- $str .= Hmon::MakeFooter();
- Hmon::WriteFile("Starthist",$str);
-
- $str = Hmon::MakeTitle(10,16,"Start Histogram",0);
- $str .= qq@
- Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely
- <br><img src="%ADDPNG files/starthiststackedx0.png%" type="image/png">
- <img src="%ADDPNG files/starthiststackedy0.png%" type="image/png">
- @;
- $str .= Hmon::MakeFooter();
- Hmon::WriteFile("StarthistStacked",$str);
-
- sleep(5);
- }
+#
+# 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;
+# my $select = trb_register_read(3,0xa0da) or sleep 5 and next;
+#
+# # print $binning->{3}."\n";
+# $binning = $binning->{3}*100E-9;
+# # print $binning."\n";
+# $binning = QA::SciNotation($binning);
+# # print $binning."\n";
+# $offset = QA::SciNotation($offset->{3}*100E-9);
+# my $selx = "err";
+# my $sely = "err";
+# $selx = "X 0-7" if ($select->{3} & 0x3) == 0;
+# $selx = "X 4-11" if ($select->{3} & 0x3) == 1;
+# $selx = "X 8-15" if ($select->{3} & 0x3) == 2;
+# $sely = "Y 0-7" if ($select->{3} & 0xC) == 0;
+# $sely = "Y 4-11" if ($select->{3} & 0xC) == 4;
+# $sely = "Y 8-15" if ($select->{3} & 0xC) == 8;
+#
+#
+#
+# $str = Hmon::MakeTitle(10,16,"Start Histogram",0);
+# $str .= qq@
+# Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely
+# <br><img src="%ADDPNG files/starthistx0.png%" type="image/png">
+# <img src="%ADDPNG files/starthisty0.png%" type="image/png">
+# @;
+# $str .= Hmon::MakeFooter();
+# Hmon::WriteFile("Starthist",$str);
+#
+# $str = Hmon::MakeTitle(10,16,"Start Histogram",0);
+# $str .= qq@
+# Offset: @.$offset.qq@s - Binning: @.$binning.qq@s - Inputs: $selx, $sely
+# <br><img src="%ADDPNG files/starthiststackedx0.png%" type="image/png">
+# <img src="%ADDPNG files/starthiststackedy0.png%" type="image/png">
+# @;
+# $str .= Hmon::MakeFooter();
+# Hmon::WriteFile("StarthistStacked",$str);
+#
+# sleep(5);
+# }
}
else {
qx(./hmon_hadplot_old.sh -d 3000 \\
my $plot2 = ();
-$plot2->{name} = "Pt3AcceptRatio";
-$plot2->{file} = "files/Pt3AcceptRatio";
+$plot2->{name} = "Pt1AcceptRatio";
+$plot2->{file} = "files/Pt1AcceptRatio";
$plot2->{entries} = 40;
$plot2->{type} = HPlot::TYPE_HISTORY;
$plot2->{output} = HPlot::OUT_PNG;
$plot2->{titles}->[0] = "";
$plot2->{xlabel} = "Spill Number";
-$plot2->{ylabel} = "accepted PT3 Ratio";
+$plot2->{ylabel} = "accepted PT1 Ratio";
$plot2->{sizex} = 630;
$plot2->{sizey} = 220;
$plot2->{nokey} = 1;
HPlot::PlotInit($plot2);
- $str = Hmon::MakeTitle(8,5,"PT3 accepted over total PT3 per spill (%)",0);
- $str .= qq@<img src="%ADDPNG files/Pt3AcceptRatio.png%" type="image/png">@;
+ $str = Hmon::MakeTitle(8,5,"PT1 accepted over total PT1 per spill (%)",0);
+ $str .= qq@<img src="%ADDPNG files/Pt1AcceptRatio.png%" type="image/png">@;
$str .= Hmon::MakeFooter();
Hmon::WriteFile("Pt3AcceptRatio",$str);
$accpt3sum = 0;
}
else {
- $pt3sum += $rStat->{3}->[0x4c] || 0;
- $accpt3sum += $rStat->{3}->[0x39] || 0; #was 0x5D
+ $pt3sum += $rStat->{3}->[0x4a] || 0;
+ $accpt3sum += $rStat->{3}->[0x37] || 0; #was 0x5D
}
- $accmsg = sprintf("%i%% / %i%%", $rStat->{3}->[0x4c]/($rStat->{3}->[0x39]||1)*100, $lastaccpt3 || 0);
+ $accmsg = sprintf("%i%% / %i%%", $rStat->{3}->[0x4a]/($rStat->{3}->[0x37]||1)*100, $lastaccpt3 || 0);
my $qastateacc = QA::OK;
QA::WriteQALog($fqa, "trg", "source", 10, $qastate, "Trigger Source", $msg, $longmsg);
- QA::WriteQALog($fqa, "trg", "accepted", 10, $qastateacc, "Accept. PT3", $accmsg, $acclmsg);
+ QA::WriteQALog($fqa, "trg", "accepted", 10, $qastateacc, "Accept. PT1", $accmsg, $acclmsg);
my $qastatept = QA::OK;
- my $ptoverStattart = $rStat->{3}->[0x26]/($rStat->{3}->[0x2c] || 1)*100;
+ my $ptoverStattart = $rStat->{3}->[0x24]/($rStat->{3}->[0x2c] || 1)*100;
if ($ptoverStattart > 100) {$ptoverStattart = 100;}
######################################
## QA check for PT3/Start rate
}
######################################
my $ptmsg = "";
- $ptmsg = sprintf("%s/s / %1.2f%%",QA::SciNotation($rStat->{3}->[0x26]),$ptoverStattart) if $ptoverStattart<=10;
+ $ptmsg = sprintf("%s/s / %1.2f%%",QA::SciNotation($rStat->{3}->[0x24]),$ptoverStattart) if $ptoverStattart<=10;
$ptmsg = sprintf("%i/s / %1.1f%%",$rStat->{3}->[0x26],$ptoverStattart) if $ptoverStattart> 10;
- my $ptlongmsg = sprintf("PT3 counts per second: %i - PT3 / Start: %1.2f%%", $rStat->{3}->[0x26], $ptoverStattart);
- QA::WriteQALog($fqa, "trg", "ptrate", 10, $qastatept, "PT3 / Start", $ptmsg, $ptlongmsg);
+ my $ptlongmsg = sprintf("PT1 counts per second: %i - PT1 / Start: %1.2f%%", $rStat->{3}->[0x24], $ptoverStattart);
+ QA::WriteQALog($fqa, "trg", "ptrate", 10, $qastatept, "PT1 / Start", $ptmsg, $ptlongmsg);
my $startsum = 0;
$plot[$p*2+$s]->{dots} = 1;
$plot[$p*2+$s]->{colors} = \@colors;
$plot[$p*2+$s]->{buffer} = 1;
+ $plot[$p*2+$s]->{storable} = 1;
+
foreach my $c (0..5) {
$plot[$p*2+$s]->{titles}->[$c] = ($s?'F ':'C ').$names[$c];
}
$plot[$p*2+$s+8]->{dots} = 1;
$plot[$p*2+$s+8]->{colors} = \@colors;
$plot[$p*2+$s+8]->{buffer} = 1;
+ $plot[$p*2+$s+8]->{storable} = 1;
foreach my $c (0..5) {
$plot[$p*2+$s+8]->{titles}->[$c] = ($s?'F ':'C ').$names[$c];
}
$plot->{ymax} = 1050;
$plot->{nokey} = 1;
$plot->{buffer} = 1;
+$plot->{storable} = 1;
HPlot::PlotInit($plot);
$plot2->{nokey} = 0;
$plot2->{curves} = 2;
$plot2->{buffer} = 1;
+$plot2->{storable} = 1;
HPlot::PlotInit($plot2);
my $plotPrePlane1 = ();
$plotPrePlane1->{curves} = 6;
$plotPrePlane1->{buffer} = 1;
$plotPrePlane1->{xscale};
+$plotPrePlane1->{storable} = 1;
HPlot::PlotInit($plotPrePlane1);
my $plotPrePlane2 = ();
$plotPrePlane2->{nokey} = 0;
$plotPrePlane2->{curves} = 6;
$plotPrePlane2->{buffer} = 1;
+$plotPrePlane2->{storable} = 1;
HPlot::PlotInit($plotPrePlane2);
$plotPrePlane3->{nokey} = 0;
$plotPrePlane3->{curves} = 6;
$plotPrePlane3->{buffer} = 1;
+$plotPrePlane3->{storable} = 1;
HPlot::PlotInit($plotPrePlane3);
$plot->{ylabel} = "mA";
$plot->{sizex} = 630;
$plot->{sizey} = 220;
+$plot->{storable}= 1;
+
HPlot::PlotInit($plot);
$plot->{sizex} = 630;
$plot->{sizey} = 220;
$plot->{ymax} = 200;
+$plot->{storable}= 1;
HPlot::PlotInit($plot);
$plot2->{ylabel} = "Microampere";
$plot2->{sizex} = 630;
$plot2->{sizey} = 220;
+$plot2->{storable}= 1;
HPlot::PlotInit($plot2);
while(1) {
curves => 6,
xscale => 4,
colors => ["#333333","#00ff00","#ff0000","#0000ff","#dddd00","#dd00dd"]};
+$plot->{storable}= 1;
HPlot::PlotInit($plot);
my $plot2 = {
curves => 6,
xscale => 30,
colors => ["#333333","#00ff00","#ff0000","#0000ff","#dddd00","#dd00dd"]};
+$plot2->{storable}= 1;
HPlot::PlotInit($plot2);
$out .= "<table>";
- my $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/target_*e*.jpg | tail -n 5";
+ my $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/target_*.jpg | tail -n 5";
my @files = qx($cmd);
@files = reverse @files;
- $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/targetSum10*e*.jpg | tail -n 5";
+ $cmd = "ls -rt /home/hadaq/trbsoft/daq/hmon/vertex/targetSum*.jpg | tail -n 5";
my @files2 = qx($cmd);
@files2 = reverse @files2;
foreach my $i (0..(scalar @files)-1) {
+ next if scalar @files == 0;
$out .= "<tr><td style='text-align:center'>";
my @n = split('/',$files[$i]);
chop $n[-1];
- my ($y,$d,$h,$m,$s) = $n[-1] =~ /.*_[\w-][\w-](\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d)_.*/;
+ my ($y,$d,$h,$m,$s) = $n[-1] =~ /.*_(\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d)_.*/;
$out .= qq@20$y-$d $h:$m:$s<br><div class=\"linkbox\" style=\"width:567px\"><img src="../vertex/$n[-1]" style="padding:10px;background:white;"></div>@;
+ }
+
+ foreach my $i (0..(scalar @files2)-1) {
+ next if scalar @files2 == 0;
$out .= "<td style='text-align:center'>";
- @n = split('/',$files2[$i]);
+ my @n = split('/',$files2[$i]);
chop $n[-1];
- my ($y1,$d1,$h1,$m1,$s1,$y2,$d2,$h2,$m2,$s2) = $n[-1] =~ /.*_[\w-][\w-](\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d)-[\w-][\w-](\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d).*/;
+ my ($y1,$d1,$h1,$m1,$s1,$y2,$d2,$h2,$m2,$s2) = $n[-1] =~ /.*_(\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d)-[\w-][\w-](\d\d)(\d\d\d)(\d\d)(\d\d)(\d\d).*/;
$out .= qq@20$y1-$d1 $h1:$m1:$s1 - $h2:$m2:$s2<br><div class=\"linkbox\" style=\"width:567px\"><img src="../vertex/$n[-1]" style="padding:11px 10px;background:white;"></div>\n@;
}