}
elsif(defined $min) {
plot_write($fh,"set $name [$min:]");
- }
+ }
}
+
+
sub PlotInit {
my ($c) = @_;
my $fn = "gnuplot";
#my $fh = new FileHandle ("|$fn") or die "error: no gnuplot";
open my $fh, "|$fn" or die "error: no gnuplot";
+ #open my $fh, ">delme_$name" or die "error: no gnuplot";
$fh->autoflush(1);
$p->{$name}->{colors} = $p->{$name}->{colors} || \@color;
$p->{$name}->{showvalues} = $p->{$name}->{showvalues} || 0;
$p->{$name}->{storable} = $p->{$name}->{storable} || 0;
+ $p->{$name}->{plot_string} = ""; # to store the plot command
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});
setranges($fh,'zrange',$p->{$name}->{zmin},$p->{$name}->{zmax});
setranges($fh,'cbrange',$p->{$name}->{cbmin},$p->{$name}->{cbmax});
-
- if($p->{$name}->{type} == TYPE_HISTORY) {
- if($p->{$name}->{fill}) {
+ if ($p->{$name}->{type} == TYPE_HISTORY) {
+ if ($p->{$name}->{fill}) {
plot_write($fh,"set style fill solid 1.00");
- }
+ }
else {
plot_write($fh,"set style fill solid 0");
- }
+ }
plot_write($fh,"set boxwidth 2 absolute");
plot_write($fh,"set autoscale fix");
plot_write($fh,"set xtics autofreq"); #$p->{$name}->{entries}
plot_write($fh,"set grid");
-# plot_write($fh,"set style fill solid 1.0");
- plot_write($fh,"plot ",1);
- for(my $j=0; $j<$p->{$name}->{curves};$j++) {
- if($p->{$name}->{fill}) {
- plot_write($fh,"'-' using 1:2 with filledcurves x1 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1);
- }
- elsif($p->{$name}->{dots}) {
- plot_write($fh,"'-' using 1:2 with points pointsize 0.6 pointtype 2 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1);
- }
+ # plot_write($fh,"set style fill solid 1.0");
+ #plot_write($fh,"plot ",1);
+ $p->{$name}->{plot_string} .= "plot ";
+ for (my $j=0; $j<$p->{$name}->{curves};$j++) {
+ if ($p->{$name}->{fill}) {
+ #plot_write($fh,"'-' using 1:2 with filledcurves x1 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1);
+ $p->{$name}->{plot_string} .= "'-' using 1:2 with filledcurves x1 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ";
+ }
+ elsif ($p->{$name}->{dots}) {
+ #plot_write($fh,"'-' using 1:2 with points pointsize 0.6 pointtype 2 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1);
+ $p->{$name}->{plot_string} .= "'-' using 1:2 with points pointsize 0.6 pointtype 2 lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ";
+ }
else {
- plot_write($fh,"'-' using 1:2 with lines lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1);
- }
- plot_write($fh,', ',1) unless ($j+1==$p->{$name}->{curves});
+ #plot_write($fh,"'-' using 1:2 with lines lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1);
+ $p->{$name}->{plot_string} .= "'-' using 1:2 with lines lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ";
}
- plot_write($fh," ");
+ #plot_write($fh,', ',1) unless ($j+1==$p->{$name}->{curves});
+ $p->{$name}->{plot_string} .= ', ' unless ($j+1==$p->{$name}->{curves});
}
- elsif($p->{$name}->{type} == TYPE_BARGRAPH) {
+ #plot_write($fh," ");
+ $p->{$name}->{plot_string} .= " \n";
+ plot_write($fh, $p->{$name}->{plot_string});
+ }
+ 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 ".($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}}) {
+ 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++) {
+ for (my $j=0; $j<scalar @{$p->{$name}->{bartitle}};$j++) {
plot_write($fh,', ',1) if $j;
plot_write($fh,"'".$p->{$name}->{bartitle}->[$j]."' $j ",1);
- }
- plot_write($fh,") offset 2.5,0 scale 0");
}
+ plot_write($fh,") offset 2.5,0 scale 0");
+ }
plot_write($fh,"set style histogram title offset character 0, 0, 0");
plot_write($fh,"set style data histograms");
- plot_write($fh,"plot ",1);
- for(my $j=0; $j<$p->{$name}->{curves};$j++) {
- plot_write($fh,', ',1) if $j;
- plot_write($fh,"'-' lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1);
- }
- plot_write($fh," ");
+ #plot_write($fh,"plot ",1);
+ $p->{$name}->{plot_string} .= "plot ";
+ for (my $j=0; $j<$p->{$name}->{curves};$j++) {
+ #plot_write($fh,', ',1) if $j;
+ $p->{$name}->{plot_string} .= ', ' if $j;
+ #plot_write($fh,"'-' lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ",1);
+ $p->{$name}->{plot_string} .= "'-' lt rgb \"".$p->{$name}->{colors}->[$j]."\" title \"".($p->{$name}->{titles}->[$j] || "$j")."\" ";
}
- elsif($p->{$name}->{type} == TYPE_HEATMAP) {
+ #plot_write($fh," ");
+ $p->{$name}->{plot_string} .= " \n";
+ plot_write($fh, $p->{$name}->{plot_string});
+ }
+ elsif ($p->{$name}->{type} == TYPE_HEATMAP) {
plot_write($fh,"set view map");
plot_write($fh,"set palette rgbformulae 22,13,-31");
if ($p->{$name}->{showvalues} == 0) {
- plot_write($fh,"splot '-' matrix with image");
- }
+ #plot_write($fh,"splot '-' matrix with image");
+ $p->{$name}->{plot_string} .= "splot '-' matrix with image \n"
+ }
else {
- plot_write($fh,"plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)) with labels tc rgb \"#ffffff\" font ',10'");
-# plot_write($fh,"plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)):3 with labels tc palette font ',10'");
- }
+ #plot_write($fh,"plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)) with labels tc rgb \"#ffffff\" font ',10'");
+ $p->{$name}->{plot_string} .= "plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)) with labels tc rgb \"#ffffff\" font ',10'";
+ #### plot_write($fh,"plot '-' matrix with image, '-' matrix using 1:2:(sprintf('%i', \$3)):3 with labels tc palette font ',10'");
}
+ plot_write($fh, $p->{$name}->{plot_string});
+ }
else {
die "Plot type not supported";
- }
-
}
+}
+
sub PlotDraw {
my($name) = @_;
if($p->{$name}->{run}>=1) {
plot_write($p->{$name}->{fh},"set out \"".$p->{$name}->{file}.($p->{$name}->{buffer}?"tmp":"").".png\"");
plot_write($p->{$name}->{fh},makeTimeString());
- plot_write($p->{$name}->{fh},"replot");
+ #plot_write($p->{$name}->{fh},"replot");
+ plot_write($p->{$name}->{fh}, $p->{$name}->{plot_string});
}
-
+
if($p->{$name}->{type} == TYPE_HISTORY) {
for(my $j=0; $j<$p->{$name}->{curves}; $j++) {
for(my $i=0; $i< $p->{$name}->{entries}; $i++) {
}
}
plot_write($p->{$name}->{fh},"e");
- }
+ }
}
-
-
- if($p->{$name}->{type} == TYPE_BARGRAPH) {
+
+ if($p->{$name}->{type} == TYPE_BARGRAPH) {
+ #plot_write($p->{$name}->{fh}, $p->{$name}->{plot_string});
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]);
plot_write($p->{$name}->{fh},"e");
}
}
-
-
- if($p->{$name}->{type} == TYPE_HEATMAP) {
+
+ if($p->{$name}->{type} == TYPE_HEATMAP) {
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);
}
plot_write($p->{$name}->{fh}," ",0);
}
- plot_write($p->{$name}->{fh},"e");
- plot_write($p->{$name}->{fh},"e");
+ plot_write($p->{$name}->{fh},"e");
+ plot_write($p->{$name}->{fh},"e");
for(my $j=0; $j<$p->{$name}->{curves}; $j++) {
for(my $i=0; $i< $p->{$name}->{entries}; $i++) {
}
plot_write($p->{$name}->{fh}," ",0);
}
- plot_write($p->{$name}->{fh},"e");
- plot_write($p->{$name}->{fh},"e");
+ plot_write($p->{$name}->{fh},"e");
+ plot_write($p->{$name}->{fh},"e");
}
-
-
+
+
$p->{$name}->{run}++;
-
-
+
+
if($p->{$name}->{storable}) {
lock_store($p->{$name}->{value},$storefile->{$name});
}
$curve = 0 unless $curve;
$p->{$name}->{value}->[$curve]->[$slot] = $value||0;
}
-
+
1;
'endp'=>"Endp",
'feeerr'=>"Fee",
'other'=>"Other",
- 'pion'=>"Pion"};
+ 'pion'=>"Pion",
+ 'qa'=>'QA'};
# Order of categories
our $entries->{'cats'} = ["main",
"mdc",
"endp",
"feeerr",
- "pion",
+# "pion",
"other",
+ "qa",
];
# Order of entries in each cat
$entries->{'feeerr'} = ['rich', 'trb', 'feeerr','trginp','trgqual'];
$entries->{'pion'} = ['nxstatus', 'HV', 'HVcurr', 'cooling','seu'];
$entries->{'other'} = ['magnet','rich','shower','mdcinvalid','sequencer'];
+$entries->{'qa'} = ['goofy','','','',''];
our $QAServer = "hades33";
our @TimeoutLimits = (0, 0, 1);
our @LinkErrLimits = (50, 500, 1000);
our @MdcEndpMissingLimits = (0, 0, 1);
-our @RichEndpMissingLimits = (0, 0, 0);
+our @RichEndpMissingLimits = (0, 30, 30); #!!!!
our @TofEndpMissingLimits = (0, 0, 0);
our @RpcEndpMissingLimits = (0, 0, 0);
-our @OtherEndpMissingLimits = (0, 0, 0);
+our @OtherEndpMissingLimits = (0, 30, 30);#!!!
our @EBDeltaRateLimits = (10, 15, 25);
our $TrgCheckPolarity = 1;
our @Eventsbroken = (.5,5,10);
our @PionLvCurrLimits = (4,5,6);
+our $MdcHvOff = 1;
+our $RichHvOff = 1;
+our $MagnetOff = 1;
our @LimitTriggerPerSpill = (1000, 0, 0);
our $AcceleratorCycle = 7;
# Missing Boards
###############################################################################
-our @mdc_boards_removed =(0x2257); # 2233 added 2014-08-28
+our @mdc_boards_removed =(0x2257, 0x2029); # 2233 added 2014-08-28 , 2203 at 2014/09/03, 2029 2014/09/23
our @mdc_chambers_removed =();
our @rich_boards_removed =();
our @tof_boards_removed =();
my @other_boards =(
#shower
-# 0x3200,0x3201,0x3202,0x3210,0x3211,0x3212,0x3220,0x3221,0x3222,0x3230,0x3231,0x3232,0x3240,0x3241,0x3242,
-# 0x3250,0x3251,0x3252,
+ 0x3200,0x3201,0x3202,0x3210,0x3211,0x3212,0x3220,0x3221,0x3222,0x3230,0x3231,0x3232,0x3240,0x3241,0x3242,
+ 0x3250,0x3251,0x3252,
#shower-hub
# 0x8500,0x8501,
#cts
--- /dev/null
+#!/usr/bin/perl
+use strict;
+use IO::Handle;
+use Hmon;
+use QA;
+
+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())
+ }
+
+
+open my $GP,'|gnuplot -background white';
+
+my $fqa = QA::OpenQAFile() or die "No connection to QA Logfile";
+
+my $str = Hmon::MakeTitle(24,20,"Goofy",0);
+ $str .= qq@<img src="%ADDPNG files/goofyplot1.png%" type="image/png">@;
+ $str .= Hmon::MakeFooter();
+ Hmon::WriteFile("goofy1",$str);
+
+
+while(1)
+{
+my $tmp_lines = qx{ssh hadesdaq01 tail -n 500 /home/hadaq/Documents/bitscope/EPICS/goofy/goofyApp/gas_quality.txt};
+open(TMP_FILE,">/tmp/last_gas_data.txt");
+print TMP_FILE $tmp_lines;
+close(TMP_FILE);
+
+print {$GP} << '__GNUPLOT__';
+set term png size 1320,700 font "monospace,8"
+set out "files/goofyplot1.png"
+set multiplot
+set size 0.5,0.5
+set origin 0,0.5
+set title "drift velocity"
+set grid
+set xdata time
+set timefmt "%d/%m/%Y:%H:%M:%S"
+set format x "%d/%m\n%H:%M"
+set xlabel "time (dd/mm)"
+set ylabel "drift velocity (cm/us)"
+plot "/tmp/last_gas_data.txt" u 1:5 notitle
+set size 0.5,0.25
+set origin 0.5,0.5
+set title "drift time top"
+set grid
+set xdata time
+set timefmt "%d/%m/%Y:%H:%M:%S"
+set format x "%d/%m\n%H:%M"
+set xlabel "time (dd/mm)"
+set ylabel "drift time top (us)"
+plot "/tmp/last_gas_data.txt" u 1:6 notitle
+set origin 0.5,0.75
+set title "drift time bottom"
+set grid
+set xdata time
+set timefmt "%d/%m/%Y:%H:%M:%S"
+set format x "%d/%m\n%H:%M"
+set xlabel "time (dd/mm)"
+set ylabel "drift time bottom (us)"
+plot "/tmp/last_gas_data.txt" u 1:7 notitle
+set size 0.5,0.5
+set origin 0,0
+set title "pickup bottom on pickup top amplitude ratio"
+set grid
+set xdata time
+set timefmt "%d/%m/%Y:%H:%M:%S"
+set format x "%d/%m\n%H:%M"
+set xlabel "time (dd/mm)"
+set ylabel "pickup bottom on pickup top amplitude ratio"
+plot "/tmp/last_gas_data.txt" u 1:8 notitle
+set origin 0.5,0
+set title "pickup bottom on pickup top area ratio"
+set grid
+set xdata time
+set timefmt "%d/%m/%Y:%H:%M:%S"
+set format x "%d/%m\n%H:%M"
+set xlabel "time (dd/mm)"
+set ylabel "pickup bottom on pickup top area ratio"
+plot "/tmp/last_gas_data.txt" u 1:9 notitle
+unset multiplot
+reset
+__GNUPLOT__
+$GP->autoflush;
+
+my $qastate = QA::OK;
+#Replace 0 by the condition for ERROR on hmon Panel
+
+my $tmp_line = qx{ssh hadesdaq01 tail -n 1 /home/hadaq/Documents/bitscope/EPICS/goofy/goofyApp/gas_quality.txt};
+my @data = split(/ /,$tmp_line);
+my ($dateS,$dateE,$countsT,$countsB,$dv,$dtT,$dtB,$ramp,$rar)=@data;
+
+$qastate = QA::ERROR if (0);
+QA::WriteQALogvaleurs($fqa,"qa","goofy",120,$qastate,"Goofy","Running","Doing whatever needs to be done.");
+
+sleep(60);
+}
+
+#<>;
+close $GP;
if (!(defined $regamount->[$i]) || $regamount->[$i] == 1) {
# $c = "trbcmd r $address->[$i] $register->[$i] | sort";
$c = trb_register_read(($address->[$i]),($register->[$i]));
- foreach my $s (keys $c) {
+ foreach my $s (keys %$c) {
$c->{$s}=[$c->{$s}];
}
}
# print Dumper $c;
}
# my @out = qx($c);
- foreach my $s (sort keys $c) {
+ foreach my $s (sort keys %$c) {
for(my $r = 0; $r < scalar @{$c->{$s}};$r++) {
my $tmp = ($c->{$s}->[$r]>>$regoffset->[$i])&(2**$regwidth->[$i]-1);
my $val = $tmp;
for(my $i = 0; $i<scalar(@{$address});$i++) {
$val = 0;
my $c = trb_registertime_read($address->[$i], $register->[$i]) or sleep 1 and print "Error\n" and next;
- foreach my $o (sort keys $c) {
+ foreach my $o (sort keys %$c) {
# if (($a,$s,$t) = $o =~ /^0x(\w{4})\s*0x(\w{8})\s*0x(\w{4})/) {
$val += (($c->{$o}->{'value'}->[0]>>($regoffset->[$i]))&(2**($regwidth->[$i])-1));
}
$t = trb_registertime_read(0xfe49,0x8132);
if (defined $t) {
- foreach my $b (keys $t) {
+ foreach my $b (keys %$t) {
$o2->{$b}->{0x8132} = $t->{$b};
}
}
}
foreach my $b (keys %$o2) {
- foreach my $a (keys $o2->{$b}) {
+ 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;}
my $rh_mdc_rates = trb_register_read(0xfffd, 0x910b) or sleep 5 and next;
my $rh_evts = trb_register_read(0x0002, 0x0001) or sleep 5 and next;
- foreach my $v (sort keys $rh_mdc_rates) {
+ foreach my $v (sort keys %$rh_mdc_rates) {
$values->{$v} = ($rh_mdc_rates->{$v} || 0) - ($laststore->{$v} || $rh_mdc_rates->{$v} || 0);
$laststore->{$v} = $rh_mdc_rates->{$v};
$sum += $values->{$v};
if($rate > 1000 && $avg > 1000) {
- foreach my $v (sort keys $values) {
+ foreach my $v (sort keys %$values) {
# print($v." ".$values->{$v}."\n");
if($values->{$v} == 0) {
$error++;
$iteration = 1;
}
sleep 10;
- }
\ No newline at end of file
+ }
trb_register_setbit(0x8880,0xcf8f,1);
my $a = trb_register_read(0x8880,0xcf82);
my $length = $a->{0x8880};
+ $length = 0 if(!defined $length);
if($length > 0 && $length < 1E6) {
$length = $length/100*1024;
if($length < 500000) {$length = 500000;}
$filter = trb_register_read($address, 0x8400);
$addonfilter = trb_register_read($address, 0x8420);
$str .= "<strong>";
-
- if (($filter->{$address} & 0x80000000) == 0) {
- if (($addonfilter->{$address} & 0x80000000) > 0) {
+ 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/Pion1XOvfl.png%\" type=\"image/png\">\n";
$addonfilter = trb_register_read($address, 0x8420);
$str .= "<strong>";
- if (($filter->{$address} & 0x80000000) == 0) {
- if (($addonfilter->{$address} & 0x80000000) > 0) {
+ if (($addonfilter->{$address} & 0x80000000) != 0) {
+ if (($addonfilter->{$address} & 0x40000000) != 0) {
$str .= "${histname} (TS Cut Level2)";
} else {
$str .= "${histname} (TS Cut)";
$addonfilter = trb_register_read($address, 0x8420);
$str .= "<strong>";
- if (($filter->{$address} & 0x80000000) == 0) {
- if (($addonfilter->{$address} & 0x80000000) > 0) {
+ if (($addonfilter->{$address} & 0x80000000) != 0) {
+ if (($addonfilter->{$address} & 0x40000000) != 0) {
$str .= "${histname} (TS Cut Level2)";
} else {
$str .= "${histname} (TS Cut)";
$addonfilter = trb_register_read($address, 0x8420);
$str .= "<strong>";
- if (($filter->{$address} & 0x80000000) == 0) {
- if (($addonfilter->{$address} & 0x80000000) > 0) {
+ if (($addonfilter->{$address} & 0x80000000) != 0) {
+ if (($addonfilter->{$address} & 0x40000000) != 0) {
$str .= "${histname} (TS Cut Level2)";
} else {
$str .= "${histname} (TS Cut)";
$str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2YOvfl.png%\" type=\"image/png\">\n";
$str .= Hmon::MakeFooter();
- Hmon::WriteFile("pion2ovfl",$str);
+ Hmon::WriteFile("pion2ovfl", $str);
sleep(5);
}
} else {
$addonfilter = trb_register_read($address, 0x8420);
$str .= "<strong>";
- if (($filter->{$address} & 0x80000000) == 0) {
- if (($addonfilter->{$address} & 0x80000000) > 0) {
+ if (($addonfilter->{$address} & 0x80000000) != 0) {
+ if (($addonfilter->{$address} & 0x40000000) != 0) {
$str .= "${histname} (TS Cut Level2)";
} else {
$str .= "${histname} (TS Cut)";
$addonfilter = trb_register_read($address, 0x8420);
$str .= "<strong>";
- if (($filter->{$address} & 0x80000000) == 0) {
- if (($addonfilter->{$address} & 0x80000000) > 0) {
+ if (($addonfilter->{$address} & 0x80000000) != 0) {
+ if (($addonfilter->{$address} & 0x40000000) != 0) {
$str .= "${histname} (TS Cut Level2)";
} else {
$str .= "${histname} (TS Cut)";
$addonfilter = trb_register_read($address, 0x8420);
$str .= "<strong>";
- if (($filter->{$address} & 0x80000000) == 0) {
- if (($addonfilter->{$address} & 0x80000000) > 0) {
+ if (($addonfilter->{$address} & 0x80000000) != 0) {
+ if (($addonfilter->{$address} & 0x40000000) != 0) {
$str .= "${histname} (TS Cut Level2)";
} else {
$str .= "${histname} (TS Cut)";
$addonfilter = trb_register_read($address, 0x8420);
$str .= "<strong>";
- if (($filter->{$address} & 0x80000000) == 0) {
- if (($addonfilter->{$address} & 0x80000000) > 0) {
+ if (($addonfilter->{$address} & 0x80000000) != 0) {
+ if (($addonfilter->{$address} & 0x40000000) != 0) {
$str .= "${histname} (TS Cut Level2)";
} else {
$str .= "${histname} (TS Cut)";
$str .= "<img width=\"700\" height=\"265\" src=\"%ADDPNG files/Pion2Y.png%\" type=\"image/png\">\n";
$str .= Hmon::MakeFooter();
- Hmon::WriteFile("pion2rate",$str);
+ Hmon::WriteFile("pion2rate", $str);
sleep(5);
}
} else {
if($rate == 0 && ($rh_status->{3} & (1 << 31)) && ($rh_status->{3} & 0x3ff00000)) {
my $rh_hubs = trb_register_read(0xfffe,0x81) or sleep 5 and next;
- foreach my $h (sort keys $rh_hubs) {
+ foreach my $h (sort keys %$rh_hubs) {
if($rh_hubs->{$h} != 0) {
# $boardlist .= sprintf("%04x, ",$h);
if (isFeeHub($h)) {
QA::WriteQALog($fqa, "daq", "readout", 30, $qastate,"Read-out", $status,$longmsg);
# print $qastate." ".$status." ".$longmsg."\n";
sleep(5);
- }
\ No newline at end of file
+ }
my $hexval = sprintf("%x", $board);
my @a = split("", $hexval);
if($a[0] == "3" && $a[1] == "2") {
- $values{$board}->{"bytes"} = %$bytes_sent->{$board} - ($values{$board}->{"prev_bytes"}||0) if defined %$bytes_sent->{$board};
- $values{$board}->{"prev_bytes"} = %$bytes_sent->{$board};
+ $values{$board}->{"bytes"} = $bytes_sent->{$board} - ($values{$board}->{"prev_bytes"}||0) if defined $bytes_sent->{$board};
+ $values{$board}->{"prev_bytes"} = $bytes_sent->{$board};
$sum += $values{$board}->{"bytes"};
}
my $patternSum = 0;
my $thresholdSum = 0;
foreach my $board (keys %$configuration) {
- $pattern = sprintf("%x", ((%$configuration->{$board} & 0xf0) >> 4));
- $threshold = sprintf("%x", (%$configuration->{$board} & 0xf));
+ $pattern = sprintf("%x", (($configuration->{$board} & 0xf0) >> 4));
+ $threshold = sprintf("%x", ($configuration->{$board} & 0xf));
$patternSum += $pattern;
$thresholdSum += $threshold;
}
#analyze data from EPICS
my $iSum = 0;
foreach my $n (%$data) {
- if (defined %$data->{$n}->{"val"}) {
- $iSum += %$data->{$n}->{"val"};
+ if (defined $data->{$n}->{"val"}) {
+ $iSum += $data->{$n}->{"val"};
}
}
foreach my $n (%$data) {
- if (defined %$data->{$n}->{"val"}) {
- if (%$data->{$n}->{"val"} > ($iSum / 18) + 0.5) {
+ if (defined $data->{$n}->{"val"}) {
+ if ($data->{$n}->{"val"} > ($iSum / 18) + 0.5) {
$setAlert = 3;
}
}
use warnings;
use Time::HiRes qw(usleep);
+use List::Util qw(min max);
use strict;
use Data::Dumper;
use Hmon;
Hmon::WriteFile("EvtsPerSpill",$str);
my $fqa = QA::OpenQAFile() or die "No connection to QA Logfile";
+my $lastqa = 0;
trb_init_ports() or die trb_strerror();
my $rh_result = trb_register_read(QA::CTSAddress, 0xa002) or $trbneterr = 1; #sleep 5 and next;
my $stopped = trb_register_read(0x3,0xa0c0) or sleep 5 and next;
$stopped = ($stopped->{3} || 0) & 0x400;
-
+
my $sc = trb_register_read(0x3830,0xc00d);
+ if(!defined $sc) {
+ sleep 10;
+ next;
+ }
my $spillcount = $sc->{0x3830} & 0x00ffffff;
my $inspill = ($sc->{0x3830} & 0x80000000) >> 31;
- my $data = Perl2Epics::GetAll();
-
+
$lastspill = $outofspill;
$outofspill = ($rh_result->{QA::CTSAddress} || 0) & 0x10;
$spilllength++ ; #if($outofspill);
$rh_result = trb_register_read(0x0002, 0x01) or $trbneterr = 1; #sleep 5 and next;
- # 0x3000 => a reliable guy to ask about rates
-
+
if($trbneterr == 0) {
my $res = $rh_result->{0x0002} & 0xffff;
$evtrate = $res >= $lastres ? $res - $lastres : ($res + 2**16) - $lastres;
$spillavgshort /= (scalar @spills < 10)?(scalar @spills):10;
$qashort = QA::SciNotation($events)." (".$spilllength."s)";
- $qastate = QA::GetQAState('above', "$events", @QA::LimitTriggerPerSpill);
+ $qastate = min($lastqa,QA::GetQAState('above', "$events", @QA::LimitTriggerPerSpill));
+ $lastqa = QA::GetQAState('above', "$events", @QA::LimitTriggerPerSpill);
$qalong = sprintf("current spill: %s - 10-spill avg. %s - 50-spill avg. %s - Spill length %is",
QA::SciNotation($events),
QA::SciNotation($spillavgshort),
} elsif ($spilllength > 20) {
QA::WriteQALog($fqa, "trg", "spill", 30, QA::NOTE, "Spill Sum",
"No Spills", "No Spills detected at the moment");
-
- if($spilllength >= 25 && !($spilllength%25)) {
- if($data->{'prefix'}->{val} eq 'be') {
+ #print $spilllength."\n" unless $spilllength%10;
+ if($spilllength >= 25 && ($spilllength%25 == 0)) {
+ my $data = Perl2Epics::GetAll();
+ print STDERR $data->{'prefix'}->{val}."\n";
+ if(($data->{'prefix'}->{val} eq '-1') || ($data->{'prefix'}->{val} eq 'be')) {
Hmon::Speak('nobeam', "No beam");
}
}
$plot->{output} = HPlot::OUT_PNG;
$plot->{titles}->[0] = "";
$plot->{xlabel} = "Spill Number";
-$plot->{ylabel} = "Start Counts / Mcnt";
+$plot->{ylabel} = "Hodoscope Counts / Mcnt";
$plot->{sizex} = 630;
$plot->{sizey} = 220;
$plot->{nokey} = 1;
+$plot->{buffer} = 1;
+$plot->{storable} = 1;
HPlot::PlotInit($plot);
-my $str = Hmon::MakeTitle(8,5,"Start Counts per Spill (millions)",0);
+my $str = Hmon::MakeTitle(8,5,"Hodoscope Counts per Spill (millions)",0);
$str .= qq@<img src="%ADDPNG files/StartCountSpills.png%" type="image/png">@;
$str .= Hmon::MakeFooter();
Hmon::WriteFile("StartCountSpill",$str);
$spillsum = 0;
}
$startmsg = sprintf("%s / %s",QA::SciNotation($startsum),QA::SciNotation($lastspillsum));
- $startlongmsg = sprintf("Hodo counts per second %s/s - Hodo counts per spill %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, "Hodo Count", $startmsg, $startlongmsg);
# 0x3000 => ??
- $rh_result = trb_register_read(0x3000, 0x1) or $trbneterr = 1;
- my $res = ($rh_result->{0x3000} || 0) & 0xFFFF;
+ $rh_result = trb_register_read(0x3001, 0x1) or $trbneterr = 1;
+ my $res = ($rh_result->{0x3001} || 0) & 0xFFFF;
$evtrate = $res - ($events || $res);
$evtrate += 2**16 if $evtrate < 0;
use Getopt::Long;
use Data::Dumper;
-my $magnet_on = 1;
+my $magnet_on = 1 - $QA::MagnetOff;
my %range_list = (
'Time' => {},
use HADES::TrbNet;
use HPlot;
+
my $timer = 0;
my @colors = ("#000000", "#ff0000","#00ff00","#0000ff","#cccc00","#009955");
my @names = qw( S1 S2 S3 S4 S5 S6);
die("could not connect to trbnetd");
}
+my $currenterr = 0;
+my $currenterrtimer = 0;
+my $spikeString = "";
###########
#Change 3 for-loops to include all four planes again!
$plot[$p*2+$s]->{name} = "P".$p.($s?'F':'C')."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]->{xscale} = 1;
$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]->{xlabel} = "Seconds";
$plot[$p*2+$s]->{ylabel} = ($s?'F':'C')." Current";
$plot[$p*2+$s]->{sizex} = 700;
$plot[$p*2+$s]->{sizey} = 240;
$plot[$p*2+$s+8]->{name} = "P".$p.($s?'F':'C')."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]->{xscale} = 1;
$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]->{xlabel} = "Seconds";
$plot[$p*2+$s+8]->{ylabel} = ($s?'F':'C')." Voltage";
$plot[$p*2+$s+8]->{sizex} = 700;
$plot[$p*2+$s+8]->{sizey} = 240;
}
}
-
-for(my $i = 1; $i<=4; $i++) {
+### default HV channels:
+ for(my $i = 1; $i<=4; $i++) {
for(my $j = 1; $j<=6; $j++) {
my $s = sprintf("HAD:MDC:HV:P%i:S%i:F:vmon",$i,$j);
Perl2Epics::Connect("$i-$j-0-V",$s);
Perl2Epics::Connect("$i-$j-1-V",$s);
$s = sprintf("HAD:MDC:HV:P%i:S%i:F:imon",$i,$j);
Perl2Epics::Connect("$i-$j-0-I",$s);
- $s = sprintf("HAD:MDC:HV:P%i:S%i:C:imon",$i,$j);
+ $s = sprintf("HAD:MDC:HV:P%i:S%i:C:imon",$i,$j);
Perl2Epics::Connect("$i-$j-1-I",$s);
}
}
+####################################################################
+## CW 2.Oct 2014 individual layer HV:
+for(my $i = 1; $i<=4; $i++) {
+ for(my $j = 1; $j<=6; $j++) {
+ my $s = sprintf("HAD:MDC:HV:Ind%i:F%i:vmon",$i,$j);
+ Perl2Epics::Connect("Ind-$i-$j-0-V",$s);
+ if($j == 6) { $s = sprintf("HAD:MDC:HV:Ind%i:C0%i:vmon",$i,$j);}
+ else { $s = sprintf("HAD:MDC:HV:Ind%i:C%i:vmon",$i,$j);}
+ Perl2Epics::Connect("Ind-$i-$j-1-V",$s);
+ $s = sprintf("HAD:MDC:HV:Ind%i:F%i:imon",$i,$j);
+ Perl2Epics::Connect("Ind-$i-$j-0-I",$s);
+ if($j == 6) { $s = sprintf("HAD:MDC:HV:Ind%i:C0%i:imon",$i,$j);}
+ else { $s = sprintf("HAD:MDC:HV:Ind%i:C%i:imon",$i,$j);}
+ Perl2Epics::Connect("Ind-$i-$j-1-I",$s);
+ }
+ }
+#####################################################################
+
print "Connected.\n";
while(1) {
my $data = Perl2Epics::GetAll();
- my $str = Hmon::MakeTitle(13, 6, "MDC HV", 1, "");
+ my $str = Hmon::MakeTitle(18, 12, "MDC HV", 1, "");
$str .= "<table class=\"rates textbox\">"; #<div id=\"logbox\" class=\"textbox\" >
$str .= "<tr><th><th colspan=1>Sector 1<th colspan=1>Sector 2<th colspan=1>Sector 3<th colspan=1>Sector 4<th colspan=1>Sector 5<th colspan=1>Sector 6";
for(my $i = 1; $i<=4; $i++) {
$curr = -1 unless defined $curr;
HPlot::PlotAdd("P".($i-1).(($v)?'C':'F')."I",$curr,$s-1);
HPlot::PlotAdd("P".($i-1).(($v)?'C':'F')."V",$volt,$s-1);
- my $tmp .= sprintf(" %4i V | %2.2f uA",$volt,$curr);
+ my $tmp .= sprintf(" %4i V | %3.2f uA",$volt,$curr);
$tmp =~ s/\s/ /gi;
$str .= "<td title=\"$tv / $tc\">".$tmp;
+
}
}
#$str .= "<tr><th colspan=7> \n";
}
+ $str .= "</table>\n ";#</div
+ #~ $str .= Hmon::MakeFooter();
+
+####################################################################
+## CW 20. June 2016 individual layer HV:
+ my $data = Perl2Epics::GetAll();
+ #~ my $str = Hmon::MakeTitle(13, 6, "MDC indv. HV", 1, "");
+ $str .= "<br><table class=\"rates textbox\">"; #<div id=\"logbox\" class=\"textbox\" >
+ $str .= "<tr><th><th colspan=1>Layer 1<th colspan=1>Layer 2<th colspan=1>Layer 3<th colspan=1>Layer 4<th colspan=1>Layer 5<th colspan=1>Layer 6/0";
+ for(my $i = 1; $i<=4; $i++) {
+ $str .= "<tr><tr><th colspan=7>Chamber $i\n";
+ for(my $v = 0; $v<=1; $v++) {
+ $str .= "<tr><td>".$layerlabel[$v]." ";
+ for(my $s = 1; $s<=6; $s++) {
+ my $voltI = $data->{"Ind-$i-$s-$v-V"}->{val};
+ my $currI = $data->{"Ind-$i-$s-$v-I"}->{val};
+ my $tvI = strftime("%H:%M:%S",localtime($data->{"Ind-$i-$s-$v-V"}->{tme} || 0));
+ my $tcI = strftime("%H:%M:%S",localtime($data->{"Ind-$i-$s-$v-I"}->{tme} || 0));
+ $voltI = -1 unless defined $voltI;
+ $currI = -1 unless defined $currI;
+ my $tmpI .= sprintf(" %4i V | %3.2f uA",$voltI,$currI);
+ $str .= "<td title=\"$tvI / $tcI\">".$tmpI;
+ }
+ }
+ }
$str .= "</table>\n";#</div
- $str .= Hmon::MakeFooter();
+ $str .= Hmon::MakeFooter();
+####################################################################
+
if(!($timer%1)) {
Hmon::WriteFile("MDCHV", $str);
}
}
+# my $logString = strftime("%Y.%m.%d %H:%M:%S",localtime())."\t";
my @mdcHvMin;
my @mdcHvMax;
my $qastate = QA::OK;
for my $s (1..6) {
for my $i (0..1) {
my $volt = $data->{"$p-$s-$i-V"}->{val};
+ my $current = $data->{"$p-$s-$i-I"}->{val};
if(! defined $mdcHvMin[$p] || $mdcHvMin[$p] > $volt) {
$mdcHvMin[$p] = $volt;
}
if(! defined $mdcHvMax[$p] || $mdcHvMax[$p] < $volt) {
$mdcHvMax[$p] = $volt;
}
+# if($p>2) {
+# $logString .= " ".$volt." ".$current." ";
+# }
+ if($current > 160) {
+ $spikeString .= "P$p S$s F/C $i: HV = ".$volt." , I = ".$current." - ".localtime()."\n";
+ $currenterr++;
+ }
+
}
}
if($mdcHvMax[$p] > $QA::MdcNominalHV[$p-1] + $QA::MdcHVOffsetLimits[0]) {$qastate = max($qastate,QA::WARN);}
if($mdcHvMin[$p] < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits[1]) {$qastate = max($qastate,QA::WARN_2);}
if($mdcHvMin[$p] < $QA::MdcNominalHV[$p-1] - $QA::MdcHVOffsetLimits[2]) {$qastate = max($qastate,QA::ERROR);}
}
-
+ $qastate = min($qastate,$QA::MdcHvOff?QA::NOTE:200);
my $value = sprintf("%.1f/%.1f/%.1f/%.1f",$mdcHvMin[1]/1000.,$mdcHvMin[2]/1000.,$mdcHvMin[3]/1000.,$mdcHvMin[4]/1000.);
my $longtext = "MDC high voltage in all four planes".
"<br>Minimum [V]: ".$mdcHvMin[1]." / ".$mdcHvMin[2]." / ".$mdcHvMin[3]." / ".$mdcHvMin[4].
"<br>Maximum [V]: ".$mdcHvMax[1]." / ".$mdcHvMax[2]." / ".$mdcHvMax[3]." / ".$mdcHvMax[4].
"<br>Nominal [V]: ".$QA::MdcNominalHV[0]." / ".$QA::MdcNominalHV[1]." / ".$QA::MdcNominalHV[2]." / ".$QA::MdcNominalHV[3];
QA::WriteQALog($flog,"other","mdcinvalid",10,$qastate,"MDC HV",$value,$longtext);
+
+
+
+ if($currenterr > 0 ) {
+ $currenterrtimer++;
+ if( $currenterrtimer == 10 && $currenterr < 6){
+ Hmon::SendEmail('c.wendisch@gsi.de',"MDC Current Spike","Currents in MDC was spiking in\n$spikeString");
+ $currenterrtimer = 0;
+ }
+ if ($currenterrtimer == 20 && $currenterr >= 6 ){
+ Hmon::SendEmail('c.wendisch@gsi.de',"MDC OVC","Current in MDC was too high in\n$spikeString");
+ $currenterrtimer = 0;
+ }
+ if($currenterrtimer==0) {
+ $currenterr = 0;
+ $spikeString = "";
+ }
+ }
+ my $fh;
+
+ # $logString .= "\n";
+ # open($fh, ">>",Hmon::HMONDIR."/archive/mdcCurrentslog.csv");
+ # print $fh $logString;
+ # close $fh;
+
$timer++;
sleep(1);
}
# $presserr++;
# }
- for my $i (1..3) {
+ for my $i (1..3) { # CW 1.4.2016 : only for Plane 1 to 3, as pressure values in plane 4 S5&6 are wrong - readout failure
+planes
for my $j (1..6) {
- if($data->{"p$i$j"}->{val} > 50 ) {
- $presserr++;
+ my $pressure_now = $data->{"p$i$j"}->{val};
+ if( $pressure_now < 1.0 || $pressure_now > 55) {
+ # $presserr++;
}
}
}
- if($presserr >= 3) {
- if($presserrtimer == 0) {
+ if($presserr > 0) {
+ $presserrtimer++;
+ if($presserrtimer > 3 && $presserr > 3) {
$presserr = 0;
my $valstr = "";
- $valstr.="CO2 concentration Plane1: ".$data->{"p1CO2"}->{val}." % \n";
- $valstr.="CO2 concentration Plane2: ".$data->{"p2CO2"}->{val}." % \n";
- for my $i (1..3) {
- for my $j (1..6) {
- $valstr.="P$i S$j: ".$data->{"p$i$j"}->{val}."\n";
+ $valstr.="CO2 concentration Plane1: ".$data->{"p1CO2"}->{val}." % \n";
+ $valstr.="CO2 concentration Plane2: ".$data->{"p2CO2"}->{val}." % \n";
+ for my $i (1..4) {
+ for my $j (1..6) {
+ $valstr.="P$i S$j: ".$data->{"p$i$j"}->{val}."\n";
}
}
- $presserrtimer = 90;
- Hmon::SendEmail('c.wendisch@gsi.de',"Warning: MDC Over-Pressure","Pressures in MDC are too high: \n$valstr");
- }
- else {
- $presserrtimer--;
- }
+ $presserrtimer = 0;
+ # Hmon::SendEmail('c.wendisch@gsi.de',"Warning: MDC Over-Pressure","Pressures in MDC are too high: \n$valstr");
+< }
}
-
-
$timer++;
sleep(10);
}
while(1) {
-
- open(PIONLOG, Hmon::HMONDIR."hmon_permanent_tail -F ".Hmon::HMONDIR."pion/scmon.log|");
+
+ open(PIONLOG, Hmon::HMONDIR."hmon_permanent_tail -F ".Hmon::HMONDIR."pion/scmon.log|");
- my $readlines = 0;
- my $str = "";
- my $oldtime = time();
- my $a;
+ my $readlines = 0;
+ my $str = "";
+ my $oldtime = time();
+ my $a;
- while($a = <PIONLOG>) {
- $str = Hmon::MakeTitle(9,11,"PionSupplies",1);
- my @val = split(/\s+/,$a);
+ while($a = <PIONLOG>) {
+ $str = Hmon::MakeTitle(9,11,"PionSupplies",1);
+ my @val = split(/\s+/,$a);
- #$str .= strftime("%H:%M:%S",localtime($val[0]));
- $str .= "<br><table style='margin:auto' class=\"rates \"><tr><th><th>HV (V)<th>HV (μA)<th>Temp. (°C)";
- $str .= sprintf("<tr><th>Pion1:<td>%.1fV<td>%.3fuA<td>%.1f°C",$val[3],$val[4],$val[47]);
- $str .= sprintf("<tr><th>Pion2:<td>%.1fV<td>%.3fuA<td>%.1f°C",$val[25],$val[26],$val[53]);
- $str .= "</table>";
- $str .= qq@<img src="%ADDPNG files/PionHV.png%" type="image/png"><br>\n@;
- $str .= qq@<img src="%ADDPNG files/PionHVCurrent.png%" type="image/png">\n@;
- $str .= Hmon::MakeFooter();
- Hmon::WriteFile("PionSupplies",$str);
-
- HPlot::PlotAdd('HighVoltage',$val[3],0);
- HPlot::PlotAdd('HighVoltage',$val[25],1);
- HPlot::PlotDraw("HighVoltage");
-
- HPlot::PlotAdd('HVCurrent',$val[4],0);
- HPlot::PlotAdd('HVCurrent',$val[26],1);
- HPlot::PlotDraw("HVCurrent");
-
-
- 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);
- $state = QA::WARN if($val[4] > 1.0);
- $state = QA::FATAL if($val[4] > 5);
-
- QA::WriteQALog($flog, "pion", "HV", 30,
- $state, 'Pion 0 HV', $shorttext, $longtext);
+ #$str .= strftime("%H:%M:%S",localtime($val[0]));
+ $str .= "<br><table style='margin:auto' class=\"rates \"><tr><th><th>HV (V)<th>HV (μA)<th>Temp. (°C)";
+ $str .= sprintf("<tr><th>Pion1:<td>%.1fV<td>%.3fuA<td>%.1f°C",$val[3],$val[4],$val[47]);
+ $str .= sprintf("<tr><th>Pion2:<td>%.1fV<td>%.3fuA<td>%.1f°C",$val[25],$val[26],$val[53]);
+ $str .= "</table>";
+ $str .= qq@<img src="%ADDPNG files/PionHV.png%" type="image/png"><br>\n@;
+ $str .= qq@<img src="%ADDPNG files/PionHVCurrent.png%" type="image/png">\n@;
+ $str .= Hmon::MakeFooter();
+ Hmon::WriteFile("PionSupplies",$str);
+
+ HPlot::PlotAdd('HighVoltage',$val[3],0);
+ HPlot::PlotAdd('HighVoltage',$val[25],1);
+ HPlot::PlotDraw("HighVoltage");
+
+ HPlot::PlotAdd('HVCurrent',$val[4],0);
+ HPlot::PlotAdd('HVCurrent',$val[26],1);
+ HPlot::PlotDraw("HVCurrent");
+
+
+ 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);
+ $state = QA::WARN if($val[4] > 1.0);
+ $state = QA::FATAL if($val[4] > 5);
+
+ QA::WriteQALog($flog, "pion", "HV", 30,
+ $state, '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::WARN if($val[26] > 1.5);
- $state = QA::FATAL if($val[26] > 5);
-
- QA::WriteQALog($flog, "pion", "HVcurr", 30,
- $state, 'Pion 1 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::WARN if($val[26] > 1.5);
+ $state = QA::FATAL if($val[26] > 5);
+
+ QA::WriteQALog($flog, "pion", "HVcurr", 30,
+ $state, 'Pion 1 HV', $shorttext, $longtext);
- $shorttext = sprintf("%.1f° / %.1f°",$val[47],$val[53]);
- $longtext = sprintf("Pion 1: is %.1f°, soll %.1f°<br>Pion 2: is %.1f°, soll %.1f°",$val[47],$val[49],$val[53],$val[55]);
- $state = QA::OK;
- $state = QA::WARN if($val[47]>-15 || $val[53]>-15);
-
-
- QA::WriteQALog($flog, "pion", "cooling", 120,
- $state, 'Pion Cool', $shorttext, $longtext);
-
+ $shorttext = sprintf("%.1f° / %.1f°", $val[47], $val[53]);
+ $longtext = sprintf("Pion 1: is %.1f°, soll %.1f°<br>Pion 2: is %.1f°, soll %.1f°", $val[47], $val[49], $val[53], $val[55]);
+ $state = QA::OK;
+ $state = QA::WARN if ($val[47] >-15 || $val[53] >- 15);
+ if ($val[50] != 1 || $val[56] != 1) {
+ $longtext = $longtext . sprintf("<br>--------- CHILLER OFFLINE ERROR ---------<br> Pion1: %s<br>Pion2: %s", \
+ $val[50] != 1 ? "OFF" : "ON", $val[56] != 1 ? "OFF" : "ON");
+ $state = QA::ERROR;
+ }
+
+ QA::WriteQALog($flog, "pion", "cooling", 120,
+ $state, 'Pion Cool', $shorttext, $longtext);
}
}
$str .= "<tr><th>Volt.";
for(my $v = 1; $v<=6; $v++) {
$str .= sprintf("<td> %i V\n",$data->{"U$v"}->{val} || -1);
- $min = min($min,$data->{"U$v"}->{val}||1E6);
- $max = max($max,$data->{"U$v"}->{val}||0);
+ $min = min($min,$data->{"U$v"}->{val}||-1);
+ $max = max($max,$data->{"U$v"}->{val}||-1);
}
$str .= "</table>\n";
$str .= qq@<img src="%ADDPNG files/RichCurr.png%" type="image/png">\n@;
else {
$errortimer = 0;
}
- if($errortimer >= 800) {
+ if($errortimer >= 800 && !$QA::RichHvOff) {
$qastate = QA::ERROR;
if (!($errortimer%200)) {
Hmon::Speak('richhv', "Rich high voltage error");
}
}
+$qastate = QA::NOTE if ($QA::RichHvOff == 1);
+
if( $timer % (4*$OVERCURRENT_period) == 0) {
$value = sprintf("%.2f / %.2f kV",$min/1000,$max/1000);
$longtext = sprintf("Averaged current in RICH HV: %i uA",$current_average);
- $longtext.= sprintf("<br>HV settings: %i, %i, %i, %i, %i, %i V", $data->{"U1"}->{val}, $data->{"U2"}->{val},
- $data->{"U3"}->{val}, $data->{"U4"}->{val},
- $data->{"U5"}->{val}, $data->{"U6"}->{val});
+ $longtext.= sprintf("<br>HV settings: %i, %i, %i, %i, %i, %i V", $data->{"U1"}->{val}||-1, $data->{"U2"}->{val}||-1,
+ $data->{"U3"}->{val}||-1, $data->{"U4"}->{val}||-1,
+ $data->{"U5"}->{val}||-1, $data->{"U6"}->{val}||-1);
#print "current_average: $current_average, sum: $current_sum\n";
-
+
$current_sum = 0;
QA::WriteQALog($flog,"other","rich",30,$qastate,"RICH HV",$value,$longtext);
}
for(my $i = 1; $i<=6;$i++) {
- HPlot::PlotAdd("RichCurr",$data->{"I$i"}->{val},$i-1);
+ HPlot::PlotAdd("RichCurr",$data->{"I$i"}->{val}||-1,$i-1);
}
if($timer%8 == 0) {
HPlot::PlotDraw("RichCurr");
for(my $i = 1; $i<=6;$i++) {
- HPlot::PlotAdd("RichCurrLong",$data->{"I$i"}->{val},$i-1);
+ HPlot::PlotAdd("RichCurrLong",$data->{"I$i"}->{val}||-1,$i-1);
}
HPlot::PlotDraw("RichCurrLong");
}
my @names;
my $errorcounter;
+
+
+#HAD:FWHV:G7:status:alive:roc:average
+
my @variables = qw(
HAD:TOFHV:G1:status:alive:roc:average
HAD:TOFHV:G4:status:alive:roc:average
HAD:TOFHV:G5:status:alive:roc:average
HAD:TOFHV:G6:status:alive:roc:average
-HAD:FWHV:G7:status:alive:roc:average
HAD:RPCHV:G8:status:alive:roc:average
HAD:RPCHV:G9:status:alive:roc:average
HAD:RICH:HV:G25:status:alive:roc:average
Perl2Epics::Connect($name,$v);
}
-sleep(10);
+sleep(10);
+Perl2Epics::GetAll();
+sleep(20);
while(1) {
my $qastate = QA::OK;
ssh -f -R 8888:hades33.gsi.de:80 -R 3060:hades33.gsi.de:80 -R 8889:hades33.gsi.de:1234 -R 9999:lxhadeb06.gsi.de:80 cerberus.x-matter.uni-frankfurt.de -N &
fi
-killall speakdaemon.pl
+killall -f speakdaemon.pl
cd /home/hadaq/trbsoft/hadesdaq/hmon/
# cd permanent