["0x6055",52,0,0], ["0x6055",53,1,1], ["0x6055",54,2,2], ["0x6055",55,14,14], ["0x6055",56,15,15], ["0x6052",57,5,5], ["0x6052",58,6,6], ["0x6052",59,7,7], ["0x6052",60,8,8], ["0x6052",61,9,9], ["0x6052",62,10,10],
["0x6055",63,3,3], ["0x6055",64,4,4], ["0x6055",65,5,5], ["0x6055",66,6,6], ["0x6055",67,7,7], ["0x6052",68,16,16], ["0x6052",69,11,11], ["0x6052",70,12,12], ["0x6052",71,13,13], ["0x6052",72,14,14], ["0x6052",73,15,15],
["0x6054",74,17,17], ["0x6054",75,18,18], ["0x6054",76,19,19], ["0x6054",77,20,20], ["0x6054",78,21,21], ["0x6054",79,22,22], ["0x6054",80,23,23], ["0x6051",81,16,16], ["0x6051",82,17,17], ["0x6051",83,18,18], ["0x6051",84,19,19], ["0x6051",85,20,20], ["0x6051",86,21,21],
- ["0x6054",87,8,8], ["0x6054",88,9,9], ["0x6054",89,10,10], ["0x6054",90,11,11], ["0x6054",91,12,12], ["0x6054",92,13,13], ["0x6051",93,8,8], ["0x6051",94,9,9], ["0x6051",95,10,10], ["0x6051",96,11,11], ["0x6051",97,12,12], ["0x6051",98,13,13], ["0x6051",99,14,14],
+ ["0x6054",87,8,8], ["0x6054",88,9,9], ["0x6054",89,10,10], ["0x6054",90,11,11], ["0x6054",91,12,12], ["0x6054",92,13,13], ["0x6051",93,9,9], ["0x6051",94,9,9], ["0x6051",95,10,10], ["0x6051",96,11,11], ["0x6051",97,12,12], ["0x6051",98,13,13], ["0x6051",99,14,14],
["0x6054",100,0,0], ["0x6054",101,1,1], ["0x6054",102,2,2], ["0x6054",103,3,3], ["0x6054",104,4,4], ["0x6054",105,5,5], ["0x6054",106,6,6], ["0x6051",107,0,0], ["0x6051",108,1,1], ["0x6051",109,2,2], ["0x6051",110,3,3], ["0x6051",111,4,4], ["0x6051",112,5,5], ["0x6051",113,6,6], ["0x6051",114,7,7],
["0x6054",115,7,7], ["0x6053",116,16,16], ["0x6053",117,17,17], ["0x6053",118,18,18], ["0x6053",119,19,19], ["0x6053",120,20,20], ["0x6053",121,21,21], ["0x6053",122,22,22], ["0x6050",123,16,16], ["0x6050",124,17,17], ["0x6050",125,18,18], ["0x6050",126,19,19], ["0x6050",127,20,20], ["0x6050",128,21,21], ["0x6050",129,22,22],
["0x6053",130,8,8], ["0x6053",131,9,9], ["0x6053",132,10,10], ["0x6053",133,11,11], ["0x6053",134,12,12], ["0x6053",135,13,13], ["0x6053",136,14,14], ["0x6053",137,15,15], ["0x6053",138,23,23], ["0x6050",139,23,23], ["0x6050",140,8,8], ["0x6050",141,9,9], ["0x6050",142,10,10], ["0x6050",143,11,11], ["0x6050",144,12,12], ["0x6050",145,13,13], ["0x6050",146,14,14],
--- /dev/null
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+use LWP::Simple qw(get);
+use JSON qw( decode_json encode_json );
+use Data::Dumper;
+use CGI qw(:standard);
+
+
+my $q = CGI->new;
+
+
+return unless $q->param('histo') =~ /^[a-zA-Z0-9_\-\/]+$/;
+return unless $q->param('src') =~ /^[a-zA-Z0-9]+$/;
+
+my $baseurl;
+if($q->param('src') eq 'rawmon') {$baseurl = 'http://lxhadeb13:8090/';}
+if($q->param('src') eq 'ebmon') {$baseurl = 'http://lxhadeb13:8090/';}
+if($q->param('src') eq 'eb') {$baseurl = 'http://lxhadeb07:8099/';}
+
+
+
+my $rawdata = get ($baseurl.$q->param('histo')."/get.json");
+
+my $data;
+if (defined $rawdata) {
+ $data = decode_json($rawdata);
+ }
+
+foreach my $s ('xlabels', 'ylabels', 'zlabels') {
+ if ($data->{$s}) {
+ my @labels = split(',',$data->{$s});
+ $data->{$s} = \@labels;
+ }
+ }
+
+
+if($data->{'_kind'} eq 'ROOT.TH1D') {
+ $data->{"underflow"} = $data->{bins}[3];
+ $data->{"overflow"} = $data->{bins}[-1];
+ @{$data->{"bins"}} = splice(@{$data->{"bins"}},4,-1);
+ }
+
+if($data->{'_kind'} eq 'ROOT.TH2D') {
+ my $d;
+ foreach my $x (1..$data->{nbins1}) {
+ foreach my $y (1..$data->{nbins2}) {
+ $d->[$x-1][$y-1] = $data->{bins}[6+$x+$y*($data->{nbins1}+2)];
+ }
+ }
+# foreach my $x (1..$data->{nbins1}) {
+# $data->{underflow}{x}[$x] = $data->{bins}[7+$x];
+# $data->{overflow}{x}[$x] = $data->{bins}[-($data->{nbins1}+$x-2)];
+# }
+
+ $data->{bins} = $d;
+ }
+
+
+
+print "Cache-Control: no-cache, must-revalidate, max-age=1\r\n";
+print "Expires: Thu, 01 Dec 1994 16:00:00 GMT\r\n";
+print "Content-type: application/json\r\n\r\n";
+
+print encode_json($data);
+
--- /dev/null
+#!/usr/bin/perl -w
+
+use warnings;
+use POSIX qw(strftime);
+use FileHandle;
+use lib "./code";
+use lib "../daqtools/tools";
+use HADES::TrbNet;
+use Time::HiRes qw(usleep);
+use Dmon;
+use Hmon;
+use HPlot;
+use QA;
+use JSON::XS;
+use Data::Dumper;
+use List::Util qw(min max);
+
+
+my $plot0 = {
+name => "RichThresh",
+file => "files/RichThresh",
+title => "RICH Thresholds",
+entries => 193,
+curves => 193,
+type => HPlot::TYPE_HEATMAP,
+output => HPlot::OUT_PNG,
+cblabel => "mV",
+sizex => 800,
+sizey => 700,
+nokey => 1,
+buffer => 0,
+xmin => -1.5,
+xmax => 192.5,
+ymin => -1.5,
+ymax => 192.5,
+cbmax => "*<1600",
+cbmin => "1300<*",
+noinit => 1,
+additional => "set xrange [192.5:-1.5] reverse",
+showvalues => 0, };
+HPlot::PlotInit($plot0);
+
+my $str = Hmon::MakeTitle(11, 16, "RICH Threshold",0);
+$str .= qq@<img src="%ADDPNG files/RichThresh.png%" type="image/png"><br>\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("RichThresh",$str);
+
+ my $filename = 'rich_pmt_parameters_xy.geo';
+
+ open(my $fh, '<:encoding(UTF-8)', $filename)
+ or die "Could not open file '$filename' $!";
+
+ my @pos;
+
+ while (my $row = <$fh>) {
+ chomp $row;
+ my @words = split / /, $row;
+ if ($words[0] eq "Di-Rich") {next;}
+ if (defined $words[0]) {
+
+ my $dirich= ((hex $words[0])&0xfff);
+ my $ch=int $words[1];
+ $pos[$dirich][$ch][0]=int $words[4];
+ $pos[$dirich][$ch][1]=int $words[5];
+
+ }
+ }
+
+while(1){
+my @t;
+my $store;
+for my $i (0..15) {
+ my $cmd = "/home/hadaq/trbsoft/daqtools/tools/spi_slave.pl -e=0xfe51 -c=0 -x pwm --channel=".$i;
+ push(@t,qx($cmd));
+ $cmd = "/home/hadaq/trbsoft/daqtools/tools/spi_slave.pl -e=0xfe51 -c=1 -x pwm --channel=".$i;
+ push(@t,qx($cmd));
+ }
+foreach my $s (@t) {
+ my ($b,$chain,$channel,$val) = $s =~ /endpoint: 0x(\w\w\w\w) chain: (\d) channel: (\d+) .+ voltage: (\d+\.\d+) mV/;
+# $store->{hex($b)}{$chain*16+$channel} = $val;
+ $b = hex($b);
+ my $v = $chain*16+$channel;
+ HPlot::PlotFill('RichThresh',$val,$pos[$b&0xfff][$v+1][0],$pos[$b&0xfff][$v+1][1]);
+ }
+HPlot::PlotDraw('RichThresh');
+
+sleep 120;
+}
+
+
+
+
+# print Dumper $store;
HPlot::PlotInit({
name => "StartRateXhistbar",
file => "files/StartRateXhistbar",
- entries => 500,
+ entries => 200,
type => HPlot::TYPE_BARGRAPH,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"],
sizex => 950,
sizey => 330,
xmin => 0,
- xmax => 500,
+ xmax => 200,
ymin => "0",
ymax => "100<*",
curves => 16,
- xscale => 5,
+ xscale => 10,
buffer => 1,
stacked => 1,
curvewidth => .9,
HPlot::PlotInit({
name => "StartRateYhistbar",
file => "files/StartRateYhistbar",
- entries => 500,
+ entries => 200,
type => HPlot::TYPE_BARGRAPH,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"],
sizex => 950,
sizey => 330,
xmin => 0,
- xmax => 500,
+ xmax => 200,
ymin => "0",
ymax => "100<*",
curves => 16,
- xscale => 5,
+ xscale => 10,
buffer => 1,
stacked => 1,
curvewidth => .9,
HPlot::PlotInit({
name => "VetoRatehistbar",
file => "files/VetoRatehistbar",
- entries => 500,
+ entries => 200,
type => HPlot::TYPE_BARGRAPH,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7"],
sizex => 950,
sizey => 330,
xmin => 0,
- xmax => 500,
+ xmax => 200,
ymin => "0",
ymax => "100<*",
curves => 8,
- xscale => 5,
+ xscale => 10,
buffer => 1,
stacked => 1,
curvewidth => .9,
HPlot::PlotInit({
name => "StartRateXhist",
file => "files/StartRateXhist",
- entries => 500,
+ entries => 200,
type => HPlot::TYPE_HISTORY,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"],
ymin => "0",
ymax => "100<*",
curves => 16,
- xscale => 5,
+ xscale => 10,
buffer => 1,
});
HPlot::PlotInit({
name => "StartRateYhist",
file => "files/StartRateYhist",
- entries => 500,
+ entries => 200,
type => HPlot::TYPE_HISTORY,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"],
ymin => "0",
ymax => "100<*",
curves => 16,
- xscale => 5,
+ xscale => 10,
buffer => 1,
});
HPlot::PlotInit({
name => "VetoRatehist",
file => "files/VetoRatehist",
- entries => 500,
+ entries => 200,
type => HPlot::TYPE_HISTORY,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7"],
ymin => "0",
ymax => "100<*",
curves => 8,
- xscale => 5,
+ xscale => 10,
buffer => 1,
});
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"],
ylabel => "Hits",
+ yscale => 10,
nokey => 1,
sizex => 340,
sizey => 330,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"],
ylabel => "Hits",
+ yscale => 10,
nokey => 1,
sizex => 340,
sizey => 330,
output => HPlot::OUT_PNG,
titles => ["0","1","2","3","4","5","6","7"],
ylabel => "Hits",
+ yscale => 10,
nokey => 1,
sizex => 340,
sizey => 330,
HPlot::PlotInit({
name => "StartPosition",
file => "files/StartPosition",
- entries => 500,
+ entries => 200,
type => HPlot::TYPE_HISTORY,
output => HPlot::OUT_PNG,
titles => ["X position","Y position","Xrms","Yrms"],
ymin => "-0.5",
ymax => "15.5",
curves => 4,
- xscale => 5,
+ xscale => 10,
buffer => 1,
});
+HPlot::PlotInit({
+ name => "HALO",
+ file => "files/HALO",
+ title => "HALO",
+ entries => 3,
+ curves => 3,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ cblabel => "Hitrate",
+ cbscale => 10,
+ sizex => 300,
+ sizey => 240,
+ nokey => 1,
+ buffer => 1,
+ xmin => -0.5,
+ xmax => 2.5,
+ ymin => -0.5,
+ ymax => 2.5,
+# cbmax => "100<*<1E5",
+ cbmin => 0,
+ noinit => 1,
+# additional => "set logscale cb;",
+ showvalues => 0,
+ });
+
+HPlot::PlotInit({
+ name => "Veto",
+ file => "files/Veto",
+ title => "Veto",
+ entries => 3,
+ curves => 3,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ cblabel => "Hitrate",
+ cbscale => 10,
+ sizex => 300,
+ sizey => 240,
+ nokey => 1,
+ buffer => 1,
+ xmin => -0.5,
+ xmax => 2.5,
+ ymin => -0.5,
+ ymax => 2.5,
+# cbmax => "100<*<1E5",
+ cbmin => 0,
+ noinit => 1,
+# additional => "set logscale cb;",
+ showvalues => 0,
+ });
+
+
my $str = Hmon::MakeTitle(13, 22, "Start / Veto Rate",0);
$str .= qq@<h3>Start X</h3><img src="%ADDPNG files/StartRateXhist.png%" type="image/png"><br>\n@;
$str .= qq@<h3>Start Y</h3><img src="%ADDPNG files/StartRateYhist.png%" type="image/png"><br>\n@;
$str .= Hmon::MakeFooter();
Hmon::WriteFile("StartRateBars",$str);
-$str = Hmon::MakeTitle(14, 8, "Start-X / Start-Y / Veto Rate",0);
+$str = Hmon::MakeTitle(14, 8, "Start-X / Start-Y / Veto Rate / HALO",0);
$str .= qq@<img src="%ADDPNG files/StartXbar.png%" type="image/png">\n@;
$str .= qq@<img src="%ADDPNG files/StartYbar.png%" type="image/png">\n@;
-$str .= qq@<img src="%ADDPNG files/Vetobar.png%" type="image/png"><br>\n@;
+$str .= qq@<img src="%ADDPNG files/Vetobar.png%" type="image/png">\n@;
$str .= Hmon::MakeFooter();
Hmon::WriteFile("StartBars",$str);
+$str = Hmon::MakeTitle(8, 6, "Veto / HALO",0);
+$str .= qq@<img src="%ADDPNG files/Veto.png%" type="image/png">\n@;
+$str .= qq@<img src="%ADDPNG files/HALO.png%" type="image/png">\n@;
+$str .= Hmon::MakeFooter();
+Hmon::WriteFile("VetoHalo",$str);
+
$str = Hmon::MakeTitle(13, 8, "Start Position",0);
$str .= qq@<img src="%ADDPNG files/StartPosition.png%" type="image/png">\n@;
my $old;
my $diff;
my $oldtime;
-my $iter = 0;
-my @chan = qw(0 0 2 4 6 8 10 12 14 15 13 11 9 7 5 3 1);
+my $iter = 1;
+my @chanx = qw(0 15 13 11 9 7 5 3 1 0 2 4 6 8 10 12 14);
+my @chany = qw(0 0 2 4 6 8 10 12 14 15 13 11 9 7 5 3 1);
my @chanveto = qw(0 2 7 3 4 0 5 1 6);
my ($sumx,$sumy,$avgx,$avgy,$rmsx,$rmsy) = (0,0,0,0,0,0);
for my $c (1..16) {
- HPlot::PlotAdd("StartRateXhist",$diff->{0x5000}[$c],$chan[$c]);
- HPlot::PlotAdd("StartRateYhist",$diff->{0x5001}[$c],$chan[$c]);
- HPlot::PlotAdd("StartRateXhistbar",$diff->{0x5000}[$c],$chan[$c]);
- HPlot::PlotAdd("StartRateYhistbar",$diff->{0x5001}[$c],$chan[$c]);
- HPlot::PlotFill("StartXbar",$diff->{0x5000}[$c],$chan[$c]);
- HPlot::PlotFill("StartYbar",$diff->{0x5001}[$c],$chan[$c]);
+ HPlot::PlotAdd("StartRateXhist",$diff->{0x5000}[$c],$chanx[$c]);
+ HPlot::PlotAdd("StartRateYhist",$diff->{0x5001}[$c],$chany[$c]);
+ HPlot::PlotAdd("StartRateXhistbar",$diff->{0x5000}[$c],$chanx[$c]);
+ HPlot::PlotAdd("StartRateYhistbar",$diff->{0x5001}[$c],$chany[$c]);
+ HPlot::PlotFill("StartXbar",$diff->{0x5000}[$c],$chanx[$c],0,$iter-7);
+ HPlot::PlotFill("StartYbar",$diff->{0x5001}[$c],$chany[$c],0,$iter-8);
$sumx += $diff->{0x5000}[$c];
$sumy += $diff->{0x5001}[$c];
- $avgx += $diff->{0x5000}[$c]*$chan[$c];
- $avgy += $diff->{0x5001}[$c]*$chan[$c];
+ $avgx += $diff->{0x5000}[$c]*$chanx[$c];
+ $avgy += $diff->{0x5001}[$c]*$chany[$c];
}
$avgx /= $sumx if($sumx !=0);
$avgy /= $sumy if($sumy !=0);
for my $c (1..16) {
- $rmsx += $diff->{0x5000}[$c]*($chan[$c]/$avgx)**2 ;
- $rmsy += $diff->{0x5001}[$c]*($chan[$c]/$avgy)**2 ;
+ $rmsx += $diff->{0x5000}[$c]*($chanx[$c]/($avgx||1E-10))**2 ;
+ $rmsy += $diff->{0x5001}[$c]*($chany[$c]/($avgy||1E-10))**2 ;
}
- $rmsx = sqrt($rmsx/$sumx);
- $rmsy = sqrt($rmsy/$sumy);
+ $rmsx = sqrt($rmsx/($sumx||1E-10));
+ $rmsy = sqrt($rmsy/($sumy||1E-10));
$avgx = "NaN" if $sumx < 50;
for my $c (1..8) {
HPlot::PlotAdd("VetoRatehist",$diff->{0x5002}[$c],$chanveto[$c]);
HPlot::PlotAdd("VetoRatehistbar",$diff->{0x5002}[$c],$chanveto[$c]);
- HPlot::PlotFill("Vetobar",$diff->{0x5002}[$c],$chanveto[$c]);
+ HPlot::PlotFill("Vetobar",$diff->{0x5002}[$c],$chanveto[$c],0,$iter-9);
}
- HPlot::PlotDraw('StartRateXhist') if ($iter == 0);
- HPlot::PlotDraw('StartRateYhist') if ($iter == 1);
- HPlot::PlotDraw('VetoRatehist') if ($iter == 2);
- HPlot::PlotDraw('StartRateXhistbar') if ($iter == 3);
+ HPlot::PlotFill("HALO",$diff->{0x5002}[9], 1,2,$iter-1);
+ HPlot::PlotFill("HALO",$diff->{0x5002}[10],1,0,$iter-1);
+ HPlot::PlotFill("HALO",$diff->{0x5002}[11],0,1,$iter-1);
+ HPlot::PlotFill("HALO",$diff->{0x5002}[12],2,1,$iter-1);
+
+ HPlot::PlotFill("Veto",$diff->{0x5002}[8], 0,0,$iter-1);
+ HPlot::PlotFill("Veto",$diff->{0x5002}[3], 1,0,$iter-1);
+ HPlot::PlotFill("Veto",$diff->{0x5002}[7], 2,0,$iter-1);
+ HPlot::PlotFill("Veto",$diff->{0x5002}[4], 0,1,$iter-1);
+ HPlot::PlotFill("Veto",$diff->{0x5002}[2], 2,1,$iter-1);
+ HPlot::PlotFill("Veto",$diff->{0x5002}[5], 0,2,$iter-1);
+ HPlot::PlotFill("Veto",$diff->{0x5002}[1], 1,2,$iter-1);
+ HPlot::PlotFill("Veto",$diff->{0x5002}[6], 2,2,$iter-1);
+
+
+ HPlot::PlotDraw('StartRateXhist') if ($iter == 1);
+ HPlot::PlotDraw('StartRateYhist') if ($iter == 2);
+ HPlot::PlotDraw('VetoRatehist') if ($iter == 3);
+ HPlot::PlotDraw('StartRateXhistbar') if ($iter == 4);
HPlot::PlotDraw('StartRateYhistbar') if ($iter == 4);
HPlot::PlotDraw('VetoRatehistbar') if ($iter == 5);
- HPlot::PlotDraw('StartXbar') if ($iter == 6);
- HPlot::PlotDraw('StartYbar') if ($iter == 7);
- HPlot::PlotDraw('Vetobar') if ($iter == 8);
+ HPlot::PlotDraw('StartXbar') if ($iter == 6); #dont change
+ HPlot::PlotDraw('StartYbar') if ($iter == 7); #dont change
+ HPlot::PlotDraw('Vetobar') if ($iter == 8); #dont change
HPlot::PlotDraw('StartPosition') if ($iter == 9);
- $iter = 0 if ($iter++ == 9)
+ HPlot::PlotDraw('HALO') if ($iter == 10); #dont change
+ HPlot::PlotDraw('Veto') if ($iter == 10); #dont change
+ $iter = 1 if ($iter++ == 10) #dont change
}
$old = $o;
- usleep(200000);
+ usleep(100000);
}
--- /dev/null
+#!/usr/bin/perl -w
+
+use warnings;
+use POSIX qw(strftime floor ceil);
+use FileHandle;
+use lib "./code";
+use lib "../daqtools/tools";
+use HADES::TrbNet;
+use Time::HiRes qw(usleep);
+use Dmon;
+use Hmon;
+use HPlot;
+use QA;
+use JSON::XS;
+use Data::Dumper;
+use List::Util qw(min max);
+use LWP::Simple qw(get);
+use Try::Tiny;
+
+
+while(1) {
+
+ my $dataerr = get ('http://localhost/mon/getrootjson.cgi?src=rawmon&histo=HADES/Run/HLD/HLD_ErrPerChannel');
+ my $datahit = get ('http://localhost/mon/getrootjson.cgi?src=rawmon&histo=HADES/Run/HLD/HLD_HitsPerChannel');
+
+ unless (defined $dataerr && defined $datahit) {
+ sleep(60);
+ next;
+ }
+
+ my $data;
+ try{
+ $data->{hit} = decode_json($datahit);
+ $data->{err} = decode_json($dataerr);
+ }
+ catch {sleep(60);next;};
+
+ my $str = Hmon::MakeTitle(20, 11, "TDC Errors",1);
+ $str .= qq@<img src="%ADDPNG files/TDCErrors.png%" type="image/png"><br>\n@;
+ $str .= Hmon::MakeFooter();
+ Hmon::WriteFile("TDCErrors",$str);
+
+ my $boards = scalar @{$data->{hit}{bins}};
+ my $channels = scalar @{$data->{hit}{bins}[0]};
+
+
+ HPlot::PlotInit({
+ name => "TDCErrors",
+ file => "files/TDCErrors",
+ title => "TDC Hit Error Ratio [1/1000]",
+ entries => $boards,
+ curves => $channels,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ cblabel => "Error ratio (x1000)",
+ sizex => 3000,
+ sizey => 500,
+ nokey => 1,
+ buffer => 1,
+ xmin => -0.5,
+ xmax => $boards-0.5,
+ ymin => -0.5,
+ ymax => $channels-0.5,
+ cbmax => "1<*<40",
+ cbmin => 0.1,
+ noinit => 1,
+ palette => 'rgb 7,5,15',
+ additional => "set logscale cb;",
+ showvalues => 0, });
+
+ my @stats;
+ foreach my $board (0..$boards-1) {
+ foreach my $chan (0..$channels-1) {
+ $data->{div}[$board][$chan] = 'NaN';
+ if ($data->{hit}{bins}[$board][$chan]) {
+ $data->{div}[$board][$chan] = $data->{err}{bins}[$board][$chan] / $data->{hit}{bins}[$board][$chan];
+# $stats[min(100,ceil($data->{div}[$board][$chan]*10000))]++;
+ }
+ HPlot::PlotFill('TDCErrors',$data->{div}[$board][$chan]*1000,$board,$chan);
+
+ }
+ }
+# print Dumper @stats;
+ HPlot::PlotDraw('TDCErrors');
+ sleep(300);
+}
+
+
+
+
<li style="width:600px;"><a href="monitor.cgi?1-window-QA" style="color:#d33">Tactical Overview (the central screen)</a></li>
<li style="width:600px;"><a href="monitor.cgi?3-window-logfile">Logfile (most important messages)</a></li>
<li style="width:600px;"><a href="monitor.cgi?10-window-chat">Chat Log</a></li>
-<li style="width:600px;"><a href="http://cerberus.x-matter.uni-frankfurt.de:3060/daqtools/index.pl" target="_blank">Web Tools</a></li>
-<li style="width:600px;"><a href="http://cerberus.x-matter.uni-frankfurt.de:3060/eb/?browser=fix" target="_blank">Eventbuilder Monitor</a></li>
+<li style="width:600px;"><a href="../daqtools/index.pl" target="_blank">Web Tools</a></li>
+<li style="width:600px;"><a href="../eb/?browser=fix" target="_blank">Eventbuilder Monitor</a></li>
</ul></div>
<div class="linkbox" style="width:730px;"><h4>Other Ressources</h4><ul>
<li style="width:600px;"><a href="files/qa.htm">QA Plots (updated every 5 minutes)</a></li>
<li style="width:500px;"><a href="files/vertex.htm">Vertex Plots (updated after each file)</a></li>
-<li style="width:500px;"><a href="http://cerberus.x-matter.uni-frankfurt.de:3060/logbook">Beamtime Logbook</a></li>
+<li style="width:500px;"><a href="../logbook">Beamtime Logbook</a></li>
<li style="width:500px;"><a href="http://lxhadeb06/icinga">Icinga Server Monitoring</a>
-<li style="width:500px;"><a href="http://cerberus.x-matter.uni-frankfurt.de:3060/munin">Munin Server Monitoring</a></li>
+<li style="width:500px;"><a href="../munin">Munin Server Monitoring</a></li>
<li style="width:500px;"><a href="archive">Archive of Hmon Windows (updated every 10 minutes)</a></li>
</ul></div>
<div class="linkbox" style="float:left"><h4>Start</h4><ul>
<li><a href="monitor.cgi?1-window-StartRate">Rates for all Start / Veto (histo)</a></li>
<li><a href="monitor.cgi?1-window-StartRateBars">Rates for all Start / Veto (histo,bargraph)</a></li>
-<li><a href="monitor.cgi?1-window-StartBars">Rates for all Start / Veto (bargraph)</a></li>
+<li><a href="monitor.cgi?1-window-StartBars">Rates for all Start / Veto (bargraph) </a></li>
+<li><a href="monitor.cgi?1-window-VetoHalo">Rates for Veto & HALO</a></li>
<li><a href="monitor.cgi?1-window-StartPosition">Beam Position</a></li>
<li><a href="monitor.cgi?1-window-SpillStructure">Spill Structure from Start</a></li>
</ul></div>
<div class="linkbox" style="float:left"><h4>ECal</h4><ul>
<li><a href="monitor.cgi?1-window-ECalRate">Rate Summary for ECal</a></li>
<li><a href="ecal_drawing.htm#ecalrate_slow">Rate for ECal</a></li>
+<li><a href="monitor.cgi?2-EcalHVVMap">ECAL HV Voltage Map</a></li>
+<li><a href="monitor.cgi?2-EcalHVCMap">ECAL HV Current Map</a></li>
</ul></div>
my $events = 0;
my @evtrates = (0,0,0);
my @ebrates = ();
-my ($oldsumtype1,$oldsumtype9,$oldsumtypeE) = (0,0,0);
-my ($cnterrtype9,$cnterrtypeE) = (50,50);
+my ($oldsumtype1,$oldsumtype9,$oldsumtypeE,$oldsumtypeD) = (0,0,0,0);
+my ($cnterrtype9,$cnterrtypeE,$cnterrtypeD) = (50,50,50);
my $lasttotalbytes = 21;
my @ebrecvhist;
my @byteshist;
my $fqa = QA::OpenQAFile();
+my $notactivesourcefile = "/home/hadaq/trbsoft/hadesdaq/evtbuild/tmp/EB_NotActiveSources.txt";
+my $cmdchecksources = "cat $notactivesourcefile 2>/dev/null;";
# JAM 2018 here figure out corresponding json calles
my $trbneterr = 0;
my $sumtype1 = 0;
my $sumtype9 = 0;
- my $sumtypeE = 0;
- my ($ratetype1,$ratetype9,$ratetypeE) = (0,0,0);
+ my $sumtypeE = 0;
+ my $sumtypeD = 0;
+ my ($ratetype1,$ratetype9,$ratetypeE,$ratetypeD) = (0,0,0,0);
# 0x03 => CTS
my $rh_result = trb_register_read(QA::CTSAddress, 0xa0f0) or $trbneterr = 1; # or sleep 5 and next;
$sumtype1 += $trigtype_array->[5] || 0;
$sumtype9 += $trigtype_array->[13] || 0;
$sumtypeE += $trigtype_array->[18] || 0;
+$sumtypeD += $trigtype_array->[17] || 0;
$totalrate = get ($url_erate);
+
+
# here check mismatch between running bnet nodes and active ones:
if($num_bnetin>$num_act_ins)
$qamsg .= "Only $num_act_build nodes of $num_bnetbuild BNET builders are building events! ";
}
+# here check if some hub sources are not active:
+
+my @notactivehubs = `$cmdchecksources`;
+chomp @notactivehubs;
+if(scalar @notactivehubs>0)
+{
+ $qamsg .= "EB setup has non active datasources: ";
+ $qastate = QA::WARN_2 unless $qastate == QA::ERROR;
+
+}
+foreach my $line (@notactivehubs)
+{
+ $qamsg .= " $line ";
+}
+#########################
if($trbneterr) {
$qastate = QA::ERROR;
}
if ($qamsg eq "") {$qamsg = "No error found";}
- if ($qastate == QA::OK) {
- $qamsg .= sprintf(". Total rate: %i, 4-spill average: %i, total per EB: %i",
+ if ($qastate == QA::OK || $qastate == QA::WARN_2) {
+ $qamsg .= sprintf(". <br> Total rate: %i, 4-spill average: %i, total per EB: %i",
$totalrate,$ebavgrate,$totalrate/($num_act_build || $totalrate || 1));
}
$ratetype1 = $sumtype1 - $oldsumtype1 unless ($oldsumtype1 > $sumtype1);
$ratetype9 = $sumtype9 - $oldsumtype9 unless ($oldsumtype9 > $sumtype9);
$ratetypeE = $sumtypeE - $oldsumtypeE unless ($oldsumtypeE > $sumtypeE);
+ $ratetypeD = $sumtypeD - $oldsumtypeD unless ($oldsumtypeD > $sumtypeD);
$cnterrtype9 += -0.8+$ratetype9 ;#if $evtrate > $act*32;
$cnterrtypeE += -0.8+$ratetypeE ;#if $evtrate > $act*32;
- if($oldsumtype1 > $sumtype1) {
+# $cnterrtypeD += -0.8+$ratetypeD;
+ if(($oldsumtype1 > $sumtype1) || ($ratetypeD == 0)) {
$cnterrtype9 = 50;
$cnterrtypeE = 50;
}
$ebavgbytes/($ebavgrate || $ebavgbytes || 1),
$totalrate/($num_bnetbuild || $totalrate || 1));
- $evtavglong .= sprintf(" <br> MDC Calib Evt: %i (%i/s) - Status Evt: %i (%i/s)",
- $sumtype9,$ratetype9,$sumtypeE,$ratetypeE);
+ $evtavglong .= sprintf(" <br> MDC Calib Evt: %i (%i/s) - Status Evt: %i (%i/s) - Trb3Cal Evt: %i (%i/s)",
+ $sumtype9,$ratetype9,$sumtypeE,$ratetypeE,$sumtypeD,$ratetypeD);
- if($cnterrtypeE < 30 || $cnterrtype9 < 30) {
+ if($ratetypeD > 0) {
+ $evtavglong .= " <br> TRB3 Calibration mode is running! (total $sumtypeD events)";
+ }
+
+ if(($cnterrtypeE < 30 || $cnterrtype9 < 30) && ($ratetypeD == 0)) {
$qastate = QA::WARN_2;
$evtavglong .= " <br> Number of special triggers is not correct (debug $cnterrtype9 $cnterrtypeE)";
}
QA::WriteQALog($fqa,"eb","bytes",30,QA::NA,"Data Rate","N/A","N/A") unless $opt_debug>0;
}
- ($oldsumtype1,$oldsumtype9,$oldsumtypeE) = ($sumtype1,$sumtype9,$sumtypeE);
+ ($oldsumtype1,$oldsumtype9,$oldsumtypeE,$oldsumtypeD) = ($sumtype1,$sumtype9,$sumtypeE,$sumtypeD);
$lasttotalbytes = $totalbytes;
usleep(990000);
}
--- /dev/null
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+use Time::HiRes qw( gettimeofday usleep time );
+use POSIX qw(strftime);
+use FileHandle;
+use Data::Dumper;
+use POSIX qw/floor ceil/;
+use List::Util qw/min max/;
+use Hmon;
+use QA;
+use Perl2Epics;
+use HADES::TrbNet;
+use HPlot;
+
+my $flog = QA::OpenQAFile();
+my @colors = ("#333333","#00ff00","#ff0000","#0000ff","#dddd00","#dd00dd");
+
+
+
+for my $i (0..5) {
+ HPlot::PlotInit( {
+ name => "EcalCurr$i",
+ file => "files/EcalCurr$i",
+ entries => 168,
+ type => HPlot::TYPE_BARGRAPH,
+ output => HPlot::OUT_PNG,
+ titles => [sprintf("Sector %i - current",$i+1)],
+ xlabel => "Module number",
+ ylabel => "uA",
+ sizex => 430,
+ sizey => 190,
+ xmin => 0,
+ xmax => 168,
+ ymin => 0,
+ ymax => 1600,
+ curves => 1,
+ countup => 1,
+ xscale => 1,
+ nokey => 0,
+ buffer => 1,
+ bargap => 0.4,
+ curvewidth => 1,});
+ }
+
+for my $i (0..5) {
+ HPlot::PlotInit( {
+ name => "EcalVolt$i",
+ file => "files/EcalVolt$i",
+ entries => 168,
+ type => HPlot::TYPE_BARGRAPH,
+ output => HPlot::OUT_PNG,
+ titles => [sprintf("Sector %i - voltage",$i+1)],
+ xlabel => "Module number",
+ ylabel => "V",
+ sizex => 430,
+ sizey => 190,
+ xmin => 0,
+ xmax => 168,
+ ymin => 0,
+ ymax => 2500,
+ curves => 1,
+ countup => 1,
+ xscale => 1,
+ nokey => 0,
+ buffer => 1,
+ bargap => 0.4,
+ curvewidth => 1,});
+ }
+
+
+for my $i (0..5) {
+ HPlot::PlotInit( {
+ name => "EcalVMap$i",
+ file => "files/EcalVMap$i",
+ title => "",
+ entries => 17,
+ curves => 15,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ zlabel => "Voltage [V]",
+ titles => ["Voltage [V]"],
+ sizex => 255,
+ sizey => 200,
+ nokey => 0,
+ buffer => 1,
+ xmin => -0.5,
+ xmax => 16.5,
+ ymin => -0.5,
+ ymax => 14.5,
+ cbmax => "1.1<*<2500",
+ cbmin => "0.1<*<0.9",
+ noinit => 0,
+ showvalues => 0, });
+ }
+
+for my $i (0..5) {
+ HPlot::PlotInit( {
+ name => "EcalCMap$i",
+ file => "files/EcalCMap$i",
+ title => "",
+ entries => 17,
+ curves => 15,
+ type => HPlot::TYPE_HEATMAP,
+ output => HPlot::OUT_PNG,
+ zlabel => "Current [uA]",
+ titles => ["Current [uA]"],
+ sizex => 255,
+ sizey => 200,
+ nokey => 0,
+ buffer => 1,
+ xmin => -0.5,
+ xmax => 16.5,
+ ymin => -0.5,
+ ymax => 14.5,
+ cbmax => "1.1<*<2000",
+ cbmin => "0.1<*<0.9",
+ noinit => 0,
+ showvalues => 0, });
+ }
+
+
+
+my $timer = 0;
+my $str = "";
+my $s="";
+
+for(my $i = 1; $i <=6; $i++) {
+ if ($i==2 or $i==3 or $i==5 or $i==6){
+ for(my $j = 1; $j<=168; $j++) {
+ my $cnt = (($i-1)*168)+$j-1;
+ if($j<10) {$s = sprintf("HAD:ECAL:HV:S%i:M00%i:imon",$i,$j);}
+ if($j>=10 and $j<100) {$s = sprintf("HAD:ECAL:HV:S%i:M0%i:imon",$i,$j);}
+ if($j>=100) {$s = sprintf("HAD:ECAL:HV:S%i:M%i:imon",$i,$j);}
+ Perl2Epics::Connect("I$cnt",$s);
+ if($j<10) {$s = sprintf("HAD:ECAL:HV:S%i:M00%i:vmon",$i,$j);}
+ if($j>=10 and $j<100) {$s = sprintf("HAD:ECAL:HV:S%i:M0%i:vmon",$i,$j);}
+ if($j>=100) {$s = sprintf("HAD:ECAL:HV:S%i:M%i:vmon",$i,$j);}
+ Perl2Epics::Connect("U$cnt",$s);
+ }
+ }
+}
+
+
+print "Connected.\n";
+
+#OVERCURRENT variables
+my $overcurrent_flag = 0;
+my $OVERCURRENT_YELLOW = 200;
+my $OVERCURRENT_RED = 300;
+
+my $OVERCURRENT_period = 3;
+my $overcurrent_alarm_flag = 0;
+my $current_average = 0;
+my $current_sum = 0;
+
+my $errortimer = 0;
+
+my @mod_tab=(0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 26, 27, 28, 29, 30, 31, 32, 33, 0, 0, 0, 0, 0, 0, 0, 0, 34, 35, 36, 37, 38, 39, 40, 41, 42, 0, 0, 0, 0, 0, 0, 0, 0, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 0, 0, 0, 0, 0, 0, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 0, 0, 0, 0, 0, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 0, 0, 0, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 0, 0, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 0, 0, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163);
+
+my @x_tab=(10, 9, 8, 7, 6, 10, 9, 8, 7, 6, 11, 10, 9, 8, 7, 6, 5, 11, 10, 9, 8, 7, 6, 5, 12, 11, 10, 9, 8, 7, 6, 5, 4, 12, 11, 10, 9, 8, 7, 6, 5, 4, 12, 11, 10, 9, 8, 7, 6, 5, 4, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
+
+my @y_tab=(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14);
+
+
+
+
+while(1) {
+ my $min_v = -1E5;
+ my $max_v = 1E5;
+ my $min_i = -1E5;
+ my $max_i = 1E5;
+ my $ChnlsOn = 0;
+ my $data = Perl2Epics::GetAll();
+
+ for(my $i = 0; $i <=5; $i++) {
+ for(my $j = 0; $j<=167; $j++) {
+ my $cnt = ($i*168)+$j;
+ if ($i==1 or $i==2 or $i==4 or $i==5){
+ if (abs($data->{"U$cnt"}->{val})>1000 and $data->{"I$cnt"}->{val}>50) {$ChnlsOn++;}
+ }
+ }
+ }
+
+
+ $str = Hmon::MakeTitle(11, 18, "ECAL HV - Current", 1, "");
+ $str .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"files/styles.css\">";
+
+ $str .= "<div style=\"text-align:left; margin-top: 10px; width: 200px\">";
+
+ if ($ChnlsOn == 0) {
+ $str .= "<div><div class=\"redbutton\" style=\"float:left;\" title=\"channels off\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels off (";
+ } elsif ($ChnlsOn < 652 and $ChnlsOn >= 642) {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: orange;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } elsif ($ChnlsOn < 642) {
+ $str .= "<div><div class=\"redbutton\" style=\"float:left;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } elsif ($ChnlsOn > 652) {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: #ffcc00;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } else {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ }
+ $str .= "$ChnlsOn";
+ $str .= "/652)</p></div>";
+
+ $str .= "</div>\n\n";
+
+ $str .= qq@<img src="%ADDPNG files/EcalCurr0.png%" type="image/png"><br>\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalCurr5.png%" type="image/png">\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalCurr1.png%" type="image/png"><br>\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalCurr4.png%" type="image/png">\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalCurr2.png%" type="image/png"><br>\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalCurr3.png%" type="image/png"><br>\n@;
+
+
+ $str .= Hmon::MakeFooter();
+ $str .= "</body>";
+ $str .= "</html>";
+ Hmon::WriteFile("EcalHVCurr", $str);
+
+
+
+ $str = Hmon::MakeTitle(11, 18, "ECAL HV - Voltage", 1, "");
+ $str .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"files/styles.css\">";
+
+ $str .= "<div style=\"text-align:left; margin-top: 10px; width: 200px\">";
+
+ if ($ChnlsOn == 0) {
+ $str .= "<div><div class=\"redbutton\" style=\"float:left;\" title=\"channels off\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels off (";
+ } elsif ($ChnlsOn < 652 and $ChnlsOn >= 642) {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: orange;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } elsif ($ChnlsOn < 642) {
+ $str .= "<div><div class=\"redbutton\" style=\"float:left;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } elsif ($ChnlsOn > 652) {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: #ffcc00;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } else {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ }
+ $str .= "$ChnlsOn";
+ $str .= "/652)</p></div>";
+
+ $str .= "</div>\n\n";
+
+
+ $str .= qq@<img src="%ADDPNG files/EcalVolt0.png%" type="image/png"><br>\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalVolt5.png%" type="image/png">\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalVolt1.png%" type="image/png"><br>\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalVolt4.png%" type="image/png">\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalVolt2.png%" type="image/png"><br>\n@;
+ $str .= qq@<img src="%ADDPNG files/EcalVolt3.png%" type="image/png"><br>\n@;
+
+
+ $str .= Hmon::MakeFooter();
+ $str .= "</body>";
+ $str .= "</html>";
+ Hmon::WriteFile("EcalHVVolt", $str);
+
+
+
+
+
+ $str = Hmon::MakeTitle(10, 13, "ECAL HV - Voltage Map", 1, "");
+ $str .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"files/styles.css\">";
+
+ $str .= "<div style=\"text-align:left; margin-top: 10px; width: 200px\">";
+
+ if ($ChnlsOn == 0) {
+ $str .= "<div><div class=\"redbutton\" style=\"float:left;\" title=\"channels off\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels off (";
+ } elsif ($ChnlsOn < 652 and $ChnlsOn >= 642) {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: orange;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } elsif ($ChnlsOn < 642) {
+ $str .= "<div><div class=\"redbutton\" style=\"float:left;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } elsif ($ChnlsOn > 652) {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: #ffcc00;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } else {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ }
+ $str .= "$ChnlsOn";
+ $str .= "/652)</p></div>";
+
+ $str .= "</div>\n\n<table>\n<tr><td>Sector 1</td>\n<td>Sector 2</td>\n<td>Sector 3</td>\n</tr>\n<tr>";
+
+
+ $str .= qq@<td><img src="%ADDPNG files/EcalVMap0.png%" type="image/png"></td>\n@;
+ $str .= qq@<td><img src="%ADDPNG files/EcalVMap1.png%" type="image/png"></td>\n@;
+ $str .= qq@<td><img src="%ADDPNG files/EcalVMap2.png%" type="image/png"></td>\n</tr>\n@;
+
+ $str .= "<tr><td>Sector 4</td>\n<td>Sector 5</td>\n<td>Sector 6</td>\n</tr>\n<tr>\n";
+
+ $str .= qq@<td><img src="%ADDPNG files/EcalVMap3.png%" type="image/png"></td>\n@;
+ $str .= qq@<td><img src="%ADDPNG files/EcalVMap4.png%" type="image/png"></td>\n@;
+ $str .= qq@<td><img src="%ADDPNG files/EcalVMap5.png%" type="image/png"></td>\n</tr>\n</table>\n@;
+
+
+ $str .= Hmon::MakeFooter();
+ $str .= "</body>";
+ $str .= "</html>";
+ Hmon::WriteFile("EcalHVVMap", $str);
+
+
+
+ $str = Hmon::MakeTitle(10, 13, "ECAL HV - Current Map", 1, "");
+ $str .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"files/styles.css\">";
+
+ $str .= "<div style=\"text-align:left; margin-top: 10px; width: 200px\">";
+
+ if ($ChnlsOn == 0) {
+ $str .= "<div><div class=\"redbutton\" style=\"float:left;\" title=\"channels off\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels off (";
+ } elsif ($ChnlsOn < 652 and $ChnlsOn >= 642) {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: orange;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } elsif ($ChnlsOn < 642) {
+ $str .= "<div><div class=\"redbutton\" style=\"float:left;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } elsif ($ChnlsOn > 652) {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: #ffcc00;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ } else {
+ $str .= "<div><div class=\"greenbutton\" style=\"float:left\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> Channels on (";
+ }
+ $str .= "$ChnlsOn";
+ $str .= "/652)</p></div>";
+
+ $str .= "</div>\n\n<table>\n<tr><td>Sector 1</td>\n<td>Sector 2</td>\n<td>Sector 3</td>\n</tr>\n<tr>";
+
+
+ $str .= qq@<td><img src="%ADDPNG files/EcalCMap0.png%" type="image/png"></td>\n@;
+ $str .= qq@<td><img src="%ADDPNG files/EcalCMap1.png%" type="image/png"></td>\n@;
+ $str .= qq@<td><img src="%ADDPNG files/EcalCMap2.png%" type="image/png"></td>\n</tr>\n@;
+
+ $str .= "<tr><td>Sector 4</td>\n<td>Sector 5</td>\n<td>Sector 6</td>\n</tr>\n<tr>\n";
+
+ $str .= qq@<td><img src="%ADDPNG files/EcalCMap3.png%" type="image/png"></td>\n@;
+ $str .= qq@<td><img src="%ADDPNG files/EcalCMap4.png%" type="image/png"></td>\n@;
+ $str .= qq@<td><img src="%ADDPNG files/EcalCMap5.png%" type="image/png"></td>\n</tr>\n</table>\n@;
+
+
+ $str .= Hmon::MakeFooter();
+ $str .= "</body>";
+ $str .= "</html>";
+ Hmon::WriteFile("EcalHVCMap", $str);
+
+
+ $timer++;
+
+
+ my $qastate = QA::OK;
+ my $value = sprintf("%i/652",$ChnlsOn);
+ my $longtext = sprintf("HV channels On: %i/652",$ChnlsOn);
+
+ if ($ChnlsOn < 652 and $ChnlsOn >= 642){
+ $qastate = QA::WARN_2;}
+ if ($ChnlsOn < 642){
+ $qastate = QA::ERROR_2;}
+ if ($ChnlsOn == 0){
+ $qastate = QA::NOTE;}
+
+
+ $str = "";
+ if($timer%8 == 0) {
+ if ($ChnlsOn>0 and $ChnlsOn<652) {
+ for(my $i = 1; $i <=6; $i++) {
+ if ($i==2 or $i==3 or $i==5 or $i==6){
+ for(my $j = 1; $j<=168; $j++) {
+ my $cnt = (($i-1)*168)+$j-1;
+ if($data->{"U$cnt"}->{val}<1000 and $data->{"I$cnt"}->{val}>=10){ $str .= sprintf("Low voltage on module %i, sector %i.<br>",$j,$i);}
+ if($data->{"I$cnt"}->{val}<10 and $data->{"U$cnt"}->{val}>=1000){ $str .= sprintf("Low current on module %i, sector %i.<br>",$j,$i);}
+ if($data->{"U$cnt"}->{val}<10 and $data->{"I$cnt"}->{val}<10){ $str .= sprintf("Module %i, sector %i is switched off. Check!<br>",$j,$i);}
+
+ }
+ }
+ }
+# $value = sprintf("%i/652",$ChnlsOn);
+ $longtext = sprintf("HV channels On: %i/652<br>Check the current and voltage monitoring plots!<br>%s",$ChnlsOn,$str);
+ }
+ elsif($ChnlsOn==0) {
+ $value = sprintf("HV is OFF");
+ $longtext = sprintf("HV is OFF");
+ }
+ QA::WriteQALog($flog,"hv","ecalhv",30,$qastate,"ECAL HV",$value,$longtext);
+ }
+
+
+ for (my $i = 0; $i <= 5;$i++){
+ if($i==1 or $i==2 or $i==4 or $i==5){
+ for (my $j = 0; $j<=167; $j++) {
+ my $cnt = ($i*168)+$j;
+ HPlot::PlotAdd("EcalCurr$i",$data->{"I$cnt"}->{val}||-1,);
+ HPlot::PlotAdd("EcalVolt$i",$data->{"U$cnt"}->{val}||-1,);
+ }
+
+ for(my $j=254;$j>=0;$j--){
+ my $cnt =-1;
+ if($mod_tab[$j]!=0){
+ $cnt=($i*168)+$mod_tab[$j]-1;
+ HPlot::PlotAdd("EcalVMap$i",$data->{"U$cnt"}->{val}||-1,$y_tab[$j],$x_tab[$mod_tab[$j]-1]);
+ HPlot::PlotAdd("EcalCMap$i",$data->{"I$cnt"}->{val}||-1,$y_tab[$j],$x_tab[$mod_tab[$j]-1]);
+ }
+ if($mod_tab[$j]==0){
+ HPlot::PlotAdd("EcalVMap$i",$data->{"U$cnt"}->{val}||'NaN',$y_tab[$j],$x_tab[$mod_tab[$j]-1]);
+ HPlot::PlotAdd("EcalCMap$i",$data->{"I$cnt"}->{val}||'NaN',$y_tab[$j],$x_tab[$mod_tab[$j]-1]);
+ }
+ }
+
+
+ }
+ }
+
+
+ #print Dumper $data;
+ if($timer%8 == 0) {
+ for (my $i = 0; $i <= 5;$i++){
+ HPlot::PlotDraw("EcalCurr$i");
+ HPlot::PlotDraw("EcalVolt$i");
+ HPlot::PlotDraw("EcalVMap$i");
+ HPlot::PlotDraw("EcalCMap$i");
+ }
+ }
+
+ usleep(250000);
+ }
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Time::HiRes qw( gettimeofday usleep time );
+use FileHandle;
+use Data::Dumper;
+use POSIX qw/floor ceil/;
+use Clone qw(clone);
+use Hmon;
+use QA;
+use List::Util qw(sum);
+
+my $store = {};
+my $laststore = {};
+my $str;
+
+
+
+my $fqa = QA::OpenQAFile();
+
+
+my @srv = qw( lxhadeb08 lxhadeb09 lxhadeb10 lxhadeb11 lxhadeb12 );
+
+
+
+
+
+while(1) {
+ $store = {};
+ my $qastate = QA::OK;
+ my $qastr = '';
+ foreach my $s (@srv) {
+ my @out = Hmon::qxtimeout("ssh $s \"cat /proc/interrupts | grep TxRx-0 | head -n 1 \" </dev/null",10);
+
+ if ($out[0] =~ /TxRx-0/) {
+ my @arr = split(/\s+/,$out[0]);
+ $store->{$s} = \@arr;
+ next unless $laststore->{$s};
+ my @diff = map {$store->{$s}[$_] - $laststore->{$s}[$_];} (2..65);
+ my $sum = sum(@diff);
+ if ($diff[0] < 0.9*$sum) {
+ $qastate = QA::WARN_2;
+ $qastr .= "$s ";
+ }
+ }
+
+ }
+
+
+ QA::WriteQALog($fqa,"misc","irq",40,$qastate,"IRQ","OK","") if $qastr eq '';
+ QA::WriteQALog($fqa,"misc","irq",40,$qastate,"IRQ","Error","IRQ affinity wrong on $qastr") unless $qastr eq '';
+ $laststore = $store;
+ sleep 10;
+ }
+
}
if ($ChnlsOn == 0) {
$str .= "<div><div class=\"redbutton\" style=\"float:left;\" title=\"channels off\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> channels off (";
- } elsif ($ChnlsOn < 66) {
+ } elsif ($ChnlsOn < 74) {
$str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: orange;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> channels on (";
- } elsif ($ChnlsOn > 66) {
+ } elsif ($ChnlsOn > 74) {
$str .= "<div><div class=\"greenbutton\" style=\"float:left; background-color: #ffcc00;\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> channels on (";
} else {
$str .= "<div><div class=\"greenbutton\" style=\"float:left\"></div><p style=\"text-align:left;position: relative; left: 10px;top: 6px;\"> channels on (";
}
$str .= "$ChnlsOn";
- $str .= "/66)</p></div>";
+ $str .= "/74)</p></div>";
my $ModulesOk = 0;
}
}
-$qastate = QA::WARN_2 if ($ChnlsOn < 66);
+$qastate = QA::WARN_2 if ($ChnlsOn < 74);
$qastate = QA::ERROR_2 if ($ChnlsOn == 0);
$qastate = QA::NOTE if ($QA::RichHvOff == 1);
if( $timer % (4*$OVERCURRENT_period) == 0) {
if ($data->{"HVPowerOn"}->{val} != 0) {
$value = sprintf("%.2f / %.2f kV",$min_v/1000,$max_v/1000);
- $longtext = sprintf("Min: %.2f kV | Max: %.2f kV <br> Min: %.4f mA | Max: %.4f mA <br> HV channel On: %i/66",$min_v/1000,$max_v/1000,$min_i,$max_i,$ChnlsOn);
+ $longtext = sprintf("Min: %.2f kV | Max: %.2f kV <br> Min: %.4f mA | Max: %.4f mA <br> HV channel On: %i/74",$min_v/1000,$max_v/1000,$min_i,$max_i,$ChnlsOn);
} else {
$value = sprintf("HV-Crate is OFF");
$longtext = sprintf("HV-Crate is OFF");